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

69 lines
1.4 KiB
Vue
Raw Normal View History

2020-04-22 19:07:51 +05:30
<script>
2021-01-29 00:20:46 +05:30
import { GlTooltipDirective, GlModal } from '@gitlab/ui';
2020-04-22 19:07:51 +05:30
import { s__, sprintf } from '~/locale';
import eventHub from '../event_hub';
export default {
id: 'delete-environment-modal',
name: 'DeleteEnvironmentModal',
components: {
GlModal,
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
environment: {
type: Object,
required: true,
},
},
computed: {
2021-01-29 00:20:46 +05:30
primaryProps() {
return {
text: s__('Environments|Delete environment'),
attributes: [{ variant: 'danger' }],
};
},
cancelProps() {
return {
text: s__('Cancel'),
};
},
2020-04-22 19:07:51 +05:30
confirmDeleteMessage() {
return sprintf(
s__(
`Environments|Deleting the '%{environmentName}' environment cannot be undone. Do you want to delete it anyway?`,
),
{
environmentName: this.environment.name,
},
false,
);
},
2021-01-29 00:20:46 +05:30
modalTitle() {
return sprintf(s__(`Environments|Delete '%{environmentName}'?`), {
environmentName: this.environment.name,
});
},
2020-04-22 19:07:51 +05:30
},
methods: {
onSubmit() {
eventHub.$emit('deleteEnvironment', this.environment);
},
},
};
</script>
<template>
<gl-modal
2021-01-29 00:20:46 +05:30
:modal-id="$options.id"
:action-primary="primaryProps"
:action-cancel="cancelProps"
:title="modalTitle"
@primary="onSubmit"
2020-04-22 19:07:51 +05:30
>
<p>{{ confirmDeleteMessage }}</p>
</gl-modal>
</template>