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

index.js « abuse_report « admin « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c2117130d26b649943365e356e37ba842a31a218 (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
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { defaultClient } from '~/graphql_shared/issuable_client';
import AbuseReportApp from './components/abuse_report_app.vue';

Vue.use(VueApollo);

const apolloProvider = new VueApollo({
  defaultClient,
});

export const initAbuseReportApp = () => {
  const el = document.querySelector('#js-abuse-reports-detail-view');

  if (!el) {
    return null;
  }

  const { abuseReportData, abuseReportsListPath } = el.dataset;
  const abuseReport = convertObjectPropsToCamelCase(JSON.parse(abuseReportData), {
    deep: true,
  });

  return new Vue({
    el,
    apolloProvider,
    name: 'AbuseReportAppRoot',
    provide: {
      allowScopedLabels: false,
      updatePath: abuseReport.report.updatePath,
      listPath: abuseReportsListPath,
      labelsManagePath: '',
      allowLabelCreate: true,
    },
    render: (createElement) =>
      createElement(AbuseReportApp, {
        props: {
          abuseReport,
        },
      }),
  });
};