debian-mirror-gitlab/app/assets/javascripts/projects/compare/index.js

70 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import Vue from 'vue';
import CompareApp from './components/app.vue';
2021-04-17 20:07:23 +05:30
import CompareAppLegacy from './components/app_legacy.vue';
2021-03-11 19:13:27 +05:30
export default function init() {
const el = document.getElementById('js-compare-selector');
2021-04-17 20:07:23 +05:30
if (gon.features?.compareRepoDropdown) {
const {
refsProjectPath,
paramsFrom,
paramsTo,
projectCompareIndexPath,
projectMergeRequestPath,
createMrPath,
projectTo,
projectsFrom,
} = el.dataset;
return new Vue({
el,
components: {
CompareApp,
},
render(createElement) {
return createElement(CompareApp, {
props: {
refsProjectPath,
paramsFrom,
paramsTo,
projectCompareIndexPath,
projectMergeRequestPath,
createMrPath,
2021-06-08 01:23:25 +05:30
defaultProject: JSON.parse(projectTo),
projects: JSON.parse(projectsFrom),
2021-04-17 20:07:23 +05:30
},
});
},
});
}
2021-03-11 19:13:27 +05:30
const {
refsProjectPath,
paramsFrom,
paramsTo,
projectCompareIndexPath,
projectMergeRequestPath,
createMrPath,
} = el.dataset;
return new Vue({
el,
components: {
2021-04-17 20:07:23 +05:30
CompareAppLegacy,
2021-03-11 19:13:27 +05:30
},
render(createElement) {
2021-04-17 20:07:23 +05:30
return createElement(CompareAppLegacy, {
2021-03-11 19:13:27 +05:30
props: {
refsProjectPath,
paramsFrom,
paramsTo,
projectCompareIndexPath,
projectMergeRequestPath,
createMrPath,
},
});
},
});
}