2023-03-04 22:38:38 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import VueApollo from 'vue-apollo';
|
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2023-07-09 08:55:56 +05:30
|
|
|
import { VARIANT_EMBEDDED } from '~/sidebar/components/labels/labels_select_widget/constants';
|
2023-05-27 22:25:52 +05:30
|
|
|
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,
|
2023-07-09 08:55:56 +05:30
|
|
|
variant: VARIANT_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);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|