@kong-ui-public/entities-keys 3.9.8 → 3.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/entities-keys.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { BookIcon as
|
|
4
|
-
import { createI18n as
|
|
5
|
-
import { useAxios as
|
|
1
|
+
import { defineComponent as ve, ref as w, computed as h, watch as le, onBeforeMount as je, resolveComponent as F, createElementBlock as W, openBlock as b, createVNode as f, unref as l, createSlots as ge, withCtx as u, createTextVNode as O, toDisplayString as C, createElementVNode as D, createBlock as V, Teleport as De, createCommentVNode as J, reactive as Se, Fragment as we, renderList as Ie } from "vue";
|
|
2
|
+
import { useRouter as Ee } from "vue-router";
|
|
3
|
+
import { BookIcon as Ce, AddIcon as Ke, KeyIcon as Fe } from "@kong/icons";
|
|
4
|
+
import { createI18n as Te, i18nTComponent as Be } from "@kong-ui-public/i18n";
|
|
5
|
+
import { useAxios as he, useTableState as Ae, useFetcher as Ue, useDeleteUrlBuilder as Pe, FetcherStatus as qe, EntityBaseTable as Ne, PermissionsWrapper as ne, TableTags as Oe, EntityFilter as Je, EntityDeleteModal as We, EntityTypes as Le, useErrors as He, EntityBaseFormType as re, useDebouncedFilter as Qe, EntityBaseForm as Ge, SupportedEntityType as Ve, EntityFormSection as xe, useStringHelpers as ze, ConfigurationSchemaType as pe, ConfigurationSchemaSection as me, EntityBaseConfigCard as Xe, InternalLinkItem as Ye, ConfigCardItem as $e } from "@kong-ui-public/entities-shared";
|
|
6
6
|
const Ze = {
|
|
7
7
|
title: "Keys",
|
|
8
8
|
list: {
|
|
@@ -23,7 +23,8 @@ const Ze = {
|
|
|
23
23
|
title: "Configure your first key",
|
|
24
24
|
group: "Keys created in gateways within this group will automatically appear here.",
|
|
25
25
|
description: "Keys hold a representation of asymmetric keys that gateways and plugins can use for secure operations.",
|
|
26
|
-
create_cta: "New key"
|
|
26
|
+
create_cta: "New key",
|
|
27
|
+
learn_more: "Learn more"
|
|
27
28
|
}
|
|
28
29
|
},
|
|
29
30
|
actions: {
|
|
@@ -127,20 +128,20 @@ const Ze = {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
|
-
},
|
|
131
|
+
}, et = {
|
|
131
132
|
keys: Ze
|
|
132
133
|
};
|
|
133
|
-
function
|
|
134
|
-
const
|
|
134
|
+
function tt() {
|
|
135
|
+
const a = Te("en-us", et);
|
|
135
136
|
return {
|
|
136
|
-
i18n:
|
|
137
|
-
i18nT:
|
|
137
|
+
i18n: a,
|
|
138
|
+
i18nT: Be(a)
|
|
138
139
|
// Translation component <i18n-t>
|
|
139
140
|
};
|
|
140
141
|
}
|
|
141
|
-
const
|
|
142
|
-
useI18n:
|
|
143
|
-
}, A = "/v2/control-planes/{controlPlaneId}/core-entities", U = "/{workspace}",
|
|
142
|
+
const be = {
|
|
143
|
+
useI18n: tt
|
|
144
|
+
}, A = "/v2/control-planes/{controlPlaneId}/core-entities", U = "/{workspace}", P = {
|
|
144
145
|
list: {
|
|
145
146
|
konnect: {
|
|
146
147
|
all: `${A}/keys`,
|
|
@@ -177,14 +178,14 @@ const ve = {
|
|
|
177
178
|
getKeySet: `${U}/key-sets/{keySetId}`
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
|
-
},
|
|
181
|
+
}, lt = { class: "kong-ui-entities-keys-list" }, it = { class: "button-row" }, at = /* @__PURE__ */ ve({
|
|
181
182
|
__name: "KeyList",
|
|
182
183
|
props: {
|
|
183
184
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
184
185
|
config: {
|
|
185
186
|
type: Object,
|
|
186
187
|
required: !0,
|
|
187
|
-
validator: (
|
|
188
|
+
validator: (a) => !(!a || !["konnect", "kongManager"].includes(a == null ? void 0 : a.app) || !a.createRoute || !a.getViewRoute || !a.getEditRoute || a.app === "kongManager" && !a.isExactMatch && !a.filterSchema)
|
|
188
189
|
},
|
|
189
190
|
// used to override the default identifier for the cache entry
|
|
190
191
|
cacheIdentifier: {
|
|
@@ -222,176 +223,176 @@ const ve = {
|
|
|
222
223
|
}
|
|
223
224
|
},
|
|
224
225
|
emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success"],
|
|
225
|
-
setup(
|
|
226
|
-
var
|
|
227
|
-
const _ =
|
|
226
|
+
setup(a, { emit: q }) {
|
|
227
|
+
var I;
|
|
228
|
+
const _ = q, t = a, { i18n: { t: c } } = be.useI18n(), d = Ee(), { axiosInstance: x } = he((I = t.config) == null ? void 0 : I.axiosRequestConfig), { hasRecords: N, handleStateChange: z } = Ae(() => M.value), $ = h(() => N.value && t.config.app === "konnect"), e = h(() => !!t.config.keySetId), K = h(() => t.config.app !== "kongManager" || !!t.config.disableSorting), T = {
|
|
228
229
|
// the Name column is non-hidable
|
|
229
|
-
name: { label:
|
|
230
|
-
kid: { label:
|
|
231
|
-
tags: { label:
|
|
232
|
-
id: { label:
|
|
233
|
-
},
|
|
234
|
-
var
|
|
235
|
-
let
|
|
236
|
-
return t.config.app === "konnect" ?
|
|
237
|
-
}),
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
230
|
+
name: { label: c("keys.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
|
|
231
|
+
kid: { label: c("keys.list.table_headers.key_id"), sortable: !0 },
|
|
232
|
+
tags: { label: c("keys.list.table_headers.tags") },
|
|
233
|
+
id: { label: c("keys.list.table_headers.id"), sortable: !0 }
|
|
234
|
+
}, B = T, L = h(() => {
|
|
235
|
+
var i, n, E, Z;
|
|
236
|
+
let s = `${t.config.apiBaseUrl}${P.list[t.config.app][t.config.keySetId ? "forKeySet" : "all"]}`;
|
|
237
|
+
return t.config.app === "konnect" ? s = s.replace(/{controlPlaneId}/gi, ((i = t.config) == null ? void 0 : i.controlPlaneId) || "").replace(/{keySetId}/gi, ((n = t.config) == null ? void 0 : n.keySetId) || "") : t.config.app === "kongManager" && (s = s.replace(/\/{workspace}/gi, (E = t.config) != null && E.workspace ? `/${t.config.workspace}` : "").replace(/{keySetId}/gi, ((Z = t.config) == null ? void 0 : Z.keySetId) || "")), s;
|
|
238
|
+
}), M = w(""), X = h(() => {
|
|
239
|
+
const s = t.config.app === "konnect" || t.config.isExactMatch;
|
|
240
|
+
if (s)
|
|
240
241
|
return {
|
|
241
|
-
isExactMatch:
|
|
242
|
-
placeholder:
|
|
242
|
+
isExactMatch: s,
|
|
243
|
+
placeholder: c("keys.search.placeholder")
|
|
243
244
|
};
|
|
244
|
-
const
|
|
245
|
+
const i = { name: T.name };
|
|
245
246
|
return {
|
|
246
|
-
isExactMatch:
|
|
247
|
-
fields:
|
|
247
|
+
isExactMatch: s,
|
|
248
|
+
fields: i,
|
|
248
249
|
schema: t.config.filterSchema
|
|
249
250
|
};
|
|
250
251
|
}), {
|
|
251
|
-
fetcher:
|
|
252
|
+
fetcher: H,
|
|
252
253
|
fetcherState: y,
|
|
253
|
-
fetcherCacheKey:
|
|
254
|
-
} =
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
},
|
|
259
|
-
const
|
|
260
|
-
if (!await
|
|
261
|
-
|
|
254
|
+
fetcherCacheKey: m
|
|
255
|
+
} = Ue(h(() => ({ ...t.config, cacheIdentifier: t.cacheIdentifier })), L), j = () => {
|
|
256
|
+
M.value = "";
|
|
257
|
+
}, g = () => {
|
|
258
|
+
m.value++;
|
|
259
|
+
}, S = w(null), k = async (s, i) => {
|
|
260
|
+
const n = s.id;
|
|
261
|
+
if (!await i(n)) {
|
|
262
|
+
ce(s, "id");
|
|
262
263
|
return;
|
|
263
264
|
}
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
const
|
|
267
|
-
if (!await
|
|
265
|
+
de(s, "id");
|
|
266
|
+
}, ie = async (s, i) => {
|
|
267
|
+
const n = JSON.stringify(s);
|
|
268
|
+
if (!await i(n)) {
|
|
268
269
|
_("copy:error", {
|
|
269
|
-
entity:
|
|
270
|
-
message:
|
|
270
|
+
entity: s,
|
|
271
|
+
message: c("keys.errors.copy")
|
|
271
272
|
});
|
|
272
273
|
return;
|
|
273
274
|
}
|
|
274
275
|
_("copy:success", {
|
|
275
|
-
entity:
|
|
276
|
-
message:
|
|
276
|
+
entity: s,
|
|
277
|
+
message: c("keys.copy.success_brief")
|
|
277
278
|
});
|
|
278
|
-
},
|
|
279
|
+
}, de = (s, i) => {
|
|
279
280
|
_("copy:success", {
|
|
280
|
-
entity:
|
|
281
|
-
field:
|
|
282
|
-
message:
|
|
281
|
+
entity: s,
|
|
282
|
+
field: i,
|
|
283
|
+
message: c("keys.copy.success", { val: s[i] })
|
|
283
284
|
});
|
|
284
|
-
},
|
|
285
|
+
}, ce = (s, i) => {
|
|
285
286
|
_("copy:error", {
|
|
286
|
-
entity:
|
|
287
|
-
field:
|
|
288
|
-
message:
|
|
287
|
+
entity: s,
|
|
288
|
+
field: i,
|
|
289
|
+
message: c("keys.errors.copy")
|
|
289
290
|
});
|
|
290
|
-
},
|
|
291
|
-
var
|
|
292
|
-
await ((
|
|
293
|
-
},
|
|
294
|
-
label:
|
|
295
|
-
to: t.config.getViewRoute(
|
|
296
|
-
}),
|
|
297
|
-
label:
|
|
298
|
-
to: t.config.getEditRoute(
|
|
299
|
-
}),
|
|
300
|
-
|
|
301
|
-
},
|
|
302
|
-
|
|
303
|
-
},
|
|
304
|
-
var
|
|
305
|
-
if ((
|
|
306
|
-
|
|
291
|
+
}, ye = async (s) => {
|
|
292
|
+
var n;
|
|
293
|
+
await ((n = t.canRetrieve) == null ? void 0 : n.call(t, s)) && d.push(t.config.getViewRoute(s.id));
|
|
294
|
+
}, fe = (s) => ({
|
|
295
|
+
label: c("keys.actions.view"),
|
|
296
|
+
to: t.config.getViewRoute(s)
|
|
297
|
+
}), ue = (s) => ({
|
|
298
|
+
label: c("keys.actions.edit"),
|
|
299
|
+
to: t.config.getEditRoute(s)
|
|
300
|
+
}), R = w(void 0), Q = w(!1), G = w(!1), ae = w(""), Y = Pe(t.config, L.value), oe = (s) => {
|
|
301
|
+
R.value = s, Q.value = !0;
|
|
302
|
+
}, ke = () => {
|
|
303
|
+
Q.value = !1;
|
|
304
|
+
}, se = async () => {
|
|
305
|
+
var s, i, n;
|
|
306
|
+
if ((s = R.value) != null && s.id) {
|
|
307
|
+
G.value = !0;
|
|
307
308
|
try {
|
|
308
|
-
await
|
|
309
|
-
} catch (
|
|
310
|
-
|
|
309
|
+
await x.delete(Y(R.value.id)), G.value = !1, Q.value = !1, m.value++, _("delete:success", R.value);
|
|
310
|
+
} catch (E) {
|
|
311
|
+
ae.value = ((n = (i = E.response) == null ? void 0 : i.data) == null ? void 0 : n.message) || E.message || c("keys.errors.delete"), _("error", E);
|
|
311
312
|
} finally {
|
|
312
|
-
|
|
313
|
+
G.value = !1;
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
316
|
}, o = () => {
|
|
316
|
-
|
|
317
|
+
d.push(t.config.createRoute);
|
|
317
318
|
};
|
|
318
|
-
|
|
319
|
-
var
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
title:
|
|
323
|
-
}, (
|
|
319
|
+
le(y, (s) => {
|
|
320
|
+
var i, n, E;
|
|
321
|
+
if (s.status === qe.Error) {
|
|
322
|
+
S.value = {
|
|
323
|
+
title: c("keys.errors.general")
|
|
324
|
+
}, (E = (n = (i = s.error) == null ? void 0 : i.response) == null ? void 0 : n.data) != null && E.message && (S.value.message = s.error.response.data.message), _("error", s.error);
|
|
324
325
|
return;
|
|
325
326
|
}
|
|
326
|
-
|
|
327
|
+
S.value = null;
|
|
327
328
|
});
|
|
328
|
-
const
|
|
329
|
+
const r = w({
|
|
329
330
|
ctaPath: t.config.createRoute,
|
|
330
331
|
ctaText: void 0,
|
|
331
|
-
message: `${
|
|
332
|
-
title:
|
|
333
|
-
});
|
|
334
|
-
return
|
|
335
|
-
await t.canCreate() && (
|
|
336
|
-
}), (
|
|
337
|
-
const
|
|
338
|
-
return
|
|
339
|
-
|
|
340
|
-
"cache-identifier":
|
|
341
|
-
"disable-sorting":
|
|
342
|
-
"empty-state-options":
|
|
332
|
+
message: `${c("keys.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
|
|
333
|
+
title: c("keys.title")
|
|
334
|
+
}), v = w(!1);
|
|
335
|
+
return je(async () => {
|
|
336
|
+
v.value = await t.canCreate(), v.value && (r.value.title = c("keys.list.empty_state.title"), r.value.ctaText = c("keys.actions.create"));
|
|
337
|
+
}), (s, i) => {
|
|
338
|
+
const n = F("KButton"), E = F("KEmptyState"), Z = F("KCopy"), ee = F("KDropdownItem"), _e = F("KClipboardProvider");
|
|
339
|
+
return b(), W("div", lt, [
|
|
340
|
+
f(l(Ne), {
|
|
341
|
+
"cache-identifier": a.cacheIdentifier,
|
|
342
|
+
"disable-sorting": K.value,
|
|
343
|
+
"empty-state-options": r.value,
|
|
343
344
|
"enable-entity-actions": "",
|
|
344
|
-
"error-message":
|
|
345
|
-
fetcher: l(
|
|
346
|
-
"fetcher-cache-key": l(
|
|
345
|
+
"error-message": S.value,
|
|
346
|
+
fetcher: l(H),
|
|
347
|
+
"fetcher-cache-key": l(m),
|
|
347
348
|
"pagination-type": "offset",
|
|
348
349
|
"preferences-storage-key": "kong-ui-entities-keys-list",
|
|
349
|
-
query:
|
|
350
|
-
"table-headers": l(
|
|
350
|
+
query: M.value,
|
|
351
|
+
"table-headers": l(B),
|
|
351
352
|
onClearSearchInput: j,
|
|
352
|
-
"onClick:row":
|
|
353
|
-
onSort:
|
|
353
|
+
"onClick:row": i[3] || (i[3] = (p) => ye(p)),
|
|
354
|
+
onSort: g,
|
|
354
355
|
onState: l(z)
|
|
355
|
-
},
|
|
356
|
-
"toolbar-filter":
|
|
357
|
-
|
|
358
|
-
modelValue:
|
|
359
|
-
"onUpdate:modelValue":
|
|
360
|
-
config:
|
|
356
|
+
}, ge({
|
|
357
|
+
"toolbar-filter": u(() => [
|
|
358
|
+
f(l(Je), {
|
|
359
|
+
modelValue: M.value,
|
|
360
|
+
"onUpdate:modelValue": i[0] || (i[0] = (p) => M.value = p),
|
|
361
|
+
config: X.value
|
|
361
362
|
}, null, 8, ["modelValue", "config"])
|
|
362
363
|
]),
|
|
363
|
-
"toolbar-button":
|
|
364
|
-
(
|
|
365
|
-
disabled: !
|
|
364
|
+
"toolbar-button": u(() => [
|
|
365
|
+
(b(), V(De, {
|
|
366
|
+
disabled: !a.useActionOutside,
|
|
366
367
|
to: "#kong-ui-app-page-header-action-button"
|
|
367
368
|
}, [
|
|
368
|
-
|
|
369
|
-
!e.value && $.value ? (
|
|
369
|
+
D("div", it, [
|
|
370
|
+
!e.value && $.value ? (b(), V(n, {
|
|
370
371
|
key: 0,
|
|
371
372
|
appearance: "secondary",
|
|
372
373
|
class: "open-learning-hub",
|
|
373
374
|
"data-testid": "keys-learn-more-button",
|
|
374
375
|
icon: "",
|
|
375
|
-
onClick:
|
|
376
|
+
onClick: i[1] || (i[1] = (p) => s.$emit("click:learn-more"))
|
|
376
377
|
}, {
|
|
377
|
-
default:
|
|
378
|
-
|
|
378
|
+
default: u(() => [
|
|
379
|
+
f(l(Ce), { decorative: "" })
|
|
379
380
|
]),
|
|
380
381
|
_: 1
|
|
381
|
-
})) :
|
|
382
|
-
|
|
383
|
-
"auth-function": () =>
|
|
382
|
+
})) : J("", !0),
|
|
383
|
+
f(l(ne), {
|
|
384
|
+
"auth-function": () => a.canCreate()
|
|
384
385
|
}, {
|
|
385
|
-
default:
|
|
386
|
-
|
|
386
|
+
default: u(() => [
|
|
387
|
+
f(n, {
|
|
387
388
|
appearance: "primary",
|
|
388
389
|
"data-testid": "toolbar-add-key",
|
|
389
|
-
size:
|
|
390
|
-
to:
|
|
390
|
+
size: a.useActionOutside ? "medium" : "large",
|
|
391
|
+
to: a.config.createRoute
|
|
391
392
|
}, {
|
|
392
|
-
default:
|
|
393
|
-
|
|
394
|
-
|
|
393
|
+
default: u(() => [
|
|
394
|
+
f(l(Ke)),
|
|
395
|
+
O(" " + C(l(c)("keys.list.toolbar_actions.new_key")), 1)
|
|
395
396
|
]),
|
|
396
397
|
_: 1
|
|
397
398
|
}, 8, ["size", "to"])
|
|
@@ -401,85 +402,85 @@ const ve = {
|
|
|
401
402
|
])
|
|
402
403
|
], 8, ["disabled"]))
|
|
403
404
|
]),
|
|
404
|
-
name:
|
|
405
|
-
|
|
405
|
+
name: u(({ rowValue: p }) => [
|
|
406
|
+
D("b", null, C(p ?? "-"), 1)
|
|
406
407
|
]),
|
|
407
|
-
kid:
|
|
408
|
-
|
|
408
|
+
kid: u(({ rowValue: p }) => [
|
|
409
|
+
f(Z, { text: p }, null, 8, ["text"])
|
|
409
410
|
]),
|
|
410
|
-
tags:
|
|
411
|
-
|
|
411
|
+
tags: u(({ rowValue: p }) => [
|
|
412
|
+
f(l(Oe), { tags: p }, null, 8, ["tags"])
|
|
412
413
|
]),
|
|
413
|
-
id:
|
|
414
|
-
|
|
415
|
-
text:
|
|
414
|
+
id: u(({ rowValue: p }) => [
|
|
415
|
+
f(Z, {
|
|
416
|
+
text: p,
|
|
416
417
|
truncate: ""
|
|
417
418
|
}, null, 8, ["text"])
|
|
418
419
|
]),
|
|
419
|
-
actions:
|
|
420
|
-
|
|
421
|
-
default:
|
|
422
|
-
|
|
420
|
+
actions: u(({ row: p }) => [
|
|
421
|
+
f(_e, null, {
|
|
422
|
+
default: u(({ copyToClipboard: te }) => [
|
|
423
|
+
f(ee, {
|
|
423
424
|
"data-testid": "action-entity-copy-id",
|
|
424
|
-
onClick: (
|
|
425
|
+
onClick: (Re) => k(p, te)
|
|
425
426
|
}, {
|
|
426
|
-
default:
|
|
427
|
-
|
|
427
|
+
default: u(() => [
|
|
428
|
+
O(C(l(c)("keys.actions.copy_id")), 1)
|
|
428
429
|
]),
|
|
429
430
|
_: 2
|
|
430
431
|
}, 1032, ["onClick"])
|
|
431
432
|
]),
|
|
432
433
|
_: 2
|
|
433
434
|
}, 1024),
|
|
434
|
-
|
|
435
|
-
default:
|
|
436
|
-
|
|
435
|
+
f(_e, null, {
|
|
436
|
+
default: u(({ copyToClipboard: te }) => [
|
|
437
|
+
f(ee, {
|
|
437
438
|
"data-testid": "action-entity-copy-json",
|
|
438
|
-
onClick: (
|
|
439
|
+
onClick: (Re) => ie(p, te)
|
|
439
440
|
}, {
|
|
440
|
-
default:
|
|
441
|
-
|
|
441
|
+
default: u(() => [
|
|
442
|
+
O(C(l(c)("keys.actions.copy_json")), 1)
|
|
442
443
|
]),
|
|
443
444
|
_: 2
|
|
444
445
|
}, 1032, ["onClick"])
|
|
445
446
|
]),
|
|
446
447
|
_: 2
|
|
447
448
|
}, 1024),
|
|
448
|
-
|
|
449
|
-
"auth-function": () =>
|
|
449
|
+
f(l(ne), {
|
|
450
|
+
"auth-function": () => a.canRetrieve(p)
|
|
450
451
|
}, {
|
|
451
|
-
default:
|
|
452
|
-
|
|
452
|
+
default: u(() => [
|
|
453
|
+
f(ee, {
|
|
453
454
|
"data-testid": "action-entity-view",
|
|
454
455
|
"has-divider": "",
|
|
455
|
-
item:
|
|
456
|
+
item: fe(p.id)
|
|
456
457
|
}, null, 8, ["item"])
|
|
457
458
|
]),
|
|
458
459
|
_: 2
|
|
459
460
|
}, 1032, ["auth-function"]),
|
|
460
|
-
|
|
461
|
-
"auth-function": () =>
|
|
461
|
+
f(l(ne), {
|
|
462
|
+
"auth-function": () => a.canEdit(p)
|
|
462
463
|
}, {
|
|
463
|
-
default:
|
|
464
|
-
|
|
464
|
+
default: u(() => [
|
|
465
|
+
f(ee, {
|
|
465
466
|
"data-testid": "action-entity-edit",
|
|
466
|
-
item:
|
|
467
|
+
item: ue(p.id)
|
|
467
468
|
}, null, 8, ["item"])
|
|
468
469
|
]),
|
|
469
470
|
_: 2
|
|
470
471
|
}, 1032, ["auth-function"]),
|
|
471
|
-
|
|
472
|
-
"auth-function": () =>
|
|
472
|
+
f(l(ne), {
|
|
473
|
+
"auth-function": () => a.canDelete(p)
|
|
473
474
|
}, {
|
|
474
|
-
default:
|
|
475
|
-
|
|
475
|
+
default: u(() => [
|
|
476
|
+
f(ee, {
|
|
476
477
|
danger: "",
|
|
477
478
|
"data-testid": "action-entity-delete",
|
|
478
479
|
"has-divider": "",
|
|
479
|
-
onClick: (
|
|
480
|
+
onClick: (te) => oe(p)
|
|
480
481
|
}, {
|
|
481
|
-
default:
|
|
482
|
-
|
|
482
|
+
default: u(() => [
|
|
483
|
+
O(C(l(c)("keys.actions.delete")), 1)
|
|
483
484
|
]),
|
|
484
485
|
_: 2
|
|
485
486
|
}, 1032, ["onClick"])
|
|
@@ -489,77 +490,91 @@ const ve = {
|
|
|
489
490
|
]),
|
|
490
491
|
_: 2
|
|
491
492
|
}, [
|
|
492
|
-
!
|
|
493
|
+
!M.value && a.config.app === "konnect" ? {
|
|
493
494
|
name: "empty-state",
|
|
494
|
-
fn:
|
|
495
|
-
var
|
|
495
|
+
fn: u(() => {
|
|
496
|
+
var p;
|
|
496
497
|
return [
|
|
497
|
-
|
|
498
|
-
"
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
498
|
+
f(E, {
|
|
499
|
+
"data-testid": a.config.keySetId ? "nested-keys-entity-empty-state" : "keys-entity-empty-state",
|
|
500
|
+
"icon-background": "",
|
|
501
|
+
message: l(c)("keys.list.empty_state_v2.description"),
|
|
502
|
+
title: l(c)("keys.list.empty_state_v2.title")
|
|
503
|
+
}, ge({
|
|
504
|
+
icon: u(() => [
|
|
505
|
+
f(l(Fe), { decorative: "" })
|
|
506
|
+
]),
|
|
507
|
+
action: u(() => [
|
|
508
|
+
v.value ? (b(), V(n, {
|
|
509
|
+
key: 0,
|
|
510
|
+
"data-testid": "entity-create-button",
|
|
511
|
+
onClick: o
|
|
512
|
+
}, {
|
|
513
|
+
default: u(() => [
|
|
514
|
+
f(l(Ke), { decorative: "" }),
|
|
515
|
+
O(" " + C(l(c)("keys.list.empty_state_v2.create_cta")), 1)
|
|
516
|
+
]),
|
|
517
|
+
_: 1
|
|
518
|
+
})) : J("", !0),
|
|
519
|
+
f(n, {
|
|
520
|
+
appearance: "secondary",
|
|
521
|
+
"data-testid": "entity-learn-more-button",
|
|
522
|
+
onClick: i[2] || (i[2] = (te) => s.$emit("click:learn-more"))
|
|
523
|
+
}, {
|
|
524
|
+
default: u(() => [
|
|
525
|
+
f(l(Ce), { decorative: "" }),
|
|
526
|
+
O(" " + C(l(c)("keys.list.empty_state_v2.learn_more")), 1)
|
|
527
|
+
]),
|
|
528
|
+
_: 1
|
|
529
|
+
})
|
|
515
530
|
]),
|
|
516
531
|
_: 2
|
|
517
532
|
}, [
|
|
518
|
-
(
|
|
519
|
-
name: "
|
|
520
|
-
fn:
|
|
521
|
-
|
|
533
|
+
(p = a.config) != null && p.isControlPlaneGroup ? {
|
|
534
|
+
name: "default",
|
|
535
|
+
fn: u(() => [
|
|
536
|
+
O(C(l(c)("keys.list.empty_state_v2.group")), 1)
|
|
522
537
|
]),
|
|
523
538
|
key: "0"
|
|
524
539
|
} : void 0
|
|
525
|
-
]), 1032, ["
|
|
540
|
+
]), 1032, ["data-testid", "message", "title"])
|
|
526
541
|
];
|
|
527
542
|
}),
|
|
528
543
|
key: "0"
|
|
529
544
|
} : void 0
|
|
530
545
|
]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers", "onState"]),
|
|
531
|
-
|
|
532
|
-
"action-pending":
|
|
533
|
-
description: l(
|
|
534
|
-
"entity-name":
|
|
535
|
-
"entity-type": l(
|
|
536
|
-
error:
|
|
546
|
+
f(l(We), {
|
|
547
|
+
"action-pending": G.value,
|
|
548
|
+
description: l(c)("keys.delete.description"),
|
|
549
|
+
"entity-name": R.value && (R.value.name || R.value.id),
|
|
550
|
+
"entity-type": l(Le).Key,
|
|
551
|
+
error: ae.value,
|
|
537
552
|
"need-confirm": !1,
|
|
538
|
-
title: l(
|
|
539
|
-
visible:
|
|
540
|
-
onCancel:
|
|
541
|
-
onProceed:
|
|
553
|
+
title: l(c)("keys.delete.title"),
|
|
554
|
+
visible: Q.value,
|
|
555
|
+
onCancel: ke,
|
|
556
|
+
onProceed: se
|
|
542
557
|
}, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
|
|
543
558
|
]);
|
|
544
559
|
};
|
|
545
560
|
}
|
|
546
|
-
}),
|
|
547
|
-
const _ =
|
|
548
|
-
for (const [t,
|
|
549
|
-
_[t] =
|
|
561
|
+
}), Me = (a, q) => {
|
|
562
|
+
const _ = a.__vccOpts || a;
|
|
563
|
+
for (const [t, c] of q)
|
|
564
|
+
_[t] = c;
|
|
550
565
|
return _;
|
|
551
|
-
},
|
|
566
|
+
}, bt = /* @__PURE__ */ Me(at, [["__scopeId", "data-v-be539385"]]), ot = { class: "kong-ui-entities-keys-form" }, st = { "data-testid": "no-search-results" }, nt = { class: "select-item-container" }, rt = { class: "select-item-label" }, dt = { class: "select-item-description" }, ct = {
|
|
552
567
|
key: 1,
|
|
553
568
|
class: "invalid-key-set-message",
|
|
554
569
|
"data-testid": "invalid-key-set-message"
|
|
555
|
-
},
|
|
570
|
+
}, yt = { "data-testid": "key-format-container" }, ft = /* @__PURE__ */ ve({
|
|
556
571
|
__name: "KeyForm",
|
|
557
572
|
props: {
|
|
558
573
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
559
574
|
config: {
|
|
560
575
|
type: Object,
|
|
561
576
|
required: !0,
|
|
562
|
-
validator: (
|
|
577
|
+
validator: (a) => !(!a || !["konnect", "kongManager"].includes(a == null ? void 0 : a.app) || a.app === "konnect" && !a.controlPlaneId || a.app === "kongManager" && typeof a.workspace != "string" || !a.cancelRoute)
|
|
563
578
|
},
|
|
564
579
|
/** If a valid Key ID is provided, it will put the form in Edit mode instead of Create */
|
|
565
580
|
keyId: {
|
|
@@ -587,9 +602,9 @@ const ve = {
|
|
|
587
602
|
}
|
|
588
603
|
},
|
|
589
604
|
emits: ["update", "error", "loading"],
|
|
590
|
-
setup(
|
|
591
|
-
var
|
|
592
|
-
const _ =
|
|
605
|
+
setup(a, { emit: q }) {
|
|
606
|
+
var se;
|
|
607
|
+
const _ = q, t = a, c = Ee(), { i18n: { t: d } } = be.useI18n(), { getMessageFromError: x } = He(), { axiosInstance: N } = he((se = t.config) == null ? void 0 : se.axiosRequestConfig), z = h(() => t.keySetId ? P.form[t.config.app].edit.forKeySet.replace(/{keySetId}/gi, t.keySetId) : P.form[t.config.app].edit.all), $ = h(() => t.keyId ? re.Edit : re.Create), e = Se({
|
|
593
608
|
fields: {
|
|
594
609
|
name: "",
|
|
595
610
|
tags: "",
|
|
@@ -603,7 +618,7 @@ const ve = {
|
|
|
603
618
|
},
|
|
604
619
|
isReadonly: !1,
|
|
605
620
|
errorMessage: ""
|
|
606
|
-
}),
|
|
621
|
+
}), K = Se({
|
|
607
622
|
name: "",
|
|
608
623
|
tags: "",
|
|
609
624
|
key_id: "",
|
|
@@ -612,271 +627,271 @@ const ve = {
|
|
|
612
627
|
jwk: "",
|
|
613
628
|
private_key: "",
|
|
614
629
|
public_key: ""
|
|
615
|
-
}),
|
|
630
|
+
}), T = [
|
|
616
631
|
{
|
|
617
|
-
label:
|
|
632
|
+
label: d("keys.form.fields.key_format.options.jwk"),
|
|
618
633
|
value: "jwk"
|
|
619
634
|
},
|
|
620
635
|
{
|
|
621
|
-
label:
|
|
636
|
+
label: d("keys.form.fields.key_format.options.pem"),
|
|
622
637
|
value: "pem"
|
|
623
638
|
}
|
|
624
|
-
],
|
|
625
|
-
|
|
626
|
-
$.value ===
|
|
639
|
+
], B = h(() => e.isReadonly || $.value === re.Create && !!t.fixedKeySetId), L = h(() => !B.value);
|
|
640
|
+
le(() => t.fixedKeySetId, (o) => {
|
|
641
|
+
$.value === re.Create && (e.fields.key_set = o);
|
|
627
642
|
}, { immediate: !0 });
|
|
628
|
-
const
|
|
629
|
-
var
|
|
630
|
-
e.fields.key_id = (o == null ? void 0 : o.kid) || "", e.fields.name = (o == null ? void 0 : o.name) || "", e.fields.tags = ((
|
|
631
|
-
},
|
|
632
|
-
|
|
643
|
+
const M = h(() => JSON.stringify(e.fields) !== JSON.stringify(K) && !!e.fields.key_id && !!e.fields.key_format && (e.fields.key_format === "jwk" && !!e.fields.jwk || e.fields.key_format === "pem" && !!e.fields.private_key && !!e.fields.public_key)), X = (o) => {
|
|
644
|
+
var r, v, I, s;
|
|
645
|
+
e.fields.key_id = (o == null ? void 0 : o.kid) || "", e.fields.name = (o == null ? void 0 : o.name) || "", e.fields.tags = ((r = o == null ? void 0 : o.tags) == null ? void 0 : r.join(", ")) || "", e.fields.key_set = ((v = o == null ? void 0 : o.set) == null ? void 0 : v.id) || "", e.fields.key_format = o != null && o.pem ? "pem" : "jwk", e.fields.jwk = (o == null ? void 0 : o.jwk) || "", e.fields.private_key = ((I = o == null ? void 0 : o.pem) == null ? void 0 : I.private_key) || "", e.fields.public_key = ((s = o == null ? void 0 : o.pem) == null ? void 0 : s.public_key) || "", t.showx5t && (e.fields.x5t = (o == null ? void 0 : o.x5t) || ""), Object.assign(K, e.fields);
|
|
646
|
+
}, H = () => {
|
|
647
|
+
c.push(t.config.cancelRoute);
|
|
633
648
|
}, y = h(() => {
|
|
634
|
-
var
|
|
635
|
-
let o = `${t.config.apiBaseUrl}${
|
|
636
|
-
return t.config.app === "konnect" ? o = o.replace(/{controlPlaneId}/gi, ((
|
|
637
|
-
}),
|
|
638
|
-
var o,
|
|
649
|
+
var r, v;
|
|
650
|
+
let o = `${t.config.apiBaseUrl}${P.form[t.config.app][$.value][t.keySetId ? "forKeySet" : "all"]}`;
|
|
651
|
+
return t.config.app === "konnect" ? o = o.replace(/{controlPlaneId}/gi, ((r = t.config) == null ? void 0 : r.controlPlaneId) || "") : t.config.app === "kongManager" && (o = o.replace(/\/{workspace}/gi, (v = t.config) != null && v.workspace ? `/${t.config.workspace}` : "")), o = o.replace(/{id}/gi, t.keyId).replace(/{keySetId}/gi, t.keySetId || ""), o;
|
|
652
|
+
}), m = h(() => {
|
|
653
|
+
var o, r, v;
|
|
639
654
|
return {
|
|
640
655
|
kid: e.fields.key_id,
|
|
641
656
|
...t.showx5t ? { x5t: e.fields.x5t || null } : {},
|
|
642
657
|
name: e.fields.name || null,
|
|
643
|
-
tags: ((
|
|
658
|
+
tags: ((v = (r = (o = e.fields.tags) == null ? void 0 : o.split(",")) == null ? void 0 : r.map((I) => String(I || "").trim())) == null ? void 0 : v.filter((I) => I !== "")) || [],
|
|
644
659
|
set: e.fields.key_set ? { id: e.fields.key_set } : null,
|
|
645
660
|
jwk: e.fields.key_format === "jwk" ? e.fields.jwk : null,
|
|
646
661
|
pem: e.fields.key_format === "pem" ? { private_key: e.fields.private_key, public_key: e.fields.public_key } : null
|
|
647
662
|
};
|
|
648
663
|
}), j = async () => {
|
|
649
|
-
var o,
|
|
664
|
+
var o, r, v, I, s;
|
|
650
665
|
try {
|
|
651
666
|
e.isReadonly = !0;
|
|
652
|
-
let
|
|
653
|
-
if ($.value === "create" ?
|
|
654
|
-
const { data:
|
|
655
|
-
e.fields.key_id = (
|
|
667
|
+
let i;
|
|
668
|
+
if ($.value === "create" ? i = await N.post(y.value, m.value) : $.value === "edit" && (i = ((o = t.config) == null ? void 0 : o.app) === "konnect" ? await N.put(y.value, m.value) : await N.patch(y.value, m.value)), i) {
|
|
669
|
+
const { data: n } = i;
|
|
670
|
+
e.fields.key_id = (n == null ? void 0 : n.kid) || "", e.fields.name = (n == null ? void 0 : n.name) || "", e.fields.tags = ((r = n == null ? void 0 : n.tags) == null ? void 0 : r.join(", ")) || "", e.fields.key_set = ((v = n == null ? void 0 : n.set) == null ? void 0 : v.id) || "", e.fields.key_format = n != null && n.pem ? "pem" : "jwk", e.fields.jwk = (n == null ? void 0 : n.jwk) || "", e.fields.private_key = ((I = n == null ? void 0 : n.pem) == null ? void 0 : I.private_key) || "", e.fields.public_key = ((s = n == null ? void 0 : n.pem) == null ? void 0 : s.public_key) || "", t.showx5t && (e.fields.x5t = (n == null ? void 0 : n.x5t) || ""), Object.assign(K, e.fields), _("update", i == null ? void 0 : i.data);
|
|
656
671
|
}
|
|
657
|
-
} catch (
|
|
658
|
-
e.errorMessage =
|
|
672
|
+
} catch (i) {
|
|
673
|
+
e.errorMessage = x(i), _("error", i);
|
|
659
674
|
} finally {
|
|
660
675
|
e.isReadonly = !1;
|
|
661
676
|
}
|
|
662
677
|
}, {
|
|
663
|
-
debouncedQueryChange:
|
|
664
|
-
loading:
|
|
665
|
-
allRecords:
|
|
666
|
-
error:
|
|
667
|
-
validationError:
|
|
668
|
-
loadItems:
|
|
669
|
-
results:
|
|
670
|
-
} =
|
|
678
|
+
debouncedQueryChange: g,
|
|
679
|
+
loading: S,
|
|
680
|
+
allRecords: k,
|
|
681
|
+
error: ie,
|
|
682
|
+
validationError: de,
|
|
683
|
+
loadItems: ce,
|
|
684
|
+
results: ye
|
|
685
|
+
} = Qe(t.config, P.form[t.config.app].keySets, void 0, {
|
|
671
686
|
fetchedItemsKey: "data",
|
|
672
687
|
searchKeys: ["id", "name"]
|
|
673
|
-
}),
|
|
674
|
-
(!o || o !== e.fields.key_set && o !==
|
|
675
|
-
},
|
|
676
|
-
if (
|
|
677
|
-
return t.config.app === "konnect" ?
|
|
678
|
-
}),
|
|
679
|
-
name:
|
|
688
|
+
}), fe = (o) => {
|
|
689
|
+
(!o || o !== e.fields.key_set && o !== K.key_set) && g(o);
|
|
690
|
+
}, ue = h(() => ie.value ? d("keys.errors.key_sets.fetch") : ""), R = h(() => de.value ? d("keys.errors.key_sets.invalid") : ""), Q = w(0), G = h(() => k.value === void 0), ae = h(() => {
|
|
691
|
+
if (G.value)
|
|
692
|
+
return t.config.app === "konnect" ? d("keys.form.fields.key_set.footer") : void 0;
|
|
693
|
+
}), Y = w(/* @__PURE__ */ new Set()), oe = h(() => Array.from(Y.value).map((r) => ({
|
|
694
|
+
name: r.name || "",
|
|
680
695
|
// can't use name for label or it tries to search => 404
|
|
681
696
|
label: "",
|
|
682
697
|
// leave it blank so no flicker when used with selected-item-template
|
|
683
|
-
value:
|
|
684
|
-
selected: e.fields.key_set ===
|
|
685
|
-
}))),
|
|
686
|
-
|
|
687
|
-
let
|
|
688
|
-
for (
|
|
689
|
-
|
|
698
|
+
value: r.id,
|
|
699
|
+
selected: e.fields.key_set === r.id
|
|
700
|
+
}))), ke = (o) => {
|
|
701
|
+
Y.value.clear();
|
|
702
|
+
let r;
|
|
703
|
+
for (r of o)
|
|
704
|
+
Y.value.add(r);
|
|
690
705
|
};
|
|
691
|
-
return
|
|
692
|
-
|
|
693
|
-
}, { immediate: !0, deep: !0 }),
|
|
694
|
-
|
|
695
|
-
}, { immediate: !0, deep: !0 }),
|
|
696
|
-
await
|
|
697
|
-
}), (o,
|
|
698
|
-
const
|
|
699
|
-
return
|
|
700
|
-
|
|
701
|
-
"can-submit":
|
|
702
|
-
config:
|
|
703
|
-
"edit-id":
|
|
704
|
-
"entity-type": l(
|
|
705
|
-
"error-message": e.errorMessage ||
|
|
706
|
+
return le(ye, (o) => {
|
|
707
|
+
ke(o);
|
|
708
|
+
}, { immediate: !0, deep: !0 }), le(oe, () => {
|
|
709
|
+
Q.value++;
|
|
710
|
+
}, { immediate: !0, deep: !0 }), je(async () => {
|
|
711
|
+
await ce();
|
|
712
|
+
}), (o, r) => {
|
|
713
|
+
const v = F("KInput"), I = F("KSelect"), s = F("KTextArea");
|
|
714
|
+
return b(), W("div", ot, [
|
|
715
|
+
f(l(Ge), {
|
|
716
|
+
"can-submit": M.value,
|
|
717
|
+
config: a.config,
|
|
718
|
+
"edit-id": a.keyId,
|
|
719
|
+
"entity-type": l(Ve).Key,
|
|
720
|
+
"error-message": e.errorMessage || ue.value,
|
|
706
721
|
"fetch-url": z.value,
|
|
707
|
-
"form-fields":
|
|
722
|
+
"form-fields": m.value,
|
|
708
723
|
"is-readonly": e.isReadonly,
|
|
709
|
-
onCancel:
|
|
710
|
-
"onFetch:error":
|
|
711
|
-
"onFetch:success":
|
|
712
|
-
onLoading:
|
|
724
|
+
onCancel: H,
|
|
725
|
+
"onFetch:error": r[9] || (r[9] = (i) => o.$emit("error", i)),
|
|
726
|
+
"onFetch:success": X,
|
|
727
|
+
onLoading: r[10] || (r[10] = (i) => o.$emit("loading", i)),
|
|
713
728
|
onSubmit: j
|
|
714
729
|
}, {
|
|
715
|
-
default:
|
|
716
|
-
|
|
717
|
-
description: l(
|
|
718
|
-
title: l(
|
|
730
|
+
default: u(() => [
|
|
731
|
+
f(l(xe), {
|
|
732
|
+
description: l(d)("keys.form.sections.general.description"),
|
|
733
|
+
title: l(d)("keys.form.sections.general.title")
|
|
719
734
|
}, {
|
|
720
|
-
default:
|
|
721
|
-
|
|
735
|
+
default: u(() => [
|
|
736
|
+
f(v, {
|
|
722
737
|
modelValue: e.fields.key_id,
|
|
723
|
-
"onUpdate:modelValue":
|
|
738
|
+
"onUpdate:modelValue": r[0] || (r[0] = (i) => e.fields.key_id = i),
|
|
724
739
|
modelModifiers: { trim: !0 },
|
|
725
740
|
autocomplete: "off",
|
|
726
741
|
"data-testid": "key-form-id",
|
|
727
|
-
help: l(
|
|
728
|
-
label: l(
|
|
742
|
+
help: l(d)("keys.form.fields.id.help"),
|
|
743
|
+
label: l(d)("keys.form.fields.id.label"),
|
|
729
744
|
"label-attributes": {
|
|
730
|
-
info: l(
|
|
745
|
+
info: l(d)("keys.form.fields.id.tooltip"),
|
|
731
746
|
tooltipAttributes: { maxWidth: "400" }
|
|
732
747
|
},
|
|
733
|
-
placeholder: l(
|
|
748
|
+
placeholder: l(d)("keys.form.fields.id.placeholder"),
|
|
734
749
|
readonly: e.isReadonly,
|
|
735
750
|
required: "",
|
|
736
751
|
type: "text"
|
|
737
752
|
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"]),
|
|
738
|
-
|
|
753
|
+
a.showx5t ? (b(), V(v, {
|
|
739
754
|
key: 0,
|
|
740
755
|
modelValue: e.fields.x5t,
|
|
741
|
-
"onUpdate:modelValue":
|
|
756
|
+
"onUpdate:modelValue": r[1] || (r[1] = (i) => e.fields.x5t = i),
|
|
742
757
|
modelModifiers: { trim: !0 },
|
|
743
758
|
autocomplete: "off",
|
|
744
759
|
"data-testid": "key-form-x5t",
|
|
745
|
-
help: l(
|
|
746
|
-
label: l(
|
|
760
|
+
help: l(d)("keys.form.fields.x5t.help"),
|
|
761
|
+
label: l(d)("keys.form.fields.x5t.label"),
|
|
747
762
|
"label-attributes": {
|
|
748
|
-
info: l(
|
|
763
|
+
info: l(d)("keys.form.fields.x5t.tooltip"),
|
|
749
764
|
tooltipAttributes: { maxWidth: "400" }
|
|
750
765
|
},
|
|
751
|
-
placeholder: l(
|
|
766
|
+
placeholder: l(d)("keys.form.fields.x5t.placeholder"),
|
|
752
767
|
readonly: e.isReadonly,
|
|
753
768
|
type: "text"
|
|
754
|
-
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])) :
|
|
755
|
-
|
|
769
|
+
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])) : J("", !0),
|
|
770
|
+
f(v, {
|
|
756
771
|
modelValue: e.fields.name,
|
|
757
|
-
"onUpdate:modelValue":
|
|
772
|
+
"onUpdate:modelValue": r[2] || (r[2] = (i) => e.fields.name = i),
|
|
758
773
|
modelModifiers: { trim: !0 },
|
|
759
774
|
autocomplete: "off",
|
|
760
775
|
"data-testid": "key-form-name",
|
|
761
|
-
label: l(
|
|
762
|
-
placeholder: l(
|
|
776
|
+
label: l(d)("keys.form.fields.name.label"),
|
|
777
|
+
placeholder: l(d)("keys.form.fields.name.placeholder"),
|
|
763
778
|
readonly: e.isReadonly,
|
|
764
779
|
type: "text"
|
|
765
780
|
}, null, 8, ["modelValue", "label", "placeholder", "readonly"]),
|
|
766
|
-
|
|
781
|
+
f(I, {
|
|
767
782
|
modelValue: e.fields.key_set,
|
|
768
|
-
"onUpdate:modelValue":
|
|
769
|
-
clearable:
|
|
783
|
+
"onUpdate:modelValue": r[3] || (r[3] = (i) => e.fields.key_set = i),
|
|
784
|
+
clearable: L.value,
|
|
770
785
|
"data-testid": "key-form-key-set",
|
|
771
|
-
"dropdown-footer-text":
|
|
786
|
+
"dropdown-footer-text": ae.value,
|
|
772
787
|
"enable-filtering": "",
|
|
773
788
|
"filter-function": () => !0,
|
|
774
|
-
items:
|
|
775
|
-
label: l(
|
|
776
|
-
loading: l(
|
|
777
|
-
placeholder: l(
|
|
778
|
-
readonly:
|
|
789
|
+
items: oe.value,
|
|
790
|
+
label: l(d)("keys.form.fields.key_set.label"),
|
|
791
|
+
loading: l(S),
|
|
792
|
+
placeholder: l(d)("keys.form.fields.key_set.placeholder"),
|
|
793
|
+
readonly: B.value,
|
|
779
794
|
width: "100%",
|
|
780
|
-
onQueryChange:
|
|
795
|
+
onQueryChange: fe
|
|
781
796
|
}, {
|
|
782
|
-
loading:
|
|
783
|
-
|
|
797
|
+
loading: u(() => [
|
|
798
|
+
D("div", null, C(l(d)("keys.actions.loading")), 1)
|
|
784
799
|
]),
|
|
785
|
-
empty:
|
|
786
|
-
|
|
800
|
+
empty: u(() => [
|
|
801
|
+
D("div", st, C(l(d)("keys.search.no_results")), 1)
|
|
787
802
|
]),
|
|
788
|
-
"selected-item-template":
|
|
789
|
-
|
|
803
|
+
"selected-item-template": u(({ item: i }) => [
|
|
804
|
+
D("div", null, C(i.name), 1)
|
|
790
805
|
]),
|
|
791
|
-
"item-template":
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
806
|
+
"item-template": u(({ item: i }) => [
|
|
807
|
+
D("div", nt, [
|
|
808
|
+
D("div", rt, C(i.name), 1),
|
|
809
|
+
D("div", dt, C(i.value), 1)
|
|
795
810
|
])
|
|
796
811
|
]),
|
|
797
812
|
_: 1
|
|
798
813
|
}, 8, ["modelValue", "clearable", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly"]),
|
|
799
|
-
|
|
800
|
-
|
|
814
|
+
R.value ? (b(), W("p", ct, C(R.value), 1)) : J("", !0),
|
|
815
|
+
f(v, {
|
|
801
816
|
modelValue: e.fields.tags,
|
|
802
|
-
"onUpdate:modelValue":
|
|
817
|
+
"onUpdate:modelValue": r[4] || (r[4] = (i) => e.fields.tags = i),
|
|
803
818
|
modelModifiers: { trim: !0 },
|
|
804
819
|
autocomplete: "off",
|
|
805
820
|
"data-testid": "key-form-tags",
|
|
806
|
-
help: l(
|
|
807
|
-
label: l(
|
|
821
|
+
help: l(d)("keys.form.fields.tags.help"),
|
|
822
|
+
label: l(d)("keys.form.fields.tags.label"),
|
|
808
823
|
"label-attributes": {
|
|
809
|
-
info: l(
|
|
824
|
+
info: l(d)("keys.form.fields.tags.tooltip"),
|
|
810
825
|
tooltipAttributes: { maxWidth: "400" }
|
|
811
826
|
},
|
|
812
|
-
placeholder: l(
|
|
827
|
+
placeholder: l(d)("keys.form.fields.tags.placeholder"),
|
|
813
828
|
readonly: e.isReadonly,
|
|
814
829
|
type: "text"
|
|
815
830
|
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])
|
|
816
831
|
]),
|
|
817
832
|
_: 1
|
|
818
833
|
}, 8, ["description", "title"]),
|
|
819
|
-
|
|
820
|
-
description: l(
|
|
834
|
+
f(l(xe), {
|
|
835
|
+
description: l(d)("keys.form.sections.keys.description"),
|
|
821
836
|
"has-divider": "",
|
|
822
|
-
title: l(
|
|
837
|
+
title: l(d)("keys.form.sections.keys.title")
|
|
823
838
|
}, {
|
|
824
|
-
default:
|
|
825
|
-
|
|
826
|
-
|
|
839
|
+
default: u(() => [
|
|
840
|
+
D("div", yt, [
|
|
841
|
+
f(I, {
|
|
827
842
|
modelValue: e.fields.key_format,
|
|
828
|
-
"onUpdate:modelValue":
|
|
843
|
+
"onUpdate:modelValue": r[5] || (r[5] = (i) => e.fields.key_format = i),
|
|
829
844
|
"data-testid": "key-form-key-format",
|
|
830
|
-
items:
|
|
831
|
-
label: l(
|
|
845
|
+
items: T,
|
|
846
|
+
label: l(d)("keys.form.fields.key_format.label"),
|
|
832
847
|
readonly: e.isReadonly,
|
|
833
848
|
required: "",
|
|
834
849
|
width: "100%"
|
|
835
850
|
}, null, 8, ["modelValue", "label", "readonly"])
|
|
836
851
|
]),
|
|
837
|
-
e.fields.key_format === "jwk" ? (
|
|
852
|
+
e.fields.key_format === "jwk" ? (b(), V(s, {
|
|
838
853
|
key: 0,
|
|
839
854
|
modelValue: e.fields.jwk,
|
|
840
|
-
"onUpdate:modelValue":
|
|
855
|
+
"onUpdate:modelValue": r[6] || (r[6] = (i) => e.fields.jwk = i),
|
|
841
856
|
modelModifiers: { trim: !0 },
|
|
842
857
|
"character-limit": !1,
|
|
843
858
|
class: "key-form-textarea",
|
|
844
859
|
"data-testid": "key-form-jwk",
|
|
845
|
-
label: l(
|
|
860
|
+
label: l(d)("keys.form.fields.jwk.label"),
|
|
846
861
|
"label-attributes": {
|
|
847
|
-
info: l(
|
|
862
|
+
info: l(d)("keys.form.fields.jwk.tooltip"),
|
|
848
863
|
tooltipAttributes: { maxWidth: "400" }
|
|
849
864
|
},
|
|
850
|
-
placeholder: l(
|
|
865
|
+
placeholder: l(d)("keys.form.fields.jwk.placeholder"),
|
|
851
866
|
readonly: e.isReadonly,
|
|
852
867
|
required: ""
|
|
853
|
-
}, null, 8, ["modelValue", "label", "label-attributes", "placeholder", "readonly"])) :
|
|
854
|
-
e.fields.key_format === "pem" ? (
|
|
868
|
+
}, null, 8, ["modelValue", "label", "label-attributes", "placeholder", "readonly"])) : J("", !0),
|
|
869
|
+
e.fields.key_format === "pem" ? (b(), V(s, {
|
|
855
870
|
key: 1,
|
|
856
871
|
modelValue: e.fields.private_key,
|
|
857
|
-
"onUpdate:modelValue":
|
|
872
|
+
"onUpdate:modelValue": r[7] || (r[7] = (i) => e.fields.private_key = i),
|
|
858
873
|
modelModifiers: { trim: !0 },
|
|
859
874
|
"character-limit": !1,
|
|
860
875
|
class: "key-form-textarea",
|
|
861
876
|
"data-testid": "key-form-private-key",
|
|
862
|
-
label: l(
|
|
863
|
-
placeholder: l(
|
|
877
|
+
label: l(d)("keys.form.fields.private_key.label"),
|
|
878
|
+
placeholder: l(d)("keys.form.fields.private_key.placeholder"),
|
|
864
879
|
readonly: e.isReadonly,
|
|
865
880
|
required: ""
|
|
866
|
-
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) :
|
|
867
|
-
e.fields.key_format === "pem" ? (
|
|
881
|
+
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) : J("", !0),
|
|
882
|
+
e.fields.key_format === "pem" ? (b(), V(s, {
|
|
868
883
|
key: 2,
|
|
869
884
|
modelValue: e.fields.public_key,
|
|
870
|
-
"onUpdate:modelValue":
|
|
885
|
+
"onUpdate:modelValue": r[8] || (r[8] = (i) => e.fields.public_key = i),
|
|
871
886
|
modelModifiers: { trim: !0 },
|
|
872
887
|
"character-limit": !1,
|
|
873
888
|
class: "key-form-textarea",
|
|
874
889
|
"data-testid": "key-form-public-key",
|
|
875
|
-
label: l(
|
|
876
|
-
placeholder: l(
|
|
890
|
+
label: l(d)("keys.form.fields.public_key.label"),
|
|
891
|
+
placeholder: l(d)("keys.form.fields.public_key.placeholder"),
|
|
877
892
|
readonly: e.isReadonly,
|
|
878
893
|
required: ""
|
|
879
|
-
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) :
|
|
894
|
+
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) : J("", !0)
|
|
880
895
|
]),
|
|
881
896
|
_: 1
|
|
882
897
|
}, 8, ["description", "title"])
|
|
@@ -886,14 +901,14 @@ const ve = {
|
|
|
886
901
|
]);
|
|
887
902
|
};
|
|
888
903
|
}
|
|
889
|
-
}),
|
|
904
|
+
}), _t = /* @__PURE__ */ Me(ft, [["__scopeId", "data-v-d5baf85a"]]), ut = { class: "kong-ui-entities-keys-entity-config-card" }, kt = { key: 2 }, St = /* @__PURE__ */ ve({
|
|
890
905
|
__name: "KeyConfigCard",
|
|
891
906
|
props: {
|
|
892
907
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
893
908
|
config: {
|
|
894
909
|
type: Object,
|
|
895
910
|
required: !0,
|
|
896
|
-
validator: (
|
|
911
|
+
validator: (a) => !(!a || !["konnect", "kongManager"].includes(a == null ? void 0 : a.app) || a.app === "konnect" && !a.controlPlaneId || a.app === "kongManager" && typeof a.workspace != "string" || !a.entityId)
|
|
897
912
|
},
|
|
898
913
|
/**
|
|
899
914
|
* External link for documentation that determines visibility of Documentation button
|
|
@@ -919,143 +934,143 @@ const ve = {
|
|
|
919
934
|
}
|
|
920
935
|
},
|
|
921
936
|
emits: ["loading", "fetch:error", "fetch:success", "navigation-click"],
|
|
922
|
-
setup(
|
|
923
|
-
var
|
|
924
|
-
const _ =
|
|
937
|
+
setup(a, { emit: q }) {
|
|
938
|
+
var H;
|
|
939
|
+
const _ = q, t = a, { axiosInstance: c } = he((H = t.config) == null ? void 0 : H.axiosRequestConfig), { convertKeyToTitle: d } = ze(), { i18n: { t: x } } = be.useI18n(), N = h(() => t.keySetId ? `${P.form[t.config.app].edit.forKeySet}`.replace(/{keySetId}/gi, t.keySetId) : P.form[t.config.app].edit.all), z = h(() => {
|
|
925
940
|
var y;
|
|
926
|
-
return (y =
|
|
927
|
-
}), $ = w(), e = w({}),
|
|
928
|
-
var
|
|
929
|
-
$.value = y,
|
|
941
|
+
return (y = P.form[t.config.app]) == null ? void 0 : y.getKeySet;
|
|
942
|
+
}), $ = w(), e = w({}), K = w(t.keySetId || ""), T = w(""), B = w(!1), L = async (y) => {
|
|
943
|
+
var m;
|
|
944
|
+
$.value = y, K.value = (m = y == null ? void 0 : y.set) == null ? void 0 : m.id, _("fetch:success", y), M(y);
|
|
930
945
|
};
|
|
931
|
-
|
|
932
|
-
var
|
|
933
|
-
if (!
|
|
946
|
+
le(K, async () => {
|
|
947
|
+
var m, j;
|
|
948
|
+
if (!K.value)
|
|
934
949
|
return;
|
|
935
950
|
let y = `${t.config.apiBaseUrl}${z.value}`;
|
|
936
|
-
t.config.app === "konnect" ? y = y.replace(/{controlPlaneId}/gi, ((
|
|
951
|
+
t.config.app === "konnect" ? y = y.replace(/{controlPlaneId}/gi, ((m = t.config) == null ? void 0 : m.controlPlaneId) || "").replace(/{keySetId}/gi, K.value || "") : t.config.app === "kongManager" && (y = y.replace(/\/{workspace}/gi, (j = t.config) != null && j.workspace ? `/${t.config.workspace}` : "").replace(/{keySetId}/gi, K.value || ""));
|
|
937
952
|
try {
|
|
938
|
-
|
|
939
|
-
const { data:
|
|
940
|
-
validateStatus: (
|
|
953
|
+
B.value = !0;
|
|
954
|
+
const { data: g } = await c.get(y, {
|
|
955
|
+
validateStatus: (S) => S === 404 || S >= 200 && S < 300
|
|
941
956
|
// in case KeySet is deleted
|
|
942
957
|
});
|
|
943
|
-
|
|
944
|
-
} catch (
|
|
945
|
-
_("fetch:error",
|
|
958
|
+
T.value = (g == null ? void 0 : g.name) || (g == null ? void 0 : g.id);
|
|
959
|
+
} catch (g) {
|
|
960
|
+
_("fetch:error", g);
|
|
946
961
|
} finally {
|
|
947
|
-
|
|
962
|
+
B.value = !1;
|
|
948
963
|
}
|
|
949
964
|
}, { immediate: !0 });
|
|
950
|
-
const
|
|
951
|
-
var
|
|
965
|
+
const M = (y) => {
|
|
966
|
+
var m, j;
|
|
952
967
|
try {
|
|
953
968
|
if (y.jwk) {
|
|
954
|
-
const
|
|
955
|
-
Object.keys(
|
|
969
|
+
const g = JSON.parse(y.jwk);
|
|
970
|
+
Object.keys(g).forEach((S) => {
|
|
956
971
|
e.value = {
|
|
957
972
|
...e.value,
|
|
958
|
-
[`jwk.${
|
|
973
|
+
[`jwk.${S}`]: g[S]
|
|
959
974
|
};
|
|
960
975
|
});
|
|
961
976
|
} else
|
|
962
977
|
e.value = {
|
|
963
|
-
"pem.public_key": (
|
|
978
|
+
"pem.public_key": (m = y == null ? void 0 : y.pem) == null ? void 0 : m.public_key,
|
|
964
979
|
"pem.private_key": (j = y == null ? void 0 : y.pem) == null ? void 0 : j.private_key
|
|
965
980
|
};
|
|
966
|
-
} catch (
|
|
967
|
-
_("fetch:error",
|
|
981
|
+
} catch (g) {
|
|
982
|
+
_("fetch:error", g);
|
|
968
983
|
}
|
|
969
984
|
return e;
|
|
970
|
-
},
|
|
985
|
+
}, X = w({
|
|
971
986
|
id: {},
|
|
972
987
|
name: {
|
|
973
|
-
tooltip:
|
|
988
|
+
tooltip: x("keys.form.fields.name.tooltip")
|
|
974
989
|
},
|
|
975
990
|
last_updated: {},
|
|
976
991
|
created: {},
|
|
977
992
|
set: {
|
|
978
|
-
label:
|
|
979
|
-
section:
|
|
980
|
-
tooltip:
|
|
993
|
+
label: x("keys.form.fields.set.label"),
|
|
994
|
+
section: me.Basic,
|
|
995
|
+
tooltip: x("keys.form.fields.set.tooltip"),
|
|
981
996
|
order: 5
|
|
982
997
|
},
|
|
983
998
|
kid: {
|
|
984
|
-
label:
|
|
985
|
-
section:
|
|
986
|
-
tooltip:
|
|
999
|
+
label: x("keys.form.fields.kid.label"),
|
|
1000
|
+
section: me.Basic,
|
|
1001
|
+
tooltip: x("keys.form.fields.kid.tooltip")
|
|
987
1002
|
},
|
|
988
1003
|
tags: {
|
|
989
|
-
tooltip:
|
|
1004
|
+
tooltip: x("keys.form.fields.tags.tooltip")
|
|
990
1005
|
},
|
|
991
1006
|
// advanced fields
|
|
992
1007
|
jwk: {
|
|
993
|
-
label:
|
|
994
|
-
type:
|
|
1008
|
+
label: x("keys.form.fields.jwk.label"),
|
|
1009
|
+
type: pe.Json
|
|
995
1010
|
},
|
|
996
1011
|
pem: {
|
|
997
|
-
section:
|
|
998
|
-
label:
|
|
999
|
-
type:
|
|
1012
|
+
section: me.Advanced,
|
|
1013
|
+
label: x("keys.form.fields.key_format.options.pem"),
|
|
1014
|
+
type: pe.Json
|
|
1000
1015
|
}
|
|
1001
1016
|
});
|
|
1002
|
-
return (y,
|
|
1003
|
-
var
|
|
1004
|
-
const j =
|
|
1005
|
-
return
|
|
1006
|
-
|
|
1007
|
-
config:
|
|
1008
|
-
"config-card-doc":
|
|
1009
|
-
"config-schema":
|
|
1010
|
-
"entity-type": l(
|
|
1011
|
-
"fetch-url":
|
|
1012
|
-
"hide-title":
|
|
1013
|
-
"onFetch:error":
|
|
1014
|
-
"onFetch:success":
|
|
1015
|
-
onLoading:
|
|
1016
|
-
},
|
|
1017
|
-
set:
|
|
1018
|
-
|
|
1017
|
+
return (y, m) => {
|
|
1018
|
+
var g, S;
|
|
1019
|
+
const j = F("KSkeleton");
|
|
1020
|
+
return b(), W("div", ut, [
|
|
1021
|
+
f(l(Xe), {
|
|
1022
|
+
config: a.config,
|
|
1023
|
+
"config-card-doc": a.configCardDoc,
|
|
1024
|
+
"config-schema": X.value,
|
|
1025
|
+
"entity-type": l(Ve).Key,
|
|
1026
|
+
"fetch-url": N.value,
|
|
1027
|
+
"hide-title": a.hideTitle,
|
|
1028
|
+
"onFetch:error": m[0] || (m[0] = (k) => y.$emit("fetch:error", k)),
|
|
1029
|
+
"onFetch:success": L,
|
|
1030
|
+
onLoading: m[1] || (m[1] = (k) => y.$emit("loading", k))
|
|
1031
|
+
}, ge({
|
|
1032
|
+
set: u(({ row: k }) => [
|
|
1033
|
+
B.value ? (b(), V(j, {
|
|
1019
1034
|
key: 0,
|
|
1020
1035
|
"data-testid": "key-set-name-loader",
|
|
1021
1036
|
type: "spinner"
|
|
1022
|
-
})) :
|
|
1037
|
+
})) : k.value && k.value.id === K.value && T.value ? (b(), V(l(Ye), {
|
|
1023
1038
|
key: 1,
|
|
1024
1039
|
item: {
|
|
1025
|
-
key:
|
|
1026
|
-
value:
|
|
1027
|
-
type: l(
|
|
1040
|
+
key: k.value.id,
|
|
1041
|
+
value: T.value,
|
|
1042
|
+
type: l(pe).LinkInternal
|
|
1028
1043
|
},
|
|
1029
|
-
onClick: (
|
|
1030
|
-
}, null, 8, ["item", "onClick"])) : (
|
|
1044
|
+
onClick: (ie) => y.$emit("navigation-click", k.value.id, "key-sets")
|
|
1045
|
+
}, null, 8, ["item", "onClick"])) : (b(), W("div", kt, C("–")))
|
|
1031
1046
|
]),
|
|
1032
1047
|
_: 2
|
|
1033
1048
|
}, [
|
|
1034
|
-
(
|
|
1049
|
+
(g = $.value) != null && g.jwk ? {
|
|
1035
1050
|
name: "jwk",
|
|
1036
|
-
fn:
|
|
1037
|
-
(
|
|
1038
|
-
key:
|
|
1039
|
-
"data-testid": `${
|
|
1051
|
+
fn: u(() => [
|
|
1052
|
+
(b(!0), W(we, null, Ie(Object.keys(e.value), (k) => (b(), V(l($e), {
|
|
1053
|
+
key: k,
|
|
1054
|
+
"data-testid": `${k}`,
|
|
1040
1055
|
item: {
|
|
1041
|
-
key:
|
|
1042
|
-
label: l(
|
|
1043
|
-
value: e.value[
|
|
1056
|
+
key: k,
|
|
1057
|
+
label: l(d)(k),
|
|
1058
|
+
value: e.value[k]
|
|
1044
1059
|
}
|
|
1045
1060
|
}, null, 8, ["data-testid", "item"]))), 128))
|
|
1046
1061
|
]),
|
|
1047
1062
|
key: "0"
|
|
1048
1063
|
} : void 0,
|
|
1049
|
-
(
|
|
1064
|
+
(S = $.value) != null && S.pem ? {
|
|
1050
1065
|
name: "pem",
|
|
1051
|
-
fn:
|
|
1052
|
-
(
|
|
1053
|
-
key:
|
|
1054
|
-
"data-testid": `${
|
|
1066
|
+
fn: u(() => [
|
|
1067
|
+
(b(!0), W(we, null, Ie(Object.keys(e.value), (k) => (b(), V(l($e), {
|
|
1068
|
+
key: k,
|
|
1069
|
+
"data-testid": `${k}`,
|
|
1055
1070
|
item: {
|
|
1056
|
-
key:
|
|
1057
|
-
label: l(
|
|
1058
|
-
value: e.value[
|
|
1071
|
+
key: k,
|
|
1072
|
+
label: l(d)(k),
|
|
1073
|
+
value: e.value[k]
|
|
1059
1074
|
}
|
|
1060
1075
|
}, null, 8, ["data-testid", "item"]))), 128))
|
|
1061
1076
|
]),
|
|
@@ -1067,7 +1082,7 @@ const ve = {
|
|
|
1067
1082
|
}
|
|
1068
1083
|
});
|
|
1069
1084
|
export {
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1085
|
+
St as KeyConfigCard,
|
|
1086
|
+
_t as KeyForm,
|
|
1087
|
+
bt as KeyList
|
|
1073
1088
|
};
|