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

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

94 lines
2.4 KiB
Vue
Raw Normal View History

2020-03-13 15:44:24 +05:30
<script>
2021-03-11 19:13:27 +05:30
import { GlTooltipDirective, GlLink, GlBadge, GlButton, GlIcon } from '@gitlab/ui';
2020-04-08 14:13:33 +05:30
import { setUrlParams } from '~/lib/utils/url_utility';
2021-04-29 21:17:54 +05:30
import { __ } from '~/locale';
2021-03-11 19:13:27 +05:30
import { BACK_URL_PARAM } from '~/releases/constants';
2020-03-13 15:44:24 +05:30
export default {
2021-04-29 21:17:54 +05:30
i18n: {
editButton: __('Edit this release'),
2022-08-27 11:52:29 +05:30
historical: __('Historical release'),
historicalTooltip: __(
'This release was created with a date in the past. Evidence collection at the moment of the release is unavailable.',
),
2021-04-29 21:17:54 +05:30
},
2020-03-13 15:44:24 +05:30
name: 'ReleaseBlockHeader',
components: {
GlLink,
GlBadge,
2020-05-24 23:13:21 +05:30
GlButton,
2021-03-11 19:13:27 +05:30
GlIcon,
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-11-24 15:15:51 +05:30
<h2 class="card-title my-2 mr-auto">
2020-03-13 15:44:24 +05:30
<gl-link v-if="selfLink" :href="selfLink" class="font-size-inherit">
{{ release.name }}
</gl-link>
2021-03-11 19:13:27 +05:30
<template v-else>
{{ release.name }}
<gl-icon
v-gl-tooltip
name="lock"
:title="
__(
'Private - Guest users are not allowed to view detailed release information like title and source code.',
)
"
class="text-secondary gl-mb-2"
/>
</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>
2022-08-27 11:52:29 +05:30
<gl-badge
v-else-if="release.historicalRelease"
v-gl-tooltip
:title="$options.i18n.historicalTooltip"
class="gl-vertical-align-middle"
>
{{ $options.i18n.historical }}
</gl-badge>
2020-03-13 15:44:24 +05:30
</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"
2021-01-03 14:25:43 +05:30
icon="pencil"
2022-07-23 23:45:48 +05:30
class="gl-mr-3 js-edit-button gl-ml-3 gl-pb-3"
2021-04-29 21:17:54 +05:30
:title="$options.i18n.editButton"
:aria-label="$options.i18n.editButton"
2020-03-13 15:44:24 +05:30
:href="editLink"
2021-01-03 14:25:43 +05:30
/>
2020-03-13 15:44:24 +05:30
</div>
</template>