2019-09-30 21:07:59 +05:30
|
|
|
import Vue from 'vue';
|
2020-04-08 14:13:33 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
2021-04-17 20:07:23 +05:30
|
|
|
import BoardsSelector from 'ee_else_ce/boards/components/boards_selector.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import store from '~/boards/stores';
|
2020-04-08 14:13:33 +05:30
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2019-09-30 21:07:59 +05:30
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
2022-04-04 11:22:00 +05:30
|
|
|
defaultClient: createDefaultClient(),
|
2020-04-08 14:13:33 +05:30
|
|
|
});
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
export default (params = {}) => {
|
2019-09-30 21:07:59 +05:30
|
|
|
const boardsSwitcherElement = document.getElementById('js-multiple-boards-switcher');
|
2021-12-11 22:18:48 +05:30
|
|
|
const { dataset } = boardsSwitcherElement;
|
2019-09-30 21:07:59 +05:30
|
|
|
return new Vue({
|
|
|
|
el: boardsSwitcherElement,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'BoardsSelectorRoot',
|
2019-09-30 21:07:59 +05:30
|
|
|
components: {
|
|
|
|
BoardsSelector,
|
|
|
|
},
|
2020-04-08 14:13:33 +05:30
|
|
|
apolloProvider,
|
2021-03-11 19:13:27 +05:30
|
|
|
store,
|
2021-03-08 18:12:59 +05:30
|
|
|
provide: {
|
|
|
|
fullPath: params.fullPath,
|
|
|
|
rootPath: params.rootPath,
|
2021-12-11 22:18:48 +05:30
|
|
|
allowScopedLabels: params.allowScopedLabels,
|
|
|
|
labelsManagePath: params.labelsManagePath,
|
|
|
|
allowLabelCreate: parseBoolean(dataset.canAdminBoard),
|
2021-03-08 18:12:59 +05:30
|
|
|
},
|
2019-09-30 21:07:59 +05:30
|
|
|
data() {
|
|
|
|
const boardsSelectorProps = {
|
|
|
|
...dataset,
|
|
|
|
hasMissingBoards: parseBoolean(dataset.hasMissingBoards),
|
|
|
|
canAdminBoard: parseBoolean(dataset.canAdminBoard),
|
|
|
|
multipleIssueBoardsAvailable: parseBoolean(dataset.multipleIssueBoardsAvailable),
|
|
|
|
scopedIssueBoardFeatureEnabled: parseBoolean(dataset.scopedIssueBoardFeatureEnabled),
|
|
|
|
weights: JSON.parse(dataset.weights),
|
|
|
|
};
|
|
|
|
|
|
|
|
return { boardsSelectorProps };
|
|
|
|
},
|
|
|
|
render(createElement) {
|
2021-11-11 11:23:49 +05:30
|
|
|
return createElement(BoardsSelector, {
|
2019-09-30 21:07:59 +05:30
|
|
|
props: this.boardsSelectorProps,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|