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

secure_files_list.vue « components « ci_secure_files « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d70ade36fe9a26a6207ef8f075d2aa9ee2abf666 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<script>
import { GlLink, GlLoadingIcon, GlPagination, GlTable } from '@gitlab/ui';
import Api, { DEFAULT_PER_PAGE } from '~/api';
import { helpPagePath } from '~/helpers/help_page_helper';
import { __ } from '~/locale';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';

export default {
  components: {
    GlLink,
    GlLoadingIcon,
    GlPagination,
    GlTable,
    TimeagoTooltip,
  },
  inject: ['projectId'],
  docsLink: helpPagePath('ci/secure_files/index'),
  DEFAULT_PER_PAGE,
  i18n: {
    pagination: {
      next: __('Next'),
      prev: __('Prev'),
    },
    title: __('Secure Files'),
    overviewMessage: __(
      'Use Secure Files to store files used by your pipelines such as Android keystores, or Apple provisioning profiles and signing certificates.',
    ),
    moreInformation: __('More information'),
  },
  data() {
    return {
      page: 1,
      totalItems: 0,
      loading: false,
      projectSecureFiles: [],
    };
  },
  fields: [
    {
      key: 'name',
      label: __('Filename'),
    },
    {
      key: 'permissions',
      label: __('Permissions'),
    },
    {
      key: 'created_at',
      label: __('Uploaded'),
    },
  ],
  computed: {
    fields() {
      return this.$options.fields;
    },
  },
  watch: {
    page(newPage) {
      this.getProjectSecureFiles(newPage);
    },
  },
  created() {
    this.getProjectSecureFiles();
  },
  methods: {
    async getProjectSecureFiles(page) {
      this.loading = true;
      const response = await Api.projectSecureFiles(this.projectId, { page });

      this.totalItems = parseInt(response.headers?.['x-total'], 10) || 0;

      this.projectSecureFiles = response.data;

      this.loading = false;
    },
  },
};
</script>

<template>
  <div>
    <h1 data-testid="title" class="gl-font-size-h1 gl-mt-3 gl-mb-0">{{ $options.i18n.title }}</h1>

    <p>
      <span data-testid="info-message" class="gl-mr-2">
        {{ $options.i18n.overviewMessage }}
        <gl-link :href="$options.docsLink" target="_blank">{{
          $options.i18n.moreInformation
        }}</gl-link>
      </span>
    </p>

    <gl-table
      :busy="loading"
      :fields="fields"
      :items="projectSecureFiles"
      tbody-tr-class="js-ci-secure-files-row"
      data-qa-selector="ci_secure_files_table_content"
      sort-by="key"
      sort-direction="asc"
      stacked="lg"
      table-class="text-secondary"
      show-empty
      sort-icon-left
      no-sort-reset
    >
      <template #table-busy>
        <gl-loading-icon size="lg" class="gl-my-5" />
      </template>

      <template #cell(name)="{ item }">
        {{ item.name }}
      </template>

      <template #cell(permissions)="{ item }">
        {{ item.permissions }}
      </template>

      <template #cell(created_at)="{ item }">
        <timeago-tooltip :time="item.created_at" />
      </template>
    </gl-table>
    <gl-pagination
      v-if="!loading"
      v-model="page"
      :per-page="$options.DEFAULT_PER_PAGE"
      :total-items="totalItems"
      :next-text="$options.i18n.pagination.next"
      :prev-text="$options.i18n.pagination.prev"
      align="center"
    />
  </div>
</template>