@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.
Files changed (30) hide show
  1. package/README.md +46 -15
  2. package/dist/dashboard-renderer.es.js +555 -330
  3. package/dist/dashboard-renderer.umd.js +1 -1
  4. package/dist/style.css +1 -1
  5. package/dist/types/components/{AnalyticsChartRenderer.vue.d.ts → BarChartRenderer.vue.d.ts} +17 -1
  6. package/dist/types/components/BarChartRenderer.vue.d.ts.map +1 -0
  7. package/dist/types/components/DashboardRenderer.vue.d.ts +84 -28
  8. package/dist/types/components/DashboardRenderer.vue.d.ts.map +1 -1
  9. package/dist/types/components/DashboardTile.vue.d.ts +40 -5
  10. package/dist/types/components/DashboardTile.vue.d.ts.map +1 -1
  11. package/dist/types/components/SimpleChartRenderer.vue.d.ts +8 -0
  12. package/dist/types/components/SimpleChartRenderer.vue.d.ts.map +1 -1
  13. package/dist/types/components/TimeseriesChartRenderer.vue.d.ts +54 -0
  14. package/dist/types/components/TimeseriesChartRenderer.vue.d.ts.map +1 -0
  15. package/dist/types/components/layout/GridLayout.vue.d.ts +63 -0
  16. package/dist/types/components/layout/GridLayout.vue.d.ts.map +1 -0
  17. package/dist/types/constants.d.ts +2 -0
  18. package/dist/types/constants.d.ts.map +1 -0
  19. package/dist/types/index.d.ts +2 -1
  20. package/dist/types/index.d.ts.map +1 -1
  21. package/dist/types/types/dashboard-renderer-types.d.ts +399 -49
  22. package/dist/types/types/dashboard-renderer-types.d.ts.map +1 -1
  23. package/dist/types/types/grid-layout-types.d.ts +28 -0
  24. package/dist/types/types/grid-layout-types.d.ts.map +1 -0
  25. package/dist/types/types/index.d.ts +2 -0
  26. package/dist/types/types/index.d.ts.map +1 -1
  27. package/package.json +3 -3
  28. package/dist/types/components/AnalyticsChartRenderer.vue.d.ts.map +0 -1
  29. package/dist/types/mock-data.d.ts +0 -25
  30. package/dist/types/mock-data.d.ts.map +0 -1
@@ -1,10 +1,19 @@
1
- import { getCurrentInstance as pe, ref as L, reactive as me, onMounted as _e, onUnmounted as ae, watch as ge, isReadonly as be, toRefs as Re, watchEffect as Ae, defineComponent as V, inject as ie, computed as w, resolveComponent as U, unref as I, openBlock as m, createBlock as E, withCtx as P, createTextVNode as oe, toDisplayString as $, renderSlot as Se, createVNode as ue, createElementBlock as x, createCommentVNode as X, resolveDynamicComponent as Ee, normalizeProps as Ce, mergeProps as Te, Fragment as De, renderList as we } from "vue";
2
- import { ChartMetricDisplay as Ie, ChartTypesSimple as Oe, SimpleChart as qe, ChartTypes as ee, AnalyticsChart as Ve } from "@kong-ui-public/analytics-chart";
3
- import { createI18n as ke, i18nTComponent as Le } from "@kong-ui-public/i18n";
4
- var S = /* @__PURE__ */ ((e) => (e.HorizontalBar = "horizontal_bar", e.VerticalBar = "vertical_bar", e.Gauge = "gauge", e))(S || {});
5
- const se = {
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
- }, xe = {
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
- syntheticsDataKey: se
30
+ showAnnotations: {
31
+ type: "boolean"
32
+ },
33
+ chartDatasetColors: ye,
34
+ syntheticsDataKey: J
22
35
  },
23
36
  required: ["type"],
24
37
  additionalProperties: !1
25
- }, Ne = {
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(Ie)
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: se
79
+ syntheticsDataKey: J
46
80
  },
47
81
  required: ["type"],
48
82
  additionalProperties: !1
