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

registration_token.vue « registration « components « runner « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b196bccf66fd127803cec6b4d038c9d7bca69898 (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
<script>
import { s__ } from '~/locale';
import InputCopyToggleVisibility from '~/vue_shared/components/form/input_copy_toggle_visibility.vue';

export default {
  components: {
    InputCopyToggleVisibility,
  },
  i18n: {
    registrationToken: s__('Runners|Registration token'),
  },
  props: {
    inputId: {
      type: String,
      required: true,
    },
    value: {
      type: String,
      required: false,
      default: '',
    },
  },
  computed: {
    formInputGroupProps() {
      return {
        id: this.inputId,
      };
    },
  },
  methods: {
    onCopy() {
      // value already in the clipboard, simply notify the user
      this.$toast?.show(s__('Runners|Registration token copied!'));
    },
  },
  I18N_COPY_BUTTON_TITLE: s__('Runners|Copy registration token'),
};
</script>
<template>
  <input-copy-toggle-visibility
    class="gl-m-0"
    :value="value"
    :label="$options.i18n.registrationToken"
    :label-for="inputId"
    :copy-button-title="$options.I18N_COPY_BUTTON_TITLE"
    :form-input-group-props="formInputGroupProps"
    @copy="onCopy"
  >
    <template v-for="slot in Object.keys($scopedSlots)" #[slot]>
      <slot :name="slot"></slot>
    </template>
  </input-copy-toggle-visibility>
</template>