@kong-ui-public/entities-gateway-services 3.11.31-pr.2030.2349ecd36.0 → 3.11.31-pr.2198.6ceb22189.0

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