2023-03-04 22:38:38 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2023-05-27 22:25:52 +05:30
|
|
|
import { DropdownVariant } from '~/sidebar/components/labels/labels_select_widget/constants';
|
|
|
|
import { WORKSPACE_PROJECT } from '~/issues/constants';
|
2023-03-04 22:38:38 +05:30
|
|
|
import IssuableLabelSelector from '~/vue_shared/issuable/create/components/issuable_label_selector.vue';
|
|
|
|
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(),
|
|
|
|
});
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const el = document.querySelector('.js-issuable-form-label-selector');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
|
|
|
fieldName,
|
|
|
|
fullPath,
|
|
|
|
initialLabels,
|
|
|
|
issuableType,
|
|
|
|
labelsFilterBasePath,
|
|
|
|
labelsManagePath,
|
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
provide: {
|
|
|
|
allowLabelCreate: true,
|
|
|
|
allowLabelEdit: true,
|
|
|
|
allowLabelRemove: true,
|
|
|
|
allowScopedLabels: true,
|
|
|
|
attrWorkspacePath: fullPath,
|
|
|
|
fieldName,
|
|
|
|
fullPath,
|
|
|
|
initialLabels: JSON.parse(initialLabels),
|
|
|
|
issuableType,
|
2023-05-27 22:25:52 +05:30
|
|
|
labelType: WORKSPACE_PROJECT,
|
2023-03-04 22:38:38 +05:30
|
|
|
labelsFilterBasePath,
|
|
|
|
labelsManagePath,
|
|
|
|
variant: DropdownVariant.Embedded,
|
2023-05-27 22:25:52 +05:30
|
|
|
workspaceType: WORKSPACE_PROJECT,
|
2023-03-04 22:38:38 +05:30
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(IssuableLabelSelector);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|