Welcome to mirror list, hosted at ThFree Co, Russian Federation.

delete_environment_modal.vue « components « environments « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 26ec882472bd7993ef704eeaf7eae24edd1c5f02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<script>
import { GlTooltipDirective, GlModal } from '@gitlab/ui';
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: {
    primaryProps() {
      return {
        text: s__('Environments|Delete environment'),
        attributes: [{ variant: 'danger' }],
      };
    },
    cancelProps() {
      return {
        text: __('Cancel'),
      };
    },
    confirmDeleteMessage() {
      return sprintf(
        s__(
          `Environments|Deleting the '%{environmentName}' environment cannot be undone. Do you want to delete it anyway?`,
        ),
        {
          environmentName: this.environment.name,
        },
        false,
      );
    },
    modalTitle() {
      return sprintf(s__(`Environments|Delete '%{environmentName}'?`), {
        environmentName: this.environment.name,
      });
    },
  },
  methods: {
    onSubmit() {
      eventHub.$emit('deleteEnvironment', this.environment);
    },
  },
};
</script>

<template>
  <gl-modal
    :modal-id="$options.id"
    :action-primary="primaryProps"
    :action-cancel="cancelProps"
    :title="modalTitle"
    @primary="onSubmit"
  >
    <p>{{ confirmDeleteMessage }}</p>
  </gl-modal>
</template>