@kong-ui-public/entities-keys 3.5.43 → 3.5.44
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,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { AddIcon as
|
|
4
|
-
import { createI18n as Ve, i18nTComponent as
|
|
5
|
-
import { useAxios as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as ue, ref as b, computed as _, watch as Z, onBeforeMount as Se, resolveComponent as T, openBlock as S, createElementBlock as q, createVNode as f, unref as o, withCtx as u, createBlock as A, Teleport as je, withDirectives as $e, createTextVNode as le, toDisplayString as j, vShow as Ee, createElementVNode as F, reactive as me, createCommentVNode as ie, createSlots as xe, Fragment as ge, renderList as ve } from "vue";
|
|
2
|
+
import { useRouter as Ie } from "vue-router";
|
|
3
|
+
import { AddIcon as Me } from "@kong/icons";
|
|
4
|
+
import { createI18n as Ve, i18nTComponent as De } from "@kong-ui-public/i18n";
|
|
5
|
+
import { useAxios as ke, useFetcher as Re, useDeleteUrlBuilder as Fe, FetcherStatus as be, EntityBaseTable as Te, EntityFilter as Ae, PermissionsWrapper as oe, TableTags as Be, EntityDeleteModal as Ue, EntityTypes as qe, useErrors as Pe, EntityBaseFormType as se, useDebouncedFilter as Ne, EntityBaseForm as Oe, SupportedEntityType as we, EntityFormSection as he, useStringHelpers as Je, ConfigurationSchemaSection as ye, ConfigurationSchemaType as fe, EntityBaseConfigCard as We, InternalLinkItem as Le, ConfigCardItem as _e } from "@kong-ui-public/entities-shared";
|
|
6
|
+
const Qe = {
|
|
7
7
|
title: "Keys",
|
|
8
8
|
list: {
|
|
9
9
|
toolbar_actions: {
|
|
@@ -115,57 +115,57 @@ const Ge = {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
},
|
|
119
|
-
keys:
|
|
118
|
+
}, ze = {
|
|
119
|
+
keys: Qe
|
|
120
120
|
};
|
|
121
|
-
function
|
|
122
|
-
const s = Ve("en-us",
|
|
121
|
+
function Ge() {
|
|
122
|
+
const s = Ve("en-us", ze);
|
|
123
123
|
return {
|
|
124
124
|
i18n: s,
|
|
125
|
-
i18nT:
|
|
125
|
+
i18nT: De(s)
|
|
126
126
|
// Translation component <i18n-t>
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
const
|
|
130
|
-
useI18n:
|
|
131
|
-
},
|
|
129
|
+
const pe = {
|
|
130
|
+
useI18n: Ge
|
|
131
|
+
}, D = "/v2/control-planes/{controlPlaneId}/core-entities", R = "/{workspace}", B = {
|
|
132
132
|
list: {
|
|
133
133
|
konnect: {
|
|
134
|
-
all: `${
|
|
135
|
-
forKeySet: `${
|
|
134
|
+
all: `${D}/keys`,
|
|
135
|
+
forKeySet: `${D}/key-sets/{keySetId}/keys`
|
|
136
136
|
},
|
|
137
137
|
kongManager: {
|
|
138
|
-
all: `${
|
|
139
|
-
forKeySet: `${
|
|
138
|
+
all: `${R}/keys`,
|
|
139
|
+
forKeySet: `${R}/key-sets/{keySetId}/keys`
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
form: {
|
|
143
143
|
konnect: {
|
|
144
144
|
create: {
|
|
145
|
-
all: `${
|
|
146
|
-
forKeySet: `${
|
|
145
|
+
all: `${D}/keys`,
|
|
146
|
+
forKeySet: `${D}/key-sets/{keySetId}/keys`
|
|
147
147
|
},
|
|
148
148
|
edit: {
|
|
149
|
-
all: `${
|
|
150
|
-
forKeySet: `${
|
|
149
|
+
all: `${D}/keys/{id}`,
|
|
150
|
+
forKeySet: `${D}/key-sets/{keySetId}/keys/{id}`
|
|
151
151
|
},
|
|
152
|
-
keySets: `${
|
|
153
|
-
getKeySet: `${
|
|
152
|
+
keySets: `${D}/key-sets`,
|
|
153
|
+
getKeySet: `${D}/key-sets/{keySetId}`
|
|
154
154
|
},
|
|
155
155
|
kongManager: {
|
|
156
156
|
create: {
|
|
157
|
-
all: `${
|
|
158
|
-
forKeySet: `${
|
|
157
|
+
all: `${R}/keys`,
|
|
158
|
+
forKeySet: `${R}/key-sets/{keySetId}/keys`
|
|
159
159
|
},
|
|
160
160
|
edit: {
|
|
161
|
-
all: `${
|
|
162
|
-
forKeySet: `${
|
|
161
|
+
all: `${R}/keys/{id}`,
|
|
162
|
+
forKeySet: `${R}/key-sets/{keySetId}/keys/{id}`
|
|
163
163
|
},
|
|
164
|
-
keySets: `${
|
|
165
|
-
getKeySet: `${
|
|
164
|
+
keySets: `${R}/key-sets`,
|
|
165
|
+
getKeySet: `${R}/key-sets/{keySetId}`
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
},
|
|
168
|
+
}, He = { class: "kong-ui-entities-keys-list" }, Xe = /* @__PURE__ */ ue({
|
|
169
169
|
__name: "KeyList",
|
|
170
170
|
props: {
|
|
171
171
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -210,259 +210,245 @@ const ve = {
|
|
|
210
210
|
}
|
|
211
211
|
},
|
|
212
212
|
emits: ["error", "copy:success", "copy:error", "delete:success"],
|
|
213
|
-
setup(s, { emit:
|
|
214
|
-
var
|
|
215
|
-
const
|
|
213
|
+
setup(s, { emit: U }) {
|
|
214
|
+
var Y;
|
|
215
|
+
const h = U, l = s, { i18n: { t: y } } = pe.useI18n(), d = Ie(), { axiosInstance: C } = ke((Y = l.config) == null ? void 0 : Y.axiosRequestConfig), x = b(1), J = _(() => l.config.app !== "kongManager" || !!l.config.disableSorting), K = {
|
|
216
216
|
// the Name column is non-hidable
|
|
217
217
|
name: { label: y("keys.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
|
|
218
218
|
kid: { label: y("keys.list.table_headers.key_id"), sortable: !0 },
|
|
219
219
|
tags: { label: y("keys.list.table_headers.tags") },
|
|
220
220
|
id: { label: y("keys.list.table_headers.id"), sortable: !0 }
|
|
221
|
-
}, t =
|
|
222
|
-
var i,
|
|
223
|
-
let e = `${l.config.apiBaseUrl}${
|
|
224
|
-
return l.config.app === "konnect" ? e = e.replace(/{controlPlaneId}/gi, ((i = l.config) == null ? void 0 : i.controlPlaneId) || "").replace(/{keySetId}/gi, ((
|
|
225
|
-
}),
|
|
221
|
+
}, t = K, I = _(() => {
|
|
222
|
+
var i, c, k, g;
|
|
223
|
+
let e = `${l.config.apiBaseUrl}${B.list[l.config.app][l.config.keySetId ? "forKeySet" : "all"]}`;
|
|
224
|
+
return l.config.app === "konnect" ? e = e.replace(/{controlPlaneId}/gi, ((i = l.config) == null ? void 0 : i.controlPlaneId) || "").replace(/{keySetId}/gi, ((c = l.config) == null ? void 0 : c.keySetId) || "") : l.config.app === "kongManager" && (e = e.replace(/\/{workspace}/gi, (k = l.config) != null && k.workspace ? `/${l.config.workspace}` : "").replace(/{keySetId}/gi, ((g = l.config) == null ? void 0 : g.keySetId) || "")), e;
|
|
225
|
+
}), E = b(""), V = _(() => {
|
|
226
226
|
const e = l.config.app === "konnect" || l.config.isExactMatch;
|
|
227
227
|
if (e)
|
|
228
228
|
return {
|
|
229
229
|
isExactMatch: e,
|
|
230
230
|
placeholder: y("keys.search.placeholder")
|
|
231
231
|
};
|
|
232
|
-
const i = { name:
|
|
232
|
+
const i = { name: K.name };
|
|
233
233
|
return {
|
|
234
234
|
isExactMatch: e,
|
|
235
235
|
fields: i,
|
|
236
236
|
schema: l.config.filterSchema
|
|
237
237
|
};
|
|
238
|
-
}), { fetcher:
|
|
239
|
-
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
const
|
|
244
|
-
if (!i(
|
|
238
|
+
}), { fetcher: W, fetcherState: L } = Re(l.config, I.value), Q = () => {
|
|
239
|
+
E.value = "";
|
|
240
|
+
}, P = () => {
|
|
241
|
+
x.value++;
|
|
242
|
+
}, n = b(null), m = b(!1), $ = (e, i) => {
|
|
243
|
+
const c = e.id;
|
|
244
|
+
if (!i(c)) {
|
|
245
245
|
p(e, "id");
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
|
|
248
|
+
w(e, "id");
|
|
249
249
|
}, v = (e, i) => {
|
|
250
|
-
const
|
|
251
|
-
if (!i(
|
|
252
|
-
|
|
250
|
+
const c = JSON.stringify(e);
|
|
251
|
+
if (!i(c)) {
|
|
252
|
+
h("copy:error", {
|
|
253
253
|
entity: e,
|
|
254
254
|
message: y("keys.errors.copy")
|
|
255
255
|
});
|
|
256
256
|
return;
|
|
257
257
|
}
|
|
258
|
-
|
|
258
|
+
h("copy:success", {
|
|
259
259
|
entity: e,
|
|
260
260
|
message: y("keys.copy.success_brief")
|
|
261
261
|
});
|
|
262
|
-
},
|
|
263
|
-
|
|
262
|
+
}, w = (e, i) => {
|
|
263
|
+
h("copy:success", {
|
|
264
264
|
entity: e,
|
|
265
265
|
field: i,
|
|
266
266
|
message: y("keys.copy.success", { val: e[i] })
|
|
267
267
|
});
|
|
268
268
|
}, p = (e, i) => {
|
|
269
|
-
|
|
269
|
+
h("copy:error", {
|
|
270
270
|
entity: e,
|
|
271
271
|
field: i,
|
|
272
272
|
message: y("keys.errors.copy")
|
|
273
273
|
});
|
|
274
|
-
},
|
|
275
|
-
var
|
|
276
|
-
await ((
|
|
277
|
-
},
|
|
274
|
+
}, ee = async (e) => {
|
|
275
|
+
var c;
|
|
276
|
+
await ((c = l.canRetrieve) == null ? void 0 : c.call(l, e)) && d.push(l.config.getViewRoute(e.id));
|
|
277
|
+
}, ae = (e) => ({
|
|
278
278
|
label: y("keys.actions.view"),
|
|
279
279
|
to: l.config.getViewRoute(e)
|
|
280
280
|
}), re = (e) => ({
|
|
281
281
|
label: y("keys.actions.edit"),
|
|
282
282
|
to: l.config.getEditRoute(e)
|
|
283
|
-
}),
|
|
284
|
-
|
|
285
|
-
},
|
|
286
|
-
|
|
287
|
-
},
|
|
288
|
-
var e, i,
|
|
289
|
-
if ((e =
|
|
290
|
-
|
|
283
|
+
}), M = b(void 0), N = b(!1), O = b(!1), z = b(""), ne = Fe(l.config, I.value), de = (e) => {
|
|
284
|
+
M.value = e, N.value = !0;
|
|
285
|
+
}, ce = () => {
|
|
286
|
+
N.value = !1;
|
|
287
|
+
}, G = async () => {
|
|
288
|
+
var e, i, c;
|
|
289
|
+
if ((e = M.value) != null && e.id) {
|
|
290
|
+
O.value = !0;
|
|
291
291
|
try {
|
|
292
|
-
await
|
|
292
|
+
await C.delete(ne(M.value.id)), O.value = !1, N.value = !1, x.value++, h("delete:success", M.value);
|
|
293
293
|
} catch (k) {
|
|
294
|
-
|
|
294
|
+
z.value = ((c = (i = k.response) == null ? void 0 : i.data) == null ? void 0 : c.message) || k.message || y("keys.errors.delete"), h("error", k);
|
|
295
295
|
} finally {
|
|
296
|
-
|
|
296
|
+
O.value = !1;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
var i,
|
|
302
|
-
if (Array.isArray((i = e == null ? void 0 : e.response) == null ? void 0 : i.data) && (
|
|
303
|
-
|
|
299
|
+
}, H = b(!1);
|
|
300
|
+
Z(L, (e) => {
|
|
301
|
+
var i, c, k, g;
|
|
302
|
+
if (Array.isArray((i = e == null ? void 0 : e.response) == null ? void 0 : i.data) && (H.value = e.response.data.length > 0), e.status === be.NoRecords ? m.value = !0 : m.value = !1, e.status === be.Error) {
|
|
303
|
+
n.value = {
|
|
304
304
|
title: y("keys.errors.general")
|
|
305
|
-
}, (
|
|
305
|
+
}, (g = (k = (c = e.error) == null ? void 0 : c.response) == null ? void 0 : k.data) != null && g.message && (n.value.message = e.error.response.data.message), h("error", e.error);
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
308
|
-
|
|
308
|
+
n.value = null;
|
|
309
309
|
});
|
|
310
|
-
const
|
|
310
|
+
const X = b({
|
|
311
311
|
ctaPath: l.config.createRoute,
|
|
312
312
|
ctaText: void 0,
|
|
313
313
|
message: `${y("keys.list.empty_state.description")}${l.config.additionMessageForEmptyState ? ` ${l.config.additionMessageForEmptyState}` : ""}`,
|
|
314
314
|
title: y("keys.title")
|
|
315
315
|
});
|
|
316
|
-
return
|
|
317
|
-
await l.canCreate() && (
|
|
316
|
+
return Se(async () => {
|
|
317
|
+
await l.canCreate() && (X.value.title = y("keys.list.empty_state.title"), X.value.ctaText = y("keys.actions.create"));
|
|
318
318
|
}), (e, i) => {
|
|
319
|
-
const
|
|
320
|
-
return
|
|
321
|
-
|
|
319
|
+
const c = T("KButton"), k = T("KCopy"), g = T("KDropdownItem"), r = T("KClipboardProvider");
|
|
320
|
+
return S(), q("div", He, [
|
|
321
|
+
f(o(Te), {
|
|
322
322
|
"cache-identifier": s.cacheIdentifier,
|
|
323
|
-
"disable-sorting":
|
|
324
|
-
"empty-state-options":
|
|
323
|
+
"disable-sorting": J.value,
|
|
324
|
+
"empty-state-options": X.value,
|
|
325
325
|
"enable-entity-actions": "",
|
|
326
|
-
"error-message":
|
|
327
|
-
fetcher: o(
|
|
328
|
-
"fetcher-cache-key":
|
|
329
|
-
"hide-toolbar":
|
|
326
|
+
"error-message": n.value,
|
|
327
|
+
fetcher: o(W),
|
|
328
|
+
"fetcher-cache-key": x.value,
|
|
329
|
+
"hide-toolbar": m.value,
|
|
330
330
|
"pagination-type": "offset",
|
|
331
331
|
"preferences-storage-key": "kong-ui-entities-keys-list",
|
|
332
|
-
query:
|
|
332
|
+
query: E.value,
|
|
333
333
|
"table-headers": o(t),
|
|
334
|
-
onClearSearchInput:
|
|
335
|
-
"onClick:row": i[
|
|
336
|
-
onSort:
|
|
334
|
+
onClearSearchInput: Q,
|
|
335
|
+
"onClick:row": i[1] || (i[1] = (a) => ee(a)),
|
|
336
|
+
onSort: P
|
|
337
337
|
}, {
|
|
338
|
-
"toolbar-filter":
|
|
339
|
-
|
|
340
|
-
modelValue:
|
|
341
|
-
"onUpdate:modelValue": i[0] || (i[0] = (
|
|
342
|
-
config:
|
|
338
|
+
"toolbar-filter": u(() => [
|
|
339
|
+
f(o(Ae), {
|
|
340
|
+
modelValue: E.value,
|
|
341
|
+
"onUpdate:modelValue": i[0] || (i[0] = (a) => E.value = a),
|
|
342
|
+
config: V.value
|
|
343
343
|
}, null, 8, ["modelValue", "config"])
|
|
344
344
|
]),
|
|
345
|
-
"toolbar-button":
|
|
346
|
-
(
|
|
345
|
+
"toolbar-button": u(() => [
|
|
346
|
+
(S(), A(je, {
|
|
347
347
|
disabled: !s.useActionOutside,
|
|
348
348
|
to: "#kong-ui-app-page-header-action-button"
|
|
349
349
|
}, [
|
|
350
|
-
|
|
350
|
+
f(o(oe), {
|
|
351
351
|
"auth-function": () => s.canCreate()
|
|
352
352
|
}, {
|
|
353
|
-
default:
|
|
354
|
-
|
|
353
|
+
default: u(() => [
|
|
354
|
+
$e(f(c, {
|
|
355
355
|
appearance: "primary",
|
|
356
356
|
"data-testid": "toolbar-add-key",
|
|
357
357
|
size: s.useActionOutside ? "medium" : "large",
|
|
358
358
|
to: s.config.createRoute
|
|
359
359
|
}, {
|
|
360
|
-
default:
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
default: u(() => [
|
|
361
|
+
f(o(Me)),
|
|
362
|
+
le(" " + j(o(y)("keys.list.toolbar_actions.new_key")), 1)
|
|
363
363
|
]),
|
|
364
364
|
_: 1
|
|
365
365
|
}, 8, ["size", "to"]), [
|
|
366
|
-
[
|
|
366
|
+
[Ee, H.value]
|
|
367
367
|
])
|
|
368
368
|
]),
|
|
369
369
|
_: 1
|
|
370
370
|
}, 8, ["auth-function"])
|
|
371
371
|
], 8, ["disabled"]))
|
|
372
372
|
]),
|
|
373
|
-
name:
|
|
374
|
-
|
|
373
|
+
name: u(({ rowValue: a }) => [
|
|
374
|
+
F("b", null, j(a ?? "-"), 1)
|
|
375
375
|
]),
|
|
376
|
-
kid:
|
|
377
|
-
|
|
376
|
+
kid: u(({ rowValue: a }) => [
|
|
377
|
+
f(k, { text: a }, null, 8, ["text"])
|
|
378
378
|
]),
|
|
379
|
-
tags:
|
|
380
|
-
(
|
|
381
|
-
default: f(() => [
|
|
382
|
-
(b(!0), V(ke, null, pe(m, (N) => (b(), D(S, {
|
|
383
|
-
key: N,
|
|
384
|
-
onClick: i[1] || (i[1] = De(() => {
|
|
385
|
-
}, ["stop"]))
|
|
386
|
-
}, {
|
|
387
|
-
default: f(() => [
|
|
388
|
-
te(K(N), 1)
|
|
389
|
-
]),
|
|
390
|
-
_: 2
|
|
391
|
-
}, 1024))), 128))
|
|
392
|
-
]),
|
|
393
|
-
_: 2
|
|
394
|
-
}, 1024)) : (b(), V("span", Ze, "-"))
|
|
379
|
+
tags: u(({ rowValue: a }) => [
|
|
380
|
+
f(o(Be), { tags: a }, null, 8, ["tags"])
|
|
395
381
|
]),
|
|
396
|
-
id:
|
|
397
|
-
|
|
398
|
-
text:
|
|
382
|
+
id: u(({ rowValue: a }) => [
|
|
383
|
+
f(k, {
|
|
384
|
+
text: a,
|
|
399
385
|
truncate: ""
|
|
400
386
|
}, null, 8, ["text"])
|
|
401
387
|
]),
|
|
402
|
-
actions:
|
|
403
|
-
|
|
404
|
-
default:
|
|
405
|
-
|
|
388
|
+
actions: u(({ row: a }) => [
|
|
389
|
+
f(r, null, {
|
|
390
|
+
default: u(({ copyToClipboard: te }) => [
|
|
391
|
+
f(g, {
|
|
406
392
|
"data-testid": "action-entity-copy-id",
|
|
407
|
-
onClick: (
|
|
393
|
+
onClick: (Ke) => $(a, te)
|
|
408
394
|
}, {
|
|
409
|
-
default:
|
|
410
|
-
|
|
395
|
+
default: u(() => [
|
|
396
|
+
le(j(o(y)("keys.actions.copy_id")), 1)
|
|
411
397
|
]),
|
|
412
398
|
_: 2
|
|
413
399
|
}, 1032, ["onClick"])
|
|
414
400
|
]),
|
|
415
401
|
_: 2
|
|
416
402
|
}, 1024),
|
|
417
|
-
|
|
418
|
-
default:
|
|
419
|
-
|
|
403
|
+
f(r, null, {
|
|
404
|
+
default: u(({ copyToClipboard: te }) => [
|
|
405
|
+
f(g, {
|
|
420
406
|
"data-testid": "action-entity-copy-json",
|
|
421
|
-
onClick: (
|
|
407
|
+
onClick: (Ke) => v(a, te)
|
|
422
408
|
}, {
|
|
423
|
-
default:
|
|
424
|
-
|
|
409
|
+
default: u(() => [
|
|
410
|
+
le(j(o(y)("keys.actions.copy_json")), 1)
|
|
425
411
|
]),
|
|
426
412
|
_: 2
|
|
427
413
|
}, 1032, ["onClick"])
|
|
428
414
|
]),
|
|
429
415
|
_: 2
|
|
430
416
|
}, 1024),
|
|
431
|
-
|
|
432
|
-
"auth-function": () => s.canRetrieve(
|
|
417
|
+
f(o(oe), {
|
|
418
|
+
"auth-function": () => s.canRetrieve(a)
|
|
433
419
|
}, {
|
|
434
|
-
default:
|
|
435
|
-
|
|
420
|
+
default: u(() => [
|
|
421
|
+
f(g, {
|
|
436
422
|
"data-testid": "action-entity-view",
|
|
437
423
|
"has-divider": "",
|
|
438
|
-
item:
|
|
424
|
+
item: ae(a.id)
|
|
439
425
|
}, null, 8, ["item"])
|
|
440
426
|
]),
|
|
441
427
|
_: 2
|
|
442
428
|
}, 1032, ["auth-function"]),
|
|
443
|
-
|
|
444
|
-
"auth-function": () => s.canEdit(
|
|
429
|
+
f(o(oe), {
|
|
430
|
+
"auth-function": () => s.canEdit(a)
|
|
445
431
|
}, {
|
|
446
|
-
default:
|
|
447
|
-
|
|
432
|
+
default: u(() => [
|
|
433
|
+
f(g, {
|
|
448
434
|
"data-testid": "action-entity-edit",
|
|
449
|
-
item: re(
|
|
435
|
+
item: re(a.id)
|
|
450
436
|
}, null, 8, ["item"])
|
|
451
437
|
]),
|
|
452
438
|
_: 2
|
|
453
439
|
}, 1032, ["auth-function"]),
|
|
454
|
-
|
|
455
|
-
"auth-function": () => s.canDelete(
|
|
440
|
+
f(o(oe), {
|
|
441
|
+
"auth-function": () => s.canDelete(a)
|
|
456
442
|
}, {
|
|
457
|
-
default:
|
|
458
|
-
|
|
443
|
+
default: u(() => [
|
|
444
|
+
f(g, {
|
|
459
445
|
danger: "",
|
|
460
446
|
"data-testid": "action-entity-delete",
|
|
461
447
|
"has-divider": "",
|
|
462
|
-
onClick: (
|
|
448
|
+
onClick: (te) => de(a)
|
|
463
449
|
}, {
|
|
464
|
-
default:
|
|
465
|
-
|
|
450
|
+
default: u(() => [
|
|
451
|
+
le(j(o(y)("keys.actions.delete")), 1)
|
|
466
452
|
]),
|
|
467
453
|
_: 2
|
|
468
454
|
}, 1032, ["onClick"])
|
|
@@ -472,31 +458,31 @@ const ve = {
|
|
|
472
458
|
]),
|
|
473
459
|
_: 1
|
|
474
460
|
}, 8, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "hide-toolbar", "query", "table-headers"]),
|
|
475
|
-
|
|
476
|
-
"action-pending":
|
|
461
|
+
f(o(Ue), {
|
|
462
|
+
"action-pending": O.value,
|
|
477
463
|
description: o(y)("keys.delete.description"),
|
|
478
|
-
"entity-name":
|
|
479
|
-
"entity-type": o(
|
|
480
|
-
error:
|
|
464
|
+
"entity-name": M.value && (M.value.name || M.value.id),
|
|
465
|
+
"entity-type": o(qe).Key,
|
|
466
|
+
error: z.value,
|
|
481
467
|
"need-confirm": !1,
|
|
482
468
|
title: o(y)("keys.delete.title"),
|
|
483
|
-
visible:
|
|
484
|
-
onCancel:
|
|
485
|
-
onProceed:
|
|
469
|
+
visible: N.value,
|
|
470
|
+
onCancel: ce,
|
|
471
|
+
onProceed: G
|
|
486
472
|
}, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
|
|
487
473
|
]);
|
|
488
474
|
};
|
|
489
475
|
}
|
|
490
|
-
}),
|
|
491
|
-
const
|
|
492
|
-
for (const [l, y] of
|
|
493
|
-
|
|
494
|
-
return
|
|
495
|
-
},
|
|
476
|
+
}), Ce = (s, U) => {
|
|
477
|
+
const h = s.__vccOpts || s;
|
|
478
|
+
for (const [l, y] of U)
|
|
479
|
+
h[l] = y;
|
|
480
|
+
return h;
|
|
481
|
+
}, ut = /* @__PURE__ */ Ce(Xe, [["__scopeId", "data-v-22a4f9c4"]]), Ye = { class: "kong-ui-entities-keys-form" }, Ze = { "data-testid": "no-search-results" }, et = { class: "select-item-container" }, tt = { class: "select-item-label" }, lt = { class: "select-item-description" }, it = {
|
|
496
482
|
key: 0,
|
|
497
483
|
class: "invalid-key-set-message",
|
|
498
484
|
"data-testid": "invalid-key-set-message"
|
|
499
|
-
},
|
|
485
|
+
}, ot = { "data-testid": "key-format-container" }, st = /* @__PURE__ */ ue({
|
|
500
486
|
__name: "KeyForm",
|
|
501
487
|
props: {
|
|
502
488
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -525,9 +511,9 @@ const ve = {
|
|
|
525
511
|
}
|
|
526
512
|
},
|
|
527
513
|
emits: ["update", "error", "loading"],
|
|
528
|
-
setup(s, { emit:
|
|
529
|
-
var
|
|
530
|
-
const
|
|
514
|
+
setup(s, { emit: U }) {
|
|
515
|
+
var Y;
|
|
516
|
+
const h = U, l = s, y = Ie(), { i18n: { t: d } } = pe.useI18n(), { getMessageFromError: C } = Pe(), { axiosInstance: x } = ke((Y = l.config) == null ? void 0 : Y.axiosRequestConfig), J = _(() => l.keySetId ? B.form[l.config.app].edit.forKeySet.replace(/{keySetId}/gi, l.keySetId) : B.form[l.config.app].edit.all), K = _(() => l.keyId ? se.Edit : se.Create), t = me({
|
|
531
517
|
fields: {
|
|
532
518
|
name: "",
|
|
533
519
|
tags: "",
|
|
@@ -540,7 +526,7 @@ const ve = {
|
|
|
540
526
|
},
|
|
541
527
|
isReadonly: !1,
|
|
542
528
|
errorMessage: ""
|
|
543
|
-
}),
|
|
529
|
+
}), I = me({
|
|
544
530
|
name: "",
|
|
545
531
|
tags: "",
|
|
546
532
|
key_id: "",
|
|
@@ -549,250 +535,250 @@ const ve = {
|
|
|
549
535
|
jwk: "",
|
|
550
536
|
private_key: "",
|
|
551
537
|
public_key: ""
|
|
552
|
-
}),
|
|
538
|
+
}), E = [
|
|
553
539
|
{
|
|
554
|
-
label:
|
|
540
|
+
label: d("keys.form.fields.key_format.options.jwk"),
|
|
555
541
|
value: "jwk"
|
|
556
542
|
},
|
|
557
543
|
{
|
|
558
|
-
label:
|
|
544
|
+
label: d("keys.form.fields.key_format.options.pem"),
|
|
559
545
|
value: "pem"
|
|
560
546
|
}
|
|
561
|
-
],
|
|
562
|
-
|
|
563
|
-
|
|
547
|
+
], V = _(() => t.isReadonly || K.value === se.Create && !!l.fixedKeySetId), W = _(() => !V.value);
|
|
548
|
+
Z(() => l.fixedKeySetId, (e) => {
|
|
549
|
+
K.value === se.Create && (t.fields.key_set = e);
|
|
564
550
|
}, { immediate: !0 });
|
|
565
|
-
const
|
|
566
|
-
var i,
|
|
567
|
-
t.fields.key_id = (e == null ? void 0 : e.kid) || "", t.fields.name = (e == null ? void 0 : e.name) || "", t.fields.tags = ((i = e == null ? void 0 : e.tags) == null ? void 0 : i.join(", ")) || "", t.fields.key_set = ((
|
|
568
|
-
},
|
|
551
|
+
const L = _(() => JSON.stringify(t.fields) !== JSON.stringify(I) && !!t.fields.key_id && !!t.fields.key_format && (t.fields.key_format === "jwk" && !!t.fields.jwk || t.fields.key_format === "pem" && !!t.fields.private_key && !!t.fields.public_key)), Q = (e) => {
|
|
552
|
+
var i, c, k, g;
|
|
553
|
+
t.fields.key_id = (e == null ? void 0 : e.kid) || "", t.fields.name = (e == null ? void 0 : e.name) || "", t.fields.tags = ((i = e == null ? void 0 : e.tags) == null ? void 0 : i.join(", ")) || "", t.fields.key_set = ((c = e == null ? void 0 : e.set) == null ? void 0 : c.id) || "", t.fields.key_format = e != null && e.pem ? "pem" : "jwk", t.fields.jwk = (e == null ? void 0 : e.jwk) || "", t.fields.private_key = ((k = e == null ? void 0 : e.pem) == null ? void 0 : k.private_key) || "", t.fields.public_key = ((g = e == null ? void 0 : e.pem) == null ? void 0 : g.public_key) || "", Object.assign(I, t.fields);
|
|
554
|
+
}, P = () => {
|
|
569
555
|
y.push(l.config.cancelRoute);
|
|
570
|
-
},
|
|
571
|
-
var i,
|
|
572
|
-
let e = `${l.config.apiBaseUrl}${
|
|
573
|
-
return l.config.app === "konnect" ? e = e.replace(/{controlPlaneId}/gi, ((i = l.config) == null ? void 0 : i.controlPlaneId) || "") : l.config.app === "kongManager" && (e = e.replace(/\/{workspace}/gi, (
|
|
574
|
-
}),
|
|
575
|
-
var e, i,
|
|
556
|
+
}, n = _(() => {
|
|
557
|
+
var i, c;
|
|
558
|
+
let e = `${l.config.apiBaseUrl}${B.form[l.config.app][K.value][l.keySetId ? "forKeySet" : "all"]}`;
|
|
559
|
+
return l.config.app === "konnect" ? e = e.replace(/{controlPlaneId}/gi, ((i = l.config) == null ? void 0 : i.controlPlaneId) || "") : l.config.app === "kongManager" && (e = e.replace(/\/{workspace}/gi, (c = l.config) != null && c.workspace ? `/${l.config.workspace}` : "")), e = e.replace(/{id}/gi, l.keyId).replace(/{keySetId}/gi, l.keySetId || ""), e;
|
|
560
|
+
}), m = _(() => {
|
|
561
|
+
var e, i, c;
|
|
576
562
|
return {
|
|
577
563
|
kid: t.fields.key_id,
|
|
578
564
|
name: t.fields.name || null,
|
|
579
|
-
tags: ((
|
|
565
|
+
tags: ((c = (i = (e = t.fields.tags) == null ? void 0 : e.split(",")) == null ? void 0 : i.map((k) => String(k || "").trim())) == null ? void 0 : c.filter((k) => k !== "")) || [],
|
|
580
566
|
set: t.fields.key_set ? { id: t.fields.key_set } : null,
|
|
581
567
|
jwk: t.fields.key_format === "jwk" ? t.fields.jwk : null,
|
|
582
568
|
pem: t.fields.key_format === "pem" ? { private_key: t.fields.private_key, public_key: t.fields.public_key } : null
|
|
583
569
|
};
|
|
584
|
-
}),
|
|
585
|
-
var e, i,
|
|
570
|
+
}), $ = async () => {
|
|
571
|
+
var e, i, c, k, g;
|
|
586
572
|
try {
|
|
587
573
|
t.isReadonly = !0;
|
|
588
|
-
let
|
|
589
|
-
if (
|
|
590
|
-
const { data:
|
|
591
|
-
t.fields.key_id = (
|
|
574
|
+
let r;
|
|
575
|
+
if (K.value === "create" ? r = await x.post(n.value, m.value) : K.value === "edit" && (r = ((e = l.config) == null ? void 0 : e.app) === "konnect" ? await x.put(n.value, m.value) : await x.patch(n.value, m.value)), r) {
|
|
576
|
+
const { data: a } = r;
|
|
577
|
+
t.fields.key_id = (a == null ? void 0 : a.kid) || "", t.fields.name = (a == null ? void 0 : a.name) || "", t.fields.tags = ((i = a == null ? void 0 : a.tags) == null ? void 0 : i.join(", ")) || "", t.fields.key_set = ((c = a == null ? void 0 : a.set) == null ? void 0 : c.id) || "", t.fields.key_format = a != null && a.pem ? "pem" : "jwk", t.fields.jwk = (a == null ? void 0 : a.jwk) || "", t.fields.private_key = ((k = a == null ? void 0 : a.pem) == null ? void 0 : k.private_key) || "", t.fields.public_key = ((g = a == null ? void 0 : a.pem) == null ? void 0 : g.public_key) || "", Object.assign(I, t.fields), h("update", r == null ? void 0 : r.data);
|
|
592
578
|
}
|
|
593
|
-
} catch (
|
|
594
|
-
t.errorMessage =
|
|
579
|
+
} catch (r) {
|
|
580
|
+
t.errorMessage = C(r), h("error", r);
|
|
595
581
|
} finally {
|
|
596
582
|
t.isReadonly = !1;
|
|
597
583
|
}
|
|
598
584
|
}, {
|
|
599
585
|
debouncedQueryChange: v,
|
|
600
|
-
loading:
|
|
586
|
+
loading: w,
|
|
601
587
|
allRecords: p,
|
|
602
|
-
error:
|
|
603
|
-
validationError:
|
|
588
|
+
error: ee,
|
|
589
|
+
validationError: ae,
|
|
604
590
|
loadItems: re,
|
|
605
|
-
results:
|
|
606
|
-
} =
|
|
591
|
+
results: M
|
|
592
|
+
} = Ne(l.config, B.form[l.config.app].keySets, void 0, {
|
|
607
593
|
fetchedItemsKey: "data",
|
|
608
594
|
searchKeys: ["id", "name"]
|
|
609
|
-
}),
|
|
610
|
-
(!e || e !== t.fields.key_set && e !==
|
|
611
|
-
},
|
|
612
|
-
if (
|
|
613
|
-
return l.config.app === "konnect" ?
|
|
614
|
-
}),
|
|
595
|
+
}), N = (e) => {
|
|
596
|
+
(!e || e !== t.fields.key_set && e !== I.key_set) && v(e);
|
|
597
|
+
}, O = _(() => ee.value ? d("keys.errors.key_sets.fetch") : ""), z = _(() => ae.value ? d("keys.errors.key_sets.invalid") : ""), ne = b(0), de = _(() => p.value === void 0), ce = _(() => {
|
|
598
|
+
if (de.value)
|
|
599
|
+
return l.config.app === "konnect" ? d("keys.form.fields.key_set.footer") : void 0;
|
|
600
|
+
}), G = b(/* @__PURE__ */ new Set()), H = _(() => Array.from(G.value).map((i) => ({
|
|
615
601
|
name: i.name || "",
|
|
616
602
|
// can't use name for label or it tries to search => 404
|
|
617
603
|
label: "",
|
|
618
604
|
// leave it blank so no flicker when used with selected-item-template
|
|
619
605
|
value: i.id,
|
|
620
606
|
selected: t.fields.key_set === i.id
|
|
621
|
-
}))),
|
|
622
|
-
|
|
607
|
+
}))), X = (e) => {
|
|
608
|
+
G.value.clear();
|
|
623
609
|
let i;
|
|
624
610
|
for (i of e)
|
|
625
|
-
|
|
611
|
+
G.value.add(i);
|
|
626
612
|
};
|
|
627
|
-
return
|
|
628
|
-
|
|
629
|
-
}, { immediate: !0, deep: !0 }),
|
|
630
|
-
|
|
631
|
-
}, { immediate: !0, deep: !0 }),
|
|
613
|
+
return Z(M, (e) => {
|
|
614
|
+
X(e);
|
|
615
|
+
}, { immediate: !0, deep: !0 }), Z(H, () => {
|
|
616
|
+
ne.value++;
|
|
617
|
+
}, { immediate: !0, deep: !0 }), Se(async () => {
|
|
632
618
|
await re();
|
|
633
619
|
}), (e, i) => {
|
|
634
|
-
const
|
|
635
|
-
return
|
|
636
|
-
|
|
637
|
-
"can-submit":
|
|
620
|
+
const c = T("KInput"), k = T("KSelect"), g = T("KTextArea");
|
|
621
|
+
return S(), q("div", Ye, [
|
|
622
|
+
f(o(Oe), {
|
|
623
|
+
"can-submit": L.value,
|
|
638
624
|
config: s.config,
|
|
639
625
|
"edit-id": s.keyId,
|
|
640
|
-
"entity-type": o(
|
|
641
|
-
"error-message": t.errorMessage ||
|
|
642
|
-
"fetch-url":
|
|
643
|
-
"form-fields":
|
|
626
|
+
"entity-type": o(we).Key,
|
|
627
|
+
"error-message": t.errorMessage || O.value,
|
|
628
|
+
"fetch-url": J.value,
|
|
629
|
+
"form-fields": m.value,
|
|
644
630
|
"is-readonly": t.isReadonly,
|
|
645
|
-
onCancel:
|
|
646
|
-
"onFetch:error": i[8] || (i[8] = (
|
|
647
|
-
"onFetch:success":
|
|
648
|
-
onLoading: i[9] || (i[9] = (
|
|
649
|
-
onSubmit:
|
|
631
|
+
onCancel: P,
|
|
632
|
+
"onFetch:error": i[8] || (i[8] = (r) => e.$emit("error", r)),
|
|
633
|
+
"onFetch:success": Q,
|
|
634
|
+
onLoading: i[9] || (i[9] = (r) => e.$emit("loading", r)),
|
|
635
|
+
onSubmit: $
|
|
650
636
|
}, {
|
|
651
|
-
default:
|
|
652
|
-
|
|
653
|
-
description: o(
|
|
654
|
-
title: o(
|
|
637
|
+
default: u(() => [
|
|
638
|
+
f(o(he), {
|
|
639
|
+
description: o(d)("keys.form.sections.general.description"),
|
|
640
|
+
title: o(d)("keys.form.sections.general.title")
|
|
655
641
|
}, {
|
|
656
|
-
default:
|
|
657
|
-
|
|
642
|
+
default: u(() => [
|
|
643
|
+
f(c, {
|
|
658
644
|
modelValue: t.fields.key_id,
|
|
659
|
-
"onUpdate:modelValue": i[0] || (i[0] = (
|
|
645
|
+
"onUpdate:modelValue": i[0] || (i[0] = (r) => t.fields.key_id = r),
|
|
660
646
|
modelModifiers: { trim: !0 },
|
|
661
647
|
autocomplete: "off",
|
|
662
648
|
"data-testid": "key-form-id",
|
|
663
|
-
help: o(
|
|
664
|
-
label: o(
|
|
649
|
+
help: o(d)("keys.form.fields.id.help"),
|
|
650
|
+
label: o(d)("keys.form.fields.id.label"),
|
|
665
651
|
"label-attributes": {
|
|
666
|
-
info: o(
|
|
652
|
+
info: o(d)("keys.form.fields.id.tooltip"),
|
|
667
653
|
tooltipAttributes: { maxWidth: "400" }
|
|
668
654
|
},
|
|
669
|
-
placeholder: o(
|
|
655
|
+
placeholder: o(d)("keys.form.fields.id.placeholder"),
|
|
670
656
|
readonly: t.isReadonly,
|
|
671
657
|
required: "",
|
|
672
658
|
type: "text"
|
|
673
659
|
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"]),
|
|
674
|
-
|
|
660
|
+
f(c, {
|
|
675
661
|
modelValue: t.fields.name,
|
|
676
|
-
"onUpdate:modelValue": i[1] || (i[1] = (
|
|
662
|
+
"onUpdate:modelValue": i[1] || (i[1] = (r) => t.fields.name = r),
|
|
677
663
|
modelModifiers: { trim: !0 },
|
|
678
664
|
autocomplete: "off",
|
|
679
665
|
"data-testid": "key-form-name",
|
|
680
|
-
label: o(
|
|
681
|
-
placeholder: o(
|
|
666
|
+
label: o(d)("keys.form.fields.name.label"),
|
|
667
|
+
placeholder: o(d)("keys.form.fields.name.placeholder"),
|
|
682
668
|
readonly: t.isReadonly,
|
|
683
669
|
type: "text"
|
|
684
670
|
}, null, 8, ["modelValue", "label", "placeholder", "readonly"]),
|
|
685
|
-
|
|
671
|
+
f(k, {
|
|
686
672
|
modelValue: t.fields.key_set,
|
|
687
|
-
"onUpdate:modelValue": i[2] || (i[2] = (
|
|
688
|
-
clearable:
|
|
673
|
+
"onUpdate:modelValue": i[2] || (i[2] = (r) => t.fields.key_set = r),
|
|
674
|
+
clearable: W.value,
|
|
689
675
|
"data-testid": "key-form-key-set",
|
|
690
|
-
"dropdown-footer-text":
|
|
676
|
+
"dropdown-footer-text": ce.value,
|
|
691
677
|
"enable-filtering": "",
|
|
692
678
|
"filter-function": () => !0,
|
|
693
|
-
items:
|
|
694
|
-
label: o(
|
|
695
|
-
loading: o(
|
|
696
|
-
placeholder: o(
|
|
697
|
-
readonly:
|
|
679
|
+
items: H.value,
|
|
680
|
+
label: o(d)("keys.form.fields.key_set.label"),
|
|
681
|
+
loading: o(w),
|
|
682
|
+
placeholder: o(d)("keys.form.fields.key_set.placeholder"),
|
|
683
|
+
readonly: V.value,
|
|
698
684
|
width: "100%",
|
|
699
|
-
onQueryChange:
|
|
685
|
+
onQueryChange: N
|
|
700
686
|
}, {
|
|
701
|
-
loading:
|
|
702
|
-
|
|
687
|
+
loading: u(() => [
|
|
688
|
+
F("div", null, j(o(d)("keys.actions.loading")), 1)
|
|
703
689
|
]),
|
|
704
|
-
empty:
|
|
705
|
-
|
|
690
|
+
empty: u(() => [
|
|
691
|
+
F("div", Ze, j(o(d)("keys.search.no_results")), 1)
|
|
706
692
|
]),
|
|
707
|
-
"selected-item-template":
|
|
708
|
-
|
|
693
|
+
"selected-item-template": u(({ item: r }) => [
|
|
694
|
+
F("div", null, j(r.name), 1)
|
|
709
695
|
]),
|
|
710
|
-
"item-template":
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
696
|
+
"item-template": u(({ item: r }) => [
|
|
697
|
+
F("div", et, [
|
|
698
|
+
F("div", tt, j(r.name), 1),
|
|
699
|
+
F("div", lt, j(r.value), 1)
|
|
714
700
|
])
|
|
715
701
|
]),
|
|
716
702
|
_: 1
|
|
717
703
|
}, 8, ["modelValue", "clearable", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly"]),
|
|
718
|
-
|
|
719
|
-
|
|
704
|
+
z.value ? (S(), q("p", it, j(z.value), 1)) : ie("", !0),
|
|
705
|
+
f(c, {
|
|
720
706
|
modelValue: t.fields.tags,
|
|
721
|
-
"onUpdate:modelValue": i[3] || (i[3] = (
|
|
707
|
+
"onUpdate:modelValue": i[3] || (i[3] = (r) => t.fields.tags = r),
|
|
722
708
|
modelModifiers: { trim: !0 },
|
|
723
709
|
autocomplete: "off",
|
|
724
710
|
"data-testid": "key-form-tags",
|
|
725
|
-
help: o(
|
|
726
|
-
label: o(
|
|
711
|
+
help: o(d)("keys.form.fields.tags.help"),
|
|
712
|
+
label: o(d)("keys.form.fields.tags.label"),
|
|
727
713
|
"label-attributes": {
|
|
728
|
-
info: o(
|
|
714
|
+
info: o(d)("keys.form.fields.tags.tooltip"),
|
|
729
715
|
tooltipAttributes: { maxWidth: "400" }
|
|
730
716
|
},
|
|
731
|
-
placeholder: o(
|
|
717
|
+
placeholder: o(d)("keys.form.fields.tags.placeholder"),
|
|
732
718
|
readonly: t.isReadonly,
|
|
733
719
|
type: "text"
|
|
734
720
|
}, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])
|
|
735
721
|
]),
|
|
736
722
|
_: 1
|
|
737
723
|
}, 8, ["description", "title"]),
|
|
738
|
-
|
|
739
|
-
description: o(
|
|
724
|
+
f(o(he), {
|
|
725
|
+
description: o(d)("keys.form.sections.keys.description"),
|
|
740
726
|
"has-divider": "",
|
|
741
|
-
title: o(
|
|
727
|
+
title: o(d)("keys.form.sections.keys.title")
|
|
742
728
|
}, {
|
|
743
|
-
default:
|
|
744
|
-
|
|
745
|
-
|
|
729
|
+
default: u(() => [
|
|
730
|
+
F("div", ot, [
|
|
731
|
+
f(k, {
|
|
746
732
|
modelValue: t.fields.key_format,
|
|
747
|
-
"onUpdate:modelValue": i[4] || (i[4] = (
|
|
733
|
+
"onUpdate:modelValue": i[4] || (i[4] = (r) => t.fields.key_format = r),
|
|
748
734
|
"data-testid": "key-form-key-format",
|
|
749
|
-
items:
|
|
750
|
-
label: o(
|
|
735
|
+
items: E,
|
|
736
|
+
label: o(d)("keys.form.fields.key_format.label"),
|
|
751
737
|
readonly: t.isReadonly,
|
|
752
738
|
required: "",
|
|
753
739
|
width: "100%"
|
|
754
740
|
}, null, 8, ["modelValue", "label", "readonly"])
|
|
755
741
|
]),
|
|
756
|
-
t.fields.key_format === "jwk" ? (
|
|
742
|
+
t.fields.key_format === "jwk" ? (S(), A(g, {
|
|
757
743
|
key: 0,
|
|
758
744
|
modelValue: t.fields.jwk,
|
|
759
|
-
"onUpdate:modelValue": i[5] || (i[5] = (
|
|
745
|
+
"onUpdate:modelValue": i[5] || (i[5] = (r) => t.fields.jwk = r),
|
|
760
746
|
modelModifiers: { trim: !0 },
|
|
761
747
|
class: "key-form-textarea",
|
|
762
748
|
"data-testid": "key-form-jwk",
|
|
763
|
-
label: o(
|
|
749
|
+
label: o(d)("keys.form.fields.jwk.label"),
|
|
764
750
|
"label-attributes": {
|
|
765
|
-
info: o(
|
|
751
|
+
info: o(d)("keys.form.fields.jwk.tooltip"),
|
|
766
752
|
tooltipAttributes: { maxWidth: "400" }
|
|
767
753
|
},
|
|
768
|
-
placeholder: o(
|
|
754
|
+
placeholder: o(d)("keys.form.fields.jwk.placeholder"),
|
|
769
755
|
readonly: t.isReadonly,
|
|
770
756
|
required: ""
|
|
771
|
-
}, null, 8, ["modelValue", "label", "label-attributes", "placeholder", "readonly"])) :
|
|
772
|
-
t.fields.key_format === "pem" ? (
|
|
757
|
+
}, null, 8, ["modelValue", "label", "label-attributes", "placeholder", "readonly"])) : ie("", !0),
|
|
758
|
+
t.fields.key_format === "pem" ? (S(), A(g, {
|
|
773
759
|
key: 1,
|
|
774
760
|
modelValue: t.fields.private_key,
|
|
775
|
-
"onUpdate:modelValue": i[6] || (i[6] = (
|
|
761
|
+
"onUpdate:modelValue": i[6] || (i[6] = (r) => t.fields.private_key = r),
|
|
776
762
|
modelModifiers: { trim: !0 },
|
|
777
763
|
class: "key-form-textarea",
|
|
778
764
|
"data-testid": "key-form-private-key",
|
|
779
|
-
label: o(
|
|
780
|
-
placeholder: o(
|
|
765
|
+
label: o(d)("keys.form.fields.private_key.label"),
|
|
766
|
+
placeholder: o(d)("keys.form.fields.private_key.placeholder"),
|
|
781
767
|
readonly: t.isReadonly,
|
|
782
768
|
required: ""
|
|
783
|
-
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) :
|
|
784
|
-
t.fields.key_format === "pem" ? (
|
|
769
|
+
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) : ie("", !0),
|
|
770
|
+
t.fields.key_format === "pem" ? (S(), A(g, {
|
|
785
771
|
key: 2,
|
|
786
772
|
modelValue: t.fields.public_key,
|
|
787
|
-
"onUpdate:modelValue": i[7] || (i[7] = (
|
|
773
|
+
"onUpdate:modelValue": i[7] || (i[7] = (r) => t.fields.public_key = r),
|
|
788
774
|
modelModifiers: { trim: !0 },
|
|
789
775
|
class: "key-form-textarea",
|
|
790
776
|
"data-testid": "key-form-public-key",
|
|
791
|
-
label: o(
|
|
792
|
-
placeholder: o(
|
|
777
|
+
label: o(d)("keys.form.fields.public_key.label"),
|
|
778
|
+
placeholder: o(d)("keys.form.fields.public_key.placeholder"),
|
|
793
779
|
readonly: t.isReadonly,
|
|
794
780
|
required: ""
|
|
795
|
-
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) :
|
|
781
|
+
}, null, 8, ["modelValue", "label", "placeholder", "readonly"])) : ie("", !0)
|
|
796
782
|
]),
|
|
797
783
|
_: 1
|
|
798
784
|
}, 8, ["description", "title"])
|
|
@@ -802,7 +788,7 @@ const ve = {
|
|
|
802
788
|
]);
|
|
803
789
|
};
|
|
804
790
|
}
|
|
805
|
-
}),
|
|
791
|
+
}), kt = /* @__PURE__ */ Ce(st, [["__scopeId", "data-v-9d0b1ebc"]]), at = { class: "kong-ui-entities-keys-entity-config-card" }, rt = { key: 2 }, pt = /* @__PURE__ */ ue({
|
|
806
792
|
__name: "KeyConfigCard",
|
|
807
793
|
props: {
|
|
808
794
|
/** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
|
|
@@ -835,142 +821,142 @@ const ve = {
|
|
|
835
821
|
}
|
|
836
822
|
},
|
|
837
823
|
emits: ["loading", "fetch:error", "fetch:success", "navigation-click"],
|
|
838
|
-
setup(s, { emit:
|
|
839
|
-
var
|
|
840
|
-
const
|
|
841
|
-
var
|
|
842
|
-
return (
|
|
843
|
-
}),
|
|
844
|
-
var
|
|
845
|
-
|
|
824
|
+
setup(s, { emit: U }) {
|
|
825
|
+
var P;
|
|
826
|
+
const h = U, l = s, { axiosInstance: y } = ke((P = l.config) == null ? void 0 : P.axiosRequestConfig), { convertKeyToTitle: d } = Je(), { i18n: { t: C } } = pe.useI18n(), x = _(() => l.keySetId ? `${B.form[l.config.app].edit.forKeySet}`.replace(/{keySetId}/gi, l.keySetId) : B.form[l.config.app].edit.all), J = _(() => {
|
|
827
|
+
var n;
|
|
828
|
+
return (n = B.form[l.config.app]) == null ? void 0 : n.getKeySet;
|
|
829
|
+
}), K = b(), t = b({}), I = b(l.keySetId || ""), E = b(""), V = b(!1), W = async (n) => {
|
|
830
|
+
var m;
|
|
831
|
+
K.value = n, I.value = (m = n == null ? void 0 : n.set) == null ? void 0 : m.id, h("fetch:success", n), L(n);
|
|
846
832
|
};
|
|
847
|
-
|
|
848
|
-
var
|
|
849
|
-
if (!
|
|
833
|
+
Z(I, async () => {
|
|
834
|
+
var m, $;
|
|
835
|
+
if (!I.value)
|
|
850
836
|
return;
|
|
851
|
-
let
|
|
852
|
-
l.config.app === "konnect" ?
|
|
837
|
+
let n = `${l.config.apiBaseUrl}${J.value}`;
|
|
838
|
+
l.config.app === "konnect" ? n = n.replace(/{controlPlaneId}/gi, ((m = l.config) == null ? void 0 : m.controlPlaneId) || "").replace(/{keySetId}/gi, I.value || "") : l.config.app === "kongManager" && (n = n.replace(/\/{workspace}/gi, ($ = l.config) != null && $.workspace ? `/${l.config.workspace}` : "").replace(/{keySetId}/gi, I.value || ""));
|
|
853
839
|
try {
|
|
854
|
-
|
|
855
|
-
const { data: v } = await y.get(
|
|
856
|
-
validateStatus: (
|
|
840
|
+
V.value = !0;
|
|
841
|
+
const { data: v } = await y.get(n, {
|
|
842
|
+
validateStatus: (w) => w === 404 || w >= 200 && w < 300
|
|
857
843
|
// in case KeySet is deleted
|
|
858
844
|
});
|
|
859
|
-
|
|
845
|
+
E.value = (v == null ? void 0 : v.name) || (v == null ? void 0 : v.id);
|
|
860
846
|
} catch (v) {
|
|
861
|
-
|
|
847
|
+
h("fetch:error", v);
|
|
862
848
|
} finally {
|
|
863
|
-
|
|
849
|
+
V.value = !1;
|
|
864
850
|
}
|
|
865
851
|
}, { immediate: !0 });
|
|
866
|
-
const
|
|
867
|
-
var
|
|
852
|
+
const L = (n) => {
|
|
853
|
+
var m, $;
|
|
868
854
|
try {
|
|
869
|
-
if (
|
|
870
|
-
const v = JSON.parse(
|
|
871
|
-
Object.keys(v).forEach((
|
|
855
|
+
if (n.jwk) {
|
|
856
|
+
const v = JSON.parse(n.jwk);
|
|
857
|
+
Object.keys(v).forEach((w) => {
|
|
872
858
|
t.value = {
|
|
873
859
|
...t.value,
|
|
874
|
-
[`jwk.${
|
|
860
|
+
[`jwk.${w}`]: v[w]
|
|
875
861
|
};
|
|
876
862
|
});
|
|
877
863
|
} else
|
|
878
864
|
t.value = {
|
|
879
|
-
"pem.public_key": (
|
|
880
|
-
"pem.private_key": (
|
|
865
|
+
"pem.public_key": (m = n == null ? void 0 : n.pem) == null ? void 0 : m.public_key,
|
|
866
|
+
"pem.private_key": ($ = n == null ? void 0 : n.pem) == null ? void 0 : $.private_key
|
|
881
867
|
};
|
|
882
868
|
} catch (v) {
|
|
883
|
-
|
|
869
|
+
h("fetch:error", v);
|
|
884
870
|
}
|
|
885
871
|
return t;
|
|
886
|
-
},
|
|
872
|
+
}, Q = b({
|
|
887
873
|
id: {},
|
|
888
874
|
name: {
|
|
889
|
-
tooltip:
|
|
875
|
+
tooltip: C("keys.form.fields.name.tooltip")
|
|
890
876
|
},
|
|
891
877
|
last_updated: {},
|
|
892
878
|
created: {},
|
|
893
879
|
set: {
|
|
894
|
-
label:
|
|
895
|
-
section:
|
|
896
|
-
tooltip:
|
|
880
|
+
label: C("keys.form.fields.set.label"),
|
|
881
|
+
section: ye.Basic,
|
|
882
|
+
tooltip: C("keys.form.fields.set.tooltip"),
|
|
897
883
|
order: 5
|
|
898
884
|
},
|
|
899
885
|
kid: {
|
|
900
|
-
label:
|
|
901
|
-
section:
|
|
902
|
-
tooltip:
|
|
886
|
+
label: C("keys.form.fields.kid.label"),
|
|
887
|
+
section: ye.Basic,
|
|
888
|
+
tooltip: C("keys.form.fields.kid.tooltip")
|
|
903
889
|
},
|
|
904
890
|
tags: {
|
|
905
|
-
tooltip:
|
|
891
|
+
tooltip: C("keys.form.fields.tags.tooltip")
|
|
906
892
|
},
|
|
907
893
|
// advanced fields
|
|
908
894
|
jwk: {
|
|
909
|
-
label:
|
|
910
|
-
type:
|
|
895
|
+
label: C("keys.form.fields.jwk.label"),
|
|
896
|
+
type: fe.Json
|
|
911
897
|
},
|
|
912
898
|
pem: {
|
|
913
|
-
section:
|
|
914
|
-
label:
|
|
915
|
-
type:
|
|
899
|
+
section: ye.Advanced,
|
|
900
|
+
label: C("keys.form.fields.key_format.options.pem"),
|
|
901
|
+
type: fe.Json
|
|
916
902
|
}
|
|
917
903
|
});
|
|
918
|
-
return (
|
|
919
|
-
var v,
|
|
920
|
-
const
|
|
921
|
-
return
|
|
922
|
-
|
|
904
|
+
return (n, m) => {
|
|
905
|
+
var v, w;
|
|
906
|
+
const $ = T("KSkeleton");
|
|
907
|
+
return S(), q("div", at, [
|
|
908
|
+
f(o(We), {
|
|
923
909
|
config: s.config,
|
|
924
910
|
"config-card-doc": s.configCardDoc,
|
|
925
|
-
"config-schema":
|
|
926
|
-
"entity-type": o(
|
|
927
|
-
"fetch-url":
|
|
911
|
+
"config-schema": Q.value,
|
|
912
|
+
"entity-type": o(we).Key,
|
|
913
|
+
"fetch-url": x.value,
|
|
928
914
|
"hide-title": s.hideTitle,
|
|
929
|
-
"onFetch:error":
|
|
930
|
-
"onFetch:success":
|
|
931
|
-
onLoading:
|
|
932
|
-
},
|
|
933
|
-
set:
|
|
934
|
-
|
|
915
|
+
"onFetch:error": m[0] || (m[0] = (p) => n.$emit("fetch:error", p)),
|
|
916
|
+
"onFetch:success": W,
|
|
917
|
+
onLoading: m[1] || (m[1] = (p) => n.$emit("loading", p))
|
|
918
|
+
}, xe({
|
|
919
|
+
set: u(({ row: p }) => [
|
|
920
|
+
V.value ? (S(), A($, {
|
|
935
921
|
key: 0,
|
|
936
922
|
"data-testid": "key-set-name-loader",
|
|
937
923
|
type: "spinner"
|
|
938
|
-
})) : p.value && p.value.id ===
|
|
924
|
+
})) : p.value && p.value.id === I.value && E.value ? (S(), A(o(Le), {
|
|
939
925
|
key: 1,
|
|
940
926
|
item: {
|
|
941
927
|
key: p.value.id,
|
|
942
|
-
value:
|
|
943
|
-
type: o(
|
|
928
|
+
value: E.value,
|
|
929
|
+
type: o(fe).LinkInternal
|
|
944
930
|
},
|
|
945
|
-
onClick: (
|
|
946
|
-
}, null, 8, ["item", "onClick"])) : (
|
|
931
|
+
onClick: (ee) => n.$emit("navigation-click", p.value.id, "key-sets")
|
|
932
|
+
}, null, 8, ["item", "onClick"])) : (S(), q("div", rt, j("–")))
|
|
947
933
|
]),
|
|
948
934
|
_: 2
|
|
949
935
|
}, [
|
|
950
|
-
(v =
|
|
936
|
+
(v = K.value) != null && v.jwk ? {
|
|
951
937
|
name: "jwk",
|
|
952
|
-
fn:
|
|
953
|
-
(
|
|
938
|
+
fn: u(() => [
|
|
939
|
+
(S(!0), q(ge, null, ve(Object.keys(t.value), (p) => (S(), A(o(_e), {
|
|
954
940
|
key: p,
|
|
955
941
|
"data-testid": `${p}`,
|
|
956
942
|
item: {
|
|
957
943
|
key: p,
|
|
958
|
-
label: o(
|
|
944
|
+
label: o(d)(p),
|
|
959
945
|
value: t.value[p]
|
|
960
946
|
}
|
|
961
947
|
}, null, 8, ["data-testid", "item"]))), 128))
|
|
962
948
|
]),
|
|
963
949
|
key: "0"
|
|
964
950
|
} : void 0,
|
|
965
|
-
(
|
|
951
|
+
(w = K.value) != null && w.pem ? {
|
|
966
952
|
name: "pem",
|
|
967
|
-
fn:
|
|
968
|
-
(
|
|
953
|
+
fn: u(() => [
|
|
954
|
+
(S(!0), q(ge, null, ve(Object.keys(t.value), (p) => (S(), A(o(_e), {
|
|
969
955
|
key: p,
|
|
970
956
|
"data-testid": `${p}`,
|
|
971
957
|
item: {
|
|
972
958
|
key: p,
|
|
973
|
-
label: o(
|
|
959
|
+
label: o(d)(p),
|
|
974
960
|
value: t.value[p]
|
|
975
961
|
}
|
|
976
962
|
}, null, 8, ["data-testid", "item"]))), 128))
|
|
@@ -983,7 +969,7 @@ const ve = {
|
|
|
983
969
|
}
|
|
984
970
|
});
|
|
985
971
|
export {
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
972
|
+
pt as KeyConfigCard,
|
|
973
|
+
kt as KeyForm,
|
|
974
|
+
ut as KeyList
|
|
989
975
|
};
|