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

integrations_table.vue « components « index « integrations « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 439c243f418046004f495ca7296c50508f08ed1b (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<script>
import { GlIcon, GlLink, GlTable, GlTooltipDirective } from '@gitlab/ui';
import { sprintf, s__, __ } from '~/locale';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';

export default {
  components: {
    GlIcon,
    GlLink,
    GlTable,
    TimeAgoTooltip,
  },
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  props: {
    integrations: {
      type: Array,
      required: true,
    },
    showUpdatedAt: {
      type: Boolean,
      required: false,
      default: false,
    },
    emptyText: {
      type: String,
      required: false,
      default: undefined,
    },
  },
  computed: {
    fields() {
      return [
        {
          key: 'active',
          label: '',
          thClass: 'gl-w-10',
        },
        {
          key: 'title',
          label: __('Integration'),
          thClass: 'gl-w-quarter',
        },
        {
          key: 'description',
          label: __('Description'),
          thClass: 'gl-display-none d-sm-table-cell',
          tdClass: 'gl-display-none d-sm-table-cell',
        },
        {
          key: 'updated_at',
          label: this.showUpdatedAt ? __('Last updated') : '',
          thClass: 'gl-w-20p',
        },
      ];
    },
  },
  methods: {
    getStatusTooltipTitle(integration) {
      return sprintf(s__('Integrations|%{integrationTitle}: active'), {
        integrationTitle: integration.title,
      });
    },
  },
};
</script>

<template>
  <gl-table :items="integrations" :fields="fields" :empty-text="emptyText" show-empty fixed>
    <template #cell(active)="{ item }">
      <gl-icon
        v-if="item.active"
        v-gl-tooltip
        name="check"
        class="gl-text-green-500"
        :title="getStatusTooltipTitle(item)"
      />
    </template>

    <template #cell(title)="{ item }">
      <gl-link
        :href="item.edit_path"
        class="gl-font-weight-bold"
        :data-qa-selector="`${item.name}_link`"
      >
        {{ item.title }}
      </gl-link>
    </template>

    <template #cell(updated_at)="{ item }">
      <time-ago-tooltip v-if="showUpdatedAt && item.updated_at" :time="item.updated_at" />
    </template>
  </gl-table>
</template>