@kong-ui-public/entities-data-plane-nodes 0.3.101-pr.2114.d6a8378f0.0 → 0.3.101

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 N = (n, e, t) => oe(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { computed as p, toValue as D, ref as L, watch as ae, defineComponent as O, resolveComponent as x, openBlock as g, createElementBlock as $, createElementVNode as i, toDisplayString as d, unref as l, createBlock as k, Fragment as j, createTextVNode as A, createCommentVNode as q, withCtx as w, createVNode as B, 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 _e = {
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
+ }, he = {
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: _e,
59
+ log_level: he
60
+ };
61
+ function P() {
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
+ N(this, "concurrentTokenSet", /* @__PURE__ */ new Set());
73
+ N(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 E {
114
+ constructor(e) {
115
+ N(this, "tokenBucket", null);
116
+ N(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
+ N(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 E ? n : n === null ? new E({ maxConcurrentAsyncs: 0 }) : new E(n), Le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
134
+ __proto__: null,
135
+ AsyncAbortException: V,
136
+ AsyncScheduler: E,
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 } = P();
147
+ return p(() => {
148
+ const t = D(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 } = P();
158
+ return p(() => {
159
+ const o = D(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 } = P();
167
+ return p(() => {
168
+ const t = D(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(D(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(() => D(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 (I) {
200
+ y.value = a(I), m.value = "error";
201
+ }
202
+ }
203
+ };
204
+ } };
205
+ }, Se = /* @__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" })), S = {
213
+ useI18n: P,
214
+ ...Se,
215
+ ...Le
216
+ }, xe = { "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 } = S.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 (T, v) => {
279
+ const C = x("KSkeleton"), I = x("KBadge"), M = x("KTooltip");
280
+ return g(), $("tr", null, [
281
+ i("td", null, d(T.hostname), 1),
282
+ i("td", xe, [
283
+ l(a) === "not_supported" ? (g(), $("span", Te, d(l(o).t("log_level.not_applicable")), 1)) : l(a) ? (g(), $(j, { key: 2 }, [
284
+ i("span", Ie, d(l(o).t(`log_level.${l(a)}`)), 1),
285
+ l(a) !== T.targetLogLevel ? (g(), $("span", Ne, [
286
+ v[0] || (v[0] = A(" → ")),
287
+ i("span", $e, d(l(o).t(`log_level.${T.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
+ B(I, {
301
+ appearance: u.value,
302
+ class: "badge-cell"
303
+ }, {
304
+ icon: w(() => [
305
+ (g(), k(Q(y.value)))
306
+ ]),
307
+ default: w(() => [
308
+ A(" " + d(m.value), 1)
309
+ ]),
310
+ _: 1
311
+ }, 8, ["appearance"])
312
+ ]),
313
+ _: 1
314
+ }, 8, ["text"])) : (g(), k(I, {
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
+ A(" " + 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 } = S.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
+ }), T = p(() => r.value === "submitting" || isNaN(u.value) || u.value <= 0 || m.value.length === 0), v = S.useLogLevelCandidateSelectItems({
363
+ initialSelected: o
364
+ }), C = S.useLogLevelExplanation(s), I = S.useFriendlyRevertTime(u), M = S.useAsyncScheduler(
365
+ e.requests.scheduler === void 0 ? { maxConcurrentAsyncs: 10 } : e.requests.scheduler
366
+ ), { checkDataPlaneLogLevel: U } = S.useDataPlaneLogLevelChecker({
367
+ getDataPlaneLogLevel: e.requests.getDataPlaneLogLevel,
368
+ setDataPlaneLogLevel: e.requests.setDataPlaneLogLevel,
369
+ requestExecutor: M.schedule
370
+ }), K = /* @__PURE__ */ new Map(), G = (f, _) => {
371
+ _ === null ? K.delete(f) : K.set(f, _);
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((_) => _.updateLogLevel(s.value, u.value));
379
+ try {
380
+ await Promise.all(f);
381
+ } catch (_) {
382
+ console.error("Failed to update log level", _);
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, _) => {
399
+ const Y = x("KSelect"), R = x("KLabel"), Z = x("KInput"), ee = x("KModal");
400
+ return g(), k(ee, {
401
+ "action-button-disabled": T.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": _[0] || (_[0] = (h) => s.value = h),
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
+ B(R, null, {
424
+ default: w(() => [
425
+ A(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(), $("div", Pe, d(l(C).warning), 1)) : q("", !0)
431
+ ]),
432
+ i("div", Me, [
433
+ B(R, null, {
434
+ default: w(() => [
435
+ A(d(l(a).t("modal.revert_to_default_after.label")), 1)
436
+ ]),
437
+ _: 1
438
+ }),
439
+ i("div", Ke, [
440
+ B(Z, {
441
+ modelValue: c.value,
442
+ "onUpdate:modelValue": _[1] || (_[1] = (h) => c.value = h),
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(I)), 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), $(j, null, re(e.instanceList, (h) => {
462
+ var F;
463
+ return g(), k(Be, {
464
+ key: h.id,
465
+ ref_for: !0,
466
+ ref: (te) => G(h.id, te),
467
+ "check-log-level": l(U),
468
+ "data-plane-id": h.id,
469
+ "data-testid": `data-plane-node-list-row-${h.id}`,
470
+ "has-dll-capability": h.hasDLLCapability ?? !0,
471
+ hostname: h.hostname,
472
+ "log-level-hint": (F = e.instanceLogLevel) == null ? void 0 : F.get(h.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-983a59ac"]]);
484
+ export {
485
+ Ge as ChangeLogLevelModal,
486
+ b as LogLevel,
487
+ S 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,k,A,S){"use strict";var ue=Object.defineProperty;var ge=(s,e,k)=>e in s?ue(s,e,{enumerable:!0,configurable:!0,writable:!0,value:k}):s[e]=k;var C=(s,e,k)=>ge(s,typeof e!="symbol"?e+"":e,k);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 N(){const o=k.createI18n("en-us",P);return{i18n:o,i18nT:k.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){C(this,"concurrentTokenSet",new Set);C(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 x extends Error{constructor(n,t){super(n,t),this.name="AsyncAbortException"}}class v{constructor(n){C(this,"tokenBucket",null);C(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}});C(this,"cancelAll",(n,t)=>{var a;(a=this.tokenBucket)==null||a.clearWaitingQueue(new x(n,t))});n.maxConcurrentAsyncs>0&&(this.tokenBucket=new M(n.maxConcurrentAsyncs))}}const K=Object.freeze(Object.defineProperty({__proto__:null,AsyncAbortException:x,AsyncScheduler:v,useAsyncScheduler:o=>o instanceof v?o:o===null?new v({maxConcurrentAsyncs:0}):new v(o)},Symbol.toStringTag,{value:"Module"})),V=[h.Debug,h.Info,h.Notice,h.Warn,h.Error,h.Critical],f={useI18n:N,...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,c)=>{const d=e.ref(e.toValue(c==null?void 0:c.currentLogLevelHint)??null);d.value===null&&n(async()=>{d.value=await t(r)}).catch(u=>{u instanceof x||console.error("Failed to get data plane log level",u)}),c!=null&&c.currentLogLevelHint&&e.watch(()=>e.toValue(c.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,b)=>{g.value="loading",L.value=null;try{await n(()=>a(r,u,b)),d.value=u,g.value="success"}catch(w){L.value=l(w),g.value="error"}}}}}},useFriendlyRevertTime:o=>{const{i18n:n}=N();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 i=Math.floor(t/60)%60;i!==0&&(a=`${i} ${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}=N();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}=N();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}=f.useI18n();let l=e.ref("not_supported"),i=e.ref("not_supported"),r=e.ref(null),c=async()=>{};t.hasDllCapability&&({currentLogLevel:l,updateStatus:i,updateErrorMessage:r,updateLogLevel:c}=t.checkLogLevel(t.dataPlaneId,{currentLogLevelHint:()=>t.logLevelHint??null})),n({updateLogLevel:c});const d=e.computed(()=>{switch(i.value){case"success":return"success";case"error":return"danger";case"loading":case"pending":return"warning";default:return"neutral"}}),g=e.computed(()=>{switch(i.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(i.value){case"success":return S.CheckCircleIcon;case"error":case"not_supported":return S.ClearIcon;case"loading":return S.ProgressIcon;default:return S.EqualIcon}});return(y,u)=>{const b=e.resolveComponent("KSkeleton"),w=e.resolveComponent("KBadge"),B=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("tr",null,[e.createElementVNode("td",null,e.toDisplayString(y.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)!==y.targetLogLevel?(e.openBlock(),e.createElementBlock("span",H,[u[0]||(u[0]=e.createTextVNode(" → ")),e.createElementVNode("span",j,e.toDisplayString(e.unref(a).t(`log_level.${y.targetLogLevel}`)),1)])):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createBlock(b,{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(w,{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(w,{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}=f.useI18n(),i=e.ref("edit"),r=e.ref(a),c=e.ref("60"),d=e.computed(()=>Math.floor(Number(c.value))),g=e.computed(()=>n.instanceList.filter(_=>_.hasDLLCapability!==!1)),L=e.computed(()=>{const _=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:_})}),y=e.computed(()=>i.value==="submitting"||isNaN(d.value)||d.value<=0||g.value.length===0),u=f.useLogLevelCandidateSelectItems({initialSelected:a}),b=f.useLogLevelExplanation(r),w=f.useFriendlyRevertTime(d),B=f.useAsyncScheduler(n.requests.scheduler===void 0?{maxConcurrentAsyncs:10}:n.requests.scheduler),{checkDataPlaneLogLevel:oe}=f.useDataPlaneLogLevelChecker({getDataPlaneLogLevel:n.requests.getDataPlaneLogLevel,setDataPlaneLogLevel:n.requests.setDataPlaneLogLevel,requestExecutor:B.schedule}),E=new Map,ae=(_,m)=>{m===null?E.delete(_):E.set(_,m)},le=async()=>{if(i.value!=="edit"){D();return}i.value="submitting";const _=Array.from(E.values()).map(m=>m.updateLogLevel(r.value,d.value));try{await Promise.all(_)}catch(m){console.error("Failed to update log level",m)}finally{i.value="submitted"}},D=()=>{t.value=!1,c.value="60",i.value="edit",r.value=a},re=e.computed(()=>{switch(i.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(_,m)=>{const se=e.resolveComponent("KSelect"),I=e.resolveComponent("KLabel"),ie=e.resolveComponent("KInput"),ce=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(ce,{"action-button-disabled":y.value,"action-button-text":re.value,"data-testid":"change-log-level-modal","hide-cancel-button":!0,"hide-close-icon":i.value==="submitting","max-width":"640px",title:L.value,visible:t.value,onCancel:D,onProceed:le},{default:e.withCtx(()=>[i.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(b).explanation),1),e.unref(b).warning?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(e.unref(b).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(ie,{modelValue:c.value,"onUpdate:modelValue":m[1]||(m[1]=p=>c.value=p),class:"time-input","data-testid":"log-level-timeout",disabled:i.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(w)),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-983a59ac"]]);s.ChangeLogLevelModal=ne,s.LogLevel=h,s.composables=f,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-983a59ac],.explanation-wrapper[data-v-983a59ac]{margin-bottom:20px}.explanation-wrapper[data-v-983a59ac] .k-label{margin-bottom:0!important}.explanation-wrapper .warning-message[data-v-983a59ac]{color:#d60027}.revert-after-wrapper[data-v-983a59ac]{margin-bottom:8px}.revert-after-wrapper .time[data-v-983a59ac]{align-items:center;display:flex}.revert-after-wrapper .time .time-input[data-v-983a59ac]{margin-right:8px;width:80px}.revert-after-wrapper .time .seconds[data-v-983a59ac]{color:#000933}.revert-after-wrapper .time .formatted-time[data-v-983a59ac]{color:#52596e;font-style:italic;margin-left:64px}.data-plane-node-list th[data-v-983a59ac],.data-plane-node-list td[data-v-983a59ac]{color:#000933}.data-plane-node-list thead[data-v-983a59ac]{text-align:left}.data-plane-node-list thead th[data-v-983a59ac]{font-weight:700;line-height:36px}
@@ -0,0 +1,21 @@
1
+ import composables from '../composables';
2
+ import type { LogLevel } from '../types';
3
+ declare const _default: import("vue").DefineComponent<{
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
+ updateLogLevel: (level: LogLevel, revertAfter: number) => Promise<void>;
12
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
13
+ dataPlaneId: string;
14
+ hostname: string;
15
+ hasDllCapability: boolean;
16
+ targetLogLevel: LogLevel;
17
+ checkLogLevel: ReturnType<typeof composables.useDataPlaneLogLevelChecker>["checkDataPlaneLogLevel"];
18
+ logLevelHint?: LogLevel | null;
19
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ export default _default;
21
+ //# 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":"AA0JA,OAAO,WAAW,MAAM,gBAAgB,CAAA;AAKxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;;iBAOzB,MAAM;cACT,MAAM;sBACE,OAAO;oBACT,QAAQ;mBACT,UAAU,CAAC,OAAO,WAAW,CAAC,2BAA2B,CAAC,CAAC,wBAAwB,CAAC;mBACpF,QAAQ,GAAG,IAAI;;;;iBALjB,MAAM;cACT,MAAM;sBACE,OAAO;oBACT,QAAQ;mBACT,UAAU,CAAC,OAAO,WAAW,CAAC,2BAA2B,CAAC,CAAC,wBAAwB,CAAC;mBACpF,QAAQ,GAAG,IAAI;;AAsMhC,wBAOG"}
@@ -0,0 +1,23 @@
1
+ import { LogLevel, type DataPlaneNodeCommon } from '../types';
2
+ import type { AsyncScheduler, AsyncSchedulerOptions } from '../composables';
3
+ declare let __VLS_typeProps: {
4
+ instanceList: (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_PublicProps = {
15
+ 'visible'?: boolean;
16
+ } & typeof __VLS_typeProps;
17
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ "update:visible": (visible: boolean) => any;
19
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
+ "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
21
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ export default _default;
23
+ //# 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":"AAuQA,OAAO,EAAE,QAAQ,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAQ3E,QAAA,IAAI,eAAe,EAAG;IACpB,YAAY,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,UAAU,CAAC,GAAG;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,EAAE,CAAA;IAC/F,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;AAwGF,KAAK,iBAAiB,GAAG;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,eAAe,CAAC;;;;;;AAmL3B,wBAOG"}
@@ -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/dist/types").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;;;;;;;uBAQsE,CAAC;gBAAqB,CAAC;;;;;;;uBAAyrE,CAAC;;;+BAAmT,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,kBAAkB,MAAM,OAAO,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,CAAC,CAAC,CAajE;IAED,SAAS,aAAc,MAAM,YAAY,YAAY,UAEpD;CACF;AAED,eAAO,MAAM,iBAAiB,QAAS,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,SAAU;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,UAAW,gBAAgB,CAAC,QAAQ,CAAC,KAAG,WAAW,CAAC,mBAAmB,CAazG,CAAA;AAED,eAAO,MAAM,qBAAqB,eAAgB,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,QAAS;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?: {
15
+ affected_resources: {
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?: {
39
+ name: string;
40
+ config_hash: string;
41
+ flattened_errors: {
42
+ entity_id: string;
43
+ entity_name: string;
44
+ errors: {
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;YACP,kBAAkB,EAAE;gBAClB,EAAE,EAAE,MAAM,CAAA;gBACV,IAAI,EAAE,MAAM,CAAA;aACb,EAAE,CAAA;YACH,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,EAAE,CAAA;QACH,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;QACP,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,gBAAgB,EAAE;YAChB,SAAS,EAAE,MAAM,CAAA;YACjB,WAAW,EAAE,MAAM,CAAA;YACnB,MAAM,EAAE;gBACN,aAAa,EAAE,MAAM,CAAA;gBACrB,IAAI,EAAE,MAAM,CAAA;gBACZ,KAAK,EAAE,MAAM,CAAA;aACd,EAAE,CAAA;YACH,WAAW,EAAE,MAAM,CAAA;SACpB,EAAE,CAAA;QACH,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;KACf,EAAE,CAAA;IACH,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.3.101-pr.2114.d6a8378f0.0",
3
+ "version": "0.3.101",
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,7 +26,7 @@
26
26
  "axios": "^1.7.7",
27
27
  "vue": ">= 3.3.13 < 4",
28
28
  "vue-router": "^4.4.5",
29
- "@kong-ui-public/entities-shared": "^3.24.2-pr.2114.d6a8378f0.0",
29
+ "@kong-ui-public/entities-shared": "^3.25.0",
30
30
  "@kong-ui-public/i18n": "^2.3.0"
31
31
  },
32
32
  "devDependencies": {
@@ -36,7 +36,7 @@
36
36
  "axios": "^1.7.7",
37
37
  "vue": "^3.5.13",
38
38
  "vue-router": "^4.4.5",
39
- "@kong-ui-public/entities-shared": "^3.24.2-pr.2114.d6a8378f0.0",
39
+ "@kong-ui-public/entities-shared": "^3.25.0",
40
40
  "@kong-ui-public/i18n": "^2.3.0"
41
41
  },
42
42
  "repository": {