@kong-ui-public/entities-gateway-services 3.12.4-pr.2289.890e582c0.0 → 3.12.4

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.
Files changed (36) hide show
  1. package/dist/entities-gateway-services.es.js +1719 -0
  2. package/dist/entities-gateway-services.umd.js +1 -0
  3. package/dist/style.css +1 -0
  4. package/dist/types/components/GatewayServiceConfigCard.vue.d.ts +62 -0
  5. package/dist/types/components/GatewayServiceConfigCard.vue.d.ts.map +1 -0
  6. package/dist/types/components/GatewayServiceForm.vue.d.ts +97 -0
  7. package/dist/types/components/GatewayServiceForm.vue.d.ts.map +1 -0
  8. package/dist/types/components/GatewayServiceList.vue.d.ts +119 -0
  9. package/dist/types/components/GatewayServiceList.vue.d.ts.map +1 -0
  10. package/dist/types/composables/getPortFromProtocol.d.ts +4 -0
  11. package/dist/types/composables/getPortFromProtocol.d.ts.map +1 -0
  12. package/dist/types/composables/index.d.ts +10 -0
  13. package/dist/types/composables/index.d.ts.map +1 -0
  14. package/dist/types/composables/useI18n.d.ts +9 -0
  15. package/dist/types/composables/useI18n.d.ts.map +1 -0
  16. package/dist/types/composables/useUrlValidators.d.ts +8 -0
  17. package/dist/types/composables/useUrlValidators.d.ts.map +1 -0
  18. package/dist/types/constants.d.ts +15 -0
  19. package/dist/types/constants.d.ts.map +1 -0
  20. package/dist/types/gateway-services-endpoints.d.ts +24 -0
  21. package/dist/types/gateway-services-endpoints.d.ts.map +1 -0
  22. package/dist/types/index.d.ts +7 -0
  23. package/dist/types/index.d.ts.map +1 -0
  24. package/dist/types/types/gateway-service-config-card.d.ts +28 -0
  25. package/dist/types/types/gateway-service-config-card.d.ts.map +1 -0
  26. package/dist/types/types/gateway-service-form.d.ts +68 -0
  27. package/dist/types/types/gateway-service-form.d.ts.map +1 -0
  28. package/dist/types/types/gateway-service-list.d.ts +36 -0
  29. package/dist/types/types/gateway-service-list.d.ts.map +1 -0
  30. package/dist/types/types/index.d.ts +4 -0
  31. package/dist/types/types/index.d.ts.map +1 -0
  32. package/dist/types/utils/index.d.ts +2 -0
  33. package/dist/types/utils/index.d.ts.map +1 -0
  34. package/dist/types/utils/urlValidator.d.ts +4 -0
  35. package/dist/types/utils/urlValidator.d.ts.map +1 -0
  36. package/package.json +5 -5