49
- }, Pe = {
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: [xe, Ne]
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
- title: {
60
- type: "string"
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: ["chart", "query"],
128
+ required: ["position", "size"],
64
129
  additionalProperties: !1
65
- }, dt = {
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: Pe
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(), te = 0;
77
- function Be(e) {
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 n = "arg", t = 0; t < e.length; ++t) {
81
- var i = void 0;
82
- e[t] === null || typeof e[t] != "object" && typeof e[t] != "function" ? typeof e[t] == "string" ? i = '"' + e[t] + '"' : i = String(e[t]) : K.has(e[t]) ? i = K.get(e[t]) : (i = te, K.set(e[t], te++)), n += "@" + i;
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 n;
176
+ return r;
85
177
  }
86
- function Ge(e) {
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 = Be(e) : e = String(e || ""), e;
185
+ return Array.isArray(e) ? e = Ue(e) : e = String(e || ""), e;
94
186
  }
95
- var M = (
187
+ var Y = (
96
188
  /** @class */
97
189
  function() {
98
- function e(n) {
99
- n === void 0 && (n = 0), this.items = /* @__PURE__ */ new Map(), this.ttl = n;
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(n) {
102
- return Ge(n);
103
- }, e.prototype.get = function(n) {
104
- var t = this.serializeKey(n);
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(n, t, i) {
107
- var a = this.serializeKey(n), r = i || this.ttl, u = Date.now(), c = {
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: u,
110
- expiresAt: r ? u + r : 1 / 0
201
+ createdAt: s,
202
+ expiresAt: n ? s + n : 1 / 0
111
203
  };
112
- this.dispatchExpire(r, c, a), this.items.set(a, c);
113
- }, e.prototype.dispatchExpire = function(n, t, i) {
114
- var a = this;
115
- n && setTimeout(function() {
116
- var r = Date.now(), u = r >= t.expiresAt;
117
- u && a.delete(i);
118
- }, n);
119
- }, e.prototype.delete = function(n) {
120
- this.items.delete(n);
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 je() {
216
+ function We() {
125
217
  return typeof navigator.onLine < "u" ? navigator.onLine : !0;
126
218
  }
127
- function He() {
219
+ function Qe() {
128
220
  return typeof document < "u" && typeof document.visibilityState < "u" ? document.visibilityState !== "hidden" : !0;
129
221
  }
130
- var Ke = function(e) {
131
- return fetch(e).then(function(n) {
132
- return n.json();
222
+ var Je = function(e) {
223
+ return fetch(e).then(function(r) {
224
+ return r.json();
133
225
  });
134
226
  };
135
- const z = {
136
- isOnline: je,
137
- isDocumentVisible: He,
138
- fetcher: Ke
227
+ const F = {
228
+ isOnline: We,
229
+ isDocumentVisible: Qe,
230
+ fetcher: Je
139
231
  };
140
- var R = globalThis && globalThis.__assign || function() {
141
- return R = Object.assign || function(e) {
142
- for (var n, t = 1, i = arguments.length; t < i; t++) {
143
- n = arguments[t];
144
- for (var a in n)
145
- Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
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
- }, R.apply(this, arguments);
149
- }, T = globalThis && globalThis.__awaiter || function(e, n, t, i) {
150
- function a(r) {
151
- return r instanceof t ? r : new t(function(u) {
152
- u(r);
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(r, u) {
156
- function c(l) {
247
+ return new (t || (t = Promise))(function(n, s) {
248
+ function d(l) {
157
249
  try {
158
- o(i.next(l));
159
- } catch (h) {
160
- u(h);
250
+ o(a.next(l));
251
+ } catch (c) {
252
+ s(c);
161
253
  }
162
254
  }
163
- function v(l) {
255
+ function h(l) {
164
256
  try {
165
- o(i.throw(l));
166
- } catch (h) {
167
- u(h);
257
+ o(a.throw(l));
258
+ } catch (c) {
259
+ s(c);
168
260
  }
169
261
  }
170
262
  function o(l) {
171
- l.done ? r(l.value) : a(l.value).then(c, v);
263
+ l.done ? n(l.value) : i(l.value).then(d, h);
172
264
  }
173
- o((i = i.apply(e, n || [])).next());
265
+ o((a = a.apply(e, r || [])).next());
174
266
  });
175
- }, D = globalThis && globalThis.__generator || function(e, n) {
267
+ }, I = globalThis && globalThis.__generator || function(e, r) {
176
268
  var t = { label: 0, sent: function() {
177
- if (r[0] & 1)
178
- throw r[1];
179
- return r[1];
180
- }, trys: [], ops: [] }, i, a, r, u;
181
- return u = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
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
- }), u;
184
- function c(o) {
275
+ }), s;
276
+ function d(o) {
185
277
  return function(l) {
186
- return v([o, l]);
278
+ return h([o, l]);
187
279
  };
188
280
  }
189
- function v(o) {
190
- if (i)
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 (i = 1, a && (r = o[0] & 2 ? a.return : o[0] ? a.throw || ((r = a.return) && r.call(a), 0) : a.next) && !(r = r.call(a, o[1])).done)
195
- return r;
196
- switch (a = 0, r && (o = [o[0] & 2, r.value]), o[0]) {
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
- r = o;
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++, a = o[1], o = [0];
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 (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (o[0] === 6 || o[0] === 2)) {
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 && (!r || o[1] > r[0] && o[1] < r[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 < r[1]) {
219
- t.label = r[1], r = o;
310
+ if (o[0] === 6 && t.label < n[1]) {
311
+ t.label = n[1], n = o;
220
312
  break;
221
313
  }
222
- if (r && t.label < r[2]) {
223
- t.label = r[2], t.ops.push(o);
314
+ if (n && t.label < n[2]) {
315
+ t.label = n[2], t.ops.push(o);
224
316
  break;
225
317
  }
226
- r[2] && t.ops.pop(), t.trys.pop();
318
+ n[2] && t.ops.pop(), t.trys.pop();
227
319
  continue;
228
320
  }
229
- o = n.call(e, t);
321
+ o = r.call(e, t);
230
322
  } catch (l) {
231
- o = [6, l], a = 0;
323
+ o = [6, l], i = 0;
232
324
  } finally {
233
- i = r = 0;
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
- }, ze = globalThis && globalThis.__read || function(e, n) {
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 i = t.call(e), a, r = [], u;
335
+ var a = t.call(e), i, n = [], s;
244
336
  try {
245
- for (; (n === void 0 || n-- > 0) && !(a = i.next()).done; )
246
- r.push(a.value);
247
- } catch (c) {
248
- u = { error: c };
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
- a && !a.done && (t = i.return) && t.call(i);
343
+ i && !i.done && (t = a.return) && t.call(a);
252
344
  } finally {
253
- if (u)
254
- throw u.error;
345
+ if (s)
346
+ throw s.error;
255
347
  }
256
348
  }
257
- return r;
258
- }, Fe = globalThis && globalThis.__spreadArray || function(e, n, t) {
349
+ return n;
350
+ }, Ze = globalThis && globalThis.__spreadArray || function(e, r, t) {
259
351
  if (t || arguments.length === 2)
260
- for (var i = 0, a = n.length, r; i < a; i++)
261
- (r || !(i in n)) && (r || (r = Array.prototype.slice.call(n, 0, i)), r[i] = n[i]);
262
- return e.concat(r || Array.prototype.slice.call(n));
263
- }, le = new M(), N = new M(), F = new M(), ce = {
264
- cache: le,
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: z.fetcher,
275
- isOnline: z.isOnline,
276
- isDocumentVisible: z.isDocumentVisible
366
+ fetcher: F.fetcher,
367
+ isOnline: F.isOnline,
368
+ isDocumentVisible: F.isDocumentVisible
277
369
  };
278
- function Ue(e, n, t) {
279
- var i = N.get(e);
280
- if (i)
281
- i.data.push(n);
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 a = 5e3;
284
- N.set(e, [n], t > 0 ? t + a : t);
375
+ var i = 5e3;
376
+ j.set(e, [r], t > 0 ? t + i : t);
285
377
  }
286
378
  }
287
- function $e(e, n, t) {
288
- if (t.isDocumentVisible() && !(t.errorRetryCount !== void 0 && n > t.errorRetryCount)) {
289
- var i = Math.min(n || 0, t.errorRetryCount), a = i * t.errorRetryInterval;
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: i + 1, shouldRetryOnError: !0 });
292
- }, a);
383
+ e(null, { errorRetryCount: a + 1, shouldRetryOnError: !0 });
384
+ }, i);
293
385
  }
294
386
  }
295
- var re = function(e, n, t, i) {
296
- return t === void 0 && (t = le), i === void 0 && (i = ce.ttl), T(void 0, void 0, void 0, function() {
297
- var a, r, u, c, v, o, l;
298
- return D(this, function(h) {
299
- switch (h.label) {
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 (!Qe(n))
393
+ if (!rt(r))
302
394
  return [3, 5];
303
- h.label = 1;
395
+ c.label = 1;
304
396
  case 1:
305
- return h.trys.push([1, 3, , 4]), [4, n];
397
+ return c.trys.push([1, 3, , 4]), [4, r];
306
398
  case 2:
307
- return a = h.sent(), [3, 4];
399
+ return i = c.sent(), [3, 4];
308
400
  case 3:
309
- return c = h.sent(), r = c, [3, 4];
401
+ return d = c.sent(), n = d, [3, 4];
310
402
  case 4:
311
403
  return [3, 6];
312
404
  case 5:
313
- a = n, h.label = 6;
405
+ i = r, c.label = 6;
314
406
  case 6:
315
- if (u = !1, v = { data: a, error: r, isValidating: u }, typeof a < "u")
407
+ if (s = !1, h = { data: i, error: n, isValidating: s }, typeof i < "u")
316
408
  try {
317
- t.set(e, v, i);
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 = N.get(e), o && o.data.length && (l = o.data.filter(function(y) {
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, d) {
324
- typeof v.data < "u" && (y.data = v.data), y.error = v.error, y.isValidating = v.isValidating;
325
- var _ = d === l.length - 1;
326
- _ || delete l[d];
327
- }), l = l.filter(Boolean)), [2, v];
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 Me() {
333
- for (var e = this, n = [], t = 0; t < arguments.length; t++)
334
- n[t] = arguments[t];
335
- var i, a, r = R({}, ce), u = !1, c = !1, v = pe(), o = (v == null ? void 0 : v.proxy) || v;
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
- n.length >= 1 && (i = n[0]), n.length >= 2 && (a = n[1]), n.length > 2 && (r = R(R({}, r), n[2]));
340
- var h = l ? r.serverTTL : r.ttl, y = typeof i == "function" ? i : L(i);
341
- typeof a > "u" && (a = r.fetcher);
342
- var d = null;
343
- d || (d = me({
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 _ = function(f, s) {
350
- return T(e, void 0, void 0, function() {
351
- var Q, p, O, q, B, W, G, J = this;
352
- return D(this, function(j) {
353
- switch (j.label) {
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 Q = d.data === void 0, p = y.value, p ? (O = r.cache.get(p), q = O && O.data, d.isValidating = !0, q && (d.data = q.data, d.error = q.error), B = f || a, !B || !r.isDocumentVisible() && !Q || (s == null ? void 0 : s.forceRevalidate) !== void 0 && !(s != null && s.forceRevalidate) ? (d.isValidating = !1, [
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
- ]) : O && (W = !!(Date.now() - O.createdAt >= r.dedupingInterval || s != null && s.forceRevalidate), !W) ? (d.isValidating = !1, [
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 T(J, void 0, void 0, function() {
363
- var A, Y, H, Z;
364
- return D(this, function(k) {
365
- switch (k.label) {
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 = F.get(p), A ? [3, 2] : (Y = Array.isArray(p) ? p : [p], H = B.apply(void 0, Fe([], ze(Y), !1)), F.set(p, H, r.dedupingInterval), [4, re(p, H, r.cache, h)]);
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 k.sent(), [3, 4];
461
+ return z.sent(), [3, 4];
370
462
  case 2:
371
- return [4, re(p, A.data, r.cache, h)];
463
+ return [4, oe(m, A.data, n.cache, c)];
372
464
  case 3:
373
- k.sent(), k.label = 4;
465
+ z.sent(), z.label = 4;
374
466
  case 4:
375
- return d.isValidating = !1, F.delete(p), d.error !== void 0 && (Z = !u && r.shouldRetryOnError && (s ? s.shouldRetryOnError : !0), Z && $e(_, s ? s.errorRetryCount : 1, r)), [
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
- }, q && r.revalidateDebounce ? (setTimeout(function() {
383
- return T(J, void 0, void 0, function() {
384
- return D(this, function(A) {
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 u ? [3, 2] : [4, G()];
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
- }, r.revalidateDebounce), [3, 3]) : [3, 1])) : [
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
- j.sent(), j.label = 3;
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
- }, b = function() {
415
- return T(e, void 0, void 0, function() {
416
- return D(this, function(f) {
417
- return [2, _(null, { shouldRetryOnError: !1 })];
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
- }, g = null;
421
- _e(function() {
422
- var f = function() {
423
- return T(e, void 0, void 0, function() {
424
- return D(this, function(s) {
425
- switch (s.label) {
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 !d.error && r.isOnline() ? [4, _()] : [3, 2];
519
+ return !f.error && n.isOnline() ? [4, g()] : [3, 2];
428
520
  case 1:
429
- return s.sent(), [3, 3];
521
+ return u.sent(), [3, 3];
430
522
  case 2:
431
- g && clearTimeout(g), s.label = 3;
523
+ b && clearTimeout(b), u.label = 3;
432
524
  case 3:
433
- return r.refreshInterval && !u && (g = setTimeout(f, r.refreshInterval)), [
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
- r.refreshInterval && (g = setTimeout(f, r.refreshInterval)), r.revalidateOnFocus && (document.addEventListener("visibilitychange", b, !1), window.addEventListener("focus", b, !1));
442
- }), ae(function() {
443
- u = !0, g && clearTimeout(g), r.revalidateOnFocus && (document.removeEventListener("visibilitychange", b, !1), window.removeEventListener("focus", b, !1));
444
- var f = N.get(y.value);
445
- f && (f.data = f.data.filter(function(s) {
446
- return s !== d;
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
- ge(y, function(f) {
451
- be(y) || (y.value = f), d.key = f, d.isValidating = !!f, Ue(y.value, d, h), !l && !c && y.value && _(), c = !1;
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 C = R(R({}, Re(d)), { mutate: function(f, s) {
458
- return _(f, R(R({}, s), { forceRevalidate: !0 }));
549
+ var D = S(S({}, Ae(f)), { mutate: function(p, u) {
550
+ return g(p, S(S({}, u), { forceRevalidate: !0 }));
459
551
  } });
460
- return C;
552
+ return D;
461
553
  }
462
- function Qe(e) {
554
+ function rt(e) {
463
555
  return e !== null && typeof e == "object" && typeof e.then == "function";
464
556
  }
465
- const de = "analytics-query-provider";
466
- var fe = /* @__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))(fe || {});
467
- const We = (e) => {
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
- ((n = Object.keys(e)) != null && n.length || (t = e.data) != null && t.length || (a = (i = e.data) == null ? void 0 : i.data) != null && a.length || !((r = e.data) != null && r.data) && typeof e.data == "object" && Object.keys(e == null ? void 0 : e.data).length) : !1;
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 Je(e = L({}), n, t, i = We) {
473
- const a = L(
563
+ function it(e = O({}), r, t, a = nt) {
564
+ const i = O(
474
565
  "PENDING"
475
566
  /* PENDING */
476
567
  );
477
- return Ae(() => {
478
- const r = i(e.value);
479
- if (e.value && r && t.value) {
480
- a.value = "VALIDATING_HAS_DATA";
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
- a.value = "VALIDATING";
575
+ i.value = "VALIDATING";
485
576
  return;
486
577
  }
487
- if (e.value && n.value) {
488
- a.value = "STALE_IF_ERROR";
578
+ if (e.value && r.value) {
579
+ i.value = "STALE_IF_ERROR";
489
580
  return;
490
581
  }
491
- if (e.value === void 0 && !n.value) {
492
- a.value = "PENDING";
582
+ if (e.value === void 0 && !r.value) {
583
+ i.value = "PENDING";
493
584
  return;
494
585
  }
495
- if (e.value && !n.value && r) {
496
- a.value = "SUCCESS_HAS_DATA";
586
+ if (e.value && !r.value && n) {
587
+ i.value = "SUCCESS_HAS_DATA";
497
588
  return;
498
589
  }
499
- if (e.value && !n.value) {
500
- a.value = "SUCCESS";
590
+ if (e.value && !r.value) {
591
+ i.value = "SUCCESS";
501
592
  return;
502
593
  }
503
- e.value === void 0 && n && (a.value = "ERROR");
594
+ e.value === void 0 && r && (i.value = "ERROR");
504
595
  }), {
505
- state: a,
506
- swrvState: fe
596
+ state: i,
597
+ swrvState: me
507
598
  };
508
599
  }
509
- const Ye = {
600
+ const at = {
510
601
  noQueryBridge: "No query bridge provided. Unable to render dashboard."
511
- }, Ze = {
602
+ }, ot = {
512
603
  timeRangeExceeded: "The time range for this report is outside of your organization's data retention period"
513
- }, Xe = {
514
- renderer: Ye,
515
- queryDataProvider: Ze
604
+ }, st = {
605
+ renderer: at,
606
+ queryDataProvider: ot
516
607
  };
517
- function et() {
518
- const e = ke("en-us", Xe);
608
+ function ut() {
609
+ const e = je("en-us", st);
519
610
  return {
520
611
  i18n: e,
521
- i18nT: Le(e)
612
+ i18nT: xe(e)
522
613
  // Translation component <i18n-t>
523
614
  };
524
615
  }
525
- const ve = {
526
- useI18n: et
527
- }, ye = /* @__PURE__ */ V({
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: n }) {
535
- const t = e, { i18n: i } = ve.useI18n(), a = ie(de), r = () => t.queryReady && a ? JSON.stringify(t.query) : null, u = new AbortController();
536
- ae(() => {
537
- u.abort();
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: c, error: v, isValidating: o } = Me(r, async () => {
540
- var b, g, C, f;
630
+ const { data: d, error: h, isValidating: o } = tt(n, async () => {
631
+ var R, b, D, p;
541
632
  try {
542
- return a == null ? void 0 : a.query(t.query, u);
543
- } catch (s) {
544
- y.value = ((g = (b = s == null ? void 0 : s.response) == null ? void 0 : b.data) == null ? void 0 : g.message) === "Range not allowed for this tier" ? i.t("queryDataProvider.timeRangeExceeded") : ((f = (C = s == null ? void 0 : s.response) == null ? void 0 : C.data) == null ? void 0 : f.message) || (s == null ? void 0 : s.message);
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
- n("queryComplete");
637
+ r("queryComplete");
547
638
  }
548
- }), { state: l, swrvState: h } = Je(c, v, o), y = L(null), d = w(() => l.value === h.ERROR || !!y.value), _ = w(() => !t.queryReady || l.value === h.PENDING);
549
- return (b, g) => {
550
- const C = U("KSkeleton"), f = U("KEmptyState");
551
- return _.value || !I(c) && !d.value ? (m(), E(C, {
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
- })) : !_.value && d.value ? (m(), E(f, {
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: P(() => [
562
- oe($(y.value), 1)
652
+ message: k(() => [
653
+ ce(de(y.value), 1)
563
654
  ]),
564
655
  _: 1
565
- })) : Se(b.$slots, "default", {
656
+ })) : fe(R.$slots, "default", {
566
657
  key: 2,
567
- data: I(c)
658
+ data: E(d)
568
659
  });
569
660
  };
570
661
  }
571
- }), tt = /* @__PURE__ */ V({
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 n = e, t = {
580
- [S.Gauge]: Oe.GAUGE
581
- }, i = w(() => ({
582
- ...n.chartOptions,
583
- type: t[n.chartOptions.type]
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 (a, r) => (m(), E(ye, {
586
- query: n.query,
587
- "query-ready": n.queryReady
677
+ return (i, n) => (v(), C(Z, {
678
+ query: i.query,
679
+ "query-ready": i.queryReady
588
680
  }, {
589
- default: P(({ data: u }) => [
590
- ue(I(qe), {
591
- "chart-data": u,
592
- "chart-options": i.value,
593
- "synthetics-data-key": n.chartOptions.syntheticsDataKey
594
- }, null, 8, ["chart-data", "chart-options", "synthetics-data-key"])
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
- }), ne = /* @__PURE__ */ V({
600
- __name: "AnalyticsChartRenderer",
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 n = e, t = {
608
- [S.HorizontalBar]: ee.HORIZONTAL_BAR,
609
- [S.VerticalBar]: ee.VERTICAL_BAR
610
- }, i = w(() => ({
611
- type: t[n.chartOptions.type]
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 (a, r) => (m(), E(ye, {
614
- query: n.query,
615
- "query-ready": n.queryReady
709
+ return (i, n) => (v(), C(Z, {
710
+ query: i.query,
711
+ "query-ready": i.queryReady
616
712
  }, {
617
- default: P(({ data: u }) => [
618
- ue(I(Ve), {
619
- "chart-data": u,
620
- "chart-options": i.value,
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
- }), rt = { class: "tile-boundary" }, nt = { key: 0 }, at = /* @__PURE__ */ V({
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 n = e, t = w(() => n.definition.title), i = {
635
- [S.HorizontalBar]: ne,
636
- [S.VerticalBar]: ne,
637
- [S.Gauge]: tt
638
- }, a = w(() => ({
639
- component: i[n.definition.chart.type],
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: n.definition.query,
784
+ query: r.definition.query,
642
785
  queryReady: !0,
643
786
  // TODO: Pipelining
644
- chartOptions: n.definition.chart
787
+ chartOptions: r.definition.chart,
788
+ height: r.height
645
789
  }
646
790
  }));
647
- return (r, u) => (m(), x("div", rt, [
648
- t.value ? (m(), x("h2", nt, $(t.value), 1)) : X("", !0),
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 he = (e, n) => {
857
+ const _e = (e, r) => {
654
858
  const t = e.__vccOpts || e;
655
- for (const [i, a] of n)
656
- t[i] = a;
859
+ for (const [a, i] of r)
860
+ t[a] = i;
657
861
  return t;
658
- }, it = /* @__PURE__ */ he(at, [["__scopeId", "data-v-eb4fff82"]]), ot = { class: "kong-ui-public-dashboard-renderer" }, ut = /* @__PURE__ */ V({
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
- definition: {}
866
+ config: {}
663
867
  },
664
868
  setup(e) {
665
- const n = e, { i18n: t } = ve.useI18n(), i = ie(de);
666
- return (a, r) => {
667
- const u = U("KAlert");
668
- return m(), x("div", ot, [
669
- I(i) ? (m(!0), x(De, { key: 1 }, we(n.definition.tiles, (c, v) => (m(), E(it, {
670
- key: v,
671
- definition: c
672
- }, null, 8, ["definition"]))), 128)) : (m(), E(u, {
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: P(() => [
677
- oe($(I(t).t("renderer.noQueryBridge")), 1)
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 ft = /* @__PURE__ */ he(ut, [["__scopeId", "data-v-d6a56abf"]]);
905
+ const St = /* @__PURE__ */ _e(gt, [["__scopeId", "data-v-dec7d037"]]);
686
906
  export {
687
- S as ChartTypes,
688
- ft as DashboardRenderer,
689
- xe as barChartSchema,
690
- dt as dashboardDefinitionSchema,
691
- Ne as gaugeChartSchema,
692
- Pe as tileSchema
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
  };