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