2019-11-06 16:06:44 -05:00
|
|
|
import Vue from 'vue';
|
2020-05-13 05:08:37 -04:00
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
import IssuableListRootApp from './components/issuable_list_root_app.vue';
|
2019-11-06 16:06:44 -05:00
|
|
|
import IssuablesListApp from './components/issuables_list_app.vue';
|
|
|
|
|
2020-05-13 05:08:37 -04:00
|
|
|
function mountIssuableListRootApp() {
|
|
|
|
const el = document.querySelector('.js-projects-issues-root');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const defaultClient = createDefaultClient();
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient,
|
|
|
|
});
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
render(createComponent) {
|
|
|
|
return createComponent(IssuableListRootApp, {
|
|
|
|
props: {
|
|
|
|
canEdit: parseBoolean(el.dataset.canEdit),
|
|
|
|
isJiraConfigured: parseBoolean(el.dataset.isJiraConfigured),
|
2020-05-19 11:08:04 -04:00
|
|
|
issuesPath: el.dataset.issuesPath,
|
2020-05-13 05:08:37 -04:00
|
|
|
projectPath: el.dataset.projectPath,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function mountIssuablesListApp() {
|
|
|
|
if (!gon.features?.vueIssuablesList) {
|
2019-11-06 16:06:44 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
document.querySelectorAll('.js-issuables-list').forEach(el => {
|
|
|
|
const { canBulkEdit, ...data } = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
render(createElement) {
|
2020-05-13 05:08:37 -04:00
|
|
|
return createElement(IssuablesListApp, {
|
|
|
|
props: {
|
|
|
|
...data,
|
|
|
|
canBulkEdit: Boolean(canBulkEdit),
|
|
|
|
},
|
|
|
|
});
|
2019-11-06 16:06:44 -05:00
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2020-05-13 05:08:37 -04:00
|
|
|
|
|
|
|
export default function initIssuablesList() {
|
|
|
|
mountIssuableListRootApp();
|
|
|
|
mountIssuablesListApp();
|
|
|
|
}
|