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
|
<script>
import { GlDisclosureDropdown, GlTooltipDirective } from '@gitlab/ui';
import { __ } from '~/locale';
export const i18n = {
artifacts: __('Artifacts'),
artifactSectionHeader: __('Download artifacts'),
};
export default {
i18n,
directives: {
GlTooltip: GlTooltipDirective,
},
components: {
GlDisclosureDropdown,
},
inject: {
artifactsEndpoint: {
default: '',
},
artifactsEndpointPlaceholder: {
default: '',
},
},
props: {
pipelineId: {
type: Number,
required: true,
},
artifacts: {
type: Array,
required: false,
default: () => [],
},
},
computed: {
items() {
return [
{
name: this.$options.i18n.artifactSectionHeader,
items: this.artifacts.map(({ name, path }) => ({
text: name,
href: path,
extraAttrs: {
download: '',
rel: 'nofollow',
},
})),
},
];
},
shouldShowDropdown() {
return this.artifacts?.length;
},
},
};
</script>
<template>
<gl-disclosure-dropdown
v-if="shouldShowDropdown"
v-gl-tooltip
class="gl-text-left"
:title="$options.i18n.artifacts"
:toggle-text="$options.i18n.artifacts"
:aria-label="$options.i18n.artifacts"
icon="download"
placement="right"
text-sr-only
:items="items"
/>
</template>
|