1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import createStore from './store';
import AddContextCommitsModalTrigger from './components/add_context_commits_modal_trigger.vue';
import AddContextCommitsModalWrapper from './components/add_context_commits_modal_wrapper.vue';
export default function initAddContextCommitsTriggers() {
const addContextCommitsModalTriggerEl = document.querySelector('.add-review-item-modal-trigger');
const addContextCommitsModalWrapperEl = document.querySelector('.add-review-item-modal-wrapper');
if (addContextCommitsModalTriggerEl || addContextCommitsModalWrapperEl) {
// eslint-disable-next-line no-new
new Vue({
el: addContextCommitsModalTriggerEl,
data() {
const { commitsEmpty, contextCommitsEmpty } = this.$options.el.dataset;
return {
commitsEmpty: parseBoolean(commitsEmpty),
contextCommitsEmpty: parseBoolean(contextCommitsEmpty),
};
},
render(createElement) {
return createElement(AddContextCommitsModalTrigger, {
props: {
commitsEmpty: this.commitsEmpty,
contextCommitsEmpty: this.contextCommitsEmpty,
},
});
},
});
const store = createStore();
// eslint-disable-next-line no-new
new Vue({
el: addContextCommitsModalWrapperEl,
store,
data() {
const {
contextCommitsPath,
targetBranch,
mergeRequestIid,
projectId,
} = this.$options.el.dataset;
return {
contextCommitsPath,
targetBranch,
mergeRequestIid: Number(mergeRequestIid),
projectId: Number(projectId),
};
},
render(createElement) {
return createElement(AddContextCommitsModalWrapper, {
props: {
contextCommitsPath: this.contextCommitsPath,
targetBranch: this.targetBranch,
mergeRequestIid: this.mergeRequestIid,
projectId: this.projectId,
},
});
},
});
}
}
|