debian-mirror-gitlab/app/assets/javascripts/jobs/components/stages_dropdown.vue

65 lines
1.5 KiB
Vue
Raw Normal View History

2018-11-20 20:47:30 +05:30
<script>
2018-12-13 13:39:08 +05:30
import _ from 'underscore';
import CiIcon from '~/vue_shared/components/ci_icon.vue';
import Icon from '~/vue_shared/components/icon.vue';
2018-11-20 20:47:30 +05:30
2018-12-13 13:39:08 +05:30
export default {
components: {
CiIcon,
Icon,
},
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() {
return !_.isEmpty(this.pipeline.ref);
2018-11-20 20:47:30 +05:30
},
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>
2018-12-05 23:21:45 +05:30
<div class="block-last dropdown">
2018-12-23 12:14:25 +05:30
<ci-icon :status="pipeline.details.status" class="vertical-align-middle" />
2018-12-05 23:21:45 +05:30
{{ __('Pipeline') }}
2018-12-23 12:14:25 +05:30
<a :href="pipeline.path" class="js-pipeline-path link-commit"> #{{ pipeline.id }} </a>
2018-12-05 23:21:45 +05:30
<template v-if="hasRef">
{{ __('from') }}
2018-12-23 12:14:25 +05:30
<a :href="pipeline.ref.path" class="link-commit ref-name"> {{ pipeline.ref.name }} </a>
2018-12-05 23:21:45 +05:30
</template>
2018-11-20 20:47:30 +05:30
2018-12-05 23:21:45 +05:30
<button
type="button"
data-toggle="dropdown"
class="js-selected-stage dropdown-menu-toggle prepend-top-8"
>
2018-12-23 12:14:25 +05:30
{{ selectedStage }} <i class="fa fa-chevron-down"></i>
2018-12-05 23:21:45 +05:30
</button>
2018-11-20 20:47:30 +05:30
2018-12-05 23:21:45 +05:30
<ul class="dropdown-menu">
2018-12-23 12:14:25 +05:30
<li v-for="stage in stages" :key="stage.name">
<button type="button" class="js-stage-item stage-item" @click="onStageClick(stage);">
2018-12-05 23:21:45 +05:30
{{ stage.name }}
</button>
</li>
</ul>
2018-11-20 20:47:30 +05:30
</div>
</template>