debian-mirror-gitlab/app/assets/javascripts/ide/components/nav_dropdown_button.vue

38 lines
993 B
Vue
Raw Normal View History

2018-11-18 11:00:15 +05:30
<script>
import { mapState } from 'vuex';
import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue';
import Icon from '~/vue_shared/components/icon.vue';
const EMPTY_LABEL = '-';
export default {
components: {
Icon,
DropdownButton,
},
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>
2019-02-15 15:39:39 +05:30
<span class="row">
<span class="col-7 text-truncate">
<icon :size="16" :aria-label="__('Current Branch')" name="branch" /> {{ branchLabel }}
2018-11-18 11:00:15 +05:30
</span>
2019-02-15 15:39:39 +05:30
<span class="col-5 pl-0 text-truncate">
<icon :size="16" :aria-label="__('Merge Request')" name="merge-request" />
2018-11-18 11:00:15 +05:30
{{ mergeRequestLabel }}
</span>
</span>
</dropdown-button>
</template>