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

79 lines
2.2 KiB
Vue
Raw Normal View History

2018-11-20 20:47:30 +05:30
<script>
2019-02-15 15:39:39 +05:30
import { 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: {
TimeagoTooltip,
GlLink,
},
mixins: [timeagoMixin],
props: {
artifact: {
type: Object,
required: true,
2018-11-20 20:47:30 +05:30
},
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">
2019-02-15 15:39:39 +05:30
<div class="title 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" />
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>
2019-02-15 15:39:39 +05:30
<div class="btn-group d-flex prepend-top-10" role="group">
2018-12-13 13:39:08 +05:30
<gl-link
2018-12-05 23:21:45 +05:30
v-if="artifact.keep_path"
:href="artifact.keep_path"
2020-06-23 00:09:42 +05:30
class="btn btn-sm btn-default"
2018-11-20 20:47:30 +05:30
data-method="post"
2020-06-23 00:09:42 +05:30
data-testid="keep-artifacts"
2019-02-15 15:39:39 +05:30
>{{ s__('Job|Keep') }}</gl-link
2018-11-20 20:47:30 +05:30
>
2018-12-13 13:39:08 +05:30
<gl-link
2018-12-05 23:21:45 +05:30
v-if="artifact.download_path"
:href="artifact.download_path"
2020-06-23 00:09:42 +05:30
class="btn btn-sm btn-default"
2018-11-20 20:47:30 +05:30
download
rel="nofollow"
2020-06-23 00:09:42 +05:30
data-testid="download-artifacts"
2019-02-15 15:39:39 +05:30
>{{ s__('Job|Download') }}</gl-link
2018-11-20 20:47:30 +05:30
>
2018-12-13 13:39:08 +05:30
<gl-link
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
class="btn btn-sm btn-default"
data-testid="browse-artifacts"
2019-02-15 15:39:39 +05:30
>{{ s__('Job|Browse') }}</gl-link
2018-11-20 20:47:30 +05:30
>
</div>
</div>
</template>