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

app.vue « components « artifacts « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3a07be65341547c67ca9dfe590beb97ae5466c4d (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
<script>
import { GlSkeletonLoader } from '@gitlab/ui';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import getBuildArtifactsSizeQuery from '../graphql/queries/get_build_artifacts_size.query.graphql';
import { PAGE_TITLE, TOTAL_ARTIFACTS_SIZE, SIZE_UNKNOWN } from '../constants';
import JobArtifactsTable from './job_artifacts_table.vue';

export default {
  name: 'ArtifactsApp',
  components: {
    GlSkeletonLoader,
    JobArtifactsTable,
  },
  inject: ['projectPath'],
  apollo: {
    buildArtifactsSize: {
      query: getBuildArtifactsSizeQuery,
      variables() {
        return { projectPath: this.projectPath };
      },
      update({
        project: {
          statistics: { buildArtifactsSize },
        },
      }) {
        return buildArtifactsSize;
      },
    },
  },
  data() {
    return {
      buildArtifactsSize: null,
    };
  },
  computed: {
    isLoading() {
      return this.$apollo.queries.buildArtifactsSize.loading;
    },
    humanReadableArtifactsSize() {
      return numberToHumanSize(this.buildArtifactsSize);
    },
  },
  i18n: {
    PAGE_TITLE,
    TOTAL_ARTIFACTS_SIZE,
    SIZE_UNKNOWN,
  },
};
</script>
<template>
  <div>
    <h1 class="page-title gl-font-size-h-display gl-mb-0" data-testid="artifacts-page-title">
      {{ $options.i18n.PAGE_TITLE }}
    </h1>
    <div class="gl-mb-6" data-testid="build-artifacts-size">
      <gl-skeleton-loader v-if="isLoading" :lines="1" />
      <template v-else>
        <strong>{{ $options.i18n.TOTAL_ARTIFACTS_SIZE }}</strong>
        <span v-if="buildArtifactsSize !== null">{{ humanReadableArtifactsSize }}</span>
        <span v-else>{{ $options.i18n.SIZE_UNKNOWN }}</span>
      </template>
    </div>
    <job-artifacts-table />
  </div>
</template>