debian-mirror-gitlab/app/assets/javascripts/environments/components/rollback_modal_manager.vue
2021-12-11 22:18:48 +05:30

54 lines
1.1 KiB
Vue

<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,
retryUrl: retryPath,
isLastDeployment: parseBoolean(isLastDeployment),
};
this.visible = true;
});
});
},
};
</script>
<template>
<confirm-rollback-modal
v-if="environment"
v-model="visible"
:environment="environment"
:has-multiple-commits="false"
/>
</template>