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
|
<script>
import { GlButtonGroup, GlButton, GlBadge, GlFriendlyWrap } from '@gitlab/ui';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { I18N_EXPIRED, I18N_DOWNLOAD, I18N_DELETE } from '../constants';
export default {
name: 'ArtifactRow',
components: {
GlButtonGroup,
GlButton,
GlBadge,
GlFriendlyWrap,
},
props: {
artifact: {
type: Object,
required: true,
},
isLastRow: {
type: Boolean,
required: true,
},
},
computed: {
isExpired() {
if (!this.artifact.expireAt) {
return false;
}
return Date.now() > new Date(this.artifact.expireAt).getTime();
},
artifactSize() {
return numberToHumanSize(this.artifact.size);
},
},
i18n: {
expired: I18N_EXPIRED,
download: I18N_DOWNLOAD,
delete: I18N_DELETE,
},
};
</script>
<template>
<div
class="gl-py-4"
:class="{ 'gl-border-b-solid gl-border-b-1 gl-border-gray-100': !isLastRow }"
>
<div class="gl-display-inline-flex gl-align-items-center gl-w-full">
<span
class="gl-w-half gl-pl-8 gl-display-flex gl-align-items-center"
data-testid="job-artifact-row-name"
>
<gl-friendly-wrap :text="artifact.name" />
<gl-badge size="sm" variant="neutral" class="gl-ml-2">
{{ artifact.fileType.toLowerCase() }}
</gl-badge>
<gl-badge v-if="isExpired" size="sm" variant="warning" icon="expire" class="gl-ml-2">
{{ $options.i18n.expired }}
</gl-badge>
</span>
<span class="gl-w-quarter gl-text-right gl-pr-5" data-testid="job-artifact-row-size">
{{ artifactSize }}
</span>
<span class="gl-w-quarter gl-text-right gl-pr-5">
<gl-button-group>
<gl-button
category="tertiary"
icon="download"
:title="$options.i18n.download"
:aria-label="$options.i18n.download"
:href="artifact.downloadPath"
data-testid="job-artifact-row-download-button"
/>
<gl-button
category="tertiary"
icon="remove"
:title="$options.i18n.delete"
:aria-label="$options.i18n.delete"
data-testid="job-artifact-row-delete-button"
@click="$emit('delete')"
/>
</gl-button-group>
</span>
</div>
</div>
</template>
|