@@ -0,0 +1,1719 @@
1
+ import { defineComponent as De, ref as R, computed as b, watch as Be, onBeforeMount as ze, resolveComponent as L, createElementBlock as T, openBlock as E, createVNode as c, unref as o, createSlots as Se, withCtx as d, createTextVNode as K, toDisplayString as V, createElementVNode as S, withModifiers as xe, createBlock as Ee, Teleport as He, createCommentVNode as D, reactive as Ke, onMounted as Ze, Transition as Me, Fragment as Je, renderList as Qe, renderSlot as Xe } from "vue";
2
+ import { useRouter as Ge } from "vue-router";
3
+ import { BookIcon as Ye, AddIcon as et, ServicesIcon as tt } from "@kong/icons";
4
+ import { createI18n as ot, i18nTComponent as rt } from "@kong-ui-public/i18n";
5
+ import { useAxios as Ne, useTableState as it, useFetcher as lt, useDeleteUrlBuilder as st, FetcherStatus as at, EntityBaseTable as nt, PermissionsWrapper as de, TableTags as ct, EntityFilter as dt, EntityEmptyState as ut, EntityToggleModal as ft, EntityDeleteModal as pt, EntityTypes as mt, useHelpers as Oe, ConfigurationSchemaType as vt, ConfigurationSchemaSection as ke, EntityBaseConfigCard as gt, SupportedEntityType as We, useErrors as yt, useValidators as _t, EntityBaseFormType as Le, useGatewayFeatureSupported as ht, EntityBaseForm as bt, EntityFormSection as qe } from "@kong-ui-public/entities-shared";
6
+ const wt = {
7
+ create: "New gateway service",
8
+ serverless_create: "Add a Service",
9
+ copy_id: "Copy ID",
10
+ copy_json: "Copy JSON",
11
+ edit: "Edit",
12
+ clear: "Clear",
13
+ view: "View Details",
14
+ delete: {
15
+ title: "Delete a Gateway Service",
16
+ description: "Deleting this Gateway Service will also remove any associated plugins. This action cannot be reversed.",
17
+ menu_label: "Delete"
18
+ }
19
+ }, kt = {
20
+ placeholder: {
21
+ konnect: "Filter by name",
22
+ kongManager: "Filter by exact name or ID"
23
+ }
24
+ }, Vt = {
25
+ title: "Gateway Services",
26
+ list: {
27
+ toolbar_actions: {
28
+ new_gateway_service: "New gateway service"
29
+ },
30
+ table_headers: {
31
+ name: "Name",
32
+ control_plane: "Control Plane",
33
+ protocol: "Protocol",
34
+ host: "Host",
35
+ port: "Port",
36
+ path: "Path",
37
+ enabled: "Enabled",
38
+ tags: "Tags",
39
+ id: "ID",
40
+ created_at: "Created At",
41
+ updated_at: "Last Modified"
42
+ },
43
+ empty_state: {
44
+ title: "Configure a New Gateway Service",
45
+ description: "Gateway services are used to proxy traffic.",
46
+ serverless_title: "Configure your first Gateway Service"
47
+ }
48
+ },
49
+ empty_state_v2: {
50
+ create: "New gateway service",
51
+ title: "Configure your first gateway service",
52
+ group: "Services created in gateways within this group will automatically appear here.",
53
+ description: "Gateway services represent backend APIs or microservices that receive traffic routed through the gateway."
54
+ },
55
+ form: {
56
+ buttons: {
57
+ try_sample: "Try sample API"
58
+ },
59
+ errors: {
60
+ host: {
61
+ empty: "Host cannot be empty",
62
+ invalid: "Invalid host"
63
+ },
64
+ port: {
65
+ type: "Port must be a number",
66
+ invalid: "Port must be between 0 and 65535"
67
+ },
68
+ path: {
69
+ prefix: "Path must begin with /",
70
+ invalid: "Path should not include characters outside of the reserved list of RFC 3986"
71
+ },
72
+ protocol: {
73
+ empty: "Protocol cannot be empty",
74
+ invalid: "Protocol - value must be one of http, https, grpc, grpcs, tcp, udp, tls, tls_passthrough, ws, wss"
75
+ },
76
+ url: {
77
+ invalid: "The URL must follow a valid format. Example: https://api.kong-air.com/flights"
78
+ }
79
+ },
80
+ sections: {
81
+ general: {
82
+ title: "General Information",
83
+ description: "Provide a name and tags to help identify and manage this service."
84
+ },
85
+ keys: {
86
+ title: "Service endpoint",
87
+ description: "Define where this service should send requests.",
88
+ checkedGroupLabel: "Choose how and where to send traffic",
89
+ urlLabel: "Full URL",
90
+ checkedGroupAltLabel: "Protocol, host, port and path",
91
+ url: {
92
+ label: "Full URL",
93
+ description: "Define the service using a single, complete API URL for simple setup."
94
+ },
95
+ protocol: {
96
+ label: "Protocol, host, port, and path",
97
+ description: "Manually specify each component of the API’s URL for advanced configurations."
98
+ },
99
+ viewAdvancedFields: "View advanced fields"
100
+ }
101
+ },
102
+ fields: {
103
+ upstream_url: {
104
+ label: "Full URL",
105
+ placeholder: "e.g. https://api.kong-air.com/flights",
106
+ tooltip_for_konnect: "This is the URL of the API you will manage in Konnect.",
107
+ tooltip_for_km: "This is the URL of the API you will manage in Kong Gateway."
108
+ },
109
+ name: {
110
+ label: "Name",
111
+ placeholder: "Enter a unique name",
112
+ tooltip: "The Service name."
113
+ },
114
+ protocol: {
115
+ label: "Protocol",
116
+ tooltip: "The protocol used to communicate with the upstream.",
117
+ options: {
118
+ http: "http",
119
+ https: "https",
120
+ tcp: "tcp",
121
+ tls: "tls",
122
+ tls_passthrough: "tls_passthrough",
123
+ grpc: "grpc",
124
+ grpcs: "grpcs",
125
+ ws: "ws",
126
+ wss: "wss",
127
+ udp: "udp"
128
+ }
129
+ },
130
+ host: {
131
+ label: "Host",
132
+ placeholder: "e.g. api.kong-air.com",
133
+ tooltip: "The host of the upstream server. Note that the host value is case sensitive."
134
+ },
135
+ path: {
136
+ label: "Path",
137
+ placeholder: "e.g. /sample",
138
+ tooltip: "The path to be used in request to the upstream server."
139
+ },
140
+ port: {
141
+ label: "Port",
142
+ tooltip: "The upstream server port."
143
+ },
144
+ retries: {
145
+ label: "Retries",
146
+ tooltip: "The number of retries to execute upon failure to proxy."
147
+ },
148
+ connect_timeout: {
149
+ label: "Connection timeout",
150
+ tooltip: "The timeout in milliseconds for establishing a connection to the upstream server."
151
+ },
152
+ write_timeout: {
153
+ label: "Write timeout",
154
+ tooltip: "The timeout in milliseconds between two successive write operations for transmitting a request to the upstream server."
155
+ },
156
+ read_timeout: {
157
+ label: "Read timeout",
158
+ tooltip: "The timeout in milliseconds between two successive read operations for transmitting a request to the upstream server."
159
+ },
160
+ client_certificate: {
161
+ label: "Client certificate",
162
+ placeholder: "Enter a Certificate ID",
163
+ tooltip: "Certificate to be used as client certificate while TLS handshaking to the upstream server."
164
+ },
165
+ ca_certificates: {
166
+ label: "CA certificates",
167
+ placeholder: "Enter a comma separated list of CA Certificate IDs",
168
+ tooltip: "Array of {code1} object UUIDs that are used to build the trust store while verifying upstream server's TLS certificate. If set to {code2} when Nginx default is respected. If default CA list in Nginx are not specified and TLS verification is enabled, then handshake with upstream server will always fail (because no CA are trusted).",
169
+ code1: "CA Certificate",
170
+ code2: "null"
171
+ },
172
+ tls_verify_enabled: {
173
+ label: "TLS verify",
174
+ help: "If unchecked, use default system setting",
175
+ tooltip: "Whether to enable verification of upstream server TLS certificate. If set to {code1}, then the Nginx default is respected.",
176
+ code1: "null"
177
+ },
178
+ tls_verify_option: {
179
+ unset: {
180
+ display: "Use default system setting"
181
+ },
182
+ true: {
183
+ label: "True",
184
+ display: "On"
185
+ },
186
+ false: {
187
+ label: "False",
188
+ display: "Off"
189
+ }
190
+ },
191
+ tags: {
192
+ label: "Tags",
193
+ tooltip: "An optional set of strings associated with the Service for grouping and filtering.",
194
+ placeholder: "Enter a list of tags separated by comma",
195
+ help: "e.g. tag1, tag2, tag3",
196
+ collapse: "Add tags"
197
+ },
198
+ enabled: {
199
+ label: "Enabled",
200
+ tooltip: "Whether the Service is active. If set to {false}, the proxy behavior will be as if any routes attached to it do not exist (404). Default: {true}.",
201
+ false: "false",
202
+ true: "true"
203
+ }
204
+ }
205
+ }
206
+ }, Ct = {
207
+ general: "Gateway Services could not be retrieved",
208
+ delete: "The gateway service could not be deleted at this time.",
209
+ copy: "Failed to copy to clipboard",
210
+ urlErrorMessage: "Error: invalid URL"
211
+ }, Et = {
212
+ success: "Copied {val} to clipboard",
213
+ success_brief: "Successfully copied to clipboard"
214
+ }, St = {
215
+ gateway_services: "gateway services"
216
+ }, It = {
217
+ actions: wt,
218
+ search: kt,
219
+ gateway_services: Vt,
220
+ errors: Ct,
221
+ copy: Et,
222
+ glossary: St
223
+ };
224
+ function Pt() {
225
+ const s = ot("en-us", It);
226
+ return {
227
+ i18n: s,
228
+ i18nT: rt(s)
229
+ // Translation component <i18n-t>
230
+ };
231
+ }
232
+ function Ft() {
233
+ return {
234
+ getPortFromProtocol: (G, m) => {
235
+ const n = [80, 443], a = Number(m);
236
+ if ((a || a === 0) && !n.includes(a))
237
+ return a;
238
+ switch (G) {
239
+ case "grpcs":
240
+ case "tls":
241
+ case "https":
242
+ case "wss":
243
+ return 443;
244
+ case "grpc":
245
+ case "tcp":
246
+ case "http":
247
+ case "ws":
248
+ default:
249
+ return 80;
250
+ }
251
+ }
252
+ };
253
+ }
254
+ function At() {
255
+ const { i18n: { t: s } } = ee.useI18n();
256
+ return {
257
+ validateHost: (v) => {
258
+ if (!v || v.trim() === "") return s("gateway_services.form.errors.host.empty");
259
+ const A = /^(?!:\/\/)([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?))*)(\.[a-zA-Z]{1,63})?$/;
260
+ return /^((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9])$/.test(v) || A.test(v) ? "" : s("gateway_services.form.errors.host.invalid");
261
+ },
262
+ validateProtocol: (v, A) => !v || v.trim() === "" ? s("gateway_services.form.errors.protocol.empty") : (v = v.slice(0, -1), A.find((l) => {
263
+ if (l.value === v) return l;
264
+ }) === void 0 ? s("gateway_services.form.errors.protocol.invalid") : ""),
265
+ validatePath: (v) => !v || v === "" ? "" : v.startsWith("/") ? /[^A-Za-z0-9\-._~:/?#[\]@!$&'()*+,;=%]/.test(v) ? s("gateway_services.form.errors.path.invalid") : "" : s("gateway_services.form.errors.path.prefix"),
266
+ validatePort: (v) => {
267
+ if (v == null || v === "")
268
+ return "";
269
+ const A = typeof v == "string" ? parseInt(v, 10) : v;
270
+ return isNaN(A) ? s("gateway_services.form.errors.port.type") : A < 0 || A > 65535 ? s("gateway_services.form.errors.port.invalid") : "";
271
+ }
272
+ };
273
+ }
274
+ const ee = {
275
+ useI18n: Pt,
276
+ usePortFromProtocol: Ft,
277
+ useUrlValidators: At
278
+ }, Ve = "/v2/control-planes/{controlPlaneId}/core-entities", Ce = "/{workspace}", ue = {
279
+ list: {
280
+ konnect: {
281
+ all: `${Ve}/services`
282
+ },
283
+ kongManager: {
284
+ all: `${Ce}/services`
285
+ }
286
+ },
287
+ form: {
288
+ konnect: {
289
+ create: `${Ve}/services`,
290
+ validate: `${Ve}/v1/schemas/json/service/validate`,
291
+ edit: `${Ve}/services/{id}`
292
+ },
293
+ kongManager: {
294
+ create: `${Ce}/services`,
295
+ validate: `${Ce}/schemas/services/validate`,
296
+ edit: `${Ce}/services/{id}`
297
+ }
298
+ }
299
+ }, Tt = "#00abd2", Ut = "24px", $t = { class: "kong-ui-entities-gateway-services-list" }, Rt = { class: "button-row" }, xt = { class: "empty-state-icon-gateway" }, Mt = { key: 1 }, Bt = /* @__PURE__ */ De({
300
+ __name: "GatewayServiceList",
301
+ props: {
302
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
303
+ config: {
304
+ type: Object,
305
+ required: !0,
306
+ 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)
307
+ },
308
+ // used to override the default identifier for the cache entry
309
+ cacheIdentifier: {
310
+ type: String,
311
+ default: ""
312
+ },
313
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
314
+ canCreate: {
315
+ type: Function,
316
+ required: !1,
317
+ default: async () => !0
318
+ },
319
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
320
+ canDelete: {
321
+ type: Function,
322
+ required: !1,
323
+ default: async () => !0
324
+ },
325
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
326
+ canEdit: {
327
+ type: Function,
328
+ required: !1,
329
+ default: async () => !0
330
+ },
331
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
332
+ canRetrieve: {
333
+ type: Function,
334
+ required: !1,
335
+ default: async () => !0
336
+ },
337
+ /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
338
+ useActionOutside: {
339
+ type: Boolean,
340
+ default: !1
341
+ },
342
+ /** user is onboarding, use onboarding text */
343
+ isServerless: {
344
+ type: Boolean,
345
+ default: !1
346
+ }
347
+ },
348
+ emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success", "toggle:success"],
349
+ setup(s, { emit: G }) {
350
+ var we;
351
+ const m = G, n = s, { i18n: { t: a, formatUnixTimeStamp: v } } = ee.useI18n(), A = Ge(), { axiosInstance: N } = Ne((we = n.config) == null ? void 0 : we.axiosRequestConfig), { hasRecords: l, handleStateChange: B } = it(() => z.value), I = b(() => l.value && n.config.app === "konnect"), Ie = b(() => n.config.app !== "kongManager" || !!n.config.disableSorting), le = {
352
+ // the Name column is non-hidable
353
+ name: { label: a("gateway_services.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
354
+ ...n.config.showControlPlaneColumn ? { control_plane: { label: a("gateway_services.list.table_headers.control_plane") } } : {},
355
+ protocol: { label: a("gateway_services.list.table_headers.protocol"), searchable: !0, sortable: !0 },
356
+ host: { label: a("gateway_services.list.table_headers.host"), searchable: !0, sortable: !0 },
357
+ port: { label: a("gateway_services.list.table_headers.port"), searchable: !0, sortable: !0 },
358
+ path: { label: a("gateway_services.list.table_headers.path"), searchable: !0, sortable: !0 },
359
+ enabled: { label: a("gateway_services.list.table_headers.enabled"), searchable: !0, sortable: !0 },
360
+ tags: { label: a("gateway_services.list.table_headers.tags"), sortable: !1 },
361
+ updated_at: { label: a("gateway_services.list.table_headers.updated_at"), sortable: !0 },
362
+ created_at: { label: a("gateway_services.list.table_headers.created_at"), sortable: !0 }
363
+ }, fe = {
364
+ columnVisibility: {
365
+ created_at: !1
366
+ }
367
+ }, pe = le, te = b(() => {
368
+ var g, y;
369
+ let f = `${n.config.apiBaseUrl}${ue.list[n.config.app].all}`;
370
+ return n.config.app === "konnect" ? f = f.replace(/{controlPlaneId}/gi, ((g = n.config) == null ? void 0 : g.controlPlaneId) || "") : n.config.app === "kongManager" && (f = f.replace(/\/{workspace}/gi, (y = n.config) != null && y.workspace ? `/${n.config.workspace}` : "")), f;
371
+ }), Pe = b(() => n.config.apiBaseUrl.startsWith("/") ? new URL(`${window.location.origin}${te.value}`) : new URL(te.value)), z = R(""), Z = b(() => {
372
+ const f = n.config.app === "konnect" || n.config.isExactMatch;
373
+ if (f)
374
+ return {
375
+ isExactMatch: f,
376
+ placeholder: a(`search.placeholder.${n.config.app}`)
377
+ };
378
+ const { name: g, enabled: y, protocol: P, host: W, port: M, path: j } = le;
379
+ return {
380
+ isExactMatch: f,
381
+ fields: { name: g, enabled: y, protocol: P, host: W, port: M, path: j },
382
+ schema: n.config.filterSchema
383
+ };
384
+ }), {
385
+ fetcher: Fe,
386
+ fetcherState: J,
387
+ fetcherCacheKey: C
388
+ } = lt(b(() => ({ ...n.config, cacheIdentifier: n.cacheIdentifier })), te), se = () => {
389
+ z.value = "";
390
+ }, ae = () => {
391
+ C.value++;
392
+ }, oe = R(null), e = b(() => ({
393
+ ctaPath: n.config.createRoute,
394
+ ctaText: ce.value ? n.isServerless ? a("actions.serverless_create") : a("actions.create") : void 0,
395
+ message: `${a("gateway_services.list.empty_state.description")}${n.config.additionMessageForEmptyState ? ` ${n.config.additionMessageForEmptyState}` : ""}`,
396
+ title: ce.value ? n.isServerless ? a("gateway_services.list.empty_state.serverless_title") : a("gateway_services.list.empty_state.title") : a("gateway_services.title")
397
+ })), w = R(!1), x = R(null), re = b(() => {
398
+ const f = {
399
+ action: "disable",
400
+ id: "",
401
+ name: ""
402
+ };
403
+ if (x.value) {
404
+ const { enabled: g, id: y, name: P } = x.value;
405
+ f.action = g ? "disable" : "enable", f.id = y, f.name = P || y;
406
+ }
407
+ return f;
408
+ }), me = (f) => {
409
+ w.value = !0, x.value = f;
410
+ }, ve = () => {
411
+ w.value = !1, x.value = null;
412
+ }, Q = async () => {
413
+ var P, W;
414
+ if (!await ((P = n.canEdit) == null ? void 0 : P.call(n, x.value)) || !x.value)
415
+ return;
416
+ const g = `${Pe.value.href}/${x.value.id}`, y = !x.value.enabled;
417
+ try {
418
+ const { data: M } = ((W = n.config) == null ? void 0 : W.app) === "konnect" ? await N.put(g, { ...x.value, enabled: y }) : await N.patch(g, { ...x.value, enabled: y });
419
+ m("toggle:success", M), x.value.enabled = y;
420
+ } catch (M) {
421
+ m("error", M);
422
+ }
423
+ }, ge = (f) => {
424
+ n.config.getControlPlaneRoute && A.push(n.config.getControlPlaneRoute(f));
425
+ }, ye = async (f, g) => {
426
+ const y = f.id;
427
+ if (!await g(y)) {
428
+ m("copy:error", {
429
+ entity: f,
430
+ field: "id",
431
+ message: a("errors.copy")
432
+ });
433
+ return;
434
+ }
435
+ m("copy:success", {
436
+ entity: f,
437
+ field: "id",
438
+ message: a("copy.success", { val: y })
439
+ });
440
+ }, _e = async (f, g) => {
441
+ const y = JSON.stringify(f);
442
+ if (!await g(y)) {
443
+ m("copy:error", {
444
+ entity: f,
445
+ message: a("errors.copy")
446
+ });
447
+ return;
448
+ }
449
+ m("copy:success", {
450
+ entity: f,
451
+ message: a("copy.success_brief")
452
+ });
453
+ }, he = async (f) => {
454
+ var y;
455
+ await ((y = n.canRetrieve) == null ? void 0 : y.call(n, f)) && A.push(n.config.getViewRoute(f.id));
456
+ }, be = (f) => ({
457
+ label: a("actions.view"),
458
+ to: n.config.getViewRoute(f)
459
+ }), Ae = (f) => ({
460
+ label: a("actions.edit"),
461
+ to: n.config.getEditRoute(f)
462
+ }), $ = R(void 0), H = R(!1), O = R(!1), X = R(""), Te = st(n.config, te.value), Ue = (f) => {
463
+ $.value = f, H.value = !0, X.value = "";
464
+ }, ne = () => {
465
+ H.value = !1, $.value = void 0;
466
+ }, $e = async () => {
467
+ var f, g, y;
468
+ if ((f = $.value) != null && f.id) {
469
+ O.value = !0;
470
+ try {
471
+ await N.delete(Te($.value.id)), m("delete:success", $.value), ne(), C.value++;
472
+ } catch (P) {
473
+ X.value = ((y = (g = P.response) == null ? void 0 : g.data) == null ? void 0 : y.message) || P.message || a("errors.delete"), m("error", P);
474
+ } finally {
475
+ O.value = !1;
476
+ }
477
+ }
478
+ }, Re = () => {
479
+ A.push(n.config.createRoute);
480
+ };
481
+ Be(J, (f) => {
482
+ var g, y, P;
483
+ if (f.status === at.Error) {
484
+ oe.value = {
485
+ title: a("errors.general")
486
+ }, (P = (y = (g = f.error) == null ? void 0 : g.response) == null ? void 0 : y.data) != null && P.message && (oe.value.message = f.error.response.data.message), m("error", f.error);
487
+ return;
488
+ }
489
+ oe.value = null;
490
+ });
491
+ const ce = R(!1);
492
+ return ze(async () => {
493
+ ce.value = await n.canCreate();
494
+ }), (f, g) => {
495
+ const y = L("KButton"), P = L("KBadge"), W = L("KInputSwitch"), M = L("KDropdownItem"), j = L("KClipboardProvider");
496
+ return E(), T("div", $t, [
497
+ c(o(nt), {
498
+ "cache-identifier": s.cacheIdentifier,
499
+ "default-table-preferences": fe,
500
+ "disable-sorting": Ie.value,
501
+ "empty-state-options": e.value,
502
+ "enable-entity-actions": "",
503
+ "error-message": oe.value,
504
+ fetcher: o(Fe),
505
+ "fetcher-cache-key": o(C),
506
+ "pagination-type": "offset",
507
+ "preferences-storage-key": "kong-ui-entities-gateway-services-list",
508
+ query: z.value,
509
+ "table-headers": o(pe),
510
+ onClearSearchInput: se,
511
+ "onClick:row": g[4] || (g[4] = (p) => he(p)),
512
+ onSort: ae,
513
+ onState: o(B)
514
+ }, Se({
515
+ "toolbar-filter": d(() => [
516
+ c(o(dt), {
517
+ modelValue: z.value,
518
+ "onUpdate:modelValue": g[0] || (g[0] = (p) => z.value = p),
519
+ config: Z.value
520
+ }, null, 8, ["modelValue", "config"])
521
+ ]),
522
+ "toolbar-button": d(() => [
523
+ (E(), Ee(He, {
524
+ disabled: !s.useActionOutside,
525
+ to: "#kong-ui-app-page-header-action-button"
526
+ }, [
527
+ S("div", Rt, [
528
+ I.value ? (E(), Ee(y, {
529
+ key: 0,
530
+ appearance: "secondary",
531
+ class: "open-learning-hub",
532
+ "data-testid": "gateway-services-learn-more-button",
533
+ icon: "",
534
+ onClick: g[1] || (g[1] = (p) => f.$emit("click:learn-more"))
535
+ }, {
536
+ default: d(() => [
537
+ c(o(Ye), { decorative: "" })
538
+ ]),
539
+ _: 1
540
+ })) : D("", !0),
541
+ c(o(de), {
542
+ "auth-function": () => s.canCreate()
543
+ }, {
544
+ default: d(() => [
545
+ c(y, {
546
+ appearance: "primary",
547
+ "data-testid": "toolbar-add-gateway-service",
548
+ size: s.useActionOutside ? "medium" : "large",
549
+ to: s.config.createRoute
550
+ }, {
551
+ default: d(() => [
552
+ c(o(et)),
553
+ K(" " + V(o(a)("gateway_services.list.toolbar_actions.new_gateway_service")), 1)
554
+ ]),
555
+ _: 1
556
+ }, 8, ["size", "to"])
557
+ ]),
558
+ _: 1
559
+ }, 8, ["auth-function"])
560
+ ])
561
+ ], 8, ["disabled"]))
562
+ ]),
563
+ name: d(({ rowValue: p }) => [
564
+ S("b", null, V(p ?? "-"), 1)
565
+ ]),
566
+ control_plane: d(({ row: p }) => {
567
+ var U;
568
+ return [
569
+ (U = p.x_meta) != null && U.cluster_id ? (E(), Ee(P, {
570
+ key: 0,
571
+ tooltip: p.x_meta.cluster_id,
572
+ "truncation-tooltip": "",
573
+ onClick: xe((t) => ge(p.x_meta.cluster_id), ["stop"])
574
+ }, {
575
+ default: d(() => [
576
+ K(V(p.x_meta.cluster_id), 1)
577
+ ]),
578
+ _: 2
579
+ }, 1032, ["tooltip", "onClick"])) : (E(), T("b", Mt, "-"))
580
+ ];
581
+ }),
582
+ enabled: d(({ row: p }) => [
583
+ c(o(de), {
584
+ "auth-function": () => s.canEdit(p),
585
+ "force-show": ""
586
+ }, {
587
+ default: d(({ isAllowed: U }) => [
588
+ S("div", {
589
+ onClick: g[3] || (g[3] = xe(() => {
590
+ }, ["stop"]))
591
+ }, [
592
+ c(W, {
593
+ modelValue: p.enabled,
594
+ "onUpdate:modelValue": (t) => p.enabled = t,
595
+ "data-testid": `row-${p.id}-toggle-input`,
596
+ disabled: !U,
597
+ onClick: xe((t) => me(p), ["prevent"])
598
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "disabled", "onClick"])
599
+ ])
600
+ ]),
601
+ _: 2
602
+ }, 1032, ["auth-function"])
603
+ ]),
604
+ tags: d(({ rowValue: p }) => [
605
+ c(o(ct), { tags: p }, null, 8, ["tags"])
606
+ ]),
607
+ created_at: d(({ rowValue: p }) => [
608
+ K(V(o(v)(p)), 1)
609
+ ]),
610
+ updated_at: d(({ row: p, rowValue: U }) => [
611
+ K(V(o(v)(U ?? p.created_at)), 1)
612
+ ]),
613
+ actions: d(({ row: p }) => [
614
+ c(j, null, {
615
+ default: d(({ copyToClipboard: U }) => [
616
+ c(M, {
617
+ "data-testid": "action-entity-copy-id",
618
+ onClick: (t) => ye(p, U)
619
+ }, {
620
+ default: d(() => [
621
+ K(V(o(a)("actions.copy_id")), 1)
622
+ ]),
623
+ _: 2
624
+ }, 1032, ["onClick"])
625
+ ]),
626
+ _: 2
627
+ }, 1024),
628
+ c(j, null, {
629
+ default: d(({ copyToClipboard: U }) => [
630
+ c(M, {
631
+ "data-testid": "action-entity-copy-json",
632
+ onClick: (t) => _e(p, U)
633
+ }, {
634
+ default: d(() => [
635
+ K(V(o(a)("actions.copy_json")), 1)
636
+ ]),
637
+ _: 2
638
+ }, 1032, ["onClick"])
639
+ ]),
640
+ _: 2
641
+ }, 1024),
642
+ c(o(de), {
643
+ "auth-function": () => s.canRetrieve(p)
644
+ }, {
645
+ default: d(() => [
646
+ c(M, {
647
+ "data-testid": "action-entity-view",
648
+ "has-divider": "",
649
+ item: be(p.id)
650
+ }, null, 8, ["item"])
651
+ ]),
652
+ _: 2
653
+ }, 1032, ["auth-function"]),
654
+ c(o(de), {
655
+ "auth-function": () => s.canEdit(p)
656
+ }, {
657
+ default: d(() => [
658
+ c(M, {
659
+ "data-testid": "action-entity-edit",
660
+ item: Ae(p.id)
661
+ }, null, 8, ["item"])
662
+ ]),
663
+ _: 2
664
+ }, 1032, ["auth-function"]),
665
+ c(o(de), {
666
+ "auth-function": () => s.canDelete(p)
667
+ }, {
668
+ default: d(() => [
669
+ c(M, {
670
+ danger: "",
671
+ "data-testid": "action-entity-delete",
672
+ "has-divider": "",
673
+ onClick: (U) => Ue(p)
674
+ }, {
675
+ default: d(() => [
676
+ K(V(o(a)("actions.delete.menu_label")), 1)
677
+ ]),
678
+ _: 2
679
+ }, 1032, ["onClick"])
680
+ ]),
681
+ _: 2
682
+ }, 1032, ["auth-function"])
683
+ ]),
684
+ _: 2
685
+ }, [
686
+ !z.value && s.config.app === "konnect" ? {
687
+ name: "empty-state",
688
+ fn: d(() => {
689
+ var p;
690
+ return [
691
+ c(o(ut), {
692
+ "action-button-text": o(a)("gateway_services.empty_state_v2.create"),
693
+ appearance: "secondary",
694
+ "can-create": () => s.canCreate(),
695
+ "data-testid": "gateway-services-entity-empty-state",
696
+ description: o(a)("gateway_services.empty_state_v2.description"),
697
+ "learn-more": s.config.app === "konnect",
698
+ title: o(a)("gateway_services.empty_state_v2.title"),
699
+ "onClick:create": Re,
700
+ "onClick:learnMore": g[2] || (g[2] = (U) => f.$emit("click:learn-more"))
701
+ }, Se({
702
+ image: d(() => [
703
+ S("div", xt, [
704
+ c(o(tt), {
705
+ color: o(Tt),
706
+ size: o(Ut)
707
+ }, null, 8, ["color", "size"])
708
+ ])
709
+ ]),
710
+ _: 2
711
+ }, [
712
+ (p = s.config) != null && p.isControlPlaneGroup ? {
713
+ name: "message",
714
+ fn: d(() => [
715
+ K(V(o(a)("gateway_services.empty_state_v2.group")), 1)
716
+ ]),
717
+ key: "0"
718
+ } : void 0
719
+ ]), 1032, ["action-button-text", "can-create", "description", "learn-more", "title"])
720
+ ];
721
+ }),
722
+ key: "0"
723
+ } : void 0
724
+ ]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers", "onState"]),
725
+ c(o(ft), {
726
+ action: re.value.action,
727
+ "entity-id": re.value.id,
728
+ "entity-name": re.value.name,
729
+ "entity-type": o(a)("glossary.gateway_services"),
730
+ "on-confirm": Q,
731
+ visible: w.value,
732
+ onCancel: ve,
733
+ onProceed: ve
734
+ }, null, 8, ["action", "entity-id", "entity-name", "entity-type", "visible"]),
735
+ c(o(pt), {
736
+ "action-pending": O.value,
737
+ description: o(a)("actions.delete.description"),
738
+ "entity-name": $.value && ($.value.name || $.value.id),
739
+ "entity-type": o(mt).GatewayService,
740
+ error: X.value,
741
+ title: o(a)("actions.delete.title"),
742
+ visible: H.value,
743
+ onCancel: ne,
744
+ onProceed: $e
745
+ }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
746
+ ]);
747
+ };
748
+ }
749
+ }), je = (s, G) => {
750
+ const m = s.__vccOpts || s;
751
+ for (const [n, a] of G)
752
+ m[n] = a;
753
+ return m;
754
+ }, mo = /* @__PURE__ */ je(Bt, [["__scopeId", "data-v-5f172c04"]]), Dt = { class: "kong-ui-gateway-service-entity-config-card" }, vo = /* @__PURE__ */ De({
755
+ __name: "GatewayServiceConfigCard",
756
+ props: {
757
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
758
+ config: {
759
+ type: Object,
760
+ required: !0,
761
+ 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)
762
+ },
763
+ /**
764
+ * External link for documentation that determines visibility of Documentation button
765
+ */
766
+ configCardDoc: {
767
+ type: String,
768
+ default: "",
769
+ required: !1
770
+ },
771
+ /**
772
+ * Control visibility of card title content
773
+ */
774
+ hideTitle: {
775
+ type: Boolean,
776
+ default: !1
777
+ }
778
+ },
779
+ emits: ["loading", "fetch:error", "fetch:success"],
780
+ setup(s) {
781
+ const G = s, { i18n: { t: m }, i18nT: n } = ee.useI18n(), a = b(() => ue.form[G.config.app].edit), { getPropValue: v } = Oe(), A = (l, B) => v(l, B) === !0 ? m("gateway_services.form.fields.tls_verify_option.true.display") : m("gateway_services.form.fields.tls_verify_option.false.display"), N = R({
782
+ id: {},
783
+ name: {
784
+ tooltip: m("gateway_services.form.fields.name.tooltip")
785
+ },
786
+ enabled: {},
787
+ updated_at: {},
788
+ created_at: {},
789
+ protocol: {
790
+ section: ke.Basic,
791
+ tooltip: m("gateway_services.form.fields.protocol.tooltip")
792
+ },
793
+ host: {
794
+ section: ke.Basic,
795
+ tooltip: m("gateway_services.form.fields.host.tooltip")
796
+ },
797
+ path: {
798
+ section: ke.Basic,
799
+ tooltip: m("gateway_services.form.fields.path.tooltip")
800
+ },
801
+ port: {
802
+ section: ke.Basic,
803
+ tooltip: m("gateway_services.form.fields.port.tooltip")
804
+ },
805
+ tags: {
806
+ tooltip: m("gateway_services.form.fields.tags.tooltip")
807
+ },
808
+ // advanced fields
809
+ retries: {
810
+ order: 1,
811
+ tooltip: m("gateway_services.form.fields.retries.tooltip")
812
+ },
813
+ connect_timeout: {
814
+ order: 2,
815
+ tooltip: m("gateway_services.form.fields.connect_timeout.tooltip")
816
+ },
817
+ write_timeout: {
818
+ order: 3,
819
+ tooltip: m("gateway_services.form.fields.write_timeout.tooltip")
820
+ },
821
+ read_timeout: {
822
+ order: 4,
823
+ tooltip: m("gateway_services.form.fields.read_timeout.tooltip")
824
+ },
825
+ client_certificate: {
826
+ order: 5,
827
+ tooltip: m("gateway_services.form.fields.client_certificate.tooltip")
828
+ },
829
+ ca_certificates: {
830
+ type: vt.BadgeTag,
831
+ label: m("gateway_services.form.fields.ca_certificates.label"),
832
+ order: 6
833
+ },
834
+ tls_verify: {
835
+ label: m("gateway_services.form.fields.tls_verify_enabled.label")
836
+ },
837
+ tls_verify_depth: {
838
+ hidden: !0
839
+ }
840
+ });
841
+ return (l, B) => (E(), T("div", Dt, [
842
+ c(o(gt), {
843
+ config: s.config,
844
+ "config-card-doc": s.configCardDoc,
845
+ "config-schema": N.value,
846
+ "entity-type": o(We).GatewayService,
847
+ "fetch-url": a.value,
848
+ "hide-title": s.hideTitle,
849
+ "onFetch:error": B[0] || (B[0] = (I) => l.$emit("fetch:error", I)),
850
+ "onFetch:success": B[1] || (B[1] = (I) => l.$emit("fetch:success", I)),
851
+ onLoading: B[2] || (B[2] = (I) => l.$emit("loading", I))
852
+ }, {
853
+ "enabled-label-tooltip": d(() => [
854
+ c(o(n), {
855
+ keypath: "gateway_services.form.fields.enabled.tooltip",
856
+ scope: "global"
857
+ }, {
858
+ false: d(() => [
859
+ S("code", null, V(o(m)("gateway_services.form.fields.enabled.false")), 1)
860
+ ]),
861
+ true: d(() => [
862
+ S("code", null, V(o(m)("gateway_services.form.fields.enabled.true")), 1)
863
+ ]),
864
+ _: 1
865
+ })
866
+ ]),
867
+ "ca_certificates-label-tooltip": d(() => [
868
+ c(o(n), {
869
+ keypath: "gateway_services.form.fields.ca_certificates.tooltip",
870
+ scope: "global"
871
+ }, {
872
+ code1: d(() => [
873
+ S("code", null, V(o(m)("gateway_services.form.fields.ca_certificates.code1")), 1)
874
+ ]),
875
+ code2: d(() => [
876
+ S("code", null, V(o(m)("gateway_services.form.fields.ca_certificates.code2")), 1)
877
+ ]),
878
+ _: 1
879
+ })
880
+ ]),
881
+ "tls_verify-label-tooltip": d(() => [
882
+ c(o(n), {
883
+ keypath: "gateway_services.form.fields.tls_verify_enabled.tooltip",
884
+ scope: "global"
885
+ }, {
886
+ code1: d(() => [
887
+ S("code", null, V(o(m)("gateway_services.form.fields.tls_verify_enabled.code1")), 1)
888
+ ]),
889
+ _: 1
890
+ })
891
+ ]),
892
+ tls_verify: d((I) => [
893
+ K(V(typeof o(v)("rowValue", I) == "boolean" ? A("rowValue", I) : o(m)("gateway_services.form.fields.tls_verify_option.unset.display")), 1)
894
+ ]),
895
+ client_certificate: d((I) => [
896
+ K(V(o(v)("rowValue", I) ? o(v)("rowValue", I).id : "–"), 1)
897
+ ]),
898
+ _: 1
899
+ }, 8, ["config", "config-card-doc", "config-schema", "entity-type", "fetch-url", "hide-title"])
900
+ ]));
901
+ }
902
+ }), q = {
903
+ name: "Kong-Air-Flights-API",
904
+ protocol: "https",
905
+ path: "/flights",
906
+ host: "api.kong-air.com",
907
+ port: 443
908
+ }, Kt = { class: "kong-ui-entities-gateway-service-form" }, Lt = {
909
+ key: 0,
910
+ class: "gateway-service-form-general-info"
911
+ }, qt = { class: "gateway-service-form-group-selection-wrapper" }, Gt = {
912
+ key: 0,
913
+ class: "gateway-service-form-group-fields"
914
+ }, Nt = {
915
+ key: 0,
916
+ class: "gateway-service-form-group-fields"
917
+ }, Ot = { key: 0 }, Wt = {
918
+ key: 0,
919
+ class: "gateway-service-form-advanced-fields"
920
+ }, jt = { class: "gateway-service-form-margin-bottom" }, zt = { class: "gateway-service-form-margin-bottom" }, Ht = { class: "gateway-service-form-margin-bottom" }, Zt = { class: "gateway-service-form-margin-bottom" }, Jt = {
921
+ key: 0,
922
+ class: "gateway-service-form-margin-bottom"
923
+ }, Qt = {
924
+ key: 1,
925
+ class: "gateway-service-form-margin-bottom"
926
+ }, Xt = {
927
+ key: 2,
928
+ class: "gateway-service-form-margin-bottom"
929
+ }, Yt = {
930
+ key: 0,
931
+ class: "checkbox-aligned-radio"
932
+ }, eo = {
933
+ key: 1,
934
+ class: "checkbox-aligned-radio"
935
+ }, to = { class: "gateway-service-form-tags" }, oo = { class: "form-error-list" }, ro = /* @__PURE__ */ De({
936
+ __name: "GatewayServiceForm",
937
+ props: {
938
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
939
+ config: {
940
+ type: Object,
941
+ required: !0,
942
+ 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)
943
+ },
944
+ /** If a valid Gateway Service ID is provided, it will put the form in Edit mode instead of Create */
945
+ gatewayServiceId: {
946
+ type: String,
947
+ required: !1,
948
+ default: ""
949
+ },
950
+ /** Whether show or hide EntityFormSection info column */
951
+ hideSectionsInfo: {
952
+ type: Boolean,
953
+ required: !1,
954
+ default: !1
955
+ },
956
+ /** Whether show or hide Try sample API button */
957
+ hideTrySampleApiButton: {
958
+ type: Boolean,
959
+ required: !1,
960
+ default: !1
961
+ }
962
+ },
963
+ emits: ["update", "error", "url-valid:success", "url-valid:error", "loading", "model-updated", "try-sample-api"],
964
+ setup(s, { expose: G, emit: m }) {
965
+ var U;
966
+ const n = m, a = s, v = R(!0), A = Ge(), { i18nT: N, i18n: { t: l } } = ee.useI18n(), { getErrorFieldsFromError: B } = yt(), { axiosInstance: I } = Ne((U = a.config) == null ? void 0 : U.axiosRequestConfig), Ie = _t(), { validateHost: le, validatePath: fe, validatePort: pe, validateProtocol: te } = ee.useUrlValidators(), { objectsAreEqual: Pe } = Oe(), z = b(() => ue.form[a.config.app].edit), Z = b(() => a.gatewayServiceId ? Le.Edit : Le.Create), Fe = R(!1), J = b(() => !!a.gatewayServiceId), C = R(J.value ? "protocol" : "url"), se = ee.usePortFromProtocol(), ae = R(""), oe = b(() => !!ae.value || !!$("name")), e = Ke({
967
+ fields: {
968
+ name: "",
969
+ protocol: "http",
970
+ host: "",
971
+ path: "",
972
+ port: 80,
973
+ url: "",
974
+ retries: 5,
975
+ connect_timeout: 6e4,
976
+ write_timeout: 6e4,
977
+ read_timeout: 6e4,
978
+ client_certificate: "",
979
+ ca_certificates: "",
980
+ tls_verify_enabled: !1,
981
+ tls_verify_value: !1,
982
+ tags: "",
983
+ enabled: !0
984
+ },
985
+ isReadonly: !1,
986
+ errorMessages: [],
987
+ formFieldErrors: {
988
+ host: "",
989
+ port: "",
990
+ path: "",
991
+ name: "",
992
+ url: "",
993
+ tags: "",
994
+ retries: "",
995
+ connect_timeout: "",
996
+ write_timeout: "",
997
+ read_timeout: "",
998
+ client_certificate: "",
999
+ ca_certificates: "",
1000
+ tls_verify_enabled: "",
1001
+ tls_verify_value: ""
1002
+ }
1003
+ }), w = Ke({
1004
+ name: "",
1005
+ protocol: "http",
1006
+ host: "",
1007
+ path: "",
1008
+ port: 80,
1009
+ url: "",
1010
+ retries: 5,
1011
+ connect_timeout: 6e4,
1012
+ write_timeout: 6e4,
1013
+ read_timeout: 6e4,
1014
+ client_certificate: "",
1015
+ ca_certificates: "",
1016
+ tls_verify_enabled: !1,
1017
+ tls_verify_value: !1,
1018
+ tags: "",
1019
+ enabled: !0
1020
+ }), x = a.config.app === "konnect" || ht({
1021
+ gatewayInfo: a.config.gatewayInfo,
1022
+ // 'ws' and 'wss' are not valid values for the protocol field in Gateway Community Edition or before Gateway Enterprise Edition 3.0
1023
+ supportedRange: {
1024
+ enterprise: ["3.0"]
1025
+ }
1026
+ }), re = [
1027
+ {
1028
+ label: l("gateway_services.form.fields.protocol.options.http"),
1029
+ value: "http",
1030
+ group: "http"
1031
+ },
1032
+ {
1033
+ label: l("gateway_services.form.fields.protocol.options.https"),
1034
+ value: "https",
1035
+ group: "http"
1036
+ },
1037
+ {
1038
+ label: l("gateway_services.form.fields.protocol.options.tcp"),
1039
+ value: "tcp",
1040
+ group: "tcp"
1041
+ },
1042
+ {
1043
+ label: l("gateway_services.form.fields.protocol.options.tls"),
1044
+ value: "tls",
1045
+ group: "tcp"
1046
+ },
1047
+ {
1048
+ label: l("gateway_services.form.fields.protocol.options.tls_passthrough"),
1049
+ value: "tls_passthrough",
1050
+ group: "tcp"
1051
+ },
1052
+ {
1053
+ label: l("gateway_services.form.fields.protocol.options.grpc"),
1054
+ value: "grpc",
1055
+ group: "grpc"
1056
+ },
1057
+ {
1058
+ label: l("gateway_services.form.fields.protocol.options.grpcs"),
1059
+ value: "grpcs",
1060
+ group: "grpc"
1061
+ },
1062
+ ...x ? [
1063
+ {
1064
+ label: l("gateway_services.form.fields.protocol.options.ws"),
1065
+ value: "ws",
1066
+ group: "websocket"
1067
+ },
1068
+ {
1069
+ label: l("gateway_services.form.fields.protocol.options.wss"),
1070
+ value: "wss",
1071
+ group: "websocket"
1072
+ }
1073
+ ] : [],
1074
+ {
1075
+ label: l("gateway_services.form.fields.protocol.options.udp"),
1076
+ value: "udp",
1077
+ group: "udp"
1078
+ }
1079
+ ], me = { url: "url", protocol: "protocol" }, ve = (t, r) => {
1080
+ r.value;
1081
+ }, Q = (t) => t ? parseFloat(t) : 0, ge = () => {
1082
+ e.fields.host = w.host, e.fields.path = w.path, e.fields.port = w.port, e.fields.protocol = w.protocol, e.fields.url = w.url, e.fields.retries = w.retries, e.fields.connect_timeout = w.connect_timeout, e.fields.write_timeout = w.write_timeout, e.fields.read_timeout = w.read_timeout, e.fields.client_certificate = w.client_certificate, e.fields.ca_certificates = w.ca_certificates, e.fields.tls_verify_enabled = w.tls_verify_enabled, e.fields.tls_verify_value = w.tls_verify_value, e.fields.enabled = w.enabled;
1083
+ }, ye = () => {
1084
+ v.value = !0, O(), e.errorMessages = [], ge();
1085
+ }, _e = () => {
1086
+ switch (ge(), e.fields.name = `${q.name}-${(/* @__PURE__ */ new Date()).toISOString().replace(/\D/g, "").slice(0, 17)}`, C.value) {
1087
+ case "url":
1088
+ e.fields.url = `${q.protocol}://${q.host}${q.path}`;
1089
+ break;
1090
+ case "protocol":
1091
+ e.fields.host = q.host, e.fields.path = q.path, e.fields.protocol = q.protocol, e.fields.port = q.port;
1092
+ break;
1093
+ default:
1094
+ e.fields.url = `${q.protocol}://${q.host}${q.path}`;
1095
+ }
1096
+ }, he = () => {
1097
+ if (O(), e.fields.url.length)
1098
+ try {
1099
+ const t = new URL(e.fields.url), r = te(t.protocol, re);
1100
+ if (r) throw new Error(r);
1101
+ e.fields.protocol = t.protocol.slice(0, -1);
1102
+ const _ = le(t.hostname);
1103
+ if (_) throw new Error(_);
1104
+ e.fields.host = t.hostname;
1105
+ const F = fe(t.pathname);
1106
+ if (F) throw new Error(F);
1107
+ e.fields.path = t.pathname;
1108
+ const h = pe(t.port);
1109
+ if (h) throw new Error(h);
1110
+ const k = Number(t.port);
1111
+ Fe.value = !!k, e.fields.port = k || se.getPortFromProtocol(e.fields.protocol), n("url-valid:success");
1112
+ } catch {
1113
+ n("url-valid:error", l("gateway_services.form.errors.url.invalid")), e.formFieldErrors.url = l("gateway_services.form.errors.url.invalid");
1114
+ }
1115
+ }, be = (t) => {
1116
+ O(t);
1117
+ }, Ae = b(() => !!e.formFieldErrors.url || !!e.formFieldErrors.host || !!e.formFieldErrors.port), $ = (t) => {
1118
+ if (e.errorMessages.length) return "";
1119
+ const r = e.formFieldErrors;
1120
+ return r[t] ? r[t] : "";
1121
+ }, H = (t) => {
1122
+ O(t ?? void 0);
1123
+ const r = le(e.fields.host);
1124
+ r && (e.formFieldErrors.host = r);
1125
+ const _ = fe(e.fields.path);
1126
+ _ && (e.formFieldErrors.path = _);
1127
+ const F = pe(e.fields.port);
1128
+ F && (e.formFieldErrors.port = F), X.value ? n("url-valid:success") : n("url-valid:error", e.errorMessages.join(",") || l("gateway_services.form.errors.url.invalid"));
1129
+ }, O = (t) => {
1130
+ if (t)
1131
+ e.formFieldErrors[t] = "";
1132
+ else
1133
+ for (let r in e.formFieldErrors)
1134
+ e.formFieldErrors[r] = "";
1135
+ e.errorMessages = [];
1136
+ }, X = b(() => {
1137
+ for (let t in e.formFieldErrors)
1138
+ if (e.formFieldErrors[t].length)
1139
+ return !1;
1140
+ return !0;
1141
+ }), Te = () => {
1142
+ e.fields.url && C.value === "url" ? he() : H();
1143
+ }, Ue = () => `new-service-${(/* @__PURE__ */ new Date()).toISOString().replace(/\D/g, "").slice(0, 17)}`, ne = b(() => !["tcp", "tls", "tls_passthrough", "grpc", "grpcs", "udp"].includes(e.fields.protocol)), $e = b(() => {
1144
+ if (C.value === "url")
1145
+ return !0;
1146
+ const t = ["https", "wss", "tls"].includes(e.fields.protocol);
1147
+ return C.value === "protocol" && t;
1148
+ }), Re = b(() => {
1149
+ if (C.value === "url")
1150
+ return !0;
1151
+ const t = ["https", "tls"].includes(e.fields.protocol);
1152
+ return C.value === "protocol" && t;
1153
+ }), ce = b(() => {
1154
+ if (C.value === "url")
1155
+ return !0;
1156
+ const t = ["https", "wss", "tls"].includes(e.fields.protocol);
1157
+ return C.value === "protocol" && t;
1158
+ }), we = (t) => {
1159
+ O("name"), ae.value = Ie.utf8Name(t);
1160
+ }, f = b(() => {
1161
+ const t = !J.value || !Pe(e.fields, w), r = C.value === "url" && !!e.fields.url && X.value, _ = C.value === "protocol" && !!e.fields.host && X.value;
1162
+ return t && (r || _);
1163
+ }), g = (t) => {
1164
+ var r, _, F;
1165
+ e.fields.name = (t == null ? void 0 : t.name) || "", e.fields.tags = ((r = t == null ? void 0 : t.tags) == null ? void 0 : r.join(", ")) || "", e.fields.protocol = (t == null ? void 0 : t.protocol) || "http", e.fields.path = (t == null ? void 0 : t.path) || "", e.fields.read_timeout = t != null && t.read_timeout || (t == null ? void 0 : t.read_timeout) === 0 ? t == null ? void 0 : t.read_timeout : 6e4, e.fields.retries = t != null && t.retries || (t == null ? void 0 : t.retries) === 0 ? t == null ? void 0 : t.retries : 5, e.fields.host = (t == null ? void 0 : t.host) || "", e.fields.connect_timeout = t != null && t.connect_timeout || (t == null ? void 0 : t.connect_timeout) === 0 ? t == null ? void 0 : t.connect_timeout : 6e4, e.fields.tls_verify_enabled = (t == null ? void 0 : t.tls_verify) !== "" && (t == null ? void 0 : t.tls_verify) !== null && (t == null ? void 0 : t.tls_verify) !== void 0, e.fields.tls_verify_value = t != null && t.tls_verify ? t == null ? void 0 : t.tls_verify : !1, e.fields.ca_certificates = ((_ = t == null ? void 0 : t.ca_certificates) == null ? void 0 : _.join(",")) || "", e.fields.client_certificate = ((F = t == null ? void 0 : t.client_certificate) == null ? void 0 : F.id) || "", e.fields.write_timeout = t != null && t.write_timeout || (t == null ? void 0 : t.write_timeout) === 0 ? t == null ? void 0 : t.write_timeout : 6e4, e.fields.port = t != null && t.port || (t == null ? void 0 : t.port) === 0 ? t == null ? void 0 : t.port : 80, e.fields.enabled = (t == null ? void 0 : t.enabled) ?? !0, Object.assign(w, e.fields);
1166
+ }, y = () => {
1167
+ A.push(a.config.cancelRoute);
1168
+ }, P = b(() => {
1169
+ var r, _;
1170
+ let t = `${a.config.apiBaseUrl}${ue.form[a.config.app].validate}`;
1171
+ return a.config.app === "konnect" ? t = t.replace(/{controlPlaneId}/gi, ((r = a.config) == null ? void 0 : r.controlPlaneId) || "") : a.config.app === "kongManager" && (t = t.replace(/\/{workspace}/gi, (_ = a.config) != null && _.workspace ? `/${a.config.workspace}` : "")), t = t.replace(/{id}/gi, a.gatewayServiceId), t;
1172
+ }), W = b(() => {
1173
+ var r, _;
1174
+ let t = `${a.config.apiBaseUrl}${ue.form[a.config.app][Z.value]}`;
1175
+ return a.config.app === "konnect" ? t = t.replace(/{controlPlaneId}/gi, ((r = a.config) == null ? void 0 : r.controlPlaneId) || "") : a.config.app === "kongManager" && (t = t.replace(/\/{workspace}/gi, (_ = a.config) != null && _.workspace ? `/${a.config.workspace}` : "")), t = t.replace(/{id}/gi, a.gatewayServiceId), t;
1176
+ }), M = (t) => {
1177
+ let r = "";
1178
+ t.url && (r = new URL(t.url).protocol), (["https", "wss", "tls"].includes(t.protocol) || ["https", "wss", "tls"].includes(r)) && (t.tls_verify = t.tls_verify_enabled ? t.tls_verify_value : null), delete t.tls_verify_enabled, delete t.tls_verify_value;
1179
+ }, j = b(() => {
1180
+ var r, _, F, h;
1181
+ const t = {
1182
+ name: e.fields.name || null,
1183
+ tags: e.fields.tags ? (F = (_ = (r = e.fields.tags) == null ? void 0 : r.split(",")) == null ? void 0 : _.map((k) => String(k || "").trim())) == null ? void 0 : F.filter((k) => k !== "") : null,
1184
+ protocol: e.fields.protocol,
1185
+ path: e.fields.path || null,
1186
+ read_timeout: e.fields.read_timeout,
1187
+ retries: e.fields.retries,
1188
+ host: e.fields.host,
1189
+ connect_timeout: e.fields.connect_timeout,
1190
+ tls_verify_value: e.fields.tls_verify_value,
1191
+ tls_verify_enabled: e.fields.tls_verify_enabled,
1192
+ ca_certificates: e.fields.ca_certificates ? (h = e.fields.ca_certificates) == null ? void 0 : h.split(",").filter((k) => k !== "") : null,
1193
+ client_certificate: e.fields.client_certificate ? { id: e.fields.client_certificate } : null,
1194
+ write_timeout: e.fields.write_timeout,
1195
+ port: e.fields.port,
1196
+ url: e.fields.url,
1197
+ enabled: e.fields.enabled
1198
+ };
1199
+ return e.fields.client_certificate && ["https", "wss", "tls"].includes(e.fields.protocol) && (t.client_certificate = { id: e.fields.client_certificate }), e.fields.tls_verify_enabled && ["https", "wss", "tls"].includes(e.fields.protocol) && (t.tls_verify = e.fields.tls_verify_value), ne.value || (t.path = null), Z.value === "create" ? C.value === "url" ? (delete t.protocol, delete t.host, delete t.path, a.config.app === "konnect" && delete t.port) : delete t.url : Z.value === "edit" && delete t.url, t;
1200
+ }), p = async () => {
1201
+ var t, r, _, F;
1202
+ try {
1203
+ e.isReadonly = !0;
1204
+ const h = j.value;
1205
+ M(h);
1206
+ let k;
1207
+ if (await I.post(P.value, h), Z.value === "create" ? k = await I.post(W.value, h) : Z.value === "edit" && (k = ((t = a.config) == null ? void 0 : t.app) === "konnect" ? await I.put(W.value, h) : await I.patch(W.value, h)), k) {
1208
+ const { data: i } = k;
1209
+ e.fields.name = (i == null ? void 0 : i.name) || "", e.fields.port = i.port || se.getPortFromProtocol(i.protocol), e.fields.protocol = (i == null ? void 0 : i.protocol) || "http", e.fields.host = (i == null ? void 0 : i.host) || "", e.fields.path = (i == null ? void 0 : i.path) || "", e.fields.url = (i == null ? void 0 : i.url) || "", e.fields.retries = i != null && i.retries || (i == null ? void 0 : i.retries) === 0 ? i == null ? void 0 : i.retries : 5, e.fields.connect_timeout = i != null && i.connect_timeout || (i == null ? void 0 : i.connect_timeout) === 0 ? i == null ? void 0 : i.connect_timeout : 6e4, e.fields.write_timeout = i != null && i.write_timeout || (i == null ? void 0 : i.write_timeout) === 0 ? i == null ? void 0 : i.write_timeout : 6e4, e.fields.read_timeout = i != null && i.read_timeout || (i == null ? void 0 : i.read_timeout) === 0 ? i == null ? void 0 : i.read_timeout : 6e4, e.fields.client_certificate = ((r = i == null ? void 0 : i.client_certificate) == null ? void 0 : r.id) || "", e.fields.ca_certificates = (_ = i == null ? void 0 : i.ca_certificates) != null && _.length ? i == null ? void 0 : i.ca_certificates.join(",") : "", e.fields.tls_verify_enabled = (i == null ? void 0 : i.tls_verify) !== "" && (i == null ? void 0 : i.tls_verify) !== null && (i == null ? void 0 : i.tls_verify) !== void 0, e.fields.tls_verify_value = e.fields.tls_verify_enabled && (i == null ? void 0 : i.tls_verify), e.fields.tags = (F = i == null ? void 0 : i.tags) != null && F.length ? i.tags.join(", ") : "", e.fields.enabled = (i == null ? void 0 : i.enabled) ?? !0, Object.assign(w, e.fields), n("update", k == null ? void 0 : k.data);
1210
+ }
1211
+ return k;
1212
+ } catch (h) {
1213
+ const { fields: k, messages: i } = B(h);
1214
+ e.errorMessages = i, k.length && k.forEach((Y) => {
1215
+ const ie = Y.field;
1216
+ ie === "client_certificate.id" ? e.formFieldErrors.client_certificate = Y.message : ie.startsWith("ca_certificates") ? e.formFieldErrors.ca_certificates = Y.message : Object.keys(e.formFieldErrors).includes(ie) && (e.formFieldErrors = {
1217
+ ...e.formFieldErrors,
1218
+ [ie]: Y.message
1219
+ });
1220
+ }), n("error", h);
1221
+ } finally {
1222
+ e.isReadonly = !1;
1223
+ }
1224
+ };
1225
+ return Be(() => a.gatewayServiceId, () => {
1226
+ Object.assign(e.fields, w);
1227
+ }), Be(e.fields, (t) => {
1228
+ e.fields.port = se.getPortFromProtocol(t.protocol, String(t.port)), n("model-updated", j.value);
1229
+ }), Ze(() => {
1230
+ n("model-updated", j.value), J.value || (e.fields.name = Ue());
1231
+ }), G({
1232
+ validateUrl: Te,
1233
+ getPayload: j,
1234
+ saveFormData: p,
1235
+ canSubmit: f,
1236
+ initForm: g
1237
+ }), (t, r) => {
1238
+ const _ = L("KRadio"), F = L("KButton"), h = L("KInput"), k = L("KSelect"), i = L("KCheckbox"), Y = L("KCollapse"), ie = L("KAlert");
1239
+ return E(), T("div", Kt, [
1240
+ c(o(bt), {
1241
+ "can-submit": f.value,
1242
+ config: s.config,
1243
+ "edit-id": s.gatewayServiceId,
1244
+ "entity-type": o(We).GatewayService,
1245
+ "fetch-url": z.value,
1246
+ "form-fields": j.value,
1247
+ "is-readonly": e.isReadonly,
1248
+ onCancel: y,
1249
+ "onFetch:error": r[31] || (r[31] = (u) => t.$emit("error", u)),
1250
+ "onFetch:success": g,
1251
+ onLoading: r[32] || (r[32] = (u) => t.$emit("loading", u)),
1252
+ onSubmit: p
1253
+ }, {
1254
+ "form-actions": d(() => [
1255
+ Xe(t.$slots, "form-actions", {
1256
+ canSubmit: f.value,
1257
+ cancel: y,
1258
+ submit: p
1259
+ }, void 0, !0)
1260
+ ]),
1261
+ default: d(() => [
1262
+ c(o(qe), {
1263
+ description: o(l)("gateway_services.form.sections.keys.description"),
1264
+ "hide-info-header": s.hideSectionsInfo,
1265
+ title: o(l)("gateway_services.form.sections.keys.title")
1266
+ }, {
1267
+ default: d(() => [
1268
+ J.value ? D("", !0) : (E(), T("div", Lt, [
1269
+ S("div", qt, [
1270
+ c(_, {
1271
+ modelValue: C.value,
1272
+ "onUpdate:modelValue": r[0] || (r[0] = (u) => C.value = u),
1273
+ card: "",
1274
+ "card-orientation": "horizontal",
1275
+ "data-testid": "gateway-service-url-radio",
1276
+ description: o(l)("gateway_services.form.sections.keys.url.description"),
1277
+ label: o(l)("gateway_services.form.sections.keys.url.label"),
1278
+ "selected-value": me.url,
1279
+ onChange: ye
1280
+ }, null, 8, ["modelValue", "description", "label", "selected-value"]),
1281
+ c(_, {
1282
+ modelValue: C.value,
1283
+ "onUpdate:modelValue": r[1] || (r[1] = (u) => C.value = u),
1284
+ card: "",
1285
+ "card-orientation": "horizontal",
1286
+ "checked-group": "protocol",
1287
+ "data-testid": "gateway-service-protocol-radio",
1288
+ description: o(l)("gateway_services.form.sections.keys.protocol.description"),
1289
+ label: o(l)("gateway_services.form.sections.keys.protocol.label"),
1290
+ "selected-value": me.protocol,
1291
+ onChange: ye
1292
+ }, null, 8, ["modelValue", "description", "label", "selected-value"])
1293
+ ]),
1294
+ c(Me, { name: "slide-fade" }, {
1295
+ default: d(() => [
1296
+ C.value === "url" ? (E(), T("div", Gt, [
1297
+ c(h, {
1298
+ modelValue: e.fields.url,
1299
+ "onUpdate:modelValue": r[2] || (r[2] = (u) => e.fields.url = u),
1300
+ modelModifiers: { trim: !0 },
1301
+ class: "gateway-service-url-input gateway-service-form-margin-bottom",
1302
+ "data-testid": "gateway-service-url-input",
1303
+ error: Ae.value,
1304
+ "error-message": $("url"),
1305
+ label: o(l)("gateway_services.form.fields.upstream_url.label"),
1306
+ "label-attributes": {
1307
+ info: s.config.app === "konnect" ? o(l)("gateway_services.form.fields.upstream_url.tooltip_for_konnect") : o(l)("gateway_services.form.fields.upstream_url.tooltip_for_km"),
1308
+ tooltipAttributes: { maxWidth: "400" }
1309
+ },
1310
+ name: "url",
1311
+ placeholder: o(l)("gateway_services.form.fields.upstream_url.placeholder"),
1312
+ required: "",
1313
+ onInput: he
1314
+ }, Se({ _: 2 }, [
1315
+ s.hideTrySampleApiButton ? void 0 : {
1316
+ name: "after",
1317
+ fn: d(() => [
1318
+ c(F, {
1319
+ appearance: "tertiary",
1320
+ "data-testid": "try-sample-api",
1321
+ size: "small",
1322
+ onClick: _e
1323
+ }, {
1324
+ default: d(() => [
1325
+ K(V(o(l)("gateway_services.form.buttons.try_sample")), 1)
1326
+ ]),
1327
+ _: 1
1328
+ })
1329
+ ]),
1330
+ key: "0"
1331
+ }
1332
+ ]), 1032, ["modelValue", "error", "error-message", "label", "label-attributes", "placeholder"])
1333
+ ])) : D("", !0)
1334
+ ]),
1335
+ _: 1
1336
+ })
1337
+ ])),
1338
+ c(Me, { name: "slide-fade" }, {
1339
+ default: d(() => [
1340
+ C.value === "protocol" || J.value ? (E(), T("div", Nt, [
1341
+ c(k, {
1342
+ modelValue: e.fields.protocol,
1343
+ "onUpdate:modelValue": r[3] || (r[3] = (u) => e.fields.protocol = u),
1344
+ "data-testid": "gateway-service-protocol-select",
1345
+ items: re,
1346
+ label: o(l)("gateway_services.form.fields.protocol.label"),
1347
+ "label-attributes": {
1348
+ info: o(l)("gateway_services.form.fields.protocol.tooltip"),
1349
+ tooltipAttributes: { maxWidth: "400" }
1350
+ },
1351
+ readonly: e.isReadonly,
1352
+ required: "",
1353
+ width: "100%",
1354
+ onSelected: r[4] || (r[4] = (u) => ve(e.fields.protocol, u))
1355
+ }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1356
+ c(h, {
1357
+ modelValue: e.fields.host,
1358
+ "onUpdate:modelValue": r[5] || (r[5] = (u) => e.fields.host = u),
1359
+ modelModifiers: { trim: !0 },
1360
+ class: "gateway-service-form-margin-top",
1361
+ "data-testid": "gateway-service-host-input",
1362
+ error: !!e.formFieldErrors.host,
1363
+ "error-message": $("host"),
1364
+ label: o(l)("gateway_services.form.fields.host.label"),
1365
+ "label-attributes": {
1366
+ info: o(l)("gateway_services.form.fields.host.tooltip"),
1367
+ tooltipAttributes: { maxWidth: "400" }
1368
+ },
1369
+ name: "host",
1370
+ placeholder: o(l)("gateway_services.form.fields.host.placeholder"),
1371
+ required: "",
1372
+ onInput: r[6] || (r[6] = (u) => H("host"))
1373
+ }, Se({ _: 2 }, [
1374
+ s.hideTrySampleApiButton ? void 0 : {
1375
+ name: "after",
1376
+ fn: d(() => [
1377
+ c(F, {
1378
+ appearance: "tertiary",
1379
+ size: "small",
1380
+ onClick: _e
1381
+ }, {
1382
+ default: d(() => [
1383
+ K(V(o(l)("gateway_services.form.buttons.try_sample")), 1)
1384
+ ]),
1385
+ _: 1
1386
+ })
1387
+ ]),
1388
+ key: "0"
1389
+ }
1390
+ ]), 1032, ["modelValue", "error", "error-message", "label", "label-attributes", "placeholder"]),
1391
+ ne.value ? (E(), T("div", Ot, [
1392
+ c(h, {
1393
+ modelValue: e.fields.path,
1394
+ "onUpdate:modelValue": r[7] || (r[7] = (u) => e.fields.path = u),
1395
+ modelModifiers: { trim: !0 },
1396
+ class: "gateway-service-form-margin-top",
1397
+ "data-testid": "gateway-service-path-input",
1398
+ error: !!e.formFieldErrors.path,
1399
+ "error-message": $("path"),
1400
+ label: o(l)("gateway_services.form.fields.path.label"),
1401
+ "label-attributes": {
1402
+ info: o(l)("gateway_services.form.fields.path.tooltip"),
1403
+ tooltipAttributes: { maxWidth: "400" }
1404
+ },
1405
+ name: "path",
1406
+ placeholder: o(l)("gateway_services.form.fields.path.placeholder"),
1407
+ onInput: r[8] || (r[8] = (u) => H("path"))
1408
+ }, null, 8, ["modelValue", "error", "error-message", "label", "label-attributes", "placeholder"])
1409
+ ])) : D("", !0),
1410
+ c(h, {
1411
+ modelValue: e.fields.port,
1412
+ "onUpdate:modelValue": [
1413
+ r[9] || (r[9] = (u) => e.fields.port = u),
1414
+ r[11] || (r[11] = () => {
1415
+ e.fields.port = Q(e.fields.port + "");
1416
+ })
1417
+ ],
1418
+ class: "gateway-service-form-margin-top",
1419
+ "data-testid": "gateway-service-port-input",
1420
+ error: !!e.formFieldErrors.port,
1421
+ "error-message": $("port"),
1422
+ label: o(l)("gateway_services.form.fields.port.label"),
1423
+ "label-attributes": {
1424
+ info: o(l)("gateway_services.form.fields.port.tooltip"),
1425
+ tooltipAttributes: { maxWidth: "400" }
1426
+ },
1427
+ name: "port",
1428
+ type: "number",
1429
+ onInput: r[10] || (r[10] = (u) => H("port"))
1430
+ }, null, 8, ["modelValue", "error", "error-message", "label", "label-attributes"])
1431
+ ])) : D("", !0)
1432
+ ]),
1433
+ _: 1
1434
+ }),
1435
+ c(Y, {
1436
+ modelValue: v.value,
1437
+ "onUpdate:modelValue": r[27] || (r[27] = (u) => v.value = u),
1438
+ "data-testid": "advanced-fields-collapse",
1439
+ "trigger-alignment": "leading",
1440
+ "trigger-label": o(l)("gateway_services.form.sections.keys.viewAdvancedFields")
1441
+ }, {
1442
+ default: d(() => [
1443
+ c(Me, { name: "slide-fade" }, {
1444
+ default: d(() => [
1445
+ v.value ? D("", !0) : (E(), T("div", Wt, [
1446
+ S("div", jt, [
1447
+ c(h, {
1448
+ modelValue: e.fields.retries,
1449
+ "onUpdate:modelValue": [
1450
+ r[12] || (r[12] = (u) => e.fields.retries = u),
1451
+ r[13] || (r[13] = () => {
1452
+ e.fields.retries = Q(e.fields.retries + "");
1453
+ })
1454
+ ],
1455
+ autocomplete: "off",
1456
+ "data-testid": "gateway-service-retries-input",
1457
+ label: o(l)("gateway_services.form.fields.retries.label"),
1458
+ "label-attributes": {
1459
+ info: o(l)("gateway_services.form.fields.retries.tooltip"),
1460
+ tooltipAttributes: { maxWidth: "400" }
1461
+ },
1462
+ name: "retries",
1463
+ readonly: e.isReadonly,
1464
+ type: "number"
1465
+ }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])
1466
+ ]),
1467
+ S("div", zt, [
1468
+ c(h, {
1469
+ modelValue: e.fields.connect_timeout,
1470
+ "onUpdate:modelValue": [
1471
+ r[14] || (r[14] = (u) => e.fields.connect_timeout = u),
1472
+ r[15] || (r[15] = () => {
1473
+ e.fields.connect_timeout = Q(e.fields.connect_timeout + "");
1474
+ })
1475
+ ],
1476
+ autocomplete: "off",
1477
+ "data-testid": "gateway-service-connTimeout-input",
1478
+ label: o(l)("gateway_services.form.fields.connect_timeout.label"),
1479
+ "label-attributes": {
1480
+ info: o(l)("gateway_services.form.fields.connect_timeout.tooltip"),
1481
+ tooltipAttributes: { maxWidth: "400" }
1482
+ },
1483
+ name: "connTimeout",
1484
+ readonly: e.isReadonly,
1485
+ type: "number"
1486
+ }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])
1487
+ ]),
1488
+ S("div", Ht, [
1489
+ c(h, {
1490
+ modelValue: e.fields.write_timeout,
1491
+ "onUpdate:modelValue": [
1492
+ r[16] || (r[16] = (u) => e.fields.write_timeout = u),
1493
+ r[17] || (r[17] = () => {
1494
+ e.fields.write_timeout = Q(e.fields.write_timeout + "");
1495
+ })
1496
+ ],
1497
+ autocomplete: "off",
1498
+ "data-testid": "gateway-service-writeTimeout-input",
1499
+ label: o(l)("gateway_services.form.fields.write_timeout.label"),
1500
+ "label-attributes": {
1501
+ info: o(l)("gateway_services.form.fields.write_timeout.tooltip"),
1502
+ tooltipAttributes: { maxWidth: "400" }
1503
+ },
1504
+ name: "writeTimeout",
1505
+ readonly: e.isReadonly,
1506
+ type: "number"
1507
+ }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])
1508
+ ]),
1509
+ S("div", Zt, [
1510
+ c(h, {
1511
+ modelValue: e.fields.read_timeout,
1512
+ "onUpdate:modelValue": [
1513
+ r[18] || (r[18] = (u) => e.fields.read_timeout = u),
1514
+ r[19] || (r[19] = () => {
1515
+ e.fields.read_timeout = Q(e.fields.read_timeout + "");
1516
+ })
1517
+ ],
1518
+ autocomplete: "off",
1519
+ "data-testid": "gateway-service-readTimeout-input",
1520
+ label: o(l)("gateway_services.form.fields.read_timeout.label"),
1521
+ "label-attributes": {
1522
+ info: o(l)("gateway_services.form.fields.read_timeout.tooltip"),
1523
+ tooltipAttributes: { maxWidth: "400" }
1524
+ },
1525
+ name: "readTimeout",
1526
+ readonly: e.isReadonly,
1527
+ type: "number"
1528
+ }, null, 8, ["modelValue", "label", "label-attributes", "readonly"])
1529
+ ]),
1530
+ $e.value ? (E(), T("div", Jt, [
1531
+ c(h, {
1532
+ modelValue: e.fields.client_certificate,
1533
+ "onUpdate:modelValue": r[20] || (r[20] = (u) => e.fields.client_certificate = u),
1534
+ modelModifiers: { trim: !0 },
1535
+ autocomplete: "off",
1536
+ "data-testid": "gateway-service-clientCert-input",
1537
+ error: !!e.formFieldErrors.client_certificate,
1538
+ label: o(l)("gateway_services.form.fields.client_certificate.label"),
1539
+ "label-attributes": {
1540
+ info: o(l)("gateway_services.form.fields.client_certificate.tooltip"),
1541
+ tooltipAttributes: { maxWidth: "400" }
1542
+ },
1543
+ name: "clientCert",
1544
+ placeholder: o(l)("gateway_services.form.fields.client_certificate.placeholder"),
1545
+ readonly: e.isReadonly,
1546
+ type: "text",
1547
+ onInput: r[21] || (r[21] = (u) => be("client_certificate"))
1548
+ }, null, 8, ["modelValue", "error", "label", "label-attributes", "placeholder", "readonly"])
1549
+ ])) : D("", !0),
1550
+ Re.value ? (E(), T("div", Qt, [
1551
+ c(h, {
1552
+ modelValue: e.fields.ca_certificates,
1553
+ "onUpdate:modelValue": r[22] || (r[22] = (u) => e.fields.ca_certificates = u),
1554
+ modelModifiers: { trim: !0 },
1555
+ autocomplete: "off",
1556
+ "data-testid": "gateway-service-ca-certs-input",
1557
+ error: !!e.formFieldErrors.ca_certificates,
1558
+ label: o(l)("gateway_services.form.fields.ca_certificates.label"),
1559
+ "label-attributes": { tooltipAttributes: { maxWidth: "400" } },
1560
+ placeholder: o(l)("gateway_services.form.fields.ca_certificates.placeholder"),
1561
+ readonly: e.isReadonly,
1562
+ type: "text",
1563
+ onInput: r[23] || (r[23] = (u) => be("ca_certificates"))
1564
+ }, {
1565
+ "label-tooltip": d(() => [
1566
+ c(o(N), {
1567
+ keypath: "gateway_services.form.fields.ca_certificates.tooltip",
1568
+ scope: "global"
1569
+ }, {
1570
+ code1: d(() => [
1571
+ S("code", null, V(o(l)("gateway_services.form.fields.ca_certificates.code1")), 1)
1572
+ ]),
1573
+ code2: d(() => [
1574
+ S("code", null, V(o(l)("gateway_services.form.fields.ca_certificates.code2")), 1)
1575
+ ]),
1576
+ _: 1
1577
+ })
1578
+ ]),
1579
+ _: 1
1580
+ }, 8, ["modelValue", "error", "label", "placeholder", "readonly"])
1581
+ ])) : D("", !0),
1582
+ ce.value ? (E(), T("div", Xt, [
1583
+ c(i, {
1584
+ modelValue: e.fields.tls_verify_enabled,
1585
+ "onUpdate:modelValue": r[24] || (r[24] = (u) => e.fields.tls_verify_enabled = u),
1586
+ "data-testid": "gateway-service-tls-verify-checkbox",
1587
+ description: o(l)("gateway_services.form.fields.tls_verify_enabled.help"),
1588
+ label: o(l)("gateway_services.form.fields.tls_verify_enabled.label"),
1589
+ "label-attributes": { tooltipAttributes: { maxWidth: "400" } }
1590
+ }, {
1591
+ tooltip: d(() => [
1592
+ c(o(N), {
1593
+ keypath: "gateway_services.form.fields.tls_verify_enabled.tooltip",
1594
+ scope: "global"
1595
+ }, {
1596
+ code1: d(() => [
1597
+ S("code", null, V(o(l)("gateway_services.form.fields.tls_verify_enabled.code1")), 1)
1598
+ ]),
1599
+ _: 1
1600
+ })
1601
+ ]),
1602
+ _: 1
1603
+ }, 8, ["modelValue", "description", "label"]),
1604
+ e.fields.tls_verify_enabled ? (E(), T("div", Yt, [
1605
+ c(_, {
1606
+ modelValue: e.fields.tls_verify_value,
1607
+ "onUpdate:modelValue": r[25] || (r[25] = (u) => e.fields.tls_verify_value = u),
1608
+ "data-testid": "gateway-service-tls-verify-true-option",
1609
+ label: o(l)("gateway_services.form.fields.tls_verify_option.true.label"),
1610
+ "selected-value": !0
1611
+ }, null, 8, ["modelValue", "label"])
1612
+ ])) : D("", !0),
1613
+ e.fields.tls_verify_enabled ? (E(), T("div", eo, [
1614
+ c(_, {
1615
+ modelValue: e.fields.tls_verify_value,
1616
+ "onUpdate:modelValue": r[26] || (r[26] = (u) => e.fields.tls_verify_value = u),
1617
+ "data-testid": "gateway-service-tls-verify-false-option",
1618
+ label: o(l)("gateway_services.form.fields.tls_verify_option.false.label"),
1619
+ "selected-value": !1
1620
+ }, null, 8, ["modelValue", "label"])
1621
+ ])) : D("", !0)
1622
+ ])) : D("", !0)
1623
+ ]))
1624
+ ]),
1625
+ _: 1
1626
+ })
1627
+ ]),
1628
+ _: 1
1629
+ }, 8, ["modelValue", "trigger-label"])
1630
+ ]),
1631
+ _: 1
1632
+ }, 8, ["description", "hide-info-header", "title"]),
1633
+ c(o(qe), {
1634
+ description: o(l)("gateway_services.form.sections.general.description"),
1635
+ "hide-info-header": s.hideSectionsInfo,
1636
+ title: o(l)("gateway_services.form.sections.general.title")
1637
+ }, {
1638
+ default: d(() => [
1639
+ c(h, {
1640
+ modelValue: e.fields.name,
1641
+ "onUpdate:modelValue": r[28] || (r[28] = (u) => e.fields.name = u),
1642
+ modelModifiers: { trim: !0 },
1643
+ autocomplete: "off",
1644
+ "data-testid": "gateway-service-name-input",
1645
+ error: oe.value,
1646
+ "error-message": ae.value,
1647
+ label: o(l)("gateway_services.form.fields.name.label"),
1648
+ "label-attributes": {
1649
+ info: o(l)("gateway_services.form.fields.name.tooltip"),
1650
+ tooltipAttributes: { maxWidth: "400" }
1651
+ },
1652
+ name: "name",
1653
+ placeholder: o(l)("gateway_services.form.fields.name.placeholder"),
1654
+ readonly: e.isReadonly,
1655
+ type: "text",
1656
+ onInput: we
1657
+ }, null, 8, ["modelValue", "error", "error-message", "label", "label-attributes", "placeholder", "readonly"]),
1658
+ c(Y, {
1659
+ "data-testid": "tags-collapse",
1660
+ "trigger-alignment": "leading",
1661
+ "trigger-label": o(l)("gateway_services.form.fields.tags.collapse")
1662
+ }, {
1663
+ default: d(() => [
1664
+ S("div", to, [
1665
+ c(h, {
1666
+ modelValue: e.fields.tags,
1667
+ "onUpdate:modelValue": r[29] || (r[29] = (u) => e.fields.tags = u),
1668
+ modelModifiers: { trim: !0 },
1669
+ autocomplete: "off",
1670
+ "data-testid": "gateway-service-tags-input",
1671
+ help: o(l)("gateway_services.form.fields.tags.help"),
1672
+ label: o(l)("gateway_services.form.fields.tags.label"),
1673
+ "label-attributes": {
1674
+ info: o(l)("gateway_services.form.fields.tags.tooltip"),
1675
+ tooltipAttributes: { maxWidth: "400" }
1676
+ },
1677
+ name: "tags",
1678
+ placeholder: o(l)("gateway_services.form.fields.tags.placeholder"),
1679
+ readonly: e.isReadonly,
1680
+ type: "text",
1681
+ onInput: r[30] || (r[30] = (u) => O("tags"))
1682
+ }, null, 8, ["modelValue", "help", "label", "label-attributes", "placeholder", "readonly"])
1683
+ ])
1684
+ ]),
1685
+ _: 1
1686
+ }, 8, ["trigger-label"])
1687
+ ]),
1688
+ _: 1
1689
+ }, 8, ["description", "hide-info-header", "title"]),
1690
+ e.errorMessages.length ? (E(), Ee(ie, {
1691
+ key: 0,
1692
+ appearance: "danger",
1693
+ "data-testid": "form-error"
1694
+ }, {
1695
+ default: d(() => [
1696
+ S("ul", oo, [
1697
+ (E(!0), T(Je, null, Qe(e.errorMessages, (u) => (E(), T("li", { key: u }, V(u), 1))), 128))
1698
+ ])
1699
+ ]),
1700
+ _: 1
1701
+ })) : D("", !0)
1702
+ ]),
1703
+ _: 3
1704
+ }, 8, ["can-submit", "config", "edit-id", "entity-type", "fetch-url", "form-fields", "is-readonly"])
1705
+ ]);
1706
+ };
1707
+ }
1708
+ }), go = /* @__PURE__ */ je(ro, [["__scopeId", "data-v-2ef1cab4"]]), { validateHost: io, validatePort: lo, validateProtocol: so, validatePath: ao } = ee.useUrlValidators(), yo = () => ({
1709
+ validateHost: io,
1710
+ validatePort: lo,
1711
+ validateProtocol: so,
1712
+ validatePath: ao
1713
+ });
1714
+ export {
1715
+ vo as GatewayServiceConfigCard,
1716
+ go as GatewayServiceForm,
1717
+ mo as GatewayServiceList,
1718
+ yo as useUrlValidator
1719
+ };