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
|
<script>
import DeprecatedModal2 from '~/vue_shared/components/deprecated_modal_2.vue';
import Icon from '~/vue_shared/components/icon.vue';
export default {
components: {
GlModal: DeprecatedModal2,
Icon,
},
props: {
currentRequest: {
type: Object,
required: true,
},
metric: {
type: String,
required: true,
},
title: {
type: String,
required: false,
default() {
return this.metric;
},
},
header: {
type: String,
required: true,
},
keys: {
type: Array,
required: true,
},
},
computed: {
metricDetails() {
return this.currentRequest.details[this.metric];
},
detailsList() {
return this.metricDetails.details;
},
},
};
</script>
<template>
<div
v-if="currentRequest.details && metricDetails"
:id="`peek-view-${metric}`"
class="view qa-performance-bar-detailed-metric"
>
<button
:data-target="`#modal-peek-${metric}-details`"
class="btn-blank btn-link bold"
type="button"
data-toggle="modal"
>
{{ metricDetails.duration }} / {{ metricDetails.calls }}
</button>
<gl-modal
:id="`modal-peek-${metric}-details`"
:header-title-text="header"
modal-size="xl"
class="performance-bar-modal"
>
<table class="table">
<template v-if="detailsList.length">
<tr v-for="(item, index) in detailsList" :key="index">
<td>
<span>{{ sprintf(__('%{duration}ms'), { duration: item.duration }) }}</span>
</td>
<td>
<div class="js-toggle-container">
<div
v-for="(key, keyIndex) in keys"
:key="key"
class="break-word"
:class="{ 'mb-3 bold': keyIndex == 0 }"
>
{{ item[key] }}
<button
v-if="keyIndex == 0 && item.backtrace"
class="text-expander js-toggle-button"
type="button"
:aria-label="__('Toggle backtrace')"
>
<icon :size="12" name="ellipsis_h" />
</button>
</div>
<pre v-if="item.backtrace" class="backtrace-row js-toggle-content mt-2">{{
item.backtrace
}}</pre>
</div>
</td>
</tr>
</template>
<template v-else>
<tr>
<td>
{{ sprintf(__('No %{header} for this request.'), { header: header.toLowerCase() }) }}
</td>
</tr>
</template>
</table>
<div slot="footer"></div>
</gl-modal>
{{ title }}
</div>
</template>
|