2020-05-24 23:13:21 +05:30
|
|
|
<script>
|
2021-01-29 00:20:46 +05:30
|
|
|
import { GlButton, GlIcon, GlTooltipDirective } from '@gitlab/ui';
|
|
|
|
import permissionsQuery from 'shared_queries/design_management/design_permissions.query.graphql';
|
2021-04-29 21:17:54 +05:30
|
|
|
import { __, s__, sprintf } from '~/locale';
|
2020-05-24 23:13:21 +05:30
|
|
|
import timeagoMixin from '~/vue_shared/mixins/timeago';
|
|
|
|
import { DESIGNS_ROUTE_NAME } from '../../router/constants';
|
2021-03-11 19:13:27 +05:30
|
|
|
import DeleteButton from '../delete_button.vue';
|
|
|
|
import DesignNavigation from './design_navigation.vue';
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
export default {
|
2021-04-29 21:17:54 +05:30
|
|
|
i18n: {
|
|
|
|
downloadButtonLabel: s__('DesignManagement|Download design'),
|
|
|
|
},
|
2020-05-24 23:13:21 +05:30
|
|
|
components: {
|
2020-10-24 23:57:45 +05:30
|
|
|
GlButton,
|
|
|
|
GlIcon,
|
|
|
|
DesignNavigation,
|
2020-05-24 23:13:21 +05:30
|
|
|
DeleteButton,
|
|
|
|
},
|
2021-01-29 00:20:46 +05:30
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
2020-05-24 23:13:21 +05:30
|
|
|
mixins: [timeagoMixin],
|
2021-03-08 18:12:59 +05:30
|
|
|
inject: {
|
|
|
|
projectPath: {
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
issueIid: {
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
},
|
2020-05-24 23:13:21 +05:30
|
|
|
props: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
isDeleting: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
filename: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
updatedAt: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
updatedBy: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
|
|
|
isLatestVersion: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
image: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
permissions: {
|
|
|
|
createDesign: false,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
2020-10-24 23:57:45 +05:30
|
|
|
apollo: {
|
2020-05-24 23:13:21 +05:30
|
|
|
permissions: {
|
|
|
|
query: permissionsQuery,
|
|
|
|
variables() {
|
|
|
|
return {
|
|
|
|
fullPath: this.projectPath,
|
|
|
|
iid: this.issueIid,
|
|
|
|
};
|
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
update: (data) => data.project.issue.userPermissions,
|
2020-05-24 23:13:21 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
updatedText() {
|
|
|
|
return sprintf(__('Updated %{updated_at} by %{updated_by}'), {
|
|
|
|
updated_at: this.timeFormatted(this.updatedAt),
|
|
|
|
updated_by: this.updatedBy.name,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
canDeleteDesign() {
|
|
|
|
return this.permissions.createDesign;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
DESIGNS_ROUTE_NAME,
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-10-24 23:57:45 +05:30
|
|
|
<header
|
|
|
|
class="gl-display-flex gl-align-items-center gl-justify-content-space-between gl-bg-white gl-py-4 gl-pl-4 js-design-header"
|
|
|
|
>
|
|
|
|
<div class="gl-display-flex gl-align-items-center">
|
|
|
|
<router-link
|
|
|
|
:to="{
|
|
|
|
name: $options.DESIGNS_ROUTE_NAME,
|
|
|
|
query: $route.query,
|
|
|
|
}"
|
|
|
|
:aria-label="s__('DesignManagement|Go back to designs')"
|
|
|
|
data-testid="close-design"
|
|
|
|
class="gl-mr-5 gl-display-flex gl-align-items-center gl-justify-content-center text-plain"
|
|
|
|
>
|
|
|
|
<gl-icon name="close" />
|
|
|
|
</router-link>
|
2021-01-03 14:25:43 +05:30
|
|
|
<div class="gl-overflow-hidden gl-display-flex gl-align-items-center">
|
|
|
|
<h2 class="gl-m-0 str-truncated-100 gl-font-base">{{ filename }}</h2>
|
|
|
|
<small v-if="updatedAt" class="gl-text-gray-500">{{ updatedText }}</small>
|
2020-10-24 23:57:45 +05:30
|
|
|
</div>
|
2020-05-24 23:13:21 +05:30
|
|
|
</div>
|
2021-01-03 14:25:43 +05:30
|
|
|
<design-navigation :id="id" class="gl-ml-auto gl-flex-shrink-0" />
|
2021-01-29 00:20:46 +05:30
|
|
|
<gl-button
|
|
|
|
v-gl-tooltip.bottom
|
|
|
|
:href="image"
|
|
|
|
icon="download"
|
2021-04-29 21:17:54 +05:30
|
|
|
:title="$options.i18n.downloadButtonLabel"
|
|
|
|
:aria-label="$options.i18n.downloadButtonLabel"
|
2021-01-29 00:20:46 +05:30
|
|
|
/>
|
2020-05-24 23:13:21 +05:30
|
|
|
<delete-button
|
|
|
|
v-if="isLatestVersion && canDeleteDesign"
|
2021-01-29 00:20:46 +05:30
|
|
|
v-gl-tooltip.bottom
|
2020-10-24 23:57:45 +05:30
|
|
|
class="gl-ml-3"
|
2020-05-24 23:13:21 +05:30
|
|
|
:is-deleting="isDeleting"
|
2020-10-24 23:57:45 +05:30
|
|
|
button-variant="warning"
|
|
|
|
button-icon="archive"
|
|
|
|
button-category="secondary"
|
2021-01-29 00:20:46 +05:30
|
|
|
:title="s__('DesignManagement|Archive design')"
|
2021-04-17 20:07:23 +05:30
|
|
|
@delete-selected-designs="$emit('delete')"
|
2020-10-24 23:57:45 +05:30
|
|
|
/>
|
2020-05-24 23:13:21 +05:30
|
|
|
</header>
|
|
|
|
</template>
|