@kong-ui-public/entities-data-plane-nodes 1.2.3 → 1.3.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.
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useAxios as
|
|
3
|
-
import { WarningIcon as
|
|
4
|
-
import { createI18n as
|
|
5
|
-
const
|
|
6
|
-
modal:
|
|
7
|
-
log_level:
|
|
8
|
-
operation_status:
|
|
1
|
+
import { defineComponent as _e, useModel as he, ref as r, computed as d, watch as fe, onBeforeUnmount as be, resolveComponent as v, openBlock as _, createBlock as U, unref as i, withCtx as m, createElementBlock as P, createElementVNode as g, toDisplayString as u, createVNode as c, createTextVNode as x, normalizeClass as xe, createCommentVNode as Ie, resolveDynamicComponent as ye, Fragment as Ee, mergeModels as G } from "vue";
|
|
2
|
+
import { useAxios as Ce, useErrors as Le } from "@kong-ui-public/entities-shared";
|
|
3
|
+
import { WarningIcon as ke, DangerCircleIcon as we, InfoIcon as B, CheckCircleIcon as Te, ProgressIcon as Ue } from "@kong/icons";
|
|
4
|
+
import { createI18n as Ne, i18nTComponent as Ve } from "@kong-ui-public/i18n";
|
|
5
|
+
const Ke = "20px", Ae = { title: "Change log level temporarily", description: "Choose how much information Kong Gateway writes to its logs. Changes automatically revert when the TTL expires.", log_level_label: "Log level", log_level_help: "Selecting a log level captures logs at the selected level and all lower-severity levels.", learn_more: "Learn more", expiration: { label: "Expiration", tooltip: "The duration before the log level automatically reverts to its default value.", help: { seconds: "Enter a value between 1 second and 3600 seconds.", mins: "Enter a value between 1 minute and 60 minutes." }, unit: { seconds: "secs", mins: "mins" } }, warning: "Higher log levels can significantly increase log volume and disk usage. Use them only while troubleshooting.", save: "Save", cancel: "Cancel", done: "Done", status_title: "Change log level status", node_host: "Node host", status: "Status", status_note: "Updates typically reach all data plane nodes in about 5 seconds. Keep this modal open to monitor progress while the update is in progress." }, Se = { debug: "Debug", info: "Info", notice: "Notice", warn: "Warn", error: "Error", crit: "Critical" }, Me = { in_progress: "In progress", applied: "Applied", reverted: "Reverted", superseded: "Superseded", failed: "Failed", unsupported: "Unsupported" }, De = {
|
|
6
|
+
modal: Ae,
|
|
7
|
+
log_level: Se,
|
|
8
|
+
operation_status: Me
|
|
9
9
|
};
|
|
10
|
-
function
|
|
11
|
-
const
|
|
10
|
+
function Pe() {
|
|
11
|
+
const o = Ne("en-us", De);
|
|
12
12
|
return {
|
|
13
|
-
i18n:
|
|
14
|
-
i18nT:
|
|
13
|
+
i18n: o,
|
|
14
|
+
i18nT: Ve(o)
|
|
15
15
|
// Translation component <i18n-t>
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
useI18n:
|
|
20
|
-
},
|
|
18
|
+
const Be = {
|
|
19
|
+
useI18n: Pe
|
|
20
|
+
}, W = "/v2/control-planes/{controlPlaneId}", H = "/debug/cluster", q = {
|
|
21
21
|
logLevel: {
|
|
22
22
|
konnect: {
|
|
23
|
-
update: `${
|
|
24
|
-
results: `${
|
|
23
|
+
update: `${W}/nodes/log-level-operations`,
|
|
24
|
+
results: `${W}/nodes/log-level-operations/{operationId}/results`
|
|
25
25
|
},
|
|
26
26
|
kongManager: {
|
|
27
|
-
update: `${
|
|
28
|
-
results: `${
|
|
27
|
+
update: `${H}/data-planes/log-level-operations`,
|
|
28
|
+
results: `${H}/data-planes/log-level-operations/{operationId}/results?size=1000`
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
var
|
|
33
|
-
const
|
|
32
|
+
var j = /* @__PURE__ */ ((o) => (o.Debug = "debug", o.Info = "info", o.Notice = "notice", o.Warn = "warn", o.Error = "error", o.Critical = "crit", o))(j || {});
|
|
33
|
+
const Re = [
|
|
34
34
|
"debug",
|
|
35
35
|
"info",
|
|
36
36
|
"notice",
|
|
@@ -38,16 +38,16 @@ const Ve = [
|
|
|
38
38
|
"error",
|
|
39
39
|
"crit"
|
|
40
40
|
/* Critical */
|
|
41
|
-
],
|
|
41
|
+
], $e = {
|
|
42
42
|
key: 0,
|
|
43
43
|
class: "change-log-level-modal-content"
|
|
44
|
-
},
|
|
44
|
+
}, Oe = { class: "description" }, Fe = { class: "log-level-field" }, ze = { class: "field-help" }, Ge = { class: "expiration-field" }, We = { class: "expiration-inputs" }, He = {
|
|
45
45
|
key: 1,
|
|
46
46
|
class: "change-log-level-status"
|
|
47
|
-
},
|
|
47
|
+
}, qe = { class: "status-note" }, X = 10, Z = "mins", Xe = 2e3, Ze = "https://developer.konghq.com/gateway/logs/", je = /* @__PURE__ */ _e({
|
|
48
48
|
name: "ChangeLogLevelModal",
|
|
49
49
|
__name: "ChangeLogLevelModal",
|
|
50
|
-
props: /* @__PURE__ */
|
|
50
|
+
props: /* @__PURE__ */ G({
|
|
51
51
|
config: {},
|
|
52
52
|
nodes: {},
|
|
53
53
|
getNodeDetailRoute: { type: Function }
|
|
@@ -55,179 +55,217 @@ const Ve = [
|
|
|
55
55
|
visible: { type: Boolean },
|
|
56
56
|
visibleModifiers: {}
|
|
57
57
|
}),
|
|
58
|
-
emits: /* @__PURE__ */
|
|
59
|
-
setup(
|
|
60
|
-
const
|
|
58
|
+
emits: /* @__PURE__ */ G(["success", "close", "node-error"], ["update:visible"]),
|
|
59
|
+
setup(o, { emit: N }) {
|
|
60
|
+
const s = o, I = N, L = he(o, "visible"), { i18n: e } = Be.useI18n(), { axiosInstance: R } = Ce(s.config.axiosRequestConfig), { getMessageFromError: J } = Le(), $ = j.Notice, Q = {
|
|
61
61
|
in_progress: "info",
|
|
62
62
|
applied: "success",
|
|
63
63
|
reverted: "neutral",
|
|
64
64
|
superseded: "neutral",
|
|
65
65
|
failed: "danger",
|
|
66
66
|
unsupported: "warning"
|
|
67
|
-
},
|
|
68
|
-
in_progress:
|
|
69
|
-
applied:
|
|
70
|
-
reverted:
|
|
71
|
-
superseded:
|
|
72
|
-
failed:
|
|
73
|
-
unsupported:
|
|
74
|
-
},
|
|
75
|
-
label:
|
|
76
|
-
value:
|
|
77
|
-
}))),
|
|
78
|
-
{
|
|
79
|
-
{
|
|
80
|
-
]),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
|
|
67
|
+
}, Y = {
|
|
68
|
+
in_progress: Ue,
|
|
69
|
+
applied: Te,
|
|
70
|
+
reverted: B,
|
|
71
|
+
superseded: B,
|
|
72
|
+
failed: we,
|
|
73
|
+
unsupported: ke
|
|
74
|
+
}, p = r("edit"), k = r($), h = r(X), f = r(Z), y = r(!1), E = r(""), V = r(""), w = r({}), C = r(null), K = r(!1), A = /* @__PURE__ */ new Set(), ee = d(() => Re.map((a) => ({
|
|
75
|
+
label: e.t(`log_level.${a}`),
|
|
76
|
+
value: a
|
|
77
|
+
}))), te = d(() => [
|
|
78
|
+
{ label: e.t("modal.expiration.unit.mins"), value: "mins" },
|
|
79
|
+
{ label: e.t("modal.expiration.unit.seconds"), value: "seconds" }
|
|
80
|
+
]), S = d(() => f.value === "mins" ? h.value * 60 : h.value), oe = d(() => e.t(`modal.expiration.help.${f.value}`)), M = d(() => Number.isInteger(h.value) && S.value >= 1 && S.value <= 3600), ae = d(() => p.value === "status" ? e.t("modal.status_title") : e.t("modal.title")), le = d(() => p.value === "status" ? e.t("modal.done") : e.t("modal.save")), ne = d(() => [
|
|
81
|
+
{ key: "host", label: e.t("modal.node_host") },
|
|
82
|
+
{ key: "status", label: e.t("modal.status") }
|
|
83
|
+
]), se = d(() => s.nodes.map((a) => ({
|
|
84
|
+
id: a.id,
|
|
85
|
+
hostname: a.hostname,
|
|
86
|
+
status: w.value[a.id] ?? "in_progress"
|
|
87
|
+
}))), O = (a, l) => {
|
|
88
|
+
let t = `${s.config.apiBaseUrl}${a}`;
|
|
89
|
+
return s.config.app === "konnect" && (t = t.replace(/{controlPlaneId}/gi, s.config.controlPlaneId)), t.replace(/{operationId}/gi, l ?? "");
|
|
90
|
+
}, D = () => {
|
|
91
|
+
K.value = !1, C.value && (clearTimeout(C.value), C.value = null);
|
|
92
|
+
}, F = async () => {
|
|
90
93
|
try {
|
|
91
|
-
const
|
|
92
|
-
for (const
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
94
|
+
const a = O(q.logLevel[s.config.app].results, V.value), { data: l } = await R.get(a);
|
|
95
|
+
for (const t of l.data)
|
|
96
|
+
if (w.value[t.node_id] = t.status, (t.status === "failed" || t.status === "unsupported") && !A.has(t.node_id)) {
|
|
97
|
+
A.add(t.node_id);
|
|
98
|
+
const b = s.nodes.find((T) => T.id === t.node_id)?.hostname ?? "";
|
|
99
|
+
I("node-error", { id: t.node_id, hostname: b, status: t.status });
|
|
97
100
|
}
|
|
98
|
-
if (
|
|
99
|
-
|
|
101
|
+
if (l.data.length > 0 && l.data.every((t) => t.status !== "in_progress")) {
|
|
102
|
+
D();
|
|
100
103
|
return;
|
|
101
104
|
}
|
|
102
105
|
} catch {
|
|
103
106
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
|
|
107
|
+
K.value && (C.value = setTimeout(() => {
|
|
108
|
+
C.value = null, F();
|
|
109
|
+
}, Xe));
|
|
110
|
+
}, ie = () => {
|
|
111
|
+
w.value = {}, K.value = !0, F();
|
|
112
|
+
}, re = async () => {
|
|
113
|
+
E.value = "", y.value = !0;
|
|
111
114
|
try {
|
|
112
|
-
const
|
|
113
|
-
log_level:
|
|
114
|
-
ttl:
|
|
115
|
-
targets: { node_ids:
|
|
116
|
-
}, { data:
|
|
117
|
-
|
|
118
|
-
} catch (
|
|
119
|
-
|
|
115
|
+
const a = O(q.logLevel[s.config.app].update), l = {
|
|
116
|
+
log_level: k.value,
|
|
117
|
+
ttl: S.value,
|
|
118
|
+
targets: { node_ids: s.nodes.map((b) => b.id) }
|
|
119
|
+
}, { data: t } = await R.post(a, l);
|
|
120
|
+
V.value = t.id, I("success"), p.value = "status", ie();
|
|
121
|
+
} catch (a) {
|
|
122
|
+
E.value = J(a);
|
|
120
123
|
} finally {
|
|
121
|
-
|
|
124
|
+
y.value = !1;
|
|
122
125
|
}
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
|
|
126
|
+
}, de = () => {
|
|
127
|
+
p.value === "status" ? z() : re();
|
|
128
|
+
}, z = () => {
|
|
129
|
+
I("close");
|
|
130
|
+
}, ue = () => {
|
|
131
|
+
D(), p.value = "edit", k.value = $, h.value = X, f.value = Z, E.value = "", V.value = "", w.value = {}, A.clear();
|
|
129
132
|
};
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
const
|
|
134
|
-
return
|
|
135
|
-
"action-button-disabled":
|
|
136
|
-
"action-button-text":
|
|
137
|
-
"cancel-button-disabled":
|
|
138
|
-
"cancel-button-text": i(
|
|
133
|
+
return fe(L, (a) => {
|
|
134
|
+
a && ue();
|
|
135
|
+
}), be(D), (a, l) => {
|
|
136
|
+
const t = v("KAlert"), b = v("KSelect"), T = v("KExternalLink"), ce = v("KLabel"), pe = v("KInput"), ve = v("KBadge"), me = v("KTableView"), ge = v("KModal");
|
|
137
|
+
return _(), U(ge, {
|
|
138
|
+
"action-button-disabled": p.value === "edit" && (y.value || !M.value || s.nodes.length === 0),
|
|
139
|
+
"action-button-text": le.value,
|
|
140
|
+
"cancel-button-disabled": y.value,
|
|
141
|
+
"cancel-button-text": i(e).t("modal.cancel"),
|
|
139
142
|
"data-testid": "change-log-level-modal",
|
|
140
|
-
"hide-cancel-button":
|
|
141
|
-
"hide-close-icon":
|
|
143
|
+
"hide-cancel-button": p.value === "status",
|
|
144
|
+
"hide-close-icon": y.value,
|
|
142
145
|
"max-width": "640px",
|
|
143
|
-
title:
|
|
144
|
-
visible:
|
|
145
|
-
onCancel:
|
|
146
|
-
onProceed:
|
|
146
|
+
title: ae.value,
|
|
147
|
+
visible: L.value,
|
|
148
|
+
onCancel: z,
|
|
149
|
+
onProceed: de
|
|
147
150
|
}, {
|
|
148
|
-
default:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
default: m(() => [
|
|
152
|
+
p.value === "edit" ? (_(), P("div", $e, [
|
|
153
|
+
g("p", Oe, u(i(e).t("modal.description")), 1),
|
|
154
|
+
c(t, {
|
|
152
155
|
appearance: "warning",
|
|
153
156
|
"data-testid": "log-level-warning",
|
|
154
|
-
message: i(
|
|
157
|
+
message: i(e).t("modal.warning"),
|
|
155
158
|
"show-icon": ""
|
|
156
159
|
}, null, 8, ["message"]),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
160
|
+
g("div", Fe, [
|
|
161
|
+
c(b, {
|
|
162
|
+
modelValue: k.value,
|
|
163
|
+
"onUpdate:modelValue": l[0] || (l[0] = (n) => k.value = n),
|
|
164
|
+
"data-testid": "log-level-select",
|
|
165
|
+
items: ee.value,
|
|
166
|
+
"kpop-attributes": { "data-testid": "log-level-select-popover" },
|
|
167
|
+
label: i(e).t("modal.log_level_label")
|
|
168
|
+
}, null, 8, ["modelValue", "items", "label"]),
|
|
169
|
+
g("p", ze, [
|
|
170
|
+
x(u(i(e).t("modal.log_level_help")) + " ", 1),
|
|
171
|
+
c(T, {
|
|
172
|
+
"data-testid": "log-level-learn-more",
|
|
173
|
+
"hide-icon": "",
|
|
174
|
+
href: Ze
|
|
175
|
+
}, {
|
|
176
|
+
default: m(() => [
|
|
177
|
+
x(u(i(e).t("modal.learn_more")), 1)
|
|
178
|
+
]),
|
|
179
|
+
_: 1
|
|
180
|
+
})
|
|
181
|
+
])
|
|
182
|
+
]),
|
|
183
|
+
g("div", Ge, [
|
|
184
|
+
c(ce, {
|
|
185
|
+
class: "expiration-label",
|
|
186
|
+
info: i(e).t("modal.expiration.tooltip"),
|
|
187
|
+
"tooltip-attributes": { maxWidth: "340px" }
|
|
188
|
+
}, {
|
|
189
|
+
default: m(() => [
|
|
190
|
+
x(u(i(e).t("modal.expiration.label")), 1)
|
|
191
|
+
]),
|
|
192
|
+
_: 1
|
|
193
|
+
}, 8, ["info"]),
|
|
194
|
+
g("div", We, [
|
|
195
|
+
c(pe, {
|
|
196
|
+
modelValue: h.value,
|
|
197
|
+
"onUpdate:modelValue": l[1] || (l[1] = (n) => h.value = n),
|
|
198
|
+
modelModifiers: { number: !0 },
|
|
199
|
+
class: "expiration-value",
|
|
200
|
+
"data-testid": "expiration-input",
|
|
201
|
+
error: !M.value,
|
|
202
|
+
max: f.value === "mins" ? 60 : 3600,
|
|
203
|
+
min: "1",
|
|
204
|
+
type: "number"
|
|
205
|
+
}, null, 8, ["modelValue", "error", "max"]),
|
|
206
|
+
c(b, {
|
|
207
|
+
modelValue: f.value,
|
|
208
|
+
"onUpdate:modelValue": l[2] || (l[2] = (n) => f.value = n),
|
|
209
|
+
"data-testid": "expiration-unit-select",
|
|
210
|
+
items: te.value,
|
|
211
|
+
"kpop-attributes": { "data-testid": "expiration-unit-select-popover" },
|
|
212
|
+
width: "140"
|
|
213
|
+
}, null, 8, ["modelValue", "items"])
|
|
214
|
+
]),
|
|
215
|
+
g("p", {
|
|
216
|
+
class: xe(["field-help", { "field-help-error": !M.value }])
|
|
217
|
+
}, u(oe.value), 3)
|
|
218
|
+
]),
|
|
219
|
+
E.value ? (_(), U(t, {
|
|
182
220
|
key: 0,
|
|
183
221
|
appearance: "danger",
|
|
184
222
|
"data-testid": "log-level-error",
|
|
185
|
-
message:
|
|
186
|
-
}, null, 8, ["message"])) :
|
|
187
|
-
])) : (
|
|
188
|
-
|
|
223
|
+
message: E.value
|
|
224
|
+
}, null, 8, ["message"])) : Ie("", !0)
|
|
225
|
+
])) : (_(), P("div", He, [
|
|
226
|
+
c(me, {
|
|
189
227
|
class: "change-log-level-status-table",
|
|
190
|
-
data:
|
|
228
|
+
data: se.value,
|
|
191
229
|
"data-testid": "log-level-status-table",
|
|
192
|
-
headers:
|
|
230
|
+
headers: ne.value,
|
|
193
231
|
"hide-pagination": "",
|
|
194
232
|
"row-key": "id"
|
|
195
233
|
}, {
|
|
196
|
-
host:
|
|
197
|
-
|
|
234
|
+
host: m(({ row: n }) => [
|
|
235
|
+
o.getNodeDetailRoute ? (_(), U(T, {
|
|
198
236
|
key: 0,
|
|
199
237
|
"hide-icon": "",
|
|
200
|
-
href:
|
|
238
|
+
href: o.getNodeDetailRoute(n.id)
|
|
201
239
|
}, {
|
|
202
|
-
default:
|
|
203
|
-
|
|
240
|
+
default: m(() => [
|
|
241
|
+
x(u(n.hostname), 1)
|
|
204
242
|
]),
|
|
205
243
|
_: 2
|
|
206
|
-
}, 1032, ["href"])) : (
|
|
207
|
-
|
|
244
|
+
}, 1032, ["href"])) : (_(), P(Ee, { key: 1 }, [
|
|
245
|
+
x(u(n.hostname), 1)
|
|
208
246
|
], 64))
|
|
209
247
|
]),
|
|
210
|
-
status:
|
|
211
|
-
|
|
212
|
-
appearance:
|
|
213
|
-
"data-testid": `log-level-status-${
|
|
248
|
+
status: m(({ row: n }) => [
|
|
249
|
+
c(ve, {
|
|
250
|
+
appearance: Q[n.status],
|
|
251
|
+
"data-testid": `log-level-status-${n.status}`
|
|
214
252
|
}, {
|
|
215
|
-
icon:
|
|
216
|
-
(
|
|
253
|
+
icon: m(() => [
|
|
254
|
+
(_(), U(ye(Y[n.status])))
|
|
217
255
|
]),
|
|
218
|
-
default:
|
|
219
|
-
|
|
256
|
+
default: m(() => [
|
|
257
|
+
x(" " + u(i(e).t(`operation_status.${n.status}`)), 1)
|
|
220
258
|
]),
|
|
221
259
|
_: 2
|
|
222
260
|
}, 1032, ["appearance", "data-testid"])
|
|
223
261
|
]),
|
|
224
262
|
_: 1
|
|
225
263
|
}, 8, ["data", "headers"]),
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
size: `var(--kui-icon-size-40, ${i(
|
|
264
|
+
g("p", qe, [
|
|
265
|
+
c(i(B), {
|
|
266
|
+
size: `var(--kui-icon-size-40, ${i(Ke)})`
|
|
229
267
|
}, null, 8, ["size"]),
|
|
230
|
-
|
|
268
|
+
g("span", null, u(i(e).t("modal.status_note")), 1)
|
|
231
269
|
])
|
|
232
270
|
]))
|
|
233
271
|
]),
|
|
@@ -235,15 +273,15 @@ const Ve = [
|
|
|
235
273
|
}, 8, ["action-button-disabled", "action-button-text", "cancel-button-disabled", "cancel-button-text", "hide-cancel-button", "hide-close-icon", "title", "visible"]);
|
|
236
274
|
};
|
|
237
275
|
}
|
|
238
|
-
}),
|
|
239
|
-
const
|
|
240
|
-
for (const [
|
|
241
|
-
|
|
242
|
-
return
|
|
243
|
-
},
|
|
276
|
+
}), Je = (o, N) => {
|
|
277
|
+
const s = o.__vccOpts || o;
|
|
278
|
+
for (const [I, L] of N)
|
|
279
|
+
s[I] = L;
|
|
280
|
+
return s;
|
|
281
|
+
}, ot = /* @__PURE__ */ Je(je, [["__scopeId", "data-v-4fa1aea2"]]);
|
|
244
282
|
export {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
283
|
+
ot as ChangeLogLevelModal,
|
|
284
|
+
Re as LOG_LEVELS,
|
|
285
|
+
j as LogLevel,
|
|
286
|
+
Be as composables
|
|
249
287
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong-ui-public/entities-shared"),require("@kong/icons"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/entities-shared","@kong/icons","@kong-ui-public/i18n"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["kong-ui-public-entities-data-plane-nodes"]={},i.Vue,i["kong-ui-public-entities-shared"],i.KongIcons,i["kong-ui-public-i18n"]))})(this,(function(i,e,T,c,S){"use strict";const z="20px",G={modal:{title:"Change log level temporarily",description:"Choose how much information Kong Gateway writes to its logs. Changes automatically revert when the TTL expires.",log_level_label:"Log level",log_level_help:"Selecting a log level captures logs at the selected level and all lower-severity levels.",learn_more:"Learn more",expiration:{label:"Expiration",tooltip:"The duration before the log level automatically reverts to its default value.",help:{seconds:"Enter a value between 1 second and 3600 seconds.",mins:"Enter a value between 1 minute and 60 minutes."},unit:{seconds:"secs",mins:"mins"}},warning:"Higher log levels can significantly increase log volume and disk usage. Use them only while troubleshooting.",save:"Save",cancel:"Cancel",done:"Done",status_title:"Change log level status",node_host:"Node host",status:"Status",status_note:"Updates typically reach all data plane nodes in about 5 seconds. Keep this modal open to monitor progress while the update is in progress."},log_level:{debug:"Debug",info:"Info",notice:"Notice",warn:"Warn",error:"Error",crit:"Critical"},operation_status:{in_progress:"In progress",applied:"Applied",reverted:"Reverted",superseded:"Superseded",failed:"Failed",unsupported:"Unsupported"}};function W(){const n=S.createI18n("en-us",G);return{i18n:n,i18nT:S.i18nTComponent(n)}}const B={useI18n:W},U="/v2/control-planes/{controlPlaneId}",D="/debug/cluster",K={logLevel:{konnect:{update:`${U}/nodes/log-level-operations`,results:`${U}/nodes/log-level-operations/{operationId}/results`},kongManager:{update:`${D}/data-planes/log-level-operations`,results:`${D}/data-planes/log-level-operations/{operationId}/results?size=1000`}}};var y=(n=>(n.Debug="debug",n.Info="info",n.Notice="notice",n.Warn="warn",n.Error="error",n.Critical="crit",n))(y||{});const A=["debug","info","notice","warn","error","crit"],H={key:0,class:"change-log-level-modal-content"},j={class:"description"},X={class:"log-level-field"},Z={class:"field-help"},J={class:"expiration-field"},Q={class:"expiration-inputs"},Y={key:1,class:"change-log-level-status"},ee={class:"status-note"},M=10,P="mins",te=2e3,oe="https://developer.konghq.com/gateway/logs/",ne=((n,I)=>{const r=n.__vccOpts||n;for(const[g,b]of I)r[g]=b;return r})(e.defineComponent({name:"ChangeLogLevelModal",__name:"ChangeLogLevelModal",props:e.mergeModels({config:{},nodes:{},getNodeDetailRoute:{type:Function}},{visible:{type:Boolean},visibleModifiers:{}}),emits:e.mergeModels(["success","close","node-error"],["update:visible"]),setup(n,{emit:I}){const r=n,g=I,b=e.useModel(n,"visible"),{i18n:t}=B.useI18n(),{axiosInstance:O}=T.useAxios(r.config.axiosRequestConfig),{getMessageFromError:ae}=T.useErrors(),$=y.Notice,le={in_progress:"info",applied:"success",reverted:"neutral",superseded:"neutral",failed:"danger",unsupported:"warning"},se={in_progress:c.ProgressIcon,applied:c.CheckCircleIcon,reverted:c.InfoIcon,superseded:c.InfoIcon,failed:c.DangerCircleIcon,unsupported:c.WarningIcon},d=e.ref("edit"),x=e.ref($),p=e.ref(M),u=e.ref(P),f=e.ref(!1),_=e.ref(""),V=e.ref(""),v=e.ref({}),h=e.ref(null),C=e.ref(!1),N=new Set,ie=e.computed(()=>A.map(a=>({label:t.t(`log_level.${a}`),value:a}))),re=e.computed(()=>[{label:t.t("modal.expiration.unit.mins"),value:"mins"},{label:t.t("modal.expiration.unit.seconds"),value:"seconds"}]),E=e.computed(()=>u.value==="mins"?p.value*60:p.value),de=e.computed(()=>t.t(`modal.expiration.help.${u.value}`)),L=e.computed(()=>Number.isInteger(p.value)&&E.value>=1&&E.value<=3600),ce=e.computed(()=>d.value==="status"?t.t("modal.status_title"):t.t("modal.title")),pe=e.computed(()=>d.value==="status"?t.t("modal.done"):t.t("modal.save")),ue=e.computed(()=>[{key:"host",label:t.t("modal.node_host")},{key:"status",label:t.t("modal.status")}]),me=e.computed(()=>r.nodes.map(a=>({id:a.id,hostname:a.hostname,status:v.value[a.id]??"in_progress"}))),R=(a,l)=>{let o=`${r.config.apiBaseUrl}${a}`;return r.config.app==="konnect"&&(o=o.replace(/{controlPlaneId}/gi,r.config.controlPlaneId)),o.replace(/{operationId}/gi,l??"")},w=()=>{C.value=!1,h.value&&(clearTimeout(h.value),h.value=null)},F=async()=>{try{const a=R(K.logLevel[r.config.app].results,V.value),{data:l}=await O.get(a);for(const o of l.data)if(v.value[o.node_id]=o.status,(o.status==="failed"||o.status==="unsupported")&&!N.has(o.node_id)){N.add(o.node_id);const m=r.nodes.find(k=>k.id===o.node_id)?.hostname??"";g("node-error",{id:o.node_id,hostname:m,status:o.status})}if(l.data.length>0&&l.data.every(o=>o.status!=="in_progress")){w();return}}catch{}C.value&&(h.value=setTimeout(()=>{h.value=null,F()},te))},ge=()=>{v.value={},C.value=!0,F()},fe=async()=>{_.value="",f.value=!0;try{const a=R(K.logLevel[r.config.app].update),l={log_level:x.value,ttl:E.value,targets:{node_ids:r.nodes.map(m=>m.id)}},{data:o}=await O.post(a,l);V.value=o.id,g("success"),d.value="status",ge()}catch(a){_.value=ae(a)}finally{f.value=!1}},_e=()=>{d.value==="status"?q():fe()},q=()=>{g("close")},he=()=>{w(),d.value="edit",x.value=$,p.value=M,u.value=P,_.value="",V.value="",v.value={},N.clear()};return e.watch(b,a=>{a&&he()}),e.onBeforeUnmount(w),(a,l)=>{const o=e.resolveComponent("KAlert"),m=e.resolveComponent("KSelect"),k=e.resolveComponent("KExternalLink"),be=e.resolveComponent("KLabel"),xe=e.resolveComponent("KInput"),ve=e.resolveComponent("KBadge"),ke=e.resolveComponent("KTableView"),ye=e.resolveComponent("KModal");return e.openBlock(),e.createBlock(ye,{"action-button-disabled":d.value==="edit"&&(f.value||!L.value||r.nodes.length===0),"action-button-text":pe.value,"cancel-button-disabled":f.value,"cancel-button-text":e.unref(t).t("modal.cancel"),"data-testid":"change-log-level-modal","hide-cancel-button":d.value==="status","hide-close-icon":f.value,"max-width":"640px",title:ce.value,visible:b.value,onCancel:q,onProceed:_e},{default:e.withCtx(()=>[d.value==="edit"?(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("p",j,e.toDisplayString(e.unref(t).t("modal.description")),1),e.createVNode(o,{appearance:"warning","data-testid":"log-level-warning",message:e.unref(t).t("modal.warning"),"show-icon":""},null,8,["message"]),e.createElementVNode("div",X,[e.createVNode(m,{modelValue:x.value,"onUpdate:modelValue":l[0]||(l[0]=s=>x.value=s),"data-testid":"log-level-select",items:ie.value,"kpop-attributes":{"data-testid":"log-level-select-popover"},label:e.unref(t).t("modal.log_level_label")},null,8,["modelValue","items","label"]),e.createElementVNode("p",Z,[e.createTextVNode(e.toDisplayString(e.unref(t).t("modal.log_level_help"))+" ",1),e.createVNode(k,{"data-testid":"log-level-learn-more","hide-icon":"",href:oe},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t).t("modal.learn_more")),1)]),_:1})])]),e.createElementVNode("div",J,[e.createVNode(be,{class:"expiration-label",info:e.unref(t).t("modal.expiration.tooltip"),"tooltip-attributes":{maxWidth:"340px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(t).t("modal.expiration.label")),1)]),_:1},8,["info"]),e.createElementVNode("div",Q,[e.createVNode(xe,{modelValue:p.value,"onUpdate:modelValue":l[1]||(l[1]=s=>p.value=s),modelModifiers:{number:!0},class:"expiration-value","data-testid":"expiration-input",error:!L.value,max:u.value==="mins"?60:3600,min:"1",type:"number"},null,8,["modelValue","error","max"]),e.createVNode(m,{modelValue:u.value,"onUpdate:modelValue":l[2]||(l[2]=s=>u.value=s),"data-testid":"expiration-unit-select",items:re.value,"kpop-attributes":{"data-testid":"expiration-unit-select-popover"},width:"140"},null,8,["modelValue","items"])]),e.createElementVNode("p",{class:e.normalizeClass(["field-help",{"field-help-error":!L.value}])},e.toDisplayString(de.value),3)]),_.value?(e.openBlock(),e.createBlock(o,{key:0,appearance:"danger","data-testid":"log-level-error",message:_.value},null,8,["message"])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(ke,{class:"change-log-level-status-table",data:me.value,"data-testid":"log-level-status-table",headers:ue.value,"hide-pagination":"","row-key":"id"},{host:e.withCtx(({row:s})=>[n.getNodeDetailRoute?(e.openBlock(),e.createBlock(k,{key:0,"hide-icon":"",href:n.getNodeDetailRoute(s.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.hostname),1)]),_:2},1032,["href"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(s.hostname),1)],64))]),status:e.withCtx(({row:s})=>[e.createVNode(ve,{appearance:le[s.status],"data-testid":`log-level-status-${s.status}`},{icon:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(se[s.status])))]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(t).t(`operation_status.${s.status}`)),1)]),_:2},1032,["appearance","data-testid"])]),_:1},8,["data","headers"]),e.createElementVNode("p",ee,[e.createVNode(e.unref(c.InfoIcon),{size:`var(--kui-icon-size-40, ${e.unref(z)})`},null,8,["size"]),e.createElementVNode("span",null,e.toDisplayString(e.unref(t).t("modal.status_note")),1)])]))]),_:1},8,["action-button-disabled","action-button-text","cancel-button-disabled","cancel-button-text","hide-cancel-button","hide-close-icon","title","visible"])}}}),[["__scopeId","data-v-4fa1aea2"]]);i.ChangeLogLevelModal=ne,i.LOG_LEVELS=A,i.LogLevel=y,i.composables=B,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.change-log-level-modal-content[data-v-
|
|
1
|
+
.change-log-level-modal-content[data-v-4fa1aea2]{display:flex;flex-direction:column;gap:20px;gap:var(--kui-space-70, 20px)}.change-log-level-modal-content .description[data-v-4fa1aea2]{color:#3a3f51;color:var(--kui-color-text-neutral-stronger, #3a3f51);margin:0}.change-log-level-modal-content .field-help[data-v-4fa1aea2]{color:#6c7489;color:var(--kui-color-text-neutral, #6c7489);font-size:12px;font-size:var(--kui-font-size-20, 12px);line-height:16px;line-height:var(--kui-line-height-20, 16px);margin:8px 0 0!important;margin:var(--kui-space-40, 8px) 0 0!important}.change-log-level-modal-content .field-help.field-help-error[data-v-4fa1aea2]{color:#d60027;color:var(--kui-color-text-danger, #d60027)}.change-log-level-modal-content .expiration-label[data-v-4fa1aea2]{display:flex}.change-log-level-modal-content .expiration-inputs[data-v-4fa1aea2]{align-items:flex-start;display:inline-flex;gap:8px;gap:var(--kui-space-40, 8px)}.change-log-level-modal-content .expiration-inputs .expiration-value[data-v-4fa1aea2]{width:140px}.change-log-level-status .change-log-level-status-table[data-v-4fa1aea2]{background-color:#0000;background-color:var(--kui-color-background-transparent, rgba(0, 0, 0, 0));border-bottom:1px solid #e0e4ea;border-bottom:var(--kui-border-width-10, 1px) solid var(--kui-color-border, #e0e4ea)}.change-log-level-status .status-note[data-v-4fa1aea2]{color:#3a3f51;color:var(--kui-color-text-neutral-stronger, #3a3f51);display:flex;font-size:14px;font-size:var(--kui-font-size-30, 14px);gap:8px;gap:var(--kui-space-40, 8px);margin:16px 0 0!important;margin:var(--kui-space-60, 16px) 0 0!important}.change-log-level-status .status-note[data-v-4fa1aea2] svg{flex-shrink:0;margin-top:2px;margin-top:var(--kui-space-10, 2px)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeLogLevelModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ChangeLogLevelModal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChangeLogLevelModal.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ChangeLogLevelModal.vue"],"names":[],"mappings":"AAmbA,OAAO,KAAK,EACV,oBAAoB,EAKrB,MAAM,UAAU,CAAA;AAQjB,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,oBAAoB,CAAA;IAC5B,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAA;CAChD,CAAC;AA+MF,KAAK,gBAAgB,GAAG;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AA2XxD,QAAA,MAAM,YAAY;;;;YA3kBc,MAAM;kBAAY,MAAM;gBAAU,QAAQ,GAAG,aAAa;;;;;;;YAA1D,MAAM;kBAAY,MAAM;gBAAU,QAAQ,GAAG,aAAa;;;kFA8kBxF,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/entities-data-plane-nodes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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.16.1",
|
|
27
27
|
"vue": ">= 3.3.13 < 4",
|
|
28
28
|
"vue-router": "^4.6.4 || ^5.0.6",
|
|
29
|
-
"@kong-ui-public/
|
|
30
|
-
"@kong-ui-public/
|
|
29
|
+
"@kong-ui-public/entities-shared": "^3.59.1",
|
|
30
|
+
"@kong-ui-public/i18n": "^2.5.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@kong/design-tokens": "3.1.5",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"axios": "^1.17.0",
|
|
37
37
|
"vue": "^3.5.35",
|
|
38
38
|
"vue-router": "^5.1.0",
|
|
39
|
-
"@kong-ui-public/
|
|
40
|
-
"@kong-ui-public/
|
|
39
|
+
"@kong-ui-public/i18n": "^2.5.0",
|
|
40
|
+
"@kong-ui-public/entities-shared": "^3.59.1"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|