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

index.js « index « jobs « admin « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a4d89889d576ff354c314eee6b8e3d27ead33165 (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
import Vue from 'vue';
import { BV_SHOW_MODAL } from '~/lib/utils/constants';
import Translate from '~/vue_shared/translate';
import stopJobsModal from './components/stop_jobs_modal.vue';

Vue.use(Translate);

function initJobs() {
  const buttonId = 'js-stop-jobs-button';
  const modalId = 'stop-jobs-modal';
  const stopJobsButton = document.getElementById(buttonId);
  if (stopJobsButton) {
    // eslint-disable-next-line no-new
    new Vue({
      el: `#js-${modalId}`,
      components: {
        stopJobsModal,
      },
      mounted() {
        stopJobsButton.classList.remove('disabled');
        stopJobsButton.addEventListener('click', () => {
          this.$root.$emit(BV_SHOW_MODAL, modalId, `#${buttonId}`);
        });
      },
      render(createElement) {
        return createElement(modalId, {
          props: {
            url: stopJobsButton.dataset.url,
          },
        });
      },
    });
  }
}

initJobs();