debian-mirror-gitlab/app/assets/javascripts/mr_notes/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-03-27 19:54:05 +05:30
import Vue from 'vue';
2020-06-23 00:09:42 +05:30
import store from '~/mr_notes/stores';
2021-03-11 19:13:27 +05:30
import initCherryPickCommitModal from '~/projects/commit/init_cherry_pick_commit_modal';
import initRevertCommitModal from '~/projects/commit/init_revert_commit_modal';
2018-11-08 19:23:39 +05:30
import initDiffsApp from '../diffs';
2021-03-11 19:13:27 +05:30
import { resetServiceWorkersPublicPath } from '../lib/utils/webpack';
import MergeRequest from '../merge_request';
2022-10-11 01:57:18 +05:30
import DiscussionCounter from '../notes/components/discussion_counter.vue';
2021-03-11 19:13:27 +05:30
import initNotesApp from './init_notes';
2018-03-27 19:54:05 +05:30
export default function initMrNotes() {
2019-03-02 22:35:43 +05:30
resetServiceWorkersPublicPath();
2018-11-08 19:23:39 +05:30
const mrShowNode = document.querySelector('.merge-request');
// eslint-disable-next-line no-new
new MergeRequest({
action: mrShowNode.dataset.mrAction,
});
2021-11-11 11:23:49 +05:30
initDiffsApp(store);
2019-07-07 11:18:12 +05:30
initNotesApp();
2018-03-27 19:54:05 +05:30
2021-03-11 19:13:27 +05:30
document.addEventListener('merged:UpdateActions', () => {
2021-12-11 22:18:48 +05:30
initRevertCommitModal('i_code_review_post_merge_submit_revert_modal');
initCherryPickCommitModal('i_code_review_post_merge_submit_cherry_pick_modal');
2021-03-11 19:13:27 +05:30
});
2021-11-11 11:23:49 +05:30
requestIdleCallback(() => {
const el = document.getElementById('js-vue-discussion-counter');
2018-11-08 19:23:39 +05:30
2021-11-11 11:23:49 +05:30
if (el) {
2022-07-16 23:28:13 +05:30
const { blocksMerge } = el.dataset;
2021-11-11 11:23:49 +05:30
// eslint-disable-next-line no-new
new Vue({
el,
name: 'DiscussionCounter',
components: {
2022-10-11 01:57:18 +05:30
DiscussionCounter,
2021-11-11 11:23:49 +05:30
},
store,
render(createElement) {
2022-07-16 23:28:13 +05:30
return createElement('discussion-counter', {
props: {
blocksMerge: blocksMerge === 'true',
},
});
2021-11-11 11:23:49 +05:30
},
});
}
});
2018-03-27 19:54:05 +05:30
}