debian-mirror-gitlab/app/assets/javascripts/diffs/components/compare_dropdown_layout.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.7 KiB
Vue
Raw Normal View History

2020-04-22 19:07:51 +05:30
<script>
2021-06-08 01:23:25 +05:30
import { GlDropdown, GlDropdownItem, GlDropdownDivider } from '@gitlab/ui';
2020-04-22 19:07:51 +05:30
import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue';
export default {
components: {
2021-02-22 17:27:13 +05:30
GlDropdown,
GlDropdownItem,
2021-06-08 01:23:25 +05:30
GlDropdownDivider,
2020-04-22 19:07:51 +05:30
TimeAgo,
},
props: {
versions: {
type: Array,
required: true,
},
},
computed: {
selectedVersionName() {
2021-03-08 18:12:59 +05:30
return this.versions.find((x) => x.selected)?.versionName || '';
2020-04-22 19:07:51 +05:30
},
},
};
</script>
<template>
2022-07-16 23:28:13 +05:30
<gl-dropdown
:text="selectedVersionName"
data-qa-selector="dropdown_content"
size="small"
category="tertiary"
>
2021-06-08 01:23:25 +05:30
<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,
}"
2022-10-11 01:57:18 +05:30
is-check-item
2021-06-08 01:23:25 +05:30
: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>
2021-02-22 17:27:13 +05:30
</gl-dropdown>
2020-04-22 19:07:51 +05:30
</template>