2019-12-21 20:55:43 +05:30
|
|
|
<script>
|
2020-04-22 19:07:51 +05:30
|
|
|
import { GlLoadingIcon, GlTooltipDirective, GlDeprecatedButton } from '@gitlab/ui';
|
2019-12-21 20:55:43 +05:30
|
|
|
import CiStatus from '~/vue_shared/components/ci_icon.vue';
|
2020-03-13 15:44:24 +05:30
|
|
|
import { __ } from '~/locale';
|
2019-12-21 20:55:43 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
CiStatus,
|
|
|
|
GlLoadingIcon,
|
2020-04-22 19:07:51 +05:30
|
|
|
GlDeprecatedButton,
|
2019-12-21 20:55:43 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
pipeline: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2020-03-13 15:44:24 +05:30
|
|
|
projectId: {
|
|
|
|
type: Number,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
columnTitle: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2019-12-21 20:55:43 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
tooltipText() {
|
|
|
|
return `${this.projectName} - ${this.pipelineStatus.label}`;
|
|
|
|
},
|
|
|
|
buttonId() {
|
|
|
|
return `js-linked-pipeline-${this.pipeline.id}`;
|
|
|
|
},
|
|
|
|
pipelineStatus() {
|
|
|
|
return this.pipeline.details.status;
|
|
|
|
},
|
|
|
|
projectName() {
|
|
|
|
return this.pipeline.project.name;
|
|
|
|
},
|
2020-03-13 15:44:24 +05:30
|
|
|
parentPipeline() {
|
|
|
|
// Refactor string match when BE returns Upstream/Downstream indicators
|
|
|
|
return this.projectId === this.pipeline.project.id && this.columnTitle === __('Upstream');
|
|
|
|
},
|
|
|
|
childPipeline() {
|
|
|
|
// Refactor string match when BE returns Upstream/Downstream indicators
|
|
|
|
return this.projectId === this.pipeline.project.id && this.columnTitle === __('Downstream');
|
|
|
|
},
|
|
|
|
label() {
|
|
|
|
return this.parentPipeline ? __('Parent') : __('Child');
|
|
|
|
},
|
|
|
|
childTooltipText() {
|
|
|
|
return __('This pipeline was triggered by a parent pipeline');
|
|
|
|
},
|
|
|
|
parentTooltipText() {
|
|
|
|
return __('This pipeline triggered a child pipeline');
|
|
|
|
},
|
|
|
|
labelToolTipText() {
|
|
|
|
return this.label === __('Parent') ? this.parentTooltipText : this.childTooltipText;
|
|
|
|
},
|
2019-12-21 20:55:43 +05:30
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClickLinkedPipeline() {
|
|
|
|
this.$root.$emit('bv::hide::tooltip', this.buttonId);
|
2020-03-13 15:44:24 +05:30
|
|
|
this.$emit('pipelineClicked', this.$refs.linkedPipeline);
|
|
|
|
},
|
|
|
|
hideTooltips() {
|
|
|
|
this.$root.$emit('bv::hide::tooltip');
|
2019-12-21 20:55:43 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-03-13 15:44:24 +05:30
|
|
|
<li
|
|
|
|
ref="linkedPipeline"
|
|
|
|
class="linked-pipeline build"
|
|
|
|
:class="{ 'child-pipeline': childPipeline }"
|
|
|
|
>
|
2020-04-22 19:07:51 +05:30
|
|
|
<gl-deprecated-button
|
2019-12-21 20:55:43 +05:30
|
|
|
:id="buttonId"
|
|
|
|
v-gl-tooltip
|
|
|
|
:title="tooltipText"
|
|
|
|
class="js-linked-pipeline-content linked-pipeline-content"
|
|
|
|
data-qa-selector="linked_pipeline_button"
|
|
|
|
:class="`js-pipeline-expand-${pipeline.id}`"
|
|
|
|
@click="onClickLinkedPipeline"
|
|
|
|
>
|
|
|
|
<gl-loading-icon v-if="pipeline.isLoading" class="js-linked-pipeline-loading d-inline" />
|
|
|
|
<ci-status
|
|
|
|
v-else
|
|
|
|
:status="pipelineStatus"
|
|
|
|
css-classes="position-top-0"
|
|
|
|
class="js-linked-pipeline-status"
|
|
|
|
/>
|
|
|
|
<span class="str-truncated align-bottom"> {{ projectName }} • #{{ pipeline.id }} </span>
|
2020-03-13 15:44:24 +05:30
|
|
|
<div v-if="parentPipeline || childPipeline" class="parent-child-label-container">
|
|
|
|
<span
|
|
|
|
v-gl-tooltip.bottom
|
|
|
|
:title="labelToolTipText"
|
|
|
|
class="badge badge-primary"
|
|
|
|
@mouseover="hideTooltips"
|
|
|
|
>{{ label }}</span
|
|
|
|
>
|
|
|
|
</div>
|
2020-04-22 19:07:51 +05:30
|
|
|
</gl-deprecated-button>
|
2019-12-21 20:55:43 +05:30
|
|
|
</li>
|
|
|
|
</template>
|