@cobaltcore-dev/aurora 1.1.0 → 1.2.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 (183) hide show
  1. package/README.md +59 -9
  2. package/dist/client/App.d.ts +2 -2
  3. package/dist/client/AuroraApp.d.ts +33 -13
  4. package/dist/client/{AuthProvider-BS5OVv8n.mjs → AuthProvider-CVSAwW9f.mjs} +22 -8
  5. package/dist/client/AuthProvider-CVSAwW9f.mjs.map +1 -0
  6. package/dist/client/{ContentHeader-BHMUzd9H.mjs → ContentHeader-CPJbgYWn.mjs} +18 -18
  7. package/dist/client/{ContentHeader-BHMUzd9H.mjs.map → ContentHeader-CPJbgYWn.mjs.map} +1 -1
  8. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs +773 -0
  9. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs.map +1 -0
  10. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs +26 -0
  11. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs.map +1 -0
  12. package/dist/client/{FiltersInput-B8CNBg1L.mjs → FiltersInput-CKI6zWnm.mjs} +18 -18
  13. package/dist/client/{FiltersInput-B8CNBg1L.mjs.map → FiltersInput-CKI6zWnm.mjs.map} +1 -1
  14. package/dist/client/FloatingIpActionModals-CwEC5GR-.mjs +460 -0
  15. package/dist/client/FloatingIpActionModals-CwEC5GR-.mjs.map +1 -0
  16. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs +1152 -0
  17. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs.map +1 -0
  18. package/dist/client/SortInput-4g7nSTHW.mjs +34 -0
  19. package/dist/client/SortInput-4g7nSTHW.mjs.map +1 -0
  20. package/dist/client/{TwoColumnDescriptionList-DiDx3PnH.mjs → TwoColumnDescriptionList-NvgvErua.mjs} +2 -2
  21. package/dist/client/{TwoColumnDescriptionList-DiDx3PnH.mjs.map → TwoColumnDescriptionList-NvgvErua.mjs.map} +1 -1
  22. package/dist/client/_-CAsCx-Ay.mjs +6 -0
  23. package/dist/client/_-CAsCx-Ay.mjs.map +1 -0
  24. package/dist/client/_auth-SrDjHL6j.mjs +12 -0
  25. package/dist/client/_auth-SrDjHL6j.mjs.map +1 -0
  26. package/dist/client/_flavorId-9PcBBW52.mjs +231 -0
  27. package/dist/client/_flavorId-9PcBBW52.mjs.map +1 -0
  28. package/dist/client/{_flavorId-BN_qessZ.mjs → _flavorId-a9Gu66R1.mjs} +3 -9
  29. package/dist/client/_flavorId-a9Gu66R1.mjs.map +1 -0
  30. package/dist/client/_floatingIpId-AE9Fu8l6.mjs +210 -0
  31. package/dist/client/_floatingIpId-AE9Fu8l6.mjs.map +1 -0
  32. package/dist/client/{_floatingIpId-CwDGHkWm.mjs → _floatingIpId-AZ11Ksmu.mjs} +3 -9
  33. package/dist/client/_floatingIpId-AZ11Ksmu.mjs.map +1 -0
  34. package/dist/client/{_imageId-BtJ7GmYB.mjs → _imageId-BtAql2Kr.mjs} +104 -92
  35. package/dist/client/_imageId-BtAql2Kr.mjs.map +1 -0
  36. package/dist/client/_imageId-D76BxvFY.mjs +39 -0
  37. package/dist/client/_imageId-D76BxvFY.mjs.map +1 -0
  38. package/dist/client/{_projectId-Byt3GQDW.mjs → _projectId-7Nl1MQTJ.mjs} +5 -5
  39. package/dist/client/_projectId-7Nl1MQTJ.mjs.map +1 -0
  40. package/dist/client/_projectId-B3wmSala.mjs +281 -0
  41. package/dist/client/_projectId-B3wmSala.mjs.map +1 -0
  42. package/dist/client/_projectId-DPzv0CCp.mjs +77 -0
  43. package/dist/client/_projectId-DPzv0CCp.mjs.map +1 -0
  44. package/dist/client/_projectId-DfeVJy0G.mjs +30 -0
  45. package/dist/client/_projectId-DfeVJy0G.mjs.map +1 -0
  46. package/dist/client/_securityGroupId-C5huJNfO.mjs +1810 -0
  47. package/dist/client/_securityGroupId-C5huJNfO.mjs.map +1 -0
  48. package/dist/client/{_securityGroupId-BcbkRhsN.mjs → _securityGroupId-D85mSigA.mjs} +3 -9
  49. package/dist/client/_securityGroupId-D85mSigA.mjs.map +1 -0
  50. package/dist/client/_serviceType-DS8DxsrP.mjs +20 -0
  51. package/dist/client/_serviceType-DS8DxsrP.mjs.map +1 -0
  52. package/dist/client/_serviceType-M8d9rOT6.mjs +6 -0
  53. package/dist/client/_serviceType-M8d9rOT6.mjs.map +1 -0
  54. package/dist/client/_storageType-BRWWJtow.mjs +14 -0
  55. package/dist/client/_storageType-BRWWJtow.mjs.map +1 -0
  56. package/dist/client/_storageType-CzZ4u9x_.mjs +12 -0
  57. package/dist/client/_storageType-CzZ4u9x_.mjs.map +1 -0
  58. package/dist/client/_storageType-Dy9uCVXr.mjs +845 -0
  59. package/dist/client/_storageType-Dy9uCVXr.mjs.map +1 -0
  60. package/dist/client/_storageType-zeSZe--V.mjs.map +1 -1
  61. package/dist/client/{about-_73VmpTB.mjs → about-BmQTyLWc.mjs} +2 -2
  62. package/dist/client/{about-_73VmpTB.mjs.map → about-BmQTyLWc.mjs.map} +1 -1
  63. package/dist/client/{aurora-EbwGRLLf.mjs → aurora-CIml-f2f.mjs} +2 -2
  64. package/dist/client/{aurora-EbwGRLLf.mjs.map → aurora-CIml-f2f.mjs.map} +1 -1
  65. package/dist/client/{build-C_4vRMCq.mjs → build-WuxXRAqf.mjs} +121 -24
  66. package/dist/client/{build-C_4vRMCq.mjs.map → build-WuxXRAqf.mjs.map} +1 -1
  67. package/dist/client/components/Breadcrumbs.d.ts +1 -0
  68. package/dist/client/components/ListToolbar/SortInput.d.ts +3 -0
  69. package/dist/client/context/BreadcrumbExtensionContext.d.ts +9 -0
  70. package/dist/client/context/DynamicBreadcrumbContext.d.ts +9 -0
  71. package/dist/client/{flavors-CiHCYrtZ.mjs → flavors-B0rbqffG.mjs} +3 -5
  72. package/dist/client/flavors-B0rbqffG.mjs.map +1 -0
  73. package/dist/client/flavors-DWMZ6TuJ.mjs.map +1 -1
  74. package/dist/client/flavors-Rl20bxVU.mjs +628 -0
  75. package/dist/client/flavors-Rl20bxVU.mjs.map +1 -0
  76. package/dist/client/floatingips-Cz9k80cc.mjs +8 -0
  77. package/dist/client/floatingips-Cz9k80cc.mjs.map +1 -0
  78. package/dist/client/floatingips-xbO_mu4f.mjs +576 -0
  79. package/dist/client/floatingips-xbO_mu4f.mjs.map +1 -0
  80. package/dist/client/hooks/useBreadcrumbs.d.ts +16 -0
  81. package/dist/client/hooks/usePushBreadcrumbs.d.ts +10 -0
  82. package/dist/client/hooks/useSetBreadcrumb.d.ts +11 -0
  83. package/dist/client/{hooks-LutR2Yg3.mjs → hooks-D0yKIumu.mjs} +2 -2
  84. package/dist/client/{hooks-LutR2Yg3.mjs.map → hooks-D0yKIumu.mjs.map} +1 -1
  85. package/dist/client/images-BGQv9kKT.mjs +1983 -0
  86. package/dist/client/images-BGQv9kKT.mjs.map +1 -0
  87. package/dist/client/{images-CS4kZQyu.mjs → images-CPmMa4SQ.mjs} +3 -5
  88. package/dist/client/images-CPmMa4SQ.mjs.map +1 -0
  89. package/dist/client/images-NBf2bV43.mjs.map +1 -1
  90. package/dist/client/index.d.ts +7 -3
  91. package/dist/client/index.js +549 -535
  92. package/dist/client/index.js.map +1 -1
  93. package/dist/client/{objects-C3azvW8m.mjs → objects-BE_u5yRt.mjs} +7087 -4211
  94. package/dist/client/objects-BE_u5yRt.mjs.map +1 -0
  95. package/dist/client/objects-BN-59Th0.mjs +66 -0
  96. package/dist/client/objects-BN-59Th0.mjs.map +1 -0
  97. package/dist/client/objects-D9Luf9KB.mjs +66 -0
  98. package/dist/client/objects-D9Luf9KB.mjs.map +1 -0
  99. package/dist/client/projects-yiK0HGSA.mjs.map +1 -1
  100. package/dist/client/routeInfo-DP3v74Wg.mjs +19 -0
  101. package/dist/client/routeInfo-DP3v74Wg.mjs.map +1 -0
  102. package/dist/client/router.d.ts +2 -2
  103. package/dist/client/{routes-CdDm-hhO.mjs → routes-CJj7SR_K.mjs} +2 -2
  104. package/dist/client/routes-CJj7SR_K.mjs.map +1 -0
  105. package/dist/client/routes-xofA3ksU.mjs +110 -0
  106. package/dist/client/routes-xofA3ksU.mjs.map +1 -0
  107. package/dist/client/securitygroups-BjhgLBHm.mjs +620 -0
  108. package/dist/client/securitygroups-BjhgLBHm.mjs.map +1 -0
  109. package/dist/client/securitygroups-CtKne8UQ.mjs +8 -0
  110. package/dist/client/securitygroups-CtKne8UQ.mjs.map +1 -0
  111. package/dist/client/{securitygroups-Byte-iSp.mjs → securitygroups-DEJQBcxm.mjs} +3 -5
  112. package/dist/client/securitygroups-DEJQBcxm.mjs.map +1 -0
  113. package/dist/client/trpcClient.d.ts +135 -3
  114. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs +54 -0
  115. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs.map +1 -0
  116. package/dist/client/useModalTracking-BcOKTYRN.mjs +33 -0
  117. package/dist/client/useModalTracking-BcOKTYRN.mjs.map +1 -0
  118. package/dist/client/{useSecurityGroupPermissions-C29mzb3b.mjs → useSecurityGroupPermissions-BOyLQLdC.mjs} +85 -19
  119. package/dist/client/useSecurityGroupPermissions-BOyLQLdC.mjs.map +1 -0
  120. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs +19 -0
  121. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs.map +1 -0
  122. package/dist/client/utils/formatSwiftDate.d.ts +30 -0
  123. package/dist/server/index.d.ts +136 -4
  124. package/dist/server/index.js +845 -260
  125. package/package.json +37 -36
  126. package/dist/client/AuthProvider-BS5OVv8n.mjs.map +0 -1
  127. package/dist/client/DeleteFlavorModal-BP83t9zX.mjs +0 -721
  128. package/dist/client/DeleteFlavorModal-BP83t9zX.mjs.map +0 -1
  129. package/dist/client/FloatingIpActionModals-BraiJWBi.mjs +0 -417
  130. package/dist/client/FloatingIpActionModals-BraiJWBi.mjs.map +0 -1
  131. package/dist/client/ImageToastNotifications-BXMHJaIH.mjs +0 -1131
  132. package/dist/client/ImageToastNotifications-BXMHJaIH.mjs.map +0 -1
  133. package/dist/client/RouteError-hAF8_jbe.mjs +0 -25
  134. package/dist/client/RouteError-hAF8_jbe.mjs.map +0 -1
  135. package/dist/client/SortInput-Cqs2poV3.mjs +0 -34
  136. package/dist/client/SortInput-Cqs2poV3.mjs.map +0 -1
  137. package/dist/client/StatusError-C5KodQOq.mjs +0 -39
  138. package/dist/client/StatusError-C5KodQOq.mjs.map +0 -1
  139. package/dist/client/_auth-DJ9wHZaj.mjs +0 -11
  140. package/dist/client/_auth-DJ9wHZaj.mjs.map +0 -1
  141. package/dist/client/_flavorId-BN_qessZ.mjs.map +0 -1
  142. package/dist/client/_flavorId-CJjEB_Ao.mjs +0 -210
  143. package/dist/client/_flavorId-CJjEB_Ao.mjs.map +0 -1
  144. package/dist/client/_floatingIpId-CwDGHkWm.mjs.map +0 -1
  145. package/dist/client/_floatingIpId-foMIwbE4.mjs +0 -215
  146. package/dist/client/_floatingIpId-foMIwbE4.mjs.map +0 -1
  147. package/dist/client/_imageId-BtJ7GmYB.mjs.map +0 -1
  148. package/dist/client/_projectId-BmtCuzJu.mjs +0 -29
  149. package/dist/client/_projectId-BmtCuzJu.mjs.map +0 -1
  150. package/dist/client/_projectId-Byt3GQDW.mjs.map +0 -1
  151. package/dist/client/_projectId-NYk1IN_a.mjs +0 -291
  152. package/dist/client/_projectId-NYk1IN_a.mjs.map +0 -1
  153. package/dist/client/_projectId-QueiFczy.mjs +0 -46
  154. package/dist/client/_projectId-QueiFczy.mjs.map +0 -1
  155. package/dist/client/_securityGroupId-BcbkRhsN.mjs.map +0 -1
  156. package/dist/client/_securityGroupId-pPtJsCoe.mjs +0 -1797
  157. package/dist/client/_securityGroupId-pPtJsCoe.mjs.map +0 -1
  158. package/dist/client/_storageType-BmqrU06i.mjs +0 -2202
  159. package/dist/client/_storageType-BmqrU06i.mjs.map +0 -1
  160. package/dist/client/components/Error/StatusError.d.ts +0 -11
  161. package/dist/client/components/ProjectView/ProjectInfoBox.d.ts +0 -12
  162. package/dist/client/flavors-CiHCYrtZ.mjs.map +0 -1
  163. package/dist/client/flavors-DY-bDc8l.mjs +0 -650
  164. package/dist/client/flavors-DY-bDc8l.mjs.map +0 -1
  165. package/dist/client/floatingips-Ci4jHkaG.mjs +0 -591
  166. package/dist/client/floatingips-Ci4jHkaG.mjs.map +0 -1
  167. package/dist/client/images-91U7tr9Y2.mjs +0 -1976
  168. package/dist/client/images-91U7tr9Y2.mjs.map +0 -1
  169. package/dist/client/images-CS4kZQyu.mjs.map +0 -1
  170. package/dist/client/objects-C3azvW8m.mjs.map +0 -1
  171. package/dist/client/objects-CM265S6b.mjs +0 -56
  172. package/dist/client/objects-CM265S6b.mjs.map +0 -1
  173. package/dist/client/objects-EE9Cd1wI.mjs +0 -56
  174. package/dist/client/objects-EE9Cd1wI.mjs.map +0 -1
  175. package/dist/client/routeInfo-DXqB2HCf.mjs +0 -32
  176. package/dist/client/routeInfo-DXqB2HCf.mjs.map +0 -1
  177. package/dist/client/routes-CBd8CCuM.mjs +0 -115
  178. package/dist/client/routes-CBd8CCuM.mjs.map +0 -1
  179. package/dist/client/routes-CdDm-hhO.mjs.map +0 -1
  180. package/dist/client/securitygroups-Bd_uV4S9.mjs +0 -595
  181. package/dist/client/securitygroups-Bd_uV4S9.mjs.map +0 -1
  182. package/dist/client/securitygroups-Byte-iSp.mjs.map +0 -1
  183. package/dist/client/useSecurityGroupPermissions-C29mzb3b.mjs.map +0 -1
