uninstall_application_confirmation_modal.vue 2.7 KB
Newer Older
1
<script>
2
/* eslint-disable vue/no-v-html */
3
import { GlModal } from '@gitlab/ui';
4
import trackUninstallButtonClickMixin from 'ee_else_ce/clusters/mixins/track_uninstall_button_click';
5
import { sprintf, s__ } from '~/locale';
6 7 8 9 10 11 12 13 14 15
import {
  HELM,
  INGRESS,
  CERT_MANAGER,
  PROMETHEUS,
  RUNNER,
  KNATIVE,
  JUPYTER,
  ELASTIC_STACK,
} from '../constants';
16 17

const CUSTOM_APP_WARNING_TEXT = {
18 19 20 21 22 23 24 25
  [HELM]: sprintf(
    s__(
      'ClusterIntegration|The associated Tiller pod, the %{gitlabManagedAppsNamespace} namespace, and all of its resources will be deleted and cannot be restored.',
    ),
    {
      gitlabManagedAppsNamespace: '<code>gitlab-managed-apps</code>',
    },
    false,
26
  ),
27 28 29 30
  [INGRESS]: s__(
    'ClusterIntegration|The associated load balancer and IP will be deleted and cannot be restored.',
  ),
  [CERT_MANAGER]: s__(
T
Tiger 已提交
31
    'ClusterIntegration|The associated private key will be deleted and cannot be restored.',
32 33 34
  ),
  [PROMETHEUS]: s__('ClusterIntegration|All data will be deleted and cannot be restored.'),
  [RUNNER]: s__('ClusterIntegration|Any running pipelines will be canceled.'),
J
João Cunha 已提交
35 36 37
  [KNATIVE]: s__(
    'ClusterIntegration|The associated IP and all deployed services will be deleted and cannot be restored. Uninstalling Knative will also remove Istio from your cluster. This will not effect any other applications.',
  ),
J
João Cunha 已提交
38 39 40
  [JUPYTER]: s__(
    'ClusterIntegration|All data not committed to GitLab will be deleted and cannot be restored.',
  ),
41
  [ELASTIC_STACK]: s__('ClusterIntegration|All data will be deleted and cannot be restored.'),
42 43 44 45 46 47
};

export default {
  components: {
    GlModal,
  },
48
  mixins: [trackUninstallButtonClickMixin],
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
  props: {
    application: {
      type: String,
      required: true,
    },
    applicationTitle: {
      type: String,
      required: true,
    },
  },
  computed: {
    title() {
      return sprintf(s__('ClusterIntegration|Uninstall %{appTitle}'), {
        appTitle: this.applicationTitle,
      });
    },
    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}`;
    },
  },
80 81 82 83 84 85
  methods: {
    confirmUninstall() {
      this.trackUninstallButtonClick(this.application);
      this.$emit('confirm');
    },
  },
86 87 88 89 90 91 92 93 94
};
</script>
<template>
  <gl-modal
    ok-variant="danger"
    cancel-variant="light"
    :ok-title="title"
    :modal-id="modalId"
    :title="title"
95
    @ok="confirmUninstall()"
96
  >
97 98
    {{ warningText }} <span v-html="customAppWarningText"></span>
  </gl-modal>
99
</template>