2019-07-17 16:42:33 -04:00
|
|
|
import Vue from 'vue';
|
2020-03-10 05:08:10 -04:00
|
|
|
import VueApollo from 'vue-apollo';
|
2021-02-18 16:10:43 -05:00
|
|
|
import BoardsSelector from 'ee_else_ce/boards/components/boards_selector.vue';
|
2021-02-08 22:09:18 -05:00
|
|
|
import store from '~/boards/stores';
|
2020-03-10 05:08:10 -04:00
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2019-07-17 16:42:33 -04:00
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
|
2020-03-10 05:08:10 -04:00
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
2022-02-14 07:14:02 -05:00
|
|
|
defaultClient: createDefaultClient(),
|
2020-03-10 05:08:10 -04:00
|
|
|
});
|
|
|
|
|
2020-12-23 10:09:54 -05:00
|
|
|
export default (params = {}) => {
|
2019-07-17 16:42:33 -04:00
|
|
|
const boardsSwitcherElement = document.getElementById('js-multiple-boards-switcher');
|
2021-11-02 05:09:49 -04:00
|
|
|
const { dataset } = boardsSwitcherElement;
|
2019-07-17 16:42:33 -04:00
|
|
|
return new Vue({
|
|
|
|
el: boardsSwitcherElement,
|
2022-02-16 07:13:53 -05:00
|
|
|
name: 'BoardsSelectorRoot',
|
2019-07-17 16:42:33 -04:00
|
|
|
components: {
|
|
|
|
BoardsSelector,
|
|
|
|
},
|
2020-03-10 05:08:10 -04:00
|
|
|
apolloProvider,
|
2021-02-08 22:09:18 -05:00
|
|
|
store,
|
2021-01-12 07:10:49 -05:00
|
|
|
provide: {
|
|
|
|
fullPath: params.fullPath,
|
|
|
|
rootPath: params.rootPath,
|
2021-11-02 05:09:49 -04:00
|
|
|
allowScopedLabels: params.allowScopedLabels,
|
|
|
|
labelsManagePath: params.labelsManagePath,
|
|
|
|
allowLabelCreate: parseBoolean(dataset.canAdminBoard),
|
2021-01-12 07:10:49 -05:00
|
|
|
},
|
2019-07-17 16:42:33 -04:00
|
|
|
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-08-31 11:10:29 -04:00
|
|
|
return createElement(BoardsSelector, {
|
2019-07-17 16:42:33 -04:00
|
|
|
props: this.boardsSelectorProps,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|