Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issuable_label_selector.js « issuable « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b4e277a0b31a912537f35e93fcacd97fe9abed68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import { VARIANT_EMBEDDED } from '~/sidebar/components/labels/labels_select_widget/constants';
import { WORKSPACE_PROJECT } from '~/issues/constants';
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,
      labelType: WORKSPACE_PROJECT,
      labelsFilterBasePath,
      labelsManagePath,
      variant: VARIANT_EMBEDDED,
      workspaceType: WORKSPACE_PROJECT,
    },
    render(createElement) {
      return createElement(IssuableLabelSelector);
    },
  });
};