2018-11-08 19:23:39 +05:30
|
|
|
<script>
|
2019-02-15 15:39:39 +05:30
|
|
|
import { GlLoadingIcon } from '@gitlab/ui';
|
2018-11-08 19:23:39 +05:30
|
|
|
import tooltip from '../../../vue_shared/directives/tooltip';
|
|
|
|
import Icon from '../../../vue_shared/components/icon.vue';
|
|
|
|
import CiIcon from '../../../vue_shared/components/ci_icon.vue';
|
|
|
|
import Item from './item.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
Icon,
|
|
|
|
CiIcon,
|
|
|
|
Item,
|
2018-12-13 13:39:08 +05:30
|
|
|
GlLoadingIcon,
|
2018-11-08 19:23:39 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
stage: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showTooltip: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
collapseIcon() {
|
|
|
|
return this.stage.isCollapsed ? 'angle-left' : 'angle-down';
|
|
|
|
},
|
|
|
|
showLoadingIcon() {
|
|
|
|
return this.stage.isLoading && !this.stage.jobs.length;
|
|
|
|
},
|
|
|
|
jobsCount() {
|
|
|
|
return this.stage.jobs.length;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
const { stageTitle } = this.$refs;
|
|
|
|
|
|
|
|
this.showTooltip = stageTitle.scrollWidth > stageTitle.offsetWidth;
|
|
|
|
|
|
|
|
this.$emit('fetch', this.stage);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleCollapsed() {
|
|
|
|
this.$emit('toggleCollapsed', this.stage.id);
|
|
|
|
},
|
|
|
|
clickViewLog(job) {
|
|
|
|
this.$emit('clickViewLog', job);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2019-02-15 15:39:39 +05:30
|
|
|
<div class="ide-stage card prepend-top-default">
|
2018-11-08 19:23:39 +05:30
|
|
|
<div
|
|
|
|
:class="{
|
2019-02-15 15:39:39 +05:30
|
|
|
'border-bottom-0': stage.isCollapsed,
|
2018-11-08 19:23:39 +05:30
|
|
|
}"
|
|
|
|
class="card-header"
|
|
|
|
@click="toggleCollapsed"
|
|
|
|
>
|
2019-02-15 15:39:39 +05:30
|
|
|
<ci-icon :status="stage.status" :size="24" />
|
2018-11-08 19:23:39 +05:30
|
|
|
<strong
|
|
|
|
ref="stageTitle"
|
2018-12-05 23:21:45 +05:30
|
|
|
v-tooltip="showTooltip"
|
2018-11-08 19:23:39 +05:30
|
|
|
:title="showTooltip ? stage.name : null"
|
|
|
|
data-container="body"
|
|
|
|
class="prepend-left-8 ide-stage-title"
|
|
|
|
>
|
|
|
|
{{ stage.name }}
|
|
|
|
</strong>
|
2019-02-15 15:39:39 +05:30
|
|
|
<div v-if="!stage.isLoading || stage.jobs.length" class="append-right-8 prepend-left-4">
|
|
|
|
<span class="badge badge-pill"> {{ jobsCount }} </span>
|
2018-11-08 19:23:39 +05:30
|
|
|
</div>
|
2019-12-21 20:55:43 +05:30
|
|
|
<icon :name="collapseIcon" class="ide-stage-collapse-icon" />
|
2018-11-08 19:23:39 +05:30
|
|
|
</div>
|
2019-02-15 15:39:39 +05:30
|
|
|
<div v-show="!stage.isCollapsed" class="card-body">
|
|
|
|
<gl-loading-icon v-if="showLoadingIcon" />
|
2018-11-08 19:23:39 +05:30
|
|
|
<template v-else>
|
2019-02-15 15:39:39 +05:30
|
|
|
<item v-for="job in stage.jobs" :key="job.id" :job="job" @clickViewLog="clickViewLog" />
|
2018-11-08 19:23:39 +05:30
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|