@kong-ui-public/entities-snis 3.7.28-pr.2132.c7fba69a4.0 → 3.7.28

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.
@@ -0,0 +1,707 @@
1
+ import { defineComponent as ge, computed as g, ref as k, watch as le, onBeforeMount as ye, resolveComponent as D, openBlock as b, createElementBlock as G, createVNode as u, unref as a, createSlots as de, withCtx as d, createBlock as F, Teleport as ue, createElementVNode as L, createCommentVNode as ve, createTextVNode as U, toDisplayString as I, reactive as fe } from "vue";
2
+ import { useRouter as he } from "vue-router";
3
+ import { createI18n as Ce, i18nTComponent as _e } from "@kong-ui-public/i18n";
4
+ import { useAxios as be, useTableState as Ee, useFetcher as $e, useDeleteUrlBuilder as we, FetcherStatus as Ne, EntityBaseTable as Me, EntityFilter as xe, PermissionsWrapper as se, TableTags as De, EntityEmptyState as Fe, EntityDeleteModal as Re, EntityTypes as Be, useErrors as Te, EntityBaseFormType as re, useDebouncedFilter as Ve, EntityBaseForm as Ke, SupportedEntityType as Oe, EntityFormSection as pe } from "@kong-ui-public/entities-shared";
5
+ import { BookIcon as me, AddIcon as Ue, CloudIcon as Pe } from "@kong/icons";
6
+ const qe = {
7
+ create: "New SNI",
8
+ copy_id: "Copy ID",
9
+ copy_json: "Copy JSON",
10
+ edit: "Edit",
11
+ delete: "Delete",
12
+ clear: "Clear",
13
+ loading: "Loading..."
14
+ }, Ae = {
15
+ placeholder: "Filter by exact name or ID",
16
+ no_results: "No results found"
17
+ }, Le = {
18
+ title: "SNIs",
19
+ list: {
20
+ toolbar_actions: {
21
+ new: "New SNI"
22
+ },
23
+ table_headers: {
24
+ name: "Name",
25
+ id: "ID",
26
+ certificate_id: "SSL Certificate ID",
27
+ tags: "Tags"
28
+ },
29
+ empty_state: {
30
+ title: "Configure a New SNI",
31
+ description: "SNIs are used to map hostnames to a certificate."
32
+ },
33
+ empty_state_v2: {
34
+ title: "Configure your first SNI",
35
+ description: "Server Name Indications (SNIs) map hostnames to SSL/TLS certificates, enabling secure connections for domain-specific traffic.",
36
+ group: "SNIs created in gateways within this group will automatically appear here.",
37
+ create_cta: "New SNI"
38
+ }
39
+ }
40
+ }, je = {
41
+ sections: {
42
+ general: {
43
+ title: "General Information",
44
+ description: "General information will help identify and manage this SNI."
45
+ },
46
+ certificate: {
47
+ title: "Certificate",
48
+ description: "Map an existing Certificate object to hostnames"
49
+ }
50
+ },
51
+ fields: {
52
+ name: {
53
+ label: "Name",
54
+ placeholder: "Enter a unique name for this SNI"
55
+ },
56
+ tags: {
57
+ label: "Tags",
58
+ placeholder: "Enter a list of tags separated by comma",
59
+ help: "e.g. tag1, tag2, tag3",
60
+ tooltip: "An optional set of strings for grouping and filtering, separated by commas."
61
+ },
62
+ certificate_id: {
63
+ label: "SSL Certificate ID",
64
+ placeholder: "Enter or select a Certificate ID",
65
+ footer: "Search by exact ID to find certificates not included in the list"
66
+ }
67
+ }
68
+ }, Je = {
69
+ delete: "The SNI could not be deleted at this time.",
70
+ general: "SNIs could not be retrieved",
71
+ certificates: {
72
+ fetch: "Could not fetch available certificates",
73
+ invalid: "Please select a valid certificate ID"
74
+ },
75
+ copy: "Failed to copy to clipboard"
76
+ }, Qe = {
77
+ success: "Copied {val} to clipboard",
78
+ success_brief: "Successfully copied to clipboard"
79
+ }, ze = {
80
+ actions: qe,
81
+ search: Ae,
82
+ snis: Le,
83
+ form: je,
84
+ delete: {
85
+ title: "Delete an SNI",
86
+ description: "This action cannot be reversed so make sure to check the SNI usage before deleting."
87
+ },
88
+ errors: Je,
89
+ copy: Qe
90
+ };
91
+ function He() {
92
+ const i = Ce("en-us", ze);
93
+ return {
94
+ i18n: i,
95
+ i18nT: _e(i)
96
+ // Translation component <i18n-t>
97
+ };
98
+ }
99
+ const ke = {
100
+ useI18n: He
101
+ }, P = "/v2/control-planes/{controlPlaneId}/core-entities", q = "/{workspace}", A = {
102
+ list: {
103
+ konnect: {
104
+ all: `${P}/snis`
105
+ },
106
+ kongManager: {
107
+ all: `${q}/snis`
108
+ }
109
+ },
110
+ form: {
111
+ konnect: {
112
+ create: `${P}/snis`,
113
+ edit: `${P}/snis/{id}`,
114
+ validate: `${P}/v1/schemas/json/sni/validate`,
115
+ certificates: `${P}/certificates`
116
+ },
117
+ kongManager: {
118
+ create: `${q}/snis`,
119
+ edit: `${q}/snis/{id}`,
120
+ validate: `${q}/schemas/snis/validate`,
121
+ certificates: `${q}/certificates`
122
+ }
123
+ }
124
+ }, Ge = "#00abd2", We = "24px", Xe = { class: "kong-ui-entities-snis-list" }, Ze = { class: "button-row" }, Ye = { class: "empty-state-icon-gateway" }, et = { key: 1 }, tt = /* @__PURE__ */ ge({
125
+ __name: "SniList",
126
+ props: {
127
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
128
+ config: {
129
+ type: Object,
130
+ required: !0,
131
+ validator: (i) => !(!i || !["konnect", "kongManager"].includes(i == null ? void 0 : i.app) || !i.createRoute || !i.getViewRoute || !i.getEditRoute || i.app === "kongManager" && !i.isExactMatch && !i.filterSchema)
132
+ },
133
+ // used to override the default identifier for the cache entry
134
+ cacheIdentifier: {
135
+ type: String,
136
+ default: ""
137
+ },
138
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
139
+ canCreate: {
140
+ type: Function,
141
+ required: !1,
142
+ default: async () => !0
143
+ },
144
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
145
+ canDelete: {
146
+ type: Function,
147
+ required: !1,
148
+ default: async () => !0
149
+ },
150
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
151
+ canEdit: {
152
+ type: Function,
153
+ required: !1,
154
+ default: async () => !0
155
+ },
156
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
157
+ canRetrieve: {
158
+ type: Function,
159
+ required: !1,
160
+ default: async () => !0
161
+ },
162
+ /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
163
+ useActionOutside: {
164
+ type: Boolean,
165
+ default: !1
166
+ },
167
+ /**
168
+ * Enables the new empty state design, this prop can be removed when
169
+ * the khcp-14756-empty-states-m2 FF is removed.
170
+ */
171
+ enableV2EmptyStates: {
172
+ type: Boolean,
173
+ default: !1
174
+ }
175
+ },
176
+ emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success"],
177
+ setup(i, { emit: R }) {
178
+ var o;
179
+ const y = R, t = i, { i18n: { t: l } } = ke.useI18n(), m = he(), { axiosInstance: W } = be((o = t.config) == null ? void 0 : o.axiosRequestConfig), { hasRecords: C, handleStateChange: X } = Ee(() => S.value), E = g(() => C.value && t.config.app === "konnect"), $ = g(() => !t.enableV2EmptyStates && t.config.app === "konnect"), s = g(() => t.config.app !== "kongManager" || !!t.config.disableSorting), w = {
180
+ // the Name column is non-hidable
181
+ name: { label: l("snis.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
182
+ certificate: { label: l("snis.list.table_headers.certificate_id"), sortable: !1 },
183
+ tags: { label: l("snis.list.table_headers.tags"), sortable: !1 }
184
+ }, Z = w, Y = (e) => ({
185
+ style: {
186
+ maxWidth: e.headerKey === "name" ? "250px" : e.headerKey === "certificate" ? "350px" : null
187
+ }
188
+ }), j = g(() => {
189
+ var c, r;
190
+ let e = `${t.config.apiBaseUrl}${A.list[t.config.app].all}`;
191
+ return t.config.app === "konnect" ? e = e.replace(/{controlPlaneId}/gi, ((c = t.config) == null ? void 0 : c.controlPlaneId) || "") : t.config.app === "kongManager" && (e = e.replace(/\/{workspace}/gi, (r = t.config) != null && r.workspace ? `/${t.config.workspace}` : "")), e;
192
+ }), S = k(""), B = g(() => {
193
+ const e = t.config.app === "konnect" || t.config.isExactMatch;
194
+ if (e)
195
+ return {
196
+ isExactMatch: e,
197
+ placeholder: l("search.placeholder")
198
+ };
199
+ const { name: c } = w;
200
+ return {
201
+ isExactMatch: e,
202
+ fields: { name: c },
203
+ schema: t.config.filterSchema
204
+ };
205
+ }), {
206
+ fetcher: _,
207
+ fetcherState: ee,
208
+ fetcherCacheKey: T
209
+ } = $e(g(() => ({ ...t.config, cacheIdentifier: t.cacheIdentifier })), j), te = () => {
210
+ S.value = "";
211
+ }, ae = () => {
212
+ T.value++;
213
+ }, N = k(null), V = k({
214
+ ctaPath: t.config.createRoute,
215
+ ctaText: void 0,
216
+ message: `${l("snis.list.empty_state.description")}${t.config.additionMessageForEmptyState ? ` ${t.config.additionMessageForEmptyState}` : ""}`,
217
+ title: l("snis.title")
218
+ }), ie = async (e, c) => {
219
+ const r = e.id;
220
+ if (!await c(r)) {
221
+ y("copy:error", {
222
+ entity: e,
223
+ field: "id",
224
+ message: l("errors.copy")
225
+ });
226
+ return;
227
+ }
228
+ y("copy:success", {
229
+ entity: e,
230
+ field: "id",
231
+ message: l("copy.success", { val: r })
232
+ });
233
+ }, ne = async (e, c) => {
234
+ const r = JSON.stringify(e);
235
+ if (!await c(r)) {
236
+ y("copy:error", {
237
+ entity: e,
238
+ message: l("errors.copy")
239
+ });
240
+ return;
241
+ }
242
+ y("copy:success", {
243
+ entity: e,
244
+ message: l("copy.success_brief")
245
+ });
246
+ }, oe = (e) => ({
247
+ label: l("actions.edit"),
248
+ to: t.config.getEditRoute(e)
249
+ }), h = k(void 0), M = k(!1), x = k(!1), J = k(""), K = we(t.config, j.value), Q = (e) => {
250
+ h.value = e, M.value = !0;
251
+ }, z = () => {
252
+ M.value = !1, h.value = void 0;
253
+ }, H = async () => {
254
+ var e, c, r;
255
+ if ((e = h.value) != null && e.id) {
256
+ x.value = !0;
257
+ try {
258
+ await W.delete(K(h.value.id)), y("delete:success", h.value), x.value = !1, z(), T.value++;
259
+ } catch (v) {
260
+ J.value = ((r = (c = v.response) == null ? void 0 : c.data) == null ? void 0 : r.message) || v.message || l("errors.delete"), y("error", v);
261
+ } finally {
262
+ x.value = !1;
263
+ }
264
+ }
265
+ }, n = () => {
266
+ m.push(t.config.createRoute);
267
+ };
268
+ return le(ee, (e) => {
269
+ var c, r, v;
270
+ if (e.status === Ne.Error) {
271
+ N.value = {
272
+ title: l("errors.general")
273
+ }, (v = (r = (c = e.error) == null ? void 0 : c.response) == null ? void 0 : r.data) != null && v.message && (N.value.message = e.error.response.data.message), y("error", e.error);
274
+ return;
275
+ }
276
+ N.value = null;
277
+ }), ye(async () => {
278
+ await t.canCreate() && (V.value.title = l("snis.list.empty_state.title"), V.value.ctaText = l("actions.create"));
279
+ }), (e, c) => {
280
+ const r = D("KButton"), v = D("KCopy"), f = D("KDropdownItem"), ce = D("KClipboardProvider");
281
+ return b(), G("div", Xe, [
282
+ u(a(Me), {
283
+ "cache-identifier": i.cacheIdentifier,
284
+ "cell-attributes": Y,
285
+ "disable-row-click": !0,
286
+ "disable-sorting": s.value,
287
+ "empty-state-options": V.value,
288
+ "enable-entity-actions": "",
289
+ "error-message": N.value,
290
+ fetcher: a(_),
291
+ "fetcher-cache-key": a(T),
292
+ "pagination-type": "offset",
293
+ "preferences-storage-key": "kong-ui-entities-snis-list",
294
+ query: S.value,
295
+ "table-headers": a(Z),
296
+ onClearSearchInput: te,
297
+ onSort: ae,
298
+ onState: a(X)
299
+ }, de({
300
+ "toolbar-filter": d(() => [
301
+ u(a(xe), {
302
+ modelValue: S.value,
303
+ "onUpdate:modelValue": c[0] || (c[0] = (p) => S.value = p),
304
+ config: B.value
305
+ }, null, 8, ["modelValue", "config"])
306
+ ]),
307
+ "toolbar-button": d(() => [
308
+ (b(), F(ue, {
309
+ disabled: !i.useActionOutside,
310
+ to: "#kong-ui-app-page-header-action-button"
311
+ }, [
312
+ L("div", Ze, [
313
+ E.value ? (b(), F(r, {
314
+ key: 0,
315
+ appearance: "secondary",
316
+ class: "open-learning-hub",
317
+ "data-testid": "snis-learn-more-button",
318
+ icon: "",
319
+ onClick: c[1] || (c[1] = (p) => e.$emit("click:learn-more"))
320
+ }, {
321
+ default: d(() => [
322
+ u(a(me), { decorative: "" })
323
+ ]),
324
+ _: 1
325
+ })) : ve("", !0),
326
+ u(a(se), {
327
+ "auth-function": () => i.canCreate()
328
+ }, {
329
+ default: d(() => [
330
+ u(r, {
331
+ appearance: "primary",
332
+ "data-testid": "toolbar-add-sni",
333
+ size: i.useActionOutside ? "medium" : "large",
334
+ to: i.config.createRoute
335
+ }, {
336
+ default: d(() => [
337
+ u(a(Ue)),
338
+ U(" " + I(a(l)("snis.list.toolbar_actions.new")), 1)
339
+ ]),
340
+ _: 1
341
+ }, 8, ["size", "to"])
342
+ ]),
343
+ _: 1
344
+ }, 8, ["auth-function"])
345
+ ])
346
+ ], 8, ["disabled"]))
347
+ ]),
348
+ name: d(({ rowValue: p }) => [
349
+ L("b", null, I(p ?? "-"), 1)
350
+ ]),
351
+ certificate: d(({ row: p }) => [
352
+ p.certificate && p.certificate.id ? (b(), F(v, {
353
+ key: 0,
354
+ class: "copy-certificate-uuid",
355
+ "data-testid": "copy-certificate-uuid",
356
+ text: p.certificate.id,
357
+ truncate: ""
358
+ }, null, 8, ["text"])) : (b(), G("span", et, "-"))
359
+ ]),
360
+ tags: d(({ rowValue: p }) => [
361
+ u(a(De), { tags: p }, null, 8, ["tags"])
362
+ ]),
363
+ actions: d(({ row: p }) => [
364
+ u(ce, null, {
365
+ default: d(({ copyToClipboard: O }) => [
366
+ u(f, {
367
+ "data-testid": "action-entity-copy-id",
368
+ onClick: (Se) => ie(p, O)
369
+ }, {
370
+ default: d(() => [
371
+ U(I(a(l)("actions.copy_id")), 1)
372
+ ]),
373
+ _: 2
374
+ }, 1032, ["onClick"])
375
+ ]),
376
+ _: 2
377
+ }, 1024),
378
+ u(ce, null, {
379
+ default: d(({ copyToClipboard: O }) => [
380
+ u(f, {
381
+ "data-testid": "action-entity-copy-json",
382
+ onClick: (Se) => ne(p, O)
383
+ }, {
384
+ default: d(() => [
385
+ U(I(a(l)("actions.copy_json")), 1)
386
+ ]),
387
+ _: 2
388
+ }, 1032, ["onClick"])
389
+ ]),
390
+ _: 2
391
+ }, 1024),
392
+ u(a(se), {
393
+ "auth-function": () => i.canEdit(p)
394
+ }, {
395
+ default: d(() => [
396
+ u(f, {
397
+ "data-testid": "action-entity-edit",
398
+ item: oe(p.id)
399
+ }, null, 8, ["item"])
400
+ ]),
401
+ _: 2
402
+ }, 1032, ["auth-function"]),
403
+ u(a(se), {
404
+ "auth-function": () => i.canDelete(p)
405
+ }, {
406
+ default: d(() => [
407
+ u(f, {
408
+ danger: "",
409
+ "data-testid": "action-entity-delete",
410
+ "has-divider": "",
411
+ onClick: (O) => Q(p)
412
+ }, {
413
+ default: d(() => [
414
+ U(I(a(l)("actions.delete")), 1)
415
+ ]),
416
+ _: 2
417
+ }, 1032, ["onClick"])
418
+ ]),
419
+ _: 2
420
+ }, 1032, ["auth-function"])
421
+ ]),
422
+ _: 2
423
+ }, [
424
+ !a(C) && $.value ? {
425
+ name: "outside-actions",
426
+ fn: d(() => [
427
+ (b(), F(ue, {
428
+ disabled: !i.useActionOutside,
429
+ to: "#kong-ui-app-page-header-action-button"
430
+ }, [
431
+ u(r, {
432
+ appearance: "secondary",
433
+ class: "open-learning-hub",
434
+ "data-testid": "sni-learn-more-button",
435
+ icon: "",
436
+ onClick: c[2] || (c[2] = (p) => e.$emit("click:learn-more"))
437
+ }, {
438
+ default: d(() => [
439
+ u(a(me), { decorative: "" })
440
+ ]),
441
+ _: 1
442
+ })
443
+ ], 8, ["disabled"]))
444
+ ]),
445
+ key: "0"
446
+ } : void 0,
447
+ !S.value && i.enableV2EmptyStates && i.config.app === "konnect" ? {
448
+ name: "empty-state",
449
+ fn: d(() => {
450
+ var p;
451
+ return [
452
+ u(a(Fe), {
453
+ "action-button-text": a(l)("snis.list.toolbar_actions.new"),
454
+ appearance: "secondary",
455
+ "can-create": () => i.canCreate(),
456
+ "data-testid": "snis-entity-empty-state",
457
+ description: a(l)("snis.list.empty_state_v2.description"),
458
+ "learn-more": i.config.app === "konnect",
459
+ title: a(l)("snis.list.empty_state_v2.title"),
460
+ "onClick:create": n,
461
+ "onClick:learnMore": c[3] || (c[3] = (O) => e.$emit("click:learn-more"))
462
+ }, de({
463
+ image: d(() => [
464
+ L("div", Ye, [
465
+ u(a(Pe), {
466
+ color: a(Ge),
467
+ size: a(We)
468
+ }, null, 8, ["color", "size"])
469
+ ])
470
+ ]),
471
+ _: 2
472
+ }, [
473
+ (p = i.config) != null && p.isControlPlaneGroup ? {
474
+ name: "message",
475
+ fn: d(() => [
476
+ U(I(a(l)("snis.list.empty_state_v2.group")), 1)
477
+ ]),
478
+ key: "0"
479
+ } : void 0
480
+ ]), 1032, ["action-button-text", "can-create", "description", "learn-more", "title"])
481
+ ];
482
+ }),
483
+ key: "1"
484
+ } : void 0
485
+ ]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers", "onState"]),
486
+ u(a(Re), {
487
+ "action-pending": x.value,
488
+ description: a(l)("delete.description"),
489
+ "entity-name": h.value && (h.value.name || h.value.id),
490
+ "entity-type": a(Be).SNI,
491
+ error: J.value,
492
+ "need-confirm": !1,
493
+ title: a(l)("delete.title"),
494
+ visible: M.value,
495
+ onCancel: z,
496
+ onProceed: H
497
+ }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
498
+ ]);
499
+ };
500
+ }
501
+ }), Ie = (i, R) => {
502
+ const y = i.__vccOpts || i;
503
+ for (const [t, l] of R)
504
+ y[t] = l;
505
+ return y;
506
+ }, ut = /* @__PURE__ */ Ie(tt, [["__scopeId", "data-v-9ec44cca"]]), at = { class: "kong-ui-entities-snis-form" }, it = { "data-testid": "no-search-results" }, nt = {
507
+ key: 2,
508
+ class: "invalid-certificate-message",
509
+ "data-testid": "invalid-certificate-message"
510
+ }, ot = /* @__PURE__ */ ge({
511
+ __name: "SniForm",
512
+ props: {
513
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
514
+ config: {
515
+ type: Object,
516
+ required: !0,
517
+ validator: (i) => !(!i || !["konnect", "kongManager"].includes(i == null ? void 0 : i.app) || i.app === "konnect" && !i.controlPlaneId || i.app === "kongManager" && typeof i.workspace != "string" || !i.cancelRoute)
518
+ },
519
+ /** If a valid SNI ID is provided, it will put the form in Edit mode instead of Create */
520
+ sniId: {
521
+ type: String,
522
+ required: !1,
523
+ default: ""
524
+ }
525
+ },
526
+ emits: ["update", "error", "loading"],
527
+ setup(i, { emit: R }) {
528
+ var H;
529
+ const y = R, t = i, l = he(), { i18n: { t: m } } = ke.useI18n(), { getMessageFromError: W } = Te(), { axiosInstance: C } = be((H = t.config) == null ? void 0 : H.axiosRequestConfig), X = g(() => A.form[t.config.app].edit), E = g(() => t.sniId ? re.Edit : re.Create), $ = g(() => t.config.certificateId && E.value === re.Create ? t.config.certificateId : ""), s = fe({
530
+ fields: {
531
+ name: "",
532
+ tags: "",
533
+ certificate_id: ""
534
+ },
535
+ isReadonly: !1,
536
+ errorMessage: ""
537
+ }), w = fe({
538
+ name: "",
539
+ tags: "",
540
+ certificate_id: ""
541
+ }), Z = g(() => JSON.stringify(s.fields) !== JSON.stringify(w) && !!s.fields.name && !!(s.fields.certificate_id || $.value)), Y = (n) => {
542
+ var o, e;
543
+ s.fields.name = (n == null ? void 0 : n.name) || "", s.fields.tags = ((o = n == null ? void 0 : n.tags) == null ? void 0 : o.join(", ")) || "", s.fields.certificate_id = ((e = n == null ? void 0 : n.certificate) == null ? void 0 : e.id) || "", Object.assign(w, s.fields);
544
+ }, j = () => {
545
+ l.push(t.config.cancelRoute);
546
+ }, S = g(() => {
547
+ var o, e;
548
+ let n = `${t.config.apiBaseUrl}${A.form[t.config.app].validate}`;
549
+ return t.config.app === "konnect" ? n = n.replace(/{controlPlaneId}/gi, ((o = t.config) == null ? void 0 : o.controlPlaneId) || "") : t.config.app === "kongManager" && (n = n.replace(/\/{workspace}/gi, (e = t.config) != null && e.workspace ? `/${t.config.workspace}` : "")), n = n.replace(/{id}/gi, t.sniId), n;
550
+ }), B = g(() => {
551
+ var o, e;
552
+ let n = `${t.config.apiBaseUrl}${A.form[t.config.app][E.value]}`;
553
+ return t.config.app === "konnect" ? n = n.replace(/{controlPlaneId}/gi, ((o = t.config) == null ? void 0 : o.controlPlaneId) || "") : t.config.app === "kongManager" && (n = n.replace(/\/{workspace}/gi, (e = t.config) != null && e.workspace ? `/${t.config.workspace}` : "")), n = n.replace(/{id}/gi, t.sniId), n;
554
+ }), _ = g(() => {
555
+ var n, o;
556
+ return {
557
+ name: s.fields.name,
558
+ tags: (o = (n = s.fields.tags.split(",")) == null ? void 0 : n.map((e) => String(e || "").trim())) == null ? void 0 : o.filter((e) => e !== ""),
559
+ certificate: { id: $.value || s.fields.certificate_id }
560
+ };
561
+ }), ee = async () => {
562
+ var n, o, e, c, r, v;
563
+ try {
564
+ s.isReadonly = !0;
565
+ let f;
566
+ await C.post(S.value, _.value), E.value === "create" ? f = await C.post(B.value, _.value) : E.value === "edit" && (f = ((n = t.config) == null ? void 0 : n.app) === "konnect" ? await C.put(B.value, _.value) : await C.patch(B.value, _.value)), s.fields.name = ((o = f == null ? void 0 : f.data) == null ? void 0 : o.name) || "", s.fields.tags = ((c = (e = f == null ? void 0 : f.data) == null ? void 0 : e.tags) == null ? void 0 : c.join(", ")) || "", s.fields.certificate_id = ((v = (r = f == null ? void 0 : f.data) == null ? void 0 : r.certificate) == null ? void 0 : v.id) || "", Object.assign(w, s.fields), y("update", f == null ? void 0 : f.data);
567
+ } catch (f) {
568
+ s.errorMessage = W(f), y("error", f);
569
+ } finally {
570
+ s.isReadonly = !1;
571
+ }
572
+ }, {
573
+ debouncedQueryChange: T,
574
+ loading: te,
575
+ allRecords: ae,
576
+ error: N,
577
+ validationError: V,
578
+ loadItems: ie,
579
+ results: ne
580
+ } = Ve(t.config, A.form[t.config.app].certificates), oe = (n) => {
581
+ T(n);
582
+ }, h = g(() => N.value ? m("errors.certificates.fetch") : ""), M = g(() => V.value ? m("errors.certificates.invalid") : ""), x = k(0), J = g(() => ae.value === void 0), K = k(/* @__PURE__ */ new Set()), Q = g(() => Array.from(K.value).map((o) => ({
583
+ label: o,
584
+ value: o,
585
+ selected: s.fields.certificate_id === o
586
+ }))), z = (n) => {
587
+ K.value.clear();
588
+ let o;
589
+ for (o of n)
590
+ K.value.add(o.id);
591
+ };
592
+ return le(ne, (n) => {
593
+ z(n);
594
+ }, { immediate: !0, deep: !0 }), le(Q, () => {
595
+ x.value++;
596
+ }, { immediate: !0, deep: !0 }), ye(async () => {
597
+ await ie();
598
+ }), (n, o) => {
599
+ const e = D("KInput"), c = D("KSelect");
600
+ return b(), G("div", at, [
601
+ u(a(Ke), {
602
+ "can-submit": Z.value,
603
+ config: i.config,
604
+ "edit-id": i.sniId,
605
+ "entity-type": a(Oe).SNI,
606
+ "error-message": s.errorMessage || h.value,
607
+ "fetch-url": X.value,
608
+ "form-fields": _.value,
609
+ "is-readonly": s.isReadonly,
610
+ onCancel: j,
611
+ "onFetch:error": o[3] || (o[3] = (r) => n.$emit("error", r)),
612
+ "onFetch:success": Y,
613
+ onLoading: o[4] || (o[4] = (r) => n.$emit("loading", r)),
614
+ onSubmit: ee
615
+ }, {
616
+ default: d(() => [
617
+ u(a(pe), {
618
+ description: a(m)("form.sections.general.description"),
619
+ title: a(m)("form.sections.general.title")
620
+ }, {
621
+ default: d(() => [
622
+ u(e, {
623
+ modelValue: s.fields.name,
624
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => s.fields.name = r),
625
+ modelModifiers: { trim: !0 },
626
+ autocomplete: "off",
627
+ "data-testid": "sni-form-name",
628
+ label: a(m)("form.fields.name.label"),
629
+ placeholder: a(m)("form.fields.name.placeholder"),
630
+ readonly: s.isReadonly,
631
+ required: "",
632
+ type: "text"
633
+ }, null, 8, ["modelValue", "label", "placeholder", "readonly"]),
634
+ u(e, {
635
+ modelValue: s.fields.tags,
636
+ "onUpdate:modelValue": o[1] || (o[1] = (r) => s.fields.tags = r),
637
+ modelModifiers: { trim: !0 },
638
+ autocomplete: "off",
639
+ "data-testid": "sni-form-tags",
640
+ help: a(m)("form.fields.tags.help"),
641
+ label: a(m)("form.fields.tags.label"),
642
+ "label-attributes": {
643
+ info: a(m)("form.fields.tags.tooltip"),
644
+ tooltipAttributes: { maxWidth: "400" }
645
+ },
646
+ placeholder: a(m)("form.fields.tags.placeholder"),
647
+ readonly: s.isReadonly,
648
+ type: "text"
649
+ }, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])
650
+ ]),
651
+ _: 1
652
+ }, 8, ["description", "title"]),
653
+ u(a(pe), {
654
+ description: a(m)("form.sections.certificate.description"),
655
+ "has-divider": "",
656
+ title: a(m)("form.sections.certificate.title")
657
+ }, {
658
+ default: d(() => [
659
+ $.value ? (b(), F(e, {
660
+ key: 0,
661
+ "data-testid": "sni-form-certificate-id",
662
+ label: a(m)("form.fields.certificate_id.label"),
663
+ "model-value": $.value,
664
+ readonly: "",
665
+ required: "",
666
+ width: "100%"
667
+ }, null, 8, ["label", "model-value"])) : (b(), F(c, {
668
+ key: 1,
669
+ modelValue: s.fields.certificate_id,
670
+ "onUpdate:modelValue": o[2] || (o[2] = (r) => s.fields.certificate_id = r),
671
+ clearable: "",
672
+ "data-testid": "sni-form-certificate-id",
673
+ "dropdown-footer-text": J.value ? a(m)("form.fields.certificate_id.footer") : void 0,
674
+ "enable-filtering": "",
675
+ "filter-function": () => !0,
676
+ items: Q.value,
677
+ label: a(m)("form.fields.certificate_id.label"),
678
+ loading: a(te),
679
+ placeholder: a(m)("form.fields.certificate_id.placeholder"),
680
+ readonly: s.isReadonly,
681
+ required: "",
682
+ width: "100%",
683
+ onQueryChange: oe
684
+ }, {
685
+ loading: d(() => [
686
+ L("div", null, I(a(m)("actions.loading")), 1)
687
+ ]),
688
+ empty: d(() => [
689
+ L("div", it, I(a(m)("search.no_results")), 1)
690
+ ]),
691
+ _: 1
692
+ }, 8, ["modelValue", "dropdown-footer-text", "items", "label", "loading", "placeholder", "readonly"])),
693
+ M.value ? (b(), G("p", nt, I(M.value), 1)) : ve("", !0)
694
+ ]),
695
+ _: 1
696
+ }, 8, ["description", "title"])
697
+ ]),
698
+ _: 1
699
+ }, 8, ["can-submit", "config", "edit-id", "entity-type", "error-message", "fetch-url", "form-fields", "is-readonly"])
700
+ ]);
701
+ };
702
+ }
703
+ }), ft = /* @__PURE__ */ Ie(ot, [["__scopeId", "data-v-c4973985"]]);
704
+ export {
705
+ ft as SniForm,
706
+ ut as SniList
707
+ };
@@ -0,0 +1 @@
1
+ (function(g,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router"),require("@kong-ui-public/i18n"),require("@kong-ui-public/entities-shared"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router","@kong-ui-public/i18n","@kong-ui-public/entities-shared","@kong/icons"],e):(g=typeof globalThis<"u"?globalThis:g||self,e(g["kong-ui-public-entities-snis"]={},g.Vue,g.VueRouter,g["kong-ui-public-i18n"],g["kong-ui-public-entities-shared"],g.KongIcons))})(this,function(g,e,Y,v,d,q){"use strict";const ae={actions:{create:"New SNI",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",loading:"Loading..."},search:{placeholder:"Filter by exact name or ID",no_results:"No results found"},snis:{title:"SNIs",list:{toolbar_actions:{new:"New SNI"},table_headers:{name:"Name",id:"ID",certificate_id:"SSL Certificate ID",tags:"Tags"},empty_state:{title:"Configure a New SNI",description:"SNIs are used to map hostnames to a certificate."},empty_state_v2:{title:"Configure your first SNI",description:"Server Name Indications (SNIs) map hostnames to SSL/TLS certificates, enabling secure connections for domain-specific traffic.",group:"SNIs created in gateways within this group will automatically appear here.",create_cta:"New SNI"}}},form:{sections:{general:{title:"General Information",description:"General information will help identify and manage this SNI."},certificate:{title:"Certificate",description:"Map an existing Certificate object to hostnames"}},fields:{name:{label:"Name",placeholder:"Enter a unique name for this SNI"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."},certificate_id:{label:"SSL Certificate ID",placeholder:"Enter or select a Certificate ID",footer:"Search by exact ID to find certificates not included in the list"}}},delete:{title:"Delete an SNI",description:"This action cannot be reversed so make sure to check the SNI usage before deleting."},errors:{delete:"The SNI could not be deleted at this time.",general:"SNIs could not be retrieved",certificates:{fetch:"Could not fetch available certificates",invalid:"Please select a valid certificate ID"},copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}};function ne(){const a=v.createI18n("en-us",ae);return{i18n:a,i18nT:v.i18nTComponent(a)}}const ee={useI18n:ne},V="/v2/control-planes/{controlPlaneId}/core-entities",E="/{workspace}",B={list:{konnect:{all:`${V}/snis`},kongManager:{all:`${E}/snis`}},form:{konnect:{create:`${V}/snis`,edit:`${V}/snis/{id}`,validate:`${V}/v1/schemas/json/sni/validate`,certificates:`${V}/certificates`},kongManager:{create:`${E}/snis`,edit:`${E}/snis/{id}`,validate:`${E}/schemas/snis/validate`,certificates:`${E}/certificates`}}},oe="#00abd2",re="24px",se={class:"kong-ui-entities-snis-list"},ce={class:"button-row"},le={class:"empty-state-icon-gateway"},de={key:1},fe=e.defineComponent({__name:"SniList",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||!a.createRoute||!a.getViewRoute||!a.getEditRoute||a.app==="kongManager"&&!a.isExactMatch&&!a.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1},enableV2EmptyStates:{type:Boolean,default:!1}},emits:["error","click:learn-more","copy:success","copy:error","delete:success"],setup(a,{emit:$}){var o;const m=$,i=a,{i18n:{t:c}}=ee.useI18n(),u=Y.useRouter(),{axiosInstance:j}=d.useAxios((o=i.config)==null?void 0:o.axiosRequestConfig),{hasRecords:k,handleStateChange:L}=d.useTableState(()=>b.value),I=e.computed(()=>k.value&&i.config.app==="konnect"),N=e.computed(()=>!i.enableV2EmptyStates&&i.config.app==="konnect"),r=e.computed(()=>i.config.app!=="kongManager"||!!i.config.disableSorting),w={name:{label:c("snis.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1},certificate:{label:c("snis.list.table_headers.certificate_id"),sortable:!1},tags:{label:c("snis.list.table_headers.tags"),sortable:!1}},J=w,Q=t=>({style:{maxWidth:t.headerKey==="name"?"250px":t.headerKey==="certificate"?"350px":null}}),K=e.computed(()=>{var l,s;let t=`${i.config.apiBaseUrl}${B.list[i.config.app].all}`;return i.config.app==="konnect"?t=t.replace(/{controlPlaneId}/gi,((l=i.config)==null?void 0:l.controlPlaneId)||""):i.config.app==="kongManager"&&(t=t.replace(/\/{workspace}/gi,(s=i.config)!=null&&s.workspace?`/${i.config.workspace}`:"")),t}),b=e.ref(""),D=e.computed(()=>{const t=i.config.app==="konnect"||i.config.isExactMatch;if(t)return{isExactMatch:t,placeholder:c("search.placeholder")};const{name:l}=w;return{isExactMatch:t,fields:{name:l},schema:i.config.filterSchema}}),{fetcher:C,fetcherState:W,fetcherCacheKey:M}=d.useFetcher(e.computed(()=>({...i.config,cacheIdentifier:i.cacheIdentifier})),K),z=()=>{b.value=""},H=()=>{M.value++},_=e.ref(null),T=e.ref({ctaPath:i.config.createRoute,ctaText:void 0,message:`${c("snis.list.empty_state.description")}${i.config.additionMessageForEmptyState?` ${i.config.additionMessageForEmptyState}`:""}`,title:c("snis.title")}),G=async(t,l)=>{const s=t.id;if(!await l(s)){m("copy:error",{entity:t,field:"id",message:c("errors.copy")});return}m("copy:success",{entity:t,field:"id",message:c("copy.success",{val:s})})},X=async(t,l)=>{const s=JSON.stringify(t);if(!await l(s)){m("copy:error",{entity:t,message:c("errors.copy")});return}m("copy:success",{entity:t,message:c("copy.success_brief")})},Z=t=>({label:c("actions.edit"),to:i.config.getEditRoute(t)}),h=e.ref(void 0),S=e.ref(!1),x=e.ref(!1),O=e.ref(""),F=d.useDeleteUrlBuilder(i.config,K.value),P=t=>{h.value=t,S.value=!0},U=()=>{S.value=!1,h.value=void 0},A=async()=>{var t,l,s;if((t=h.value)!=null&&t.id){x.value=!0;try{await j.delete(F(h.value.id)),m("delete:success",h.value),x.value=!1,U(),M.value++}catch(y){O.value=((s=(l=y.response)==null?void 0:l.data)==null?void 0:s.message)||y.message||c("errors.delete"),m("error",y)}finally{x.value=!1}}},n=()=>{u.push(i.config.createRoute)};return e.watch(W,t=>{var l,s,y;if(t.status===d.FetcherStatus.Error){_.value={title:c("errors.general")},(y=(s=(l=t.error)==null?void 0:l.response)==null?void 0:s.data)!=null&&y.message&&(_.value.message=t.error.response.data.message),m("error",t.error);return}_.value=null}),e.onBeforeMount(async()=>{await i.canCreate()&&(T.value.title=c("snis.list.empty_state.title"),T.value.ctaText=c("actions.create"))}),(t,l)=>{const s=e.resolveComponent("KButton"),y=e.resolveComponent("KCopy"),f=e.resolveComponent("KDropdownItem"),ie=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",se,[e.createVNode(e.unref(d.EntityBaseTable),{"cache-identifier":a.cacheIdentifier,"cell-attributes":Q,"disable-row-click":!0,"disable-sorting":r.value,"empty-state-options":T.value,"enable-entity-actions":"","error-message":_.value,fetcher:e.unref(C),"fetcher-cache-key":e.unref(M),"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-snis-list",query:b.value,"table-headers":e.unref(J),onClearSearchInput:z,onSort:H,onState:e.unref(L)},e.createSlots({"toolbar-filter":e.withCtx(()=>[e.createVNode(e.unref(d.EntityFilter),{modelValue:b.value,"onUpdate:modelValue":l[0]||(l[0]=p=>b.value=p),config:D.value},null,8,["modelValue","config"])]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!a.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createElementVNode("div",ce,[I.value?(e.openBlock(),e.createBlock(s,{key:0,appearance:"secondary",class:"open-learning-hub","data-testid":"snis-learn-more-button",icon:"",onClick:l[1]||(l[1]=p=>t.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(q.BookIcon),{decorative:""})]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(d.PermissionsWrapper),{"auth-function":()=>a.canCreate()},{default:e.withCtx(()=>[e.createVNode(s,{appearance:"primary","data-testid":"toolbar-add-sni",size:a.useActionOutside?"medium":"large",to:a.config.createRoute},{default:e.withCtx(()=>[e.createVNode(e.unref(q.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(c)("snis.list.toolbar_actions.new")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])])],8,["disabled"]))]),name:e.withCtx(({rowValue:p})=>[e.createElementVNode("b",null,e.toDisplayString(p??"-"),1)]),certificate:e.withCtx(({row:p})=>[p.certificate&&p.certificate.id?(e.openBlock(),e.createBlock(y,{key:0,class:"copy-certificate-uuid","data-testid":"copy-certificate-uuid",text:p.certificate.id,truncate:""},null,8,["text"])):(e.openBlock(),e.createElementBlock("span",de,"-"))]),tags:e.withCtx(({rowValue:p})=>[e.createVNode(e.unref(d.TableTags),{tags:p},null,8,["tags"])]),actions:e.withCtx(({row:p})=>[e.createVNode(ie,null,{default:e.withCtx(({copyToClipboard:R})=>[e.createVNode(f,{"data-testid":"action-entity-copy-id",onClick:he=>G(p,R)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(ie,null,{default:e.withCtx(({copyToClipboard:R})=>[e.createVNode(f,{"data-testid":"action-entity-copy-json",onClick:he=>X(p,R)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(e.unref(d.PermissionsWrapper),{"auth-function":()=>a.canEdit(p)},{default:e.withCtx(()=>[e.createVNode(f,{"data-testid":"action-entity-edit",item:Z(p.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(d.PermissionsWrapper),{"auth-function":()=>a.canDelete(p)},{default:e.withCtx(()=>[e.createVNode(f,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:R=>P(p)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:2},[!e.unref(k)&&N.value?{name:"outside-actions",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!a.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createVNode(s,{appearance:"secondary",class:"open-learning-hub","data-testid":"sni-learn-more-button",icon:"",onClick:l[2]||(l[2]=p=>t.$emit("click:learn-more"))},{default:e.withCtx(()=>[e.createVNode(e.unref(q.BookIcon),{decorative:""})]),_:1})],8,["disabled"]))]),key:"0"}:void 0,!b.value&&a.enableV2EmptyStates&&a.config.app==="konnect"?{name:"empty-state",fn:e.withCtx(()=>{var p;return[e.createVNode(e.unref(d.EntityEmptyState),{"action-button-text":e.unref(c)("snis.list.toolbar_actions.new"),appearance:"secondary","can-create":()=>a.canCreate(),"data-testid":"snis-entity-empty-state",description:e.unref(c)("snis.list.empty_state_v2.description"),"learn-more":a.config.app==="konnect",title:e.unref(c)("snis.list.empty_state_v2.title"),"onClick:create":n,"onClick:learnMore":l[3]||(l[3]=R=>t.$emit("click:learn-more"))},e.createSlots({image:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(e.unref(q.CloudIcon),{color:e.unref(oe),size:e.unref(re)},null,8,["color","size"])])]),_:2},[(p=a.config)!=null&&p.isControlPlaneGroup?{name:"message",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)("snis.list.empty_state_v2.group")),1)]),key:"0"}:void 0]),1032,["action-button-text","can-create","description","learn-more","title"])]}),key:"1"}:void 0]),1032,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers","onState"]),e.createVNode(e.unref(d.EntityDeleteModal),{"action-pending":x.value,description:e.unref(c)("delete.description"),"entity-name":h.value&&(h.value.name||h.value.id),"entity-type":e.unref(d.EntityTypes).SNI,error:O.value,"need-confirm":!1,title:e.unref(c)("delete.title"),visible:S.value,onCancel:U,onProceed:A},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),te=(a,$)=>{const m=a.__vccOpts||a;for(const[i,c]of $)m[i]=c;return m},pe=te(fe,[["__scopeId","data-v-9ec44cca"]]),ue={class:"kong-ui-entities-snis-form"},me={"data-testid":"no-search-results"},ge={key:2,class:"invalid-certificate-message","data-testid":"invalid-certificate-message"},ye=te(e.defineComponent({__name:"SniForm",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||a.app==="konnect"&&!a.controlPlaneId||a.app==="kongManager"&&typeof a.workspace!="string"||!a.cancelRoute)},sniId:{type:String,required:!1,default:""}},emits:["update","error","loading"],setup(a,{emit:$}){var A;const m=$,i=a,c=Y.useRouter(),{i18n:{t:u}}=ee.useI18n(),{getMessageFromError:j}=d.useErrors(),{axiosInstance:k}=d.useAxios((A=i.config)==null?void 0:A.axiosRequestConfig),L=e.computed(()=>B.form[i.config.app].edit),I=e.computed(()=>i.sniId?d.EntityBaseFormType.Edit:d.EntityBaseFormType.Create),N=e.computed(()=>i.config.certificateId&&I.value===d.EntityBaseFormType.Create?i.config.certificateId:""),r=e.reactive({fields:{name:"",tags:"",certificate_id:""},isReadonly:!1,errorMessage:""}),w=e.reactive({name:"",tags:"",certificate_id:""}),J=e.computed(()=>JSON.stringify(r.fields)!==JSON.stringify(w)&&!!r.fields.name&&!!(r.fields.certificate_id||N.value)),Q=n=>{var o,t;r.fields.name=(n==null?void 0:n.name)||"",r.fields.tags=((o=n==null?void 0:n.tags)==null?void 0:o.join(", "))||"",r.fields.certificate_id=((t=n==null?void 0:n.certificate)==null?void 0:t.id)||"",Object.assign(w,r.fields)},K=()=>{c.push(i.config.cancelRoute)},b=e.computed(()=>{var o,t;let n=`${i.config.apiBaseUrl}${B.form[i.config.app].validate}`;return i.config.app==="konnect"?n=n.replace(/{controlPlaneId}/gi,((o=i.config)==null?void 0:o.controlPlaneId)||""):i.config.app==="kongManager"&&(n=n.replace(/\/{workspace}/gi,(t=i.config)!=null&&t.workspace?`/${i.config.workspace}`:"")),n=n.replace(/{id}/gi,i.sniId),n}),D=e.computed(()=>{var o,t;let n=`${i.config.apiBaseUrl}${B.form[i.config.app][I.value]}`;return i.config.app==="konnect"?n=n.replace(/{controlPlaneId}/gi,((o=i.config)==null?void 0:o.controlPlaneId)||""):i.config.app==="kongManager"&&(n=n.replace(/\/{workspace}/gi,(t=i.config)!=null&&t.workspace?`/${i.config.workspace}`:"")),n=n.replace(/{id}/gi,i.sniId),n}),C=e.computed(()=>{var n,o;return{name:r.fields.name,tags:(o=(n=r.fields.tags.split(","))==null?void 0:n.map(t=>String(t||"").trim()))==null?void 0:o.filter(t=>t!==""),certificate:{id:N.value||r.fields.certificate_id}}}),W=async()=>{var n,o,t,l,s,y;try{r.isReadonly=!0;let f;await k.post(b.value,C.value),I.value==="create"?f=await k.post(D.value,C.value):I.value==="edit"&&(f=((n=i.config)==null?void 0:n.app)==="konnect"?await k.put(D.value,C.value):await k.patch(D.value,C.value)),r.fields.name=((o=f==null?void 0:f.data)==null?void 0:o.name)||"",r.fields.tags=((l=(t=f==null?void 0:f.data)==null?void 0:t.tags)==null?void 0:l.join(", "))||"",r.fields.certificate_id=((y=(s=f==null?void 0:f.data)==null?void 0:s.certificate)==null?void 0:y.id)||"",Object.assign(w,r.fields),m("update",f==null?void 0:f.data)}catch(f){r.errorMessage=j(f),m("error",f)}finally{r.isReadonly=!1}},{debouncedQueryChange:M,loading:z,allRecords:H,error:_,validationError:T,loadItems:G,results:X}=d.useDebouncedFilter(i.config,B.form[i.config.app].certificates),Z=n=>{M(n)},h=e.computed(()=>_.value?u("errors.certificates.fetch"):""),S=e.computed(()=>T.value?u("errors.certificates.invalid"):""),x=e.ref(0),O=e.computed(()=>H.value===void 0),F=e.ref(new Set),P=e.computed(()=>Array.from(F.value).map(o=>({label:o,value:o,selected:r.fields.certificate_id===o}))),U=n=>{F.value.clear();let o;for(o of n)F.value.add(o.id)};return e.watch(X,n=>{U(n)},{immediate:!0,deep:!0}),e.watch(P,()=>{x.value++},{immediate:!0,deep:!0}),e.onBeforeMount(async()=>{await G()}),(n,o)=>{const t=e.resolveComponent("KInput"),l=e.resolveComponent("KSelect");return e.openBlock(),e.createElementBlock("div",ue,[e.createVNode(e.unref(d.EntityBaseForm),{"can-submit":J.value,config:a.config,"edit-id":a.sniId,"entity-type":e.unref(d.SupportedEntityType).SNI,"error-message":r.errorMessage||h.value,"fetch-url":L.value,"form-fields":C.value,"is-readonly":r.isReadonly,onCancel:K,"onFetch:error":o[3]||(o[3]=s=>n.$emit("error",s)),"onFetch:success":Q,onLoading:o[4]||(o[4]=s=>n.$emit("loading",s)),onSubmit:W},{default:e.withCtx(()=>[e.createVNode(e.unref(d.EntityFormSection),{description:e.unref(u)("form.sections.general.description"),title:e.unref(u)("form.sections.general.title")},{default:e.withCtx(()=>[e.createVNode(t,{modelValue:r.fields.name,"onUpdate:modelValue":o[0]||(o[0]=s=>r.fields.name=s),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"sni-form-name",label:e.unref(u)("form.fields.name.label"),placeholder:e.unref(u)("form.fields.name.placeholder"),readonly:r.isReadonly,required:"",type:"text"},null,8,["modelValue","label","placeholder","readonly"]),e.createVNode(t,{modelValue:r.fields.tags,"onUpdate:modelValue":o[1]||(o[1]=s=>r.fields.tags=s),modelModifiers:{trim:!0},autocomplete:"off","data-testid":"sni-form-tags",help:e.unref(u)("form.fields.tags.help"),label:e.unref(u)("form.fields.tags.label"),"label-attributes":{info:e.unref(u)("form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:e.unref(u)("form.fields.tags.placeholder"),readonly:r.isReadonly,type:"text"},null,8,["modelValue","help","label","label-attributes","placeholder","readonly"])]),_:1},8,["description","title"]),e.createVNode(e.unref(d.EntityFormSection),{description:e.unref(u)("form.sections.certificate.description"),"has-divider":"",title:e.unref(u)("form.sections.certificate.title")},{default:e.withCtx(()=>[N.value?(e.openBlock(),e.createBlock(t,{key:0,"data-testid":"sni-form-certificate-id",label:e.unref(u)("form.fields.certificate_id.label"),"model-value":N.value,readonly:"",required:"",width:"100%"},null,8,["label","model-value"])):(e.openBlock(),e.createBlock(l,{key:1,modelValue:r.fields.certificate_id,"onUpdate:modelValue":o[2]||(o[2]=s=>r.fields.certificate_id=s),clearable:"","data-testid":"sni-form-certificate-id","dropdown-footer-text":O.value?e.unref(u)("form.fields.certificate_id.footer"):void 0,"enable-filtering":"","filter-function":()=>!0,items:P.value,label:e.unref(u)("form.fields.certificate_id.label"),loading:e.unref(z),placeholder:e.unref(u)("form.fields.certificate_id.placeholder"),readonly:r.isReadonly,required:"",width:"100%",onQueryChange:Z},{loading:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(u)("actions.loading")),1)]),empty:e.withCtx(()=>[e.createElementVNode("div",me,e.toDisplayString(e.unref(u)("search.no_results")),1)]),_:1},8,["modelValue","dropdown-footer-text","items","label","loading","placeholder","readonly"])),S.value?(e.openBlock(),e.createElementBlock("p",ge,e.toDisplayString(S.value),1)):e.createCommentVNode("",!0)]),_:1},8,["description","title"])]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])])}}}),[["__scopeId","data-v-c4973985"]]);g.SniForm=ye,g.SniList=pe,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .config-card-fieldset[data-v-f7096c33]{border:solid 1px #e0e4ea;border-radius:4px;margin-bottom:8px;margin-top:4px}.config-card-fieldset-title[data-v-f7096c33]{font-size:14px;padding:0 8px;width:auto}fieldset.config-card-fieldset .config-card-details-row{width:unset}.config-card-json-item .config-card-details-row,fieldset.config-card-fieldset .config-card-details-row{margin:0 16px}.config-card-json-item .config-card-details-row:last-of-type,fieldset.config-card-fieldset .config-card-details-row:last-of-type{border-bottom:none}[data-v-2feb8c2e] .k-button.navigation-button{font-size:14px;font-weight:400}.config-card-details-row[data-v-5f9aa0e8]{align-items:center;border-bottom:var(--2f90d7f7);box-sizing:border-box;display:var(--668a792a);padding:16px 16px 16px 0;width:100%}.config-card-details-row .config-card-details-label[data-v-5f9aa0e8]{box-sizing:border-box;padding-right:16px;width:var(--5bc9ad14)}.config-card-details-row .config-card-details-label label[data-v-5f9aa0e8]{color:#3a3f51;display:inline-flex;max-width:100%}.config-card-details-row .config-card-details-label label .label-content[data-v-5f9aa0e8]{line-height:initial;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.config-card-details-row .config-card-details-label label .k-popover[data-v-5f9aa0e8]{min-width:0}.config-card-details-row .config-card-details-value[data-v-5f9aa0e8]{box-sizing:border-box;width:var(--5bc5215e)}.config-card-details-row .config-card-details-value .truncated[data-v-5f9aa0e8]{display:inline-block;line-height:initial;max-width:20ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.config-card-details-row .config-card-details-value span.attrs-data-text[data-v-5f9aa0e8]{overflow-wrap:anywhere}.config-card-details-row .config-card-details-value .copy-uuid-array[data-v-5f9aa0e8] .k-copy:not(:last-of-type){margin-bottom:8px}.config-card-details-row .config-card-details-value .method-badge-array[data-v-5f9aa0e8]{display:flex;flex-wrap:wrap;row-gap:10px}.config-card-details-row .config-badge[data-v-5f9aa0e8]{margin-right:4px}.config-card-details-row[data-v-5f9aa0e8] .k-label{margin-bottom:0}.config-card-details-row[data-v-5f9aa0e8] .k-label .kong-icon-infoFilled{display:flex}.config-card-details-row[data-v-5f9aa0e8] .config-card-details-row{width:auto}.json-content.k-code-block{border-top-left-radius:0;border-top-right-radius:0}.json-endpoint{align-items:baseline;background-color:#000933;border-bottom:1px solid rgba(255,255,255,.2);border-top-left-radius:8px;border-top-right-radius:8px;display:flex;padding:8px 0 8px 12px}.json-endpoint .k-code-block{flex:auto;z-index:2}.json-endpoint .k-code-block .code-block-content{padding-bottom:0;padding-top:0}.json-endpoint .k-code-block .code-block-secondary-actions{margin-top:0!important}.json-endpoint code{direction:rtl;max-width:var(--54aebfa2);overflow:hidden!important;text-align:left;text-overflow:ellipsis;white-space:nowrap}.config-card-prop-section-title[data-v-d67757a9]{color:#000933;font-size:16px;font-weight:600;margin-bottom:16px;margin-top:48px}.kong-ui-entity-base-config-card .config-card-actions[data-v-dd0edd92]{align-items:center;display:flex}.kong-ui-entity-base-config-card .config-card-actions .config-format-select-label[data-v-dd0edd92]{margin-bottom:0;margin-right:8px}.kong-ui-entity-base-config-card .config-card-prop-section-title[data-v-dd0edd92]{color:#000933;font-size:16px;font-weight:600;margin-bottom:16px;margin-top:48px}.kong-ui-entity-base-config-card[data-v-dd0edd92] .config-card-details-row:last-of-type{border-bottom:none}.kong-ui-entity-base-config-card .book-icon[data-v-dd0edd92]{margin-left:8px;padding:0}.kong-ui-entity-base-form[data-v-b073d014]{box-sizing:border-box;max-width:1536px;width:100%}.kong-ui-entity-base-form[data-v-b073d014] .k-slideout-title{color:#000933!important;font-size:24px!important;font-weight:700!important;line-height:32px!important;margin-bottom:16px!important}.kong-ui-entity-base-form[data-v-b073d014] .k-card.content-card{padding:0 16px!important}.kong-ui-entity-base-form[data-v-b073d014] .tab-item>div.tab-link.has-panels{color:#6c7489!important;font-size:14px!important;font-weight:700!important;line-height:24px!important}.kong-ui-entity-base-form[data-v-b073d014] .tab-item.active>div.tab-link.has-panels{color:#000933!important;font-weight:600!important}.form-actions[data-v-b073d014]{align-items:center;display:flex;justify-content:flex-end;margin-top:24px}.form-actions[data-v-b073d014] .k-button:last-of-type,.form-actions[data-v-b073d014] .k-button:nth-last-of-type(2){margin-left:16px}.content-wrapper[data-v-a3a65cac] .k-tooltip{word-break:break-all}.kong-ui-entity-base-table .toolbar-container[data-v-254b0222]{align-items:center;display:flex;width:100%}.kong-ui-entity-base-table .toolbar-button-container[data-v-254b0222]{margin-left:auto}.kong-ui-entity-base-table .hidden[data-v-254b0222]{display:none}.kong-ui-entity-base-table[data-v-254b0222] .empty-state-icon-gateway{background-color:#ecfcff;border-radius:4px;padding:8px}.kong-ui-entity-base-table :deep(.k-table){table-layout:fixed}.kong-ui-entity-delete-modal .message[data-v-4361d622],.kong-ui-entity-delete-modal .description[data-v-4361d622]{line-height:24px;margin:0}.kong-ui-entity-delete-modal .message strong[data-v-4361d622]{font-weight:600}.kong-ui-entity-delete-modal .description[data-v-4361d622]{margin-top:32px}.kong-ui-entity-delete-error[data-v-4361d622]{margin-bottom:16px}.kong-ui-entity-filter-input[data-v-d1bb74d1]{width:100%}.kong-ui-entity-filter-clear[data-v-d1bb74d1]{cursor:pointer}.kong-ui-entity-filter[data-v-d1bb74d1]{display:flex;position:relative}.kong-ui-entity-filter[data-v-d1bb74d1] .menu-content{flex-direction:column}.kong-ui-entity-filter[data-v-d1bb74d1] .k-menu-item-divider hr{margin:12px 0}.kong-ui-entity-filter-backdrop[data-v-d1bb74d1]{bottom:0;left:0;position:fixed;right:0;top:0;z-index:1050}.kong-ui-entity-filter-menu[data-v-d1bb74d1]{background-color:#fff;border:1px solid #afb7c5;border-radius:4px;box-shadow:0 4px 20px #e0e4ea;left:0;margin-top:16px;padding:8px 0 12px;position:absolute;top:100%;width:300px;z-index:1060}.kong-ui-entity-filter-menu-item[data-v-d1bb74d1]{border-bottom:1px solid #e0e4ea;color:#6c7489;font-size:12px;font-weight:400;line-height:16px;list-style:none;margin:0 20px;padding:16px 0;position:relative;white-space:nowrap}.menu-item-title[data-v-d1bb74d1]{align-items:center;cursor:pointer;display:flex;line-height:24px}.menu-item-title.expanded[data-v-d1bb74d1]{color:#232633}.menu-item-expand-icon[data-v-d1bb74d1]{margin-left:auto}.menu-item-expand-icon.expanded[data-v-d1bb74d1]{transform:rotate(180deg)}.menu-item-indicator[data-v-d1bb74d1]{background-color:#0044f4;border-radius:50%;height:4px;margin-left:4px;width:4px}.menu-item-body[data-v-d1bb74d1]{align-items:center;display:flex;justify-content:space-between;margin-top:16px}.menu-item-body[data-v-d1bb74d1] .input{padding-bottom:4px!important;padding-top:4px!important}.menu-item-body[data-v-d1bb74d1] .k-input{width:100%}.menu-item-body[data-v-d1bb74d1] .k-select-input .input{font-size:12px}.menu-item-body[data-v-d1bb74d1] .k-select-input .input::placeholder{color:#00000073!important;font-size:12px}.menu-item-label[data-v-d1bb74d1]{margin-bottom:0;margin-right:12px}.menu-item-buttons[data-v-d1bb74d1]{display:flex;justify-content:space-between;margin:10px 0 6px}.filter-clear-button-container[data-v-d1bb74d1]{padding:12px 20px 0}fieldset[data-v-b1f74200]{margin:0;min-width:0;padding:0}.kong-ui-entity-form-section[data-v-b1f74200]{border:0}.kong-ui-entity-form-section .form-section-wrapper[data-v-b1f74200]{column-gap:16px;display:flex;flex-direction:column;padding-bottom:64px;row-gap:12px;width:100%}@media (min-width: 1024px){.kong-ui-entity-form-section .form-section-wrapper[data-v-b1f74200]{flex-direction:row}}.kong-ui-entity-form-section .form-section-wrapper .form-section-info[data-v-b1f74200]{flex:1}@media (min-width: 1024px){.kong-ui-entity-form-section .form-section-wrapper .form-section-info[data-v-b1f74200]{max-width:350px}.kong-ui-entity-form-section .form-section-wrapper .form-section-info.sticky[data-v-b1f74200]{height:fit-content;margin-bottom:16px;position:sticky;top:16px}}.kong-ui-entity-form-section .form-section-wrapper .form-section-info .form-section-title[data-v-b1f74200]{color:#000933;font-size:16px;font-weight:700;line-height:20px;margin-bottom:8px;margin-top:0}.kong-ui-entity-form-section .form-section-wrapper .form-section-info .form-section-description[data-v-b1f74200],.kong-ui-entity-form-section .form-section-wrapper .form-section-info .form-section-description p[data-v-b1f74200],.kong-ui-entity-form-section .form-section-wrapper .form-section-info .form-section-description[data-v-b1f74200] p{color:#000933;font-size:14px;font-weight:400;line-height:20px;margin:0}.kong-ui-entity-form-section .form-section-wrapper .form-section-info .form-section-footer[data-v-b1f74200]{margin-top:32px}.kong-ui-entity-form-section .form-section-wrapper .form-section-content[data-v-b1f74200]{flex:1}.kong-ui-entity-form-section .form-section-wrapper .form-section-content[data-v-b1f74200]>*:not(:first-child){margin-top:24px}.kong-ui-entity-form-section.has-divider .form-section-wrapper[data-v-b1f74200]{border-bottom:1px solid #e0e4ea}.kong-ui-public-entity-link[data-v-96efdfa5]{align-items:center;display:flex}.kong-ui-public-entity-link .deleted-entity[data-v-96efdfa5]{font-style:italic}.kong-ui-public-entity-link .entity-link[data-v-96efdfa5]{display:flex;flex:1}.kong-ui-public-entity-link .entity-link[data-v-96efdfa5] .external-link-icon{color:#0044f4;margin-left:4px;padding:2px}.kong-ui-public-entity-link .entity-link-label[data-v-96efdfa5]{display:inline-block;font-weight:400;max-width:90%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.kong-ui-public-entity-link .copy-uuid-tooltip[data-v-96efdfa5]{align-items:center;cursor:pointer;display:flex}.kong-ui-public-entity-link .copy-uuid-tooltip .entity-link-copy-id[data-v-96efdfa5]{margin-left:2px}.kong-ui-public-entity-empty-state[data-v-b6376b66]{align-items:center;background-color:#fff;box-sizing:border-box;display:flex;flex-direction:column;font-family:Inter,Roboto,Helvetica,sans-serif;gap:24px;padding:64px 0;width:100%}@media (min-width: 640px){.kong-ui-public-entity-empty-state[data-v-b6376b66]{padding:64px 96px}}.kong-ui-public-entity-empty-state .empty-state-image[data-v-b6376b66]{margin-bottom:8px}.kong-ui-public-entity-empty-state .entity-empty-state-content[data-v-b6376b66]{align-items:center;display:flex;flex-direction:column;gap:8px;text-align:center;width:100%}.kong-ui-public-entity-empty-state .entity-empty-state-content .entity-empty-state-title h1[data-v-b6376b66]{align-items:center;color:#000933;display:flex;font-size:24px;font-weight:700;gap:8px;line-height:32px;margin:0}.kong-ui-public-entity-empty-state .entity-empty-state-content .entity-empty-state-title h1.secondary[data-v-b6376b66]{font-size:18px}.kong-ui-public-entity-empty-state .entity-empty-state-description[data-v-b6376b66],.kong-ui-public-entity-empty-state .entity-empty-state-pricing[data-v-b6376b66]{color:#52596e;font-size:14px;font-weight:400;line-height:20px;max-width:640px}.kong-ui-public-entity-empty-state .entity-empty-state-description p[data-v-b6376b66],.kong-ui-public-entity-empty-state .entity-empty-state-pricing p[data-v-b6376b66]{margin:0}.kong-ui-public-entity-empty-state .entity-empty-state-pricing[data-v-b6376b66]{margin-top:16px}.kong-ui-public-entity-empty-state .entity-empty-state-message[data-v-b6376b66]{color:#52596e}.kong-ui-public-entity-empty-state .entity-empty-state-action[data-v-b6376b66]{align-items:center;display:flex;gap:12px}.kong-ui-public-entity-empty-state .entity-empty-state-card-container[data-v-b6376b66]{display:flex;flex-wrap:wrap;gap:16px;justify-content:space-around;margin-top:8px;width:312px}@media (min-width: 640px){.kong-ui-public-entity-empty-state .entity-empty-state-card-container[data-v-b6376b66]{width:640px}}.kong-ui-public-entity-empty-state .entity-empty-state-card-container .entity-empty-state-card[data-v-b6376b66]{background-color:#f9fafb;border:1px solid #e0e4ea;border-radius:6px;color:#afb7c5;gap:8px;height:160px;padding:20px;width:312px}.kong-ui-public-entity-empty-state .entity-empty-state-card-container .entity-empty-state-card .feature-icon[data-v-b6376b66]{color:#3a3f51;display:flex;margin-bottom:12px}.kong-ui-public-entity-empty-state .entity-empty-state-card-container .entity-empty-state-card .feature-icon[data-v-b6376b66] .kui-icon{height:20px!important;width:20px!important}.kong-ui-public-entity-empty-state .entity-empty-state-card-container .entity-empty-state-card[data-v-b6376b66] .card-title{font-size:14px;font-weight:600}.kong-ui-public-entity-empty-state .entity-empty-state-card-container .entity-empty-state-card[data-v-b6376b66] .card-content{-webkit-box-orient:vertical;color:#6c7489;display:-webkit-box;-webkit-line-clamp:3;line-clamp:3;overflow:hidden}.kong-ui-public-entity-empty-state .entity-empty-state-bottom-container[data-v-b6376b66]{border-top:1px solid #e0e4ea;display:flex;flex-direction:column;gap:16px;padding-top:48px;width:100%}@media (min-width: 640px){.kong-ui-public-entity-empty-state .entity-empty-state-bottom-container[data-v-b6376b66]{width:640px}}.button-row[data-v-9ec44cca]{align-items:center;display:flex;gap:12px}.kong-ui-entities-snis-list[data-v-9ec44cca]{width:100%}.kong-ui-entities-snis-list .kong-ui-entity-filter-input[data-v-9ec44cca]{margin-right:12px}.kong-ui-entities-snis-form[data-v-c4973985]{width:100%}.kong-ui-entities-snis-form .invalid-certificate-message[data-v-c4973985]{color:#d60027;font-size:11px;font-weight:500;margin-top:3px!important}
@@ -0,0 +1,43 @@
1
+ import type { PropType } from 'vue';
2
+ import type { AxiosError } from 'axios';
3
+ import type { KonnectSniFormConfig, KongManagerSniFormConfig } from '../types';
4
+ import '@kong-ui-public/entities-shared/dist/style.css';
5
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
7
+ config: {
8
+ type: PropType<KonnectSniFormConfig | KongManagerSniFormConfig>;
9
+ required: true;
10
+ validator: (config: KonnectSniFormConfig | KongManagerSniFormConfig) => boolean;
11
+ };
12
+ /** If a valid SNI ID is provided, it will put the form in Edit mode instead of Create */
13
+ sniId: {
14
+ type: StringConstructor;
15
+ required: false;
16
+ default: string;
17
+ };
18
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
19
+ error: (error: AxiosError<unknown, any>) => any;
20
+ loading: (isLoading: boolean) => any;
21
+ update: (data: Record<string, any>) => any;
22
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
24
+ config: {
25
+ type: PropType<KonnectSniFormConfig | KongManagerSniFormConfig>;
26
+ required: true;
27
+ validator: (config: KonnectSniFormConfig | KongManagerSniFormConfig) => boolean;
28
+ };
29
+ /** If a valid SNI ID is provided, it will put the form in Edit mode instead of Create */
30
+ sniId: {
31
+ type: StringConstructor;
32
+ required: false;
33
+ default: string;
34
+ };
35
+ }>> & Readonly<{
36
+ onError?: ((error: AxiosError<unknown, any>) => any) | undefined;
37
+ onLoading?: ((isLoading: boolean) => any) | undefined;
38
+ onUpdate?: ((data: Record<string, any>) => any) | undefined;
39
+ }>, {
40
+ sniId: string;
41
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
42
+ export default _default;
43
+ //# sourceMappingURL=SniForm.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SniForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/SniForm.vue"],"names":[],"mappings":"AAsWA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAGnC,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EAIzB,MAAM,UAAU,CAAA;AAYjB,OAAO,gDAAgD,CAAA;;IAsfrD,oHAAoH;;cAElG,QAAQ,CAAC,oBAAoB,GAAG,wBAAwB,CAAC;;4BAErD,oBAAoB,GAAG,wBAAwB,KAAG,OAAO;;IAQ/E,yFAAyF;;;;;;;;;;;IAZzF,oHAAoH;;cAElG,QAAQ,CAAC,oBAAoB,GAAG,wBAAwB,CAAC;;4BAErD,oBAAoB,GAAG,wBAAwB,KAAG,OAAO;;IAQ/E,yFAAyF;;;;;;;;;;;;;AAvB3F,wBA8BG"}
@@ -0,0 +1,123 @@
1
+ import type { PropType } from 'vue';
2
+ import type { AxiosError } from 'axios';
3
+ import type { KongManagerSniListConfig, KonnectSniListConfig, EntityRow, CopyEventPayload } from '../types';
4
+ import '@kong-ui-public/entities-shared/dist/style.css';
5
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
7
+ config: {
8
+ type: PropType<KonnectSniListConfig | KongManagerSniListConfig>;
9
+ required: true;
10
+ validator: (config: KonnectSniListConfig | KongManagerSniListConfig) => boolean;
11
+ };
12
+ cacheIdentifier: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
17
+ canCreate: {
18
+ type: PropType<() => boolean | Promise<boolean>>;
19
+ required: false;
20
+ default: () => Promise<boolean>;
21
+ };
22
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
23
+ canDelete: {
24
+ type: PropType<(row: EntityRow) => boolean | Promise<boolean>>;
25
+ required: false;
26
+ default: () => Promise<boolean>;
27
+ };
28
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
29
+ canEdit: {
30
+ type: PropType<(row: EntityRow) => boolean | Promise<boolean>>;
31
+ required: false;
32
+ default: () => Promise<boolean>;
33
+ };
34
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
35
+ canRetrieve: {
36
+ type: PropType<(row: EntityRow) => boolean | Promise<boolean>>;
37
+ required: false;
38
+ default: () => Promise<boolean>;
39
+ };
40
+ /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
41
+ useActionOutside: {
42
+ type: BooleanConstructor;
43
+ default: boolean;
44
+ };
45
+ /**
46
+ * Enables the new empty state design, this prop can be removed when
47
+ * the khcp-14756-empty-states-m2 FF is removed.
48
+ */
49
+ enableV2EmptyStates: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
54
+ error: (error: AxiosError<unknown, any>) => any;
55
+ "click:learn-more": () => any;
56
+ "copy:success": (payload: CopyEventPayload) => any;
57
+ "copy:error": (payload: CopyEventPayload) => any;
58
+ "delete:success": (sni: EntityRow) => any;
59
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
60
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
61
+ config: {
62
+ type: PropType<KonnectSniListConfig | KongManagerSniListConfig>;
63
+ required: true;
64
+ validator: (config: KonnectSniListConfig | KongManagerSniListConfig) => boolean;
65
+ };
66
+ cacheIdentifier: {
67
+ type: StringConstructor;
68
+ default: string;
69
+ };
70
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
71
+ canCreate: {
72
+ type: PropType<() => boolean | Promise<boolean>>;
73
+ required: false;
74
+ default: () => Promise<boolean>;
75
+ };
76
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
77
+ canDelete: {
78
+ type: PropType<(row: EntityRow) => boolean | Promise<boolean>>;
79
+ required: false;
80
+ default: () => Promise<boolean>;
81
+ };
82
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
83
+ canEdit: {
84
+ type: PropType<(row: EntityRow) => boolean | Promise<boolean>>;
85
+ required: false;
86
+ default: () => Promise<boolean>;
87
+ };
88
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
89
+ canRetrieve: {
90
+ type: PropType<(row: EntityRow) => boolean | Promise<boolean>>;
91
+ required: false;
92
+ default: () => Promise<boolean>;
93
+ };
94
+ /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
95
+ useActionOutside: {
96
+ type: BooleanConstructor;
97
+ default: boolean;
98
+ };
99
+ /**
100
+ * Enables the new empty state design, this prop can be removed when
101
+ * the khcp-14756-empty-states-m2 FF is removed.
102
+ */
103
+ enableV2EmptyStates: {
104
+ type: BooleanConstructor;
105
+ default: boolean;
106
+ };
107
+ }>> & Readonly<{
108
+ onError?: ((error: AxiosError<unknown, any>) => any) | undefined;
109
+ "onClick:learn-more"?: (() => any) | undefined;
110
+ "onCopy:success"?: ((payload: CopyEventPayload) => any) | undefined;
111
+ "onCopy:error"?: ((payload: CopyEventPayload) => any) | undefined;
112
+ "onDelete:success"?: ((sni: EntityRow) => any) | undefined;
113
+ }>, {
114
+ cacheIdentifier: string;
115
+ canCreate: () => boolean | Promise<boolean>;
116
+ canDelete: (row: EntityRow) => boolean | Promise<boolean>;
117
+ canEdit: (row: EntityRow) => boolean | Promise<boolean>;
118
+ canRetrieve: (row: EntityRow) => boolean | Promise<boolean>;
119
+ useActionOutside: boolean;
120
+ enableV2EmptyStates: boolean;
121
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
122
+ export default _default;
123
+ //# sourceMappingURL=SniList.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SniList.vue.d.ts","sourceRoot":"","sources":["../../../src/components/SniList.vue"],"names":[],"mappings":"AA0iBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAEnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAkBvC,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,SAAS,EACT,gBAAgB,EACjB,MAAM,UAAU,CAAA;AASjB,OAAO,gDAAgD,CAAA;;IA08BrD,oHAAoH;;cAElG,QAAQ,CAAC,oBAAoB,GAAG,wBAAwB,CAAC;;4BAErD,oBAAoB,GAAG,wBAAwB,KAAG,OAAO;;;;;;IAY/E,yHAAyH;;cAErG,QAAQ,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI9D,2HAA2H;;cAEvG,QAAQ,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI5E,yHAAyH;;cAErG,QAAQ,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI5E,4IAA4I;;cAExH,QAAQ,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI5E,iHAAiH;;;;;IAKjH;;;OAGG;;;;;;;;;;;;IAhDH,oHAAoH;;cAElG,QAAQ,CAAC,oBAAoB,GAAG,wBAAwB,CAAC;;4BAErD,oBAAoB,GAAG,wBAAwB,KAAG,OAAO;;;;;;IAY/E,yHAAyH;;cAErG,QAAQ,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI9D,2HAA2H;;cAEvG,QAAQ,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI5E,yHAAyH;;cAErG,QAAQ,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI5E,4IAA4I;;cAExH,QAAQ,CAAC,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;;;;IAI5E,iHAAiH;;;;;IAKjH;;;OAGG;;;;;;;;;;;;;qBA9BgC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;qBAM1B,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;mBAMxC,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;uBAMxC,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;;;;AAjD7E,wBAmEG"}
@@ -0,0 +1,6 @@
1
+ import useI18n from './useI18n';
2
+ declare const _default: {
3
+ useI18n: typeof useI18n;
4
+ };
5
+ export default _default;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;;;;AAG/B,wBAEC"}
@@ -0,0 +1,9 @@
1
+ import { createI18n, i18nTComponent } from '@kong-ui-public/i18n';
2
+ import english from '../locales/en.json';
3
+ interface UseI18nReturn {
4
+ i18n: ReturnType<typeof createI18n<typeof english>>;
5
+ i18nT: ReturnType<typeof i18nTComponent<typeof english>>;
6
+ }
7
+ export default function useI18n(): UseI18nReturn;
8
+ export {};
9
+ //# sourceMappingURL=useI18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../src/composables/useI18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAExC,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,IAAI,aAAa,CAO/C"}
@@ -0,0 +1,5 @@
1
+ import SniList from './components/SniList.vue';
2
+ import SniForm from './components/SniForm.vue';
3
+ export { SniForm, SniList, };
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAA;AAC9C,OAAO,OAAO,MAAM,0BAA0B,CAAA;AAE9C,OAAO,EACL,OAAO,EACP,OAAO,GACR,CAAA;AAED,cAAc,SAAS,CAAA"}
@@ -0,0 +1,26 @@
1
+ declare const _default: {
2
+ list: {
3
+ konnect: {
4
+ all: string;
5
+ };
6
+ kongManager: {
7
+ all: string;
8
+ };
9
+ };
10
+ form: {
11
+ konnect: {
12
+ create: string;
13
+ edit: string;
14
+ validate: string;
15
+ certificates: string;
16
+ };
17
+ kongManager: {
18
+ create: string;
19
+ edit: string;
20
+ validate: string;
21
+ certificates: string;
22
+ };
23
+ };
24
+ };
25
+ export default _default;
26
+ //# sourceMappingURL=snis-endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snis-endpoints.d.ts","sourceRoot":"","sources":["../../src/snis-endpoints.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAuBC"}
@@ -0,0 +1,3 @@
1
+ export * from './sni-form';
2
+ export * from './sni-list';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,35 @@
1
+ import type { RouteLocationRaw } from 'vue-router';
2
+ import type { KonnectBaseFormConfig, KongManagerBaseFormConfig } from '@kong-ui-public/entities-shared';
3
+ /** Konnect SNI form config */
4
+ export interface KonnectSniFormConfig extends KonnectBaseFormConfig {
5
+ /** Route to return to if canceling create/edit a SNI */
6
+ cancelRoute: RouteLocationRaw;
7
+ /** Certificate to bind the SNI to on creation */
8
+ certificateId?: string;
9
+ }
10
+ /** Kong Manager SNI form config */
11
+ export interface KongManagerSniFormConfig extends KongManagerBaseFormConfig {
12
+ /** Route to return to if canceling create/edit a SNI */
13
+ cancelRoute: RouteLocationRaw;
14
+ /** Certificate to bind the SNI to on creation */
15
+ certificateId?: string;
16
+ }
17
+ export interface SniFormFields {
18
+ name: string;
19
+ tags: string;
20
+ certificate_id: string;
21
+ }
22
+ export interface SniFormState {
23
+ /** Form fields */
24
+ fields: SniFormFields;
25
+ /** Form readonly state (only used when saving entity details) */
26
+ isReadonly: boolean;
27
+ /** The error message to show on the form */
28
+ errorMessage: string;
29
+ }
30
+ export interface SelectItem {
31
+ label: string;
32
+ value: string | number;
33
+ selected?: boolean;
34
+ }
35
+ //# sourceMappingURL=sni-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sni-form.d.ts","sourceRoot":"","sources":["../../../src/types/sni-form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAEvG,8BAA8B;AAC9B,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,wDAAwD;IACxD,WAAW,EAAE,gBAAgB,CAAA;IAC7B,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,mCAAmC;AACnC,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,wDAAwD;IACxD,WAAW,EAAE,gBAAgB,CAAA;IAC7B,iDAAiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,kBAAkB;IAClB,MAAM,EAAE,aAAa,CAAA;IACrB,iEAAiE;IACjE,UAAU,EAAE,OAAO,CAAA;IACnB,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAA;CACrB;AAGD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
@@ -0,0 +1,32 @@
1
+ import type { RouteLocationRaw } from 'vue-router';
2
+ import type { FilterSchema, KongManagerBaseTableConfig, KonnectBaseTableConfig } from '@kong-ui-public/entities-shared';
3
+ export interface BaseSniListConfig {
4
+ /** Route for creating an SNI */
5
+ createRoute: RouteLocationRaw;
6
+ /** A function that returns the route for viewing an SNI */
7
+ getViewRoute: (id: string) => RouteLocationRaw;
8
+ /** A function that returns the route for editing an SNI */
9
+ getEditRoute: (id: string) => RouteLocationRaw;
10
+ }
11
+ /** Konnect SNI list config */
12
+ export interface KonnectSniListConfig extends KonnectBaseTableConfig, BaseSniListConfig {
13
+ }
14
+ /** Kong Manager SNI list config */
15
+ export interface KongManagerSniListConfig extends KongManagerBaseTableConfig, BaseSniListConfig {
16
+ /** FilterSchema for fuzzy match */
17
+ filterSchema?: FilterSchema;
18
+ }
19
+ export interface EntityRow extends Record<string, any> {
20
+ id: string;
21
+ name: string;
22
+ }
23
+ /** Copy field event payload */
24
+ export interface CopyEventPayload {
25
+ /** The entity row */
26
+ entity: EntityRow;
27
+ /** The field being copied. If omitted, the entity JSON is being copied. */
28
+ field?: string;
29
+ /** The toaster message */
30
+ message: string;
31
+ }
32
+ //# sourceMappingURL=sni-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sni-list.d.ts","sourceRoot":"","sources":["../../../src/types/sni-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAEvH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,WAAW,EAAE,gBAAgB,CAAA;IAC7B,2DAA2D;IAC3D,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,gBAAgB,CAAA;IAC9C,2DAA2D;IAC3D,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,gBAAgB,CAAA;CAC/C;AAED,8BAA8B;AAC9B,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB,EAAE,iBAAiB;CAAG;AAE1F,mCAAmC;AACnC,MAAM,WAAW,wBAAyB,SAAQ,0BAA0B,EAAE,iBAAiB;IAC7F,mCAAmC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B;AAED,MAAM,WAAW,SAAU,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;AAED,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB;IACrB,MAAM,EAAE,SAAS,CAAA;IACjB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/entities-snis",
3
- "version": "3.7.28-pr.2132.c7fba69a4.0",
3
+ "version": "3.7.28",
4
4
  "type": "module",
5
5
  "main": "./dist/entities-snis.umd.js",
6
6
  "module": "./dist/entities-snis.es.js",
@@ -26,7 +26,7 @@
26
26
  "axios": "^1.7.7",
27
27
  "vue": ">= 3.3.13 < 4",
28
28
  "vue-router": "^4.4.5",
29
- "@kong-ui-public/entities-shared": "^3.23.1-pr.2132.c7fba69a4.0",
29
+ "@kong-ui-public/entities-shared": "^3.24.0",
30
30
  "@kong-ui-public/i18n": "^2.3.0"
31
31
  },
32
32
  "devDependencies": {
@@ -36,7 +36,7 @@
36
36
  "axios": "^1.7.7",
37
37
  "vue": "^3.5.13",
38
38
  "vue-router": "^4.4.5",
39
- "@kong-ui-public/entities-shared": "^3.23.1-pr.2132.c7fba69a4.0",
39
+ "@kong-ui-public/entities-shared": "^3.24.0",
40
40
  "@kong-ui-public/i18n": "^2.3.0"
41
41
  },
42
42
  "repository": {