@kong-ui-public/entities-routes 3.17.13-pr.2782.db07c11a2.0 → 3.17.14-pr.2781.b1238e65f.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 (64) hide show
  1. package/package.json +5 -5
  2. package/dist/RouteFormExpressionsEditor-BmRiH3GR.js +0 -64
  3. package/dist/entities-routes.es.js +0 -20
  4. package/dist/entities-routes.umd.js +0 -1
  5. package/dist/index-DKwH5iba.js +0 -2640
  6. package/dist/style.css +0 -1
  7. package/dist/types/components/RouteConfigCard.vue.d.ts +0 -78
  8. package/dist/types/components/RouteConfigCard.vue.d.ts.map +0 -1
  9. package/dist/types/components/RouteForm.vue.d.ts +0 -176
  10. package/dist/types/components/RouteForm.vue.d.ts.map +0 -1
  11. package/dist/types/components/RouteFormExpressionsEditor.vue.d.ts +0 -36
  12. package/dist/types/components/RouteFormExpressionsEditor.vue.d.ts.map +0 -1
  13. package/dist/types/components/RouteFormExpressionsEditorLoader.vue.d.ts +0 -42
  14. package/dist/types/components/RouteFormExpressionsEditorLoader.vue.d.ts.map +0 -1
  15. package/dist/types/components/RouteFormRulesComposer.vue.d.ts +0 -57
  16. package/dist/types/components/RouteFormRulesComposer.vue.d.ts.map +0 -1
  17. package/dist/types/components/RouteList.vue.d.ts +0 -157
  18. package/dist/types/components/RouteList.vue.d.ts.map +0 -1
  19. package/dist/types/components/rules-composer/ExpressionsRules.vue.d.ts +0 -44
  20. package/dist/types/components/rules-composer/ExpressionsRules.vue.d.ts.map +0 -1
  21. package/dist/types/components/rules-composer/RulesComposer.vue.d.ts +0 -42
  22. package/dist/types/components/rules-composer/RulesComposer.vue.d.ts.map +0 -1
  23. package/dist/types/components/rules-composer/TraditionalRules.vue.d.ts +0 -32
  24. package/dist/types/components/rules-composer/TraditionalRules.vue.d.ts.map +0 -1
  25. package/dist/types/components/rules-composer/rules/DestinationRules.vue.d.ts +0 -16
  26. package/dist/types/components/rules-composer/rules/DestinationRules.vue.d.ts.map +0 -1
  27. package/dist/types/components/rules-composer/rules/HeaderRules.vue.d.ts +0 -16
  28. package/dist/types/components/rules-composer/rules/HeaderRules.vue.d.ts.map +0 -1
  29. package/dist/types/components/rules-composer/rules/HostRules.vue.d.ts +0 -15
  30. package/dist/types/components/rules-composer/rules/HostRules.vue.d.ts.map +0 -1
  31. package/dist/types/components/rules-composer/rules/MethodRules.vue.d.ts +0 -24
  32. package/dist/types/components/rules-composer/rules/MethodRules.vue.d.ts.map +0 -1
  33. package/dist/types/components/rules-composer/rules/PathRules.vue.d.ts +0 -15
  34. package/dist/types/components/rules-composer/rules/PathRules.vue.d.ts.map +0 -1
  35. package/dist/types/components/rules-composer/rules/RuleControlsAdd.vue.d.ts +0 -11
  36. package/dist/types/components/rules-composer/rules/RuleControlsAdd.vue.d.ts.map +0 -1
  37. package/dist/types/components/rules-composer/rules/RuleControlsRemove.vue.d.ts +0 -12
  38. package/dist/types/components/rules-composer/rules/RuleControlsRemove.vue.d.ts.map +0 -1
  39. package/dist/types/components/rules-composer/rules/SniRules.vue.d.ts +0 -15
  40. package/dist/types/components/rules-composer/rules/SniRules.vue.d.ts.map +0 -1
  41. package/dist/types/components/rules-composer/rules/SourceRules.vue.d.ts +0 -16
  42. package/dist/types/components/rules-composer/rules/SourceRules.vue.d.ts.map +0 -1
  43. package/dist/types/composables/index.d.ts +0 -6
  44. package/dist/types/composables/index.d.ts.map +0 -1
  45. package/dist/types/composables/useI18n.d.ts +0 -9
  46. package/dist/types/composables/useI18n.d.ts.map +0 -1
  47. package/dist/types/constants.d.ts +0 -65
  48. package/dist/types/constants.d.ts.map +0 -1
  49. package/dist/types/index.d.ts +0 -9
  50. package/dist/types/index.d.ts.map +0 -1
  51. package/dist/types/routes-endpoints.d.ts +0 -58
  52. package/dist/types/routes-endpoints.d.ts.map +0 -1
  53. package/dist/types/types/index.d.ts +0 -4
  54. package/dist/types/types/index.d.ts.map +0 -1
  55. package/dist/types/types/route-config-card.d.ts +0 -31
  56. package/dist/types/types/route-config-card.d.ts.map +0 -1
  57. package/dist/types/types/route-form.d.ts +0 -148
  58. package/dist/types/types/route-form.d.ts.map +0 -1
  59. package/dist/types/types/route-list.d.ts +0 -36
  60. package/dist/types/types/route-list.d.ts.map +0 -1
  61. package/dist/types/utilities/helpers.d.ts +0 -2
  62. package/dist/types/utilities/helpers.d.ts.map +0 -1
  63. package/dist/types/utilities/index.d.ts +0 -2
  64. package/dist/types/utilities/index.d.ts.map +0 -1
