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
|
<script>
import { GlButton, GlButtonGroup, GlIcon, GlLink, GlPopover } from '@gitlab/ui';
import { s__ } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
export default {
i18n: {
jobArtifacts: s__('Job|Job artifacts'),
artifactsHelpText: s__(
'Job|Job artifacts are files that are configured to be uploaded when a job finishes execution. Artifacts could be compiled files, unit tests or scanning reports, or any other files generated by a job.',
),
expiredText: s__('Job|The artifacts were removed'),
willExpireText: s__('Job|The artifacts will be removed'),
lockedText: s__(
'Job|These artifacts are the latest. They will not be deleted (even if expired) until newer artifacts are available.',
),
keepText: s__('Job|Keep'),
downloadText: s__('Job|Download'),
browseText: s__('Job|Browse'),
},
artifactsHelpPath: helpPagePath('ci/jobs/job_artifacts'),
components: {
GlButton,
GlButtonGroup,
GlIcon,
GlLink,
GlPopover,
TimeagoTooltip,
},
mixins: [timeagoMixin],
props: {
artifact: {
type: Object,
required: true,
},
helpUrl: {
type: String,
required: true,
},
},
computed: {
isExpired() {
return this.artifact?.expired && !this.isLocked;
},
isLocked() {
return this.artifact?.locked;
},
// Only when the key is `false` we can render this block
willExpire() {
return this.artifact?.expired === false && !this.isLocked;
},
},
};
</script>
<template>
<div>
<div class="title gl-font-weight-bold">
<span class="gl-mr-2">{{ $options.i18n.jobArtifacts }}</span>
<gl-link :href="$options.artifactsHelpPath" data-testid="artifacts-help-link">
<gl-icon id="artifacts-help" name="question-o" />
</gl-link>
<gl-popover
target="artifacts-help"
:title="$options.i18n.jobArtifacts"
triggers="hover focus"
>
{{ $options.i18n.artifactsHelpText }}
</gl-popover>
</div>
<p
v-if="isExpired || willExpire"
class="build-detail-row"
data-testid="artifacts-remove-timeline"
>
<span v-if="isExpired">{{ $options.i18n.expiredText }}</span>
<span v-if="willExpire" data-testid="artifacts-unlocked-message-content">
{{ $options.i18n.willExpireText }}
</span>
<timeago-tooltip v-if="artifact.expire_at" :time="artifact.expire_at" />
<gl-link
:href="helpUrl"
target="_blank"
rel="noopener noreferrer nofollow"
data-testid="artifact-expired-help-link"
>
<gl-icon name="question-o" />
</gl-link>
</p>
<p v-else-if="isLocked" class="build-detail-row">
<span data-testid="artifacts-locked-message-content">
{{ $options.i18n.lockedText }}
</span>
</p>
<gl-button-group class="gl-display-flex gl-mt-3">
<gl-button
v-if="artifact.keep_path"
:href="artifact.keep_path"
data-method="post"
data-testid="keep-artifacts"
>{{ $options.i18n.keepText }}</gl-button
>
<gl-button
v-if="artifact.download_path"
:href="artifact.download_path"
rel="nofollow"
data-testid="download-artifacts"
download
>{{ $options.i18n.downloadText }}</gl-button
>
<gl-button
v-if="artifact.browse_path"
:href="artifact.browse_path"
data-testid="browse-artifacts-button"
>{{ $options.i18n.browseText }}</gl-button
>
</gl-button-group>
</div>
</template>
|