@kong-ui-public/analytics-metric-provider 5.1.4 → 5.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ref as pe, watchEffect as Fe, computed as g, getCurrentInstance as He, reactive as Be, onMounted as $e, onUnmounted as Pe, watch as Ke, isReadonly as Ze, toRefs as Ue, defineComponent as k, inject as xe, toRef as Ge, provide as je, renderSlot as ke, resolveComponent as qe, openBlock as p, createElementBlock as y, createElementVNode as I, normalizeClass as G, unref as w, createCommentVNode as T, createBlock as N, resolveDynamicComponent as z, withCtx as A, createTextVNode as
|
|
1
|
+
import { ref as pe, watchEffect as Fe, computed as g, getCurrentInstance as He, reactive as Be, onMounted as $e, onUnmounted as Pe, watch as Ke, isReadonly as Ze, toRefs as Ue, defineComponent as k, inject as xe, toRef as Ge, provide as je, renderSlot as ke, resolveComponent as qe, openBlock as p, createElementBlock as y, createElementVNode as I, normalizeClass as G, unref as w, createCommentVNode as T, createBlock as N, resolveDynamicComponent as z, withCtx as A, createTextVNode as Ye, toDisplayString as R, createVNode as Y, normalizeStyle as V, Fragment as Se, renderList as Xe, mergeProps as Qe, pushScopeId as L, popScopeId as M, normalizeProps as We, guardReactiveProps as Je } from "vue";
|
|
2
2
|
import { TimePeriods as re, TimeframeKeys as te, queryableExploreDimensions as er, DeltaQueryTime as rr, UnaryQueryTime as tr } from "@kong-ui-public/analytics-utilities";
|
|
3
3
|
import { createI18n as ir, i18nTComponent as nr } from "@kong-ui-public/i18n";
|
|
4
4
|
import { useAnalyticsConfigStore as ar, SEVEN_DAYS_MS as or } from "@kong-ui-public/analytics-config-store";
|
|
5
|
-
const
|
|
5
|
+
const lr = {
|
|
6
6
|
notAvailable: "N/A"
|
|
7
|
-
},
|
|
7
|
+
}, sr = {
|
|
8
8
|
short: {
|
|
9
9
|
traffic: "Requests",
|
|
10
10
|
errorRate: "Error Rate",
|
|
@@ -15,7 +15,7 @@ const sr = {
|
|
|
15
15
|
errorRate: "Average Error Rate",
|
|
16
16
|
latency: "P99 Latency"
|
|
17
17
|
}
|
|
18
|
-
},
|
|
18
|
+
}, ur = {
|
|
19
19
|
custom: "vs previous {numDays, plural, =1 {day} other {# days}}",
|
|
20
20
|
"15m": "vs previous 15 minutes",
|
|
21
21
|
"1h": "vs previous hour",
|
|
@@ -31,9 +31,9 @@ const sr = {
|
|
|
31
31
|
previous_month: "vs previous time period",
|
|
32
32
|
previous_quarter: "vs previous quarter"
|
|
33
33
|
}, dr = {
|
|
34
|
-
general:
|
|
35
|
-
metricCard:
|
|
36
|
-
trendRange:
|
|
34
|
+
general: lr,
|
|
35
|
+
metricCard: sr,
|
|
36
|
+
trendRange: ur
|
|
37
37
|
};
|
|
38
38
|
function cr() {
|
|
39
39
|
const e = ir("en-us", dr);
|
|
@@ -87,18 +87,18 @@ function yr(e = pe({}), r, t, a = gr) {
|
|
|
87
87
|
swrvState: ze
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
const B = Symbol("default"),
|
|
90
|
+
const B = Symbol("default"), se = "status_code_grouped", _e = (e, r, t, a, n) => {
|
|
91
91
|
e[r][t] || (e[r][t] = {}), e[r][t][a] = n;
|
|
92
92
|
};
|
|
93
93
|
function mr(e, r) {
|
|
94
94
|
var f;
|
|
95
|
-
const t = ((f = e.meta.metric_names) == null ? void 0 : f[0]) || "", a = e.meta.start_ms, n = Object.keys(e.meta.display || {}), i = !!n.find((c) => c ===
|
|
95
|
+
const t = ((f = e.meta.metric_names) == null ? void 0 : f[0]) || "", a = e.meta.start_ms, n = Object.keys(e.meta.display || {}), i = !!n.find((c) => c === se), s = n.find((c) => c !== se);
|
|
96
96
|
return n.length > 2 || n.length > 1 && !i ? (console.error("Don't know how to work with provided dimensions:", n), {
|
|
97
97
|
previous: { [B]: { [B]: 0 } },
|
|
98
98
|
current: { [B]: { [B]: 0 } }
|
|
99
99
|
}) : e.data.reduce((c, o) => {
|
|
100
|
-
const
|
|
101
|
-
return new Date(o.timestamp).getTime() === a && r ? _e(c, "previous",
|
|
100
|
+
const l = o.event[t], u = s ? o.event[s] : B, d = i ? o.event[se] : B;
|
|
101
|
+
return new Date(o.timestamp).getTime() === a && r ? _e(c, "previous", u, d, l) : _e(c, "current", u, d, l), c;
|
|
102
102
|
}, {
|
|
103
103
|
previous: {},
|
|
104
104
|
current: {}
|
|
@@ -107,11 +107,11 @@ function mr(e, r) {
|
|
|
107
107
|
function hr(e) {
|
|
108
108
|
e.queryReady === void 0 && (e.queryReady = g(() => !0));
|
|
109
109
|
const { i18n: r } = K.useI18n(), t = g(() => {
|
|
110
|
-
var
|
|
110
|
+
var u, d;
|
|
111
111
|
return {
|
|
112
112
|
metrics: e.metrics,
|
|
113
113
|
dimensions: [
|
|
114
|
-
...(
|
|
114
|
+
...(u = e.dimensions) != null && u.length ? [...e.dimensions] : [],
|
|
115
115
|
...e.withTrend.value ? ["time"] : []
|
|
116
116
|
],
|
|
117
117
|
granularity: e.withTrend.value ? "trend" : void 0,
|
|
@@ -122,9 +122,9 @@ function hr(e) {
|
|
|
122
122
|
var d, v, b, m;
|
|
123
123
|
if (!((d = e.queryReady) != null && d.value) || e.featureFlags && !e.featureFlags.every((h) => h))
|
|
124
124
|
return null;
|
|
125
|
-
const
|
|
126
|
-
return `metric-fetcher-${e.timeframe.value.cacheKey()}-${(b = e.dimensions) == null ? void 0 : b.join("-")}-${(m = e.metrics) == null ? void 0 : m.join("-")}-${
|
|
127
|
-
}), { response: n, error: i, isValidating:
|
|
125
|
+
const u = (v = e.filter) != null && v.value ? JSON.stringify(e.filter.value) : "";
|
|
126
|
+
return `metric-fetcher-${e.timeframe.value.cacheKey()}-${(b = e.dimensions) == null ? void 0 : b.join("-")}-${(m = e.metrics) == null ? void 0 : m.join("-")}-${u}`;
|
|
127
|
+
}), { response: n, error: i, isValidating: s } = K.useRequest(
|
|
128
128
|
() => a.value,
|
|
129
129
|
() => e.queryFn(t.value, e.abortController ?? new AbortController()),
|
|
130
130
|
{
|
|
@@ -132,13 +132,13 @@ function hr(e) {
|
|
|
132
132
|
revalidateOnFocus: !1,
|
|
133
133
|
errorRetryCount: fr
|
|
134
134
|
}
|
|
135
|
-
), { state: f, swrvState: c } = yr(n, i,
|
|
136
|
-
var
|
|
137
|
-
return !((d = (
|
|
138
|
-
}),
|
|
139
|
-
var
|
|
135
|
+
), { state: f, swrvState: c } = yr(n, i, s), o = g(() => {
|
|
136
|
+
var u, d, v, b, m, h, x;
|
|
137
|
+
return !((d = (u = n.value) == null ? void 0 : u.data) != null && d.length) || !((b = (v = n.value) == null ? void 0 : v.meta) != null && b.display) || !((x = (h = (m = n.value) == null ? void 0 : m.meta) == null ? void 0 : h.metric_names) != null && x.length) ? { current: {}, previous: {} } : mr(n.value, e.withTrend.value);
|
|
138
|
+
}), l = g(() => {
|
|
139
|
+
var u, d, v;
|
|
140
140
|
if (e.timeframe.value.key === "custom") {
|
|
141
|
-
if (!((d = (
|
|
141
|
+
if (!((d = (u = n.value) == null ? void 0 : u.meta) != null && d.start_ms))
|
|
142
142
|
return "";
|
|
143
143
|
const { start_ms: b, end_ms: m } = n.value.meta;
|
|
144
144
|
let h = (m - b) / (1e3 * 60 * 60 * 24);
|
|
@@ -151,12 +151,12 @@ function hr(e) {
|
|
|
151
151
|
hasError: g(() => c.ERROR === f.value),
|
|
152
152
|
raw: n,
|
|
153
153
|
mapped: o,
|
|
154
|
-
trendRange:
|
|
154
|
+
trendRange: l
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
const j = (e, r, t = B, a) => (a ?? [B]).reduce((i,
|
|
157
|
+
const j = (e, r, t = B, a) => (a ?? [B]).reduce((i, s) => {
|
|
158
158
|
const f = e[r][t];
|
|
159
|
-
return f ? i + (f[
|
|
159
|
+
return f ? i + (f[s] || 0) : i;
|
|
160
160
|
}, 0);
|
|
161
161
|
function Cr(e) {
|
|
162
162
|
const {
|
|
@@ -165,42 +165,42 @@ function Cr(e) {
|
|
|
165
165
|
description: a,
|
|
166
166
|
record: n,
|
|
167
167
|
hasError: i,
|
|
168
|
-
increaseIsBad:
|
|
168
|
+
increaseIsBad: s,
|
|
169
169
|
formatValueFn: f,
|
|
170
170
|
trendRange: c
|
|
171
171
|
} = e;
|
|
172
172
|
return g(() => {
|
|
173
|
-
let o = 0,
|
|
173
|
+
let o = 0, l = 0;
|
|
174
174
|
if (n != null && n.value)
|
|
175
175
|
try {
|
|
176
|
-
o = j(n.value, "current", e.lookupKey, e.sumGroupedValues),
|
|
177
|
-
} catch (
|
|
176
|
+
o = j(n.value, "current", e.lookupKey, e.sumGroupedValues), l = j(n.value, "previous", e.lookupKey, e.sumGroupedValues);
|
|
177
|
+
} catch (u) {
|
|
178
178
|
console.error(
|
|
179
179
|
"Metric card data doesn't have the expected structure:",
|
|
180
|
-
|
|
180
|
+
u
|
|
181
181
|
);
|
|
182
182
|
}
|
|
183
183
|
return {
|
|
184
184
|
cardType: r,
|
|
185
185
|
hasError: i.value,
|
|
186
186
|
currentValue: o,
|
|
187
|
-
previousValue:
|
|
187
|
+
previousValue: l,
|
|
188
188
|
title: t.value,
|
|
189
189
|
description: a,
|
|
190
|
-
increaseIsBad: !!
|
|
190
|
+
increaseIsBad: !!s,
|
|
191
191
|
// Coerce undefined to false
|
|
192
192
|
formatValueFn: f,
|
|
193
193
|
trendRange: c == null ? void 0 : c.value
|
|
194
194
|
};
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
var
|
|
197
|
+
var ue = /* @__PURE__ */ new WeakMap(), Re = 0;
|
|
198
198
|
function br(e) {
|
|
199
199
|
if (!e.length)
|
|
200
200
|
return "";
|
|
201
201
|
for (var r = "arg", t = 0; t < e.length; ++t) {
|
|
202
202
|
var a = void 0;
|
|
203
|
-
e[t] === null || typeof e[t] != "object" && typeof e[t] != "function" ? typeof e[t] == "string" ? a = '"' + e[t] + '"' : a = String(e[t]) :
|
|
203
|
+
e[t] === null || typeof e[t] != "object" && typeof e[t] != "function" ? typeof e[t] == "string" ? a = '"' + e[t] + '"' : a = String(e[t]) : ue.has(e[t]) ? a = ue.get(e[t]) : (a = Re, ue.set(e[t], Re++)), r += "@" + a;
|
|
204
204
|
}
|
|
205
205
|
return r;
|
|
206
206
|
}
|
|
@@ -225,17 +225,17 @@ var ve = (
|
|
|
225
225
|
var t = this.serializeKey(r);
|
|
226
226
|
return this.items.get(t);
|
|
227
227
|
}, e.prototype.set = function(r, t, a) {
|
|
228
|
-
var n = this.serializeKey(r), i = a || this.ttl,
|
|
228
|
+
var n = this.serializeKey(r), i = a || this.ttl, s = Date.now(), f = {
|
|
229
229
|
data: t,
|
|
230
|
-
createdAt:
|
|
231
|
-
expiresAt: i ?
|
|
230
|
+
createdAt: s,
|
|
231
|
+
expiresAt: i ? s + i : 1 / 0
|
|
232
232
|
};
|
|
233
233
|
this.dispatchExpire(i, f, n), this.items.set(n, f);
|
|
234
234
|
}, e.prototype.dispatchExpire = function(r, t, a) {
|
|
235
235
|
var n = this;
|
|
236
236
|
r && setTimeout(function() {
|
|
237
|
-
var i = Date.now(),
|
|
238
|
-
|
|
237
|
+
var i = Date.now(), s = i >= t.expiresAt;
|
|
238
|
+
s && n.delete(a);
|
|
239
239
|
}, r);
|
|
240
240
|
}, e.prototype.delete = function(r) {
|
|
241
241
|
this.items.delete(r);
|
|
@@ -269,27 +269,27 @@ var O = function() {
|
|
|
269
269
|
}, O.apply(this, arguments);
|
|
270
270
|
}, Z = function(e, r, t, a) {
|
|
271
271
|
function n(i) {
|
|
272
|
-
return i instanceof t ? i : new t(function(
|
|
273
|
-
|
|
272
|
+
return i instanceof t ? i : new t(function(s) {
|
|
273
|
+
s(i);
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
-
return new (t || (t = Promise))(function(i,
|
|
277
|
-
function f(
|
|
276
|
+
return new (t || (t = Promise))(function(i, s) {
|
|
277
|
+
function f(l) {
|
|
278
278
|
try {
|
|
279
|
-
o(a.next(
|
|
280
|
-
} catch (
|
|
281
|
-
u
|
|
279
|
+
o(a.next(l));
|
|
280
|
+
} catch (u) {
|
|
281
|
+
s(u);
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
function c(
|
|
284
|
+
function c(l) {
|
|
285
285
|
try {
|
|
286
|
-
o(a.throw(
|
|
287
|
-
} catch (
|
|
288
|
-
u
|
|
286
|
+
o(a.throw(l));
|
|
287
|
+
} catch (u) {
|
|
288
|
+
s(u);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
function o(
|
|
292
|
-
|
|
291
|
+
function o(l) {
|
|
292
|
+
l.done ? i(l.value) : n(l.value).then(f, c);
|
|
293
293
|
}
|
|
294
294
|
o((a = a.apply(e, r || [])).next());
|
|
295
295
|
});
|
|
@@ -298,13 +298,13 @@ var O = function() {
|
|
|
298
298
|
if (i[0] & 1)
|
|
299
299
|
throw i[1];
|
|
300
300
|
return i[1];
|
|
301
|
-
}, trys: [], ops: [] }, a, n, i,
|
|
302
|
-
return
|
|
301
|
+
}, trys: [], ops: [] }, a, n, i, s;
|
|
302
|
+
return s = { next: f(0), throw: f(1), return: f(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
303
303
|
return this;
|
|
304
|
-
}),
|
|
304
|
+
}), s;
|
|
305
305
|
function f(o) {
|
|
306
|
-
return function(
|
|
307
|
-
return c([o,
|
|
306
|
+
return function(l) {
|
|
307
|
+
return c([o, l]);
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
310
|
function c(o) {
|
|
@@ -348,8 +348,8 @@ var O = function() {
|
|
|
348
348
|
continue;
|
|
349
349
|
}
|
|
350
350
|
o = r.call(e, t);
|
|
351
|
-
} catch (
|
|
352
|
-
o = [6,
|
|
351
|
+
} catch (l) {
|
|
352
|
+
o = [6, l], n = 0;
|
|
353
353
|
} finally {
|
|
354
354
|
a = i = 0;
|
|
355
355
|
}
|
|
@@ -361,18 +361,18 @@ var O = function() {
|
|
|
361
361
|
var t = typeof Symbol == "function" && e[Symbol.iterator];
|
|
362
362
|
if (!t)
|
|
363
363
|
return e;
|
|
364
|
-
var a = t.call(e), n, i = [],
|
|
364
|
+
var a = t.call(e), n, i = [], s;
|
|
365
365
|
try {
|
|
366
366
|
for (; (r === void 0 || r-- > 0) && !(n = a.next()).done; )
|
|
367
367
|
i.push(n.value);
|
|
368
368
|
} catch (f) {
|
|
369
|
-
|
|
369
|
+
s = { error: f };
|
|
370
370
|
} finally {
|
|
371
371
|
try {
|
|
372
372
|
n && !n.done && (t = a.return) && t.call(a);
|
|
373
373
|
} finally {
|
|
374
|
-
if (
|
|
375
|
-
throw
|
|
374
|
+
if (s)
|
|
375
|
+
throw s.error;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
return i;
|
|
@@ -415,37 +415,37 @@ function Ir(e, r, t) {
|
|
|
415
415
|
}
|
|
416
416
|
var Te = function(e, r, t, a) {
|
|
417
417
|
return t === void 0 && (t = Ae), a === void 0 && (a = Ve.ttl), Z(void 0, void 0, void 0, function() {
|
|
418
|
-
var n, i,
|
|
419
|
-
return U(this, function(
|
|
420
|
-
switch (
|
|
418
|
+
var n, i, s, f, c, o, l;
|
|
419
|
+
return U(this, function(u) {
|
|
420
|
+
switch (u.label) {
|
|
421
421
|
case 0:
|
|
422
422
|
if (!kr(r))
|
|
423
423
|
return [3, 5];
|
|
424
|
-
|
|
424
|
+
u.label = 1;
|
|
425
425
|
case 1:
|
|
426
|
-
return
|
|
426
|
+
return u.trys.push([1, 3, , 4]), [4, r];
|
|
427
427
|
case 2:
|
|
428
|
-
return n =
|
|
428
|
+
return n = u.sent(), [3, 4];
|
|
429
429
|
case 3:
|
|
430
|
-
return f =
|
|
430
|
+
return f = u.sent(), i = f, [3, 4];
|
|
431
431
|
case 4:
|
|
432
432
|
return [3, 6];
|
|
433
433
|
case 5:
|
|
434
|
-
n = r,
|
|
434
|
+
n = r, u.label = 6;
|
|
435
435
|
case 6:
|
|
436
|
-
if (
|
|
436
|
+
if (s = !1, c = { data: n, error: i, isValidating: s }, typeof n < "u")
|
|
437
437
|
try {
|
|
438
438
|
t.set(e, c, a);
|
|
439
439
|
} catch (d) {
|
|
440
440
|
console.error("swrv(mutate): failed to set cache", d);
|
|
441
441
|
}
|
|
442
|
-
return o = ie.get(e), o && o.data.length && (
|
|
442
|
+
return o = ie.get(e), o && o.data.length && (l = o.data.filter(function(d) {
|
|
443
443
|
return d.key === e;
|
|
444
|
-
}),
|
|
444
|
+
}), l.forEach(function(d, v) {
|
|
445
445
|
typeof c.data < "u" && (d.data = c.data), d.error = c.error, d.isValidating = c.isValidating;
|
|
446
|
-
var b = v ===
|
|
447
|
-
b || delete
|
|
448
|
-
}),
|
|
446
|
+
var b = v === l.length - 1;
|
|
447
|
+
b || delete l[v];
|
|
448
|
+
}), l = l.filter(Boolean)), [2, c];
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
});
|
|
@@ -453,12 +453,12 @@ var Te = function(e, r, t, a) {
|
|
|
453
453
|
function xr() {
|
|
454
454
|
for (var e = this, r = [], t = 0; t < arguments.length; t++)
|
|
455
455
|
r[t] = arguments[t];
|
|
456
|
-
var a, n, i = O({}, Ve),
|
|
456
|
+
var a, n, i = O({}, Ve), s = !1, f = !1, c = He(), o = (c == null ? void 0 : c.proxy) || c;
|
|
457
457
|
if (!o)
|
|
458
458
|
return console.error("Could not get current instance, check to make sure that `useSwrv` is declared in the top level of the setup function."), null;
|
|
459
|
-
var
|
|
459
|
+
var l = (o == null ? void 0 : o.$isServer) || !1;
|
|
460
460
|
r.length >= 1 && (a = r[0]), r.length >= 2 && (n = r[1]), r.length > 2 && (i = O(O({}, i), r[2]));
|
|
461
|
-
var
|
|
461
|
+
var u = l ? i.serverTTL : i.ttl, d = typeof a == "function" ? a : pe(a);
|
|
462
462
|
typeof n > "u" && (n = i.fetcher);
|
|
463
463
|
var v = null;
|
|
464
464
|
v || (v = Be({
|
|
@@ -469,11 +469,11 @@ function xr() {
|
|
|
469
469
|
}));
|
|
470
470
|
var b = function(S, C) {
|
|
471
471
|
return Z(e, void 0, void 0, function() {
|
|
472
|
-
var H, E, $,
|
|
472
|
+
var H, E, $, X, ne, me, ae, he = this;
|
|
473
473
|
return U(this, function(oe) {
|
|
474
474
|
switch (oe.label) {
|
|
475
475
|
case 0:
|
|
476
|
-
return H = v.data === void 0, E = d.value, E ? ($ = i.cache.get(E),
|
|
476
|
+
return H = v.data === void 0, E = d.value, E ? ($ = i.cache.get(E), X = $ && $.data, v.isValidating = !0, X && (v.data = X.data, v.error = X.error), ne = S || n, !ne || !i.isDocumentVisible() && !H || (C == null ? void 0 : C.forceRevalidate) !== void 0 && !(C != null && C.forceRevalidate) ? (v.isValidating = !1, [
|
|
477
477
|
2
|
|
478
478
|
/*return*/
|
|
479
479
|
]) : $ && (me = !!(Date.now() - $.createdAt >= i.dedupingInterval || C != null && C.forceRevalidate), !me) ? (v.isValidating = !1, [
|
|
@@ -481,31 +481,31 @@ function xr() {
|
|
|
481
481
|
/*return*/
|
|
482
482
|
]) : (ae = function() {
|
|
483
483
|
return Z(he, void 0, void 0, function() {
|
|
484
|
-
var P, Ce,
|
|
484
|
+
var P, Ce, le, be;
|
|
485
485
|
return U(this, function(W) {
|
|
486
486
|
switch (W.label) {
|
|
487
487
|
case 0:
|
|
488
|
-
return P = ce.get(E), P ? [3, 2] : (Ce = Array.isArray(E) ? E : [E],
|
|
488
|
+
return P = ce.get(E), P ? [3, 2] : (Ce = Array.isArray(E) ? E : [E], le = ne.apply(void 0, Nr([], Tr(Ce), !1)), ce.set(E, le, i.dedupingInterval), [4, Te(E, le, i.cache, u)]);
|
|
489
489
|
case 1:
|
|
490
490
|
return W.sent(), [3, 4];
|
|
491
491
|
case 2:
|
|
492
|
-
return [4, Te(E, P.data, i.cache,
|
|
492
|
+
return [4, Te(E, P.data, i.cache, u)];
|
|
493
493
|
case 3:
|
|
494
494
|
W.sent(), W.label = 4;
|
|
495
495
|
case 4:
|
|
496
|
-
return v.isValidating = !1, ce.delete(E), v.error !== void 0 && (be = !
|
|
496
|
+
return v.isValidating = !1, ce.delete(E), v.error !== void 0 && (be = !s && i.shouldRetryOnError && (C ? C.shouldRetryOnError : !0), be && Ir(b, C ? C.errorRetryCount : 1, i)), [
|
|
497
497
|
2
|
|
498
498
|
/*return*/
|
|
499
499
|
];
|
|
500
500
|
}
|
|
501
501
|
});
|
|
502
502
|
});
|
|
503
|
-
},
|
|
503
|
+
}, X && i.revalidateDebounce ? (setTimeout(function() {
|
|
504
504
|
return Z(he, void 0, void 0, function() {
|
|
505
505
|
return U(this, function(P) {
|
|
506
506
|
switch (P.label) {
|
|
507
507
|
case 0:
|
|
508
|
-
return
|
|
508
|
+
return s ? [3, 2] : [4, ae()];
|
|
509
509
|
case 1:
|
|
510
510
|
P.sent(), P.label = 2;
|
|
511
511
|
case 2:
|
|
@@ -551,7 +551,7 @@ function xr() {
|
|
|
551
551
|
case 2:
|
|
552
552
|
h && clearTimeout(h), C.label = 3;
|
|
553
553
|
case 3:
|
|
554
|
-
return i.refreshInterval && !
|
|
554
|
+
return i.refreshInterval && !s && (h = setTimeout(S, i.refreshInterval)), [
|
|
555
555
|
2
|
|
556
556
|
/*return*/
|
|
557
557
|
];
|
|
@@ -561,7 +561,7 @@ function xr() {
|
|
|
561
561
|
};
|
|
562
562
|
i.refreshInterval && (h = setTimeout(S, i.refreshInterval)), i.revalidateOnFocus && (document.addEventListener("visibilitychange", m, !1), window.addEventListener("focus", m, !1));
|
|
563
563
|
}), Pe(function() {
|
|
564
|
-
|
|
564
|
+
s = !0, h && clearTimeout(h), i.revalidateOnFocus && (document.removeEventListener("visibilitychange", m, !1), window.removeEventListener("focus", m, !1));
|
|
565
565
|
var S = ie.get(d.value);
|
|
566
566
|
S && (S.data = S.data.filter(function(C) {
|
|
567
567
|
return C !== v;
|
|
@@ -569,7 +569,7 @@ function xr() {
|
|
|
569
569
|
});
|
|
570
570
|
try {
|
|
571
571
|
Ke(d, function(S) {
|
|
572
|
-
Ze(d) || (d.value = S), v.key = S, v.isValidating = !!S, Er(d.value, v,
|
|
572
|
+
Ze(d) || (d.value = S), v.key = S, v.isValidating = !!S, Er(d.value, v, u), !l && !f && d.value && b(), f = !1;
|
|
573
573
|
}, {
|
|
574
574
|
immediate: !0
|
|
575
575
|
});
|
|
@@ -588,7 +588,7 @@ function qr(e, r, t) {
|
|
|
588
588
|
data: a,
|
|
589
589
|
error: n,
|
|
590
590
|
isValidating: i,
|
|
591
|
-
mutate:
|
|
591
|
+
mutate: s
|
|
592
592
|
} = xr(e, r, {
|
|
593
593
|
revalidateDebounce: 500,
|
|
594
594
|
revalidateOnFocus: !1,
|
|
@@ -600,7 +600,7 @@ function qr(e, r, t) {
|
|
|
600
600
|
response: a,
|
|
601
601
|
error: n,
|
|
602
602
|
isValidating: i,
|
|
603
|
-
revalidate:
|
|
603
|
+
revalidate: s
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
const K = {
|
|
@@ -615,17 +615,17 @@ const K = {
|
|
|
615
615
|
additionalFilter: a,
|
|
616
616
|
queryReady: n,
|
|
617
617
|
timeframe: i,
|
|
618
|
-
tz:
|
|
618
|
+
tz: s,
|
|
619
619
|
hasTrendAccess: f,
|
|
620
620
|
refreshInterval: c,
|
|
621
621
|
abortController: o,
|
|
622
|
-
queryFn:
|
|
622
|
+
queryFn: l
|
|
623
623
|
} = e;
|
|
624
624
|
if (t && !r)
|
|
625
625
|
throw new Error("Must provide a dimension if filtering by a value");
|
|
626
|
-
const
|
|
626
|
+
const u = !!(r && t), d = !!(r && !t), v = g(() => {
|
|
627
627
|
const S = [];
|
|
628
|
-
return
|
|
628
|
+
return u && S.push({
|
|
629
629
|
dimension: r,
|
|
630
630
|
type: "in",
|
|
631
631
|
values: [t]
|
|
@@ -637,17 +637,17 @@ const K = {
|
|
|
637
637
|
// Traffic and error rate cards should only try to query for the dimension if it's going to be used.
|
|
638
638
|
// It isn't used for single entity queries.
|
|
639
639
|
dimensions: [
|
|
640
|
-
...r && !
|
|
640
|
+
...r && !u ? [r] : [],
|
|
641
641
|
"status_code_grouped"
|
|
642
642
|
],
|
|
643
643
|
filter: v,
|
|
644
644
|
queryReady: n,
|
|
645
645
|
timeframe: i,
|
|
646
|
-
tz:
|
|
646
|
+
tz: s,
|
|
647
647
|
// Traffic and error rate cards can't query trend if multiple entities are expected.
|
|
648
648
|
withTrend: g(() => f.value && !d),
|
|
649
649
|
refreshInterval: c,
|
|
650
|
-
queryFn:
|
|
650
|
+
queryFn: l,
|
|
651
651
|
abortController: o
|
|
652
652
|
}, m = {
|
|
653
653
|
metrics: [
|
|
@@ -655,15 +655,15 @@ const K = {
|
|
|
655
655
|
],
|
|
656
656
|
// To keep single-entity queries consistent, don't bother querying the dimension for latency
|
|
657
657
|
// in the single-entity case, even though it's possible.
|
|
658
|
-
...r && !
|
|
658
|
+
...r && !u ? { dimensions: [r] } : {},
|
|
659
659
|
filter: v,
|
|
660
660
|
queryReady: n,
|
|
661
661
|
timeframe: i,
|
|
662
|
-
tz:
|
|
662
|
+
tz: s,
|
|
663
663
|
// Don't query latency trends in the multi-entity case: it's possible, but wasteful.
|
|
664
664
|
withTrend: g(() => f.value && !d),
|
|
665
665
|
refreshInterval: c,
|
|
666
|
-
queryFn:
|
|
666
|
+
queryFn: l,
|
|
667
667
|
abortController: o
|
|
668
668
|
}, h = K.useMetricFetcher(b), x = K.useMetricFetcher(m);
|
|
669
669
|
return {
|
|
@@ -693,7 +693,7 @@ const K = {
|
|
|
693
693
|
const t = xe(vr);
|
|
694
694
|
let a;
|
|
695
695
|
t ? a = t.queryFn : (console.warn("Analytics dashboards require a query bridge supplied via provide / inject."), console.warn("Please ensure your application has a query bridge provided under the key 'analytics-query-provider', as described in"), console.warn("https://github.com/Kong/public-ui-components/blob/main/packages/analytics/analytics-metric-provider/README.md#requirements"), a = () => Promise.reject(new Error("Query bridge required")));
|
|
696
|
-
const i = ar().getConfig(),
|
|
696
|
+
const i = ar().getConfig(), s = g(() => i.value !== null && r.queryReady), f = g(() => {
|
|
697
697
|
var v, b;
|
|
698
698
|
const d = (b = (v = i.value) == null ? void 0 : v.analytics) == null ? void 0 : b.retention_ms;
|
|
699
699
|
return !!d && d > or;
|
|
@@ -705,13 +705,13 @@ const K = {
|
|
|
705
705
|
throw new Error("Metrics provider failed to resolve fallback timeframe.");
|
|
706
706
|
return d;
|
|
707
707
|
}), {
|
|
708
|
-
trafficData:
|
|
709
|
-
latencyData:
|
|
708
|
+
trafficData: l,
|
|
709
|
+
latencyData: u
|
|
710
710
|
} = zr({
|
|
711
711
|
dimension: r.dimension,
|
|
712
712
|
dimensionFilterValue: r.filterValue,
|
|
713
713
|
additionalFilter: Ge(r, "additionalFilter"),
|
|
714
|
-
queryReady:
|
|
714
|
+
queryReady: s,
|
|
715
715
|
timeframe: o,
|
|
716
716
|
tz: c,
|
|
717
717
|
hasTrendAccess: f,
|
|
@@ -721,8 +721,8 @@ const K = {
|
|
|
721
721
|
});
|
|
722
722
|
return je(Le, {
|
|
723
723
|
data: {
|
|
724
|
-
traffic:
|
|
725
|
-
latency:
|
|
724
|
+
traffic: l,
|
|
725
|
+
latency: u
|
|
726
726
|
},
|
|
727
727
|
description: r.description,
|
|
728
728
|
containerTitle: r.containerTitle,
|
|
@@ -740,26 +740,26 @@ function Ar(e) {
|
|
|
740
740
|
var Me = { exports: {} };
|
|
741
741
|
(function(e) {
|
|
742
742
|
(function() {
|
|
743
|
-
function r(o,
|
|
744
|
-
if (
|
|
743
|
+
function r(o, l) {
|
|
744
|
+
if (l.separator === !1 || o < 1e3)
|
|
745
745
|
return o.toString();
|
|
746
|
-
var
|
|
746
|
+
var u = typeof l.separator == "string" ? l.separator : ",", d = [], v = Math.round(o).toString().split("");
|
|
747
747
|
return v.reverse().forEach(function(b, m) {
|
|
748
|
-
m && m % 3 === 0 && d.push(
|
|
748
|
+
m && m % 3 === 0 && d.push(u), d.push(b);
|
|
749
749
|
}), d.reverse().join("");
|
|
750
750
|
}
|
|
751
|
-
function t(o,
|
|
752
|
-
var d = o /
|
|
753
|
-
return
|
|
751
|
+
function t(o, l, u) {
|
|
752
|
+
var d = o / l, v = u.round ? "round" : "floor";
|
|
753
|
+
return u.decimal === !1 ? (o = Math[v](d), o.toString()) : (u.precision ? o = d : o = d < 10 ? Math[v](d * 10) / 10 : Math[v](d), o = o.toString(), typeof u.decimal == "string" && (o = o.replace(".", u.decimal)), o);
|
|
754
754
|
}
|
|
755
|
-
var a = 1e3, n = 1e4, i = 1e6,
|
|
756
|
-
function c(o,
|
|
757
|
-
var
|
|
758
|
-
|
|
755
|
+
var a = 1e3, n = 1e4, i = 1e6, s = 1e9, f = 1e12;
|
|
756
|
+
function c(o, l) {
|
|
757
|
+
var u;
|
|
758
|
+
l = l || {};
|
|
759
759
|
var d = o < 0;
|
|
760
|
-
d && (o = Math.abs(o)),
|
|
761
|
-
var v =
|
|
762
|
-
return o < v ||
|
|
760
|
+
d && (o = Math.abs(o)), l.precision && (o = parseFloat(o.toPrecision(l.precision)));
|
|
761
|
+
var v = l.min10k ? n : a;
|
|
762
|
+
return o < v || l.precision && l.precision > Math.log10(o) ? u = r(t(o, 1, l), l) : o < i ? u = t(o, a, l) + "k" : o < s ? u = t(o, i, l) + "m" : o < f ? u = r(t(o, s, l), l) + "b" : u = r(t(o, f, l), l) + "t", d && (u = "-" + u), l.capital && (u = u.toUpperCase()), l.prefix && (u = l.prefix + u), l.suffix && (u = u + l.suffix), u;
|
|
763
763
|
}
|
|
764
764
|
c.addCommas = r, e.exports = c;
|
|
765
765
|
})();
|
|
@@ -772,7 +772,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
772
772
|
for (const [a, n] of r)
|
|
773
773
|
t[a] = n;
|
|
774
774
|
return t;
|
|
775
|
-
}, Mr = (e) => (L("data-v-
|
|
775
|
+
}, Mr = (e) => (L("data-v-005a4b79"), e = e(), M(), e), Dr = ["aria-hidden"], Or = {
|
|
776
776
|
key: 0,
|
|
777
777
|
"data-testid": "kui-icon-svg-title"
|
|
778
778
|
}, Fr = /* @__PURE__ */ Mr(() => /* @__PURE__ */ I("path", {
|
|
@@ -871,7 +871,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
871
871
|
_: 1
|
|
872
872
|
}, 8, ["aria-hidden", "style"]));
|
|
873
873
|
}
|
|
874
|
-
}), Br = /* @__PURE__ */ D(Hr, [["__scopeId", "data-v-
|
|
874
|
+
}), Br = /* @__PURE__ */ D(Hr, [["__scopeId", "data-v-005a4b79"]]), $r = (e) => (L("data-v-21b356a3"), e = e(), M(), e), Pr = ["aria-hidden"], Kr = {
|
|
875
875
|
key: 0,
|
|
876
876
|
"data-testid": "kui-icon-svg-title"
|
|
877
877
|
}, Zr = /* @__PURE__ */ $r(() => /* @__PURE__ */ I("path", {
|
|
@@ -970,7 +970,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
970
970
|
_: 1
|
|
971
971
|
}, 8, ["aria-hidden", "style"]));
|
|
972
972
|
}
|
|
973
|
-
}), Gr = /* @__PURE__ */ D(Ur, [["__scopeId", "data-v-
|
|
973
|
+
}), Gr = /* @__PURE__ */ D(Ur, [["__scopeId", "data-v-21b356a3"]]), jr = (e) => (L("data-v-ca54d0fc"), e = e(), M(), e), Yr = ["aria-hidden"], Xr = {
|
|
974
974
|
key: 0,
|
|
975
975
|
"data-testid": "kui-icon-svg-title"
|
|
976
976
|
}, Qr = /* @__PURE__ */ jr(() => /* @__PURE__ */ I("path", {
|
|
@@ -1062,14 +1062,14 @@ const _ = "24px", D = (e, r) => {
|
|
|
1062
1062
|
width: "100%",
|
|
1063
1063
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1064
1064
|
}, [
|
|
1065
|
-
e.title ? (p(), y("title",
|
|
1065
|
+
e.title ? (p(), y("title", Xr, R(e.title), 1)) : T("", !0),
|
|
1066
1066
|
Qr
|
|
1067
|
-
], 8,
|
|
1067
|
+
], 8, Yr))
|
|
1068
1068
|
]),
|
|
1069
1069
|
_: 1
|
|
1070
1070
|
}, 8, ["aria-hidden", "style"]));
|
|
1071
1071
|
}
|
|
1072
|
-
}), De = /* @__PURE__ */ D(Wr, [["__scopeId", "data-v-
|
|
1072
|
+
}), De = /* @__PURE__ */ D(Wr, [["__scopeId", "data-v-ca54d0fc"]]), Jr = (e) => (L("data-v-3cadd6e0"), e = e(), M(), e), et = ["aria-hidden"], rt = {
|
|
1073
1073
|
key: 0,
|
|
1074
1074
|
"data-testid": "kui-icon-svg-title"
|
|
1075
1075
|
}, tt = /* @__PURE__ */ Jr(() => /* @__PURE__ */ I("path", {
|
|
@@ -1168,13 +1168,13 @@ const _ = "24px", D = (e, r) => {
|
|
|
1168
1168
|
_: 1
|
|
1169
1169
|
}, 8, ["aria-hidden", "style"]));
|
|
1170
1170
|
}
|
|
1171
|
-
}), nt = /* @__PURE__ */ D(it, [["__scopeId", "data-v-
|
|
1171
|
+
}), nt = /* @__PURE__ */ D(it, [["__scopeId", "data-v-3cadd6e0"]]), at = (e) => (L("data-v-ad741ea1"), e = e(), M(), e), ot = ["aria-hidden"], lt = {
|
|
1172
1172
|
key: 0,
|
|
1173
1173
|
"data-testid": "kui-icon-svg-title"
|
|
1174
|
-
},
|
|
1174
|
+
}, st = /* @__PURE__ */ at(() => /* @__PURE__ */ I("path", {
|
|
1175
1175
|
d: "M15.25 5C14.9 5 14.6042 4.87917 14.3625 4.6375C14.1208 4.39583 14 4.1 14 3.75C14 3.4 14.1208 3.10417 14.3625 2.8625C14.6042 2.62083 14.9 2.5 15.25 2.5C15.6 2.5 15.8958 2.62083 16.1375 2.8625C16.3792 3.10417 16.5 3.4 16.5 3.75C16.5 4.1 16.3792 4.39583 16.1375 4.6375C15.8958 4.87917 15.6 5 15.25 5ZM15.25 21.5C14.9 21.5 14.6042 21.3792 14.3625 21.1375C14.1208 20.8958 14 20.6 14 20.25C14 19.9 14.1208 19.6042 14.3625 19.3625C14.6042 19.1208 14.9 19 15.25 19C15.6 19 15.8958 19.1208 16.1375 19.3625C16.3792 19.6042 16.5 19.9 16.5 20.25C16.5 20.6 16.3792 20.8958 16.1375 21.1375C15.8958 21.3792 15.6 21.5 15.25 21.5ZM19.25 8.5C18.9 8.5 18.6042 8.37917 18.3625 8.1375C18.1208 7.89583 18 7.6 18 7.25C18 6.9 18.1208 6.60417 18.3625 6.3625C18.6042 6.12083 18.9 6 19.25 6C19.6 6 19.8958 6.12083 20.1375 6.3625C20.3792 6.60417 20.5 6.9 20.5 7.25C20.5 7.6 20.3792 7.89583 20.1375 8.1375C19.8958 8.37917 19.6 8.5 19.25 8.5ZM19.25 18C18.9 18 18.6042 17.8792 18.3625 17.6375C18.1208 17.3958 18 17.1 18 16.75C18 16.4 18.1208 16.1042 18.3625 15.8625C18.6042 15.6208 18.9 15.5 19.25 15.5C19.6 15.5 19.8958 15.6208 20.1375 15.8625C20.3792 16.1042 20.5 16.4 20.5 16.75C20.5 17.1 20.3792 17.3958 20.1375 17.6375C19.8958 17.8792 19.6 18 19.25 18ZM20.75 13.25C20.4 13.25 20.1042 13.1292 19.8625 12.8875C19.6208 12.6458 19.5 12.35 19.5 12C19.5 11.65 19.6208 11.3542 19.8625 11.1125C20.1042 10.8708 20.4 10.75 20.75 10.75C21.1 10.75 21.3958 10.8708 21.6375 11.1125C21.8792 11.3542 22 11.65 22 12C22 12.35 21.8792 12.6458 21.6375 12.8875C21.3958 13.1292 21.1 13.25 20.75 13.25ZM12 22C10.6167 22 9.31667 21.7375 8.1 21.2125C6.88333 20.6875 5.825 19.975 4.925 19.075C4.025 18.175 3.3125 17.1167 2.7875 15.9C2.2625 14.6833 2 13.3833 2 12C2 10.6167 2.2625 9.31667 2.7875 8.1C3.3125 6.88333 4.025 5.825 4.925 4.925C5.825 4.025 6.88333 3.3125 8.1 2.7875C9.31667 2.2625 10.6167 2 12 2V4C9.76667 4 7.875 4.775 6.325 6.325C4.775 7.875 4 9.76667 4 12C4 14.2333 4.775 16.125 6.325 17.675C7.875 19.225 9.76667 20 12 20V22ZM12 14C11.45 14 10.9792 13.8042 10.5875 13.4125C10.1958 13.0208 10 12.55 10 12C10 11.9167 10.0042 11.8292 10.0125 11.7375C10.0208 11.6458 10.0417 11.5583 10.075 11.475L8 9.4L9.4 8L11.475 10.075C11.5417 10.0583 11.7167 10.0333 12 10C12.55 10 13.0208 10.1958 13.4125 10.5875C13.8042 10.9792 14 11.45 14 12C14 12.55 13.8042 13.0208 13.4125 13.4125C13.0208 13.8042 12.55 14 12 14Z",
|
|
1176
1176
|
fill: "currentColor"
|
|
1177
|
-
}, null, -1)),
|
|
1177
|
+
}, null, -1)), ut = /* @__PURE__ */ k({
|
|
1178
1178
|
__name: "ResponseIcon",
|
|
1179
1179
|
props: {
|
|
1180
1180
|
/** The accessibility text provided to screen readers */
|
|
@@ -1260,14 +1260,14 @@ const _ = "24px", D = (e, r) => {
|
|
|
1260
1260
|
width: "100%",
|
|
1261
1261
|
xmlns: "http://www.w3.org/2000/svg"
|
|
1262
1262
|
}, [
|
|
1263
|
-
e.title ? (p(), y("title",
|
|
1264
|
-
|
|
1263
|
+
e.title ? (p(), y("title", lt, R(e.title), 1)) : T("", !0),
|
|
1264
|
+
st
|
|
1265
1265
|
], 8, ot))
|
|
1266
1266
|
]),
|
|
1267
1267
|
_: 1
|
|
1268
1268
|
}, 8, ["aria-hidden", "style"]));
|
|
1269
1269
|
}
|
|
1270
|
-
}), dt = /* @__PURE__ */ D(
|
|
1270
|
+
}), dt = /* @__PURE__ */ D(ut, [["__scopeId", "data-v-ad741ea1"]]), ct = (e) => (L("data-v-72597234"), e = e(), M(), e), ft = ["aria-hidden"], pt = {
|
|
1271
1271
|
key: 0,
|
|
1272
1272
|
"data-testid": "kui-icon-svg-title"
|
|
1273
1273
|
}, vt = /* @__PURE__ */ ct(() => /* @__PURE__ */ I("path", {
|
|
@@ -1366,7 +1366,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
1366
1366
|
_: 1
|
|
1367
1367
|
}, 8, ["aria-hidden", "style"]));
|
|
1368
1368
|
}
|
|
1369
|
-
}), yt = /* @__PURE__ */ D(gt, [["__scopeId", "data-v-
|
|
1369
|
+
}), yt = /* @__PURE__ */ D(gt, [["__scopeId", "data-v-72597234"]]), mt = (e) => (L("data-v-06c8e6ba"), e = e(), M(), e), ht = ["aria-hidden"], Ct = {
|
|
1370
1370
|
key: 0,
|
|
1371
1371
|
"data-testid": "kui-icon-svg-title"
|
|
1372
1372
|
}, bt = /* @__PURE__ */ mt(() => /* @__PURE__ */ I("path", {
|
|
@@ -1465,7 +1465,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
1465
1465
|
_: 1
|
|
1466
1466
|
}, 8, ["aria-hidden", "style"]));
|
|
1467
1467
|
}
|
|
1468
|
-
}), wt = /* @__PURE__ */ D(St, [["__scopeId", "data-v-
|
|
1468
|
+
}), wt = /* @__PURE__ */ D(St, [["__scopeId", "data-v-06c8e6ba"]]), _t = (e) => (L("data-v-b493c18d"), e = e(), M(), e), Rt = ["aria-hidden"], Tt = {
|
|
1469
1469
|
key: 0,
|
|
1470
1470
|
"data-testid": "kui-icon-svg-title"
|
|
1471
1471
|
}, Nt = /* @__PURE__ */ _t(() => /* @__PURE__ */ I("path", {
|
|
@@ -1564,7 +1564,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
1564
1564
|
_: 1
|
|
1565
1565
|
}, 8, ["aria-hidden", "style"]));
|
|
1566
1566
|
}
|
|
1567
|
-
}), It = /* @__PURE__ */ D(Et, [["__scopeId", "data-v-
|
|
1567
|
+
}), It = /* @__PURE__ */ D(Et, [["__scopeId", "data-v-b493c18d"]]), xt = (e) => (L("data-v-a3d7bf8b"), e = e(), M(), e), kt = ["aria-hidden"], qt = {
|
|
1568
1568
|
key: 0,
|
|
1569
1569
|
"data-testid": "kui-icon-svg-title"
|
|
1570
1570
|
}, zt = /* @__PURE__ */ xt(() => /* @__PURE__ */ I("path", {
|
|
@@ -1663,7 +1663,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
1663
1663
|
_: 1
|
|
1664
1664
|
}, 8, ["aria-hidden", "style"]));
|
|
1665
1665
|
}
|
|
1666
|
-
}), Vt = /* @__PURE__ */ D(At, [["__scopeId", "data-v-
|
|
1666
|
+
}), Vt = /* @__PURE__ */ D(At, [["__scopeId", "data-v-a3d7bf8b"]]), Lt = (e) => (L("data-v-42ff3f58"), e = e(), M(), e), Mt = ["aria-hidden"], Dt = {
|
|
1667
1667
|
key: 0,
|
|
1668
1668
|
"data-testid": "kui-icon-svg-title"
|
|
1669
1669
|
}, Ot = /* @__PURE__ */ Lt(() => /* @__PURE__ */ I("path", {
|
|
@@ -1762,7 +1762,7 @@ const _ = "24px", D = (e, r) => {
|
|
|
1762
1762
|
_: 1
|
|
1763
1763
|
}, 8, ["aria-hidden", "style"]));
|
|
1764
1764
|
}
|
|
1765
|
-
}), Oe = /* @__PURE__ */ D(Ft, [["__scopeId", "data-v-
|
|
1765
|
+
}), Oe = /* @__PURE__ */ D(Ft, [["__scopeId", "data-v-42ff3f58"]]), ge = 2, Ne = ge + 2, Ht = (e, r, t = !1) => {
|
|
1766
1766
|
let a = !r || Number(e.toFixed(Ne)) === 0 ? 0 : Number(e.toFixed(Ne)) > 0 ? 1 : -1;
|
|
1767
1767
|
return t && (a *= -1), a;
|
|
1768
1768
|
}, Bt = (e, r, t) => r ? `${Math.abs(e * 100).toFixed(ge)}%` : t, $t = (e, r) => r === 0 ? 0 : e / r - 1, Pt = (e, r = !1) => (r && (e *= -1), e > 0 ? wt : e < 0 ? yt : De), Kt = "#ad000e", fe = "#6c7489", Ee = "#52596e", Zt = "#007d60", J = "16px", Ut = "20px";
|
|
@@ -1770,10 +1770,10 @@ var F = /* @__PURE__ */ ((e) => (e.GENERIC_COUNT = "GenericCount", e.TRAFFIC = "
|
|
|
1770
1770
|
const Gt = { class: "metricscard" }, jt = {
|
|
1771
1771
|
key: 0,
|
|
1772
1772
|
class: "metricscard-description"
|
|
1773
|
-
},
|
|
1773
|
+
}, Yt = {
|
|
1774
1774
|
key: 0,
|
|
1775
1775
|
class: "metricscard-error"
|
|
1776
|
-
},
|
|
1776
|
+
}, Xt = {
|
|
1777
1777
|
key: 2,
|
|
1778
1778
|
class: "metricscard-trend"
|
|
1779
1779
|
}, Qt = { "data-testid": "metric-trend-change" }, Wt = {
|
|
@@ -1863,9 +1863,9 @@ const Gt = { class: "metricscard" }, jt = {
|
|
|
1863
1863
|
grey: `var(--kong-ui-metric-card-trend-neutral, ${Ee})`
|
|
1864
1864
|
};
|
|
1865
1865
|
return c > 0 ? o.green : c < 0 ? o.red : o.grey;
|
|
1866
|
-
}, n = (c) => c > 0 ? "positive" : c < 0 ? "negative" : "neutral", i = [q.Medium, q.Large, q.LargeCompact].includes(t.cardSize),
|
|
1866
|
+
}, n = (c) => c > 0 ? "positive" : c < 0 ? "negative" : "neutral", i = [q.Medium, q.Large, q.LargeCompact].includes(t.cardSize), s = g(() => t.cardSize === q.LargeCompact), f = [q.Small, q.LargeCompact].includes(t.cardSize);
|
|
1867
1867
|
return (c, o) => {
|
|
1868
|
-
const
|
|
1868
|
+
const l = qe("KTooltip");
|
|
1869
1869
|
return p(), y("div", Gt, [
|
|
1870
1870
|
I("div", {
|
|
1871
1871
|
class: G(["metricscard-title", e.cardSize])
|
|
@@ -1878,18 +1878,18 @@ const Gt = { class: "metricscard" }, jt = {
|
|
|
1878
1878
|
}, null, 8, ["color", "size"])),
|
|
1879
1879
|
(p(), N(z(e.titleTag), null, {
|
|
1880
1880
|
default: A(() => [
|
|
1881
|
-
|
|
1881
|
+
Ye(R(e.title), 1)
|
|
1882
1882
|
]),
|
|
1883
1883
|
_: 1
|
|
1884
1884
|
})),
|
|
1885
|
-
e.tooltip ? (p(), N(
|
|
1885
|
+
e.tooltip ? (p(), N(l, {
|
|
1886
1886
|
key: 1,
|
|
1887
1887
|
class: "metricscard-tooltip",
|
|
1888
1888
|
placement: "right",
|
|
1889
1889
|
text: e.tooltip
|
|
1890
1890
|
}, {
|
|
1891
1891
|
default: A(() => [
|
|
1892
|
-
|
|
1892
|
+
Y(w(nt), {
|
|
1893
1893
|
color: w(fe),
|
|
1894
1894
|
size: w(J)
|
|
1895
1895
|
}, null, 8, ["color", "size"])
|
|
@@ -1897,14 +1897,14 @@ const Gt = { class: "metricscard" }, jt = {
|
|
|
1897
1897
|
_: 1
|
|
1898
1898
|
}, 8, ["text"])) : T("", !0)
|
|
1899
1899
|
], 2),
|
|
1900
|
-
e.description && w(i) && !
|
|
1900
|
+
e.description && w(i) && !s.value ? (p(), y("div", jt, [
|
|
1901
1901
|
I("span", null, R(e.description), 1)
|
|
1902
1902
|
])) : T("", !0),
|
|
1903
1903
|
I("div", {
|
|
1904
|
-
class: G(["metricscard-valuetrend", { "is-compact":
|
|
1904
|
+
class: G(["metricscard-valuetrend", { "is-compact": s.value }])
|
|
1905
1905
|
}, [
|
|
1906
|
-
e.hasError ? (p(), y("div",
|
|
1907
|
-
|
|
1906
|
+
e.hasError ? (p(), y("div", Yt, [
|
|
1907
|
+
Y(w(Oe), {
|
|
1908
1908
|
color: w(fe),
|
|
1909
1909
|
size: w(Ut)
|
|
1910
1910
|
}, null, 8, ["color", "size"]),
|
|
@@ -1914,7 +1914,7 @@ const Gt = { class: "metricscard" }, jt = {
|
|
|
1914
1914
|
class: G(["metricscard-value", e.cardSize]),
|
|
1915
1915
|
"data-testid": "metric-value"
|
|
1916
1916
|
}, R(e.metricValue), 3)),
|
|
1917
|
-
w(i) ? (p(), y("div",
|
|
1917
|
+
w(i) ? (p(), y("div", Xt, [
|
|
1918
1918
|
I("div", {
|
|
1919
1919
|
class: G(["metricscard-trend-change", n(e.changePolarity)]),
|
|
1920
1920
|
"data-testid": "metric-trend-parent"
|
|
@@ -1945,8 +1945,8 @@ const Gt = { class: "metricscard" }, jt = {
|
|
|
1945
1945
|
function ii(e, r) {
|
|
1946
1946
|
const t = qe("KSkeletonBox");
|
|
1947
1947
|
return p(), y("div", ti, [
|
|
1948
|
-
|
|
1949
|
-
|
|
1948
|
+
Y(t, { width: "100" }),
|
|
1949
|
+
Y(t, { width: "75" })
|
|
1950
1950
|
]);
|
|
1951
1951
|
}
|
|
1952
1952
|
const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c40"]]), ai = {
|
|
@@ -1955,13 +1955,13 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
1955
1955
|
}, oi = {
|
|
1956
1956
|
key: 1,
|
|
1957
1957
|
class: "error-display"
|
|
1958
|
-
},
|
|
1958
|
+
}, li = {
|
|
1959
1959
|
key: 0,
|
|
1960
1960
|
class: "error-display-message"
|
|
1961
|
-
},
|
|
1961
|
+
}, si = {
|
|
1962
1962
|
key: 2,
|
|
1963
1963
|
class: "cards-wrapper"
|
|
1964
|
-
},
|
|
1964
|
+
}, ui = /* @__PURE__ */ k({
|
|
1965
1965
|
__name: "MetricCardContainer",
|
|
1966
1966
|
props: {
|
|
1967
1967
|
fallbackDisplayText: {
|
|
@@ -2000,12 +2000,12 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
2000
2000
|
},
|
|
2001
2001
|
setup(e) {
|
|
2002
2002
|
const r = e, t = g(() => r.cards.every((n) => (n == null ? void 0 : n.hasError) === !0)), a = (n) => {
|
|
2003
|
-
const i = $t(n.currentValue, n.previousValue) || 0,
|
|
2003
|
+
const i = $t(n.currentValue, n.previousValue) || 0, s = Ht(i, r.hasTrendAccess, n.increaseIsBad);
|
|
2004
2004
|
return {
|
|
2005
2005
|
metricValue: n.formatValueFn ? n.formatValueFn(n.currentValue) : Lr(n.currentValue, { capital: !0, round: !0 }) || "0",
|
|
2006
2006
|
metricChange: n.formatChangeFn ? n.formatChangeFn(i) : Bt(i, r.hasTrendAccess, r.fallbackDisplayText),
|
|
2007
|
-
changePolarity:
|
|
2008
|
-
trendIcon: Pt(
|
|
2007
|
+
changePolarity: s,
|
|
2008
|
+
trendIcon: Pt(s, n.increaseIsBad),
|
|
2009
2009
|
cardSize: r.cardSize,
|
|
2010
2010
|
hasContainerTitle: !!r.containerTitle
|
|
2011
2011
|
};
|
|
@@ -2015,29 +2015,29 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
2015
2015
|
}, [
|
|
2016
2016
|
r.containerTitle ? (p(), y("div", ai, R(r.containerTitle), 1)) : T("", !0),
|
|
2017
2017
|
t.value ? (p(), y("div", oi, [
|
|
2018
|
-
|
|
2019
|
-
e.errorMessage ? (p(), y("div",
|
|
2020
|
-
])) : (p(), y("div",
|
|
2021
|
-
(p(!0), y(Se, null,
|
|
2018
|
+
Y(w(Oe), { class: "error-display-icon" }),
|
|
2019
|
+
e.errorMessage ? (p(), y("div", li, R(e.errorMessage), 1)) : T("", !0)
|
|
2020
|
+
])) : (p(), y("div", si, [
|
|
2021
|
+
(p(!0), y(Se, null, Xe(e.cards, (s, f) => (p(), y(Se, null, [
|
|
2022
2022
|
e.loading ? (p(), N(ni, {
|
|
2023
2023
|
key: `skeleton-${f}`,
|
|
2024
2024
|
class: G(e.cardSize === w(q).Small ? "loading-tabs-small" : "loading-tabs-large")
|
|
2025
|
-
}, null, 8, ["class"])) : (p(), N(ei, Qe({ key: f }, a(
|
|
2025
|
+
}, null, 8, ["class"])) : (p(), N(ei, Qe({ key: f }, a(s), {
|
|
2026
2026
|
"card-size": e.cardSize,
|
|
2027
|
-
"card-type":
|
|
2028
|
-
description:
|
|
2027
|
+
"card-type": s.cardType,
|
|
2028
|
+
description: s.description,
|
|
2029
2029
|
"error-message": e.errorMessage,
|
|
2030
|
-
"has-error":
|
|
2031
|
-
title:
|
|
2032
|
-
"title-tag":
|
|
2033
|
-
tooltip:
|
|
2034
|
-
"trend-range":
|
|
2030
|
+
"has-error": s.hasError,
|
|
2031
|
+
title: s.title,
|
|
2032
|
+
"title-tag": s.titleTag,
|
|
2033
|
+
tooltip: s.tooltip,
|
|
2034
|
+
"trend-range": s.trendRange
|
|
2035
2035
|
}), null, 16, ["card-size", "card-type", "description", "error-message", "has-error", "title", "title-tag", "tooltip", "trend-range"]))
|
|
2036
2036
|
], 64))), 256))
|
|
2037
2037
|
]))
|
|
2038
2038
|
], 2));
|
|
2039
2039
|
}
|
|
2040
|
-
}), di = /* @__PURE__ */ ye(
|
|
2040
|
+
}), di = /* @__PURE__ */ ye(ui, [["__scopeId", "data-v-0483795d"]]), mi = /* @__PURE__ */ k({
|
|
2041
2041
|
__name: "MetricsConsumer",
|
|
2042
2042
|
props: {
|
|
2043
2043
|
lookupKey: { default: void 0 },
|
|
@@ -2048,7 +2048,7 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
2048
2048
|
const r = e, t = xe(Le);
|
|
2049
2049
|
if (!t)
|
|
2050
2050
|
throw new Error("MetricsConsumer must be nested inside a MetricsProvider instance.");
|
|
2051
|
-
const { traffic: a, latency: n } = t.data, { i18n: i } = K.useI18n(),
|
|
2051
|
+
const { traffic: a, latency: n } = t.data, { i18n: i } = K.useI18n(), s = K.useMetricCardBuilder({
|
|
2052
2052
|
cardType: F.TRAFFIC,
|
|
2053
2053
|
title: g(() => t.longCardTitles ? i.t("metricCard.long.traffic") : i.t("metricCard.short.traffic")),
|
|
2054
2054
|
description: t.description,
|
|
@@ -2070,7 +2070,7 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
2070
2070
|
increaseIsBad: !0,
|
|
2071
2071
|
trendRange: a.trendRange.value
|
|
2072
2072
|
};
|
|
2073
|
-
}), o = (m) => `${m}ms`,
|
|
2073
|
+
}), o = (m) => `${m}ms`, l = K.useMetricCardBuilder({
|
|
2074
2074
|
cardType: F.LATENCY,
|
|
2075
2075
|
title: g(() => t.longCardTitles ? i.t("metricCard.long.latency") : i.t("metricCard.short.latency")),
|
|
2076
2076
|
description: t.description,
|
|
@@ -2080,8 +2080,8 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
2080
2080
|
increaseIsBad: !0,
|
|
2081
2081
|
formatValueFn: o,
|
|
2082
2082
|
trendRange: n.trendRange
|
|
2083
|
-
}),
|
|
2084
|
-
cards:
|
|
2083
|
+
}), u = g(() => r.cardToDisplay === "TRAFFIC" ? [s.value] : r.cardToDisplay === "ERROR_RATE" ? [c.value] : r.cardToDisplay === "LATENCY" ? [l.value] : [s.value, c.value, l.value]), d = g(() => r.cardToDisplay === "TRAFFIC" || r.cardToDisplay === "ERROR_RATE" ? a.isLoading.value : r.cardToDisplay === "LATENCY" ? n.isLoading.value : a.isLoading.value || n.isLoading.value), v = g(() => ({
|
|
2084
|
+
cards: u.value,
|
|
2085
2085
|
containerTitle: t.containerTitle,
|
|
2086
2086
|
loading: d.value,
|
|
2087
2087
|
hasTrendAccess: t.hasTrendAccess.value,
|
|
@@ -2091,14 +2091,14 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
2091
2091
|
hideTitle: !0
|
|
2092
2092
|
})), b = g(() => ({
|
|
2093
2093
|
loading: v.value.loading,
|
|
2094
|
-
trafficCard:
|
|
2094
|
+
trafficCard: s.value,
|
|
2095
2095
|
errorRateCard: c.value,
|
|
2096
|
-
latencyCard:
|
|
2096
|
+
latencyCard: l.value,
|
|
2097
2097
|
errorRateFormatted: f(c.value.currentValue),
|
|
2098
|
-
latencyFormatted: o(
|
|
2098
|
+
latencyFormatted: o(l.value.currentValue)
|
|
2099
2099
|
}));
|
|
2100
2100
|
return (m, h) => ke(m.$slots, "default", { cardValues: b.value }, () => [
|
|
2101
|
-
|
|
2101
|
+
Y(w(di), We(Je(v.value)), null, 16)
|
|
2102
2102
|
]);
|
|
2103
2103
|
}
|
|
2104
2104
|
}), ee = (e) => new Date(e), hi = (e, r) => {
|
|
@@ -2109,30 +2109,30 @@ const ni = /* @__PURE__ */ ye(ri, [["render", ii], ["__scopeId", "data-v-f7eb9c4
|
|
|
2109
2109
|
});
|
|
2110
2110
|
}, Ie = (e) => e.reduce((r, t) => (r[t] = { name: t }, r), {}), ci = (e, r) => {
|
|
2111
2111
|
var b, m;
|
|
2112
|
-
const t = re.get(te.ONE_DAY), a = e.granularity === "trend" ? new rr(t) : new tr(t), n = a.endMs(), i = a.startMs(),
|
|
2112
|
+
const t = re.get(te.ONE_DAY), a = e.granularity === "trend" ? new rr(t) : new tr(t), n = a.endMs(), i = a.startMs(), s = a.granularityMs(), f = e.granularity === "trend" ? 2 : 1;
|
|
2113
2113
|
if ((e.dimensions ?? []).length > 2)
|
|
2114
2114
|
throw new Error(`Explore only supports 0-2 dimensions; got: ${JSON.stringify(e.dimensions)}`);
|
|
2115
|
-
const c = (e.dimensions ?? []).find((h) => h !== "time"), o = (r == null ? void 0 : r.dimensionNames) ?? [],
|
|
2115
|
+
const c = (e.dimensions ?? []).find((h) => h !== "time"), o = (r == null ? void 0 : r.dimensionNames) ?? [], l = Math.max(o.length, 1), u = e.metrics || [], d = [];
|
|
2116
2116
|
for (let h = 0; h < f; h++)
|
|
2117
|
-
for (let x = 0; x <
|
|
2117
|
+
for (let x = 0; x < l; x++) {
|
|
2118
2118
|
const S = c ? { [c]: o[x] } : {};
|
|
2119
2119
|
(b = e.dimensions) != null && b.includes("status_code_grouped") ? Q.forEach((C) => {
|
|
2120
|
-
const H =
|
|
2120
|
+
const H = u.reduce((E, $) => (E[$] = (f - h) * 1e3 + 100 * x + 1, E), { ...S, status_code_grouped: C });
|
|
2121
2121
|
d.push({
|
|
2122
2122
|
version: "v1",
|
|
2123
|
-
timestamp: h === 0 ? ee(i).toISOString() : ee(i +
|
|
2123
|
+
timestamp: h === 0 ? ee(i).toISOString() : ee(i + s).toISOString(),
|
|
2124
2124
|
event: H
|
|
2125
2125
|
});
|
|
2126
2126
|
}) : d.push({
|
|
2127
2127
|
version: "v1",
|
|
2128
|
-
timestamp: h === 0 ? ee(i).toISOString() : ee(i +
|
|
2129
|
-
event:
|
|
2128
|
+
timestamp: h === 0 ? ee(i).toISOString() : ee(i + s).toISOString(),
|
|
2129
|
+
event: u.reduce((C, H) => (C[H] = (f - h) * 1e3 + 100 * x + 1, C), { ...S })
|
|
2130
2130
|
});
|
|
2131
2131
|
}
|
|
2132
2132
|
const v = {
|
|
2133
2133
|
start_ms: i,
|
|
2134
2134
|
end_ms: n,
|
|
2135
|
-
granularity_ms:
|
|
2135
|
+
granularity_ms: s,
|
|
2136
2136
|
display: c ? {
|
|
2137
2137
|
[c]: Ie(o),
|
|
2138
2138
|
...(m = e.dimensions) != null && m.includes("status_code_grouped") ? { status_code_grouped: Ie(Q) } : {}
|