debian-mirror-gitlab/app/assets/javascripts/issuable/popover/components/issue_popover.vue

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

130 lines
3.6 KiB
Vue
Raw Normal View History

2022-07-23 23:45:48 +05:30
<script>
2022-08-27 11:52:29 +05:30
import { GlIcon, GlPopover, GlSkeletonLoader, GlTooltipDirective } from '@gitlab/ui';
import query from 'ee_else_ce/issuable/popover/queries/issue.query.graphql';
import IssueDueDate from '~/boards/components/issue_due_date.vue';
import IssueMilestone from '~/issuable/components/issue_milestone.vue';
2022-07-23 23:45:48 +05:30
import StatusBox from '~/issuable/components/status_box.vue';
2023-04-23 21:23:45 +05:30
import { STATUS_CLOSED } from '~/issues/constants';
2022-07-23 23:45:48 +05:30
import timeagoMixin from '~/vue_shared/mixins/timeago';
2022-08-27 11:52:29 +05:30
import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue';
2022-07-23 23:45:48 +05:30
export default {
components: {
2022-08-27 11:52:29 +05:30
GlIcon,
2022-07-23 23:45:48 +05:30
GlPopover,
GlSkeletonLoader,
2022-08-27 11:52:29 +05:30
IssueDueDate,
IssueMilestone,
IssueWeight: () => import('ee_component/boards/components/issue_card_weight.vue'),
2022-07-23 23:45:48 +05:30
StatusBox,
2022-08-27 11:52:29 +05:30
WorkItemTypeIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
2022-07-23 23:45:48 +05:30
},
mixins: [timeagoMixin],
props: {
target: {
type: HTMLAnchorElement,
required: true,
},
projectPath: {
type: String,
required: true,
},
iid: {
type: String,
required: true,
},
cachedTitle: {
type: String,
required: true,
},
},
data() {
return {
issue: {},
};
},
computed: {
formattedTime() {
return this.timeFormatted(this.issue.createdAt);
},
title() {
return this.issue?.title || this.cachedTitle;
},
showDetails() {
return Object.keys(this.issue).length > 0;
},
2022-08-27 11:52:29 +05:30
isIssueClosed() {
2023-04-23 21:23:45 +05:30
return this.issue?.state === STATUS_CLOSED;
2022-08-27 11:52:29 +05:30
},
2022-07-23 23:45:48 +05:30
},
apollo: {
issue: {
query,
update: (data) => data.project.issue,
variables() {
const { projectPath, iid } = this;
return {
projectPath,
iid,
};
},
},
},
};
</script>
<template>
<gl-popover :target="target" boundary="viewport" placement="top" show>
<gl-skeleton-loader v-if="$apollo.queries.issue.loading" :height="15">
<rect width="250" height="15" rx="4" />
</gl-skeleton-loader>
<div v-else-if="showDetails" class="gl-display-flex gl-align-items-center">
<status-box issuable-type="issue" :initial-state="issue.state" />
2022-08-27 11:52:29 +05:30
<gl-icon
v-if="issue.confidential"
v-gl-tooltip
name="eye-slash"
:title="__('Confidential')"
class="gl-text-orange-500 gl-mr-2"
:aria-label="__('Confidential')"
/>
2022-07-23 23:45:48 +05:30
<span class="gl-text-secondary">
{{ __('Opened') }} <time :datetime="issue.createdAt">{{ formattedTime }}</time>
</span>
</div>
<h5 v-if="!$apollo.queries.issue.loading" class="gl-my-3">{{ title }}</h5>
<!-- eslint-disable @gitlab/vue-require-i18n-strings -->
2022-08-27 11:52:29 +05:30
<div>
<work-item-type-icon v-if="!$apollo.queries.issue.loading" :work-item-type="issue.type" />
<span class="gl-text-secondary">{{ `${projectPath}#${iid}` }}</span>
2022-07-23 23:45:48 +05:30
</div>
<!-- eslint-enable @gitlab/vue-require-i18n-strings -->
2022-08-27 11:52:29 +05:30
<div v-if="!$apollo.queries.issue.loading" class="gl-display-flex gl-text-secondary gl-mt-2">
<issue-due-date
v-if="issue.dueDate"
:date="issue.dueDate.toString()"
:closed="isIssueClosed"
tooltip-placement="top"
class="gl-mr-4"
css-class="gl-display-flex gl-white-space-nowrap"
/>
<issue-weight
v-if="issue.weight"
:weight="issue.weight"
tag-name="span"
class="gl-display-flex gl-mr-4"
/>
<issue-milestone
v-if="issue.milestone"
:milestone="issue.milestone"
class="gl-display-flex gl-overflow-hidden"
/>
</div>
2022-07-23 23:45:48 +05:30
</gl-popover>
</template>