Welcome to mirror list, hosted at ThFree Co, Russian Federation.

nav_dropdown_button.vue « components « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6cee4e9a8f0baef69e91186b16505345ceb65600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<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() {
      return this.currentMergeRequestId ? `!${this.currentMergeRequestId}` : EMPTY_LABEL;
    },
    branchLabel() {
      return this.currentBranchId || EMPTY_LABEL;
    },
  },
};
</script>

<template>
  <dropdown-button>
    <span
      class="row"
    >
      <span
        class="col-7 text-truncate"
      >
        <icon
          :size="16"
          :aria-label="__('Current Branch')"
          name="branch"
        />
        {{ branchLabel }}
      </span>
      <span
        class="col-5 pl-0 text-truncate"
      >
        <icon
          :size="16"
          :aria-label="__('Merge Request')"
          name="merge-request"
        />
        {{ mergeRequestLabel }}
      </span>
    </span>
  </dropdown-button>
</template>