summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/confidential_merge_request/index.js
blob: 9672821d30e3079dcd67a683af19907b956f0afc (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
import Vue from 'vue';
import { parseBoolean } from '../lib/utils/common_utils';
import ProjectFormGroup from './components/project_form_group.vue';
import state from './state';

export function isConfidentialIssue() {
  return parseBoolean(document.querySelector('.js-create-mr').dataset.isConfidential);
}

export function canCreateConfidentialMergeRequest() {
  return isConfidentialIssue() && Object.keys(state.selectedProject).length > 0;
}

export function init() {
  const el = document.getElementById('js-forked-project');

  return new Vue({
    el,
    render(h) {
      return h(ProjectFormGroup, {
        props: {
          namespacePath: el.dataset.namespacePath,
          projectPath: el.dataset.projectPath,
          newForkPath: el.dataset.newForkPath,
          helpPagePath: el.dataset.helpPagePath,
        },
      });
    },
  });
}