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

metric_popover.vue « components « shared « analytics « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8d90e7b23921ca2e4e8bb6d848c86d118595e56b (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
<script>
import { GlPopover, GlLink, GlIcon } from '@gitlab/ui';

export default {
  name: 'MetricPopover',
  components: {
    GlPopover,
    GlLink,
    GlIcon,
  },
  props: {
    metric: {
      type: Object,
      required: true,
    },
    target: {
      type: String,
      required: true,
    },
  },
  computed: {
    metricLinks() {
      return this.metric.links?.filter((link) => !link.docs_link) || [];
    },
    docsLink() {
      return this.metric.links?.find((link) => link.docs_link);
    },
  },
};
</script>

<template>
  <gl-popover :target="target" placement="bottom">
    <template #title>
      <span class="gl-display-block gl-text-left" data-testid="metric-label">{{
        metric.label
      }}</span>
    </template>
    <div
      v-for="(link, idx) in metricLinks"
      :key="`link-${idx}`"
      class="gl-display-flex gl-justify-content-space-between gl-text-right gl-py-1"
      data-testid="metric-link"
    >
      <span>{{ link.label }}</span>
      <gl-link :href="link.url" class="gl-font-sm">
        {{ link.name }}
      </gl-link>
    </div>
    <span v-if="metric.description" data-testid="metric-description">{{ metric.description }}</span>
    <gl-link
      v-if="docsLink"
      :href="docsLink.url"
      class="gl-font-sm"
      target="_blank"
      data-testid="metric-docs-link"
      >{{ docsLink.label }}
      <gl-icon name="external-link" class="gl-vertical-align-middle" />
    </gl-link>
  </gl-popover>
</template>