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