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

index.js « work_items « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0b7f9290d6e931a6babd463c31f883ca9d7b2a30 (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
54
55
56
57
58
59
60
61
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { WORKSPACE_GROUP } from '~/issues/constants';
import { parseBoolean } from '~/lib/utils/common_utils';
import { apolloProvider } from '~/graphql_shared/issuable_client';
import App from './components/app.vue';
import WorkItemRoot from './pages/work_item_root.vue';
import { createRouter } from './router';

Vue.use(VueApollo);

export const initWorkItemsRoot = (workspace) => {
  const el = document.querySelector('#js-work-items');

  if (!el) {
    return undefined;
  }

  const {
    fullPath,
    hasIssueWeightsFeature,
    iid,
    issuesListPath,
    registerPath,
    signInPath,
    hasIterationsFeature,
    hasOkrsFeature,
    hasIssuableHealthStatusFeature,
    newCommentTemplatePath,
    reportAbusePath,
  } = el.dataset;

  const Component = workspace === WORKSPACE_GROUP ? WorkItemRoot : App;

  return new Vue({
    el,
    name: 'WorkItemsRoot',
    router: createRouter(el.dataset.fullPath),
    apolloProvider,
    provide: {
      fullPath,
      isGroup: workspace === WORKSPACE_GROUP,
      hasIssueWeightsFeature: parseBoolean(hasIssueWeightsFeature),
      hasOkrsFeature: parseBoolean(hasOkrsFeature),
      issuesListPath,
      registerPath,
      signInPath,
      hasIterationsFeature: parseBoolean(hasIterationsFeature),
      hasIssuableHealthStatusFeature: parseBoolean(hasIssuableHealthStatusFeature),
      newCommentTemplatePath,
      reportAbusePath,
    },
    render(createElement) {
      return createElement(Component, {
        props: {
          iid: workspace === WORKSPACE_GROUP ? iid : undefined,
        },
      });
    },
  });
};