debian-mirror-gitlab/app/assets/javascripts/releases/components/release_block_header.vue

67 lines
1.6 KiB
Vue
Raw Normal View History

2020-03-13 15:44:24 +05:30
<script>
2020-05-24 23:13:21 +05:30
import { GlTooltipDirective, GlLink, GlBadge, GlButton } from '@gitlab/ui';
2020-03-13 15:44:24 +05:30
import Icon from '~/vue_shared/components/icon.vue';
2020-04-08 14:13:33 +05:30
import { BACK_URL_PARAM } from '~/releases/constants';
import { setUrlParams } from '~/lib/utils/url_utility';
2020-03-13 15:44:24 +05:30
export default {
name: 'ReleaseBlockHeader',
components: {
GlLink,
GlBadge,
Icon,
2020-05-24 23:13:21 +05:30
GlButton,
2020-03-13 15:44:24 +05:30
},
directives: {
GlTooltip: GlTooltipDirective,
},
props: {
release: {
type: Object,
required: true,
},
},
computed: {
editLink() {
2020-04-08 14:13:33 +05:30
if (this.release._links?.editUrl) {
const queryParams = {
[BACK_URL_PARAM]: window.location.href,
};
return setUrlParams(queryParams, this.release._links.editUrl);
}
return undefined;
2020-03-13 15:44:24 +05:30
},
selfLink() {
return this.release._links?.self;
},
},
};
</script>
<template>
<div class="card-header d-flex align-items-center bg-white pr-0">
2020-05-24 23:13:21 +05:30
<h2 class="card-title my-2 mr-auto gl-font-size-20-deprecated-no-really-do-not-use-me">
2020-03-13 15:44:24 +05:30
<gl-link v-if="selfLink" :href="selfLink" class="font-size-inherit">
{{ release.name }}
</gl-link>
<template v-else>{{ release.name }}</template>
2020-04-08 14:13:33 +05:30
<gl-badge v-if="release.upcomingRelease" variant="warning" class="align-middle">{{
2020-03-13 15:44:24 +05:30
__('Upcoming Release')
}}</gl-badge>
</h2>
2020-05-24 23:13:21 +05:30
<gl-button
2020-03-13 15:44:24 +05:30
v-if="editLink"
v-gl-tooltip
2020-05-24 23:13:21 +05:30
category="primary"
variant="default"
class="append-right-10 js-edit-button ml-2 pb-2"
2020-03-13 15:44:24 +05:30
:title="__('Edit this release')"
:href="editLink"
>
<icon name="pencil" />
2020-05-24 23:13:21 +05:30
</gl-button>
2020-03-13 15:44:24 +05:30
</div>
</template>