debian-mirror-gitlab/app/assets/javascripts/pipelines/components/graph/graph_component.vue

78 lines
1.8 KiB
Vue
Raw Normal View History

2017-08-17 22:00:37 +05:30
<script>
2017-09-10 17:25:29 +05:30
import loadingIcon from '~/vue_shared/components/loading_icon.vue';
2017-08-17 22:00:37 +05:30
import stageColumnComponent from './stage_column_component.vue';
export default {
2018-03-17 18:26:18 +05:30
components: {
stageColumnComponent,
loadingIcon,
},
2017-09-10 17:25:29 +05:30
props: {
isLoading: {
type: Boolean,
required: true,
},
pipeline: {
type: Object,
required: true,
},
2017-08-17 22:00:37 +05:30
},
2017-09-10 17:25:29 +05:30
computed: {
graph() {
return this.pipeline.details && this.pipeline.details.stages;
},
2017-08-17 22:00:37 +05:30
},
methods: {
capitalizeStageName(name) {
return name.charAt(0).toUpperCase() + name.slice(1);
},
isFirstColumn(index) {
return index === 0;
},
stageConnectorClass(index, stage) {
let className;
// If it's the first stage column and only has one job
if (index === 0 && stage.groups.length === 1) {
className = 'no-margin';
} else if (index > 0) {
// If it is not the first column
className = 'left-margin';
}
return className;
},
},
};
</script>
<template>
<div class="build-content middle-block js-pipeline-graph">
2018-03-27 19:54:05 +05:30
<div class="pipeline-visualization pipeline-graph pipeline-tab-content">
2017-08-17 22:00:37 +05:30
<div class="text-center">
2017-09-10 17:25:29 +05:30
<loading-icon
2017-08-17 22:00:37 +05:30
v-if="isLoading"
2017-09-10 17:25:29 +05:30
size="3"
2018-03-17 18:26:18 +05:30
/>
2017-08-17 22:00:37 +05:30
</div>
<ul
v-if="!isLoading"
class="stage-column-list">
<stage-column-component
2017-09-10 17:25:29 +05:30
v-for="(stage, index) in graph"
2017-08-17 22:00:37 +05:30
:title="capitalizeStageName(stage.name)"
:jobs="stage.groups"
:key="stage.name"
:stage-connector-class="stageConnectorClass(index, stage)"
2018-03-17 18:26:18 +05:30
:is-first-column="isFirstColumn(index)"
/>
2017-08-17 22:00:37 +05:30
</ul>
</div>
</div>
</template>