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

compare_dropdown_layout.vue « components « diffs « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fd219a7d00f21a2eed22586d2bc380337ff98dbe (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<script>
import { GlDropdown, GlDropdownItem, GlDropdownDivider } from '@gitlab/ui';
import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';

export default {
  components: {
    GlDropdown,
    GlDropdownItem,
    GlDropdownDivider,
    TimeAgo,
  },
  props: {
    versions: {
      type: Array,
      required: true,
    },
  },
  computed: {
    selectedVersionName() {
      return this.versions.find((x) => x.selected)?.versionName || '';
    },
  },
};
</script>

<template>
  <gl-dropdown
    :text="selectedVersionName"
    data-qa-selector="dropdown_content"
    size="small"
    category="tertiary"
  >
    <template v-for="version in versions">
      <gl-dropdown-divider v-if="version.addDivider" :key="version.id" />
      <gl-dropdown-item
        :key="version.id"
        :class="{
          'is-active': version.selected,
        }"
        :is-check-item="true"
        :is-checked="version.selected"
        :href="version.href"
      >
        <div>
          <strong>
            {{ version.versionName }}
            <template v-if="version.isHead">{{ s__('DiffsCompareBaseBranch|(HEAD)') }}</template>
            <template v-else-if="version.isBase">{{
              s__('DiffsCompareBaseBranch|(base)')
            }}</template>
          </strong>
        </div>
        <div>
          <small class="commit-sha"> {{ version.short_commit_sha }} </small>
        </div>
        <div>
          <small>
            <template v-if="version.commitsText">
              {{ version.commitsText }}
            </template>
            <time-ago v-if="version.created_at" :time="version.created_at" class="js-timeago" />
          </small>
        </div>
      </gl-dropdown-item>
    </template>
  </gl-dropdown>
</template>