@@ -1,1797 +0,0 @@
1
- import { A as e, C as t, F as n, I as r, J as i, L as a, N as o, O as s, Q as c, S as l, T as u, W as d, X as f, a as p, g as m, h, j as g, l as _, m as v, nt as y, o as b, p as x, q as S, st as C, t as w, tt as T, ut as E, v as D, x as O } from "./build-C_4vRMCq.mjs";
2
- import { a as k } from "./trpcClient-D7gpR7YG.mjs";
3
- import { t as A } from "./_securityGroupId-BcbkRhsN.mjs";
4
- import { t as j } from "./useProjectId-DBc5lpoU.mjs";
5
- import { t as M } from "./SortInput-Cqs2poV3.mjs";
6
- import "./hooks-LutR2Yg3.mjs";
7
- import { t as N } from "./TwoColumnDescriptionList-DiDx3PnH.mjs";
8
- import { t as P } from "./useModal-DCs1OJh7.mjs";
9
- import { n as F, t as I } from "./FiltersInput-B8CNBg1L.mjs";
10
- import { n as L, t as ee } from "./useSecurityGroupPermissions-C29mzb3b.mjs";
11
- import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
12
- import { startTransition as V, useEffect as H, useMemo as U, useRef as W, useState as G } from "react";
13
- import { useNavigate as K } from "@tanstack/react-router";
14
- import { Trans as q, useLingui as J } from "@lingui/react";
15
- import { z as Y } from "zod";
16
- import { useForm as X, useStore as Z } from "@tanstack/react-form";
17
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupHeader.tsx
18
- function te({ name: e, id: t }) {
19
- return /*#__PURE__*/ B("div", {
20
- className: "mb-2",
21
- children: [/*#__PURE__*/ z(y, { children: `'${e || t}' Details` }), /*#__PURE__*/ z("p", {
22
- className: "text-theme-secondary mt-2 text-sm",
23
- children: /*#__PURE__*/ z(q, { id: "kIuDMT" })
24
- })]
25
- });
26
- }
27
- //#endregion
28
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupBasicInfo.tsx
29
- function Q({ securityGroup: e, onEdit: t, canUpdate: n }) {
30
- let { i18n: r, _: i } = J(), a = [
31
- {
32
- label: r._({ id: "Nu4oKW" }),
33
- value: e.description || r._({ id: "h47p9L" })
34
- },
35
- {
36
- label: r._({ id: "S0kLOH" }),
37
- value: e.id
38
- },
39
- {
40
- label: r._({ id: "OYHzN1" }),
41
- value: e.tags?.join(", ") || r._({ id: "h47p9L" })
42
- },
43
- {
44
- label: r._({ id: "6YtxFj" }),
45
- value: e.name || r._({ id: "h47p9L" })
46
- },
47
- {
48
- label: r._({ id: "Jim5X9" }),
49
- value: e.stateful ? r._({ id: "l75CjT" }) : r._({ id: "1UzENP" })
50
- },
51
- {
52
- label: r._({ id: "aI8Tgp" }),
53
- value: e.project_id || r._({ id: "h47p9L" })
54
- },
55
- {
56
- label: r._({ id: "0Gd0NU" }),
57
- value: e.shared ? r._({ id: "l75CjT" }) : r._({ id: "1UzENP" })
58
- }
59
- ];
60
- return /*#__PURE__*/ B(R, { children: [/*#__PURE__*/ z("div", {
61
- className: "mb-4 flex flex-row-reverse",
62
- children: t && n && /*#__PURE__*/ z(p, {
63
- variant: "primary",
64
- onClick: t,
65
- disabled: !n,
66
- children: /*#__PURE__*/ z(q, { id: "ePK91l" })
67
- })
68
- }), /*#__PURE__*/ z(N, { items: a })] });
69
- }
70
- //#endregion
71
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupTabs.tsx
72
- function $({ activeTab: e, onTabChange: t, showRBACTab: n = !0 }) {
73
- let r = (t) => `px-6 py-3 font-semibold border-b-2 transition-colors ${e === t ? "border-theme-accent text-theme-highest" : "border-transparent text-theme-secondary hover:text-theme-high"}`;
74
- return /*#__PURE__*/ z("div", {
75
- className: "border-theme-background-lvl-3 mt-1 border-b",
76
- children: /*#__PURE__*/ B(f, {
77
- direction: "horizontal",
78
- gap: "0",
79
- children: [/*#__PURE__*/ z("button", {
80
- className: r("rules"),
81
- onClick: () => t("rules"),
82
- children: /*#__PURE__*/ z(q, { id: "4EZrJN" })
83
- }), n && /*#__PURE__*/ z("button", {
84
- className: r("rbac"),
85
- onClick: () => t("rbac"),
86
- children: /*#__PURE__*/ z(q, { id: "/eFtWI" })
87
- })]
88
- })
89
- });
90
- }
91
- //#endregion
92
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/DeleteRuleDialog.tsx
93
- function ne({ rule: e, open: t, onClose: r, onConfirm: a, isLoading: s, error: c }) {
94
- let { i18n: l, _: u } = J(), [d, f] = G(""), m = () => {
95
- e && d === "delete" && a(e.id);
96
- }, h = () => {
97
- f(""), r();
98
- }, _ = d !== "delete" || s;
99
- return e ? /*#__PURE__*/ z(i, {
100
- open: t,
101
- onCancel: h,
102
- size: "small",
103
- title: l._({ id: "TM93nK" }),
104
- modalFooter: /*#__PURE__*/ z(o, {
105
- className: "flex justify-end",
106
- children: /*#__PURE__*/ B(g, { children: [/*#__PURE__*/ z(p, {
107
- variant: "default",
108
- onClick: h,
109
- disabled: s,
110
- children: /*#__PURE__*/ z(q, { id: "dEgA5A" })
111
- }), /*#__PURE__*/ z(p, {
112
- variant: "primary-danger",
113
- onClick: m,
114
- disabled: _,
115
- "data-testid": "confirm-delete-rule-button",
116
- children: s ? /*#__PURE__*/ z(q, { id: "EF2EU9" }) : /*#__PURE__*/ z(q, { id: "lN3xvy" })
117
- })] })
118
- }),
119
- children: /*#__PURE__*/ B("div", { children: [
120
- c && /*#__PURE__*/ z(n, {
121
- dismissible: !1,
122
- variant: "error",
123
- className: "mt-4",
124
- children: c
125
- }),
126
- /*#__PURE__*/ z(q, { id: "CMVP7y" }),
127
- /*#__PURE__*/ B("div", {
128
- className: "bg-theme-background-lvl-1 mt-4 mb-4 rounded p-4",
129
- children: [/*#__PURE__*/ z("p", {
130
- className: "mb-2 font-semibold",
131
- children: /*#__PURE__*/ z(q, { id: "uly9ET" })
132
- }), /*#__PURE__*/ B("ul", {
133
- className: "list-inside list-disc space-y-1 text-sm",
134
- children: [
135
- /*#__PURE__*/ B("li", { children: [
136
- /*#__PURE__*/ z(q, { id: "MRB7nI" }),
137
- ": ",
138
- e.direction
139
- ] }),
140
- e.description && /*#__PURE__*/ B("li", { children: [
141
- /*#__PURE__*/ z(q, { id: "Nu4oKW" }),
142
- ": ",
143
- e.description
144
- ] }),
145
- /*#__PURE__*/ B("li", { children: [
146
- /*#__PURE__*/ z(q, { id: "yp0UjB" }),
147
- ": ",
148
- e.ethertype
149
- ] }),
150
- e.protocol && /*#__PURE__*/ B("li", { children: [
151
- /*#__PURE__*/ z(q, { id: "6+OdGi" }),
152
- ": ",
153
- e.protocol
154
- ] }),
155
- e.port_range_min !== null && e.port_range_max !== null && /*#__PURE__*/ B("li", { children: [
156
- /*#__PURE__*/ z(q, { id: "tV/Ozb" }),
157
- ":",
158
- " ",
159
- e.port_range_min === e.port_range_max ? e.port_range_min : `${e.port_range_min}-${e.port_range_max}`
160
- ] }),
161
- e.remote_ip_prefix && /*#__PURE__*/ B("li", { children: [
162
- /*#__PURE__*/ z(q, { id: "WoSkGY" }),
163
- ": ",
164
- e.remote_ip_prefix
165
- ] }),
166
- e.remote_group_id && /*#__PURE__*/ B("li", { children: [
167
- /*#__PURE__*/ z(q, { id: "i9TIyi" }),
168
- ": ",
169
- e.remote_group_id
170
- ] })
171
- ]
172
- })]
173
- }),
174
- /*#__PURE__*/ B("div", {
175
- className: "mt-4",
176
- children: [/*#__PURE__*/ z("p", {
177
- className: "mb-2 text-sm",
178
- children: /*#__PURE__*/ z(q, {
179
- id: "PHt+EV",
180
- components: { 0: /*#__PURE__*/ z("strong", {}) }
181
- })
182
- }), /*#__PURE__*/ z(v, {
183
- value: d,
184
- onChange: (e) => f(e.target.value),
185
- placeholder: l._({ id: "HNlEFZ" }),
186
- autoComplete: "off",
187
- disabled: s,
188
- "data-testid": "delete-rule-confirmation-input"
189
- })]
190
- })
191
- ] })
192
- }) : null;
193
- }
194
- //#endregion
195
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/validation/validationHelpers.ts
196
- function re(e) {
197
- return e.includes(".") ? "IPv4" : e.includes(":") ? "IPv6" : null;
198
- }
199
- function ie(e, t, n) {
200
- if (e != null && isNaN(e) || t != null && isNaN(t)) return {
201
- valid: !1,
202
- error: "Port must be a valid number"
203
- };
204
- if (n?.toLowerCase() === "tcp" || n?.toLowerCase() === "udp") {
205
- if (e != null && (e < 1 || e > 65535) || t != null && (t < 1 || t > 65535)) return {
206
- valid: !1,
207
- error: "For TCP/UDP: port must be between 1 and 65535"
208
- };
209
- } else if (e != null && (e < 0 || e > 65535) || t != null && (t < 0 || t > 65535)) return {
210
- valid: !1,
211
- error: "Port must be between 0 and 65535"
212
- };
213
- return e != null && t != null && e > t ? {
214
- valid: !1,
215
- error: "port_range_min must be less than or equal to port_range_max"
216
- } : { valid: !0 };
217
- }
218
- function ae(e, t) {
219
- return e != null && isNaN(e) ? {
220
- valid: !1,
221
- error: "ICMP type must be a valid number"
222
- } : t != null && isNaN(t) ? {
223
- valid: !1,
224
- error: "ICMP code must be a valid number"
225
- } : e != null && (e < 0 || e > 255) ? {
226
- valid: !1,
227
- error: "ICMP type must be between 0 and 255"
228
- } : t != null && (t < 0 || t > 255) ? {
229
- valid: !1,
230
- error: "ICMP code must be between 0 and 255"
231
- } : { valid: !0 };
232
- }
233
- function oe(e) {
234
- let t = e.split("/");
235
- if (t.length !== 2) return !1;
236
- let [n, r] = t;
237
- if (!/^\d+$/.test(r)) return !1;
238
- let i = parseInt(r, 10);
239
- if (isNaN(i) || i < 0) return !1;
240
- if (n.includes(".")) {
241
- let e = n.split(".");
242
- if (e.length !== 4) return !1;
243
- for (let t of e) {
244
- let e = parseInt(t, 10);
245
- if (isNaN(e) || e < 0 || e > 255 || t !== e.toString()) return !1;
246
- }
247
- return i <= 32;
248
- }
249
- if (n.includes(":")) {
250
- if (n.includes(":::") || i > 128) return !1;
251
- let e = n.includes("::"), t = n.split(":").filter((e) => e !== "");
252
- if (e) {
253
- if (t.length > 7) return !1;
254
- } else if (t.length !== 8) return !1;
255
- for (let e of t) if (e.length === 0 || e.length > 4 || !/^[0-9a-fA-F]+$/.test(e)) return !1;
256
- return !((n.match(/::/g) || []).length > 1 || n.startsWith(":") && !n.startsWith("::") || n.endsWith(":") && !n.endsWith("::"));
257
- }
258
- return !1;
259
- }
260
- //#endregion
261
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/constants.ts
262
- var se = "0.0.0.0/0", ce = "::/0", le = "other-protocol", ue = Y.object({
263
- ruleType: Y.string().min(1, "Rule type is required"),
264
- direction: Y.enum(["ingress", "egress"]),
265
- ethertype: Y.enum(["IPv4", "IPv6"]),
266
- description: Y.string(),
267
- protocol: Y.string().nullable(),
268
- portFrom: Y.string(),
269
- portTo: Y.string(),
270
- icmpType: Y.string(),
271
- icmpCode: Y.string(),
272
- remoteSourceType: Y.enum(["cidr", "security_group"]),
273
- remoteCidr: Y.string(),
274
- remoteSecurityGroupId: Y.string()
275
- }).superRefine((e, t) => {
276
- let n = e.protocol === "tcp" || e.protocol === "udp", r = e.protocol === "icmp" || e.protocol === "ipv6-icmp", i = e.ruleType === le, a = n && ["custom-tcp", "custom-udp"].includes(e.ruleType);
277
- if (i && !e.protocol && t.addIssue({
278
- code: Y.ZodIssueCode.custom,
279
- message: "Protocol is required",
280
- path: ["protocol"]
281
- }), a) if (!e.portFrom) t.addIssue({
282
- code: Y.ZodIssueCode.custom,
283
- message: "Port (from) is required",
284
- path: ["portFrom"]
285
- });
286
- else {
287
- let n = parseInt(e.portFrom, 10);
288
- if (isNaN(n)) t.addIssue({
289
- code: Y.ZodIssueCode.custom,
290
- message: "Port must be a valid number",
291
- path: ["portFrom"]
292
- });
293
- else if (e.portTo) {
294
- let r = parseInt(e.portTo, 10);
295
- if (isNaN(r)) t.addIssue({
296
- code: Y.ZodIssueCode.custom,
297
- message: "Port must be a valid number",
298
- path: ["portTo"]
299
- });
300
- else if (n >= r) t.addIssue({
301
- code: Y.ZodIssueCode.custom,
302
- message: "\"Port (from)\" must be less than \"Port (to)\"",
303
- path: ["portFrom"]
304
- });
305
- else {
306
- let i = ie(n, r, e.protocol);
307
- i.valid || t.addIssue({
308
- code: Y.ZodIssueCode.custom,
309
- message: i.error || "Invalid port range",
310
- path: ["portFrom"]
311
- });
312
- }
313
- } else {
314
- let r = ie(n, n, e.protocol);
315
- r.valid || t.addIssue({
316
- code: Y.ZodIssueCode.custom,
317
- message: r.error || "Invalid port",
318
- path: ["portFrom"]
319
- });
320
- }
321
- }
322
- if (r) {
323
- let n = e.icmpType ? parseInt(e.icmpType, 10) : null, r = e.icmpCode ? parseInt(e.icmpCode, 10) : null;
324
- if (e.icmpType && isNaN(n) && t.addIssue({
325
- code: Y.ZodIssueCode.custom,
326
- message: "ICMP type must be a valid number",
327
- path: ["icmpType"]
328
- }), e.icmpCode && isNaN(r) && t.addIssue({
329
- code: Y.ZodIssueCode.custom,
330
- message: "ICMP code must be a valid number",
331
- path: ["icmpCode"]
332
- }), e.icmpCode && !e.icmpType && t.addIssue({
333
- code: Y.ZodIssueCode.custom,
334
- message: "ICMP type is required when ICMP code is specified",
335
- path: ["icmpType"]
336
- }), n !== null || r !== null) {
337
- let e = ae(n, r);
338
- e.valid || (e.error?.includes("type") && t.addIssue({
339
- code: Y.ZodIssueCode.custom,
340
- message: "ICMP type must be between 0 and 255",
341
- path: ["icmpType"]
342
- }), e.error?.includes("code") && t.addIssue({
343
- code: Y.ZodIssueCode.custom,
344
- message: "ICMP code must be between 0 and 255",
345
- path: ["icmpCode"]
346
- }));
347
- }
348
- }
349
- if (e.remoteSourceType === "cidr" && e.remoteCidr) if (!oe(e.remoteCidr)) t.addIssue({
350
- code: Y.ZodIssueCode.custom,
351
- message: "Invalid CIDR format. Examples: 0.0.0.0/0 (IPv4) or ::/0 (IPv6)",
352
- path: ["remoteCidr"]
353
- });
354
- else {
355
- let n = re(e.remoteCidr);
356
- n && n !== e.ethertype && t.addIssue({
357
- code: Y.ZodIssueCode.custom,
358
- message: `CIDR family (${n}) must match Ethertype (${e.ethertype})`,
359
- path: ["remoteCidr"]
360
- });
361
- }
362
- }), de = {
363
- ruleType: "",
364
- direction: "ingress",
365
- ethertype: "IPv4",
366
- description: "",
367
- protocol: null,
368
- portFrom: "",
369
- portTo: "",
370
- icmpType: "",
371
- icmpCode: "",
372
- remoteSourceType: "cidr",
373
- remoteCidr: se,
374
- remoteSecurityGroupId: ""
375
- }, fe = [
376
- {
377
- value: "",
378
- label: "",
379
- protocol: null,
380
- portRangeMin: null,
381
- portRangeMax: null
382
- },
383
- {
384
- value: "custom-tcp",
385
- label: "Custom TCP Rule",
386
- protocol: "tcp",
387
- portRangeMin: null,
388
- portRangeMax: null
389
- },
390
- {
391
- value: "custom-udp",
392
- label: "Custom UDP Rule",
393
- protocol: "udp",
394
- portRangeMin: null,
395
- portRangeMax: null
396
- },
397
- {
398
- value: "custom-icmp",
399
- label: "Custom ICMP Rule",
400
- protocol: "icmp",
401
- portRangeMin: null,
402
- portRangeMax: null
403
- },
404
- {
405
- value: "all-tcp",
406
- label: "All TCP",
407
- protocol: "tcp",
408
- portRangeMin: 1,
409
- portRangeMax: 65535
410
- },
411
- {
412
- value: "all-udp",
413
- label: "All UDP",
414
- protocol: "udp",
415
- portRangeMin: 1,
416
- portRangeMax: 65535
417
- },
418
- {
419
- value: "all-icmp",
420
- label: "All ICMP",
421
- protocol: "icmp",
422
- portRangeMin: null,
423
- portRangeMax: null
424
- },
425
- {
426
- value: "other-protocol",
427
- label: "Other Protocol",
428
- protocol: null,
429
- portRangeMin: null,
430
- portRangeMax: null
431
- },
432
- {
433
- value: "dns",
434
- label: "DNS",
435
- protocol: "tcp",
436
- portRangeMin: 53,
437
- portRangeMax: 53
438
- },
439
- {
440
- value: "http",
441
- label: "HTTP",
442
- protocol: "tcp",
443
- portRangeMin: 80,
444
- portRangeMax: 80
445
- },
446
- {
447
- value: "https",
448
- label: "HTTPS",
449
- protocol: "tcp",
450
- portRangeMin: 443,
451
- portRangeMax: 443
452
- },
453
- {
454
- value: "imap",
455
- label: "IMAP",
456
- protocol: "tcp",
457
- portRangeMin: 143,
458
- portRangeMax: 143
459
- },
460
- {
461
- value: "imaps",
462
- label: "IMAPS",
463
- protocol: "tcp",
464
- portRangeMin: 993,
465
- portRangeMax: 993
466
- },
467
- {
468
- value: "ldap",
469
- label: "LDAP",
470
- protocol: "tcp",
471
- portRangeMin: 389,
472
- portRangeMax: 389
473
- },
474
- {
475
- value: "ms-sql",
476
- label: "MS SQL",
477
- protocol: "tcp",
478
- portRangeMin: 1433,
479
- portRangeMax: 1433
480
- },
481
- {
482
- value: "mysql",
483
- label: "MySQL",
484
- protocol: "tcp",
485
- portRangeMin: 3306,
486
- portRangeMax: 3306
487
- },
488
- {
489
- value: "pop3",
490
- label: "POP3",
491
- protocol: "tcp",
492
- portRangeMin: 110,
493
- portRangeMax: 110
494
- },
495
- {
496
- value: "pop3s",
497
- label: "POP3S",
498
- protocol: "tcp",
499
- portRangeMin: 995,
500
- portRangeMax: 995
501
- },
502
- {
503
- value: "rdp",
504
- label: "RDP",
505
- protocol: "tcp",
506
- portRangeMin: 3389,
507
- portRangeMax: 3389
508
- },
509
- {
510
- value: "ssh",
511
- label: "SSH",
512
- protocol: "tcp",
513
- portRangeMin: 22,
514
- portRangeMax: 22
515
- },
516
- {
517
- value: "smtp",
518
- label: "SMTP",
519
- protocol: "tcp",
520
- portRangeMin: 25,
521
- portRangeMax: 25
522
- },
523
- {
524
- value: "smtps",
525
- label: "SMTPS",
526
- protocol: "tcp",
527
- portRangeMin: 465,
528
- portRangeMax: 465
529
- }
530
- ];
531
- //#endregion
532
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/RuleTypeSection.tsx
533
- function pe({ form: e, disabled: t = !1 }) {
534
- let { i18n: n, _: i } = J();
535
- return /*#__PURE__*/ z(e.Field, {
536
- name: "ruleType",
537
- mode: "value",
538
- children: (i) => /*#__PURE__*/ z(h, {
539
- className: "mb-6",
540
- children: /*#__PURE__*/ z(T, {
541
- id: "ruleType",
542
- label: n._({ id: "YuGQWb" }),
543
- value: i.state.value,
544
- onChange: (t) => {
545
- let n = String(t || "");
546
- if (i.handleChange(n), !n) {
547
- e.setFieldValue("protocol", null), e.setFieldValue("portFrom", ""), e.setFieldValue("portTo", ""), e.setFieldValue("icmpType", ""), e.setFieldValue("icmpCode", "");
548
- return;
549
- }
550
- let r = fe.find((e) => e.value === n);
551
- r && (e.setFieldValue("protocol", r.protocol), (r.protocol === "tcp" || r.protocol === "udp") && r.portRangeMin !== null && r.portRangeMax !== null ? (e.setFieldValue("portFrom", String(r.portRangeMin)), e.setFieldValue("portTo", String(r.portRangeMax))) : (e.setFieldValue("portFrom", ""), e.setFieldValue("portTo", "")), r.protocol !== "icmp" && r.protocol !== "ipv6-icmp" && (e.setFieldValue("icmpType", ""), e.setFieldValue("icmpCode", "")));
552
- },
553
- disabled: t,
554
- children: fe.map((e) => e.value === "" ? /*#__PURE__*/ z(r, {
555
- value: e.value,
556
- label: n._({ id: "eh/k36" })
557
- }, e.value) : /*#__PURE__*/ z(r, {
558
- value: e.value,
559
- label: e.label
560
- }, e.value))
561
- })
562
- })
563
- });
564
- }
565
- //#endregion
566
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/DirectionEthertypeSection.tsx
567
- function me({ form: e, disabled: t = !1 }) {
568
- let { i18n: n, _: r } = J();
569
- return /*#__PURE__*/ z(e.Field, {
570
- name: "direction",
571
- children: (e) => /*#__PURE__*/ z(h, { children: /*#__PURE__*/ z(D, {
572
- name: "direction",
573
- label: n._({ id: "MRB7nI" }),
574
- selected: e.state.value,
575
- onChange: (t) => e.handleChange(String(t)),
576
- required: !0,
577
- disabled: t,
578
- children: /*#__PURE__*/ B("div", {
579
- className: "flex gap-4",
580
- children: [/*#__PURE__*/ z(c, {
581
- value: "ingress",
582
- label: n._({ id: "fzfAAa" })
583
- }), /*#__PURE__*/ z(c, {
584
- value: "egress",
585
- label: n._({ id: "nETBrc" })
586
- })]
587
- })
588
- }) })
589
- });
590
- }
591
- function he({ form: e, disabled: t = !1 }) {
592
- let { i18n: n, _: r } = J();
593
- return /*#__PURE__*/ z(e.Field, {
594
- name: "ethertype",
595
- children: (e) => /*#__PURE__*/ z(h, { children: /*#__PURE__*/ z(D, {
596
- name: "ethertype",
597
- label: n._({ id: "16085O" }),
598
- selected: e.state.value,
599
- onChange: (t) => e.handleChange(String(t)),
600
- required: !0,
601
- disabled: t,
602
- children: /*#__PURE__*/ B("div", {
603
- className: "flex gap-4",
604
- children: [/*#__PURE__*/ z(c, {
605
- value: "IPv4",
606
- label: "IPv4"
607
- }), /*#__PURE__*/ z(c, {
608
- value: "IPv6",
609
- label: "IPv6"
610
- })]
611
- })
612
- }) })
613
- });
614
- }
615
- //#endregion
616
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/ProtocolSection.tsx
617
- function ge({ form: e, disabled: t = !1 }) {
618
- let { i18n: n, _: r } = J();
619
- return /*#__PURE__*/ z(e.Field, {
620
- name: "protocol",
621
- children: (e) => /*#__PURE__*/ z(h, {
622
- className: "mb-6",
623
- children: /*#__PURE__*/ z(v, {
624
- id: "protocol",
625
- name: "protocol",
626
- label: n._({ id: "6+OdGi" }),
627
- value: e.state.value || "",
628
- onChange: (t) => e.handleChange(t.target.value || null),
629
- errortext: e.state.meta.errors[0]?.message,
630
- placeholder: n._({ id: "8wdCNd" }),
631
- disabled: t
632
- })
633
- })
634
- });
635
- }
636
- //#endregion
637
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/PortRangeSection.tsx
638
- function _e({ form: e, disabled: t = !1 }) {
639
- let { i18n: n, _: r } = J(), i = Z(e.store, (e) => e.values.portFrom), a = Z(e.store, (e) => e.fieldMeta.portFrom?.errors[0]?.message), o = Z(e.store, (e) => e.fieldMeta.portTo?.errors[0]?.message), s = t || !i || i.trim() === "";
640
- return /*#__PURE__*/ B(h, {
641
- className: "mb-6",
642
- children: [
643
- /*#__PURE__*/ B("div", {
644
- className: "flex items-center gap-4",
645
- children: [
646
- /*#__PURE__*/ z(e.Field, {
647
- name: "portFrom",
648
- children: (r) => /*#__PURE__*/ z("div", {
649
- className: "flex-1",
650
- children: /*#__PURE__*/ z(v, {
651
- id: "portFrom",
652
- name: "portFrom",
653
- label: n._({ id: "LMdsuJ" }),
654
- value: r.state.value || "",
655
- onChange: (t) => {
656
- let n = t.target.value;
657
- r.handleChange(n), (!n || n.trim() === "") && e.setFieldValue("portTo", ""), e.validateField("portTo", "change");
658
- },
659
- invalid: r.state.meta.errors.length > 0,
660
- disabled: t,
661
- required: !0
662
- })
663
- })
664
- }),
665
- /*#__PURE__*/ z("div", {
666
- className: "text-theme-secondary flex items-center justify-center",
667
- children: "—"
668
- }),
669
- /*#__PURE__*/ z(e.Field, {
670
- name: "portTo",
671
- children: (t) => /*#__PURE__*/ z("div", {
672
- className: "flex-1",
673
- children: /*#__PURE__*/ z(v, {
674
- id: "portTo",
675
- name: "portTo",
676
- label: n._({ id: "a12lSo" }),
677
- value: t.state.value || "",
678
- onChange: (n) => {
679
- t.handleChange(n.target.value), e.validateField("portFrom", "change");
680
- },
681
- invalid: t.state.meta.errors.length > 0,
682
- placeholder: "",
683
- disabled: s
684
- })
685
- })
686
- })
687
- ]
688
- }),
689
- (a || o) && /*#__PURE__*/ B("div", {
690
- className: "text-theme-error mt-2 text-sm",
691
- children: [a && /*#__PURE__*/ z("div", { children: a }), o && /*#__PURE__*/ z("div", { children: o })]
692
- }),
693
- /*#__PURE__*/ z("p", {
694
- className: "mt-2 text-sm",
695
- children: n._({ id: "QAUa4B" })
696
- })
697
- ]
698
- });
699
- }
700
- //#endregion
701
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/IcmpSection.tsx
702
- function ve({ form: e, disabled: t = !1 }) {
703
- let { i18n: n, _: r } = J();
704
- return /*#__PURE__*/ z(h, {
705
- className: "mb-6",
706
- children: /*#__PURE__*/ B("div", {
707
- className: "flex w-full gap-4",
708
- children: [/*#__PURE__*/ z(e.Field, {
709
- name: "icmpType",
710
- children: (e) => /*#__PURE__*/ z("div", {
711
- className: "flex-1",
712
- children: /*#__PURE__*/ z(v, {
713
- id: "icmpType",
714
- name: "icmpType",
715
- label: n._({ id: "yPWFWy" }),
716
- value: e.state.value,
717
- onChange: (t) => e.handleChange(t.target.value),
718
- errortext: e.state.meta.errors[0]?.message,
719
- placeholder: n._({ id: "GPuCEo" }),
720
- disabled: t
721
- })
722
- })
723
- }), /*#__PURE__*/ z(e.Field, {
724
- name: "icmpCode",
725
- children: (e) => /*#__PURE__*/ z("div", {
726
- className: "flex-1",
727
- children: /*#__PURE__*/ z(v, {
728
- id: "icmpCode",
729
- name: "icmpCode",
730
- label: n._({ id: "76RKuS" }),
731
- value: e.state.value,
732
- onChange: (t) => e.handleChange(t.target.value),
733
- errortext: e.state.meta.errors[0]?.message,
734
- placeholder: n._({ id: "UkVkoq" }),
735
- disabled: t
736
- })
737
- })
738
- })]
739
- })
740
- });
741
- }
742
- //#endregion
743
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/RemoteSourceSection.tsx
744
- function ye({ form: e, disabled: t = !1, availableSecurityGroups: n }) {
745
- let { i18n: i, _: a } = J();
746
- return /*#__PURE__*/ B(R, { children: [
747
- /*#__PURE__*/ z(e.Field, {
748
- name: "remoteSourceType",
749
- mode: "value",
750
- children: (n) => /*#__PURE__*/ z(h, {
751
- className: "mb-1",
752
- children: /*#__PURE__*/ z(D, {
753
- name: "remoteSourceType",
754
- label: i._({ id: "I5kZVK" }),
755
- selected: n.state.value,
756
- onChange: (t) => {
757
- let r = String(t);
758
- n.handleChange(r), r !== "security_group" && e.setFieldValue("ethertype", "IPv4");
759
- },
760
- disabled: t,
761
- children: /*#__PURE__*/ B("div", {
762
- className: "flex gap-4",
763
- children: [/*#__PURE__*/ z(c, {
764
- value: "cidr",
765
- label: i._({ id: "4uXhtt" })
766
- }), /*#__PURE__*/ z(c, {
767
- value: "security_group",
768
- label: i._({ id: "bwhBhT" })
769
- })]
770
- })
771
- })
772
- })
773
- }),
774
- /*#__PURE__*/ z(e.Field, {
775
- name: "remoteSourceType",
776
- children: (n) => n.state.value === "cidr" ? /*#__PURE__*/ z(e.Field, {
777
- name: "remoteCidr",
778
- children: (n) => /*#__PURE__*/ z(e.Field, {
779
- name: "ethertype",
780
- children: (e) => /*#__PURE__*/ z(h, {
781
- className: "mb-6",
782
- children: /*#__PURE__*/ z(v, {
783
- id: "remoteCidr",
784
- name: "remoteCidr",
785
- label: i._({ id: "vmYyLY" }),
786
- value: n.state.value,
787
- onChange: (e) => n.handleChange(e.target.value),
788
- errortext: n.state.meta.errors[0]?.message,
789
- placeholder: e.state.value === "IPv4" ? se : ce,
790
- disabled: t
791
- })
792
- })
793
- })
794
- }) : null
795
- }),
796
- /*#__PURE__*/ z(e.Field, {
797
- name: "remoteSourceType",
798
- children: (a) => a.state.value === "security_group" ? /*#__PURE__*/ z(e.Field, {
799
- name: "remoteSecurityGroupId",
800
- children: (e) => /*#__PURE__*/ z(h, {
801
- className: "mb-6",
802
- children: /*#__PURE__*/ B(T, {
803
- id: "remoteSecurityGroupId",
804
- label: i._({ id: "i9TIyi" }),
805
- value: e.state.value,
806
- onChange: (t) => e.handleChange(String(t)),
807
- errortext: e.state.meta.errors[0]?.message,
808
- disabled: t,
809
- children: [/*#__PURE__*/ z(r, {
810
- value: "",
811
- label: i._({ id: "ZvIpwi" })
812
- }), n.map((e) => /*#__PURE__*/ z(r, {
813
- value: e.id,
814
- label: e.name || e.id
815
- }, e.id))]
816
- })
817
- })
818
- }) : null
819
- })
820
- ] });
821
- }
822
- //#endregion
823
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/DescriptionSection.tsx
824
- function be({ form: e, disabled: t = !1 }) {
825
- let { i18n: n, _: r } = J();
826
- return /*#__PURE__*/ z(e.Field, {
827
- name: "description",
828
- children: (e) => /*#__PURE__*/ z(h, {
829
- className: "mb-0",
830
- children: /*#__PURE__*/ z(C, {
831
- id: "description",
832
- name: "description",
833
- label: n._({ id: "Nu4oKW" }),
834
- value: e.state.value,
835
- onChange: (t) => e.handleChange(t.target.value),
836
- placeholder: n._({ id: "pbzA+s" }),
837
- disabled: t,
838
- rows: 2
839
- })
840
- })
841
- });
842
- }
843
- //#endregion
844
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/AddRuleModal.tsx
845
- var xe = ({ securityGroupId: e, open: t, onClose: r, onCreate: a, isLoading: s = !1, error: c = null, availableSecurityGroups: l = [] }) => {
846
- let { i18n: u, _: f } = J(), m = X({
847
- defaultValues: de,
848
- validators: { onSubmit: ue },
849
- onSubmit: async ({ value: t }) => {
850
- if (s) return;
851
- let n = {
852
- security_group_id: e,
853
- direction: t.direction,
854
- ethertype: t.ethertype,
855
- description: t.description || void 0,
856
- protocol: t.protocol || null,
857
- remote_ip_prefix: void 0,
858
- remote_group_id: void 0,
859
- remote_address_group_id: void 0
860
- };
861
- if ((t.protocol === "tcp" || t.protocol === "udp") && t.portFrom) {
862
- let e = parseInt(t.portFrom, 10);
863
- n.port_range_min = e, n.port_range_max = t.portTo ? parseInt(t.portTo, 10) : e;
864
- }
865
- (t.protocol === "icmp" || t.protocol === "ipv6-icmp") && (t.icmpType && (n.port_range_min = parseInt(t.icmpType, 10)), t.icmpCode && (n.port_range_max = parseInt(t.icmpCode, 10))), t.remoteSourceType === "cidr" && t.remoteCidr ? n.remote_ip_prefix = t.remoteCidr : t.remoteSourceType === "security_group" && t.remoteSecurityGroupId && (n.remote_group_id = t.remoteSecurityGroupId), await a(n), h();
866
- }
867
- }), h = () => {
868
- m.reset(), r();
869
- };
870
- return /*#__PURE__*/ B(i, {
871
- open: t,
872
- onCancel: h,
873
- size: "large",
874
- title: u._({ id: "b2BLBa" }),
875
- modalFooter: /*#__PURE__*/ z(o, {
876
- className: "flex justify-end",
877
- children: /*#__PURE__*/ z(m.Subscribe, { children: (e) => {
878
- let t = !!e.values.ruleType;
879
- return /*#__PURE__*/ B(g, { children: [/*#__PURE__*/ z(p, {
880
- variant: "default",
881
- onClick: h,
882
- disabled: s || e.isSubmitting,
883
- children: /*#__PURE__*/ z(q, { id: "dEgA5A" })
884
- }), /*#__PURE__*/ z(p, {
885
- variant: "primary",
886
- type: "button",
887
- onClick: () => m.handleSubmit(),
888
- disabled: s || e.isSubmitting || !t,
889
- "data-testid": "add-rule-button",
890
- children: e.isSubmitting || s ? /*#__PURE__*/ z(d, { size: "small" }) : /*#__PURE__*/ z(q, { id: "bmQLn5" })
891
- })] });
892
- } })
893
- }),
894
- children: [
895
- c && /*#__PURE__*/ z(n, {
896
- dismissible: !1,
897
- variant: "error",
898
- className: "mb-4",
899
- children: c
900
- }),
901
- s && /*#__PURE__*/ B("div", {
902
- className: "mb-4 flex items-center justify-center gap-2",
903
- children: [/*#__PURE__*/ z(d, { variant: "primary" }), /*#__PURE__*/ z("span", {
904
- className: "text-theme-secondary text-sm",
905
- children: /*#__PURE__*/ z(q, { id: "gU7JFm" })
906
- })]
907
- }),
908
- /*#__PURE__*/ z(E, {
909
- className: "mb-6",
910
- onSubmit: (e) => {
911
- e.preventDefault(), m.handleSubmit();
912
- },
913
- children: /*#__PURE__*/ B(x, {
914
- className: "mb-6",
915
- children: [/*#__PURE__*/ z(pe, {
916
- form: m,
917
- disabled: s
918
- }), /*#__PURE__*/ z(m.Subscribe, { children: (e) => {
919
- if (!e.values.ruleType) return null;
920
- let t = (e.values.protocol === "tcp" || e.values.protocol === "udp") && ["custom-tcp", "custom-udp"].includes(e.values.ruleType), n = e.values.protocol === "icmp" || e.values.protocol === "ipv6-icmp";
921
- return /*#__PURE__*/ B(R, { children: [
922
- /*#__PURE__*/ z(me, {
923
- form: m,
924
- disabled: s
925
- }),
926
- e.values.ruleType === "other-protocol" && /*#__PURE__*/ z(ge, {
927
- form: m,
928
- disabled: s
929
- }),
930
- t && /*#__PURE__*/ z(_e, {
931
- form: m,
932
- disabled: s
933
- }),
934
- n && /*#__PURE__*/ z(ve, {
935
- form: m,
936
- disabled: s
937
- }),
938
- /*#__PURE__*/ z(ye, {
939
- form: m,
940
- disabled: s,
941
- availableSecurityGroups: l
942
- }),
943
- e.values.remoteSourceType === "security_group" && /*#__PURE__*/ z(he, {
944
- form: m,
945
- disabled: s
946
- }),
947
- /*#__PURE__*/ z(be, {
948
- form: m,
949
- disabled: s
950
- })
951
- ] });
952
- } })]
953
- })
954
- })
955
- ]
956
- });
957
- };
958
- //#endregion
959
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupRulesTable.tsx
960
- function Se({ rules: e, totalRulesCount: n, onDeleteRule: r, isDeletingRule: i, deleteError: a, searchTerm: o = "", onSearchChange: c, sortSettings: d, onSortChange: h, filterSettings: g, onFilterChange: v, securityGroupId: y, onCreateRule: x, isCreatingRule: S = !1, createRuleError: C = null, availableSecurityGroups: T = [], canCreateRule: E, canDeleteRule: D }) {
961
- let { i18n: k, _: A } = J(), [j, N] = G(null), [L, ee] = P(), [V, U] = G(o), K = W(void 0);
962
- H(() => () => clearTimeout(K.current), []);
963
- let Y = (e) => {
964
- N(e);
965
- }, X = (e) => {
966
- r(e);
967
- }, Z = () => {
968
- i || N(null);
969
- };
970
- H(() => {
971
- !i && !a && N(null);
972
- }, [i, a]);
973
- let te = (e) => {
974
- if (e.protocol === "icmp" || e.protocol === "ipv6-icmp") {
975
- if (e.port_range_min !== null && e.port_range_max !== null) {
976
- let t = e.port_range_min, n = e.port_range_max;
977
- return k._({
978
- id: "0p+s6m",
979
- values: {
980
- typeValue: t,
981
- codeValue: n
982
- }
983
- });
984
- }
985
- return k._({ id: "eKC+EC" });
986
- }
987
- return e.port_range_min === null || e.port_range_max === null ? k._({ id: "eKC+EC" }) : e.port_range_min === e.port_range_max ? String(e.port_range_min) : `${e.port_range_min}-${e.port_range_max}`;
988
- }, Q = e.length, $ = n;
989
- return /*#__PURE__*/ B(R, { children: [
990
- /*#__PURE__*/ B(f, {
991
- direction: "vertical",
992
- gap: "4",
993
- children: [
994
- /*#__PURE__*/ B(f, {
995
- distribution: "between",
996
- alignment: "center",
997
- gap: "2",
998
- className: "pb-2",
999
- children: [/*#__PURE__*/ z("span", {
1000
- className: "theme-color-text-light text-sm",
1001
- children: $ !== void 0 && Q !== $ ? /*#__PURE__*/ z(q, {
1002
- id: "xuVMLX",
1003
- values: {
1004
- rulesLength: Q,
1005
- totalCount: $
1006
- }
1007
- }) : /*#__PURE__*/ z(q, {
1008
- id: "UHciG3",
1009
- values: { rulesLength: Q }
1010
- })
1011
- }), /*#__PURE__*/ B(f, {
1012
- gap: "2",
1013
- children: [d && h && /*#__PURE__*/ z(M, {
1014
- options: d.options,
1015
- sortBy: d.sortBy,
1016
- sortDirection: d.sortDirection ?? "asc",
1017
- selectClassName: "min-w-40",
1018
- onSortByChange: (e) => h({
1019
- ...d,
1020
- sortBy: e,
1021
- sortDirection: d.sortDirection
1022
- }),
1023
- onSortDirectionChange: (e) => h({
1024
- ...d,
1025
- sortDirection: e
1026
- })
1027
- }), E && x && /*#__PURE__*/ z(p, {
1028
- variant: "primary",
1029
- icon: "addCircle",
1030
- onClick: ee,
1031
- className: "whitespace-nowrap",
1032
- children: /*#__PURE__*/ z(q, { id: "O8tK4v" })
1033
- })]
1034
- })]
1035
- }),
1036
- (g || c) && /*#__PURE__*/ z(_, { children: /*#__PURE__*/ B(f, {
1037
- direction: "vertical",
1038
- gap: "2",
1039
- children: [/*#__PURE__*/ B(f, {
1040
- distribution: "between",
1041
- alignment: "center",
1042
- children: [g && v && /*#__PURE__*/ z(I, {
1043
- filters: g.filters,
1044
- selectClassName: "sm:min-w-40",
1045
- comboboxClassName: "sm:min-w-40",
1046
- onChange: (e) => {
1047
- if ((g.selectedFilters || []).some((t) => t.name === e.name && t.value === e.value)) return;
1048
- let t = g.filters.find((t) => t.filterName === e.name)?.supportsMultiValue ? [...g.selectedFilters || [], e] : [...(g.selectedFilters || []).filter((t) => t.name !== e.name), e];
1049
- v({
1050
- ...g,
1051
- selectedFilters: t
1052
- });
1053
- }
1054
- }), c && /*#__PURE__*/ z(t, {
1055
- placeholder: k._({ id: "HMV+cw" }),
1056
- "data-testid": "searchbar",
1057
- value: V,
1058
- onInput: (e) => {
1059
- let t = e.currentTarget.value;
1060
- U(t), clearTimeout(K.current), K.current = window.setTimeout(() => c(t), 500);
1061
- },
1062
- onSearch: (e) => {
1063
- clearTimeout(K.current), c(typeof e == "string" ? e : "");
1064
- },
1065
- onClear: () => {
1066
- clearTimeout(K.current), U(""), c("");
1067
- }
1068
- })]
1069
- }), g?.selectedFilters && g.selectedFilters.length > 0 && /*#__PURE__*/ z(F, {
1070
- selectedFilters: g.selectedFilters,
1071
- onDelete: (e) => v?.({
1072
- ...g,
1073
- selectedFilters: (g.selectedFilters || []).filter((t) => t.name !== e.name || t.value !== e.value)
1074
- }),
1075
- onClear: () => v?.({
1076
- ...g,
1077
- selectedFilters: []
1078
- })
1079
- })]
1080
- }) }),
1081
- e.length === 0 ? /*#__PURE__*/ z(q, { id: "nnxwBn" }) : /*#__PURE__*/ B(b, {
1082
- columns: D ? 6 : 5,
1083
- className: "security-group-rules-table",
1084
- children: [/*#__PURE__*/ B(u, { children: [
1085
- /*#__PURE__*/ z(l, { children: k._({ id: "MRB7nI" }) }),
1086
- /*#__PURE__*/ z(l, { children: k._({ id: "Nu4oKW" }) }),
1087
- /*#__PURE__*/ z(l, { children: k._({ id: "yp0UjB" }) }),
1088
- /*#__PURE__*/ z(l, { children: k._({ id: "6+OdGi" }) }),
1089
- /*#__PURE__*/ z(l, { children: k._({ id: "6jAi8c" }) }),
1090
- D && /*#__PURE__*/ z(l, { children: k._({ id: "7L01XJ" }) })
1091
- ] }), e.map((e) => /*#__PURE__*/ B(u, {
1092
- "data-testid": `rule-row-${e.id}`,
1093
- children: [
1094
- /*#__PURE__*/ z(w, { children: e.direction || k._({ id: "h47p9L" }) }),
1095
- /*#__PURE__*/ z(w, { children: e.description || k._({ id: "h47p9L" }) }),
1096
- /*#__PURE__*/ z(w, { children: e.ethertype }),
1097
- /*#__PURE__*/ z(w, { children: e.protocol || k._({ id: "eKC+EC" }) }),
1098
- /*#__PURE__*/ z(w, { children: te(e) }),
1099
- D && /*#__PURE__*/ z(w, {
1100
- onClick: (e) => e.stopPropagation(),
1101
- className: "items-end justify-end pr-0",
1102
- children: /*#__PURE__*/ z(s, { children: /*#__PURE__*/ z(m, { children: /*#__PURE__*/ z(O, {
1103
- label: k._({ id: "cnGeoo" }),
1104
- onClick: () => Y(e)
1105
- }) }) })
1106
- })
1107
- ]
1108
- }, e.id))]
1109
- })
1110
- ]
1111
- }),
1112
- D && /*#__PURE__*/ z(ne, {
1113
- rule: j,
1114
- open: !!j,
1115
- onClose: Z,
1116
- onConfirm: X,
1117
- isLoading: i,
1118
- error: a
1119
- }),
1120
- E && y && x && L && /*#__PURE__*/ z(xe, {
1121
- securityGroupId: y,
1122
- open: L,
1123
- onClose: ee,
1124
- onCreate: x,
1125
- isLoading: S,
1126
- error: C,
1127
- availableSecurityGroups: T
1128
- })
1129
- ] });
1130
- }
1131
- //#endregion
1132
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/RBACPolicyRow.tsx
1133
- function Ce({ policy: e, onDelete: t, canDelete: n }) {
1134
- let { i18n: r, _: i } = J();
1135
- return /*#__PURE__*/ B(u, { children: [
1136
- /*#__PURE__*/ z(w, { children: e.target_tenant }),
1137
- /*#__PURE__*/ z(w, { children: e.action }),
1138
- /*#__PURE__*/ z(w, {
1139
- onClick: (e) => e.stopPropagation(),
1140
- className: "items-end justify-end pr-0",
1141
- children: n && /*#__PURE__*/ z(s, { children: /*#__PURE__*/ z(m, { children: /*#__PURE__*/ z(O, {
1142
- label: r._({ id: "t/YqKh" }),
1143
- onClick: t
1144
- }) }) })
1145
- })
1146
- ] });
1147
- }
1148
- //#endregion
1149
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRBACPolicyModal.tsx
1150
- var we = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, Te = /^[0-9a-f]{32}$/i;
1151
- function Ee(e) {
1152
- return we.test(e) || Te.test(e);
1153
- }
1154
- function De({ isOpen: e, onClose: t, securityGroupId: r }) {
1155
- let { i18n: a, _: o } = J(), s = k.useUtils(), c = j(), [l, u] = G(!1), d = Y.object({ targetTenant: Y.string().min(1, a._({ id: "1RwosK" })).refine(Ee, { message: a._({ id: "CunRry" }) }) }), f = k.network.rbacPolicy.create.useMutation({ onSuccess: () => {
1156
- s.network.rbacPolicy.list.invalidate({
1157
- project_id: c,
1158
- securityGroupId: r
1159
- }), s.network.securityGroup.getById.invalidate({
1160
- project_id: c,
1161
- securityGroupId: r
1162
- }), m();
1163
- } }), p = X({
1164
- defaultValues: { targetTenant: "" },
1165
- validators: { onSubmit: d },
1166
- onSubmit: async ({ value: e }) => {
1167
- f.isPending || f.mutate({
1168
- project_id: c,
1169
- securityGroupId: r,
1170
- targetTenant: e.targetTenant.trim()
1171
- });
1172
- }
1173
- }), m = () => {
1174
- p.reset(), f.reset(), u(!1), t();
1175
- }, h = async () => {
1176
- u(!0), await p.handleSubmit();
1177
- };
1178
- return /*#__PURE__*/ B(i, {
1179
- open: e,
1180
- onCancel: m,
1181
- title: a._({ id: "vmRPFm" }),
1182
- size: "large",
1183
- onConfirm: h,
1184
- cancelButtonLabel: a._({ id: "dEgA5A" }),
1185
- confirmButtonLabel: a._({ id: "Z8lGw6" }),
1186
- disableConfirmButton: f.isPending,
1187
- children: [
1188
- f.error && /*#__PURE__*/ z(n, {
1189
- variant: "error",
1190
- className: "mb-4",
1191
- children: (() => {
1192
- let e = f.error.message.toLowerCase();
1193
- return e.includes("conflict") || e.includes("409") ? a._({ id: "rbuO5A" }) : e.includes("not found") || e.includes("404") ? a._({ id: "FwSyEp" }) : e.includes("forbidden") || e.includes("403") ? a._({ id: "kqJVBO" }) : f.error.message;
1194
- })()
1195
- }),
1196
- /*#__PURE__*/ z("p", {
1197
- className: "mb-4",
1198
- children: /*#__PURE__*/ z(q, { id: "cjEOmc" })
1199
- }),
1200
- /*#__PURE__*/ z(E, {
1201
- className: "mb-0",
1202
- onSubmit: (e) => {
1203
- e.preventDefault(), h();
1204
- },
1205
- children: /*#__PURE__*/ z(x, { children: /*#__PURE__*/ z(p.Field, {
1206
- name: "targetTenant",
1207
- validators: {
1208
- onBlur: ({ value: e }) => {
1209
- let t = e.trim();
1210
- if (!t) return a._({ id: "1RwosK" });
1211
- if (!Ee(t)) return a._({ id: "CunRry" });
1212
- },
1213
- onChange: ({ value: e }) => {
1214
- if (!l) return;
1215
- let t = e.trim();
1216
- if (!t) return a._({ id: "1RwosK" });
1217
- if (!Ee(t)) return a._({ id: "CunRry" });
1218
- }
1219
- },
1220
- children: (e) => {
1221
- let t = (e.state.meta.isTouched || l) && e.state.meta.errors.length > 0, n = e.state.meta.errors[0], r = t ? typeof n == "string" ? n : n?.message : void 0;
1222
- return /*#__PURE__*/ z(v, {
1223
- id: e.name,
1224
- name: e.name,
1225
- label: a._({ id: "WzVwU0" }),
1226
- value: e.state.value,
1227
- onChange: (t) => e.handleChange(t.target.value),
1228
- onBlur: e.handleBlur,
1229
- placeholder: a._({ id: "he4q+i" }),
1230
- required: !0,
1231
- helptext: a._({ id: "PkfPsB" }),
1232
- disabled: f.isPending,
1233
- errortext: r,
1234
- invalid: t
1235
- });
1236
- }
1237
- }) })
1238
- })
1239
- ]
1240
- });
1241
- }
1242
- //#endregion
1243
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/DeleteRBACPolicyDialog.tsx
1244
- function Oe({ policy: e, open: t, onClose: r, onConfirm: a, isLoading: o, error: s }) {
1245
- let { i18n: c, _: l } = J(), u = Y.object({ confirmText: Y.string().refine((e) => e === "remove", { message: c._({ id: "SVLToM" }) }) }), d = X({
1246
- defaultValues: { confirmText: "" },
1247
- validators: { onSubmit: u },
1248
- onSubmit: async () => {
1249
- o || (a(e.id), p());
1250
- }
1251
- }), f = Z(d.store, (e) => e.isSubmitting || e.values.confirmText !== "remove"), p = () => {
1252
- d.reset(), r();
1253
- };
1254
- return /*#__PURE__*/ z(i, {
1255
- open: t,
1256
- onCancel: p,
1257
- size: "small",
1258
- title: c._({ id: "Dt5W9T" }),
1259
- onConfirm: d.handleSubmit,
1260
- cancelButtonLabel: c._({ id: "dEgA5A" }),
1261
- confirmButtonLabel: o ? c._({ id: "M5RhXF" }) : c._({ id: "qh5W8q" }),
1262
- disableConfirmButton: o || f,
1263
- children: /*#__PURE__*/ B("div", { children: [
1264
- s && /*#__PURE__*/ z(n, {
1265
- dismissible: !1,
1266
- variant: "error",
1267
- className: "mt-4",
1268
- children: s
1269
- }),
1270
- /*#__PURE__*/ z(q, { id: "BMTd81" }),
1271
- /*#__PURE__*/ B("div", {
1272
- className: "bg-theme-background-lvl-1 mt-4 mb-4 rounded p-4",
1273
- children: [/*#__PURE__*/ z("p", {
1274
- className: "mb-2 font-semibold",
1275
- children: /*#__PURE__*/ z(q, { id: "nLvo6K" })
1276
- }), /*#__PURE__*/ B("ul", {
1277
- className: "list-inside list-disc space-y-1 text-sm",
1278
- children: [
1279
- /*#__PURE__*/ B("li", { children: [
1280
- /*#__PURE__*/ z(q, { id: "WzVwU0" }),
1281
- ": ",
1282
- e.target_tenant
1283
- ] }),
1284
- /*#__PURE__*/ B("li", { children: [
1285
- /*#__PURE__*/ z(q, { id: "bwRvnp" }),
1286
- ": ",
1287
- e.action
1288
- ] }),
1289
- /*#__PURE__*/ B("li", { children: [
1290
- /*#__PURE__*/ z(q, { id: "UGhVPl" }),
1291
- ": ",
1292
- e.object_type
1293
- ] })
1294
- ]
1295
- })]
1296
- }),
1297
- !o && /*#__PURE__*/ z(E, {
1298
- className: "mt-4 mb-0",
1299
- onSubmit: (e) => {
1300
- e.preventDefault(), d.handleSubmit();
1301
- },
1302
- children: /*#__PURE__*/ B(x, { children: [/*#__PURE__*/ z("p", {
1303
- className: "mb-2 text-sm",
1304
- children: /*#__PURE__*/ z(q, {
1305
- id: "Enpdmy",
1306
- components: { 0: /*#__PURE__*/ z("strong", {}) }
1307
- })
1308
- }), /*#__PURE__*/ z(d.Field, {
1309
- name: "confirmText",
1310
- children: (e) => /*#__PURE__*/ z(v, {
1311
- id: e.name,
1312
- name: e.name,
1313
- value: e.state.value,
1314
- onChange: (t) => e.handleChange(t.target.value),
1315
- placeholder: c._({ id: "tasfos" }),
1316
- autoComplete: "off",
1317
- disabled: o,
1318
- "data-testid": "remove-policy-confirmation-input"
1319
- })
1320
- })] })
1321
- })
1322
- ] })
1323
- });
1324
- }
1325
- //#endregion
1326
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupRBACPolicies.tsx
1327
- function ke({ securityGroupId: e, canManageAccess: r }) {
1328
- let i = k.useUtils(), { i18n: a, _: o } = J(), s = j(), [c, m] = P(), [h, g] = G(null), [v, y] = G(""), [x, S] = G(""), C = W(void 0);
1329
- H(() => () => clearTimeout(C.current), []);
1330
- let { data: w, isPending: T, isError: E, error: D } = k.network.rbacPolicy.list.useQuery({
1331
- project_id: s,
1332
- securityGroupId: e
1333
- }, { refetchOnWindowFocus: !1 }), O = k.network.rbacPolicy.delete.useMutation({ onSuccess: () => {
1334
- i.network.rbacPolicy.list.invalidate({
1335
- project_id: s,
1336
- securityGroupId: e
1337
- }), i.network.securityGroup.getById.invalidate({
1338
- project_id: s,
1339
- securityGroupId: e
1340
- });
1341
- } }), A = (e) => {
1342
- g(e);
1343
- }, M = (e) => {
1344
- O.mutate({
1345
- project_id: s,
1346
- policyId: e
1347
- });
1348
- }, N = () => {
1349
- O.isPending || g(null);
1350
- };
1351
- H(() => {
1352
- !O.isPending && !O.error && O.isSuccess && g(null);
1353
- }, [
1354
- O.isPending,
1355
- O.error,
1356
- O.isSuccess
1357
- ]);
1358
- let F = U(() => {
1359
- if (!w) return [];
1360
- if (!v) return w;
1361
- let e = v.toLowerCase();
1362
- return w.filter((t) => t.target_tenant?.toLowerCase().includes(e) || t.action?.toLowerCase().includes(e));
1363
- }, [w, v]);
1364
- if (T) return /*#__PURE__*/ z(f, {
1365
- distribution: "center",
1366
- alignment: "center",
1367
- className: "py-8",
1368
- children: /*#__PURE__*/ z(d, { variant: "primary" })
1369
- });
1370
- if (E) return /*#__PURE__*/ z(n, {
1371
- variant: "error",
1372
- className: "mb-4",
1373
- children: D.message
1374
- });
1375
- let I = w?.length || 0, L = F.length;
1376
- return /*#__PURE__*/ B(R, { children: [
1377
- /*#__PURE__*/ B(f, {
1378
- direction: "vertical",
1379
- gap: "4",
1380
- children: [
1381
- /*#__PURE__*/ B(f, {
1382
- distribution: "between",
1383
- alignment: "center",
1384
- gap: "2",
1385
- className: "pb-2",
1386
- children: [/*#__PURE__*/ z("span", {
1387
- className: "theme-color-text-light text-sm",
1388
- children: I === L ? /*#__PURE__*/ z(q, {
1389
- id: "xx2KP5",
1390
- values: { totalCount: I }
1391
- }) : /*#__PURE__*/ z(q, {
1392
- id: "VcWhM0",
1393
- values: {
1394
- filteredCount: L,
1395
- totalCount: I
1396
- }
1397
- })
1398
- }), r && /*#__PURE__*/ z(p, {
1399
- variant: "primary",
1400
- icon: "addCircle",
1401
- onClick: m,
1402
- className: "whitespace-nowrap",
1403
- children: /*#__PURE__*/ z(q, { id: "vmRPFm" })
1404
- })]
1405
- }),
1406
- /*#__PURE__*/ z(_, { children: /*#__PURE__*/ z(f, {
1407
- distribution: "between",
1408
- alignment: "center",
1409
- children: /*#__PURE__*/ z(t, {
1410
- placeholder: a._({ id: "mlxk2U" }),
1411
- "data-testid": "searchbar",
1412
- value: x,
1413
- onInput: (e) => {
1414
- let t = e.currentTarget.value;
1415
- S(t), clearTimeout(C.current), C.current = window.setTimeout(() => y(t), 500);
1416
- },
1417
- onSearch: (e) => {
1418
- clearTimeout(C.current), y(typeof e == "string" ? e : "");
1419
- },
1420
- onClear: () => {
1421
- clearTimeout(C.current), S(""), y("");
1422
- }
1423
- })
1424
- }) }),
1425
- L === 0 ? v ? /*#__PURE__*/ z(q, { id: "qxxo7y" }) : /*#__PURE__*/ z(q, { id: "Dia2Ue" }) : /*#__PURE__*/ B(b, {
1426
- columns: 3,
1427
- children: [/*#__PURE__*/ B(u, { children: [
1428
- /*#__PURE__*/ z(l, { children: /*#__PURE__*/ z(q, { id: "WzVwU0" }) }),
1429
- /*#__PURE__*/ z(l, { children: /*#__PURE__*/ z(q, { id: "bwRvnp" }) }),
1430
- /*#__PURE__*/ z(l, { children: /*#__PURE__*/ z(q, { id: "7L01XJ" }) })
1431
- ] }), F.map((e) => /*#__PURE__*/ z(Ce, {
1432
- policy: e,
1433
- onDelete: () => A(e),
1434
- canDelete: r
1435
- }, e.id))]
1436
- })
1437
- ]
1438
- }),
1439
- !!h && /*#__PURE__*/ z(Oe, {
1440
- policy: h,
1441
- open: !!h,
1442
- onClose: N,
1443
- onConfirm: M,
1444
- isLoading: O.isPending,
1445
- error: O.error?.message || null
1446
- }),
1447
- c && /*#__PURE__*/ z(De, {
1448
- isOpen: c,
1449
- onClose: m,
1450
- securityGroupId: e
1451
- })
1452
- ] });
1453
- }
1454
- //#endregion
1455
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/SecurityGroupDetailsView.tsx
1456
- function Ae({ securityGroup: t, filteredAndSortedRules: n, onEdit: r, onDeleteRule: i, isDeletingRule: a = !1, deleteRuleError: o = null, filterControls: s, onCreateRule: c, isCreatingRule: l = !1, createRuleError: u = null, availableSecurityGroups: d = [], currentProjectId: p, permissions: m }) {
1457
- let [h, g] = G("rules"), _ = t.project_id === p && m.canViewRBAC;
1458
- return /*#__PURE__*/ z(e, {
1459
- px: !1,
1460
- py: !0,
1461
- children: /*#__PURE__*/ B(f, {
1462
- direction: "vertical",
1463
- gap: "4",
1464
- children: [
1465
- /*#__PURE__*/ z(te, {
1466
- name: t.name,
1467
- id: t.id
1468
- }),
1469
- /*#__PURE__*/ z(Q, {
1470
- securityGroup: t,
1471
- onEdit: r,
1472
- canUpdate: m.canUpdate
1473
- }),
1474
- /*#__PURE__*/ z($, {
1475
- activeTab: h,
1476
- onTabChange: g,
1477
- showRBACTab: _
1478
- }),
1479
- /*#__PURE__*/ B("div", {
1480
- className: "mt-6",
1481
- children: [h === "rules" && /*#__PURE__*/ z(Se, {
1482
- rules: n,
1483
- totalRulesCount: t.security_group_rules?.length,
1484
- onDeleteRule: i,
1485
- isDeletingRule: a,
1486
- deleteError: o,
1487
- searchTerm: s.searchTerm,
1488
- onSearchChange: s.onSearchChange,
1489
- sortSettings: s.sortSettings,
1490
- onSortChange: s.onSortChange,
1491
- filterSettings: s.filterSettings,
1492
- onFilterChange: s.onFilterChange,
1493
- securityGroupId: t.id,
1494
- onCreateRule: m.canCreateRule ? c : void 0,
1495
- isCreatingRule: l,
1496
- createRuleError: u,
1497
- availableSecurityGroups: d,
1498
- canCreateRule: m.canCreateRule,
1499
- canDeleteRule: m.canDeleteRule
1500
- }), h === "rbac" && /*#__PURE__*/ z(ke, {
1501
- securityGroupId: t.id,
1502
- canManageAccess: m.canManageAccess
1503
- })]
1504
- })
1505
- ]
1506
- })
1507
- });
1508
- }
1509
- //#endregion
1510
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-hooks/useSecurityGroupDetails.ts
1511
- function je({ securityGroupId: e, filterControls: t }) {
1512
- let [n, r] = G(!1), i = j(), a = k.useUtils(), o = k.network.securityGroup.getById.useQuery({
1513
- project_id: i,
1514
- securityGroupId: e
1515
- }, { placeholderData: () => a.network.securityGroup.getById.getData({
1516
- project_id: i,
1517
- securityGroupId: e
1518
- }) }), s = U(() => {
1519
- let e = o.data?.security_group_rules || [], n = t.filterSettings.selectedFilters?.find((e) => e.name === "direction")?.value, r = t.filterSettings.selectedFilters?.find((e) => e.name === "ethertype")?.value, i = t.filterSettings.selectedFilters?.find((e) => e.name === "protocol")?.value;
1520
- if (n && n !== "all" && (e = e.filter((e) => e.direction === n)), r && r !== "all" && (e = e.filter((e) => e.ethertype === r)), i && i !== "all" && (e = e.filter((e) => e.protocol !== null && e.protocol === i)), t.searchTerm) {
1521
- let n = t.searchTerm.toLowerCase();
1522
- e = e.filter((e) => e.description?.toLowerCase().includes(n) || e.protocol?.toLowerCase().includes(n) || e.ethertype?.toLowerCase().includes(n));
1523
- }
1524
- if (t.sortSettings.sortBy) {
1525
- let n = t.sortSettings.sortBy;
1526
- e = [...e].sort((e, r) => {
1527
- let i = e[n] || "", a = r[n] || "", o = i.localeCompare(a);
1528
- return t.sortSettings.sortDirection === "asc" ? o : -o;
1529
- });
1530
- }
1531
- return e;
1532
- }, [o.data?.security_group_rules, t]), c = k.network.securityGroup.update.useMutation({ onSuccess: () => {
1533
- a.network.securityGroup.getById.invalidate({
1534
- project_id: i,
1535
- securityGroupId: e
1536
- }), a.network.securityGroup.list.invalidate(), r(!1);
1537
- } }), l = k.network.securityGroupRule.delete.useMutation({ onSuccess: () => {
1538
- a.network.securityGroup.getById.invalidate({
1539
- project_id: i,
1540
- securityGroupId: e
1541
- }), a.network.securityGroup.list.invalidate();
1542
- } }), u = k.network.securityGroupRule.create.useMutation({ onSuccess: () => {
1543
- a.network.securityGroup.getById.invalidate({
1544
- project_id: i,
1545
- securityGroupId: e
1546
- }), a.network.securityGroup.list.invalidate();
1547
- } });
1548
- return {
1549
- securityGroup: o.data,
1550
- filteredAndSortedRules: s,
1551
- isLoading: o.isPending,
1552
- isError: o.isError,
1553
- error: o.error,
1554
- isUpdating: c.isPending,
1555
- updateError: c.error?.message || null,
1556
- isDeletingRule: l.isPending,
1557
- deleteRuleError: l.error?.message || null,
1558
- isCreatingRule: u.isPending,
1559
- createRuleError: u.error?.message || null,
1560
- editModalOpen: n,
1561
- handleEdit: () => {
1562
- r(!0);
1563
- },
1564
- handleCloseEditModal: () => {
1565
- r(!1);
1566
- },
1567
- handleUpdate: async (e, t) => {
1568
- await c.mutateAsync({
1569
- project_id: i,
1570
- securityGroupId: e,
1571
- ...t
1572
- });
1573
- },
1574
- handleDeleteRule: async (e) => {
1575
- await l.mutateAsync({
1576
- project_id: i,
1577
- ruleId: e
1578
- });
1579
- },
1580
- handleCreateRule: async (e) => {
1581
- await u.mutateAsync({
1582
- project_id: i,
1583
- ...e
1584
- });
1585
- }
1586
- };
1587
- }
1588
- //#endregion
1589
- //#region src/client/utils/useListWithFiltering.ts
1590
- function Me({ defaultSortKey: e, defaultSortDir: t, sortOptions: n, filterSettings: r }) {
1591
- let [i, a] = G(""), o = (e) => {
1592
- let t = typeof e == "string" ? e : "";
1593
- V(() => a(t));
1594
- }, [s, c] = G({
1595
- options: n,
1596
- sortBy: e,
1597
- sortDirection: t
1598
- }), l = (n) => {
1599
- let r = {
1600
- options: n.options ?? s.options,
1601
- sortBy: n.sortBy?.toString() || e,
1602
- sortDirection: n.sortDirection || t
1603
- };
1604
- c(r);
1605
- }, [u, d] = G(r);
1606
- return {
1607
- searchTerm: i,
1608
- sortSettings: s,
1609
- filterSettings: u,
1610
- handleSearchChange: o,
1611
- handleSortChange: l,
1612
- handleFilterChange: (e) => {
1613
- V(() => d(e));
1614
- }
1615
- };
1616
- }
1617
- //#endregion
1618
- //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/index.tsx?tsr-split=component
1619
- function Ne() {
1620
- let { securityGroupId: e } = A.useParams(), { trpcClient: t } = A.useRouteContext(), n = j(), r = K(), { i18n: i, _: o } = J();
1621
- if (!t) throw Error("trpcClient is not available in route context");
1622
- let { permissions: s, isLoading: c, isError: l } = ee(n), { searchTerm: u, sortSettings: m, filterSettings: h, handleSearchChange: g, handleSortChange: _, handleFilterChange: v } = Me({
1623
- defaultSortKey: "direction",
1624
- defaultSortDir: "asc",
1625
- sortOptions: [
1626
- {
1627
- label: i._({ id: "MRB7nI" }),
1628
- value: "direction"
1629
- },
1630
- {
1631
- label: i._({ id: "6+OdGi" }),
1632
- value: "protocol"
1633
- },
1634
- {
1635
- label: i._({ id: "Nu4oKW" }),
1636
- value: "description"
1637
- }
1638
- ],
1639
- filterSettings: { filters: [
1640
- {
1641
- displayName: i._({ id: "MRB7nI" }),
1642
- filterName: "direction",
1643
- values: ["ingress", "egress"],
1644
- supportsMultiValue: !1
1645
- },
1646
- {
1647
- displayName: i._({ id: "yp0UjB" }),
1648
- filterName: "ethertype",
1649
- values: ["IPv4", "IPv6"],
1650
- supportsMultiValue: !1
1651
- },
1652
- {
1653
- displayName: i._({ id: "6+OdGi" }),
1654
- filterName: "protocol",
1655
- values: [
1656
- "tcp",
1657
- "udp",
1658
- "icmp",
1659
- "ipv6-icmp"
1660
- ],
1661
- supportsMultiValue: !1
1662
- }
1663
- ] }
1664
- }), b = {
1665
- searchTerm: u,
1666
- onSearchChange: g,
1667
- sortSettings: m,
1668
- onSortChange: _,
1669
- filterSettings: h,
1670
- onFilterChange: v
1671
- }, { securityGroup: x, filteredAndSortedRules: C, isLoading: w, isError: T, error: E, isUpdating: D, updateError: O, isDeletingRule: M, deleteRuleError: N, isCreatingRule: P, createRuleError: F, editModalOpen: I, handleEdit: R, handleCloseEditModal: V, handleUpdate: H, handleDeleteRule: W, handleCreateRule: G } = je({
1672
- securityGroupId: e,
1673
- filterControls: b
1674
- }), { data: Y } = k.network.securityGroup.list.useQuery({ project_id: n }), X = U(() => (Y || []).filter((t) => t.id !== e).map((e) => ({
1675
- id: e.id,
1676
- name: e.name || e.id
1677
- })), [Y, e]), Z = () => {
1678
- r({
1679
- to: "/projects/$projectId/network/securitygroups",
1680
- params: { projectId: n }
1681
- });
1682
- };
1683
- if (c) return /*#__PURE__*/ B(f, {
1684
- className: "fixed inset-0",
1685
- distribution: "center",
1686
- alignment: "center",
1687
- direction: "vertical",
1688
- children: [/*#__PURE__*/ z(d, {
1689
- variant: "primary",
1690
- size: "large",
1691
- className: "mb-2"
1692
- }), /*#__PURE__*/ z(q, { id: "EpWoJ9" })]
1693
- });
1694
- let te = l ? {
1695
- canView: !1,
1696
- canCreate: !1,
1697
- canUpdate: !1,
1698
- canDelete: !1,
1699
- canCreateRule: !1,
1700
- canDeleteRule: !1,
1701
- canManageAccess: !1,
1702
- canViewRBAC: !1
1703
- } : s;
1704
- if (w) return /*#__PURE__*/ B(f, {
1705
- className: "fixed inset-0",
1706
- distribution: "center",
1707
- alignment: "center",
1708
- direction: "vertical",
1709
- children: [/*#__PURE__*/ z(d, {
1710
- variant: "primary",
1711
- size: "large",
1712
- className: "mb-2"
1713
- }), /*#__PURE__*/ z(q, { id: "3x7Sws" })]
1714
- });
1715
- if (T) {
1716
- let e = E?.message || "Unknown error";
1717
- return /*#__PURE__*/ B(f, {
1718
- className: "fixed inset-0",
1719
- distribution: "center",
1720
- alignment: "center",
1721
- direction: "vertical",
1722
- gap: "5",
1723
- children: [
1724
- /*#__PURE__*/ z("p", {
1725
- className: "text-theme-error font-semibold",
1726
- children: /*#__PURE__*/ z(q, { id: "FjPnAE" })
1727
- }),
1728
- /*#__PURE__*/ z("p", {
1729
- className: "text-theme-highest",
1730
- children: e
1731
- }),
1732
- /*#__PURE__*/ z(p, {
1733
- onClick: Z,
1734
- variant: "primary",
1735
- children: /*#__PURE__*/ z(q, { id: "U9q4M7" })
1736
- })
1737
- ]
1738
- });
1739
- }
1740
- return x ? /*#__PURE__*/ B(f, {
1741
- direction: "vertical",
1742
- children: [
1743
- /*#__PURE__*/ z(y, { children: x.name || x.id }),
1744
- /*#__PURE__*/ B(S, {
1745
- className: "my-6",
1746
- children: [/*#__PURE__*/ z(a, {
1747
- onClick: Z,
1748
- label: i._({ id: "4opp4r" })
1749
- }), /*#__PURE__*/ z(a, {
1750
- active: !0,
1751
- label: x.id
1752
- })]
1753
- }),
1754
- /*#__PURE__*/ z(Ae, {
1755
- securityGroup: x,
1756
- filteredAndSortedRules: C,
1757
- onEdit: R,
1758
- onDeleteRule: W,
1759
- isDeletingRule: M,
1760
- deleteRuleError: N,
1761
- filterControls: b,
1762
- onCreateRule: G,
1763
- isCreatingRule: P,
1764
- createRuleError: F,
1765
- availableSecurityGroups: X,
1766
- currentProjectId: n,
1767
- permissions: te
1768
- }),
1769
- /*#__PURE__*/ z(L, {
1770
- securityGroup: x,
1771
- open: I,
1772
- onClose: V,
1773
- onUpdate: H,
1774
- isLoading: D,
1775
- error: O
1776
- })
1777
- ]
1778
- }) : /*#__PURE__*/ B(f, {
1779
- className: "fixed inset-0",
1780
- distribution: "center",
1781
- alignment: "center",
1782
- direction: "vertical",
1783
- gap: "5",
1784
- children: [/*#__PURE__*/ z("p", {
1785
- className: "text-theme-secondary",
1786
- children: /*#__PURE__*/ z(q, { id: "Zw8Q49" })
1787
- }), /*#__PURE__*/ z(p, {
1788
- onClick: Z,
1789
- variant: "primary",
1790
- children: /*#__PURE__*/ z(q, { id: "U9q4M7" })
1791
- })]
1792
- });
1793
- }
1794
- //#endregion
1795
- export { Ne as component };
1796
-
1797
- //# sourceMappingURL=_securityGroupId-pPtJsCoe.mjs.map