@@ -1,2640 +0,0 @@
1
- import { defineComponent as z, ref as B, computed as w, resolveComponent as N, createElementBlock as k, openBlock as m, createVNode as d, unref as t, withCtx as u, createBlock as x, toDisplayString as H, inject as De, createCommentVNode as P, createElementVNode as V, mergeModels as Y, useModel as X, createTextVNode as U, TransitionGroup as he, Fragment as G, renderList as re, nextTick as lt, defineAsyncComponent as rt, h as Ke, onMounted as Ye, renderSlot as Le, resolveDynamicComponent as qe, watch as _e, reactive as Ce, onBeforeMount as Ze, provide as it, createSlots as Be, withModifiers as Ne, Teleport as at } from "vue";
2
- import { useAxios as Fe, ConfigurationSchemaType as ve, ConfigurationSchemaSection as pe, EntityBaseConfigCard as nt, SupportedEntityType as et, InternalLinkItem as ut, useErrors as dt, useGatewayFeatureSupported as ct, EntityBaseFormType as Ge, useDebouncedFilter as pt, EntityBaseForm as ft, EntityFormSection as We, useTableState as mt, useFetcher as vt, useDeleteUrlBuilder as ht, FetcherStatus as gt, EntityBaseTable as yt, PermissionsWrapper as ke, TableTags as bt, EntityFilter as St, EntityDeleteModal as _t, EntityTypes as Tt } from "@kong-ui-public/entities-shared";
3
- import { createI18n as It, i18nTComponent as Et } from "@kong-ui-public/i18n";
4
- import je from "lodash.isequal";
5
- import { useRouter as tt } from "vue-router";
6
- import { AddIcon as Ue, CloseIcon as Rt, RocketIcon as At, InfoIcon as Ot, BookIcon as Xe, ForwardIcon as kt } from "@kong/icons";
7
- import { BadgeMethodAppearances as Ht } from "@kong/kongponents";
8
- const oe = "/v2/control-planes/{controlPlaneId}/core-entities", se = "/{workspace}", Te = {
9
- list: {
10
- konnect: {
11
- all: `${oe}/routes`,
12
- forGatewayService: `${oe}/services/{serviceId}/routes`
13
- },
14
- kongManager: {
15
- all: `${se}/routes`,
16
- forGatewayService: `${se}/services/{serviceId}/routes`
17
- }
18
- },
19
- form: {
20
- konnect: {
21
- services: `${oe}/services`,
22
- create: {
23
- all: `${oe}/routes`,
24
- forGatewayService: `${oe}/services/{serviceId}/routes`
25
- },
26
- fetch: {
27
- all: `${oe}/routes/{id}`,
28
- forGatewayService: `${oe}/services/{serviceId}/routes/{id}`
29
- },
30
- edit: {
31
- all: `${oe}/routes/{id}`,
32
- forGatewayService: `${oe}/services/{serviceId}/routes/{id}`
33
- }
34
- },
35
- kongManager: {
36
- services: `${se}/services`,
37
- create: {
38
- all: `${se}/routes`,
39
- forGatewayService: `${se}/services/{serviceId}/routes`
40
- },
41
- fetch: {
42
- all: `${se}/routes/{id}`,
43
- forGatewayService: `${se}/services/{serviceId}/routes/{id}`
44
- },
45
- edit: {
46
- all: `${se}/routes/{id}`,
47
- forGatewayService: `${se}/services/{serviceId}/routes/{id}`
48
- }
49
- }
50
- },
51
- item: {
52
- konnect: {
53
- getService: `${oe}/services/{serviceId}`,
54
- all: `${oe}/routes/{id}`,
55
- forGatewayService: `${oe}/services/{serviceId}/routes/{id}`
56
- },
57
- kongManager: {
58
- getService: `${se}/services/{serviceId}`,
59
- all: `${se}/routes/{id}`,
60
- forGatewayService: `${se}/services/{serviceId}/routes/{id}`
61
- }
62
- }
63
- }, Nt = {
64
- create: "New route",
65
- debugger: "Start debugging",
66
- copy_id: "Copy ID",
67
- copy_json: "Copy JSON",
68
- edit: "Edit",
69
- delete: "Delete",
70
- clear: "Clear",
71
- view: "View Details",
72
- loading: "Loading..."
73
- }, Ct = {
74
- placeholder: {
75
- konnect: "Filter by name",
76
- exact: "Filter by exact name or ID",
77
- kongManager: "Filter by exact name or ID"
78
- },
79
- no_results: "No results found"
80
- }, xt = {
81
- title: "Routes",
82
- list: {
83
- toolbar_actions: {
84
- new_route: "New route"
85
- },
86
- table_headers: {
87
- name: "Name",
88
- protocols: "Protocols",
89
- hosts: "Hosts",
90
- methods: "Methods",
91
- paths: "Paths",
92
- expression: "Expression",
93
- id: "ID",
94
- tags: "Tags",
95
- created_at: "Created At",
96
- updated_at: "Last Modified"
97
- },
98
- empty_state: {
99
- title: "Configure a New Route",
100
- description: "Routes proxy requests to an associated Service."
101
- },
102
- empty_state_v2: {
103
- title: "Configure your first route",
104
- group: "Routes created in gateways within this group will automatically appear here.",
105
- description: "Routes direct incoming API requests to the appropriate gateway service based on paths, methods, and headers, ensuring efficient traffic flow.",
106
- learn_more: "Learn more"
107
- }
108
- }
109
- }, Dt = {
110
- general: "Routes could not be retrieved",
111
- delete: "The route could not be deleted at this time.",
112
- copy: "Failed to copy to clipboard",
113
- services: {
114
- fetch: "Could not fetch available services"
115
- }
116
- }, Vt = {
117
- success: "Copied {val} to clipboard",
118
- success_brief: "Successfully copied to clipboard"
119
- }, wt = {
120
- config_flavor: {
121
- label: "Define by"
122
- },
123
- config_types: {
124
- basic: {
125
- description: "Quickly set up a route with HTTP & HTTPS protocol with the essentials: path, method, and host.",
126
- label: "Basic"
127
- },
128
- advanced: {
129
- description: "Define complex route logic with other protocols or additional paths or attributes such as headers.",
130
- label: "Advanced"
131
- }
132
- },
133
- protocols: {
134
- grpc: "GRPC",
135
- grpcs: "GRPCS",
136
- "grpc,grpcs": "GRPC, GRPCS",
137
- http: "HTTP",
138
- https: "HTTPS",
139
- "http,https": "HTTP, HTTPS",
140
- tls: "TLS",
141
- tcp: "TCP",
142
- udp: "UDP",
143
- "tls,udp": "TLS, UDP",
144
- "tcp,udp": "TCP, UDP",
145
- "tcp,tls": "TCP, TLS",
146
- "tcp,tls,udp": "TCP, TLS, UDP",
147
- ws: "WS",
148
- wss: "WSS",
149
- "ws,wss": "WS, WSS",
150
- tls_passthrough: "TLS_PASSTHROUGH"
151
- },
152
- sections: {
153
- general: {
154
- title: "General Information",
155
- description: "General information will help you identify and manage this route"
156
- },
157
- config: {
158
- title: "Route Configuration",
159
- description: "Route configuration determines how this route will handle incoming requests"
160
- },
161
- routingRules: {
162
- title: "Routing Rules"
163
- },
164
- routingExpression: {
165
- title: "Routing Expression"
166
- }
167
- },
168
- fields: {
169
- service_id: {
170
- label: "Service",
171
- placeholder: "Select a service"
172
- },
173
- name: {
174
- label: "Name",
175
- placeholder: "Enter a unique name",
176
- tooltip: "The name of the Route. Route names must be unique, and they are case sensitive. For example, there can be two different Routes named 'test' and 'Test'."
177
- },
178
- service: {
179
- label: "Gateway Service",
180
- tooltip: "The Service this Route is associated to. This is where the Route proxies traffic to."
181
- },
182
- tags: {
183
- label: "Tags",
184
- tooltip: "An optional set of strings associated with the Route for grouping and filtering.",
185
- placeholder: "Enter a list of tags separated by commas",
186
- help: "e.g. tag1, tag2, tag3"
187
- },
188
- protocols: {
189
- label: "Protocols",
190
- tooltip: "The protocols this route supports."
191
- },
192
- path_handling: {
193
- label: "Path Handling",
194
- tooltip: "Controls how Kong modifies the request path before proxying to the upstream service. Use v1 for standardized, predictable path behavior. Use v0 for legacy compatibility."
195
- },
196
- https_redirect_status_code: {
197
- label: "HTTPS Redirect Status Code",
198
- tooltip: "Specifies the HTTP status code for redirecting requests from HTTP to HTTPS. Use <code>301</code> or <code>308</code> for permanent redirects, <code>302</code> or <code>307</code> for temporary redirects."
199
- },
200
- regex_priority: {
201
- label: "Regex Priority",
202
- tooltip: "Regex priority is determined by length first (longer patterns win), and when lengths are the same, more specific regexes are preferred. When two routes match the path and have the same <code>regex_priority</code>, the older one (lowest <code>created_at</code>) is used."
203
- },
204
- strip_path: {
205
- label: "Strip Path",
206
- tooltip: "When enabled, Kong removes the portion of the request path that matches the route's path before forwarding the request to the upstream. If the request exactly matches the route, the result is <code>/</code>. Disable if that's not desired."
207
- },
208
- preserve_host: {
209
- label: "Preserve Host",
210
- tooltip: "Keeps the original <code>Host</code> header when proxying requests. Enable this if the upstream service requires the client's <code>Host</code> value. Disable if the service expects its own hostname."
211
- },
212
- paths: {
213
- add: "Add a path",
214
- label: "Paths",
215
- label_singular: "Path",
216
- placeholder: "e.g. /api/v1",
217
- singular: "path",
218
- tooltip: "Match specific URL paths, such as <code>/api/v1</code>. Prefix with <code>~</code> to enable regex-based matching."
219
- },
220
- snis: {
221
- add: "Add an SNI",
222
- label: "SNIs",
223
- placeholder: "e.g. api.example.com",
224
- singular: "SNI",
225
- tooltip: "SNIs (Server Name Indications) that match the route when using stream routing."
226
- },
227
- hosts: {
228
- add: "Add a host",
229
- label: "Hosts",
230
- label_singular: "Host",
231
- placeholder: "e.g. example.com",
232
- singular: "host",
233
- tooltip: "Match specific domain names, such as <code>api.example.com</code>."
234
- },
235
- methods: {
236
- label: "Methods",
237
- placeholder: "Select methods",
238
- search_placeholder: "Search for a method or enter a custom method",
239
- singular: "method",
240
- tooltip: "Match specific HTTP methods, such as GET or POST. If no method is selected, all methods are included.",
241
- custom: {
242
- label: "Custom",
243
- placeholder: "Enter a custom method",
244
- tooltip: "Custom methods can be used with default selections. Uppercase characters are required."
245
- }
246
- },
247
- headers: {
248
- add: "Add a header",
249
- label: "Headers",
250
- singular: "header",
251
- tooltip: "Match specific headers, such as <code>x-api-version</code> or <code>x-region</code>. Doesn't accept the <code>Host</code> header. Provide only one entry and prefix with <code>~</code> to enable regex-based matching.",
252
- name: {
253
- placeholder: "e.g. x-api-version"
254
- },
255
- values: {
256
- placeholder: "e.g. v1"
257
- }
258
- },
259
- sources: {
260
- add: "Add a source",
261
- label: "Sources",
262
- singular: "source",
263
- tooltip: "A list of IP sources of incoming connections that match this Route when using stream routing.",
264
- ip: {
265
- placeholder: "Enter a source IP"
266
- },
267
- port: {
268
- placeholder: "Enter a source port"
269
- }
270
- },
271
- destinations: {
272
- add: "Add a destination",
273
- label: "Destinations",
274
- singular: "destination",
275
- tooltip: "A list of IP destinations of incoming connections that match this Route when using stream routing.",
276
- ip: {
277
- placeholder: "Enter a destination IP"
278
- },
279
- port: {
280
- placeholder: "Enter a destination port"
281
- }
282
- },
283
- response_buffering: {
284
- label: "Response buffering",
285
- tooltip: "Reads and buffers the full response from the upstream service before sending it to the client. Enable buffering if the client expects the complete response at once. Disable for faster streaming of large or chunked responses."
286
- },
287
- request_buffering: {
288
- label: "Request buffering",
289
- tooltip: "Reads and buffers the full request body before proxying. Enable buffering if the upstream service requires the complete request before processing. Disable for faster streaming of large or chunked requests."
290
- },
291
- expression: {
292
- label: "Expression",
293
- tooltip: "The route expression."
294
- },
295
- priority: {
296
- label: "Priority",
297
- tooltip: "A number used to choose which route resolves a given request when several routes match it using expression simultaneously."
298
- }
299
- },
300
- flavors: {
301
- traditional: "Traditional Form",
302
- expressions: "Expressions Editor"
303
- },
304
- show_more: "Show more",
305
- hint: {
306
- rules_message: "Choose at least one {routingRules} option.",
307
- single_rule: "{routingRules}",
308
- multiple_rules: "{routingRules} or {lastRoutingRule}",
309
- advanced: "To add more than one, use the Advanced options."
310
- },
311
- warning: {
312
- cannotChangeFlavor: {
313
- create: "The format of the route cannot be changed once created.",
314
- edit: "This route was configured in the {format} format, and cannot be changed after creation. You can switch to the {format} tab to edit, or create a new route in a different format instead."
315
- }
316
- },
317
- expressions_editor: {
318
- loading: "Loading the Expressions editor…",
319
- error: "Error occurred while loading the Expressions editor. Please view the console for more details."
320
- },
321
- expression_playground: {
322
- test_link: "Test with Router Playground",
323
- supported_protocols_hint: "Currently only supports the following protocols: {protocols}"
324
- }
325
- }, Mt = {
326
- actions: Nt,
327
- search: Ct,
328
- routes: xt,
329
- delete: {
330
- title: "Delete a Route",
331
- description: "Deleting this route will also remove any associated plugins. This action cannot be reversed."
332
- },
333
- errors: Dt,
334
- copy: Vt,
335
- form: wt
336
- };
337
- function $t() {
338
- const e = It("en-us", Mt);
339
- return {
340
- i18n: e,
341
- i18nT: Et(e)
342
- // Translation component <i18n-t>
343
- };
344
- }
345
- const J = {
346
- useI18n: $t
347
- }, Ut = { class: "kong-ui-entities-route-entity-config-card" }, Pt = { key: 2 }, cs = /* @__PURE__ */ z({
348
- __name: "RouteConfigCard",
349
- props: {
350
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
351
- config: {
352
- type: Object,
353
- required: !0,
354
- validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || e.app === "konnect" && !e.controlPlaneId || e.app === "kongManager" && typeof e.workspace != "string" || !e.entityId)
355
- },
356
- /**
357
- * External link for documentation that determines visibility of Documentation button
358
- */
359
- configCardDoc: {
360
- type: String,
361
- default: "",
362
- required: !1
363
- },
364
- /**
365
- * Control visibility of card title content
366
- */
367
- hideTitle: {
368
- type: Boolean,
369
- default: !1
370
- },
371
- /** The id of the service with which the route is associated */
372
- serviceId: {
373
- type: String,
374
- required: !1,
375
- default: ""
376
- }
377
- },
378
- emits: ["loading", "fetch:error", "fetch:success", "navigation-click"],
379
- setup(e, { emit: C }) {
380
- var F;
381
- const f = C, o = e, { axiosInstance: a } = Fe((F = o.config) == null ? void 0 : F.axiosRequestConfig), { i18n: { t: v } } = J.useI18n(), i = B(""), A = B(""), h = B(!1), g = w(
382
- () => {
383
- var r, c;
384
- return (c = Te.item[(r = o.config) == null ? void 0 : r.app]) == null ? void 0 : c[o.serviceId ? "forGatewayService" : "all"].replace(/{serviceId}/gi, o.serviceId);
385
- }
386
- ), p = w(() => {
387
- var r;
388
- return (r = Te.item[o.config.app]) == null ? void 0 : r.getService;
389
- }), y = async (r) => {
390
- var S, M, le;
391
- if (i.value = o.serviceId || ((S = r == null ? void 0 : r.service) == null ? void 0 : S.id), f("fetch:success", r), !i.value)
392
- return;
393
- let c = `${o.config.apiBaseUrl}${p.value}`;
394
- o.config.app === "konnect" ? c = c.replace(/{controlPlaneId}/gi, ((M = o.config) == null ? void 0 : M.controlPlaneId) || "").replace(/{serviceId}/gi, i.value || "") : o.config.app === "kongManager" && (c = c.replace(/\/{workspace}/gi, (le = o.config) != null && le.workspace ? `/${o.config.workspace}` : "").replace(/{serviceId}/gi, i.value || ""));
395
- try {
396
- h.value = !0;
397
- const { data: j } = await a.get(c);
398
- A.value = (j == null ? void 0 : j.name) || (j == null ? void 0 : j.id);
399
- } catch (j) {
400
- f("fetch:error", j);
401
- } finally {
402
- h.value = !1;
403
- }
404
- }, D = B({
405
- id: {},
406
- name: {
407
- tooltip: v("form.fields.name.tooltip")
408
- },
409
- created_at: {},
410
- updated_at: {},
411
- service: {
412
- label: v("form.fields.service.label"),
413
- section: pe.Basic,
414
- tooltip: v("form.fields.service.tooltip"),
415
- order: 5
416
- },
417
- tags: {
418
- tooltip: v("form.fields.tags.tooltip"),
419
- order: 6
420
- },
421
- protocols: {
422
- section: pe.Basic,
423
- tooltip: v("form.fields.protocols.tooltip"),
424
- type: ve.BadgeTag,
425
- order: 7
426
- },
427
- paths: {
428
- section: pe.Basic,
429
- tooltip: v("form.fields.paths.tooltip"),
430
- type: ve.CopyBadge,
431
- order: 8
432
- },
433
- hosts: {
434
- section: pe.Basic,
435
- tooltip: v("form.fields.hosts.tooltip"),
436
- type: ve.CopyBadge,
437
- order: 9
438
- },
439
- snis: {
440
- label: v("form.fields.snis.label"),
441
- tooltip: v("form.fields.snis.tooltip"),
442
- order: 10
443
- },
444
- headers: {
445
- section: pe.Basic,
446
- tooltip: v("form.fields.headers.tooltip"),
447
- order: 11
448
- },
449
- methods: {
450
- section: pe.Basic,
451
- tooltip: v("form.fields.methods.tooltip"),
452
- type: ve.BadgeMethod,
453
- order: 12
454
- },
455
- sources: {
456
- section: pe.Basic,
457
- tooltip: v("form.fields.sources.tooltip"),
458
- type: ve.JsonArray,
459
- order: 13
460
- },
461
- destinations: {
462
- section: pe.Basic,
463
- tooltip: v("form.fields.destinations.tooltip"),
464
- type: ve.JsonArray,
465
- order: 14
466
- },
467
- // advanced fields
468
- https_redirect_status_code: {
469
- tooltip: v("form.fields.https_redirect_status_code.tooltip"),
470
- order: 1
471
- },
472
- regex_priority: {
473
- tooltip: v("form.fields.regex_priority.tooltip"),
474
- order: 2
475
- },
476
- strip_path: {
477
- tooltip: v("form.fields.strip_path.tooltip"),
478
- order: 3
479
- },
480
- preserve_host: {
481
- tooltip: v("form.fields.preserve_host.tooltip"),
482
- order: 4
483
- },
484
- request_buffering: {
485
- tooltip: v("form.fields.request_buffering.tooltip"),
486
- order: 5
487
- },
488
- response_buffering: {
489
- tooltip: v("form.fields.response_buffering.tooltip"),
490
- order: 6
491
- },
492
- path_handling: {
493
- tooltip: v("form.fields.path_handling.tooltip"),
494
- order: 7
495
- }
496
- });
497
- return (r, c) => {
498
- const S = N("KSkeleton");
499
- return m(), k("div", Ut, [
500
- d(t(nt), {
501
- config: e.config,
502
- "config-card-doc": e.configCardDoc,
503
- "config-schema": D.value,
504
- "entity-type": t(et).Route,
505
- "fetch-url": g.value,
506
- "hide-title": e.hideTitle,
507
- "onFetch:error": c[0] || (c[0] = (M) => r.$emit("fetch:error", M)),
508
- "onFetch:success": y,
509
- onLoading: c[1] || (c[1] = (M) => r.$emit("loading", M))
510
- }, {
511
- service: u(({ row: M }) => [
512
- h.value ? (m(), x(S, {
513
- key: 0,
514
- "data-testid": "service-name-loader",
515
- type: "spinner"
516
- })) : M.value && M.value.id === i.value && A.value ? (m(), x(t(ut), {
517
- key: 1,
518
- item: {
519
- key: M.value.id,
520
- value: A.value,
521
- type: t(ve).LinkInternal
522
- },
523
- onNavigationClick: () => r.$emit("navigation-click", M.value.id, "services")
524
- }, null, 8, ["item", "onNavigationClick"])) : (m(), k("div", Pt, H("-")))
525
- ]),
526
- _: 1
527
- }, 8, ["config", "config-card-doc", "config-schema", "entity-type", "fetch-url", "hide-title"])
528
- ]);
529
- };
530
- }
531
- });
532
- var q = /* @__PURE__ */ ((e) => (e.TRADITIONAL = "traditional", e.EXPRESSIONS = "expressions", e))(q || {}), s = /* @__PURE__ */ ((e) => (e.PATHS = "paths", e.SNIS = "snis", e.HOSTS = "hosts", e.METHODS = "methods", e.HEADERS = "headers", e.SOURCES = "sources", e.DESTINATIONS = "destinations", e))(s || {}), Se = /* @__PURE__ */ ((e) => (e.LOADING = "loading", e.ERROR = "error", e.READY = "ready", e))(Se || {}), Ie = /* @__PURE__ */ ((e) => (e.GET = "GET", e.PUT = "PUT", e.POST = "POST", e.PATCH = "PATCH", e.DELETE = "DELETE", e.OPTIONS = "OPTIONS", e.HEAD = "HEAD", e.CONNECT = "CONNECT", e.TRACE = "TRACE", e))(Ie || {});
533
- const ze = (e) => e.routeFlavors.traditional === !0, Je = (e) => e.routeFlavors.expressions === !0, W = {
534
- [s.PATHS]: [""],
535
- [s.SNIS]: [""],
536
- [s.HOSTS]: [""],
537
- [s.METHODS]: [],
538
- [s.HEADERS]: [{ header: "", values: "" }],
539
- [s.SOURCES]: [{ ip: "", port: null }],
540
- [s.DESTINATIONS]: [{ ip: "", port: null }]
541
- }, Pe = {
542
- http: [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS],
543
- https: [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS, s.SNIS],
544
- "http,https": [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS, s.SNIS],
545
- "https,http": [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS, s.SNIS],
546
- grpc: [s.PATHS, s.HOSTS, s.HEADERS],
547
- grpcs: [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
548
- "grpc,grpcs": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
549
- "grpcs,grpc": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
550
- udp: [s.SOURCES, s.DESTINATIONS],
551
- tls: [s.SOURCES, s.DESTINATIONS, s.SNIS],
552
- tcp: [s.SOURCES, s.DESTINATIONS],
553
- "tls,udp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
554
- "udp,tls": [s.SOURCES, s.DESTINATIONS, s.SNIS],
555
- "tcp,udp": [s.SOURCES, s.DESTINATIONS],
556
- "udp,tcp": [s.SOURCES, s.DESTINATIONS],
557
- "tcp,tls": [s.SOURCES, s.DESTINATIONS, s.SNIS],
558
- "tls,tcp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
559
- "tcp,tls,udp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
560
- "tls,udp,tcp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
561
- "udp,tcp,tls": [s.SOURCES, s.DESTINATIONS, s.SNIS],
562
- tls_passthrough: [s.SNIS],
563
- ws: [s.PATHS, s.HOSTS, s.HEADERS],
564
- wss: [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
565
- "ws,wss": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
566
- "wss,ws": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS]
567
- }, ot = [
568
- { label: "426", value: 426 },
569
- { label: "301", value: 301 },
570
- { label: "302", value: 302 },
571
- { label: "307", value: 307 },
572
- { label: "308", value: 308 }
573
- ], Lt = [
574
- { label: "v0", value: "v0" },
575
- { label: "v1", value: "v1" }
576
- ], xe = {
577
- https_redirect_status_code: 426,
578
- strip_path: !0,
579
- preserve_host: !1,
580
- request_buffering: !0,
581
- response_buffering: !0
582
- }, Ft = {
583
- ...xe,
584
- paths: [""],
585
- regex_priority: 0,
586
- path_handling: "v0",
587
- expression: "",
588
- priority: 0
589
- }, Kt = /* @__PURE__ */ z({
590
- __name: "RuleControlsAdd",
591
- props: {
592
- routingRulesEntity: {}
593
- },
594
- emits: ["add"],
595
- setup(e, { emit: C }) {
596
- const f = e, o = C, a = De("configType", "basic"), { i18n: { t: v } } = J.useI18n(), i = w(() => v(`form.fields.${f.routingRulesEntity}.add`));
597
- return (A, h) => {
598
- const g = N("KButton");
599
- return t(a) !== "basic" ? (m(), x(g, {
600
- key: 0,
601
- appearance: "tertiary",
602
- class: "routing-rule-add-item-button",
603
- "data-testid": `add-${e.routingRulesEntity}`,
604
- onClick: h[0] || (h[0] = (p) => o("add"))
605
- }, {
606
- default: u(() => [
607
- d(t(Ue)),
608
- V("span", null, H(i.value), 1)
609
- ]),
610
- _: 1
611
- }, 8, ["data-testid"])) : P("", !0);
612
- };
613
- }
614
- }), Z = (e, C) => {
615
- const f = e.__vccOpts || e;
616
- for (const [o, a] of C)
617
- f[o] = a;
618
- return f;
619
- }, Ee = /* @__PURE__ */ Z(Kt, [["__scopeId", "data-v-f1f4cfc9"]]), qt = "#afb7c5", Bt = "#0044f4", Gt = "16px", Re = /* @__PURE__ */ z({
620
- __name: "RuleControlsRemove",
621
- props: {
622
- disabled: { type: Boolean },
623
- routingRulesEntity: {}
624
- },
625
- emits: ["remove"],
626
- setup(e, { emit: C }) {
627
- const f = C, o = De("configType", "basic");
628
- return (a, v) => {
629
- const i = N("KButton");
630
- return t(o) !== "basic" ? (m(), x(i, {
631
- key: 0,
632
- appearance: "tertiary",
633
- "data-testid": `remove-${e.routingRulesEntity}`,
634
- disabled: e.disabled,
635
- icon: "",
636
- onClick: v[0] || (v[0] = (A) => f("remove"))
637
- }, {
638
- default: u(() => [
639
- d(t(Rt), {
640
- color: e.disabled ? t(qt) : t(Bt)
641
- }, null, 8, ["color"])
642
- ]),
643
- _: 1
644
- }, 8, ["data-testid", "disabled"])) : P("", !0);
645
- };
646
- }
647
- }), Wt = { class: "routing-rule-container" }, jt = ["innerHTML"], Xt = /* @__PURE__ */ z({
648
- __name: "DestinationRules",
649
- props: {
650
- modelValue: { required: !0 },
651
- modelModifiers: {}
652
- },
653
- emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
654
- setup(e, { emit: C }) {
655
- const { i18n: { t: f } } = J.useI18n(), o = X(e, "modelValue"), a = C;
656
- return (v, i) => {
657
- const A = N("KLabel"), h = N("KInput");
658
- return m(), k("div", Wt, [
659
- d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
660
- tooltip: u(() => [
661
- V("span", {
662
- innerHTML: t(f)("form.fields.destinations.tooltip")
663
- }, null, 8, jt)
664
- ]),
665
- default: u(() => [
666
- U(" " + H(t(f)("form.fields.destinations.label")), 1)
667
- ]),
668
- _: 1
669
- }),
670
- d(he, { name: "appear" }, {
671
- default: u(() => [
672
- (m(!0), k(G, null, re(o.value, (g, p) => (m(), k("div", {
673
- key: p,
674
- class: "routing-rule-input"
675
- }, [
676
- d(h, {
677
- modelValue: o.value[p].ip,
678
- "onUpdate:modelValue": (y) => o.value[p].ip = y,
679
- modelModifiers: { trim: !0 },
680
- "data-testid": `route-form-destinations-ip-input-${p + 1}`,
681
- placeholder: t(f)("form.fields.destinations.ip.placeholder")
682
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
683
- d(h, {
684
- modelValue: o.value[p].port,
685
- "onUpdate:modelValue": (y) => o.value[p].port = y,
686
- modelModifiers: { number: !0 },
687
- "data-testid": `route-form-destinations-port-input-${p + 1}`,
688
- max: "65535",
689
- min: "0",
690
- placeholder: t(f)("form.fields.destinations.port.placeholder"),
691
- type: "number"
692
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
693
- d(Re, {
694
- disabled: o.value.length === 1,
695
- "routing-rules-entity": t(s).DESTINATIONS,
696
- onRemove: (y) => a("remove", p)
697
- }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
698
- ]))), 128))
699
- ]),
700
- _: 1
701
- }),
702
- d(Ee, {
703
- "routing-rules-entity": t(s).DESTINATIONS,
704
- onAdd: i[0] || (i[0] = (g) => a("add"))
705
- }, null, 8, ["routing-rules-entity"])
706
- ]);
707
- };
708
- }
709
- }), zt = /* @__PURE__ */ Z(Xt, [["__scopeId", "data-v-3eb40a37"]]), Jt = { class: "routing-rule-container" }, Qt = ["innerHTML"], Yt = /* @__PURE__ */ z({
710
- __name: "HeaderRules",
711
- props: {
712
- modelValue: { required: !0 },
713
- modelModifiers: {}
714
- },
715
- emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
716
- setup(e, { emit: C }) {
717
- const { i18n: { t: f } } = J.useI18n(), o = X(e, "modelValue"), a = C;
718
- return (v, i) => {
719
- const A = N("KLabel"), h = N("KInput");
720
- return m(), k("div", Jt, [
721
- d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
722
- tooltip: u(() => [
723
- V("span", {
724
- innerHTML: t(f)("form.fields.headers.tooltip")
725
- }, null, 8, Qt)
726
- ]),
727
- default: u(() => [
728
- U(" " + H(t(f)("form.fields.headers.label")), 1)
729
- ]),
730
- _: 1
731
- }),
732
- d(he, { name: "appear" }, {
733
- default: u(() => [
734
- (m(!0), k(G, null, re(o.value, (g, p) => (m(), k("div", {
735
- key: p,
736
- class: "routing-rule-input"
737
- }, [
738
- d(h, {
739
- modelValue: o.value[p].header,
740
- "onUpdate:modelValue": (y) => o.value[p].header = y,
741
- modelModifiers: { trim: !0 },
742
- "data-testid": `route-form-headers-name-input-${p + 1}`,
743
- placeholder: t(f)("form.fields.headers.name.placeholder")
744
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
745
- d(h, {
746
- modelValue: o.value[p].values,
747
- "onUpdate:modelValue": (y) => o.value[p].values = y,
748
- modelModifiers: { trim: !0 },
749
- "data-testid": `route-form-headers-values-input-${p + 1}`,
750
- placeholder: t(f)("form.fields.headers.values.placeholder")
751
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
752
- d(Re, {
753
- disabled: o.value.length === 1,
754
- "routing-rules-entity": t(s).HEADERS,
755
- onRemove: (y) => a("remove", p)
756
- }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
757
- ]))), 128))
758
- ]),
759
- _: 1
760
- }),
761
- d(Ee, {
762
- "routing-rules-entity": t(s).HEADERS,
763
- onAdd: i[0] || (i[0] = (g) => a("add"))
764
- }, null, 8, ["routing-rules-entity"])
765
- ]);
766
- };
767
- }
768
- }), Zt = /* @__PURE__ */ Z(Yt, [["__scopeId", "data-v-d3bede0b"]]), eo = { class: "routing-rule-container" }, to = ["innerHTML"], oo = /* @__PURE__ */ z({
769
- __name: "HostRules",
770
- props: {
771
- modelValue: { required: !0 },
772
- modelModifiers: {}
773
- },
774
- emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
775
- setup(e, { emit: C }) {
776
- const { i18n: { t: f } } = J.useI18n(), o = X(e, "modelValue"), a = C, v = De("configType", "basic");
777
- return (i, A) => {
778
- const h = N("KLabel"), g = N("KInput");
779
- return m(), k("div", eo, [
780
- d(h, { "tooltip-attributes": { maxWidth: "320" } }, {
781
- tooltip: u(() => [
782
- V("span", {
783
- innerHTML: t(f)("form.fields.hosts.tooltip")
784
- }, null, 8, to)
785
- ]),
786
- default: u(() => [
787
- U(" " + H(t(v) === "basic" ? t(f)("form.fields.hosts.label_singular") : t(f)("form.fields.hosts.label")), 1)
788
- ]),
789
- _: 1
790
- }),
791
- d(he, { name: "appear" }, {
792
- default: u(() => [
793
- (m(!0), k(G, null, re(t(v) === "basic" ? o.value.slice(0, 1) : o.value, (p, y) => (m(), k("div", {
794
- key: y,
795
- class: "routing-rule-input"
796
- }, [
797
- d(g, {
798
- modelValue: o.value[y],
799
- "onUpdate:modelValue": (D) => o.value[y] = D,
800
- modelModifiers: { trim: !0 },
801
- "data-testid": `route-form-hosts-input-${y + 1}`,
802
- placeholder: t(f)("form.fields.hosts.placeholder")
803
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
804
- d(Re, {
805
- disabled: o.value.length === 1,
806
- "routing-rules-entity": t(s).HOSTS,
807
- onRemove: (D) => a("remove", y)
808
- }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
809
- ]))), 128))
810
- ]),
811
- _: 1
812
- }),
813
- d(Ee, {
814
- "routing-rules-entity": t(s).HOSTS,
815
- onAdd: A[0] || (A[0] = (p) => a("add"))
816
- }, null, 8, ["routing-rules-entity"])
817
- ]);
818
- };
819
- }
820
- }), so = /* @__PURE__ */ Z(oo, [["__scopeId", "data-v-dccd9082"]]), lo = {
821
- class: "routing-rule-container",
822
- "data-testid": "route-form-methods"
823
- }, ro = ["innerHTML"], io = { class: "routing-rule-input" }, ao = /* @__PURE__ */ z({
824
- __name: "MethodRules",
825
- props: {
826
- methods: { required: !0 },
827
- methodsModifiers: {},
828
- customMethods: { required: !0 },
829
- customMethodsModifiers: {}
830
- },
831
- emits: ["update:methods", "update:customMethods"],
832
- setup(e) {
833
- const { i18n: { t: C } } = J.useI18n(), f = X(e, "methods"), o = X(e, "customMethods"), a = w(() => f.value.filter((g) => Object.keys(Ie).includes(g)).concat(o.value.map((g) => g.value))), v = w(() => Object.keys(Ie).map((g) => ({
834
- label: g,
835
- value: g
836
- })).concat(o.value.map((g) => ({
837
- label: g.label,
838
- value: g.value,
839
- custom: !0
840
- })))), i = (g) => !v.value.map((p) => p.value.toLowerCase()).includes(g.toLowerCase()), A = (g, p) => {
841
- p ? o.value.push(g) : o.value = o.value.filter((y) => y.value !== g.value);
842
- }, h = (g) => {
843
- f.value = g;
844
- };
845
- return (g, p) => {
846
- const y = N("KLabel"), D = N("KMultiselect");
847
- return m(), k("div", lo, [
848
- d(y, { "tooltip-attributes": { maxWidth: "320" } }, {
849
- tooltip: u(() => [
850
- V("span", {
851
- innerHTML: t(C)("form.fields.methods.tooltip")
852
- }, null, 8, ro)
853
- ]),
854
- default: u(() => [
855
- U(" " + H(t(C)("form.fields.methods.label")), 1)
856
- ]),
857
- _: 1
858
- }),
859
- V("div", io, [
860
- d(D, {
861
- "enable-item-creation": "",
862
- "item-creation-validator": i,
863
- items: v.value,
864
- "model-value": a.value,
865
- placeholder: t(C)("form.fields.methods.placeholder"),
866
- "search-placeholder": t(C)("form.fields.methods.search_placeholder"),
867
- onItemAdded: p[0] || (p[0] = (F) => A(F, !0)),
868
- onItemRemoved: p[1] || (p[1] = (F) => A(F, !1)),
869
- "onUpdate:modelValue": h
870
- }, null, 8, ["items", "model-value", "placeholder", "search-placeholder"])
871
- ])
872
- ]);
873
- };
874
- }
875
- }), no = /* @__PURE__ */ Z(ao, [["__scopeId", "data-v-6c94d6d2"]]), uo = { class: "routing-rule-container" }, co = ["innerHTML"], po = /* @__PURE__ */ z({
876
- __name: "PathRules",
877
- props: {
878
- modelValue: { required: !0 },
879
- modelModifiers: {}
880
- },
881
- emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
882
- setup(e, { emit: C }) {
883
- const { i18n: { t: f } } = J.useI18n(), o = X(e, "modelValue"), a = C, v = De("configType", "basic");
884
- return (i, A) => {
885
- const h = N("KLabel"), g = N("KInput");
886
- return m(), k("div", uo, [
887
- d(h, { "tooltip-attributes": { maxWidth: "320" } }, {
888
- tooltip: u(() => [
889
- V("span", {
890
- innerHTML: t(f)("form.fields.paths.tooltip")
891
- }, null, 8, co)
892
- ]),
893
- default: u(() => [
894
- U(" " + H(t(v) === "basic" ? t(f)("form.fields.paths.label_singular") : t(f)("form.fields.paths.label")), 1)
895
- ]),
896
- _: 1
897
- }),
898
- d(he, { name: "appear" }, {
899
- default: u(() => [
900
- (m(!0), k(G, null, re(t(v) === "basic" ? o.value.slice(0, 1) : o.value, (p, y) => (m(), k("div", {
901
- key: y,
902
- class: "routing-rule-input"
903
- }, [
904
- d(g, {
905
- modelValue: o.value[y],
906
- "onUpdate:modelValue": (D) => o.value[y] = D,
907
- modelModifiers: { trim: !0 },
908
- "data-testid": `route-form-paths-input-${y + 1}`,
909
- placeholder: t(f)("form.fields.paths.placeholder")
910
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
911
- d(Re, {
912
- disabled: o.value.length === 1,
913
- "routing-rules-entity": t(s).PATHS,
914
- onRemove: (D) => a("remove", y)
915
- }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
916
- ]))), 128))
917
- ]),
918
- _: 1
919
- }),
920
- d(Ee, {
921
- "routing-rules-entity": t(s).PATHS,
922
- onAdd: A[0] || (A[0] = (p) => a("add"))
923
- }, null, 8, ["routing-rules-entity"])
924
- ]);
925
- };
926
- }
927
- }), fo = /* @__PURE__ */ Z(po, [["__scopeId", "data-v-eb440a9e"]]), mo = { class: "routing-rule-container" }, vo = ["innerHTML"], ho = /* @__PURE__ */ z({
928
- __name: "SniRules",
929
- props: {
930
- modelValue: { required: !0 },
931
- modelModifiers: {}
932
- },
933
- emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
934
- setup(e, { emit: C }) {
935
- const { i18n: { t: f } } = J.useI18n(), o = X(e, "modelValue"), a = C;
936
- return (v, i) => {
937
- const A = N("KLabel"), h = N("KInput");
938
- return m(), k("div", mo, [
939
- d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
940
- tooltip: u(() => [
941
- V("span", {
942
- innerHTML: t(f)("form.fields.snis.tooltip")
943
- }, null, 8, vo)
944
- ]),
945
- default: u(() => [
946
- U(" " + H(t(f)("form.fields.snis.label")), 1)
947
- ]),
948
- _: 1
949
- }),
950
- d(he, { name: "appear" }, {
951
- default: u(() => [
952
- (m(!0), k(G, null, re(o.value, (g, p) => (m(), k("div", {
953
- key: p,
954
- class: "routing-rule-input"
955
- }, [
956
- d(h, {
957
- modelValue: o.value[p],
958
- "onUpdate:modelValue": (y) => o.value[p] = y,
959
- modelModifiers: { trim: !0 },
960
- "data-testid": `route-form-snis-input-${p + 1}`,
961
- placeholder: t(f)("form.fields.snis.placeholder")
962
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
963
- d(Re, {
964
- disabled: o.value.length === 1,
965
- "routing-rules-entity": t(s).SNIS,
966
- onRemove: (y) => a("remove", p)
967
- }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
968
- ]))), 128))
969
- ]),
970
- _: 1
971
- }),
972
- d(Ee, {
973
- "routing-rules-entity": t(s).SNIS,
974
- onAdd: i[0] || (i[0] = (g) => a("add"))
975
- }, null, 8, ["routing-rules-entity"])
976
- ]);
977
- };
978
- }
979
- }), go = /* @__PURE__ */ Z(ho, [["__scopeId", "data-v-e6782e08"]]), yo = { class: "routing-rule-container" }, bo = ["innerHTML"], So = /* @__PURE__ */ z({
980
- __name: "SourceRules",
981
- props: {
982
- modelValue: { required: !0 },
983
- modelModifiers: {}
984
- },
985
- emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
986
- setup(e, { emit: C }) {
987
- const { i18n: { t: f } } = J.useI18n(), o = X(e, "modelValue"), a = C;
988
- return (v, i) => {
989
- const A = N("KLabel"), h = N("KInput");
990
- return m(), k("div", yo, [
991
- d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
992
- tooltip: u(() => [
993
- V("span", {
994
- innerHTML: t(f)("form.fields.sources.tooltip")
995
- }, null, 8, bo)
996
- ]),
997
- default: u(() => [
998
- U(" " + H(t(f)("form.fields.sources.label")), 1)
999
- ]),
1000
- _: 1
1001
- }),
1002
- d(he, { name: "appear" }, {
1003
- default: u(() => [
1004
- (m(!0), k(G, null, re(o.value, (g, p) => (m(), k("div", {
1005
- key: p,
1006
- class: "routing-rule-input"
1007
- }, [
1008
- d(h, {
1009
- modelValue: o.value[p].ip,
1010
- "onUpdate:modelValue": (y) => o.value[p].ip = y,
1011
- modelModifiers: { trim: !0 },
1012
- "data-testid": `route-form-sources-ip-input-${p + 1}`,
1013
- placeholder: t(f)("form.fields.sources.ip.placeholder")
1014
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
1015
- d(h, {
1016
- modelValue: o.value[p].port,
1017
- "onUpdate:modelValue": (y) => o.value[p].port = y,
1018
- modelModifiers: { number: !0 },
1019
- "data-testid": `route-form-sources-port-input-${p + 1}`,
1020
- max: "65535",
1021
- min: "0",
1022
- placeholder: t(f)("form.fields.sources.port.placeholder"),
1023
- type: "number"
1024
- }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
1025
- d(Re, {
1026
- disabled: o.value.length === 1,
1027
- "routing-rules-entity": t(s).SOURCES,
1028
- onRemove: (y) => a("remove", p)
1029
- }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
1030
- ]))), 128))
1031
- ]),
1032
- _: 1
1033
- }),
1034
- d(Ee, {
1035
- "routing-rules-entity": t(s).SOURCES,
1036
- onAdd: i[0] || (i[0] = (g) => a("add"))
1037
- }, null, 8, ["routing-rules-entity"])
1038
- ]);
1039
- };
1040
- }
1041
- }), _o = /* @__PURE__ */ Z(So, [["__scopeId", "data-v-448078c1"]]), To = { class: "traditional-rules-hint" }, Io = { key: 0 }, Eo = ["innerHTML"], Ro = {
1042
- key: 0,
1043
- class: "route-form-fields-container route-form-advanced-fields-container"
1044
- }, Ao = ["innerHTML"], Oo = ["innerHTML"], ko = ["innerHTML"], Ho = ["innerHTML"], No = ["innerHTML"], Co = ["innerHTML"], xo = /* @__PURE__ */ z({
1045
- __name: "TraditionalRules",
1046
- props: /* @__PURE__ */ Y({
1047
- protocols: {},
1048
- hideAdvanced: { type: Boolean },
1049
- readonly: { type: Boolean },
1050
- configType: {}
1051
- }, {
1052
- fields: { required: !0 },
1053
- fieldsModifiers: {},
1054
- customMethods: { required: !0 },
1055
- customMethodsModifiers: {}
1056
- }),
1057
- emits: ["update:fields", "update:customMethods"],
1058
- setup(e) {
1059
- const { i18nT: C, i18n: f, i18n: { t: o } } = J.useI18n(), a = f.source.form.protocols, v = e, i = X(e, "fields"), A = X(e, "customMethods"), h = (r) => {
1060
- switch (r) {
1061
- case s.PATHS:
1062
- Array.isArray(i.value.paths) ? i.value.paths.push([...W[s.PATHS]][0]) : i.value.paths = [...W[s.PATHS]];
1063
- break;
1064
- case s.SNIS:
1065
- Array.isArray(i.value.snis) ? i.value.snis.push([...W[s.SNIS]][0]) : i.value.snis = [...W[s.SNIS]];
1066
- break;
1067
- case s.HOSTS:
1068
- Array.isArray(i.value.hosts) ? i.value.hosts.push([...W[s.HOSTS]][0]) : i.value.hosts = [...W[s.HOSTS]];
1069
- break;
1070
- case s.METHODS:
1071
- i.value.methods || (i.value.methods = { ...W[s.METHODS] });
1072
- break;
1073
- case s.HEADERS:
1074
- Array.isArray(i.value.headers) ? i.value.headers.push({ ...W[s.HEADERS][0] }) : i.value.headers = [{ ...W[s.HEADERS][0] }];
1075
- break;
1076
- case s.SOURCES:
1077
- Array.isArray(i.value.sources) ? i.value.sources.push({ ...W[s.SOURCES][0] }) : i.value.sources = [{ ...W[s.SOURCES][0] }];
1078
- break;
1079
- case s.DESTINATIONS:
1080
- Array.isArray(i.value.destinations) ? i.value.destinations.push({ ...W[s.DESTINATIONS][0] }) : i.value.destinations = [{ ...W[s.DESTINATIONS][0] }];
1081
- break;
1082
- }
1083
- }, g = async (r, c) => {
1084
- if (typeof c < "u") {
1085
- const S = i.value[r];
1086
- if (Array.isArray(S) && (S.splice(c, 1), S.length > 0))
1087
- return;
1088
- }
1089
- await lt(() => {
1090
- delete i.value[r];
1091
- });
1092
- }, p = (r) => r.some((c) => v.protocols.includes(c)), y = w(() => new Set(Pe[v.protocols])), D = w(() => {
1093
- if (p(["tls_passthrough"]))
1094
- return [F(s.SNIS)];
1095
- const r = (v.configType === "basic" ? [s.PATHS, s.METHODS, s.HOSTS] : Pe[v.protocols]).map((c) => F(c));
1096
- return [[...r].splice(0, r.length - 1).join(", "), r[r.length - 1]];
1097
- }), F = (r) => {
1098
- var S;
1099
- return ((S = f.source.form.fields[r]) == null ? void 0 : S.singular) || "";
1100
- };
1101
- return (r, c) => {
1102
- const S = N("KCheckbox"), M = N("KSelect"), le = N("KInput"), j = N("KCard");
1103
- return m(), x(j, null, {
1104
- default: u(() => {
1105
- var E;
1106
- return [
1107
- V("span", To, [
1108
- d(t(C), { keypath: "form.hint.rules_message" }, {
1109
- protocol: u(() => [
1110
- V("b", null, H(t(a)[e.protocols]), 1)
1111
- ]),
1112
- routingRules: u(() => [
1113
- d(t(C), {
1114
- keypath: D.value[1] ? "form.hint.multiple_rules" : "form.hint.single_rule"
1115
- }, {
1116
- routingRules: u(() => [
1117
- U(H(D.value[0]), 1)
1118
- ]),
1119
- lastRoutingRule: u(() => [
1120
- U(H(D.value[1]), 1)
1121
- ]),
1122
- _: 1
1123
- }, 8, ["keypath"])
1124
- ]),
1125
- _: 1
1126
- }),
1127
- e.configType === "basic" ? (m(), k("span", Io, H(t(o)("form.hint.advanced")), 1)) : P("", !0)
1128
- ]),
1129
- d(he, { name: "appear" }, {
1130
- default: u(() => {
1131
- var _;
1132
- return [
1133
- i.value.paths && y.value.has(t(s).PATHS) ? (m(), x(fo, {
1134
- key: "paths-container",
1135
- modelValue: i.value.paths,
1136
- "onUpdate:modelValue": c[0] || (c[0] = (T) => i.value.paths = T),
1137
- onAdd: c[1] || (c[1] = (T) => h(t(s).PATHS)),
1138
- onRemove: c[2] || (c[2] = (T) => g(t(s).PATHS, T))
1139
- }, null, 8, ["modelValue"])) : P("", !0),
1140
- p(["http", "https", "ws", "wss"]) ? (m(), x(S, {
1141
- key: 1,
1142
- modelValue: i.value.strip_path,
1143
- "onUpdate:modelValue": c[3] || (c[3] = (T) => i.value.strip_path = T),
1144
- class: "route-form-strip-path",
1145
- "data-testid": "route-form-strip-path",
1146
- disabled: !((_ = i.value.paths) != null && _.some(Boolean)),
1147
- label: t(o)("form.fields.strip_path.label"),
1148
- "label-attributes": {
1149
- tooltipAttributes: { maxWidth: "320" }
1150
- }
1151
- }, {
1152
- tooltip: u(() => [
1153
- V("span", {
1154
- innerHTML: t(o)("form.fields.strip_path.tooltip")
1155
- }, null, 8, Eo)
1156
- ]),
1157
- _: 1
1158
- }, 8, ["modelValue", "disabled", "label"])) : P("", !0),
1159
- i.value.methods && y.value.has(t(s).METHODS) ? (m(), x(no, {
1160
- key: "methods-container",
1161
- "custom-methods": A.value,
1162
- "onUpdate:customMethods": c[4] || (c[4] = (T) => A.value = T),
1163
- methods: i.value.methods,
1164
- "onUpdate:methods": c[5] || (c[5] = (T) => i.value.methods = T)
1165
- }, null, 8, ["custom-methods", "methods"])) : P("", !0),
1166
- i.value.hosts && y.value.has(t(s).HOSTS) ? (m(), x(so, {
1167
- key: "hosts-container",
1168
- modelValue: i.value.hosts,
1169
- "onUpdate:modelValue": c[6] || (c[6] = (T) => i.value.hosts = T),
1170
- onAdd: c[7] || (c[7] = (T) => h(t(s).HOSTS)),
1171
- onRemove: c[8] || (c[8] = (T) => g(t(s).HOSTS, T))
1172
- }, null, 8, ["modelValue"])) : P("", !0),
1173
- i.value.headers && e.configType === "advanced" && y.value.has(t(s).HEADERS) ? (m(), x(Zt, {
1174
- key: "headers-container",
1175
- modelValue: i.value.headers,
1176
- "onUpdate:modelValue": c[9] || (c[9] = (T) => i.value.headers = T),
1177
- onAdd: c[10] || (c[10] = (T) => h(t(s).HEADERS)),
1178
- onRemove: c[11] || (c[11] = (T) => g(t(s).HEADERS, T))
1179
- }, null, 8, ["modelValue"])) : P("", !0),
1180
- i.value.sources && y.value.has(t(s).SOURCES) ? (m(), x(_o, {
1181
- key: "sources-container",
1182
- modelValue: i.value.sources,
1183
- "onUpdate:modelValue": c[12] || (c[12] = (T) => i.value.sources = T),
1184
- onAdd: c[13] || (c[13] = (T) => h(t(s).SOURCES)),
1185
- onRemove: c[14] || (c[14] = (T) => g(t(s).SOURCES, T))
1186
- }, null, 8, ["modelValue"])) : P("", !0),
1187
- i.value.destinations && y.value.has(t(s).DESTINATIONS) ? (m(), x(zt, {
1188
- key: "destinations-container",
1189
- modelValue: i.value.destinations,
1190
- "onUpdate:modelValue": c[15] || (c[15] = (T) => i.value.destinations = T),
1191
- onAdd: c[16] || (c[16] = (T) => h(t(s).DESTINATIONS)),
1192
- onRemove: c[17] || (c[17] = (T) => g(t(s).DESTINATIONS, T))
1193
- }, null, 8, ["modelValue"])) : P("", !0),
1194
- i.value.snis && e.configType === "advanced" && y.value.has(t(s).SNIS) ? (m(), x(go, {
1195
- key: "snis-container",
1196
- modelValue: i.value.snis,
1197
- "onUpdate:modelValue": c[18] || (c[18] = (T) => i.value.snis = T),
1198
- onAdd: c[19] || (c[19] = (T) => h(t(s).SNIS)),
1199
- onRemove: c[20] || (c[20] = (T) => g(t(s).SNIS, T))
1200
- }, null, 8, ["modelValue"])) : P("", !0)
1201
- ];
1202
- }),
1203
- _: 1
1204
- }),
1205
- e.hideAdvanced ? P("", !0) : (m(), k("div", Ro, [
1206
- (E = i.value.paths) != null && E.some(Boolean) ? (m(), x(M, {
1207
- key: 0,
1208
- modelValue: i.value.path_handling,
1209
- "onUpdate:modelValue": c[21] || (c[21] = (_) => i.value.path_handling = _),
1210
- "data-testid": "route-form-path-handling",
1211
- items: t(Lt),
1212
- label: t(o)("form.fields.path_handling.label"),
1213
- "label-attributes": {
1214
- tooltipAttributes: { maxWidth: "320" }
1215
- },
1216
- readonly: e.readonly,
1217
- width: "100%"
1218
- }, {
1219
- "label-tooltip": u(() => [
1220
- V("span", {
1221
- innerHTML: t(o)("form.fields.path_handling.tooltip")
1222
- }, null, 8, Ao)
1223
- ]),
1224
- _: 1
1225
- }, 8, ["modelValue", "items", "label", "readonly"])) : P("", !0),
1226
- d(M, {
1227
- modelValue: i.value.https_redirect_status_code,
1228
- "onUpdate:modelValue": c[22] || (c[22] = (_) => i.value.https_redirect_status_code = _),
1229
- "data-testid": "route-form-http-redirect-status-code",
1230
- items: t(ot),
1231
- label: t(o)("form.fields.https_redirect_status_code.label"),
1232
- "label-attributes": {
1233
- tooltipAttributes: { maxWidth: "320" }
1234
- },
1235
- readonly: e.readonly,
1236
- width: "100%"
1237
- }, {
1238
- "label-tooltip": u(() => [
1239
- V("span", {
1240
- innerHTML: t(o)("form.fields.https_redirect_status_code.tooltip")
1241
- }, null, 8, Oo)
1242
- ]),
1243
- _: 1
1244
- }, 8, ["modelValue", "items", "label", "readonly"]),
1245
- d(le, {
1246
- modelValue: i.value.regex_priority,
1247
- "onUpdate:modelValue": c[23] || (c[23] = (_) => i.value.regex_priority = _),
1248
- autocomplete: "off",
1249
- "data-testid": "route-form-regex-priority",
1250
- label: t(o)("form.fields.regex_priority.label"),
1251
- "label-attributes": {
1252
- tooltipAttributes: { maxWidth: "320" }
1253
- },
1254
- readonly: e.readonly,
1255
- type: "number"
1256
- }, {
1257
- "label-tooltip": u(() => [
1258
- V("span", {
1259
- innerHTML: t(o)("form.fields.regex_priority.tooltip")
1260
- }, null, 8, ko)
1261
- ]),
1262
- _: 1
1263
- }, 8, ["modelValue", "label", "readonly"]),
1264
- d(S, {
1265
- modelValue: i.value.preserve_host,
1266
- "onUpdate:modelValue": c[24] || (c[24] = (_) => i.value.preserve_host = _),
1267
- "data-testid": "route-form-preserve-host",
1268
- label: t(o)("form.fields.preserve_host.label"),
1269
- "label-attributes": {
1270
- tooltipAttributes: { maxWidth: "320" }
1271
- }
1272
- }, {
1273
- tooltip: u(() => [
1274
- V("span", {
1275
- innerHTML: t(o)("form.fields.preserve_host.tooltip")
1276
- }, null, 8, Ho)
1277
- ]),
1278
- _: 1
1279
- }, 8, ["modelValue", "label"]),
1280
- d(S, {
1281
- modelValue: i.value.request_buffering,
1282
- "onUpdate:modelValue": c[25] || (c[25] = (_) => i.value.request_buffering = _),
1283
- "data-testid": "route-form-request-buffering",
1284
- label: t(o)("form.fields.request_buffering.label"),
1285
- "label-attributes": {
1286
- tooltipAttributes: { maxWidth: "320" }
1287
- }
1288
- }, {
1289
- tooltip: u(() => [
1290
- V("span", {
1291
- innerHTML: t(o)("form.fields.request_buffering.tooltip")
1292
- }, null, 8, No)
1293
- ]),
1294
- _: 1
1295
- }, 8, ["modelValue", "label"]),
1296
- d(S, {
1297
- modelValue: i.value.response_buffering,
1298
- "onUpdate:modelValue": c[26] || (c[26] = (_) => i.value.response_buffering = _),
1299
- "data-testid": "route-form-response-buffering",
1300
- label: t(o)("form.fields.response_buffering.label"),
1301
- "label-attributes": {
1302
- tooltipAttributes: { maxWidth: "320" }
1303
- }
1304
- }, {
1305
- tooltip: u(() => [
1306
- V("span", {
1307
- innerHTML: t(o)("form.fields.response_buffering.tooltip")
1308
- }, null, 8, Co)
1309
- ]),
1310
- _: 1
1311
- }, 8, ["modelValue", "label"])
1312
- ]))
1313
- ];
1314
- }),
1315
- _: 1
1316
- });
1317
- };
1318
- }
1319
- }), Qe = /* @__PURE__ */ Z(xo, [["__scopeId", "data-v-f3fa9614"]]), Do = /* @__PURE__ */ z({
1320
- __name: "RouteFormExpressionsEditorLoader",
1321
- props: /* @__PURE__ */ Y({
1322
- protocol: {},
1323
- showExpressionsModalEntry: { type: Boolean }
1324
- }, {
1325
- modelValue: { required: !0 },
1326
- modelModifiers: {}
1327
- }),
1328
- emits: /* @__PURE__ */ Y(["notify"], ["update:modelValue"]),
1329
- setup(e, { emit: C }) {
1330
- const { i18n: { t: f } } = J.useI18n(), o = {
1331
- render: () => Ke("div", f("form.expressions_editor.loading"))
1332
- }, a = {
1333
- render: () => Ke("div", f("form.expressions_editor.error"))
1334
- }, v = rt({
1335
- loader: async () => import("./RouteFormExpressionsEditor-BmRiH3GR.js"),
1336
- loadingComponent: o,
1337
- errorComponent: a
1338
- }), i = e, A = C, h = B(Se.LOADING), g = X(e, "modelValue"), p = (y) => {
1339
- g.value = y;
1340
- };
1341
- return Ye(async () => {
1342
- try {
1343
- await (await import("@kong-ui-public/expressions")).asyncInit, h.value = Se.READY;
1344
- } catch (y) {
1345
- h.value = Se.ERROR, console.error(y);
1346
- }
1347
- }), (y, D) => (m(), k(G, null, [
1348
- h.value === t(Se).ERROR ? (m(), x(qe(a), {
1349
- key: 0,
1350
- "data-testid": "route-form-expressions-editor-loader-error"
1351
- })) : h.value === t(Se).LOADING ? (m(), x(qe(o), {
1352
- key: 1,
1353
- "data-testid": "route-form-expressions-editor-loader-loading"
1354
- })) : (m(), x(t(v), {
1355
- key: 2,
1356
- modelValue: g.value,
1357
- "onUpdate:modelValue": D[0] || (D[0] = (F) => g.value = F),
1358
- protocol: i.protocol,
1359
- "show-expressions-modal-entry": e.showExpressionsModalEntry,
1360
- onNotify: D[1] || (D[1] = (F) => A("notify", F))
1361
- }, {
1362
- default: u(() => [
1363
- d(t(At), { size: t(Gt) }, null, 8, ["size"]),
1364
- V("span", null, H(t(f)("form.expression_playground.test_link")), 1)
1365
- ]),
1366
- _: 1
1367
- }, 8, ["modelValue", "protocol", "show-expressions-modal-entry"])),
1368
- Le(y.$slots, "after-editor", {
1369
- expression: { value: g.value, update: p },
1370
- state: h.value
1371
- })
1372
- ], 64));
1373
- }
1374
- }), Vo = { class: "route-form-routing-rules-title-container" }, wo = { class: "routing-rules-title" }, Mo = { class: "route-form-fields-container route-form-advanced-fields-container" }, $o = /* @__PURE__ */ z({
1375
- __name: "ExpressionsRules",
1376
- props: /* @__PURE__ */ Y({
1377
- protocols: {},
1378
- hideAdvanced: { type: Boolean },
1379
- readonly: { type: Boolean },
1380
- showExpressionsModalEntry: { type: Boolean }
1381
- }, {
1382
- fields: { required: !0 },
1383
- fieldsModifiers: {}
1384
- }),
1385
- emits: /* @__PURE__ */ Y(["notify"], ["update:fields"]),
1386
- setup(e, { emit: C }) {
1387
- const { i18n: { t: f } } = J.useI18n(), o = e, a = X(e, "fields"), v = C, i = B(!0), A = w(() => o.protocols.split(",") || []), h = (g) => g.some((p) => o.protocols.includes(p));
1388
- return (g, p) => {
1389
- const y = N("KCard"), D = N("KSelect"), F = N("KInput"), r = N("KCheckbox"), c = N("KCollapse");
1390
- return m(), k(G, null, [
1391
- d(y, null, {
1392
- title: u(() => [
1393
- V("div", Vo, [
1394
- (m(!0), k(G, null, re(A.value, (S) => (m(), k("span", {
1395
- key: S,
1396
- class: "protocol-title"
1397
- }, H(S.toUpperCase()), 1))), 128)),
1398
- V("span", wo, H(t(f)("form.sections.routingExpression.title")), 1)
1399
- ])
1400
- ]),
1401
- default: u(() => [
1402
- d(Do, {
1403
- modelValue: a.value.expression,
1404
- "onUpdate:modelValue": p[0] || (p[0] = (S) => a.value.expression = S),
1405
- protocol: A.value[0],
1406
- "show-expressions-modal-entry": e.showExpressionsModalEntry,
1407
- onNotify: p[1] || (p[1] = (S) => v("notify", S))
1408
- }, {
1409
- "after-editor": u((S) => [
1410
- Le(g.$slots, "after-expressions-editor", {
1411
- expression: S.expression,
1412
- state: S.state
1413
- }, void 0, !0)
1414
- ]),
1415
- _: 3
1416
- }, 8, ["modelValue", "protocol", "show-expressions-modal-entry"])
1417
- ]),
1418
- _: 3
1419
- }),
1420
- d(c, {
1421
- modelValue: i.value,
1422
- "onUpdate:modelValue": p[8] || (p[8] = (S) => i.value = S),
1423
- class: "route-form-advanced-fields-collapse",
1424
- "trigger-alignment": "leading",
1425
- "trigger-label": t(f)("form.show_more")
1426
- }, {
1427
- default: u(() => [
1428
- d(y, null, {
1429
- default: u(() => [
1430
- V("div", Mo, [
1431
- d(D, {
1432
- modelValue: a.value.https_redirect_status_code,
1433
- "onUpdate:modelValue": p[2] || (p[2] = (S) => a.value.https_redirect_status_code = S),
1434
- "data-testid": "route-form-http-redirect-status-code",
1435
- items: t(ot),
1436
- label: t(f)("form.fields.https_redirect_status_code.label"),
1437
- readonly: e.readonly,
1438
- width: "100%"
1439
- }, null, 8, ["modelValue", "items", "label", "readonly"]),
1440
- d(F, {
1441
- modelValue: a.value.priority,
1442
- "onUpdate:modelValue": p[3] || (p[3] = (S) => a.value.priority = S),
1443
- autocomplete: "off",
1444
- "data-testid": "route-form-priority",
1445
- label: t(f)("form.fields.priority.label"),
1446
- "label-attributes": {
1447
- info: t(f)("form.fields.priority.tooltip"),
1448
- tooltipAttributes: { maxWidth: "400" }
1449
- },
1450
- readonly: e.readonly,
1451
- type: "number"
1452
- }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1453
- h(["http", "https", "ws", "wss", "tls", "tcp", "udp", "tls_passthrough"]) ? (m(), x(r, {
1454
- key: 0,
1455
- modelValue: a.value.strip_path,
1456
- "onUpdate:modelValue": p[4] || (p[4] = (S) => a.value.strip_path = S),
1457
- "data-testid": "route-form-strip-path",
1458
- label: t(f)("form.fields.strip_path.label")
1459
- }, null, 8, ["modelValue", "label"])) : P("", !0),
1460
- d(r, {
1461
- modelValue: a.value.preserve_host,
1462
- "onUpdate:modelValue": p[5] || (p[5] = (S) => a.value.preserve_host = S),
1463
- "data-testid": "route-form-preserve-host",
1464
- label: t(f)("form.fields.preserve_host.label")
1465
- }, null, 8, ["modelValue", "label"]),
1466
- d(r, {
1467
- modelValue: a.value.request_buffering,
1468
- "onUpdate:modelValue": p[6] || (p[6] = (S) => a.value.request_buffering = S),
1469
- "data-testid": "route-form-request-buffering",
1470
- label: t(f)("form.fields.request_buffering.label")
1471
- }, null, 8, ["modelValue", "label"]),
1472
- d(r, {
1473
- modelValue: a.value.response_buffering,
1474
- "onUpdate:modelValue": p[7] || (p[7] = (S) => a.value.response_buffering = S),
1475
- "data-testid": "route-form-response-buffering",
1476
- label: t(f)("form.fields.response_buffering.label")
1477
- }, null, 8, ["modelValue", "label"])
1478
- ])
1479
- ]),
1480
- _: 1
1481
- })
1482
- ]),
1483
- _: 1
1484
- }, 8, ["modelValue", "trigger-label"])
1485
- ], 64);
1486
- };
1487
- }
1488
- }), Uo = /* @__PURE__ */ Z($o, [["__scopeId", "data-v-e7571a47"]]), Po = { class: "config-type-container" }, Lo = {
1489
- key: 0,
1490
- class: "config-flavor"
1491
- }, Fo = /* @__PURE__ */ z({
1492
- __name: "RouteFormRulesComposer",
1493
- props: /* @__PURE__ */ Y({
1494
- protocols: {},
1495
- routeFlavors: {},
1496
- readonly: { type: Boolean },
1497
- recordFlavor: {},
1498
- showExpressionsModalEntry: { type: Boolean },
1499
- tooltips: {},
1500
- isWsSupported: { type: Boolean },
1501
- hideProtocols: { type: Boolean }
1502
- }, {
1503
- configType: { required: !0 },
1504
- configTypeModifiers: {},
1505
- configFlavor: { required: !0 },
1506
- configFlavorModifiers: {},
1507
- fields: {
1508
- default: () => Ce({
1509
- ...xe,
1510
- paths: [""],
1511
- regex_priority: 0,
1512
- path_handling: "v0",
1513
- expression: "",
1514
- priority: 0
1515
- })
1516
- },
1517
- fieldsModifiers: {},
1518
- customMethods: { default: () => Ce([]) },
1519
- customMethodsModifiers: {}
1520
- }),
1521
- emits: /* @__PURE__ */ Y(["notify", "update:payload", "update:protocols"], ["update:configType", "update:configFlavor", "update:fields", "update:customMethods"]),
1522
- setup(e, { emit: C }) {
1523
- const f = e, o = X(e, "configType"), a = X(e, "configFlavor"), v = X(e, "fields"), i = X(e, "customMethods"), A = C, { i18n: { t: h } } = J.useI18n(), g = [
1524
- {
1525
- value: q.TRADITIONAL,
1526
- label: h("form.flavors.traditional")
1527
- },
1528
- {
1529
- value: q.EXPRESSIONS,
1530
- label: h("form.flavors.expressions")
1531
- }
1532
- ], p = w(() => [
1533
- { label: h("form.protocols.grpc"), value: "grpc" },
1534
- { label: h("form.protocols.grpcs"), value: "grpcs" },
1535
- { label: h("form.protocols.grpc,grpcs"), value: "grpc,grpcs" },
1536
- { label: h("form.protocols.http"), value: "http" },
1537
- { label: h("form.protocols.https"), value: "https" },
1538
- { label: h("form.protocols.http,https"), value: "http,https" },
1539
- { label: h("form.protocols.tcp"), value: "tcp" },
1540
- { label: h("form.protocols.tls"), value: "tls" },
1541
- { label: h("form.protocols.tls,udp"), value: "tls,udp" },
1542
- { label: h("form.protocols.tcp,udp"), value: "tcp,udp" },
1543
- { label: h("form.protocols.tcp,tls"), value: "tcp,tls" },
1544
- { label: h("form.protocols.tcp,tls,udp"), value: "tcp,tls,udp" },
1545
- { label: h("form.protocols.tls_passthrough"), value: "tls_passthrough" },
1546
- { label: h("form.protocols.udp"), value: "udp" },
1547
- ...f.isWsSupported ? [
1548
- { label: h("form.protocols.ws"), value: "ws" },
1549
- { label: h("form.protocols.wss"), value: "wss" },
1550
- { label: h("form.protocols.ws,wss"), value: "ws,wss" }
1551
- ] : []
1552
- ]), y = w(() => f.recordFlavor ? f.recordFlavor : a.value), D = (E, _) => {
1553
- if (!new Set(Pe[f.protocols]).has(E))
1554
- return [];
1555
- if ([s.PATHS, s.HOSTS, s.METHODS, s.SNIS].includes(E))
1556
- return [..._].filter((K) => !!K);
1557
- if (E === s.SOURCES || E === s.DESTINATIONS)
1558
- return [..._].filter((K) => !!K.ip || !!K.port).map((K) => ({
1559
- ip: K.ip || void 0,
1560
- port: !K.port && K.port !== 0 ? void 0 : K.port
1561
- }));
1562
- if (E === s.HEADERS)
1563
- return [..._].filter((K) => !!K.header);
1564
- }, F = (E) => E.some((_) => f.protocols.includes(_)), r = () => {
1565
- if (y.value !== q.TRADITIONAL)
1566
- return null;
1567
- const E = v.value, _ = D(s.HEADERS, E.headers || []) || W[s.HEADERS];
1568
- return _.length === 0 ? null : _.reduce((T, K) => (T[K.header] = K.values.split(","), T), {});
1569
- }, c = w(() => (v.value.methods || []).filter((T) => Object.keys(Ie).includes(T)).concat(i.value.map((T) => T.label.toUpperCase()))), S = (E) => E != null && E.length ? E : null, M = w(() => ({
1570
- https_redirect_status_code: v.value.https_redirect_status_code,
1571
- strip_path: F(["http", "https", "ws", "wss"]) ? v.value.strip_path : !1,
1572
- preserve_host: v.value.preserve_host,
1573
- request_buffering: v.value.request_buffering,
1574
- response_buffering: v.value.response_buffering
1575
- })), le = w(() => {
1576
- switch (y.value) {
1577
- case q.TRADITIONAL: {
1578
- const E = v.value, _ = S(D(s.PATHS, E.paths || [])), T = S(D(s.HOSTS, E.hosts || [])), K = {
1579
- ...M.value,
1580
- methods: S(D(s.METHODS, c.value)),
1581
- hosts: o.value === "basic" && T ? T.slice(0, 1) : T,
1582
- paths: o.value === "basic" && _ ? _.slice(0, 1) : _,
1583
- headers: o.value === "basic" ? null : r(),
1584
- regex_priority: Number(E.regex_priority),
1585
- path_handling: E.path_handling,
1586
- sources: S(D(s.SOURCES, E.sources || [])),
1587
- destinations: S(D(s.DESTINATIONS, E.destinations || [])),
1588
- snis: o.value === "basic" ? null : S(D(s.SNIS, E.snis || []))
1589
- };
1590
- return {
1591
- type: y.value,
1592
- payload: K
1593
- };
1594
- }
1595
- case q.EXPRESSIONS: {
1596
- const E = v.value;
1597
- return {
1598
- type: y.value,
1599
- payload: {
1600
- ...M.value,
1601
- expression: E.expression,
1602
- priority: Number(E.priority)
1603
- }
1604
- };
1605
- }
1606
- default:
1607
- return;
1608
- }
1609
- }), j = (E) => {
1610
- E && A("update:protocols", E);
1611
- };
1612
- return _e([() => f.recordFlavor, () => f.routeFlavors], ([E, _]) => {
1613
- if (E) {
1614
- a.value = E;
1615
- return;
1616
- }
1617
- a.value = !_.traditional && _.expressions ? q.EXPRESSIONS : q.TRADITIONAL;
1618
- }, { immediate: !0, deep: !0 }), _e(o, (E) => {
1619
- E === "basic" && (a.value = q.TRADITIONAL, A("update:protocols", "http,https"));
1620
- }), _e(le, (E) => {
1621
- A("update:payload", E);
1622
- }, { deep: !0, immediate: !0 }), (E, _) => {
1623
- const T = N("KRadio"), K = N("KLabel"), Ae = N("KTooltip"), ne = N("KSegmentedControl"), ee = N("KAlert"), ge = N("KSelect");
1624
- return m(), k(G, null, [
1625
- V("div", Po, [
1626
- d(T, {
1627
- modelValue: o.value,
1628
- "onUpdate:modelValue": _[0] || (_[0] = ($) => o.value = $),
1629
- card: "",
1630
- "card-orientation": "horizontal",
1631
- "data-testid": "route-form-config-type-basic",
1632
- description: t(h)("form.config_types.basic.description"),
1633
- disabled: !e.routeFlavors.traditional || e.recordFlavor === t(q).EXPRESSIONS,
1634
- label: t(h)("form.config_types.basic.label"),
1635
- "selected-value": "basic"
1636
- }, null, 8, ["modelValue", "description", "disabled", "label"]),
1637
- d(T, {
1638
- modelValue: o.value,
1639
- "onUpdate:modelValue": _[1] || (_[1] = ($) => o.value = $),
1640
- card: "",
1641
- "card-orientation": "horizontal",
1642
- "data-testid": "route-form-config-type-advanced",
1643
- description: t(h)("form.config_types.advanced.description"),
1644
- label: t(h)("form.config_types.advanced.label"),
1645
- "selected-value": "advanced"
1646
- }, null, 8, ["modelValue", "description", "label"])
1647
- ]),
1648
- o.value === "basic" ? (m(), x(Qe, {
1649
- key: 0,
1650
- "custom-methods": i.value,
1651
- "onUpdate:customMethods": _[2] || (_[2] = ($) => i.value = $),
1652
- fields: v.value,
1653
- "onUpdate:fields": _[3] || (_[3] = ($) => v.value = $),
1654
- "config-type": "basic",
1655
- "hide-advanced": "",
1656
- protocols: e.protocols,
1657
- readonly: e.readonly
1658
- }, null, 8, ["custom-methods", "fields", "protocols", "readonly"])) : (m(), k(G, { key: 1 }, [
1659
- e.routeFlavors.traditional && e.routeFlavors.expressions ? (m(), k("div", Lo, [
1660
- d(K, { class: "config-flavor-label" }, {
1661
- default: u(() => [
1662
- U(H(t(h)("form.config_flavor.label")), 1)
1663
- ]),
1664
- _: 1
1665
- }),
1666
- d(ne, {
1667
- modelValue: a.value,
1668
- "onUpdate:modelValue": _[4] || (_[4] = ($) => a.value = $),
1669
- class: "config-flavor-control",
1670
- "data-testid": "route-form-config-flavor",
1671
- options: g
1672
- }, {
1673
- "option-label": u(({ option: $ }) => {
1674
- var fe, ue;
1675
- return [
1676
- V("span", null, H($.label), 1),
1677
- (fe = e.tooltips) != null && fe[$.value] ? (m(), x(Ae, {
1678
- key: 0,
1679
- class: "route-form-config-tabs-tooltip",
1680
- text: (ue = e.tooltips) == null ? void 0 : ue[$.value],
1681
- "tooltip-id": `route-form-config-tabs-tooltip-${$.value}`
1682
- }, {
1683
- default: u(() => [
1684
- d(t(Ot))
1685
- ]),
1686
- _: 1
1687
- }, 8, ["text", "tooltip-id"])) : P("", !0)
1688
- ];
1689
- }),
1690
- _: 1
1691
- }, 8, ["modelValue"])
1692
- ])) : P("", !0),
1693
- e.routeFlavors.traditional && e.routeFlavors.expressions && (!e.recordFlavor || e.recordFlavor !== a.value) ? (m(), x(ee, {
1694
- key: 1,
1695
- appearance: e.recordFlavor ? "warning" : "info",
1696
- class: "route-form-config-type-immutable-alert",
1697
- "data-testid": "route-config-type-immutable-alert"
1698
- }, {
1699
- default: u(() => [
1700
- e.recordFlavor ? e.recordFlavor !== a.value ? (m(), k(G, { key: 1 }, [
1701
- U(H(t(h)("form.warning.cannotChangeFlavor.edit", { format: t(h)(`form.flavors.${e.recordFlavor}`) })), 1)
1702
- ], 64)) : P("", !0) : (m(), k(G, { key: 0 }, [
1703
- U(H(t(h)("form.warning.cannotChangeFlavor.create")), 1)
1704
- ], 64))
1705
- ]),
1706
- _: 1
1707
- }, 8, ["appearance"])) : P("", !0),
1708
- !e.recordFlavor || !(e.routeFlavors.traditional && e.routeFlavors.expressions && e.recordFlavor !== a.value) ? (m(), k(G, { key: 2 }, [
1709
- e.hideProtocols ? P("", !0) : (m(), x(ge, {
1710
- key: 0,
1711
- "data-testid": "route-form-protocols",
1712
- items: p.value,
1713
- label: t(h)("form.fields.protocols.label"),
1714
- "label-attributes": {
1715
- info: t(h)("form.fields.protocols.tooltip"),
1716
- tooltipAttributes: { maxWidth: "400" }
1717
- },
1718
- "model-value": e.protocols,
1719
- readonly: e.readonly,
1720
- required: "",
1721
- width: "100%",
1722
- "onUpdate:modelValue": j
1723
- }, null, 8, ["items", "label", "label-attributes", "model-value", "readonly"])),
1724
- a.value === t(q).TRADITIONAL ? (m(), x(Qe, {
1725
- key: 1,
1726
- "custom-methods": i.value,
1727
- "onUpdate:customMethods": _[5] || (_[5] = ($) => i.value = $),
1728
- fields: v.value,
1729
- "onUpdate:fields": _[6] || (_[6] = ($) => v.value = $),
1730
- "config-type": "advanced",
1731
- protocols: e.protocols,
1732
- readonly: e.readonly
1733
- }, null, 8, ["custom-methods", "fields", "protocols", "readonly"])) : (m(), x(Uo, {
1734
- key: 2,
1735
- fields: v.value,
1736
- "onUpdate:fields": _[7] || (_[7] = ($) => v.value = $),
1737
- protocols: e.protocols,
1738
- readonly: e.readonly,
1739
- "show-expressions-modal-entry": e.showExpressionsModalEntry,
1740
- onNotify: _[8] || (_[8] = ($) => A("notify", $))
1741
- }, null, 8, ["fields", "protocols", "readonly", "show-expressions-modal-entry"]))
1742
- ], 64)) : P("", !0)
1743
- ], 64))
1744
- ], 64);
1745
- };
1746
- }
1747
- }), Ko = /* @__PURE__ */ Z(Fo, [["__scopeId", "data-v-cbda4882"]]), qo = (e) => {
1748
- var f, o, a, v, i;
1749
- return !(typeof e.expression == "string" && e.expression.length > 0 || (e.protocols || []).sort().join(",") !== "http,https" || ((f = e[s.PATHS]) == null ? void 0 : f.length) > 1 || ((o = e[s.HOSTS]) == null ? void 0 : o.length) > 1 || e[s.HEADERS] && typeof e[s.HEADERS] == "object" || ((a = e[s.SNIS]) == null ? void 0 : a.length) > 0 || ((v = e[s.SOURCES]) == null ? void 0 : v.length) > 0 || ((i = e[s.DESTINATIONS]) == null ? void 0 : i.length) > 0 || [
1750
- "path_handling",
1751
- "regex_priority",
1752
- "https_redirect_status_code",
1753
- "preserve_host",
1754
- "request_buffering",
1755
- "response_buffering"
1756
- ].some((A) => e[A] !== Ft[A]));
1757
- }, Bo = { class: "kong-ui-entities-route-form" }, Go = { key: 1 }, Wo = { "data-testid": "no-search-results" }, jo = { class: "route-form-service-dropdown-item" }, Xo = { class: "select-item-label" }, zo = { class: "select-item-description" }, Jo = /* @__PURE__ */ z({
1758
- __name: "RouteForm",
1759
- props: {
1760
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
1761
- config: {
1762
- type: Object,
1763
- required: !0,
1764
- validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || (e == null ? void 0 : e.app) === "konnect" && !(e != null && e.controlPlaneId) || (e == null ? void 0 : e.app) === "kongManager" && typeof (e == null ? void 0 : e.workspace) != "string" || !(e != null && e.cancelRoute))
1765
- },
1766
- /** If a valid routeId is provided, it will put the form in Edit mode instead of Create */
1767
- routeId: {
1768
- type: String,
1769
- required: !1,
1770
- default: ""
1771
- },
1772
- /** If valid serviceId is provided, don't show service select field */
1773
- serviceId: {
1774
- type: String,
1775
- required: !1,
1776
- default: ""
1777
- },
1778
- /** Whether show or hide EntityFormSection info column */
1779
- hideSectionsInfo: {
1780
- type: Boolean,
1781
- required: !1,
1782
- default: !1
1783
- },
1784
- /** Whether show or hide Route name field */
1785
- hideNameField: {
1786
- type: Boolean,
1787
- required: !1,
1788
- default: !1
1789
- },
1790
- /** Whether show or hide Service Select field */
1791
- hideServiceField: {
1792
- type: Boolean,
1793
- required: !1,
1794
- default: !1
1795
- },
1796
- /** Route flavors to be enabled for this form */
1797
- routeFlavors: {
1798
- type: Object,
1799
- required: !1,
1800
- default: () => ({
1801
- traditional: !0
1802
- })
1803
- },
1804
- /** Tooltips to show on config tabs */
1805
- configTabTooltips: {
1806
- type: Object,
1807
- required: !1,
1808
- default: () => {
1809
- }
1810
- },
1811
- /** Whether to show the expressions modal entry */
1812
- showExpressionsModalEntry: {
1813
- type: Boolean,
1814
- required: !1,
1815
- default: !1
1816
- }
1817
- },
1818
- emits: ["update", "error", "loading", "model-updated", "notify"],
1819
- setup(e, { expose: C, emit: f }) {
1820
- var be;
1821
- const o = e, a = f, v = B("basic"), i = B(
1822
- !o.routeFlavors.traditional && o.routeFlavors.expressions ? q.EXPRESSIONS : q.TRADITIONAL
1823
- ), A = B(void 0), h = w(() => {
1824
- if (A.value)
1825
- return A.value;
1826
- if (i.value)
1827
- return i.value;
1828
- if (o.routeFlavors.traditional)
1829
- return q.TRADITIONAL;
1830
- if (o.routeFlavors.expressions)
1831
- return q.EXPRESSIONS;
1832
- }), { i18n: { t: g } } = J.useI18n(), p = tt(), { axiosInstance: y } = Fe((be = o.config) == null ? void 0 : be.axiosRequestConfig), { getMessageFromError: D } = dt(), F = (l) => l.name ? `${l.name} - ${l.value}` : l.value, r = Ce({
1833
- routeFlavors: o.routeFlavors,
1834
- fields: {
1835
- name: "",
1836
- protocols: "http,https",
1837
- tags: "",
1838
- service_id: "",
1839
- ...xe,
1840
- paths: [""],
1841
- snis: [""],
1842
- hosts: [""],
1843
- methods: [],
1844
- headers: [{ ...W[s.HEADERS][0] }],
1845
- sources: [{ ...W[s.SOURCES][0] }],
1846
- destinations: [{ ...W[s.DESTINATIONS][0] }],
1847
- regex_priority: 0,
1848
- path_handling: "v0",
1849
- expression: "",
1850
- priority: 0
1851
- },
1852
- isReadonly: !1,
1853
- errorMessage: ""
1854
- });
1855
- _e(() => o.routeFlavors, (l) => {
1856
- r.routeFlavors = l, l.traditional || (v.value = "advanced");
1857
- }, { immediate: !0, deep: !0 });
1858
- const c = B(), S = B([]), M = B([]), le = Ce({
1859
- name: "",
1860
- protocols: "http,https",
1861
- tags: "",
1862
- service_id: "",
1863
- ...xe,
1864
- path_handling: "v0",
1865
- regex_priority: 0,
1866
- expression: "",
1867
- priority: 0
1868
- }), j = o.config.app === "konnect" || ct({
1869
- gatewayInfo: o.config.gatewayInfo,
1870
- // 'ws' and 'wss' are not valid values for the protocol field in Gateway Community Edition or before Gateway Enterprise Edition 3.0
1871
- supportedRange: {
1872
- enterprise: ["3.0"]
1873
- }
1874
- }), E = w(() => o.routeId ? Ge.Edit : Ge.Create), _ = w(() => {
1875
- var l, n, b;
1876
- return (b = (n = Te.form[(l = o.config) == null ? void 0 : l.app]) == null ? void 0 : n.fetch) == null ? void 0 : b[o.serviceId ? "forGatewayService" : "all"].replace(/{serviceId}/gi, o.serviceId || "");
1877
- }), T = () => {
1878
- var l;
1879
- p.push((l = o.config) == null ? void 0 : l.cancelRoute);
1880
- }, K = (l) => {
1881
- a("loading", l);
1882
- }, Ae = (l) => {
1883
- a("error", l);
1884
- }, ne = (l) => Object.entries(l).map((n) => {
1885
- var b;
1886
- return { header: n[0], values: (b = n[1]) == null ? void 0 : b.join() };
1887
- }), ee = (l) => l.some((n) => r.fields.protocols.includes(n)), ge = (l) => {
1888
- var b, R;
1889
- if (o.routeId) {
1890
- const I = typeof l.expression == "string" && l.expression.length > 0 ? q.EXPRESSIONS : q.TRADITIONAL;
1891
- A.value = I, qo(l) || (v.value = "advanced");
1892
- }
1893
- (b = l == null ? void 0 : l.service) != null && b.id && (r.fields.service_id = l.service.id), r.fields.name = (l == null ? void 0 : l.name) || "";
1894
- const n = (l == null ? void 0 : l.tags) || [];
1895
- r.fields.tags = (n == null ? void 0 : n.join(", ")) || "", r.fields.preserve_host = typeof (l == null ? void 0 : l.preserve_host) > "u" ? !1 : l == null ? void 0 : l.preserve_host, r.fields.https_redirect_status_code = (l == null ? void 0 : l.https_redirect_status_code) || 426, (R = l == null ? void 0 : l.protocols) != null && R.length && (l.protocols.length > 1 ? r.fields.protocols = l.protocols.join() : r.fields.protocols = l.protocols[0]), r.fields.request_buffering = typeof (l == null ? void 0 : l.request_buffering) > "u" ? !0 : l == null ? void 0 : l.request_buffering, r.fields.response_buffering = typeof (l == null ? void 0 : l.response_buffering) > "u" ? !0 : l == null ? void 0 : l.response_buffering, r.fields.strip_path = typeof (l == null ? void 0 : l.strip_path) > "u" ? !0 : l == null ? void 0 : l.strip_path, ze(r) && (r.fields.regex_priority = (l == null ? void 0 : l.regex_priority) || 0, r.fields.path_handling = (l == null ? void 0 : l.path_handling) || "v0", l != null && l.paths && (r.fields.paths = l.paths), l != null && l.snis && (r.fields.snis = l.snis), l != null && l.hosts && (r.fields.hosts = l.hosts), l != null && l.methods && (r.fields.methods = l.methods.filter((I) => Object.keys(Ie).includes(I)), S.value = l.methods.filter((I) => !Object.keys(Ie).includes(I)).map((I) => ({ label: I, value: I })), M.value = [...S.value]), l != null && l.headers && (r.fields.headers = ne(l.headers)), l != null && l.sources && (r.fields.sources = l.sources), l != null && l.destinations && (r.fields.destinations = l.destinations)), Je(r) && (r.fields.expression = (l == null ? void 0 : l.expression) || "", r.fields.priority = (l == null ? void 0 : l.priority) || 0), Object.assign(le, JSON.parse(JSON.stringify(r.fields)));
1896
- }, $ = w(() => {
1897
- switch (h.value) {
1898
- case q.TRADITIONAL: {
1899
- if (ze(r)) {
1900
- const l = r.fields.hosts ? !!r.fields.hosts.filter(Boolean).length : null, n = r.fields.paths ? !!r.fields.paths.filter(Boolean).length : null, b = r.fields.headers ? r.fields.headers.some(({ header: Q }) => !!Q) : null, R = r.fields.snis ? !!r.fields.snis.filter(Boolean).length : null, I = r.fields.destinations ? r.fields.destinations.some(({ ip: Q, port: ce }) => !!Q || !!ce) : null, te = r.fields.sources ? r.fields.sources.some(({ ip: Q, port: ce }) => !!Q || !!ce) : null, ae = r.fields.methods ? !!r.fields.methods.filter(Boolean).length : null;
1901
- return !!r.fields.protocols && (ee(["http"]) && !!(l || ae || n || b) || ee(["https"]) && !!(l || ae || n || b || R) || ee(["grpc"]) && !!(l || n || b) || ee(["grpcs", "wss"]) && !!(l || n || b || R) || ee(["udp", "tls"]) && !!(I || te || R) || ee(["tcp"]) && !!(I || te) || ee(["tls_passthrough"]) && !!R || ee(["ws"]) && !!(l || n || b));
1902
- }
1903
- break;
1904
- }
1905
- case q.EXPRESSIONS: {
1906
- if (Je(r))
1907
- return r.fields.expression.length > 0;
1908
- break;
1909
- }
1910
- }
1911
- return !0;
1912
- }), fe = w(() => !je(r.fields, le) || !je(S.value, M.value)), ue = w(() => {
1913
- var n, b;
1914
- let l = `${o.config.apiBaseUrl}${Te.form[o.config.app][E.value][o.serviceId ? "forGatewayService" : "all"]}`;
1915
- return o.config.app === "konnect" ? l = l.replace(/{controlPlaneId}/gi, ((n = o.config) == null ? void 0 : n.controlPlaneId) || "").replace(/{serviceId}/gi, o.serviceId || "") : o.config.app === "kongManager" && (l = l.replace(/\/{workspace}/gi, (b = o.config) != null && b.workspace ? `/${o.config.workspace}` : "").replace(/{serviceId}/gi, o.serviceId || "")), l = l.replace(/{id}/gi, o.routeId), l;
1916
- });
1917
- _e(() => r.fields, () => {
1918
- a("model-updated", me.value);
1919
- }, { deep: !0 });
1920
- const me = w(() => {
1921
- var l, n, b;
1922
- return {
1923
- ...!o.hideNameField && { name: r.fields.name || null },
1924
- protocols: r.fields.protocols.split(","),
1925
- tags: (n = (l = r.fields.tags.split(",")) == null ? void 0 : l.map((R) => String(R || "").trim())) == null ? void 0 : n.filter((R) => R !== ""),
1926
- service: r.fields.service_id ? { id: r.fields.service_id } : null,
1927
- ...(b = c.value) == null ? void 0 : b.payload
1928
- };
1929
- }), ie = (l) => {
1930
- switch (h.value) {
1931
- case q.TRADITIONAL: {
1932
- if (!("regex_priority" in l && "path_handling" in l))
1933
- return !1;
1934
- break;
1935
- }
1936
- case q.EXPRESSIONS: {
1937
- if (!("priority" in l))
1938
- return !1;
1939
- break;
1940
- }
1941
- }
1942
- return "service" in l && "tags" in l && "protocols" in l;
1943
- }, de = async (l) => {
1944
- var b;
1945
- const n = l && ie(l) ? l : me.value;
1946
- try {
1947
- r.isReadonly = !0;
1948
- let R;
1949
- E.value === "create" ? R = await y.post(ue.value, n) : E.value === "edit" && (R = ((b = o.config) == null ? void 0 : b.app) === "konnect" ? await y.put(ue.value, n) : await y.patch(ue.value, n)), ge(R == null ? void 0 : R.data), a("update", R == null ? void 0 : R.data);
1950
- } catch (R) {
1951
- r.errorMessage = D(R), a("error", R);
1952
- } finally {
1953
- r.isReadonly = !1;
1954
- }
1955
- }, {
1956
- debouncedQueryChange: ye,
1957
- loading: He,
1958
- error: Ve,
1959
- loadItems: we,
1960
- results: Me
1961
- } = pt(o.config, Te.form[o.config.app].services, void 0, {
1962
- fetchedItemsKey: "data",
1963
- searchKeys: ["id", "name"]
1964
- }), $e = w(() => Ve.value ? g("errors.services.fetch") : ""), Oe = w(() => {
1965
- var l;
1966
- return (l = Me.value) == null ? void 0 : l.map((n) => ({ label: n.id, name: n.name, value: n.id }));
1967
- });
1968
- return Ze(async () => {
1969
- !o.hideServiceField && !o.serviceId ? await we() : r.fields.service_id = o.serviceId;
1970
- }), Ye(() => {
1971
- a("model-updated", me.value);
1972
- }), C({ saveFormData: de, payload: me }), it("configType", v), (l, n) => {
1973
- const b = N("KInput"), R = N("KSelect");
1974
- return m(), k("div", Bo, [
1975
- d(t(ft), {
1976
- "can-submit": $.value && fe.value,
1977
- config: e.config,
1978
- "edit-id": e.routeId,
1979
- "entity-type": t(et).Route,
1980
- "error-message": r.errorMessage || $e.value,
1981
- "fetch-url": _.value,
1982
- "form-fields": me.value,
1983
- "is-readonly": r.isReadonly,
1984
- onCancel: T,
1985
- "onFetch:error": Ae,
1986
- "onFetch:success": ge,
1987
- onLoading: K,
1988
- onSubmit: de
1989
- }, {
1990
- "form-actions": u(() => [
1991
- Le(l.$slots, "form-actions", {
1992
- canSubmit: $.value && fe.value,
1993
- cancel: T,
1994
- submit: de
1995
- }, void 0, !0)
1996
- ]),
1997
- default: u(() => [
1998
- d(t(We), {
1999
- description: t(g)("form.sections.general.description"),
2000
- "hide-info-header": e.hideSectionsInfo,
2001
- title: t(g)("form.sections.general.title")
2002
- }, {
2003
- default: u(() => [
2004
- e.hideNameField ? P("", !0) : (m(), x(b, {
2005
- key: 0,
2006
- modelValue: r.fields.name,
2007
- "onUpdate:modelValue": n[0] || (n[0] = (I) => r.fields.name = I),
2008
- modelModifiers: { trim: !0 },
2009
- autocomplete: "off",
2010
- "data-testid": "route-form-name",
2011
- label: t(g)("form.fields.name.label"),
2012
- placeholder: t(g)("form.fields.name.placeholder"),
2013
- readonly: r.isReadonly,
2014
- type: "text"
2015
- }, null, 8, ["modelValue", "label", "placeholder", "readonly"])),
2016
- !e.hideServiceField && !e.serviceId ? (m(), k("div", Go, [
2017
- d(R, {
2018
- modelValue: r.fields.service_id,
2019
- "onUpdate:modelValue": n[1] || (n[1] = (I) => r.fields.service_id = I),
2020
- clearable: "",
2021
- "data-testid": "route-form-service-id",
2022
- "enable-filtering": "",
2023
- "filter-function": () => !0,
2024
- items: Oe.value,
2025
- label: t(g)("form.fields.service_id.label"),
2026
- loading: t(He),
2027
- placeholder: t(g)("form.fields.service_id.placeholder"),
2028
- readonly: r.isReadonly,
2029
- "reuse-item-template": "",
2030
- width: "100%",
2031
- onQueryChange: t(ye)
2032
- }, {
2033
- loading: u(() => [
2034
- V("div", null, H(t(g)("actions.loading")), 1)
2035
- ]),
2036
- empty: u(() => [
2037
- V("div", Wo, H(t(g)("search.no_results")), 1)
2038
- ]),
2039
- "selected-item-template": u(({ item: I }) => [
2040
- U(H(F(I)), 1)
2041
- ]),
2042
- "item-template": u(({ item: I }) => [
2043
- V("div", jo, [
2044
- V("span", Xo, H(I.name), 1),
2045
- V("span", zo, H(I.value), 1)
2046
- ])
2047
- ]),
2048
- _: 1
2049
- }, 8, ["modelValue", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"])
2050
- ])) : P("", !0),
2051
- d(b, {
2052
- modelValue: r.fields.tags,
2053
- "onUpdate:modelValue": n[2] || (n[2] = (I) => r.fields.tags = I),
2054
- modelModifiers: { trim: !0 },
2055
- autocomplete: "off",
2056
- "data-testid": "route-form-tags",
2057
- help: t(g)("form.fields.tags.help"),
2058
- label: t(g)("form.fields.tags.label"),
2059
- placeholder: t(g)("form.fields.tags.placeholder"),
2060
- readonly: r.isReadonly,
2061
- type: "text"
2062
- }, null, 8, ["modelValue", "help", "label", "placeholder", "readonly"])
2063
- ]),
2064
- _: 1
2065
- }, 8, ["description", "hide-info-header", "title"]),
2066
- d(t(We), {
2067
- description: t(g)("form.sections.config.description"),
2068
- "hide-info-header": e.hideSectionsInfo,
2069
- title: t(g)("form.sections.config.title")
2070
- }, {
2071
- default: u(() => [
2072
- d(Ko, {
2073
- "config-flavor": i.value,
2074
- "onUpdate:configFlavor": n[3] || (n[3] = (I) => i.value = I),
2075
- "config-type": v.value,
2076
- "onUpdate:configType": n[4] || (n[4] = (I) => v.value = I),
2077
- "custom-methods": S.value,
2078
- "onUpdate:customMethods": n[5] || (n[5] = (I) => S.value = I),
2079
- fields: r.fields,
2080
- "onUpdate:fields": n[6] || (n[6] = (I) => r.fields = I),
2081
- "is-ws-supported": t(j),
2082
- protocols: r.fields.protocols,
2083
- readonly: r.isReadonly,
2084
- "record-flavor": A.value,
2085
- "route-flavors": e.routeFlavors,
2086
- "show-expressions-modal-entry": e.showExpressionsModalEntry,
2087
- tooltips: e.configTabTooltips,
2088
- onNotify: n[7] || (n[7] = (I) => a("notify", I)),
2089
- "onUpdate:payload": n[8] || (n[8] = (I) => c.value = I),
2090
- "onUpdate:protocols": n[9] || (n[9] = (I) => r.fields.protocols = I)
2091
- }, null, 8, ["config-flavor", "config-type", "custom-methods", "fields", "is-ws-supported", "protocols", "readonly", "record-flavor", "route-flavors", "show-expressions-modal-entry", "tooltips"])
2092
- ]),
2093
- _: 1
2094
- }, 8, ["description", "hide-info-header", "title"])
2095
- ]),
2096
- _: 3
2097
- }, 8, ["can-submit", "config", "edit-id", "entity-type", "error-message", "fetch-url", "form-fields", "is-readonly"])
2098
- ]);
2099
- };
2100
- }
2101
- }), ps = /* @__PURE__ */ Z(Jo, [["__scopeId", "data-v-5be17e8c"]]), Qo = { class: "kong-ui-entities-routes-list" }, Yo = { class: "button-row" }, Zo = { key: 1 }, es = { key: 1 }, ts = { key: 1 }, os = { class: "route-list-cell-expression" }, ss = /* @__PURE__ */ z({
2102
- __name: "RouteList",
2103
- props: {
2104
- /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
2105
- config: {
2106
- type: Object,
2107
- required: !0,
2108
- validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || !e.createRoute || !e.getViewRoute || !e.getEditRoute || e.app === "kongManager" && !e.isExactMatch && !e.filterSchema)
2109
- },
2110
- // used to override the default identifier for the cache entry
2111
- cacheIdentifier: {
2112
- type: String,
2113
- default: ""
2114
- },
2115
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
2116
- canCreate: {
2117
- type: Function,
2118
- required: !1,
2119
- default: async () => !0
2120
- },
2121
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
2122
- canDelete: {
2123
- type: Function,
2124
- required: !1,
2125
- default: async () => !0
2126
- },
2127
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
2128
- canEdit: {
2129
- type: Function,
2130
- required: !1,
2131
- default: async () => !0
2132
- },
2133
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
2134
- canRetrieve: {
2135
- type: Function,
2136
- required: !1,
2137
- default: async () => !0
2138
- },
2139
- /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can start debugger session on a given entity */
2140
- canDebug: {
2141
- type: Function,
2142
- required: !1,
2143
- default: async () => !1
2144
- },
2145
- title: {
2146
- type: String,
2147
- default: ""
2148
- },
2149
- titleTag: {
2150
- type: String,
2151
- default: "h2"
2152
- },
2153
- /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
2154
- useActionOutside: {
2155
- type: Boolean,
2156
- default: !1
2157
- },
2158
- hideTraditionalColumns: {
2159
- type: Boolean,
2160
- default: !1
2161
- },
2162
- hasExpressionColumn: {
2163
- type: Boolean,
2164
- default: !1
2165
- }
2166
- },
2167
- emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success"],
2168
- setup(e, { emit: C }) {
2169
- var l;
2170
- const f = C, o = e, { i18n: { t: a, formatUnixTimeStamp: v } } = J.useI18n(), i = tt(), { axiosInstance: A } = Fe((l = o.config) == null ? void 0 : l.axiosRequestConfig), { handleStateChange: h, hasRecords: g } = mt(() => M.value), p = w(() => g.value && o.config.app === "konnect"), y = w(() => !!o.config.serviceId), D = w(() => o.config.app !== "kongManager" || !!o.config.disableSorting), F = {
2171
- // the Name column is non-hidable
2172
- name: { label: a("routes.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
2173
- protocols: { label: a("routes.list.table_headers.protocols"), searchable: !0 },
2174
- ...!o.hideTraditionalColumns && {
2175
- hosts: { label: a("routes.list.table_headers.hosts"), searchable: !0 },
2176
- methods: { label: a("routes.list.table_headers.methods"), searchable: !0 },
2177
- paths: { label: a("routes.list.table_headers.paths"), searchable: !0 }
2178
- },
2179
- ...o.hasExpressionColumn && {
2180
- expression: { label: a("routes.list.table_headers.expression"), tooltip: !0 }
2181
- },
2182
- tags: { label: a("routes.list.table_headers.tags"), sortable: !1 },
2183
- updated_at: { label: a("routes.list.table_headers.updated_at"), sortable: !0 },
2184
- created_at: { label: a("routes.list.table_headers.created_at"), sortable: !0 }
2185
- }, r = {
2186
- columnVisibility: {
2187
- created_at: !1
2188
- }
2189
- }, c = F, S = w(() => {
2190
- var b, R, I, te;
2191
- let n = `${o.config.apiBaseUrl}${Te.list[o.config.app][o.config.serviceId ? "forGatewayService" : "all"]}`;
2192
- return o.config.app === "konnect" ? n = n.replace(/{controlPlaneId}/gi, ((b = o.config) == null ? void 0 : b.controlPlaneId) || "").replace(/{serviceId}/gi, ((R = o.config) == null ? void 0 : R.serviceId) || "") : o.config.app === "kongManager" && (n = n.replace(/\/{workspace}/gi, (I = o.config) != null && I.workspace ? `/${o.config.workspace}` : "").replace(/{serviceId}/gi, ((te = o.config) == null ? void 0 : te.serviceId) || "")), n;
2193
- }), M = B(""), le = w(() => {
2194
- const n = o.config.app === "konnect" || o.config.isExactMatch;
2195
- if (n)
2196
- return {
2197
- isExactMatch: n,
2198
- // force exact placeholder if `props.config.isExactMatch` is true
2199
- placeholder: a(`search.placeholder.${o.config.isExactMatch ? "exact" : o.config.app}`)
2200
- };
2201
- const { name: b, protocols: R, hosts: I, methods: te, paths: ae, expression: Q } = F, ce = {
2202
- name: b,
2203
- protocols: R,
2204
- hosts: I,
2205
- methods: te,
2206
- paths: ae,
2207
- ...o.hasExpressionColumn && { expression: Q }
2208
- };
2209
- return {
2210
- isExactMatch: n,
2211
- fields: ce,
2212
- schema: o.config.filterSchema
2213
- };
2214
- }), {
2215
- fetcher: j,
2216
- fetcherState: E,
2217
- fetcherCacheKey: _
2218
- } = vt(w(() => ({ ...o.config, cacheIdentifier: o.cacheIdentifier })), S), T = (n) => n.headerKey === "expression" ? {
2219
- style: {
2220
- maxWidth: "250px",
2221
- overflowX: "hidden",
2222
- textOverflow: "ellipsis"
2223
- }
2224
- } : {}, K = () => {
2225
- M.value = "";
2226
- }, Ae = () => {
2227
- _.value++;
2228
- }, ne = B(null), ee = async (n, b) => {
2229
- if (!await b(n.id)) {
2230
- f("copy:error", {
2231
- entity: n,
2232
- field: "id",
2233
- message: a("errors.copy")
2234
- });
2235
- return;
2236
- }
2237
- f("copy:success", {
2238
- entity: n,
2239
- field: "id",
2240
- message: a("copy.success", { val: n.id })
2241
- });
2242
- }, ge = async (n, b) => {
2243
- const R = JSON.stringify(n);
2244
- if (!await b(R)) {
2245
- f("copy:error", {
2246
- entity: n,
2247
- message: a("errors.copy")
2248
- });
2249
- return;
2250
- }
2251
- f("copy:success", {
2252
- entity: n,
2253
- message: a("copy.success_brief")
2254
- });
2255
- }, $ = async (n) => {
2256
- var R;
2257
- await ((R = o.canRetrieve) == null ? void 0 : R.call(o, n)) && i.push(o.config.getViewRoute(n.id));
2258
- }, fe = (n) => ({
2259
- label: a("actions.view"),
2260
- to: o.config.getViewRoute(n)
2261
- }), ue = (n) => ({
2262
- label: a("actions.edit"),
2263
- to: o.config.getEditRoute(n)
2264
- }), me = (n) => {
2265
- if (o.config.getDebugRoute)
2266
- return {
2267
- label: a("actions.debugger"),
2268
- to: o.config.getDebugRoute(n)
2269
- };
2270
- }, ie = B(void 0), de = B(!1), ye = B(!1), He = B(""), Ve = ht(o.config, S.value), we = (n) => {
2271
- ie.value = n, de.value = !0;
2272
- }, Me = () => {
2273
- de.value = !1;
2274
- }, $e = async () => {
2275
- var n, b, R;
2276
- if ((n = ie.value) != null && n.id) {
2277
- ye.value = !0;
2278
- try {
2279
- await A.delete(Ve(ie.value.id)), ye.value = !1, de.value = !1, _.value++, f("delete:success", ie.value);
2280
- } catch (I) {
2281
- He.value = ((R = (b = I.response) == null ? void 0 : b.data) == null ? void 0 : R.message) || I.message || a("errors.delete"), f("error", I);
2282
- } finally {
2283
- ye.value = !1;
2284
- }
2285
- }
2286
- };
2287
- _e(E, (n) => {
2288
- var b, R, I;
2289
- if (n.status === gt.Error) {
2290
- ne.value = {
2291
- title: a("errors.general")
2292
- }, (I = (R = (b = n.error) == null ? void 0 : b.response) == null ? void 0 : R.data) != null && I.message && (ne.value.message = n.error.response.data.message), f("error", n.error);
2293
- return;
2294
- }
2295
- ne.value = null;
2296
- });
2297
- const Oe = B({
2298
- ctaPath: o.config.createRoute,
2299
- ctaText: void 0,
2300
- message: `${a("routes.list.empty_state.description")}${o.config.additionMessageForEmptyState ? ` ${o.config.additionMessageForEmptyState}` : ""}`,
2301
- title: a("routes.title")
2302
- }), be = B(!1);
2303
- return Ze(async () => {
2304
- be.value = await o.canCreate(), be.value && (Oe.value.title = a("routes.list.empty_state.title"), Oe.value.ctaText = a("actions.create"));
2305
- }), (n, b) => {
2306
- const R = N("KButton"), I = N("KEmptyState"), te = N("KBadge"), ae = N("KTruncate"), Q = N("KDropdownItem"), ce = N("KClipboardProvider");
2307
- return m(), k("div", Qo, [
2308
- d(t(yt), {
2309
- "cache-identifier": e.cacheIdentifier,
2310
- "cell-attributes": T,
2311
- "default-table-preferences": r,
2312
- "disable-sorting": D.value,
2313
- "empty-state-options": Oe.value,
2314
- "enable-entity-actions": "",
2315
- "error-message": ne.value,
2316
- fetcher: t(j),
2317
- "fetcher-cache-key": t(_),
2318
- "pagination-type": "offset",
2319
- "preferences-storage-key": "kong-ui-entities-routes-list",
2320
- query: M.value,
2321
- "table-headers": t(c),
2322
- title: e.title,
2323
- "title-tag": e.titleTag,
2324
- onClearSearchInput: K,
2325
- "onClick:row": b[7] || (b[7] = (O) => $(O)),
2326
- onSort: Ae,
2327
- onState: t(h)
2328
- }, Be({
2329
- "toolbar-filter": u(() => [
2330
- d(t(St), {
2331
- modelValue: M.value,
2332
- "onUpdate:modelValue": b[0] || (b[0] = (O) => M.value = O),
2333
- config: le.value
2334
- }, null, 8, ["modelValue", "config"])
2335
- ]),
2336
- "toolbar-button": u(() => [
2337
- (m(), x(at, {
2338
- disabled: !e.useActionOutside,
2339
- to: "#kong-ui-app-page-header-action-button"
2340
- }, [
2341
- V("div", Yo, [
2342
- !y.value && p.value ? (m(), x(R, {
2343
- key: 0,
2344
- appearance: "secondary",
2345
- class: "open-learning-hub",
2346
- "data-testid": "routes-learn-more-button",
2347
- icon: "",
2348
- onClick: b[1] || (b[1] = (O) => n.$emit("click:learn-more"))
2349
- }, {
2350
- default: u(() => [
2351
- d(t(Xe), { decorative: "" })
2352
- ]),
2353
- _: 1
2354
- })) : P("", !0),
2355
- d(t(ke), {
2356
- "auth-function": () => e.canCreate()
2357
- }, {
2358
- default: u(() => [
2359
- d(R, {
2360
- appearance: "primary",
2361
- "data-testid": "toolbar-add-route",
2362
- size: e.useActionOutside ? "medium" : "large",
2363
- to: e.config.createRoute
2364
- }, {
2365
- default: u(() => [
2366
- d(t(Ue)),
2367
- U(" " + H(t(a)("routes.list.toolbar_actions.new_route")), 1)
2368
- ]),
2369
- _: 1
2370
- }, 8, ["size", "to"])
2371
- ]),
2372
- _: 1
2373
- }, 8, ["auth-function"])
2374
- ])
2375
- ], 8, ["disabled"]))
2376
- ]),
2377
- name: u(({ rowValue: O }) => [
2378
- V("b", null, H(O ?? "-"), 1)
2379
- ]),
2380
- protocols: u(({ rowValue: O }) => [
2381
- d(ae, null, {
2382
- default: u(() => [
2383
- (m(!0), k(G, null, re(O, (L) => (m(), x(te, {
2384
- key: L,
2385
- appearance: "neutral",
2386
- onClick: b[3] || (b[3] = Ne(() => {
2387
- }, ["stop"]))
2388
- }, {
2389
- default: u(() => [
2390
- U(H(L), 1)
2391
- ]),
2392
- _: 2
2393
- }, 1024))), 128))
2394
- ]),
2395
- _: 2
2396
- }, 1024)
2397
- ]),
2398
- hosts: u(({ rowValue: O }) => [
2399
- (O == null ? void 0 : O.length) > 0 ? (m(), x(ae, { key: 0 }, {
2400
- default: u(() => [
2401
- (m(!0), k(G, null, re(O, (L) => (m(), x(te, {
2402
- key: L,
2403
- appearance: "neutral",
2404
- tooltip: L,
2405
- "truncation-tooltip": "",
2406
- onClick: b[4] || (b[4] = Ne(() => {
2407
- }, ["stop"]))
2408
- }, {
2409
- default: u(() => [
2410
- U(H(L), 1)
2411
- ]),
2412
- _: 2
2413
- }, 1032, ["tooltip"]))), 128))
2414
- ]),
2415
- _: 2
2416
- }, 1024)) : (m(), k("span", Zo, "-"))
2417
- ]),
2418
- methods: u(({ rowValue: O }) => [
2419
- (O == null ? void 0 : O.length) > 0 ? (m(), x(ae, { key: 0 }, {
2420
- default: u(() => [
2421
- (m(!0), k(G, null, re(O, (L) => (m(), x(te, {
2422
- key: L,
2423
- appearance: Object.values(t(Ht)).includes(L.toLowerCase()) ? L.toLowerCase() : "custom",
2424
- onClick: b[5] || (b[5] = Ne(() => {
2425
- }, ["stop"]))
2426
- }, {
2427
- default: u(() => [
2428
- U(H(L), 1)
2429
- ]),
2430
- _: 2
2431
- }, 1032, ["appearance"]))), 128))
2432
- ]),
2433
- _: 2
2434
- }, 1024)) : (m(), k("span", es, "-"))
2435
- ]),
2436
- paths: u(({ rowValue: O }) => [
2437
- (O == null ? void 0 : O.length) > 0 ? (m(), x(ae, { key: 0 }, {
2438
- default: u(() => [
2439
- (m(!0), k(G, null, re(O, (L) => (m(), x(te, {
2440
- key: L,
2441
- appearance: "neutral",
2442
- tooltip: L,
2443
- "truncation-tooltip": "",
2444
- onClick: b[6] || (b[6] = Ne(() => {
2445
- }, ["stop"]))
2446
- }, {
2447
- default: u(() => [
2448
- U(H(L), 1)
2449
- ]),
2450
- _: 2
2451
- }, 1032, ["tooltip"]))), 128))
2452
- ]),
2453
- _: 2
2454
- }, 1024)) : (m(), k("span", ts, "-"))
2455
- ]),
2456
- tags: u(({ rowValue: O }) => [
2457
- d(t(bt), { tags: O }, null, 8, ["tags"])
2458
- ]),
2459
- expression: u(({ rowValue: O }) => [
2460
- V("span", os, H(O || "-"), 1)
2461
- ]),
2462
- created_at: u(({ rowValue: O }) => [
2463
- U(H(t(v)(O)), 1)
2464
- ]),
2465
- updated_at: u(({ row: O, rowValue: L }) => [
2466
- U(H(t(v)(L ?? O.created_at)), 1)
2467
- ]),
2468
- actions: u(({ row: O }) => [
2469
- d(ce, null, {
2470
- default: u(({ copyToClipboard: L }) => [
2471
- d(Q, {
2472
- "data-testid": "action-entity-copy-id",
2473
- onClick: (st) => ee(O, L)
2474
- }, {
2475
- default: u(() => [
2476
- U(H(t(a)("actions.copy_id")), 1)
2477
- ]),
2478
- _: 1
2479
- }, 8, ["onClick"])
2480
- ]),
2481
- _: 2
2482
- }, 1024),
2483
- d(ce, null, {
2484
- default: u(({ copyToClipboard: L }) => [
2485
- d(Q, {
2486
- "data-testid": "action-entity-copy-json",
2487
- onClick: (st) => ge(O, L)
2488
- }, {
2489
- default: u(() => [
2490
- U(H(t(a)("actions.copy_json")), 1)
2491
- ]),
2492
- _: 1
2493
- }, 8, ["onClick"])
2494
- ]),
2495
- _: 2
2496
- }, 1024),
2497
- d(t(ke), {
2498
- "auth-function": () => e.canRetrieve(O)
2499
- }, {
2500
- default: u(() => [
2501
- d(Q, {
2502
- "data-testid": "action-entity-view",
2503
- "has-divider": "",
2504
- item: fe(O.id)
2505
- }, null, 8, ["item"])
2506
- ]),
2507
- _: 2
2508
- }, 1032, ["auth-function"]),
2509
- d(t(ke), {
2510
- "auth-function": () => e.canDebug(O)
2511
- }, {
2512
- default: u(() => [
2513
- e.config.getDebugRoute ? (m(), x(Q, {
2514
- key: 0,
2515
- "data-testid": "action-entity-debug",
2516
- item: me(O.id)
2517
- }, null, 8, ["item"])) : P("", !0)
2518
- ]),
2519
- _: 2
2520
- }, 1032, ["auth-function"]),
2521
- d(t(ke), {
2522
- "auth-function": () => e.canEdit(O)
2523
- }, {
2524
- default: u(() => [
2525
- d(Q, {
2526
- "data-testid": "action-entity-edit",
2527
- item: ue(O.id)
2528
- }, null, 8, ["item"])
2529
- ]),
2530
- _: 2
2531
- }, 1032, ["auth-function"]),
2532
- d(t(ke), {
2533
- "auth-function": () => e.canDelete(O)
2534
- }, {
2535
- default: u(() => [
2536
- d(Q, {
2537
- danger: "",
2538
- "data-testid": "action-entity-delete",
2539
- "has-divider": "",
2540
- onClick: (L) => we(O)
2541
- }, {
2542
- default: u(() => [
2543
- U(H(t(a)("actions.delete")), 1)
2544
- ]),
2545
- _: 1
2546
- }, 8, ["onClick"])
2547
- ]),
2548
- _: 2
2549
- }, 1032, ["auth-function"])
2550
- ]),
2551
- _: 2
2552
- }, [
2553
- !M.value && e.config.app === "konnect" ? {
2554
- name: "empty-state",
2555
- fn: u(() => {
2556
- var O;
2557
- return [
2558
- d(I, {
2559
- "data-testid": e.config.serviceId ? "nested-routes-entity-empty-state" : "routes-entity-empty-state",
2560
- "icon-background": "",
2561
- message: t(a)("routes.list.empty_state_v2.description"),
2562
- title: t(a)("routes.list.empty_state_v2.title")
2563
- }, Be({
2564
- icon: u(() => [
2565
- d(t(kt), { decorative: "" })
2566
- ]),
2567
- action: u(() => [
2568
- be.value ? (m(), x(R, {
2569
- key: 0,
2570
- "data-testid": "entity-create-button",
2571
- to: e.config.createRoute
2572
- }, {
2573
- default: u(() => [
2574
- d(t(Ue), { decorative: "" }),
2575
- U(" " + H(t(a)("routes.list.toolbar_actions.new_route")), 1)
2576
- ]),
2577
- _: 1
2578
- }, 8, ["to"])) : P("", !0),
2579
- d(R, {
2580
- appearance: "secondary",
2581
- "data-testid": "entity-learn-more-button",
2582
- onClick: b[2] || (b[2] = (L) => n.$emit("click:learn-more"))
2583
- }, {
2584
- default: u(() => [
2585
- d(t(Xe), { decorative: "" }),
2586
- U(" " + H(t(a)("routes.list.empty_state_v2.learn_more")), 1)
2587
- ]),
2588
- _: 1
2589
- })
2590
- ]),
2591
- _: 2
2592
- }, [
2593
- (O = e.config) != null && O.isControlPlaneGroup ? {
2594
- name: "default",
2595
- fn: u(() => [
2596
- U(H(t(a)("routes.list.empty_state_v2.group")), 1)
2597
- ]),
2598
- key: "0"
2599
- } : void 0
2600
- ]), 1032, ["data-testid", "message", "title"])
2601
- ];
2602
- }),
2603
- key: "0"
2604
- } : void 0
2605
- ]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers", "title", "title-tag", "onState"]),
2606
- d(t(_t), {
2607
- "action-pending": ye.value,
2608
- description: t(a)("delete.description"),
2609
- "entity-name": ie.value && (ie.value.name || ie.value.id),
2610
- "entity-type": t(Tt).Route,
2611
- error: He.value,
2612
- title: t(a)("delete.title"),
2613
- visible: de.value,
2614
- onCancel: Me,
2615
- onProceed: $e
2616
- }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
2617
- ]);
2618
- };
2619
- }
2620
- }), fs = /* @__PURE__ */ Z(ss, [["__scopeId", "data-v-a438ef1a"]]);
2621
- export {
2622
- Se as E,
2623
- ot as H,
2624
- W as I,
2625
- Ie as M,
2626
- Pe as P,
2627
- ps as R,
2628
- cs as _,
2629
- Ko as a,
2630
- fs as b,
2631
- J as c,
2632
- Lt as d,
2633
- xe as e,
2634
- Ft as f,
2635
- q as g,
2636
- s as h,
2637
- Je as i,
2638
- qo as j,
2639
- ze as s
2640
- };