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
|
<script>
import { GlButton, GlCollapse, GlIcon, GlLink, GlPopover, GlSprintf } from '@gitlab/ui';
import { __, s__, sprintf } from '~/locale';
import FailedJobsList from './failed_jobs_list.vue';
export default {
components: {
GlButton,
GlCollapse,
GlIcon,
GlLink,
GlPopover,
GlSprintf,
FailedJobsList,
},
inject: ['fullPath'],
props: {
failedJobsCount: {
required: true,
type: Number,
},
isPipelineActive: {
required: true,
type: Boolean,
},
pipelineIid: {
required: true,
type: Number,
},
pipelinePath: {
required: true,
type: String,
},
},
data() {
return {
currentFailedJobsCount: this.failedJobsCount,
isActive: false,
isExpanded: false,
};
},
computed: {
bodyClasses() {
return this.isExpanded ? '' : 'gl-display-none';
},
failedJobsCountText() {
return sprintf(this.$options.i18n.showFailedJobs, { count: this.currentFailedJobsCount });
},
iconName() {
return this.isExpanded ? 'chevron-down' : 'chevron-right';
},
popoverId() {
return `popover-${this.pipelineIid}`;
},
},
watch: {
failedJobsCount(val) {
this.currentFailedJobsCount = val;
},
},
methods: {
setFailedJobsCount(count) {
this.currentFailedJobsCount = count;
},
toggleWidget() {
this.isExpanded = !this.isExpanded;
},
},
i18n: {
additionalInfoPopover: s__(
'Pipelines|You will see a maximum of 100 jobs in this list. To view all failed jobs, %{linkStart}go to the details page%{linkEnd} of this pipeline.',
),
additionalInfoTitle: __('Limitation on this view'),
showFailedJobs: __('Show failed jobs (%{count})'),
},
};
</script>
<template>
<div class="gl-border-none!">
<gl-button variant="link" @click="toggleWidget">
<gl-icon :name="iconName" />
{{ failedJobsCountText }}
<gl-icon :id="popoverId" name="information-o" />
<gl-popover :target="popoverId" placement="top">
<template #title> {{ $options.i18n.additionalInfoTitle }} </template>
<slot>
<gl-sprintf :message="$options.i18n.additionalInfoPopover">
<template #link="{ content }">
<gl-link class="gl-font-sm" :href="pipelinePath"> {{ content }}</gl-link>
</template>
</gl-sprintf>
</slot>
</gl-popover>
</gl-button>
<gl-collapse
v-model="isExpanded"
class="gl-bg-gray-10 gl-border-1 gl-border-t gl-border-color-gray-100 gl-mt-4 gl-pt-3"
>
<failed-jobs-list
v-if="isExpanded"
:is-pipeline-active="isPipelineActive"
:pipeline-iid="pipelineIid"
@failed-jobs-count="setFailedJobsCount"
/>
</gl-collapse>
</div>
</template>
|