2018-02-27 19:10:43 -05:00
|
|
|
import Vue from 'vue';
|
2020-06-01 02:08:21 -04:00
|
|
|
import store from '~/mr_notes/stores';
|
2021-02-05 16:09:19 -05:00
|
|
|
import initCherryPickCommitModal from '~/projects/commit/init_cherry_pick_commit_modal';
|
2021-02-04 04:09:30 -05:00
|
|
|
import initRevertCommitModal from '~/projects/commit/init_revert_commit_modal';
|
2018-06-21 08:22:40 -04:00
|
|
|
import initDiffsApp from '../diffs';
|
2021-02-14 13:09:20 -05:00
|
|
|
import { resetServiceWorkersPublicPath } from '../lib/utils/webpack';
|
|
|
|
import MergeRequest from '../merge_request';
|
2018-02-27 19:10:43 -05:00
|
|
|
import discussionCounter from '../notes/components/discussion_counter.vue';
|
2018-10-23 05:49:45 -04:00
|
|
|
import initDiscussionFilters from '../notes/discussion_filters';
|
2020-03-26 05:07:52 -04:00
|
|
|
import initSortDiscussions from '../notes/sort_discussions';
|
2021-02-01 10:08:56 -05:00
|
|
|
import initNotesApp from './init_notes';
|
2018-02-27 19:10:43 -05:00
|
|
|
|
2018-03-02 16:16:11 -05:00
|
|
|
export default function initMrNotes() {
|
2019-02-08 09:06:24 -05:00
|
|
|
resetServiceWorkersPublicPath();
|
|
|
|
|
2018-06-21 08:22:40 -04:00
|
|
|
const mrShowNode = document.querySelector('.merge-request');
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new MergeRequest({
|
|
|
|
action: mrShowNode.dataset.mrAction,
|
|
|
|
});
|
|
|
|
|
2021-09-09 11:09:24 -04:00
|
|
|
initDiffsApp(store);
|
2019-03-04 06:27:57 -05:00
|
|
|
initNotesApp();
|
2018-02-27 19:10:43 -05:00
|
|
|
|
2021-02-01 10:08:56 -05:00
|
|
|
document.addEventListener('merged:UpdateActions', () => {
|
2021-11-15 10:10:57 -05:00
|
|
|
initRevertCommitModal('i_code_review_post_merge_submit_revert_modal');
|
|
|
|
initCherryPickCommitModal('i_code_review_post_merge_submit_cherry_pick_modal');
|
2021-02-01 10:08:56 -05:00
|
|
|
});
|
|
|
|
|
2021-09-09 11:09:24 -04:00
|
|
|
requestIdleCallback(() => {
|
|
|
|
const el = document.getElementById('js-vue-discussion-counter');
|
2018-06-21 08:22:40 -04:00
|
|
|
|
2021-09-09 11:09:24 -04:00
|
|
|
if (el) {
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
|
|
|
name: 'DiscussionCounter',
|
|
|
|
components: {
|
|
|
|
discussionCounter,
|
|
|
|
},
|
|
|
|
store,
|
|
|
|
render(createElement) {
|
|
|
|
return createElement('discussion-counter');
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
initDiscussionFilters(store);
|
|
|
|
initSortDiscussions(store);
|
|
|
|
});
|
2018-03-02 16:16:11 -05:00
|
|
|
}
|