2020-03-13 15:44:24 +05:30
|
|
|
import { escape } from 'lodash';
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
isLoading: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
pipeline: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
graph() {
|
|
|
|
return this.pipeline.details && this.pipeline.details.stages;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
capitalizeStageName(name) {
|
2020-03-13 15:44:24 +05:30
|
|
|
const escapedName = escape(name);
|
2019-03-02 22:35:43 +05:30
|
|
|
return escapedName.charAt(0).toUpperCase() + escapedName.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;
|
|
|
|
},
|
|
|
|
refreshPipelineGraph() {
|
|
|
|
this.$emit('refreshPipelineGraph');
|
|
|
|
},
|
2019-12-04 20:38:33 +05:30
|
|
|
/**
|
|
|
|
* CSS class is applied:
|
|
|
|
* - if pipeline graph contains only one stage column component
|
|
|
|
*
|
|
|
|
* @param {number} index
|
|
|
|
* @returns {boolean}
|
|
|
|
*/
|
|
|
|
shouldAddRightMargin(index) {
|
|
|
|
return !(index === this.graph.length - 1);
|
|
|
|
},
|
2019-03-02 22:35:43 +05:30
|
|
|
},
|
|
|
|
};
|