debian-mirror-gitlab/app/assets/javascripts/pages/admin/jobs/index/index.js

37 lines
940 B
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import Vue from 'vue';
2021-03-11 19:13:27 +05:30
import { BV_SHOW_MODAL } from '~/lib/utils/constants';
2018-03-17 18:26:18 +05:30
import Translate from '~/vue_shared/translate';
import stopJobsModal from './components/stop_jobs_modal.vue';
Vue.use(Translate);
2021-09-30 23:02:18 +05:30
function initJobs() {
2021-01-29 00:20:46 +05:30
const buttonId = 'js-stop-jobs-button';
const modalId = 'stop-jobs-modal';
const stopJobsButton = document.getElementById(buttonId);
2018-03-27 19:54:05 +05:30
if (stopJobsButton) {
// eslint-disable-next-line no-new
new Vue({
2021-01-29 00:20:46 +05:30
el: `#js-${modalId}`,
2018-03-27 19:54:05 +05:30
components: {
stopJobsModal,
},
mounted() {
stopJobsButton.classList.remove('disabled');
2021-01-29 00:20:46 +05:30
stopJobsButton.addEventListener('click', () => {
2021-03-11 19:13:27 +05:30
this.$root.$emit(BV_SHOW_MODAL, modalId, `#${buttonId}`);
2021-01-29 00:20:46 +05:30
});
2018-03-27 19:54:05 +05:30
},
render(createElement) {
2021-01-29 00:20:46 +05:30
return createElement(modalId, {
2018-03-27 19:54:05 +05:30
props: {
url: stopJobsButton.dataset.url,
},
});
},
});
}
2021-09-30 23:02:18 +05:30
}
initJobs();