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