@kong-ui-public/dashboard-renderer 0.1.14 → 0.2.0
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.
- package/README.md +46 -15
- package/dist/dashboard-renderer.es.js +555 -330
- package/dist/dashboard-renderer.umd.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/{AnalyticsChartRenderer.vue.d.ts → BarChartRenderer.vue.d.ts} +17 -1
- package/dist/types/components/BarChartRenderer.vue.d.ts.map +1 -0
- package/dist/types/components/DashboardRenderer.vue.d.ts +84 -28
- package/dist/types/components/DashboardRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/DashboardTile.vue.d.ts +40 -5
- package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
- package/dist/types/components/SimpleChartRenderer.vue.d.ts +8 -0
- package/dist/types/components/SimpleChartRenderer.vue.d.ts.map +1 -1
- package/dist/types/components/TimeseriesChartRenderer.vue.d.ts +54 -0
- package/dist/types/components/TimeseriesChartRenderer.vue.d.ts.map +1 -0
- package/dist/types/components/layout/GridLayout.vue.d.ts +63 -0
- package/dist/types/components/layout/GridLayout.vue.d.ts.map +1 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/dashboard-renderer-types.d.ts +399 -49
- package/dist/types/types/dashboard-renderer-types.d.ts.map +1 -1
- package/dist/types/types/grid-layout-types.d.ts +28 -0
- package/dist/types/types/grid-layout-types.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/types/components/AnalyticsChartRenderer.vue.d.ts.map +0 -1
- package/dist/types/mock-data.d.ts +0 -25
- package/dist/types/mock-data.d.ts.map +0 -1
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { getCurrentInstance as
|
|
2
|
-
import { ChartMetricDisplay as
|
|
3
|
-
import { createI18n as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { getCurrentInstance as Re, ref as O, reactive as Se, onMounted as ue, onUnmounted as Q, watch as we, isReadonly as Ce, toRefs as Ae, watchEffect as Ee, defineComponent as T, inject as le, computed as _, resolveComponent as M, unref as E, openBlock as v, createBlock as C, withCtx as k, createTextVNode as ce, toDisplayString as de, renderSlot as fe, createVNode as x, createElementBlock as P, resolveDynamicComponent as Te, normalizeProps as De, mergeProps as qe, createCommentVNode as Ie, useCssVars as Oe, Fragment as ke, renderList as Le, normalizeClass as Ve, normalizeStyle as ie } from "vue";
|
|
2
|
+
import { ChartMetricDisplay as Pe, ChartTypesSimple as ze, SimpleChart as Ne, ChartTypes as W, AnalyticsChart as he } from "@kong-ui-public/analytics-chart";
|
|
3
|
+
import { createI18n as je, i18nTComponent as xe } from "@kong-ui-public/i18n";
|
|
4
|
+
const N = 170;
|
|
5
|
+
var w = /* @__PURE__ */ ((e) => (e.HorizontalBar = "horizontal_bar", e.VerticalBar = "vertical_bar", e.Gauge = "gauge", e.TimeseriesLine = "timeseries_line", e))(w || {});
|
|
6
|
+
const J = {
|
|
6
7
|
type: "string"
|
|
7
|
-
},
|
|
8
|
+
}, ye = {
|
|
9
|
+
type: ["object", "array"],
|
|
10
|
+
items: {
|
|
11
|
+
type: "string"
|
|
12
|
+
},
|
|
13
|
+
additionalProperties: {
|
|
14
|
+
type: "string"
|
|
15
|
+
}
|
|
16
|
+
}, He = {
|
|
8
17
|
type: "object",
|
|
9
18
|
properties: {
|
|
10
19
|
type: {
|
|
@@ -18,11 +27,36 @@ const se = {
|
|
|
18
27
|
stacked: {
|
|
19
28
|
type: "boolean"
|
|
20
29
|
},
|
|
21
|
-
|
|
30
|
+
showAnnotations: {
|
|
31
|
+
type: "boolean"
|
|
32
|
+
},
|
|
33
|
+
chartDatasetColors: ye,
|
|
34
|
+
syntheticsDataKey: J
|
|
22
35
|
},
|
|
23
36
|
required: ["type"],
|
|
24
37
|
additionalProperties: !1
|
|
25
|
-
},
|
|
38
|
+
}, Ge = {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
type: {
|
|
42
|
+
type: "string",
|
|
43
|
+
enum: [
|
|
44
|
+
"timeseries_line"
|
|
45
|
+
/* TimeseriesLine */
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
stacked: {
|
|
49
|
+
type: "boolean"
|
|
50
|
+
},
|
|
51
|
+
fill: {
|
|
52
|
+
type: "boolean"
|
|
53
|
+
},
|
|
54
|
+
chartDatasetColors: ye,
|
|
55
|
+
syntheticsDataKey: J
|
|
56
|
+
},
|
|
57
|
+
required: ["type"],
|
|
58
|
+
additionalProperties: !1
|
|
59
|
+
}, Be = {
|
|
26
60
|
type: "object",
|
|
27
61
|
properties: {
|
|
28
62
|
type: {
|
|
@@ -34,7 +68,7 @@ const se = {
|
|
|
34
68
|
},
|
|
35
69
|
metricDisplay: {
|
|
36
70
|
type: "string",
|
|
37
|
-
enum: Object.values(
|
|
71
|
+
enum: Object.values(Pe)
|
|
38
72
|
},
|
|
39
73
|
reverseDataset: {
|
|
40
74
|
type: "boolean"
|
|
@@ -42,11 +76,11 @@ const se = {
|
|
|
42
76
|
numerator: {
|
|
43
77
|
type: "number"
|
|
44
78
|
},
|
|
45
|
-
syntheticsDataKey:
|
|
79
|
+
syntheticsDataKey: J
|
|
46
80
|
},
|
|
47
81
|
required: ["type"],
|
|
48
82
|
additionalProperties: !1
|
|
49
|
-
},
|
|
83
|
+
}, $e = {
|
|
50
84
|
type: "object",
|
|
51
85
|
properties: {
|
|
52
86
|
query: {
|
|
@@ -54,214 +88,272 @@ const se = {
|
|
|
54
88
|
type: "object"
|
|
55
89
|
},
|
|
56
90
|
chart: {
|
|
57
|
-
oneOf: [
|
|
91
|
+
oneOf: [He, Be, Ge]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
required: ["query", "chart"],
|
|
95
|
+
additionalProperties: !1
|
|
96
|
+
}, Ke = {
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: {
|
|
99
|
+
position: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
col: {
|
|
103
|
+
type: "number"
|
|
104
|
+
},
|
|
105
|
+
row: {
|
|
106
|
+
type: "number"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
description: "Position of the tile in the grid.",
|
|
110
|
+
required: ["col", "row"],
|
|
111
|
+
additionalProperties: !1
|
|
58
112
|
},
|
|
59
|
-
|
|
60
|
-
type: "
|
|
113
|
+
size: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
cols: {
|
|
117
|
+
type: "number"
|
|
118
|
+
},
|
|
119
|
+
rows: {
|
|
120
|
+
type: "number"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
description: "Number of columns and rows the tile occupies.",
|
|
124
|
+
required: ["cols", "rows"],
|
|
125
|
+
additionalProperties: !1
|
|
61
126
|
}
|
|
62
127
|
},
|
|
63
|
-
required: ["
|
|
128
|
+
required: ["position", "size"],
|
|
64
129
|
additionalProperties: !1
|
|
65
|
-
},
|
|
130
|
+
}, Fe = {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
definition: $e,
|
|
134
|
+
layout: Ke
|
|
135
|
+
},
|
|
136
|
+
required: ["definition", "layout"],
|
|
137
|
+
additionalProperties: !1
|
|
138
|
+
}, Rt = {
|
|
66
139
|
type: "object",
|
|
67
140
|
properties: {
|
|
68
141
|
tiles: {
|
|
69
142
|
type: "array",
|
|
70
|
-
items:
|
|
143
|
+
items: Fe
|
|
144
|
+
},
|
|
145
|
+
tileHeight: {
|
|
146
|
+
type: "number",
|
|
147
|
+
description: `Height of each tile in pixels. Default: ${N}`,
|
|
148
|
+
default: N
|
|
149
|
+
},
|
|
150
|
+
gridSize: {
|
|
151
|
+
type: "object",
|
|
152
|
+
properties: {
|
|
153
|
+
cols: {
|
|
154
|
+
type: "number"
|
|
155
|
+
},
|
|
156
|
+
rows: {
|
|
157
|
+
type: "number"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
description: "Number of columns and rows in the grid.",
|
|
161
|
+
required: ["cols", "rows"],
|
|
162
|
+
additionalProperties: !1
|
|
71
163
|
}
|
|
72
164
|
},
|
|
73
|
-
required: ["tiles"],
|
|
165
|
+
required: ["tiles", "gridSize"],
|
|
74
166
|
additionalProperties: !1
|
|
75
|
-
};
|
|
76
|
-
var K = /* @__PURE__ */ new WeakMap(),
|
|
77
|
-
function
|
|
167
|
+
}, pe = "analytics-query-provider";
|
|
168
|
+
var K = /* @__PURE__ */ new WeakMap(), ae = 0;
|
|
169
|
+
function Ue(e) {
|
|
78
170
|
if (!e.length)
|
|
79
171
|
return "";
|
|
80
|
-
for (var
|
|
81
|
-
var
|
|
82
|
-
e[t] === null || typeof e[t] != "object" && typeof e[t] != "function" ? typeof e[t] == "string" ?
|
|
172
|
+
for (var r = "arg", t = 0; t < e.length; ++t) {
|
|
173
|
+
var a = void 0;
|
|
174
|
+
e[t] === null || typeof e[t] != "object" && typeof e[t] != "function" ? typeof e[t] == "string" ? a = '"' + e[t] + '"' : a = String(e[t]) : K.has(e[t]) ? a = K.get(e[t]) : (a = ae, K.set(e[t], ae++)), r += "@" + a;
|
|
83
175
|
}
|
|
84
|
-
return
|
|
176
|
+
return r;
|
|
85
177
|
}
|
|
86
|
-
function
|
|
178
|
+
function Me(e) {
|
|
87
179
|
if (typeof e == "function")
|
|
88
180
|
try {
|
|
89
181
|
e = e();
|
|
90
182
|
} catch {
|
|
91
183
|
e = "";
|
|
92
184
|
}
|
|
93
|
-
return Array.isArray(e) ? e =
|
|
185
|
+
return Array.isArray(e) ? e = Ue(e) : e = String(e || ""), e;
|
|
94
186
|
}
|
|
95
|
-
var
|
|
187
|
+
var Y = (
|
|
96
188
|
/** @class */
|
|
97
189
|
function() {
|
|
98
|
-
function e(
|
|
99
|
-
|
|
190
|
+
function e(r) {
|
|
191
|
+
r === void 0 && (r = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = r;
|
|
100
192
|
}
|
|
101
|
-
return e.prototype.serializeKey = function(
|
|
102
|
-
return
|
|
103
|
-
}, e.prototype.get = function(
|
|
104
|
-
var t = this.serializeKey(
|
|
193
|
+
return e.prototype.serializeKey = function(r) {
|
|
194
|
+
return Me(r);
|
|
195
|
+
}, e.prototype.get = function(r) {
|
|
196
|
+
var t = this.serializeKey(r);
|
|
105
197
|
return this.items.get(t);
|
|
106
|
-
}, e.prototype.set = function(
|
|
107
|
-
var
|
|
198
|
+
}, e.prototype.set = function(r, t, a) {
|
|
199
|
+
var i = this.serializeKey(r), n = a || this.ttl, s = Date.now(), d = {
|
|
108
200
|
data: t,
|
|
109
|
-
createdAt:
|
|
110
|
-
expiresAt:
|
|
201
|
+
createdAt: s,
|
|
202
|
+
expiresAt: n ? s + n : 1 / 0
|
|
111
203
|
};
|
|
112
|
-
this.dispatchExpire(
|
|
113
|
-
}, e.prototype.dispatchExpire = function(
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
}, e.prototype.delete = function(
|
|
120
|
-
this.items.delete(
|
|
204
|
+
this.dispatchExpire(n, d, i), this.items.set(i, d);
|
|
205
|
+
}, e.prototype.dispatchExpire = function(r, t, a) {
|
|
206
|
+
var i = this;
|
|
207
|
+
r && setTimeout(function() {
|
|
208
|
+
var n = Date.now(), s = n >= t.expiresAt;
|
|
209
|
+
s && i.delete(a);
|
|
210
|
+
}, r);
|
|
211
|
+
}, e.prototype.delete = function(r) {
|
|
212
|
+
this.items.delete(r);
|
|
121
213
|
}, e;
|
|
122
214
|
}()
|
|
123
215
|
);
|
|
124
|
-
function
|
|
216
|
+
function We() {
|
|
125
217
|
return typeof navigator.onLine < "u" ? navigator.onLine : !0;
|
|
126
218
|
}
|
|
127
|
-
function
|
|
219
|
+
function Qe() {
|
|
128
220
|
return typeof document < "u" && typeof document.visibilityState < "u" ? document.visibilityState !== "hidden" : !0;
|
|
129
221
|
}
|
|
130
|
-
var
|
|
131
|
-
return fetch(e).then(function(
|
|
132
|
-
return
|
|
222
|
+
var Je = function(e) {
|
|
223
|
+
return fetch(e).then(function(r) {
|
|
224
|
+
return r.json();
|
|
133
225
|
});
|
|
134
226
|
};
|
|
135
|
-
const
|
|
136
|
-
isOnline:
|
|
137
|
-
isDocumentVisible:
|
|
138
|
-
fetcher:
|
|
227
|
+
const F = {
|
|
228
|
+
isOnline: We,
|
|
229
|
+
isDocumentVisible: Qe,
|
|
230
|
+
fetcher: Je
|
|
139
231
|
};
|
|
140
|
-
var
|
|
141
|
-
return
|
|
142
|
-
for (var
|
|
143
|
-
|
|
144
|
-
for (var
|
|
145
|
-
Object.prototype.hasOwnProperty.call(
|
|
232
|
+
var S = globalThis && globalThis.__assign || function() {
|
|
233
|
+
return S = Object.assign || function(e) {
|
|
234
|
+
for (var r, t = 1, a = arguments.length; t < a; t++) {
|
|
235
|
+
r = arguments[t];
|
|
236
|
+
for (var i in r)
|
|
237
|
+
Object.prototype.hasOwnProperty.call(r, i) && (e[i] = r[i]);
|
|
146
238
|
}
|
|
147
239
|
return e;
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
function
|
|
151
|
-
return
|
|
152
|
-
|
|
240
|
+
}, S.apply(this, arguments);
|
|
241
|
+
}, q = globalThis && globalThis.__awaiter || function(e, r, t, a) {
|
|
242
|
+
function i(n) {
|
|
243
|
+
return n instanceof t ? n : new t(function(s) {
|
|
244
|
+
s(n);
|
|
153
245
|
});
|
|
154
246
|
}
|
|
155
|
-
return new (t || (t = Promise))(function(
|
|
156
|
-
function
|
|
247
|
+
return new (t || (t = Promise))(function(n, s) {
|
|
248
|
+
function d(l) {
|
|
157
249
|
try {
|
|
158
|
-
o(
|
|
159
|
-
} catch (
|
|
160
|
-
|
|
250
|
+
o(a.next(l));
|
|
251
|
+
} catch (c) {
|
|
252
|
+
s(c);
|
|
161
253
|
}
|
|
162
254
|
}
|
|
163
|
-
function
|
|
255
|
+
function h(l) {
|
|
164
256
|
try {
|
|
165
|
-
o(
|
|
166
|
-
} catch (
|
|
167
|
-
|
|
257
|
+
o(a.throw(l));
|
|
258
|
+
} catch (c) {
|
|
259
|
+
s(c);
|
|
168
260
|
}
|
|
169
261
|
}
|
|
170
262
|
function o(l) {
|
|
171
|
-
l.done ?
|
|
263
|
+
l.done ? n(l.value) : i(l.value).then(d, h);
|
|
172
264
|
}
|
|
173
|
-
o((
|
|
265
|
+
o((a = a.apply(e, r || [])).next());
|
|
174
266
|
});
|
|
175
|
-
},
|
|
267
|
+
}, I = globalThis && globalThis.__generator || function(e, r) {
|
|
176
268
|
var t = { label: 0, sent: function() {
|
|
177
|
-
if (
|
|
178
|
-
throw
|
|
179
|
-
return
|
|
180
|
-
}, trys: [], ops: [] },
|
|
181
|
-
return
|
|
269
|
+
if (n[0] & 1)
|
|
270
|
+
throw n[1];
|
|
271
|
+
return n[1];
|
|
272
|
+
}, trys: [], ops: [] }, a, i, n, s;
|
|
273
|
+
return s = { next: d(0), throw: d(1), return: d(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
|
|
182
274
|
return this;
|
|
183
|
-
}),
|
|
184
|
-
function
|
|
275
|
+
}), s;
|
|
276
|
+
function d(o) {
|
|
185
277
|
return function(l) {
|
|
186
|
-
return
|
|
278
|
+
return h([o, l]);
|
|
187
279
|
};
|
|
188
280
|
}
|
|
189
|
-
function
|
|
190
|
-
if (
|
|
281
|
+
function h(o) {
|
|
282
|
+
if (a)
|
|
191
283
|
throw new TypeError("Generator is already executing.");
|
|
192
284
|
for (; t; )
|
|
193
285
|
try {
|
|
194
|
-
if (
|
|
195
|
-
return
|
|
196
|
-
switch (
|
|
286
|
+
if (a = 1, i && (n = o[0] & 2 ? i.return : o[0] ? i.throw || ((n = i.return) && n.call(i), 0) : i.next) && !(n = n.call(i, o[1])).done)
|
|
287
|
+
return n;
|
|
288
|
+
switch (i = 0, n && (o = [o[0] & 2, n.value]), o[0]) {
|
|
197
289
|
case 0:
|
|
198
290
|
case 1:
|
|
199
|
-
|
|
291
|
+
n = o;
|
|
200
292
|
break;
|
|
201
293
|
case 4:
|
|
202
294
|
return t.label++, { value: o[1], done: !1 };
|
|
203
295
|
case 5:
|
|
204
|
-
t.label++,
|
|
296
|
+
t.label++, i = o[1], o = [0];
|
|
205
297
|
continue;
|
|
206
298
|
case 7:
|
|
207
299
|
o = t.ops.pop(), t.trys.pop();
|
|
208
300
|
continue;
|
|
209
301
|
default:
|
|
210
|
-
if (
|
|
302
|
+
if (n = t.trys, !(n = n.length > 0 && n[n.length - 1]) && (o[0] === 6 || o[0] === 2)) {
|
|
211
303
|
t = 0;
|
|
212
304
|
continue;
|
|
213
305
|
}
|
|
214
|
-
if (o[0] === 3 && (!
|
|
306
|
+
if (o[0] === 3 && (!n || o[1] > n[0] && o[1] < n[3])) {
|
|
215
307
|
t.label = o[1];
|
|
216
308
|
break;
|
|
217
309
|
}
|
|
218
|
-
if (o[0] === 6 && t.label <
|
|
219
|
-
t.label =
|
|
310
|
+
if (o[0] === 6 && t.label < n[1]) {
|
|
311
|
+
t.label = n[1], n = o;
|
|
220
312
|
break;
|
|
221
313
|
}
|
|
222
|
-
if (
|
|
223
|
-
t.label =
|
|
314
|
+
if (n && t.label < n[2]) {
|
|
315
|
+
t.label = n[2], t.ops.push(o);
|
|
224
316
|
break;
|
|
225
317
|
}
|
|
226
|
-
|
|
318
|
+
n[2] && t.ops.pop(), t.trys.pop();
|
|
227
319
|
continue;
|
|
228
320
|
}
|
|
229
|
-
o =
|
|
321
|
+
o = r.call(e, t);
|
|
230
322
|
} catch (l) {
|
|
231
|
-
o = [6, l],
|
|
323
|
+
o = [6, l], i = 0;
|
|
232
324
|
} finally {
|
|
233
|
-
|
|
325
|
+
a = n = 0;
|
|
234
326
|
}
|
|
235
327
|
if (o[0] & 5)
|
|
236
328
|
throw o[1];
|
|
237
329
|
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
238
330
|
}
|
|
239
|
-
},
|
|
331
|
+
}, Ye = globalThis && globalThis.__read || function(e, r) {
|
|
240
332
|
var t = typeof Symbol == "function" && e[Symbol.iterator];
|
|
241
333
|
if (!t)
|
|
242
334
|
return e;
|
|
243
|
-
var
|
|
335
|
+
var a = t.call(e), i, n = [], s;
|
|
244
336
|
try {
|
|
245
|
-
for (; (
|
|
246
|
-
|
|
247
|
-
} catch (
|
|
248
|
-
|
|
337
|
+
for (; (r === void 0 || r-- > 0) && !(i = a.next()).done; )
|
|
338
|
+
n.push(i.value);
|
|
339
|
+
} catch (d) {
|
|
340
|
+
s = { error: d };
|
|
249
341
|
} finally {
|
|
250
342
|
try {
|
|
251
|
-
|
|
343
|
+
i && !i.done && (t = a.return) && t.call(a);
|
|
252
344
|
} finally {
|
|
253
|
-
if (
|
|
254
|
-
throw
|
|
345
|
+
if (s)
|
|
346
|
+
throw s.error;
|
|
255
347
|
}
|
|
256
348
|
}
|
|
257
|
-
return
|
|
258
|
-
},
|
|
349
|
+
return n;
|
|
350
|
+
}, Ze = globalThis && globalThis.__spreadArray || function(e, r, t) {
|
|
259
351
|
if (t || arguments.length === 2)
|
|
260
|
-
for (var
|
|
261
|
-
(
|
|
262
|
-
return e.concat(
|
|
263
|
-
},
|
|
264
|
-
cache:
|
|
352
|
+
for (var a = 0, i = r.length, n; a < i; a++)
|
|
353
|
+
(n || !(a in r)) && (n || (n = Array.prototype.slice.call(r, 0, a)), n[a] = r[a]);
|
|
354
|
+
return e.concat(n || Array.prototype.slice.call(r));
|
|
355
|
+
}, ve = new Y(), j = new Y(), U = new Y(), ge = {
|
|
356
|
+
cache: ve,
|
|
265
357
|
refreshInterval: 0,
|
|
266
358
|
ttl: 0,
|
|
267
359
|
serverTTL: 1e3,
|
|
@@ -271,120 +363,120 @@ var R = globalThis && globalThis.__assign || function() {
|
|
|
271
363
|
shouldRetryOnError: !0,
|
|
272
364
|
errorRetryInterval: 5e3,
|
|
273
365
|
errorRetryCount: 5,
|
|
274
|
-
fetcher:
|
|
275
|
-
isOnline:
|
|
276
|
-
isDocumentVisible:
|
|
366
|
+
fetcher: F.fetcher,
|
|
367
|
+
isOnline: F.isOnline,
|
|
368
|
+
isDocumentVisible: F.isDocumentVisible
|
|
277
369
|
};
|
|
278
|
-
function
|
|
279
|
-
var
|
|
280
|
-
if (
|
|
281
|
-
|
|
370
|
+
function Xe(e, r, t) {
|
|
371
|
+
var a = j.get(e);
|
|
372
|
+
if (a)
|
|
373
|
+
a.data.push(r);
|
|
282
374
|
else {
|
|
283
|
-
var
|
|
284
|
-
|
|
375
|
+
var i = 5e3;
|
|
376
|
+
j.set(e, [r], t > 0 ? t + i : t);
|
|
285
377
|
}
|
|
286
378
|
}
|
|
287
|
-
function
|
|
288
|
-
if (t.isDocumentVisible() && !(t.errorRetryCount !== void 0 &&
|
|
289
|
-
var
|
|
379
|
+
function et(e, r, t) {
|
|
380
|
+
if (t.isDocumentVisible() && !(t.errorRetryCount !== void 0 && r > t.errorRetryCount)) {
|
|
381
|
+
var a = Math.min(r || 0, t.errorRetryCount), i = a * t.errorRetryInterval;
|
|
290
382
|
setTimeout(function() {
|
|
291
|
-
e(null, { errorRetryCount:
|
|
292
|
-
},
|
|
383
|
+
e(null, { errorRetryCount: a + 1, shouldRetryOnError: !0 });
|
|
384
|
+
}, i);
|
|
293
385
|
}
|
|
294
386
|
}
|
|
295
|
-
var
|
|
296
|
-
return t === void 0 && (t =
|
|
297
|
-
var
|
|
298
|
-
return
|
|
299
|
-
switch (
|
|
387
|
+
var oe = function(e, r, t, a) {
|
|
388
|
+
return t === void 0 && (t = ve), a === void 0 && (a = ge.ttl), q(void 0, void 0, void 0, function() {
|
|
389
|
+
var i, n, s, d, h, o, l;
|
|
390
|
+
return I(this, function(c) {
|
|
391
|
+
switch (c.label) {
|
|
300
392
|
case 0:
|
|
301
|
-
if (!
|
|
393
|
+
if (!rt(r))
|
|
302
394
|
return [3, 5];
|
|
303
|
-
|
|
395
|
+
c.label = 1;
|
|
304
396
|
case 1:
|
|
305
|
-
return
|
|
397
|
+
return c.trys.push([1, 3, , 4]), [4, r];
|
|
306
398
|
case 2:
|
|
307
|
-
return
|
|
399
|
+
return i = c.sent(), [3, 4];
|
|
308
400
|
case 3:
|
|
309
|
-
return
|
|
401
|
+
return d = c.sent(), n = d, [3, 4];
|
|
310
402
|
case 4:
|
|
311
403
|
return [3, 6];
|
|
312
404
|
case 5:
|
|
313
|
-
|
|
405
|
+
i = r, c.label = 6;
|
|
314
406
|
case 6:
|
|
315
|
-
if (
|
|
407
|
+
if (s = !1, h = { data: i, error: n, isValidating: s }, typeof i < "u")
|
|
316
408
|
try {
|
|
317
|
-
t.set(e,
|
|
409
|
+
t.set(e, h, a);
|
|
318
410
|
} catch (y) {
|
|
319
411
|
console.error("swrv(mutate): failed to set cache", y);
|
|
320
412
|
}
|
|
321
|
-
return o =
|
|
413
|
+
return o = j.get(e), o && o.data.length && (l = o.data.filter(function(y) {
|
|
322
414
|
return y.key === e;
|
|
323
|
-
}), l.forEach(function(y,
|
|
324
|
-
typeof
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
}), l = l.filter(Boolean)), [2,
|
|
415
|
+
}), l.forEach(function(y, f) {
|
|
416
|
+
typeof h.data < "u" && (y.data = h.data), y.error = h.error, y.isValidating = h.isValidating;
|
|
417
|
+
var g = f === l.length - 1;
|
|
418
|
+
g || delete l[f];
|
|
419
|
+
}), l = l.filter(Boolean)), [2, h];
|
|
328
420
|
}
|
|
329
421
|
});
|
|
330
422
|
});
|
|
331
423
|
};
|
|
332
|
-
function
|
|
333
|
-
for (var e = this,
|
|
334
|
-
|
|
335
|
-
var
|
|
424
|
+
function tt() {
|
|
425
|
+
for (var e = this, r = [], t = 0; t < arguments.length; t++)
|
|
426
|
+
r[t] = arguments[t];
|
|
427
|
+
var a, i, n = S({}, ge), s = !1, d = !1, h = Re(), o = (h == null ? void 0 : h.proxy) || h;
|
|
336
428
|
if (!o)
|
|
337
429
|
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;
|
|
338
430
|
var l = (o == null ? void 0 : o.$isServer) || !1;
|
|
339
|
-
|
|
340
|
-
var
|
|
341
|
-
typeof
|
|
342
|
-
var
|
|
343
|
-
|
|
431
|
+
r.length >= 1 && (a = r[0]), r.length >= 2 && (i = r[1]), r.length > 2 && (n = S(S({}, n), r[2]));
|
|
432
|
+
var c = l ? n.serverTTL : n.ttl, y = typeof a == "function" ? a : O(a);
|
|
433
|
+
typeof i > "u" && (i = n.fetcher);
|
|
434
|
+
var f = null;
|
|
435
|
+
f || (f = Se({
|
|
344
436
|
data: void 0,
|
|
345
437
|
error: void 0,
|
|
346
438
|
isValidating: !0,
|
|
347
439
|
key: null
|
|
348
440
|
}));
|
|
349
|
-
var
|
|
350
|
-
return
|
|
351
|
-
var
|
|
352
|
-
return
|
|
353
|
-
switch (
|
|
441
|
+
var g = function(p, u) {
|
|
442
|
+
return q(e, void 0, void 0, function() {
|
|
443
|
+
var X, m, L, V, H, ee, G, te = this;
|
|
444
|
+
return I(this, function(B) {
|
|
445
|
+
switch (B.label) {
|
|
354
446
|
case 0:
|
|
355
|
-
return
|
|
447
|
+
return X = f.data === void 0, m = y.value, m ? (L = n.cache.get(m), V = L && L.data, f.isValidating = !0, V && (f.data = V.data, f.error = V.error), H = p || i, !H || !n.isDocumentVisible() && !X || (u == null ? void 0 : u.forceRevalidate) !== void 0 && !(u != null && u.forceRevalidate) ? (f.isValidating = !1, [
|
|
356
448
|
2
|
|
357
449
|
/*return*/
|
|
358
|
-
]) :
|
|
450
|
+
]) : L && (ee = !!(Date.now() - L.createdAt >= n.dedupingInterval || u != null && u.forceRevalidate), !ee) ? (f.isValidating = !1, [
|
|
359
451
|
2
|
|
360
452
|
/*return*/
|
|
361
453
|
]) : (G = function() {
|
|
362
|
-
return
|
|
363
|
-
var A,
|
|
364
|
-
return
|
|
365
|
-
switch (
|
|
454
|
+
return q(te, void 0, void 0, function() {
|
|
455
|
+
var A, re, $, ne;
|
|
456
|
+
return I(this, function(z) {
|
|
457
|
+
switch (z.label) {
|
|
366
458
|
case 0:
|
|
367
|
-
return A =
|
|
459
|
+
return A = U.get(m), A ? [3, 2] : (re = Array.isArray(m) ? m : [m], $ = H.apply(void 0, Ze([], Ye(re), !1)), U.set(m, $, n.dedupingInterval), [4, oe(m, $, n.cache, c)]);
|
|
368
460
|
case 1:
|
|
369
|
-
return
|
|
461
|
+
return z.sent(), [3, 4];
|
|
370
462
|
case 2:
|
|
371
|
-
return [4,
|
|
463
|
+
return [4, oe(m, A.data, n.cache, c)];
|
|
372
464
|
case 3:
|
|
373
|
-
|
|
465
|
+
z.sent(), z.label = 4;
|
|
374
466
|
case 4:
|
|
375
|
-
return
|
|
467
|
+
return f.isValidating = !1, U.delete(m), f.error !== void 0 && (ne = !s && n.shouldRetryOnError && (u ? u.shouldRetryOnError : !0), ne && et(g, u ? u.errorRetryCount : 1, n)), [
|
|
376
468
|
2
|
|
377
469
|
/*return*/
|
|
378
470
|
];
|
|
379
471
|
}
|
|
380
472
|
});
|
|
381
473
|
});
|
|
382
|
-
},
|
|
383
|
-
return
|
|
384
|
-
return
|
|
474
|
+
}, V && n.revalidateDebounce ? (setTimeout(function() {
|
|
475
|
+
return q(te, void 0, void 0, function() {
|
|
476
|
+
return I(this, function(A) {
|
|
385
477
|
switch (A.label) {
|
|
386
478
|
case 0:
|
|
387
|
-
return
|
|
479
|
+
return s ? [3, 2] : [4, G()];
|
|
388
480
|
case 1:
|
|
389
481
|
A.sent(), A.label = 2;
|
|
390
482
|
case 2:
|
|
@@ -395,14 +487,14 @@ function Me() {
|
|
|
395
487
|
}
|
|
396
488
|
});
|
|
397
489
|
});
|
|
398
|
-
},
|
|
490
|
+
}, n.revalidateDebounce), [3, 3]) : [3, 1])) : [
|
|
399
491
|
2
|
|
400
492
|
/*return*/
|
|
401
493
|
];
|
|
402
494
|
case 1:
|
|
403
495
|
return [4, G()];
|
|
404
496
|
case 2:
|
|
405
|
-
|
|
497
|
+
B.sent(), B.label = 3;
|
|
406
498
|
case 3:
|
|
407
499
|
return [
|
|
408
500
|
2
|
|
@@ -411,26 +503,26 @@ function Me() {
|
|
|
411
503
|
}
|
|
412
504
|
});
|
|
413
505
|
});
|
|
414
|
-
},
|
|
415
|
-
return
|
|
416
|
-
return
|
|
417
|
-
return [2,
|
|
506
|
+
}, R = function() {
|
|
507
|
+
return q(e, void 0, void 0, function() {
|
|
508
|
+
return I(this, function(p) {
|
|
509
|
+
return [2, g(null, { shouldRetryOnError: !1 })];
|
|
418
510
|
});
|
|
419
511
|
});
|
|
420
|
-
},
|
|
421
|
-
|
|
422
|
-
var
|
|
423
|
-
return
|
|
424
|
-
return
|
|
425
|
-
switch (
|
|
512
|
+
}, b = null;
|
|
513
|
+
ue(function() {
|
|
514
|
+
var p = function() {
|
|
515
|
+
return q(e, void 0, void 0, function() {
|
|
516
|
+
return I(this, function(u) {
|
|
517
|
+
switch (u.label) {
|
|
426
518
|
case 0:
|
|
427
|
-
return !
|
|
519
|
+
return !f.error && n.isOnline() ? [4, g()] : [3, 2];
|
|
428
520
|
case 1:
|
|
429
|
-
return
|
|
521
|
+
return u.sent(), [3, 3];
|
|
430
522
|
case 2:
|
|
431
|
-
|
|
523
|
+
b && clearTimeout(b), u.label = 3;
|
|
432
524
|
case 3:
|
|
433
|
-
return
|
|
525
|
+
return n.refreshInterval && !s && (b = setTimeout(p, n.refreshInterval)), [
|
|
434
526
|
2
|
|
435
527
|
/*return*/
|
|
436
528
|
];
|
|
@@ -438,243 +530,371 @@ function Me() {
|
|
|
438
530
|
});
|
|
439
531
|
});
|
|
440
532
|
};
|
|
441
|
-
|
|
442
|
-
}),
|
|
443
|
-
|
|
444
|
-
var
|
|
445
|
-
|
|
446
|
-
return
|
|
533
|
+
n.refreshInterval && (b = setTimeout(p, n.refreshInterval)), n.revalidateOnFocus && (document.addEventListener("visibilitychange", R, !1), window.addEventListener("focus", R, !1));
|
|
534
|
+
}), Q(function() {
|
|
535
|
+
s = !0, b && clearTimeout(b), n.revalidateOnFocus && (document.removeEventListener("visibilitychange", R, !1), window.removeEventListener("focus", R, !1));
|
|
536
|
+
var p = j.get(y.value);
|
|
537
|
+
p && (p.data = p.data.filter(function(u) {
|
|
538
|
+
return u !== f;
|
|
447
539
|
}));
|
|
448
540
|
});
|
|
449
541
|
try {
|
|
450
|
-
|
|
451
|
-
|
|
542
|
+
we(y, function(p) {
|
|
543
|
+
Ce(y) || (y.value = p), f.key = p, f.isValidating = !!p, Xe(y.value, f, c), !l && !d && y.value && g(), d = !1;
|
|
452
544
|
}, {
|
|
453
545
|
immediate: !0
|
|
454
546
|
});
|
|
455
547
|
} catch {
|
|
456
548
|
}
|
|
457
|
-
var
|
|
458
|
-
return
|
|
549
|
+
var D = S(S({}, Ae(f)), { mutate: function(p, u) {
|
|
550
|
+
return g(p, S(S({}, u), { forceRevalidate: !0 }));
|
|
459
551
|
} });
|
|
460
|
-
return
|
|
552
|
+
return D;
|
|
461
553
|
}
|
|
462
|
-
function
|
|
554
|
+
function rt(e) {
|
|
463
555
|
return e !== null && typeof e == "object" && typeof e.then == "function";
|
|
464
556
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
var n, t, i, a, r;
|
|
557
|
+
var me = /* @__PURE__ */ ((e) => (e.VALIDATING = "VALIDATING", e.VALIDATING_HAS_DATA = "VALIDATING_HAS_DATA", e.PENDING = "PENDING", e.SUCCESS = "SUCCESS", e.SUCCESS_HAS_DATA = "SUCCESS_HAS_DATA", e.ERROR = "ERROR", e.STALE_IF_ERROR = "STALE_IF_ERROR", e))(me || {});
|
|
558
|
+
const nt = (e) => {
|
|
559
|
+
var r, t, a, i, n;
|
|
469
560
|
return e ? !!// TODO: revisit: currently only the first check ever matters?
|
|
470
|
-
((
|
|
561
|
+
((r = Object.keys(e)) != null && r.length || (t = e.data) != null && t.length || (i = (a = e.data) == null ? void 0 : a.data) != null && i.length || !((n = e.data) != null && n.data) && typeof e.data == "object" && Object.keys(e == null ? void 0 : e.data).length) : !1;
|
|
471
562
|
};
|
|
472
|
-
function
|
|
473
|
-
const
|
|
563
|
+
function it(e = O({}), r, t, a = nt) {
|
|
564
|
+
const i = O(
|
|
474
565
|
"PENDING"
|
|
475
566
|
/* PENDING */
|
|
476
567
|
);
|
|
477
|
-
return
|
|
478
|
-
const
|
|
479
|
-
if (e.value &&
|
|
480
|
-
|
|
568
|
+
return Ee(() => {
|
|
569
|
+
const n = a(e.value);
|
|
570
|
+
if (e.value && n && t.value) {
|
|
571
|
+
i.value = "VALIDATING_HAS_DATA";
|
|
481
572
|
return;
|
|
482
573
|
}
|
|
483
574
|
if (e.value && t.value) {
|
|
484
|
-
|
|
575
|
+
i.value = "VALIDATING";
|
|
485
576
|
return;
|
|
486
577
|
}
|
|
487
|
-
if (e.value &&
|
|
488
|
-
|
|
578
|
+
if (e.value && r.value) {
|
|
579
|
+
i.value = "STALE_IF_ERROR";
|
|
489
580
|
return;
|
|
490
581
|
}
|
|
491
|
-
if (e.value === void 0 && !
|
|
492
|
-
|
|
582
|
+
if (e.value === void 0 && !r.value) {
|
|
583
|
+
i.value = "PENDING";
|
|
493
584
|
return;
|
|
494
585
|
}
|
|
495
|
-
if (e.value && !
|
|
496
|
-
|
|
586
|
+
if (e.value && !r.value && n) {
|
|
587
|
+
i.value = "SUCCESS_HAS_DATA";
|
|
497
588
|
return;
|
|
498
589
|
}
|
|
499
|
-
if (e.value && !
|
|
500
|
-
|
|
590
|
+
if (e.value && !r.value) {
|
|
591
|
+
i.value = "SUCCESS";
|
|
501
592
|
return;
|
|
502
593
|
}
|
|
503
|
-
e.value === void 0 &&
|
|
594
|
+
e.value === void 0 && r && (i.value = "ERROR");
|
|
504
595
|
}), {
|
|
505
|
-
state:
|
|
506
|
-
swrvState:
|
|
596
|
+
state: i,
|
|
597
|
+
swrvState: me
|
|
507
598
|
};
|
|
508
599
|
}
|
|
509
|
-
const
|
|
600
|
+
const at = {
|
|
510
601
|
noQueryBridge: "No query bridge provided. Unable to render dashboard."
|
|
511
|
-
},
|
|
602
|
+
}, ot = {
|
|
512
603
|
timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
|
|
513
|
-
},
|
|
514
|
-
renderer:
|
|
515
|
-
queryDataProvider:
|
|
604
|
+
}, st = {
|
|
605
|
+
renderer: at,
|
|
606
|
+
queryDataProvider: ot
|
|
516
607
|
};
|
|
517
|
-
function
|
|
518
|
-
const e =
|
|
608
|
+
function ut() {
|
|
609
|
+
const e = je("en-us", st);
|
|
519
610
|
return {
|
|
520
611
|
i18n: e,
|
|
521
|
-
i18nT:
|
|
612
|
+
i18nT: xe(e)
|
|
522
613
|
// Translation component <i18n-t>
|
|
523
614
|
};
|
|
524
615
|
}
|
|
525
|
-
const
|
|
526
|
-
useI18n:
|
|
527
|
-
},
|
|
616
|
+
const be = {
|
|
617
|
+
useI18n: ut
|
|
618
|
+
}, Z = /* @__PURE__ */ T({
|
|
528
619
|
__name: "QueryDataProvider",
|
|
529
620
|
props: {
|
|
530
621
|
query: {},
|
|
531
622
|
queryReady: { type: Boolean }
|
|
532
623
|
},
|
|
533
624
|
emits: ["queryComplete"],
|
|
534
|
-
setup(e, { emit:
|
|
535
|
-
const t = e, { i18n:
|
|
536
|
-
|
|
537
|
-
|
|
625
|
+
setup(e, { emit: r }) {
|
|
626
|
+
const t = e, { i18n: a } = be.useI18n(), i = le(pe), n = () => t.queryReady && i ? JSON.stringify(t.query) : null, s = new AbortController();
|
|
627
|
+
Q(() => {
|
|
628
|
+
s.abort();
|
|
538
629
|
});
|
|
539
|
-
const { data:
|
|
540
|
-
var
|
|
630
|
+
const { data: d, error: h, isValidating: o } = tt(n, async () => {
|
|
631
|
+
var R, b, D, p;
|
|
541
632
|
try {
|
|
542
|
-
return
|
|
543
|
-
} catch (
|
|
544
|
-
y.value = ((
|
|
633
|
+
return i == null ? void 0 : i.query(t.query, s);
|
|
634
|
+
} catch (u) {
|
|
635
|
+
y.value = ((b = (R = u == null ? void 0 : u.response) == null ? void 0 : R.data) == null ? void 0 : b.message) === "Range not allowed for this tier" ? a.t("queryDataProvider.timeRangeExceeded") : ((p = (D = u == null ? void 0 : u.response) == null ? void 0 : D.data) == null ? void 0 : p.message) || (u == null ? void 0 : u.message);
|
|
545
636
|
} finally {
|
|
546
|
-
|
|
637
|
+
r("queryComplete");
|
|
547
638
|
}
|
|
548
|
-
}), { state: l, swrvState:
|
|
549
|
-
return (
|
|
550
|
-
const
|
|
551
|
-
return
|
|
639
|
+
}), { state: l, swrvState: c } = it(d, h, o), y = O(null), f = _(() => l.value === c.ERROR || !!y.value), g = _(() => !t.queryReady || l.value === c.PENDING);
|
|
640
|
+
return (R, b) => {
|
|
641
|
+
const D = M("KSkeleton"), p = M("KEmptyState");
|
|
642
|
+
return g.value || !E(d) && !f.value ? (v(), C(D, {
|
|
552
643
|
key: 0,
|
|
553
644
|
class: "chart-skeleton",
|
|
554
645
|
type: "table"
|
|
555
|
-
})) : !
|
|
646
|
+
})) : !g.value && f.value ? (v(), C(p, {
|
|
556
647
|
key: 1,
|
|
557
648
|
"cta-is-hidden": "",
|
|
558
649
|
"data-testid": "chart-empty-state",
|
|
559
650
|
"is-error": ""
|
|
560
651
|
}, {
|
|
561
|
-
message:
|
|
562
|
-
|
|
652
|
+
message: k(() => [
|
|
653
|
+
ce(de(y.value), 1)
|
|
563
654
|
]),
|
|
564
655
|
_: 1
|
|
565
|
-
})) :
|
|
656
|
+
})) : fe(R.$slots, "default", {
|
|
566
657
|
key: 2,
|
|
567
|
-
data:
|
|
658
|
+
data: E(d)
|
|
568
659
|
});
|
|
569
660
|
};
|
|
570
661
|
}
|
|
571
|
-
}),
|
|
662
|
+
}), lt = /* @__PURE__ */ T({
|
|
572
663
|
__name: "SimpleChartRenderer",
|
|
573
664
|
props: {
|
|
574
665
|
query: {},
|
|
575
666
|
queryReady: { type: Boolean },
|
|
576
|
-
chartOptions: {}
|
|
667
|
+
chartOptions: {},
|
|
668
|
+
height: {}
|
|
577
669
|
},
|
|
578
670
|
setup(e) {
|
|
579
|
-
const
|
|
580
|
-
[
|
|
581
|
-
},
|
|
582
|
-
...
|
|
583
|
-
type: t[
|
|
671
|
+
const r = e, t = {
|
|
672
|
+
[w.Gauge]: ze.GAUGE
|
|
673
|
+
}, a = _(() => ({
|
|
674
|
+
...r.chartOptions,
|
|
675
|
+
type: t[r.chartOptions.type]
|
|
584
676
|
}));
|
|
585
|
-
return (
|
|
586
|
-
query:
|
|
587
|
-
"query-ready":
|
|
677
|
+
return (i, n) => (v(), C(Z, {
|
|
678
|
+
query: i.query,
|
|
679
|
+
"query-ready": i.queryReady
|
|
588
680
|
}, {
|
|
589
|
-
default:
|
|
590
|
-
|
|
591
|
-
"chart-data":
|
|
592
|
-
"chart-options":
|
|
593
|
-
|
|
594
|
-
|
|
681
|
+
default: k(({ data: s }) => [
|
|
682
|
+
x(E(Ne), {
|
|
683
|
+
"chart-data": s,
|
|
684
|
+
"chart-options": a.value,
|
|
685
|
+
height: `${i.height}px`,
|
|
686
|
+
"synthetics-data-key": i.chartOptions.syntheticsDataKey
|
|
687
|
+
}, null, 8, ["chart-data", "chart-options", "height", "synthetics-data-key"])
|
|
595
688
|
]),
|
|
596
689
|
_: 1
|
|
597
690
|
}, 8, ["query", "query-ready"]));
|
|
598
691
|
}
|
|
599
|
-
}),
|
|
600
|
-
__name: "
|
|
692
|
+
}), se = /* @__PURE__ */ T({
|
|
693
|
+
__name: "BarChartRenderer",
|
|
601
694
|
props: {
|
|
602
695
|
query: {},
|
|
603
696
|
queryReady: { type: Boolean },
|
|
604
|
-
chartOptions: {}
|
|
697
|
+
chartOptions: {},
|
|
698
|
+
height: {}
|
|
605
699
|
},
|
|
606
700
|
setup(e) {
|
|
607
|
-
const
|
|
608
|
-
[
|
|
609
|
-
[
|
|
610
|
-
},
|
|
611
|
-
type: t[
|
|
701
|
+
const r = e, t = {
|
|
702
|
+
[w.HorizontalBar]: W.HORIZONTAL_BAR,
|
|
703
|
+
[w.VerticalBar]: W.VERTICAL_BAR
|
|
704
|
+
}, a = _(() => ({
|
|
705
|
+
type: t[r.chartOptions.type],
|
|
706
|
+
stacked: r.chartOptions.stacked,
|
|
707
|
+
chartDatasetColors: r.chartOptions.chartDatasetColors
|
|
612
708
|
}));
|
|
613
|
-
return (
|
|
614
|
-
query:
|
|
615
|
-
"query-ready":
|
|
709
|
+
return (i, n) => (v(), C(Z, {
|
|
710
|
+
query: i.query,
|
|
711
|
+
"query-ready": i.queryReady
|
|
616
712
|
}, {
|
|
617
|
-
default:
|
|
618
|
-
|
|
619
|
-
"chart-data":
|
|
620
|
-
"chart-options":
|
|
713
|
+
default: k(({ data: s }) => [
|
|
714
|
+
x(E(he), {
|
|
715
|
+
"chart-data": s,
|
|
716
|
+
"chart-options": a.value,
|
|
621
717
|
"chart-title": "",
|
|
718
|
+
height: `${i.height}px`,
|
|
719
|
+
"legend-position": "bottom",
|
|
720
|
+
"show-annotations": i.chartOptions.showAnnotations,
|
|
622
721
|
"tooltip-title": ""
|
|
623
|
-
}, null, 8, ["chart-data", "chart-options"])
|
|
722
|
+
}, null, 8, ["chart-data", "chart-options", "height", "show-annotations"])
|
|
624
723
|
]),
|
|
625
724
|
_: 1
|
|
626
725
|
}, 8, ["query", "query-ready"]));
|
|
627
726
|
}
|
|
628
|
-
}),
|
|
727
|
+
}), ct = /* @__PURE__ */ T({
|
|
728
|
+
__name: "TimeseriesChartRenderer",
|
|
729
|
+
props: {
|
|
730
|
+
query: {},
|
|
731
|
+
queryReady: { type: Boolean },
|
|
732
|
+
chartOptions: {},
|
|
733
|
+
height: {}
|
|
734
|
+
},
|
|
735
|
+
setup(e) {
|
|
736
|
+
const r = e, t = {
|
|
737
|
+
[w.TimeseriesLine]: W.TIMESERIES_LINE
|
|
738
|
+
// TODO: Timeseries bar
|
|
739
|
+
}, a = _(() => ({
|
|
740
|
+
type: t[r.chartOptions.type],
|
|
741
|
+
fill: r.chartOptions.fill,
|
|
742
|
+
stacked: r.chartOptions.stacked,
|
|
743
|
+
chartDatasetColors: r.chartOptions.chartDatasetColors
|
|
744
|
+
}));
|
|
745
|
+
return (i, n) => (v(), C(Z, {
|
|
746
|
+
query: i.query,
|
|
747
|
+
"query-ready": i.queryReady
|
|
748
|
+
}, {
|
|
749
|
+
default: k(({ data: s }) => [
|
|
750
|
+
x(E(he), {
|
|
751
|
+
"chart-data": s,
|
|
752
|
+
"chart-options": a.value,
|
|
753
|
+
"chart-title": "",
|
|
754
|
+
height: `${i.height}px`,
|
|
755
|
+
"legend-position": "bottom",
|
|
756
|
+
"tooltip-title": ""
|
|
757
|
+
}, null, 8, ["chart-data", "chart-options", "height"])
|
|
758
|
+
]),
|
|
759
|
+
_: 1
|
|
760
|
+
}, 8, ["query", "query-ready"]));
|
|
761
|
+
}
|
|
762
|
+
}), dt = { class: "tile-boundary" }, ft = /* @__PURE__ */ T({
|
|
629
763
|
__name: "DashboardTile",
|
|
630
764
|
props: {
|
|
631
|
-
definition: {
|
|
765
|
+
definition: {
|
|
766
|
+
type: Object,
|
|
767
|
+
required: !0
|
|
768
|
+
},
|
|
769
|
+
height: {
|
|
770
|
+
type: Number,
|
|
771
|
+
required: !1,
|
|
772
|
+
default: () => N
|
|
773
|
+
}
|
|
632
774
|
},
|
|
633
775
|
setup(e) {
|
|
634
|
-
const
|
|
635
|
-
[
|
|
636
|
-
[
|
|
637
|
-
[
|
|
638
|
-
|
|
639
|
-
|
|
776
|
+
const r = e, t = {
|
|
777
|
+
[w.TimeseriesLine]: ct,
|
|
778
|
+
[w.HorizontalBar]: se,
|
|
779
|
+
[w.VerticalBar]: se,
|
|
780
|
+
[w.Gauge]: lt
|
|
781
|
+
}, a = _(() => ({
|
|
782
|
+
component: t[r.definition.chart.type],
|
|
640
783
|
rendererProps: {
|
|
641
|
-
query:
|
|
784
|
+
query: r.definition.query,
|
|
642
785
|
queryReady: !0,
|
|
643
786
|
// TODO: Pipelining
|
|
644
|
-
chartOptions:
|
|
787
|
+
chartOptions: r.definition.chart,
|
|
788
|
+
height: r.height
|
|
645
789
|
}
|
|
646
790
|
}));
|
|
647
|
-
return (
|
|
648
|
-
|
|
649
|
-
a.value ? (m(), E(Ee(a.value.component), Ce(Te({ key: 1 }, a.value.rendererProps)), null, 16)) : X("", !0)
|
|
791
|
+
return (i, n) => (v(), P("div", dt, [
|
|
792
|
+
a.value ? (v(), C(Te(a.value.component), De(qe({ key: 0 }, a.value.rendererProps)), null, 16)) : Ie("", !0)
|
|
650
793
|
]));
|
|
651
794
|
}
|
|
795
|
+
}), ht = "20px", yt = /* @__PURE__ */ T({
|
|
796
|
+
__name: "GridLayout",
|
|
797
|
+
props: {
|
|
798
|
+
gridSize: {
|
|
799
|
+
type: Object,
|
|
800
|
+
required: !0
|
|
801
|
+
},
|
|
802
|
+
tileHeight: {
|
|
803
|
+
type: Number,
|
|
804
|
+
required: !1,
|
|
805
|
+
default: () => N
|
|
806
|
+
},
|
|
807
|
+
tiles: {
|
|
808
|
+
type: Array,
|
|
809
|
+
required: !0
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
setup(e) {
|
|
813
|
+
const r = e;
|
|
814
|
+
Oe((o) => ({
|
|
815
|
+
"01f27c19": `${h.value}px`
|
|
816
|
+
}));
|
|
817
|
+
const t = parseInt(ht), a = O(null), i = O(0), n = new ResizeObserver((o) => {
|
|
818
|
+
i.value = o[0].contentRect.width;
|
|
819
|
+
});
|
|
820
|
+
ue(() => {
|
|
821
|
+
a.value && n.observe(a.value);
|
|
822
|
+
}), Q(() => {
|
|
823
|
+
a.value && n.unobserve(a.value);
|
|
824
|
+
});
|
|
825
|
+
const s = _(() => i.value / r.gridSize.cols - t), d = _(() => r.tiles.map((o, l) => {
|
|
826
|
+
const c = o.layout.position.col * (s.value + t), y = o.layout.position.row * (r.tileHeight + t), f = o.layout.size.cols * s.value + t * (o.layout.size.cols - 1), g = o.layout.size.rows * r.tileHeight + t * (o.layout.size.rows - 1);
|
|
827
|
+
return {
|
|
828
|
+
key: `tile-${l}`,
|
|
829
|
+
tile: o,
|
|
830
|
+
style: {
|
|
831
|
+
transform: `translate(${c}px, ${y}px)`,
|
|
832
|
+
width: `${f}px`,
|
|
833
|
+
height: `${g}px`
|
|
834
|
+
}
|
|
835
|
+
};
|
|
836
|
+
})), h = _(() => Math.max(...r.tiles.map((l) => l.layout.position.row + l.layout.size.rows)) * r.tileHeight + t * r.gridSize.rows);
|
|
837
|
+
return (o, l) => (v(), P("div", {
|
|
838
|
+
ref_key: "gridContainer",
|
|
839
|
+
ref: a,
|
|
840
|
+
class: "kong-ui-public-grid-layout"
|
|
841
|
+
}, [
|
|
842
|
+
(v(!0), P(ke, null, Le(d.value, (c) => (v(), P("div", {
|
|
843
|
+
key: c.key,
|
|
844
|
+
class: Ve(["grid-cell", {
|
|
845
|
+
"empty-cell": !c.tile
|
|
846
|
+
}]),
|
|
847
|
+
style: ie(c.style)
|
|
848
|
+
}, [
|
|
849
|
+
fe(o.$slots, "tile", {
|
|
850
|
+
style: ie(c.style),
|
|
851
|
+
tile: c.tile
|
|
852
|
+
}, void 0, !0)
|
|
853
|
+
], 6))), 128))
|
|
854
|
+
], 512));
|
|
855
|
+
}
|
|
652
856
|
});
|
|
653
|
-
const
|
|
857
|
+
const _e = (e, r) => {
|
|
654
858
|
const t = e.__vccOpts || e;
|
|
655
|
-
for (const [
|
|
656
|
-
t[
|
|
859
|
+
for (const [a, i] of r)
|
|
860
|
+
t[a] = i;
|
|
657
861
|
return t;
|
|
658
|
-
},
|
|
862
|
+
}, pt = /* @__PURE__ */ _e(yt, [["__scopeId", "data-v-b6cb2d7b"]]), vt = { class: "kong-ui-public-dashboard-renderer" }, gt = /* @__PURE__ */ T({
|
|
659
863
|
__name: "DashboardRenderer",
|
|
660
864
|
props: {
|
|
661
865
|
context: {},
|
|
662
|
-
|
|
866
|
+
config: {}
|
|
663
867
|
},
|
|
664
868
|
setup(e) {
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
869
|
+
const r = e, { i18n: t } = be.useI18n(), a = le(pe), i = _(() => r.config.tiles.map((n, s) => ({
|
|
870
|
+
layout: n.layout,
|
|
871
|
+
meta: n.definition,
|
|
872
|
+
// Add a unique key to each tile internally.
|
|
873
|
+
id: s
|
|
874
|
+
})));
|
|
875
|
+
return (n, s) => {
|
|
876
|
+
const d = M("KAlert");
|
|
877
|
+
return v(), P("div", vt, [
|
|
878
|
+
E(a) ? (v(), C(pt, {
|
|
879
|
+
key: 1,
|
|
880
|
+
"grid-size": n.config.gridSize,
|
|
881
|
+
"tile-height": n.config.tileHeight,
|
|
882
|
+
tiles: i.value
|
|
883
|
+
}, {
|
|
884
|
+
tile: k(({ tile: h, style: o }) => [
|
|
885
|
+
x(ft, {
|
|
886
|
+
class: "tile-container",
|
|
887
|
+
definition: h.meta,
|
|
888
|
+
height: parseInt(o.height)
|
|
889
|
+
}, null, 8, ["definition", "height"])
|
|
890
|
+
]),
|
|
891
|
+
_: 1
|
|
892
|
+
}, 8, ["grid-size", "tile-height", "tiles"])) : (v(), C(d, {
|
|
673
893
|
key: 0,
|
|
674
894
|
appearance: "danger"
|
|
675
895
|
}, {
|
|
676
|
-
default:
|
|
677
|
-
|
|
896
|
+
default: k(() => [
|
|
897
|
+
ce(de(E(t).t("renderer.noQueryBridge")), 1)
|
|
678
898
|
]),
|
|
679
899
|
_: 1
|
|
680
900
|
}))
|
|
@@ -682,12 +902,17 @@ const he = (e, n) => {
|
|
|
682
902
|
};
|
|
683
903
|
}
|
|
684
904
|
});
|
|
685
|
-
const
|
|
905
|
+
const St = /* @__PURE__ */ _e(gt, [["__scopeId", "data-v-dec7d037"]]);
|
|
686
906
|
export {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
907
|
+
w as ChartTypes,
|
|
908
|
+
St as DashboardRenderer,
|
|
909
|
+
pt as GridLayout,
|
|
910
|
+
pe as INJECT_QUERY_PROVIDER,
|
|
911
|
+
He as barChartSchema,
|
|
912
|
+
Rt as dashboardConfigSchema,
|
|
913
|
+
Be as gaugeChartSchema,
|
|
914
|
+
Fe as tileConfigSchema,
|
|
915
|
+
$e as tileDefinitionSchema,
|
|
916
|
+
Ke as tileLayoutSchema,
|
|
917
|
+
Ge as timeseriesChartSchema
|
|
693
918
|
};
|