2019-07-17 20:42:33 +00:00
|
|
|
import Vue from 'vue';
|
2020-03-10 09:08:10 +00:00
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2019-07-17 20:42:33 +00:00
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
import BoardsSelector from '~/boards/components/boards_selector.vue';
|
|
|
|
|
2020-03-10 09:08:10 +00:00
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
2019-07-17 20:42:33 +00:00
|
|
|
export default () => {
|
|
|
|
const boardsSwitcherElement = document.getElementById('js-multiple-boards-switcher');
|
|
|
|
return new Vue({
|
|
|
|
el: boardsSwitcherElement,
|
|
|
|
components: {
|
|
|
|
BoardsSelector,
|
|
|
|
},
|
2020-03-10 09:08:10 +00:00
|
|
|
apolloProvider,
|
2019-07-17 20:42:33 +00:00
|
|
|
data() {
|
|
|
|
const { dataset } = boardsSwitcherElement;
|
|
|
|
|
|
|
|
const boardsSelectorProps = {
|
|
|
|
...dataset,
|
|
|
|
currentBoard: JSON.parse(dataset.currentBoard),
|
|
|
|
hasMissingBoards: parseBoolean(dataset.hasMissingBoards),
|
|
|
|
canAdminBoard: parseBoolean(dataset.canAdminBoard),
|
|
|
|
multipleIssueBoardsAvailable: parseBoolean(dataset.multipleIssueBoardsAvailable),
|
|
|
|
projectId: Number(dataset.projectId),
|
|
|
|
groupId: Number(dataset.groupId),
|
|
|
|
scopedIssueBoardFeatureEnabled: parseBoolean(dataset.scopedIssueBoardFeatureEnabled),
|
|
|
|
weights: JSON.parse(dataset.weights),
|
|
|
|
};
|
|
|
|
|
|
|
|
return { boardsSelectorProps };
|
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(BoardsSelector, {
|
|
|
|
props: this.boardsSelectorProps,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|