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
|
<script>
import { mapActions } from 'vuex';
import Icon from '../../../vue_shared/components/icon.vue';
import CiIcon from '../../../vue_shared/components/ci_icon.vue';
import LoadingIcon from '../../../vue_shared/components/loading_icon.vue';
import Item from './item.vue';
export default {
components: {
Icon,
CiIcon,
LoadingIcon,
Item,
},
props: {
stage: {
type: Object,
required: true,
},
},
computed: {
collapseIcon() {
return this.stage.isCollapsed ? 'angle-left' : 'angle-down';
},
},
created() {
this.fetchJobs(this.stage);
},
methods: {
...mapActions('pipelines', ['fetchJobs']),
},
};
</script>
<template>
<div
class="panel panel-default prepend-top-default"
>
<div
class="panel-heading"
@click="() => stage.isCollapsed = !stage.isCollapsed"
>
<ci-icon
:status="stage.status"
/>
<span class="prepend-left-8">
{{ stage.title }}
</span>
<div>
<span class="badge">
{{ stage.jobs.length }}
</span>
</div>
<icon
:name="collapseIcon"
css-classes="pull-right"
/>
</div>
<div
class="panel-body"
v-show="!stage.isCollapsed"
>
<loading-icon
v-if="stage.isLoading && !stage.jobs.length"
/>
<template v-else>
<item
v-for="job in stage.jobs"
:key="job.id"
:job="job"
/>
</template>
</div>
</div>
</template>
<style scoped>
.panel-heading {
display: flex;
cursor: pointer;
}
.panel-heading .ci-status-icon {
display: flex;
align-items: center;
}
.panel-heading .pull-right {
margin: auto 0 auto auto;
}
</style>
|