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
|
<script>
import { GlLoadingIcon } from '@gitlab/ui';
import { s__ } from '~/locale';
import { createAlert } from '~/alert';
import GetFailedJobsQuery from '../../graphql/queries/get_failed_jobs.query.graphql';
import FailedJobsTable from './failed_jobs_table.vue';
export default {
components: {
GlLoadingIcon,
FailedJobsTable,
},
inject: {
projectPath: {
default: '',
},
pipelineIid: {
default: '',
},
},
apollo: {
failedJobs: {
query: GetFailedJobsQuery,
variables() {
return {
fullPath: this.projectPath,
pipelineIid: this.pipelineIid,
};
},
update({ project }) {
const jobNodes = project?.pipeline?.jobs?.nodes || [];
return jobNodes.map((job) => {
return {
...job,
// this field is needed for the slot row-details
// on the failed_jobs_table.vue component
_showDetails: true,
};
});
},
error() {
createAlert({ message: s__('Jobs|There was a problem fetching the failed jobs.') });
},
},
},
data() {
return {
failedJobs: [],
};
},
computed: {
loading() {
return this.$apollo.queries.failedJobs.loading;
},
},
};
</script>
<template>
<div>
<gl-loading-icon v-if="loading" size="lg" class="gl-mt-4" />
<failed-jobs-table v-else :failed-jobs="failedJobs" />
</div>
</template>
|