@kong-ui-public/entities-data-plane-nodes 0.5.42-pr.2798.a6ee9fc6b.0 → 0.5.42-pr.2836.18eab0ddc.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.
@@ -0,0 +1,488 @@
1
+ var ne = Object.defineProperty;
2
+ var oe = (n, e, t) => e in n ? ne(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var I = (n, e, t) => oe(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { computed as p, toValue as A, ref as L, watch as ae, defineComponent as O, resolveComponent as S, createElementBlock as N, openBlock as g, createElementVNode as i, toDisplayString as d, createBlock as k, unref as l, Fragment as j, createCommentVNode as q, createTextVNode as $, withCtx as w, createVNode as D, resolveDynamicComponent as Q, mergeModels as le, useModel as se, renderList as re } from "vue";
5
+ import { createI18n as ie, i18nTComponent as ce } from "@kong-ui-public/i18n";
6
+ import { useErrors as ue } from "@kong-ui-public/entities-shared";
7
+ import { EqualIcon as de, ProgressIcon as ge, ClearIcon as ve, CheckCircleIcon as me } from "@kong/icons";
8
+ const he = {
9
+ action_button: {
10
+ confirm: "Confirm",
11
+ submitting: "Submitting...",
12
+ ok: "OK"
13
+ },
14
+ change_log_level: {
15
+ title: "Change Log Level ({summary})",
16
+ summary_with_name: "Node {name}",
17
+ summary_with_number: "{number} Nodes"
18
+ },
19
+ dp_list: {
20
+ header: {
21
+ host: "Host",
22
+ action: "Action",
23
+ status: "Status"
24
+ },
25
+ status: {
26
+ failed: "Failure",
27
+ loading: "Loading",
28
+ pending: "Pending",
29
+ succeed: "Succeed",
30
+ not_supported: "Not Supported"
31
+ }
32
+ },
33
+ log_level_disk_space_warning: "If left on for extended periods of time, can result in excess disk space consumption.",
34
+ log_level_explanation: {
35
+ debug: "Provides debug information about the plugin’s run loop and each individual plugin or other components.",
36
+ info: "Provides messages that provide a record of the normal operation of the system.",
37
+ notice: "Provides messages that provide a record of the normal operation of the system, but also alerts conditions that may require monitoring. Kong does not make a large difference between info and notice.",
38
+ warn: "Is used to log any abnormal behavior that doesn’t result in dropped transactions but requires further investigation.",
39
+ error: "Is used for logging errors that result in a request being dropped.",
40
+ crit: "Is used when Kong is working under critical conditions and not working properly, thus affecting several clients."
41
+ },
42
+ revert_to_default_after: {
43
+ label: "Revert to default after",
44
+ hours: "hour",
45
+ minutes: "min",
46
+ seconds: "seconds"
47
+ },
48
+ select_log_level_title: "Select Log Level"
49
+ }, _e = {
50
+ debug: "Debug",
51
+ info: "Info",
52
+ notice: "Notice",
53
+ warn: "Warn",
54
+ error: "Error",
55
+ crit: "Critical",
56
+ not_applicable: "N/A"
57
+ }, pe = {
58
+ modal: he,
59
+ log_level: _e
60
+ };
61
+ function E() {
62
+ const n = ie("en-us", pe);
63
+ return {
64
+ i18n: n,
65
+ i18nT: ce(n)
66
+ // Translation component <i18n-t>
67
+ };
68
+ }
69
+ var b = /* @__PURE__ */ ((n) => (n.Debug = "debug", n.Info = "info", n.Notice = "notice", n.Warn = "warn", n.Error = "error", n.Critical = "crit", n))(b || {});
70
+ class fe {
71
+ constructor(e) {
72
+ I(this, "concurrentTokenSet", /* @__PURE__ */ new Set());
73
+ I(this, "concurrentTokenBorrowQueue", []);
74
+ for (let t = 0; t < e; ++t)
75
+ this.concurrentTokenSet.add(Symbol(`token-${t}`));
76
+ }
77
+ hasAvailableConcurrentToken() {
78
+ return this.concurrentTokenSet.size > 0;
79
+ }
80
+ borrowConcurrentToken() {
81
+ if (this.concurrentTokenSet.size > 0) {
82
+ const e = this.concurrentTokenSet.values().next().value;
83
+ if (e)
84
+ return this.concurrentTokenSet.delete(e), () => {
85
+ this.returnConcurrentToken(e);
86
+ };
87
+ }
88
+ throw new Error("BUG: No available token to borrow");
89
+ }
90
+ returnConcurrentToken(e) {
91
+ if (this.concurrentTokenSet.has(e))
92
+ throw new Error("Token already returned");
93
+ const t = this.concurrentTokenBorrowQueue.shift();
94
+ t ? t[0](() => this.returnConcurrentToken(e)) : this.concurrentTokenSet.add(e);
95
+ }
96
+ async borrowToken() {
97
+ return this.hasAvailableConcurrentToken() ? this.borrowConcurrentToken() : new Promise((e, t) => {
98
+ this.concurrentTokenBorrowQueue.push([e, t]);
99
+ });
100
+ }
101
+ clearWaitingQueue(e) {
102
+ for (; this.concurrentTokenBorrowQueue.length > 0; ) {
103
+ const [, t] = this.concurrentTokenBorrowQueue.shift();
104
+ t(e);
105
+ }
106
+ }
107
+ }
108
+ class V extends Error {
109
+ constructor(e, t) {
110
+ super(e, t), this.name = "AsyncAbortException";
111
+ }
112
+ }
113
+ class B {
114
+ constructor(e) {
115
+ I(this, "tokenBucket", null);
116
+ I(this, "schedule", async (e) => {
117
+ let t;
118
+ this.tokenBucket && (t = await this.tokenBucket.borrowToken());
119
+ try {
120
+ const o = await e();
121
+ return t == null || t(), o;
122
+ } catch (o) {
123
+ throw t == null || t(), o;
124
+ }
125
+ });
126
+ I(this, "cancelAll", (e, t) => {
127
+ var o;
128
+ (o = this.tokenBucket) == null || o.clearWaitingQueue(new V(e, t));
129
+ });
130
+ e.maxConcurrentAsyncs > 0 && (this.tokenBucket = new fe(e.maxConcurrentAsyncs));
131
+ }
132
+ }
133
+ const be = (n) => n instanceof B ? n : n === null ? new B({ maxConcurrentAsyncs: 0 }) : new B(n), Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
134
+ __proto__: null,
135
+ AsyncAbortException: V,
136
+ AsyncScheduler: B,
137
+ useAsyncScheduler: be
138
+ }, Symbol.toStringTag, { value: "Module" })), W = [
139
+ b.Debug,
140
+ b.Info,
141
+ b.Notice,
142
+ b.Warn,
143
+ b.Error,
144
+ b.Critical
145
+ ], ye = (n) => {
146
+ const { i18n: e } = E();
147
+ return p(() => {
148
+ const t = A(n == null ? void 0 : n.disabled) ?? [];
149
+ return W.map((o) => ({
150
+ label: e.t(`log_level.${o}`),
151
+ value: o,
152
+ selected: (n == null ? void 0 : n.initialSelected) === o,
153
+ disabled: t.includes(o)
154
+ }));
155
+ });
156
+ }, ke = (n) => {
157
+ const e = [b.Debug], { i18n: t } = E();
158
+ return p(() => {
159
+ const o = A(n);
160
+ return {
161
+ explanation: t.t(`modal.log_level_explanation.${o}`),
162
+ warning: e.includes(o) ? t.t("modal.log_level_disk_space_warning") : void 0
163
+ };
164
+ });
165
+ }, we = (n) => {
166
+ const { i18n: e } = E();
167
+ return p(() => {
168
+ const t = A(n);
169
+ if (isNaN(t) || t <= 0)
170
+ return "";
171
+ let o = "";
172
+ const a = t % 60;
173
+ a !== 0 && (o += `${a} ${e.t("modal.revert_to_default_after.seconds")}`);
174
+ const r = Math.floor(t / 60) % 60;
175
+ r !== 0 && (o = `${r} ${e.t("modal.revert_to_default_after.minutes")} ${o}`);
176
+ const s = Math.floor(t / 3600);
177
+ return s !== 0 && (o = `${s} ${e.t("modal.revert_to_default_after.hours")} ${o}`), o;
178
+ });
179
+ }, Ce = (n) => {
180
+ const e = n.requestExecutor ?? ((s) => s()), { getDataPlaneLogLevel: t, setDataPlaneLogLevel: o } = n, { getMessageFromError: a } = ue();
181
+ return { checkDataPlaneLogLevel: (s, c) => {
182
+ const u = L(A(c == null ? void 0 : c.currentLogLevelHint) ?? null);
183
+ u.value === null && e(async () => {
184
+ u.value = await t(s);
185
+ }).catch((v) => {
186
+ v instanceof V || console.error("Failed to get data plane log level", v);
187
+ }), c != null && c.currentLogLevelHint && ae(() => A(c.currentLogLevelHint), (v) => {
188
+ v && (u.value = v);
189
+ });
190
+ const m = L("pending"), y = L(null);
191
+ return {
192
+ currentLogLevel: u,
193
+ updateStatus: m,
194
+ updateErrorMessage: y,
195
+ updateLogLevel: async (v, C) => {
196
+ m.value = "loading", y.value = null;
197
+ try {
198
+ await e(() => o(s, v, C)), u.value = v, m.value = "success";
199
+ } catch (T) {
200
+ y.value = a(T), m.value = "error";
201
+ }
202
+ }
203
+ };
204
+ } };
205
+ }, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
206
+ __proto__: null,
207
+ supportedLevels: W,
208
+ useDataPlaneLogLevelChecker: Ce,
209
+ useFriendlyRevertTime: we,
210
+ useLogLevelCandidateSelectItems: ye,
211
+ useLogLevelExplanation: ke
212
+ }, Symbol.toStringTag, { value: "Module" })), x = {
213
+ useI18n: E,
214
+ ...xe,
215
+ ...Le
216
+ }, Se = { "data-testid": "log-change-action" }, Te = { key: 0 }, Ie = { "data-testid": "log-change-action-current-level" }, Ne = { key: 0 }, $e = { "data-testid": "log-change-action-target-level" }, Ae = { "data-testid": "log-change-status" }, De = /* @__PURE__ */ O({
217
+ __name: "CLLModalNodeRow",
218
+ props: {
219
+ dataPlaneId: {},
220
+ hostname: {},
221
+ hasDllCapability: { type: Boolean },
222
+ targetLogLevel: {},
223
+ checkLogLevel: {},
224
+ logLevelHint: {}
225
+ },
226
+ setup(n, { expose: e }) {
227
+ const t = n, { i18n: o } = x.useI18n();
228
+ let a = L("not_supported"), r = L("not_supported"), s = L(null), c = async () => {
229
+ };
230
+ t.hasDllCapability && ({
231
+ currentLogLevel: a,
232
+ updateStatus: r,
233
+ updateErrorMessage: s,
234
+ updateLogLevel: c
235
+ } = t.checkLogLevel(t.dataPlaneId, {
236
+ currentLogLevelHint: () => t.logLevelHint ?? null
237
+ })), e({
238
+ updateLogLevel: c
239
+ });
240
+ const u = p(() => {
241
+ switch (r.value) {
242
+ case "success":
243
+ return "success";
244
+ case "error":
245
+ return "danger";
246
+ case "loading":
247
+ case "pending":
248
+ return "warning";
249
+ default:
250
+ return "neutral";
251
+ }
252
+ }), m = p(() => {
253
+ switch (r.value) {
254
+ case "success":
255
+ return o.t("modal.dp_list.status.succeed");
256
+ case "error":
257
+ return o.t("modal.dp_list.status.failed");
258
+ case "pending":
259
+ return o.t("modal.dp_list.status.pending");
260
+ case "loading":
261
+ return o.t("modal.dp_list.status.loading");
262
+ default:
263
+ return o.t("modal.dp_list.status.not_supported");
264
+ }
265
+ }), y = p(() => {
266
+ switch (r.value) {
267
+ case "success":
268
+ return me;
269
+ case "error":
270
+ case "not_supported":
271
+ return ve;
272
+ case "loading":
273
+ return ge;
274
+ default:
275
+ return de;
276
+ }
277
+ });
278
+ return (P, v) => {
279
+ const C = S("KSkeleton"), T = S("KBadge"), M = S("KTooltip");
280
+ return g(), N("tr", null, [
281
+ i("td", null, d(n.hostname), 1),
282
+ i("td", Se, [
283
+ l(a) === "not_supported" ? (g(), N("span", Te, d(l(o).t("log_level.not_applicable")), 1)) : l(a) ? (g(), N(j, { key: 2 }, [
284
+ i("span", Ie, d(l(o).t(`log_level.${l(a)}`)), 1),
285
+ l(a) !== n.targetLogLevel ? (g(), N("span", Ne, [
286
+ v[0] || (v[0] = $(" → ", -1)),
287
+ i("span", $e, d(l(o).t(`log_level.${n.targetLogLevel}`)), 1)
288
+ ])) : q("", !0)
289
+ ], 64)) : (g(), k(C, {
290
+ key: 1,
291
+ type: "spinner"
292
+ }))
293
+ ]),
294
+ i("td", Ae, [
295
+ l(s) ? (g(), k(M, {
296
+ key: 0,
297
+ text: l(s)
298
+ }, {
299
+ default: w(() => [
300
+ D(T, {
301
+ appearance: u.value,
302
+ class: "badge-cell"
303
+ }, {
304
+ icon: w(() => [
305
+ (g(), k(Q(y.value)))
306
+ ]),
307
+ default: w(() => [
308
+ $(" " + d(m.value), 1)
309
+ ]),
310
+ _: 1
311
+ }, 8, ["appearance"])
312
+ ]),
313
+ _: 1
314
+ }, 8, ["text"])) : (g(), k(T, {
315
+ key: 1,
316
+ appearance: u.value,
317
+ class: "badge-cell"
318
+ }, {
319
+ icon: w(() => [
320
+ (g(), k(Q(y.value)))
321
+ ]),
322
+ default: w(() => [
323
+ $(" " + d(m.value), 1)
324
+ ]),
325
+ _: 1
326
+ }, 8, ["appearance"]))
327
+ ])
328
+ ]);
329
+ };
330
+ }
331
+ }), z = (n, e) => {
332
+ const t = n.__vccOpts || n;
333
+ for (const [o, a] of e)
334
+ t[o] = a;
335
+ return t;
336
+ }, Be = /* @__PURE__ */ z(De, [["__scopeId", "data-v-ac7205dd"]]), Ee = { class: "explanation-wrapper" }, Pe = {
337
+ key: 0,
338
+ class: "warning-message",
339
+ "data-testid": "log-level-warning-message"
340
+ }, Me = { class: "revert-after-wrapper" }, Ke = { class: "time" }, qe = { class: "seconds" }, Ve = {
341
+ class: "formatted-time",
342
+ "data-testid": "log-level-timeout-formatted"
343
+ }, He = {
344
+ class: "data-plane-node-list",
345
+ "data-testid": "data-plane-node-list"
346
+ }, Re = { style: { width: "40%" } }, Fe = { style: { width: "40%" } }, Qe = /* @__PURE__ */ O({
347
+ name: "ChangeLogLevelModal",
348
+ __name: "ChangeLogLevelModal",
349
+ props: /* @__PURE__ */ le({
350
+ instanceList: {},
351
+ instanceLogLevel: {},
352
+ requests: {}
353
+ }, {
354
+ visible: { type: Boolean },
355
+ visibleModifiers: {}
356
+ }),
357
+ emits: ["update:visible"],
358
+ setup(n) {
359
+ const e = n, t = se(n, "visible"), o = b.Notice, { i18n: a } = x.useI18n(), r = L("edit"), s = L(o), c = L("60"), u = p(() => Math.floor(Number(c.value))), m = p(() => e.instanceList.filter((f) => f.hasDLLCapability !== !1)), y = p(() => {
360
+ const f = m.value.length === 1 ? a.t("modal.change_log_level.summary_with_name", { name: m.value[0].hostname }) : a.t("modal.change_log_level.summary_with_number", { number: `${m.value.length}` });
361
+ return a.t("modal.change_log_level.title", { summary: f });
362
+ }), P = p(() => r.value === "submitting" || isNaN(u.value) || u.value <= 0 || m.value.length === 0), v = x.useLogLevelCandidateSelectItems({
363
+ initialSelected: o
364
+ }), C = x.useLogLevelExplanation(s), T = x.useFriendlyRevertTime(u), M = x.useAsyncScheduler(
365
+ e.requests.scheduler === void 0 ? { maxConcurrentAsyncs: 10 } : e.requests.scheduler
366
+ ), { checkDataPlaneLogLevel: U } = x.useDataPlaneLogLevelChecker({
367
+ getDataPlaneLogLevel: e.requests.getDataPlaneLogLevel,
368
+ setDataPlaneLogLevel: e.requests.setDataPlaneLogLevel,
369
+ requestExecutor: M.schedule
370
+ }), K = /* @__PURE__ */ new Map(), G = (f, h) => {
371
+ h === null ? K.delete(f) : K.set(f, h);
372
+ }, J = async () => {
373
+ if (r.value !== "edit") {
374
+ H();
375
+ return;
376
+ }
377
+ r.value = "submitting";
378
+ const f = Array.from(K.values()).map((h) => h.updateLogLevel(s.value, u.value));
379
+ try {
380
+ await Promise.all(f);
381
+ } catch (h) {
382
+ console.error("Failed to update log level", h);
383
+ } finally {
384
+ r.value = "submitted";
385
+ }
386
+ }, H = () => {
387
+ t.value = !1, c.value = "60", r.value = "edit", s.value = o;
388
+ }, X = p(() => {
389
+ switch (r.value) {
390
+ case "submitting":
391
+ return a.t("modal.action_button.submitting");
392
+ case "submitted":
393
+ return a.t("modal.action_button.ok");
394
+ default:
395
+ return a.t("modal.action_button.confirm");
396
+ }
397
+ });
398
+ return (f, h) => {
399
+ const Y = S("KSelect"), R = S("KLabel"), Z = S("KInput"), ee = S("KModal");
400
+ return g(), k(ee, {
401
+ "action-button-disabled": P.value,
402
+ "action-button-text": X.value,
403
+ "data-testid": "change-log-level-modal",
404
+ "hide-cancel-button": !0,
405
+ "hide-close-icon": r.value === "submitting",
406
+ "max-width": "640px",
407
+ title: y.value,
408
+ visible: t.value,
409
+ onCancel: H,
410
+ onProceed: J
411
+ }, {
412
+ default: w(() => [
413
+ r.value === "edit" ? (g(), k(Y, {
414
+ key: 0,
415
+ modelValue: s.value,
416
+ "onUpdate:modelValue": h[0] || (h[0] = (_) => s.value = _),
417
+ class: "log-level-select",
418
+ "data-testid": "log-level-select",
419
+ items: l(v),
420
+ label: l(a).t("modal.select_log_level_title")
421
+ }, null, 8, ["modelValue", "items", "label"])) : q("", !0),
422
+ i("div", Ee, [
423
+ D(R, null, {
424
+ default: w(() => [
425
+ $(d(l(a).t(`log_level.${s.value}`)), 1)
426
+ ]),
427
+ _: 1
428
+ }),
429
+ i("div", null, d(l(C).explanation), 1),
430
+ l(C).warning ? (g(), N("div", Pe, d(l(C).warning), 1)) : q("", !0)
431
+ ]),
432
+ i("div", Me, [
433
+ D(R, null, {
434
+ default: w(() => [
435
+ $(d(l(a).t("modal.revert_to_default_after.label")), 1)
436
+ ]),
437
+ _: 1
438
+ }),
439
+ i("div", Ke, [
440
+ D(Z, {
441
+ modelValue: c.value,
442
+ "onUpdate:modelValue": h[1] || (h[1] = (_) => c.value = _),
443
+ class: "time-input",
444
+ "data-testid": "log-level-timeout",
445
+ disabled: r.value !== "edit",
446
+ error: u.value <= 0 || isNaN(u.value),
447
+ min: "1",
448
+ type: "number"
449
+ }, null, 8, ["modelValue", "disabled", "error"]),
450
+ i("span", qe, d(l(a).t("modal.revert_to_default_after.seconds")), 1),
451
+ i("span", Ve, d(l(T)), 1)
452
+ ])
453
+ ]),
454
+ i("table", He, [
455
+ i("thead", null, [
456
+ i("th", Re, d(l(a).t("modal.dp_list.header.host")), 1),
457
+ i("th", Fe, d(l(a).t("modal.dp_list.header.action")), 1),
458
+ i("th", null, d(l(a).t("modal.dp_list.header.status")), 1)
459
+ ]),
460
+ i("tbody", null, [
461
+ (g(!0), N(j, null, re(e.instanceList, (_) => {
462
+ var F;
463
+ return g(), k(Be, {
464
+ key: _.id,
465
+ ref_for: !0,
466
+ ref: (te) => G(_.id, te),
467
+ "check-log-level": l(U),
468
+ "data-plane-id": _.id,
469
+ "data-testid": `data-plane-node-list-row-${_.id}`,
470
+ "has-dll-capability": _.hasDLLCapability ?? !0,
471
+ hostname: _.hostname,
472
+ "log-level-hint": (F = e.instanceLogLevel) == null ? void 0 : F.get(_.id),
473
+ "target-log-level": s.value
474
+ }, null, 8, ["check-log-level", "data-plane-id", "data-testid", "has-dll-capability", "hostname", "log-level-hint", "target-log-level"]);
475
+ }), 128))
476
+ ])
477
+ ])
478
+ ]),
479
+ _: 1
480
+ }, 8, ["action-button-disabled", "action-button-text", "hide-close-icon", "title", "visible"]);
481
+ };
482
+ }
483
+ }), Ge = /* @__PURE__ */ z(Qe, [["__scopeId", "data-v-c5cbbb14"]]);
484
+ export {
485
+ Ge as ChangeLogLevelModal,
486
+ b as LogLevel,
487
+ x as composables
488
+ };
@@ -0,0 +1 @@
1
+ (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong-ui-public/i18n"),require("@kong-ui-public/entities-shared"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","@kong-ui-public/entities-shared","@kong/icons"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s["kong-ui-public-entities-data-plane-nodes"]={},s.Vue,s["kong-ui-public-i18n"],s["kong-ui-public-entities-shared"],s.KongIcons))})(this,function(s,e,b,A,C){"use strict";var ue=Object.defineProperty;var ge=(s,e,b)=>e in s?ue(s,e,{enumerable:!0,configurable:!0,writable:!0,value:b}):s[e]=b;var w=(s,e,b)=>ge(s,typeof e!="symbol"?e+"":e,b);const P={modal:{action_button:{confirm:"Confirm",submitting:"Submitting...",ok:"OK"},change_log_level:{title:"Change Log Level ({summary})",summary_with_name:"Node {name}",summary_with_number:"{number} Nodes"},dp_list:{header:{host:"Host",action:"Action",status:"Status"},status:{failed:"Failure",loading:"Loading",pending:"Pending",succeed:"Succeed",not_supported:"Not Supported"}},log_level_disk_space_warning:"If left on for extended periods of time, can result in excess disk space consumption.",log_level_explanation:{debug:"Provides debug information about the plugin’s run loop and each individual plugin or other components.",info:"Provides messages that provide a record of the normal operation of the system.",notice:"Provides messages that provide a record of the normal operation of the system, but also alerts conditions that may require monitoring. Kong does not make a large difference between info and notice.",warn:"Is used to log any abnormal behavior that doesn’t result in dropped transactions but requires further investigation.",error:"Is used for logging errors that result in a request being dropped.",crit:"Is used when Kong is working under critical conditions and not working properly, thus affecting several clients."},revert_to_default_after:{label:"Revert to default after",hours:"hour",minutes:"min",seconds:"seconds"},select_log_level_title:"Select Log Level"},log_level:{debug:"Debug",info:"Info",notice:"Notice",warn:"Warn",error:"Error",crit:"Critical",not_applicable:"N/A"}};function S(){const o=b.createI18n("en-us",P);return{i18n:o,i18nT:b.i18nTComponent(o)}}var h=(o=>(o.Debug="debug",o.Info="info",o.Notice="notice",o.Warn="warn",o.Error="error",o.Critical="crit",o))(h||{});class M{constructor(n){w(this,"concurrentTokenSet",new Set);w(this,"concurrentTokenBorrowQueue",[]);for(let t=0;t<n;++t)this.concurrentTokenSet.add(Symbol(`token-${t}`))}hasAvailableConcurrentToken(){return this.concurrentTokenSet.size>0}borrowConcurrentToken(){if(this.concurrentTokenSet.size>0){const n=this.concurrentTokenSet.values().next().value;if(n)return this.concurrentTokenSet.delete(n),()=>{this.returnConcurrentToken(n)}}throw new Error("BUG: No available token to borrow")}returnConcurrentToken(n){if(this.concurrentTokenSet.has(n))throw new Error("Token already returned");const t=this.concurrentTokenBorrowQueue.shift();t?t[0](()=>this.returnConcurrentToken(n)):this.concurrentTokenSet.add(n)}async borrowToken(){return this.hasAvailableConcurrentToken()?this.borrowConcurrentToken():new Promise((n,t)=>{this.concurrentTokenBorrowQueue.push([n,t])})}clearWaitingQueue(n){for(;this.concurrentTokenBorrowQueue.length>0;){const[,t]=this.concurrentTokenBorrowQueue.shift();t(n)}}}class N extends Error{constructor(n,t){super(n,t),this.name="AsyncAbortException"}}class x{constructor(n){w(this,"tokenBucket",null);w(this,"schedule",async n=>{let t;this.tokenBucket&&(t=await this.tokenBucket.borrowToken());try{const a=await n();return t==null||t(),a}catch(a){throw t==null||t(),a}});w(this,"cancelAll",(n,t)=>{var a;(a=this.tokenBucket)==null||a.clearWaitingQueue(new N(n,t))});n.maxConcurrentAsyncs>0&&(this.tokenBucket=new M(n.maxConcurrentAsyncs))}}const K=Object.freeze(Object.defineProperty({__proto__:null,AsyncAbortException:N,AsyncScheduler:x,useAsyncScheduler:o=>o instanceof x?o:o===null?new x({maxConcurrentAsyncs:0}):new x(o)},Symbol.toStringTag,{value:"Module"})),V=[h.Debug,h.Info,h.Notice,h.Warn,h.Error,h.Critical],_={useI18n:S,...Object.freeze(Object.defineProperty({__proto__:null,supportedLevels:V,useDataPlaneLogLevelChecker:o=>{const n=o.requestExecutor??(r=>r()),{getDataPlaneLogLevel:t,setDataPlaneLogLevel:a}=o,{getMessageFromError:l}=A.useErrors();return{checkDataPlaneLogLevel:(r,i)=>{const d=e.ref(e.toValue(i==null?void 0:i.currentLogLevelHint)??null);d.value===null&&n(async()=>{d.value=await t(r)}).catch(u=>{u instanceof N||console.error("Failed to get data plane log level",u)}),i!=null&&i.currentLogLevelHint&&e.watch(()=>e.toValue(i.currentLogLevelHint),u=>{u&&(d.value=u)});const g=e.ref("pending"),L=e.ref(null);return{currentLogLevel:d,updateStatus:g,updateErrorMessage:L,updateLogLevel:async(u,k)=>{g.value="loading",L.value=null;try{await n(()=>a(r,u,k)),d.value=u,g.value="success"}catch(y){L.value=l(y),g.value="error"}}}}}},useFriendlyRevertTime:o=>{const{i18n:n}=S();return e.computed(()=>{const t=e.toValue(o);if(isNaN(t)||t<=0)return"";let a="";const l=t%60;l!==0&&(a+=`${l} ${n.t("modal.revert_to_default_after.seconds")}`);const c=Math.floor(t/60)%60;c!==0&&(a=`${c} ${n.t("modal.revert_to_default_after.minutes")} ${a}`);const r=Math.floor(t/3600);return r!==0&&(a=`${r} ${n.t("modal.revert_to_default_after.hours")} ${a}`),a})},useLogLevelCandidateSelectItems:o=>{const{i18n:n}=S();return e.computed(()=>{const t=e.toValue(o==null?void 0:o.disabled)??[];return V.map(a=>({label:n.t(`log_level.${a}`),value:a,selected:(o==null?void 0:o.initialSelected)===a,disabled:t.includes(a)}))})},useLogLevelExplanation:o=>{const n=[h.Debug],{i18n:t}=S();return e.computed(()=>{const a=e.toValue(o);return{explanation:t.t(`modal.log_level_explanation.${a}`),warning:n.includes(a)?t.t("modal.log_level_disk_space_warning"):void 0}})}},Symbol.toStringTag,{value:"Module"})),...K},q={"data-testid":"log-change-action"},F={key:0},R={"data-testid":"log-change-action-current-level"},H={key:0},j={"data-testid":"log-change-action-target-level"},O={"data-testid":"log-change-status"},Q=e.defineComponent({__name:"CLLModalNodeRow",props:{dataPlaneId:{},hostname:{},hasDllCapability:{type:Boolean},targetLogLevel:{},checkLogLevel:{},logLevelHint:{}},setup(o,{expose:n}){const t=o,{i18n:a}=_.useI18n();let l=e.ref("not_supported"),c=e.ref("not_supported"),r=e.ref(null),i=async()=>{};t.hasDllCapability&&({currentLogLevel:l,updateStatus:c,updateErrorMessage:r,updateLogLevel:i}=t.checkLogLevel(t.dataPlaneId,{currentLogLevelHint:()=>t.logLevelHint??null})),n({updateLogLevel:i});const d=e.computed(()=>{switch(c.value){case"success":return"success";case"error":return"danger";case"loading":case"pending":return"warning";default:return"neutral"}}),g=e.computed(()=>{switch(c.value){case"success":return a.t("modal.dp_list.status.succeed");case"error":return a.t("modal.dp_list.status.failed");case"pending":return a.t("modal.dp_list.status.pending");case"loading":return a.t("modal.dp_list.status.loading");default:return a.t("modal.dp_list.status.not_supported")}}),L=e.computed(()=>{switch(c.value){case"success":return C.CheckCircleIcon;case"error":case"not_supported":return C.ClearIcon;case"loading":return C.ProgressIcon;default:return C.EqualIcon}});return(v,u)=>{const k=e.resolveComponent("KSkeleton"),y=e.resolveComponent("KBadge"),B=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("tr",null,[e.createElementVNode("td",null,e.toDisplayString(o.hostname),1),e.createElementVNode("td",q,[e.unref(l)==="not_supported"?(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(e.unref(a).t("log_level.not_applicable")),1)):e.unref(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("span",R,e.toDisplayString(e.unref(a).t(`log_level.${e.unref(l)}`)),1),e.unref(l)!==o.targetLogLevel?(e.openBlock(),e.createElementBlock("span",H,[u[0]||(u[0]=e.createTextVNode(" → ",-1)),e.createElementVNode("span",j,e.toDisplayString(e.unref(a).t(`log_level.${o.targetLogLevel}`)),1)])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(k,{key:1,type:"spinner"}))]),e.createElementVNode("td",O,[e.unref(r)?(e.openBlock(),e.createBlock(B,{key:0,text:e.unref(r)},{default:e.withCtx(()=>[e.createVNode(y,{appearance:d.value,class:"badge-cell"},{icon:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(L.value)))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(g.value),1)]),_:1},8,["appearance"])]),_:1},8,["text"])):(e.openBlock(),e.createBlock(y,{key:1,appearance:d.value,class:"badge-cell"},{icon:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(L.value)))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(g.value),1)]),_:1},8,["appearance"]))])])}}}),T=(o,n)=>{const t=o.__vccOpts||o;for(const[a,l]of n)t[a]=l;return t},W=T(Q,[["__scopeId","data-v-ac7205dd"]]),z={class:"explanation-wrapper"},U={key:0,class:"warning-message","data-testid":"log-level-warning-message"},G={class:"revert-after-wrapper"},J={class:"time"},X={class:"seconds"},Y={class:"formatted-time","data-testid":"log-level-timeout-formatted"},Z={class:"data-plane-node-list","data-testid":"data-plane-node-list"},ee={style:{width:"40%"}},te={style:{width:"40%"}},ne=T(e.defineComponent({name:"ChangeLogLevelModal",__name:"ChangeLogLevelModal",props:e.mergeModels({instanceList:{},instanceLogLevel:{},requests:{}},{visible:{type:Boolean},visibleModifiers:{}}),emits:["update:visible"],setup(o){const n=o,t=e.useModel(o,"visible"),a=h.Notice,{i18n:l}=_.useI18n(),c=e.ref("edit"),r=e.ref(a),i=e.ref("60"),d=e.computed(()=>Math.floor(Number(i.value))),g=e.computed(()=>n.instanceList.filter(f=>f.hasDLLCapability!==!1)),L=e.computed(()=>{const f=g.value.length===1?l.t("modal.change_log_level.summary_with_name",{name:g.value[0].hostname}):l.t("modal.change_log_level.summary_with_number",{number:`${g.value.length}`});return l.t("modal.change_log_level.title",{summary:f})}),v=e.computed(()=>c.value==="submitting"||isNaN(d.value)||d.value<=0||g.value.length===0),u=_.useLogLevelCandidateSelectItems({initialSelected:a}),k=_.useLogLevelExplanation(r),y=_.useFriendlyRevertTime(d),B=_.useAsyncScheduler(n.requests.scheduler===void 0?{maxConcurrentAsyncs:10}:n.requests.scheduler),{checkDataPlaneLogLevel:oe}=_.useDataPlaneLogLevelChecker({getDataPlaneLogLevel:n.requests.getDataPlaneLogLevel,setDataPlaneLogLevel:n.requests.setDataPlaneLogLevel,requestExecutor:B.schedule}),E=new Map,ae=(f,m)=>{m===null?E.delete(f):E.set(f,m)},le=async()=>{if(c.value!=="edit"){D();return}c.value="submitting";const f=Array.from(E.values()).map(m=>m.updateLogLevel(r.value,d.value));try{await Promise.all(f)}catch(m){console.error("Failed to update log level",m)}finally{c.value="submitted"}},D=()=>{t.value=!1,i.value="60",c.value="edit",r.value=a},re=e.computed(()=>{switch(c.value){case"submitting":return l.t("modal.action_button.submitting");case"submitted":return l.t("modal.action_button.ok");default:return l.t("modal.action_button.confirm")}});return(f,m)=>{const se=e.resolveComponent("KSelect"),I=e.resolveComponent("KLabel"),ce=e.resolveComponent("KInput"),ie=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(ie,{"action-button-disabled":v.value,"action-button-text":re.value,"data-testid":"change-log-level-modal","hide-cancel-button":!0,"hide-close-icon":c.value==="submitting","max-width":"640px",title:L.value,visible:t.value,onCancel:D,onProceed:le},{default:e.withCtx(()=>[c.value==="edit"?(e.openBlock(),e.createBlock(se,{key:0,modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=p=>r.value=p),class:"log-level-select","data-testid":"log-level-select",items:e.unref(u),label:e.unref(l).t("modal.select_log_level_title")},null,8,["modelValue","items","label"])):e.createCommentVNode("",!0),e.createElementVNode("div",z,[e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l).t(`log_level.${r.value}`)),1)]),_:1}),e.createElementVNode("div",null,e.toDisplayString(e.unref(k).explanation),1),e.unref(k).warning?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(e.unref(k).warning),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",G,[e.createVNode(I,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l).t("modal.revert_to_default_after.label")),1)]),_:1}),e.createElementVNode("div",J,[e.createVNode(ce,{modelValue:i.value,"onUpdate:modelValue":m[1]||(m[1]=p=>i.value=p),class:"time-input","data-testid":"log-level-timeout",disabled:c.value!=="edit",error:d.value<=0||isNaN(d.value),min:"1",type:"number"},null,8,["modelValue","disabled","error"]),e.createElementVNode("span",X,e.toDisplayString(e.unref(l).t("modal.revert_to_default_after.seconds")),1),e.createElementVNode("span",Y,e.toDisplayString(e.unref(y)),1)])]),e.createElementVNode("table",Z,[e.createElementVNode("thead",null,[e.createElementVNode("th",ee,e.toDisplayString(e.unref(l).t("modal.dp_list.header.host")),1),e.createElementVNode("th",te,e.toDisplayString(e.unref(l).t("modal.dp_list.header.action")),1),e.createElementVNode("th",null,e.toDisplayString(e.unref(l).t("modal.dp_list.header.status")),1)]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.instanceList,p=>{var $;return e.openBlock(),e.createBlock(W,{key:p.id,ref_for:!0,ref:de=>ae(p.id,de),"check-log-level":e.unref(oe),"data-plane-id":p.id,"data-testid":`data-plane-node-list-row-${p.id}`,"has-dll-capability":p.hasDLLCapability??!0,hostname:p.hostname,"log-level-hint":($=n.instanceLogLevel)==null?void 0:$.get(p.id),"target-log-level":r.value},null,8,["check-log-level","data-plane-id","data-testid","has-dll-capability","hostname","log-level-hint","target-log-level"])}),128))])])]),_:1},8,["action-button-disabled","action-button-text","hide-close-icon","title","visible"])}}}),[["__scopeId","data-v-c5cbbb14"]]);s.ChangeLogLevelModal=ne,s.LogLevel=h,s.composables=_,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ tr[data-v-ac7205dd],td[data-v-ac7205dd]{color:#000933}tbody tr[data-v-ac7205dd]{font-weight:600;line-height:40px}.badge-cell[data-v-ac7205dd]{vertical-align:sub}.log-level-select[data-v-c5cbbb14],.explanation-wrapper[data-v-c5cbbb14]{margin-bottom:20px}.explanation-wrapper[data-v-c5cbbb14] .k-label{margin-bottom:0!important}.explanation-wrapper .warning-message[data-v-c5cbbb14]{color:#d60027}.revert-after-wrapper[data-v-c5cbbb14]{margin-bottom:8px}.revert-after-wrapper .time[data-v-c5cbbb14]{align-items:center;display:flex}.revert-after-wrapper .time .time-input[data-v-c5cbbb14]{margin-right:8px;width:80px}.revert-after-wrapper .time .seconds[data-v-c5cbbb14]{color:#000933}.revert-after-wrapper .time .formatted-time[data-v-c5cbbb14]{color:#52596e;font-style:italic;margin-left:64px}.data-plane-node-list th[data-v-c5cbbb14],.data-plane-node-list td[data-v-c5cbbb14]{color:#000933}.data-plane-node-list thead[data-v-c5cbbb14]{text-align:left}.data-plane-node-list thead th[data-v-c5cbbb14]{font-weight:700;line-height:36px}
@@ -0,0 +1,16 @@
1
+ import composables from '../composables';
2
+ import type { LogLevel } from '../types';
3
+ type __VLS_Props = {
4
+ dataPlaneId: string;
5
+ hostname: string;
6
+ hasDllCapability: boolean;
7
+ targetLogLevel: LogLevel;
8
+ checkLogLevel: ReturnType<typeof composables.useDataPlaneLogLevelChecker>['checkDataPlaneLogLevel'];
9
+ logLevelHint?: LogLevel | null;
10
+ };
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
12
+ updateLogLevel: (level: LogLevel, revertAfter: number) => Promise<void>;
13
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ //# sourceMappingURL=CLLModalNodeRow.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CLLModalNodeRow.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CLLModalNodeRow.vue"],"names":[],"mappings":"AA2JA,OAAO,WAAW,MAAM,gBAAgB,CAAA;AAKxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,OAAO,CAAA;IACzB,cAAc,EAAE,QAAQ,CAAA;IACxB,aAAa,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,2BAA2B,CAAC,CAAC,wBAAwB,CAAC,CAAA;IACnG,YAAY,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC/B,CAAC;AAuNF,QAAA,MAAM,YAAY;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,25 @@
1
+ import { LogLevel, type DataPlaneNodeCommon } from '../types';
2
+ import type { AsyncScheduler, AsyncSchedulerOptions } from '../composables';
3
+ type __VLS_Props = {
4
+ instanceList: Array<Pick<DataPlaneNodeCommon, 'id' | 'hostname'> & {
5
+ hasDLLCapability?: boolean;
6
+ }>;
7
+ instanceLogLevel: Map<string, LogLevel>;
8
+ requests: {
9
+ scheduler?: AsyncScheduler | AsyncSchedulerOptions | null;
10
+ getDataPlaneLogLevel: (instanceId: string) => Promise<LogLevel>;
11
+ setDataPlaneLogLevel: (instanceId: string, logLevel: LogLevel, revertAfter: number) => Promise<void>;
12
+ };
13
+ };
14
+ type __VLS_ModelProps = {
15
+ 'visible'?: boolean;
16
+ };
17
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
18
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ "update:visible": (value: boolean | undefined) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
21
+ "onUpdate:visible"?: ((value: boolean | undefined) => any) | undefined;
22
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
25
+ //# sourceMappingURL=ChangeLogLevelModal.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeLogLevelModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ChangeLogLevelModal.vue"],"names":[],"mappings":"AAwQA,OAAO,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAM3E,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IAClG,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAmB,QAAQ,CAAC,CAAA;IACxD,QAAQ,EAAE;QACR,SAAS,CAAC,EAAE,cAAc,GAAG,qBAAqB,GAAG,IAAI,CAAA;QACzD,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC/D,oBAAoB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KACrG,CAAA;CACF,CAAC;AAmGF,KAAK,gBAAgB,GAAG;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAkPxD,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,29 @@
1
+ import useI18n from './useI18n';
2
+ import * as useLogLevels from './useLogLevels';
3
+ import * as useAsyncScheduler from './useAsyncScheduler';
4
+ export type { AsyncScheduler, AsyncAbortException, AsyncSchedulerOptions, } from './useAsyncScheduler';
5
+ export type { LogLevelExplanation, DataPlaneLogLevel, } from './useLogLevels';
6
+ declare const _default: {
7
+ AsyncAbortException: typeof useAsyncScheduler.AsyncAbortException;
8
+ AsyncScheduler: typeof useAsyncScheduler.AsyncScheduler;
9
+ useAsyncScheduler: (opt: useAsyncScheduler.AsyncScheduler | useAsyncScheduler.AsyncSchedulerOptions | null) => useAsyncScheduler.AsyncScheduler;
10
+ supportedLevels: import("..").LogLevel[];
11
+ useLogLevelCandidateSelectItems: (opt?: {
12
+ initialSelected?: import("..").LogLevel;
13
+ disabled?: import("vue").MaybeRefOrGetter<import("..").LogLevel[]>;
14
+ }) => import("vue").ComputedRef<import("@kong/kongponents").SelectItem[]>;
15
+ useLogLevelExplanation: (level: import("vue").MaybeRefOrGetter<import("..").LogLevel>) => import("vue").ComputedRef<useLogLevels.LogLevelExplanation>;
16
+ useFriendlyRevertTime: (revertTime: import("vue").MaybeRefOrGetter<number>) => import("vue").ComputedRef<string>;
17
+ useDataPlaneLogLevelChecker: (opt: {
18
+ getDataPlaneLogLevel: (dataPlaneId: string) => Promise<import("..").LogLevel>;
19
+ setDataPlaneLogLevel: (dataPlaneId: string, level: import("..").LogLevel, revertAfter: number) => Promise<void>;
20
+ requestExecutor?: <T>(fn: () => Promise<T>) => Promise<T>;
21
+ }) => {
22
+ checkDataPlaneLogLevel: (dataPlaneId: string, opt?: {
23
+ currentLogLevelHint?: import("vue").MaybeRefOrGetter<import("..").LogLevel | null>;
24
+ }) => useLogLevels.DataPlaneLogLevel;
25
+ };
26
+ useI18n: typeof useI18n;
27
+ };
28
+ export default _default;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAA;AAExD,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,qBAAqB,CAAA;AAE5B,YAAY,EACV,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,gBAAgB,CAAA;;;;wBAQ4tE,sFAAkD;;sCAAjuE;uBAAyB,CAAC;gBAAqB,CAAC;KAAgC;6BAA2e,4DAAiC;4BAA+b,kDAAoC;kCAA0+B;;;uBAAgM,CAAC;KAA2C;;+BAAwQ,CAAC;;;;;AALlmF,wBAIC"}
@@ -0,0 +1,14 @@
1
+ export declare class AsyncAbortException extends Error {
2
+ constructor(message?: string, options?: ErrorOptions);
3
+ }
4
+ export type AsyncSchedulerOptions = {
5
+ maxConcurrentAsyncs: number;
6
+ };
7
+ export declare class AsyncScheduler {
8
+ private tokenBucket;
9
+ constructor(opt: AsyncSchedulerOptions);
10
+ schedule: <T>(asyncInitiator: () => Promise<T>) => Promise<T>;
11
+ cancelAll: (message?: string, options?: ErrorOptions) => void;
12
+ }
13
+ export declare const useAsyncScheduler: (opt: AsyncScheduler | AsyncSchedulerOptions | null) => AsyncScheduler;
14
+ //# sourceMappingURL=useAsyncScheduler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAsyncScheduler.d.ts","sourceRoot":"","sources":["../../../src/composables/useAsyncScheduler.ts"],"names":[],"mappings":"AAgEA,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIrD;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,WAAW,CAA2B;gBAElC,GAAG,EAAE,qBAAqB;IAMtC,QAAQ,GAAU,CAAC,EAAE,gBAAgB,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAAC,CAajE;IAED,SAAS,GAAI,UAAU,MAAM,EAAE,UAAU,YAAY,UAEpD;CACF;AAED,eAAO,MAAM,iBAAiB,GAAI,KAAK,cAAc,GAAG,qBAAqB,GAAG,IAAI,mBAQnF,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { createI18n, i18nTComponent } from '@kong-ui-public/i18n';
2
+ import english from '../locales/en.json';
3
+ interface UseI18nReturn {
4
+ i18n: ReturnType<typeof createI18n<typeof english>>;
5
+ i18nT: ReturnType<typeof i18nTComponent<typeof english>>;
6
+ }
7
+ export default function useI18n(): UseI18nReturn;
8
+ export {};
9
+ //# sourceMappingURL=useI18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../src/composables/useI18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAExC,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,IAAI,aAAa,CAO/C"}
@@ -0,0 +1,30 @@
1
+ import { LogLevel } from '../types';
2
+ import type { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
3
+ import type { SelectItem } from '@kong/kongponents';
4
+ export declare const supportedLevels: LogLevel[];
5
+ export declare const useLogLevelCandidateSelectItems: (opt?: {
6
+ initialSelected?: LogLevel;
7
+ disabled?: MaybeRefOrGetter<LogLevel[]>;
8
+ }) => ComputedRef<SelectItem[]>;
9
+ export type LogLevelExplanation = {
10
+ explanation: string;
11
+ warning?: string;
12
+ };
13
+ export declare const useLogLevelExplanation: (level: MaybeRefOrGetter<LogLevel>) => ComputedRef<LogLevelExplanation>;
14
+ export declare const useFriendlyRevertTime: (revertTime: MaybeRefOrGetter<number>) => ComputedRef<string>;
15
+ export type DataPlaneLogLevel = {
16
+ currentLogLevel: Ref<LogLevel | null>;
17
+ updateStatus: Ref<'pending' | 'success' | 'error' | 'loading'>;
18
+ updateErrorMessage: Ref<string | null>;
19
+ updateLogLevel: (level: LogLevel, revertAfter: number) => Promise<void>;
20
+ };
21
+ export declare const useDataPlaneLogLevelChecker: (opt: {
22
+ getDataPlaneLogLevel: (dataPlaneId: string) => Promise<LogLevel>;
23
+ setDataPlaneLogLevel: (dataPlaneId: string, level: LogLevel, revertAfter: number) => Promise<void>;
24
+ requestExecutor?: <T>(fn: () => Promise<T>) => Promise<T>;
25
+ }) => {
26
+ checkDataPlaneLogLevel: (dataPlaneId: string, opt?: {
27
+ currentLogLevelHint?: MaybeRefOrGetter<LogLevel | null>;
28
+ }) => DataPlaneLogLevel;
29
+ };
30
+ //# sourceMappingURL=useLogLevels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLogLevels.d.ts","sourceRoot":"","sources":["../../../src/composables/useLogLevels.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAInC,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,eAAO,MAAM,eAAe,EAAE,QAAQ,EAOrC,CAAA;AAED,eAAO,MAAM,+BAA+B,GAAI,MAAM;IACpD,eAAe,CAAC,EAAE,QAAQ,CAAA;IAC1B,QAAQ,CAAC,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAA;CACxC,KAAG,WAAW,CAAC,UAAU,EAAE,CAa3B,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAC3E,eAAO,MAAM,sBAAsB,GAAI,OAAO,gBAAgB,CAAC,QAAQ,CAAC,KAAG,WAAW,CAAC,mBAAmB,CAazG,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,YAAY,gBAAgB,CAAC,MAAM,CAAC,KAAG,WAAW,CAAC,MAAM,CAyB9F,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IACrC,YAAY,EAAE,GAAG,CAAC,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IAC9D,kBAAkB,EAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACtC,cAAc,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACxE,CAAA;AAED,eAAO,MAAM,2BAA2B,GAAI,KAAK;IAC/C,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IAChE,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAClG,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CAC1D;0CAM8C,MAAM,QAAQ;QACzD,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;KACxD,KAAG,iBAAiB;CA6CtB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { DataPlaneNodeCommon } from '../types';
2
+ export declare const mockDataPlane: () => DataPlaneNodeCommon;
3
+ //# sourceMappingURL=data-planes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-planes.d.ts","sourceRoot":"","sources":["../../../src/fixtures/data-planes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAEnD,eAAO,MAAM,aAAa,QAAO,mBAGhC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import ChangeLogLevelModal from './components/ChangeLogLevelModal.vue';
2
+ import composables from './composables';
3
+ export { ChangeLogLevelModal };
4
+ export { composables };
5
+ export type * from './composables';
6
+ export * from './types';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,sCAAsC,CAAA;AACtE,OAAO,WAAW,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,mBAAmB,EAAE,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,CAAA;AAEtB,mBAAmB,eAAe,CAAA;AAClC,cAAc,SAAS,CAAA"}
@@ -0,0 +1,59 @@
1
+ export interface DataPlaneNodeCommon {
2
+ id: string;
3
+ hostname: string;
4
+ }
5
+ export interface KonnectRuntimeInstance extends DataPlaneNodeCommon {
6
+ version: string;
7
+ last_ping: number;
8
+ type: string;
9
+ created_at: number;
10
+ updated_at: number;
11
+ config_hash: string;
12
+ compatibility_status: {
13
+ state: string;
14
+ issues?: Array<{
15
+ affected_resources: Array<{
16
+ id: string;
17
+ type: string;
18
+ }>;
19
+ code: string;
20
+ description: string;
21
+ documentation_url: string;
22
+ resolution: string;
23
+ severity: string;
24
+ }>;
25
+ config_hash?: string;
26
+ };
27
+ data_plane_cert_id: string;
28
+ labels?: Record<string, string>;
29
+ process_conf: {
30
+ plugins: string[];
31
+ cluster_max_payload: number;
32
+ lmdb_map_size: string;
33
+ router_flavor: string;
34
+ };
35
+ connection_state: {
36
+ is_connected: boolean;
37
+ };
38
+ errors?: Array<{
39
+ name: string;
40
+ config_hash: string;
41
+ flattened_errors: Array<{
42
+ entity_id: string;
43
+ entity_name: string;
44
+ errors: Array<{
45
+ error_message: string;
46
+ type: string;
47
+ field: string;
48
+ }>;
49
+ entity_type: string;
50
+ }>;
51
+ code: number;
52
+ source: string;
53
+ }>;
54
+ connected?: string;
55
+ total_traffic: number | null;
56
+ error_rate: number | null;
57
+ status?: string;
58
+ }
59
+ //# sourceMappingURL=data-plane-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-plane-node.d.ts","sourceRoot":"","sources":["../../../src/types/data-plane-node.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,oBAAoB,EAAE;QACpB,KAAK,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE,KAAK,CAAC;YACb,kBAAkB,EAAE,KAAK,CAAC;gBACxB,EAAE,EAAE,MAAM,CAAA;gBACV,IAAI,EAAE,MAAM,CAAA;aACb,CAAC,CAAA;YACF,IAAI,EAAE,MAAM,CAAA;YACZ,WAAW,EAAE,MAAM,CAAA;YACnB,iBAAiB,EAAE,MAAM,CAAA;YACzB,UAAU,EAAE,MAAM,CAAA;YAClB,QAAQ,EAAE,MAAM,CAAA;SACjB,CAAC,CAAA;QACF,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,kBAAkB,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,EAAE,CAAA;QACjB,mBAAmB,EAAE,MAAM,CAAA;QAC3B,aAAa,EAAE,MAAM,CAAA;QACrB,aAAa,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,gBAAgB,EAAE;QAChB,YAAY,EAAE,OAAO,CAAA;KACtB,CAAA;IACD,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,gBAAgB,EAAE,KAAK,CAAC;YACtB,SAAS,EAAE,MAAM,CAAA;YACjB,WAAW,EAAE,MAAM,CAAA;YACnB,MAAM,EAAE,KAAK,CAAC;gBACZ,aAAa,EAAE,MAAM,CAAA;gBACrB,IAAI,EAAE,MAAM,CAAA;gBACZ,KAAK,EAAE,MAAM,CAAA;aACd,CAAC,CAAA;YACF,WAAW,EAAE,MAAM,CAAA;SACpB,CAAC,CAAA;QACF,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;KACf,CAAC,CAAA;IACF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,3 @@
1
+ export * from './data-plane-node';
2
+ export * from './log-level';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare const enum LogLevel {
2
+ Debug = "debug",
3
+ Info = "info",
4
+ Notice = "notice",
5
+ Warn = "warn",
6
+ Error = "error",
7
+ Critical = "crit"
8
+ }
9
+ //# sourceMappingURL=log-level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-level.d.ts","sourceRoot":"","sources":["../../../src/types/log-level.ts"],"names":[],"mappings":"AAAA,0BAAkB,QAAQ;IACxB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,QAAQ,SAAS;CAClB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/entities-data-plane-nodes",
3
- "version": "0.5.42-pr.2798.a6ee9fc6b.0",
3
+ "version": "0.5.42-pr.2836.18eab0ddc.0",
4
4
  "type": "module",
5
5
  "main": "./dist/entities-data-plane-nodes.umd.js",
6
6
  "module": "./dist/entities-data-plane-nodes.es.js",
@@ -26,8 +26,8 @@
26
26
  "axios": "^1.13.2",
27
27
  "vue": ">= 3.3.13 < 4",
28
28
  "vue-router": "^4.6.4",
29
- "@kong-ui-public/entities-shared": "^3.39.2-pr.2798.a6ee9fc6b.0",
30
- "@kong-ui-public/i18n": "^2.4.5"
29
+ "@kong-ui-public/i18n": "^2.4.5",
30
+ "@kong-ui-public/entities-shared": "^3.39.2-pr.2836.18eab0ddc.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@kong/design-tokens": "1.18.2",
@@ -36,8 +36,8 @@
36
36
  "axios": "^1.13.2",
37
37
  "vue": "^3.5.26",
38
38
  "vue-router": "^4.6.4",
39
- "@kong-ui-public/i18n": "^2.4.5",
40
- "@kong-ui-public/entities-shared": "^3.39.2-pr.2798.a6ee9fc6b.0"
39
+ "@kong-ui-public/entities-shared": "^3.39.2-pr.2836.18eab0ddc.0",
40
+ "@kong-ui-public/i18n": "^2.4.5"
41
41
  },
42
42
  "repository": {
43
43
  "type": "git",