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
|
<script>
import { GlTooltipDirective, GlResizeObserverDirective } from '@gitlab/ui';
import { mapActions } from 'vuex';
export default {
directives: {
GlTooltip: GlTooltipDirective,
GlResizeObserverDirective,
},
props: {
issue: {
type: Object,
required: true,
},
// failed || success
status: {
type: String,
required: true,
},
},
data: () => ({
tooltipTitle: '',
}),
mounted() {
this.updateTooltipTitle();
},
methods: {
...mapActions(['openModal']),
handleIssueClick() {
const { issue, status, openModal } = this;
openModal({ issue, status });
},
updateTooltipTitle() {
// Only show the tooltip if the text is truncated with an ellipsis.
this.tooltipTitle = this.$el.offsetWidth < this.$el.scrollWidth ? this.issue.title : '';
},
},
};
</script>
<template>
<button
v-gl-tooltip="{ boundary: 'viewport' }"
v-gl-resize-observer-directive="updateTooltipTitle"
class="btn-link gl-text-truncate"
:aria-label="s__('Reports|Vulnerability Name')"
:title="tooltipTitle"
@click="handleIssueClick()"
>
{{ issue.title }}
</button>
</template>
|