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';
|
2023-01-13 00:05:48 +05:30
|
|
|
import { STOP_JOBS_MODAL_ID } from './components/constants';
|
2022-10-11 01:57:18 +05:30
|
|
|
import StopJobsModal from './components/stop_jobs_modal.vue';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
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 stopJobsButton = document.getElementById(buttonId);
|
2018-03-27 19:54:05 +05:30
|
|
|
if (stopJobsButton) {
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
2023-01-13 00:05:48 +05:30
|
|
|
el: `#js-${STOP_JOBS_MODAL_ID}`,
|
2018-03-27 19:54:05 +05:30
|
|
|
components: {
|
2022-10-11 01:57:18 +05:30
|
|
|
StopJobsModal,
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
stopJobsButton.classList.remove('disabled');
|
2021-01-29 00:20:46 +05:30
|
|
|
stopJobsButton.addEventListener('click', () => {
|
2023-01-13 00:05:48 +05:30
|
|
|
this.$root.$emit(BV_SHOW_MODAL, STOP_JOBS_MODAL_ID, `#${buttonId}`);
|
2021-01-29 00:20:46 +05:30
|
|
|
});
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
|
|
|
render(createElement) {
|
2023-01-13 00:05:48 +05:30
|
|
|
return createElement(STOP_JOBS_MODAL_ID, {
|
2018-03-27 19:54:05 +05:30
|
|
|
props: {
|
|
|
|
url: stopJobsButton.dataset.url,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2021-09-30 23:02:18 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
initJobs();
|