summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue
blob: 2134e9b6bb7127978b4dbf82e85ed4730ac93acf (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
69
70
<script>
import { GlModal } from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
import { INGRESS, CERT_MANAGER, PROMETHEUS, RUNNER, KNATIVE, JUPYTER } from '../constants';

const CUSTOM_APP_WARNING_TEXT = {
  [INGRESS]: s__(
    'ClusterIntegration|The associated load balancer and IP will be deleted and cannot be restored.',
  ),
  [CERT_MANAGER]: s__(
    'ClusterIntegration|The associated certifcate will be deleted and cannot be restored.',
  ),
  [PROMETHEUS]: s__('ClusterIntegration|All data will be deleted and cannot be restored.'),
  [RUNNER]: s__('ClusterIntegration|Any running pipelines will be canceled.'),
  [KNATIVE]: s__('ClusterIntegration|The associated IP will be deleted and cannot be restored.'),
  [JUPYTER]: '',
};

export default {
  components: {
    GlModal,
  },
  props: {
    application: {
      type: String,
      required: true,
    },
    applicationTitle: {
      type: String,
      required: true,
    },
  },
  computed: {
    title() {
      return sprintf(s__('ClusterIntegration|Uninstall %{appTitle}'), {
        appTitle: this.applicationTitle,
      });
    },
    okButtonLabel() {
      return this.title;
    },
    warningText() {
      return sprintf(
        s__('ClusterIntegration|You are about to uninstall %{appTitle} from your cluster.'),
        {
          appTitle: this.applicationTitle,
        },
      );
    },
    customAppWarningText() {
      return CUSTOM_APP_WARNING_TEXT[this.application];
    },
    modalId() {
      return `uninstall-${this.application}`;
    },
  },
};
</script>
<template>
  <gl-modal
    body-class="modal-body-height-auto"
    ok-variant="danger"
    cancel-variant="light"
    :ok-title="okButtonLabel"
    :modal-id="modalId"
    :title="title"
    @ok="$emit('confirm')"
    >{{ warningText }} {{ customAppWarningText }}</gl-modal
  >
</template>