2017-05-06 17:02:06 +00:00
|
|
|
<script>
|
2020-11-27 18:09:52 +00:00
|
|
|
import { capitalize, escape, isEmpty } from 'lodash';
|
|
|
|
import MainGraphWrapper from '../graph_shared/main_graph_wrapper.vue';
|
2018-10-17 11:11:52 +00:00
|
|
|
import JobItem from './job_item.vue';
|
|
|
|
import JobGroupDropdown from './job_group_dropdown.vue';
|
2019-05-02 18:27:35 +00:00
|
|
|
import ActionComponent from './action_component.vue';
|
2020-11-27 18:09:52 +00:00
|
|
|
import { GRAPHQL } from './constants';
|
2020-11-30 21:09:16 +00:00
|
|
|
import { accessValue } from './accessors';
|
2021-01-11 21:10:36 +00:00
|
|
|
import { reportToSentry } from './utils';
|
2017-05-06 17:02:06 +00:00
|
|
|
|
2018-04-06 15:42:19 +00:00
|
|
|
export default {
|
|
|
|
components: {
|
2019-05-02 18:27:35 +00:00
|
|
|
ActionComponent,
|
2020-11-27 18:09:52 +00:00
|
|
|
JobGroupDropdown,
|
|
|
|
JobItem,
|
|
|
|
MainGraphWrapper,
|
2018-04-06 15:42:19 +00:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2017-05-06 17:02:06 +00:00
|
|
|
},
|
2018-10-17 11:11:52 +00:00
|
|
|
groups: {
|
2018-04-06 15:42:19 +00:00
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
2021-01-14 12:10:54 +00:00
|
|
|
pipelineId: {
|
|
|
|
type: Number,
|
|
|
|
required: true,
|
|
|
|
},
|
2019-05-02 18:27:35 +00:00
|
|
|
action: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
2020-07-16 15:09:38 +00:00
|
|
|
jobHovered: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
2020-09-01 18:10:48 +00:00
|
|
|
pipelineExpanded: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
2019-05-02 18:27:35 +00:00
|
|
|
},
|
2020-11-27 18:09:52 +00:00
|
|
|
titleClasses: [
|
|
|
|
'gl-font-weight-bold',
|
|
|
|
'gl-pipeline-job-width',
|
|
|
|
'gl-text-truncate',
|
|
|
|
'gl-line-height-36',
|
|
|
|
'gl-pl-3',
|
|
|
|
],
|
2019-05-02 18:27:35 +00:00
|
|
|
computed: {
|
2020-11-27 18:09:52 +00:00
|
|
|
formattedTitle() {
|
|
|
|
return capitalize(escape(this.title));
|
|
|
|
},
|
2019-05-02 18:27:35 +00:00
|
|
|
hasAction() {
|
2020-02-13 21:08:59 +00:00
|
|
|
return !isEmpty(this.action);
|
2019-05-02 18:27:35 +00:00
|
|
|
},
|
2018-04-06 15:42:19 +00:00
|
|
|
},
|
2021-01-11 21:10:36 +00:00
|
|
|
errorCaptured(err, _vm, info) {
|
|
|
|
reportToSentry('stage_column_component', `error: ${err}, info: ${info}`);
|
|
|
|
},
|
2018-04-06 15:42:19 +00:00
|
|
|
methods: {
|
2020-11-30 21:09:16 +00:00
|
|
|
getGroupId(group) {
|
|
|
|
return accessValue(GRAPHQL, 'groupId', group);
|
2020-11-27 18:09:52 +00:00
|
|
|
},
|
2018-10-17 11:11:52 +00:00
|
|
|
groupId(group) {
|
2020-04-21 18:09:31 +00:00
|
|
|
return `ci-badge-${escape(group.name)}`;
|
2018-04-06 15:42:19 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2017-05-06 17:02:06 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
2020-11-27 18:09:52 +00:00
|
|
|
<main-graph-wrapper>
|
|
|
|
<template #stages>
|
|
|
|
<div
|
|
|
|
data-testid="stage-column-title"
|
|
|
|
class="gl-display-flex gl-justify-content-space-between gl-relative"
|
|
|
|
:class="$options.titleClasses"
|
|
|
|
>
|
|
|
|
<div>{{ formattedTitle }}</div>
|
|
|
|
<action-component
|
|
|
|
v-if="hasAction"
|
|
|
|
:action-icon="action.icon"
|
|
|
|
:tooltip-text="action.title"
|
|
|
|
:link="action.path"
|
|
|
|
class="js-stage-action stage-action rounded"
|
2020-12-14 18:09:48 +00:00
|
|
|
@pipelineActionRequestComplete="$emit('refreshPipelineGraph')"
|
2020-11-27 18:09:52 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #jobs>
|
|
|
|
<div
|
|
|
|
v-for="group in groups"
|
|
|
|
:id="groupId(group)"
|
2020-11-30 21:09:16 +00:00
|
|
|
:key="getGroupId(group)"
|
2020-11-27 18:09:52 +00:00
|
|
|
data-testid="stage-column-group"
|
|
|
|
class="gl-relative gl-mb-3 gl-white-space-normal gl-pipeline-job-width"
|
2021-01-14 12:10:54 +00:00
|
|
|
@mouseenter="$emit('jobHover', group.name)"
|
|
|
|
@mouseleave="$emit('jobHover', '')"
|
2020-11-27 18:09:52 +00:00
|
|
|
>
|
|
|
|
<job-item
|
|
|
|
v-if="group.size === 1"
|
|
|
|
:job="group.jobs[0]"
|
|
|
|
:job-hovered="jobHovered"
|
|
|
|
:pipeline-expanded="pipelineExpanded"
|
2021-01-14 12:10:54 +00:00
|
|
|
:pipeline-id="pipelineId"
|
2020-11-27 18:09:52 +00:00
|
|
|
css-class-job-name="gl-build-content"
|
2020-12-14 18:09:48 +00:00
|
|
|
@pipelineActionRequestComplete="$emit('refreshPipelineGraph')"
|
2020-11-27 18:09:52 +00:00
|
|
|
/>
|
2021-01-14 12:10:54 +00:00
|
|
|
<job-group-dropdown v-else :group="group" :pipeline-id="pipelineId" />
|
2020-11-27 18:09:52 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</main-graph-wrapper>
|
2017-05-06 17:02:06 +00:00
|
|
|
</template>
|