2018-11-20 20:47:30 +05:30
|
|
|
<script>
|
2021-01-29 00:20:46 +05:30
|
|
|
import { GlLink, GlDropdown, GlDropdownItem } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { isEmpty } from 'lodash';
|
2018-12-13 13:39:08 +05:30
|
|
|
import CiIcon from '~/vue_shared/components/ci_icon.vue';
|
2021-10-27 15:23:28 +05:30
|
|
|
import clipboardButton from '~/vue_shared/components/clipboard_button.vue';
|
2018-11-20 20:47:30 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
CiIcon,
|
2021-10-27 15:23:28 +05:30
|
|
|
clipboardButton,
|
2021-01-29 00:20:46 +05:30
|
|
|
GlDropdown,
|
|
|
|
GlDropdownItem,
|
2019-07-07 11:18:12 +05:30
|
|
|
GlLink,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
pipeline: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
2018-11-20 20:47:30 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
stages: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
2018-11-20 20:47:30 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
selectedStage: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2018-11-20 20:47:30 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasRef() {
|
2020-03-13 15:44:24 +05:30
|
|
|
return !isEmpty(this.pipeline.ref);
|
2018-11-20 20:47:30 +05:30
|
|
|
},
|
2019-07-07 11:18:12 +05:30
|
|
|
isTriggeredByMergeRequest() {
|
|
|
|
return Boolean(this.pipeline.merge_request);
|
|
|
|
},
|
|
|
|
isMergeRequestPipeline() {
|
|
|
|
return Boolean(this.pipeline.flags && this.pipeline.flags.merge_request_pipeline);
|
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onStageClick(stage) {
|
|
|
|
this.$emit('requestSidebarStageDropdown', stage);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2018-11-20 20:47:30 +05:30
|
|
|
</script>
|
|
|
|
<template>
|
2021-04-17 20:07:23 +05:30
|
|
|
<div class="dropdown">
|
2021-04-29 21:17:54 +05:30
|
|
|
<div class="js-pipeline-info" data-testid="pipeline-info">
|
2021-10-27 15:23:28 +05:30
|
|
|
<ci-icon :status="pipeline.details.status" />
|
2019-05-18 00:54:41 +05:30
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
<span class="font-weight-bold">{{ s__('Job|Pipeline') }}</span>
|
2021-03-08 18:12:59 +05:30
|
|
|
<gl-link
|
|
|
|
:href="pipeline.path"
|
|
|
|
class="js-pipeline-path link-commit"
|
2021-04-29 21:17:54 +05:30
|
|
|
data-testid="pipeline-path"
|
2021-03-08 18:12:59 +05:30
|
|
|
data-qa-selector="pipeline_path"
|
2019-07-07 11:18:12 +05:30
|
|
|
>#{{ pipeline.id }}</gl-link
|
|
|
|
>
|
|
|
|
<template v-if="hasRef">
|
|
|
|
{{ s__('Job|for') }}
|
|
|
|
|
|
|
|
<template v-if="isTriggeredByMergeRequest">
|
2021-04-29 21:17:54 +05:30
|
|
|
<gl-link
|
|
|
|
:href="pipeline.merge_request.path"
|
|
|
|
class="link-commit ref-name"
|
|
|
|
data-testid="mr-link"
|
2019-07-07 11:18:12 +05:30
|
|
|
>!{{ pipeline.merge_request.iid }}</gl-link
|
|
|
|
>
|
|
|
|
{{ s__('Job|with') }}
|
|
|
|
<gl-link
|
|
|
|
:href="pipeline.merge_request.source_branch_path"
|
2021-04-29 21:17:54 +05:30
|
|
|
class="link-commit ref-name"
|
|
|
|
data-testid="source-branch-link"
|
2019-07-07 11:18:12 +05:30
|
|
|
>{{ pipeline.merge_request.source_branch }}</gl-link
|
|
|
|
>
|
|
|
|
|
|
|
|
<template v-if="isMergeRequestPipeline">
|
|
|
|
{{ s__('Job|into') }}
|
|
|
|
<gl-link
|
|
|
|
:href="pipeline.merge_request.target_branch_path"
|
2021-04-29 21:17:54 +05:30
|
|
|
class="link-commit ref-name"
|
|
|
|
data-testid="target-branch-link"
|
2019-07-07 11:18:12 +05:30
|
|
|
>{{ pipeline.merge_request.target_branch }}</gl-link
|
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<gl-link v-else :href="pipeline.ref.path" class="link-commit ref-name">{{
|
|
|
|
pipeline.ref.name
|
2021-10-27 15:23:28 +05:30
|
|
|
}}</gl-link
|
|
|
|
><clipboard-button
|
|
|
|
:text="pipeline.ref.name"
|
|
|
|
:title="__('Copy reference')"
|
|
|
|
category="tertiary"
|
|
|
|
size="small"
|
|
|
|
data-testid="copy-source-ref-link"
|
|
|
|
/>
|
2019-07-07 11:18:12 +05:30
|
|
|
</template>
|
|
|
|
</div>
|
2018-11-20 20:47:30 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
<gl-dropdown :text="selectedStage" class="js-selected-stage gl-w-full gl-mt-3">
|
|
|
|
<gl-dropdown-item
|
|
|
|
v-for="stage in stages"
|
|
|
|
:key="stage.name"
|
|
|
|
class="js-stage-item stage-item"
|
|
|
|
@click="onStageClick(stage)"
|
|
|
|
>
|
|
|
|
{{ stage.name }}
|
|
|
|
</gl-dropdown-item>
|
|
|
|
</gl-dropdown>
|
2018-11-20 20:47:30 +05:30
|
|
|
</div>
|
|
|
|
</template>
|