1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
<script>
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';
import StatusBox from '~/issuable/components/status_box.vue';
import { IssuableStatus } from '~/issues/constants';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue';
export default {
components: {
GlIcon,
GlPopover,
GlSkeletonLoader,
IssueDueDate,
IssueMilestone,
IssueWeight: () => import('ee_component/boards/components/issue_card_weight.vue'),
StatusBox,
WorkItemTypeIcon,
},
directives: {
GlTooltip: GlTooltipDirective,
},
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;
},
isIssueClosed() {
return this.issue?.state === IssuableStatus.Closed;
},
},
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" />
<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')"
/>
<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 -->
<div>
<work-item-type-icon v-if="!$apollo.queries.issue.loading" :work-item-type="issue.type" />
<span class="gl-text-secondary">{{ `${projectPath}#${iid}` }}</span>
</div>
<!-- eslint-enable @gitlab/vue-require-i18n-strings -->
<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>
</gl-popover>
</template>
|