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

upload_file_experiment.js « projects « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a7519f2bce841ecedf51cd4748779e08840aedb7 (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
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import createRouter from '~/repository/router';
import UploadButton from './details/upload_button.vue';

export const initUploadFileTrigger = () => {
  const uploadFileTriggerEl = document.querySelector('.js-upload-file-experiment-trigger');

  if (!uploadFileTriggerEl) return false;

  const {
    targetBranch,
    originalBranch,
    canPushCode,
    path,
    projectPath,
  } = uploadFileTriggerEl.dataset;

  return new Vue({
    el: uploadFileTriggerEl,
    router: createRouter(projectPath, originalBranch),
    provide: {
      targetBranch,
      originalBranch,
      canPushCode: parseBoolean(canPushCode),
      path,
      projectPath,
    },
    render(h) {
      return h(UploadButton);
    },
  });
};