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