summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/runner/components/runner_delete_modal.vue
blob: 8be216a7eb5492d0fda673c3bf8af42c0c4aa1fe (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
<script>
import { GlModal } from '@gitlab/ui';
import { __, s__, sprintf } from '~/locale';

const I18N_TITLE = s__('Runners|Delete runner %{name}?');
const I18N_BODY = s__(
  'Runners|The runner will be permanently deleted and no longer available for projects or groups in the instance. Are you sure you want to continue?',
);
const I18N_PRIMARY = s__('Runners|Delete runner');
const I18N_CANCEL = __('Cancel');

export default {
  components: {
    GlModal,
  },
  props: {
    runnerName: {
      type: String,
      required: true,
    },
  },
  computed: {
    title() {
      return sprintf(I18N_TITLE, { name: this.runnerName });
    },
  },
  methods: {
    onPrimary() {
      this.$refs.modal.hide();
    },
  },
  actionPrimary: { text: I18N_PRIMARY, attributes: { variant: 'danger' } },
  actionCancel: { text: I18N_CANCEL },
  I18N_BODY,
};
</script>

<template>
  <gl-modal
    ref="modal"
    size="sm"
    :title="title"
    :action-primary="$options.actionPrimary"
    :action-cancel="$options.actionCancel"
    v-bind="$attrs"
    v-on="$listeners"
    @primary="onPrimary"
  >
    {{ $options.I18N_BODY }}
  </gl-modal>
</template>