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

revoke_button.vue « components « deploy_tokens « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fdf8b7796bf30c4b65e65e3d9b9b21d7d83be529 (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
71
72
73
74
75
76
77
78
79
80
81
<script>
import { GlButton, GlModal, GlModalDirective, GlSprintf } from '@gitlab/ui';

export default {
  components: {
    GlModal,
    GlSprintf,
    GlButton,
  },
  directives: {
    GlModal: GlModalDirective,
  },
  inject: {
    token: {
      default: null,
    },
    revokePath: {
      default: '',
    },
    buttonClass: {
      default: '',
    },
  },
  computed: {
    modalId() {
      return `revoke-modal-${this.token.id}`;
    },
  },
  methods: {
    cancelHandler() {
      this.$refs.modal.hide();
    },
  },
};
</script>

<template>
  <div>
    <gl-button
      v-gl-modal="modalId"
      :class="buttonClass"
      category="primary"
      variant="danger"
      class="float-right"
      data-testid="revoke-button"
      >{{ s__('DeployTokens|Revoke') }}</gl-button
    >
    <gl-modal ref="modal" :modal-id="modalId">
      <template #modal-title>
        <gl-sprintf :message="s__(`DeployTokens|Revoke %{boldStart}${token.name}%{boldEnd}?`)">
          <template #bold="{ content }"
            ><b>{{ content }}</b></template
          >
        </gl-sprintf>
      </template>
      <gl-sprintf
        :message="s__(`DeployTokens|You are about to revoke %{boldStart}${token.name}%{boldEnd}.`)"
      >
        <template #bold="{ content }">
          <b>{{ content }}</b>
        </template>
      </gl-sprintf>
      {{ s__('DeployTokens|This action cannot be undone.') }}
      <template #modal-footer>
        <gl-button category="secondary" @click="cancelHandler">{{ __('Cancel') }}</gl-button>
        <gl-button
          category="primary"
          variant="danger"
          :href="revokePath"
          data-method="put"
          class="text-truncate"
          data-testid="primary-revoke-btn"
        >
          <gl-sprintf :message="s__('DeployTokens|Revoke %{name}')">
            <template #name>{{ token.name }}</template>
          </gl-sprintf>
        </gl-button>
      </template>
    </gl-modal>
  </div>
</template>