debian-mirror-gitlab/app/assets/javascripts/jobs/components/artifacts_block.vue

92 lines
2.5 KiB
Vue
Raw Normal View History

2018-11-20 20:47:30 +05:30
<script>
2021-03-11 19:13:27 +05:30
import { GlButton, GlButtonGroup, GlIcon, GlLink } from '@gitlab/ui';
2018-12-13 13:39:08 +05:30
import TimeagoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
2018-11-20 20:47:30 +05:30
2018-12-13 13:39:08 +05:30
export default {
components: {
2021-03-11 19:13:27 +05:30
GlButton,
GlButtonGroup,
2020-11-24 15:15:51 +05:30
GlIcon,
2018-12-13 13:39:08 +05:30
GlLink,
2021-03-11 19:13:27 +05:30
TimeagoTooltip,
2018-12-13 13:39:08 +05:30
},
mixins: [timeagoMixin],
props: {
artifact: {
type: Object,
required: true,
2018-11-20 20:47:30 +05:30
},
2020-11-24 15:15:51 +05:30
helpUrl: {
type: String,
required: true,
},
2018-12-13 13:39:08 +05:30
},
computed: {
isExpired() {
2020-06-23 00:09:42 +05:30
return this.artifact?.expired && !this.isLocked;
},
isLocked() {
return this.artifact?.locked;
2018-12-05 23:21:45 +05:30
},
2018-12-13 13:39:08 +05:30
// Only when the key is `false` we can render this block
willExpire() {
2020-06-23 00:09:42 +05:30
return this.artifact?.expired === false && !this.isLocked;
2018-11-20 20:47:30 +05:30
},
2018-12-13 13:39:08 +05:30
},
};
2018-11-20 20:47:30 +05:30
</script>
<template>
<div class="block">
2021-03-11 19:13:27 +05:30
<div class="title gl-font-weight-bold">{{ s__('Job|Job artifacts') }}</div>
2019-01-03 12:48:30 +05:30
<p
2019-02-15 15:39:39 +05:30
v-if="isExpired || willExpire"
class="build-detail-row"
2020-06-23 00:09:42 +05:30
data-testid="artifacts-remove-timeline"
2019-01-03 12:48:30 +05:30
>
2019-02-15 15:39:39 +05:30
<span v-if="isExpired">{{ s__('Job|The artifacts were removed') }}</span>
<span v-if="willExpire">{{ s__('Job|The artifacts will be removed') }}</span>
<timeago-tooltip v-if="artifact.expire_at" :time="artifact.expire_at" />
2020-11-24 15:15:51 +05:30
<gl-link
:href="helpUrl"
target="_blank"
rel="noopener noreferrer nofollow"
data-testid="artifact-expired-help-link"
>
<gl-icon name="question" />
</gl-link>
2018-11-20 20:47:30 +05:30
</p>
2020-06-23 00:09:42 +05:30
<p v-else-if="isLocked" class="build-detail-row">
<span data-testid="job-locked-message">{{
s__(
'Job|These artifacts are the latest. They will not be deleted (even if expired) until newer artifacts are available.',
)
}}</span>
</p>
2021-03-11 19:13:27 +05:30
<gl-button-group class="gl-display-flex gl-mt-3">
<gl-button
2018-12-05 23:21:45 +05:30
v-if="artifact.keep_path"
:href="artifact.keep_path"
2018-11-20 20:47:30 +05:30
data-method="post"
2020-06-23 00:09:42 +05:30
data-testid="keep-artifacts"
2021-03-11 19:13:27 +05:30
>{{ s__('Job|Keep') }}</gl-button
2018-11-20 20:47:30 +05:30
>
2021-03-11 19:13:27 +05:30
<gl-button
2018-12-05 23:21:45 +05:30
v-if="artifact.download_path"
:href="artifact.download_path"
2018-11-20 20:47:30 +05:30
rel="nofollow"
2020-06-23 00:09:42 +05:30
data-testid="download-artifacts"
2021-03-11 19:13:27 +05:30
download
>{{ s__('Job|Download') }}</gl-button
2018-11-20 20:47:30 +05:30
>
2021-03-11 19:13:27 +05:30
<gl-button
2018-12-05 23:21:45 +05:30
v-if="artifact.browse_path"
:href="artifact.browse_path"
2020-06-23 00:09:42 +05:30
data-testid="browse-artifacts"
2020-11-24 15:15:51 +05:30
data-qa-selector="browse_artifacts_button"
2021-03-11 19:13:27 +05:30
>{{ s__('Job|Browse') }}</gl-button
2018-11-20 20:47:30 +05:30
>
2021-03-11 19:13:27 +05:30
</gl-button-group>
2018-11-20 20:47:30 +05:30
</div>
</template>