debian-mirror-gitlab/app/assets/javascripts/environments/components/rollback_modal_manager.vue

55 lines
1.1 KiB
Vue
Raw Normal View History

2021-10-27 15:23:28 +05:30
<script>
import { parseBoolean } from '~/lib/utils/common_utils';
import ConfirmRollbackModal from './confirm_rollback_modal.vue';
export default {
components: {
ConfirmRollbackModal,
},
props: {
selector: {
type: String,
required: true,
},
},
data() {
return {
environment: null,
visible: false,
};
},
mounted() {
document.querySelectorAll(this.selector).forEach((button) => {
button.addEventListener('click', (e) => {
e.preventDefault();
const {
environmentName,
commitShortSha,
commitUrl,
isLastDeployment,
retryPath,
} = button.dataset;
this.environment = {
name: environmentName,
commitShortSha,
commitUrl,
2021-12-11 22:18:48 +05:30
retryUrl: retryPath,
2021-10-27 15:23:28 +05:30
isLastDeployment: parseBoolean(isLastDeployment),
};
this.visible = true;
});
});
},
};
</script>
<template>
<confirm-rollback-modal
v-if="environment"
v-model="visible"
:environment="environment"
:has-multiple-commits="false"
/>
</template>