2018-11-18 11:00:15 +05:30
|
|
|
<script>
|
2020-11-24 15:15:51 +05:30
|
|
|
import { GlIcon } from '@gitlab/ui';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { mapState } from 'vuex';
|
2018-11-18 11:00:15 +05:30
|
|
|
import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue';
|
|
|
|
|
|
|
|
const EMPTY_LABEL = '-';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2020-11-24 15:15:51 +05:30
|
|
|
GlIcon,
|
2018-11-18 11:00:15 +05:30
|
|
|
DropdownButton,
|
|
|
|
},
|
2020-03-13 15:44:24 +05:30
|
|
|
props: {
|
|
|
|
showMergeRequests: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
computed: {
|
|
|
|
...mapState(['currentBranchId', 'currentMergeRequestId']),
|
|
|
|
mergeRequestLabel() {
|
2018-12-13 13:39:08 +05:30
|
|
|
return this.currentMergeRequestId ? `!${this.currentMergeRequestId}` : EMPTY_LABEL;
|
2018-11-18 11:00:15 +05:30
|
|
|
},
|
|
|
|
branchLabel() {
|
|
|
|
return this.currentBranchId || EMPTY_LABEL;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<dropdown-button>
|
2021-04-29 21:17:54 +05:30
|
|
|
<span class="row gl-flex-nowrap">
|
2020-04-08 14:13:33 +05:30
|
|
|
<span class="col-auto flex-fill text-truncate">
|
2020-11-24 15:15:51 +05:30
|
|
|
<gl-icon :size="16" :aria-label="__('Current Branch')" name="branch" /> {{ branchLabel }}
|
2018-11-18 11:00:15 +05:30
|
|
|
</span>
|
2020-03-13 15:44:24 +05:30
|
|
|
<span v-if="showMergeRequests" class="col-5 pl-0 text-truncate">
|
2021-04-29 21:17:54 +05:30
|
|
|
<gl-icon :size="16" :aria-label="__('Merge request')" name="merge-request" />
|
2018-11-18 11:00:15 +05:30
|
|
|
{{ mergeRequestLabel }}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</dropdown-button>
|
|
|
|
</template>
|