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