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

index.js « new « creations « merge_requests « projects « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b3868653d6a1d96327acc066b9cac1533a1d10e6 (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
import $ from 'jquery';
import Vue from 'vue';
import initPipelines from '~/commit/pipelines/pipelines_bundle';
import MergeRequest from '~/merge_request';
import TargetProjectDropdown from '~/merge_requests/components/target_project_dropdown.vue';
import initCompare from './compare';

const mrNewCompareNode = document.querySelector('.js-merge-request-new-compare');
if (mrNewCompareNode) {
  initCompare(mrNewCompareNode);

  const el = document.getElementById('js-target-project-dropdown');
  const { targetProjectsPath, currentProject } = el.dataset;

  // eslint-disable-next-line no-new
  new Vue({
    el,
    name: 'TargetProjectDropdown',
    provide: {
      targetProjectsPath,
      currentProject: JSON.parse(currentProject),
    },
    render(h) {
      return h(TargetProjectDropdown, {
        on: {
          'project-selected': function projectSelectedFunction(refsUrl) {
            const $targetBranchDropdown = $('.js-target-branch');
            $targetBranchDropdown.data('refsUrl', refsUrl);
            $targetBranchDropdown.data('deprecatedJQueryDropdown').clearMenu();
          },
        },
      });
    },
  });
} else {
  const mrNewSubmitNode = document.querySelector('.js-merge-request-new-submit');
  // eslint-disable-next-line no-new
  new MergeRequest({
    action: mrNewSubmitNode.dataset.mrSubmitAction,
  });
  initPipelines();
}