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