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

34 lines
910 B
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import Vue from 'vue';
import Translate from '~/vue_shared/translate';
import stopJobsModal from './components/stop_jobs_modal.vue';
Vue.use(Translate);
2018-03-27 19:54:05 +05:30
document.addEventListener('DOMContentLoaded', () => {
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', () => {
this.$root.$emit('bv::show::modal', modalId, `#${buttonId}`);
});
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,
},
});
},
});
}
});