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

ci_variable_popover.vue « components « ci_variable_list « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 431819124c2d5f252829670eb097b3c9bab3e532 (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
<script>
import { GlPopover, GlButton, GlTooltipDirective } from '@gitlab/ui';

export default {
  maxTextLength: 95,
  components: {
    GlPopover,
    GlButton,
  },
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  props: {
    target: {
      type: String,
      required: true,
    },
    value: {
      type: String,
      required: true,
    },
    tooltipText: {
      type: String,
      required: true,
    },
  },
  computed: {
    displayValue() {
      if (this.value.length > this.$options.maxTextLength) {
        return `${this.value.substring(0, this.$options.maxTextLength)}...`;
      }
      return this.value;
    },
  },
};
</script>

<template>
  <div id="popover-container">
    <gl-popover :target="target" triggers="hover" placement="top" container="popover-container">
      <div class="gl-display-flex gl-justify-content-space-between gl-align-items-center">
        <div class="ci-popover-value gl-pr-3">
          {{ displayValue }}
        </div>
        <gl-button
          v-gl-tooltip
          category="tertiary"
          icon="copy-to-clipboard"
          :title="tooltipText"
          :data-clipboard-text="value"
          :aria-label="__('Copy to clipboard')"
        />
      </div>
    </gl-popover>
  </div>
</template>