@cobaltcore-dev/aurora 0.21.0 → 0.23.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 (134) hide show
  1. package/dist/client/{AuthProvider-p1e1DuKU.mjs → AuthProvider-CQ6Yppoh.mjs} +2 -2
  2. package/dist/client/{AuthProvider-p1e1DuKU.mjs.map → AuthProvider-CQ6Yppoh.mjs.map} +1 -1
  3. package/dist/client/{BucketToastNotifications-BGd2wVmh.mjs → BucketToastNotifications-BhPi4WWw.mjs} +3 -3
  4. package/dist/client/{BucketToastNotifications-BGd2wVmh.mjs.map → BucketToastNotifications-BhPi4WWw.mjs.map} +1 -1
  5. package/dist/client/{ContentHeader-CIAzorGI.mjs → ContentHeader-9KZdhOoA.mjs} +4 -3
  6. package/dist/client/{ContentHeader-CIAzorGI.mjs.map → ContentHeader-9KZdhOoA.mjs.map} +1 -1
  7. package/dist/client/{DeleteFlavorModal-lFMExcq_.mjs → DeleteFlavorModal-Be2qZo4w.mjs} +2 -2
  8. package/dist/client/{DeleteFlavorModal-lFMExcq_.mjs.map → DeleteFlavorModal-Be2qZo4w.mjs.map} +1 -1
  9. package/dist/client/{DeletePcaModal-Dg9dej-H.mjs → DeletePcaModal-CIFsGWyj.mjs} +4 -4
  10. package/dist/client/{DeletePcaModal-Dg9dej-H.mjs.map → DeletePcaModal-CIFsGWyj.mjs.map} +1 -1
  11. package/dist/client/{DetailsInfo-DwCo9P1o.mjs → DetailsInfo-CHVD7d-W.mjs} +3 -3
  12. package/dist/client/{DetailsInfo-DwCo9P1o.mjs.map → DetailsInfo-CHVD7d-W.mjs.map} +1 -1
  13. package/dist/client/{FiltersInput-cOaaRpcQ.mjs → FiltersInput-DqT08Ib-.mjs} +2 -2
  14. package/dist/client/{FiltersInput-cOaaRpcQ.mjs.map → FiltersInput-DqT08Ib-.mjs.map} +1 -1
  15. package/dist/client/{FloatingIpActionModals-CDF8LVtX.mjs → FloatingIpActionModals-BcceUHcg.mjs} +4 -4
  16. package/dist/client/{FloatingIpActionModals-CDF8LVtX.mjs.map → FloatingIpActionModals-BcceUHcg.mjs.map} +1 -1
  17. package/dist/client/{ImageToastNotifications-Dzq6jNTm.mjs → ImageToastNotifications-BGyX2J6j.mjs} +5 -5
  18. package/dist/client/ImageToastNotifications-BGyX2J6j.mjs.map +1 -0
  19. package/dist/client/{RouteError-BmZRk_ss.mjs → RouteError-Rm08PcxN.mjs} +2 -2
  20. package/dist/client/{RouteError-BmZRk_ss.mjs.map → RouteError-Rm08PcxN.mjs.map} +1 -1
  21. package/dist/client/Slot-CWb612-_.mjs +28 -0
  22. package/dist/client/Slot-CWb612-_.mjs.map +1 -0
  23. package/dist/client/{SortInput-DjaEHvcO.mjs → SortInput-D_q_jDfe.mjs} +2 -2
  24. package/dist/client/{SortInput-DjaEHvcO.mjs.map → SortInput-D_q_jDfe.mjs.map} +1 -1
  25. package/dist/client/{StatusError-CLB026fg.mjs → StatusError-2ZU1gFpu.mjs} +2 -2
  26. package/dist/client/{StatusError-CLB026fg.mjs.map → StatusError-2ZU1gFpu.mjs.map} +1 -1
  27. package/dist/client/{_auth-Dut7CaMR.mjs → _auth-D5_QNUos.mjs} +2 -2
  28. package/dist/client/{_auth-Dut7CaMR.mjs.map → _auth-D5_QNUos.mjs.map} +1 -1
  29. package/dist/client/{_flavorId-Cu1nWwOq.mjs → _flavorId-BsmqS9hP.mjs} +7 -7
  30. package/dist/client/{_flavorId-Cu1nWwOq.mjs.map → _flavorId-BsmqS9hP.mjs.map} +1 -1
  31. package/dist/client/{_flavorId-BsIWL0XK.mjs → _flavorId-CFmkmg2Y.mjs} +2 -2
  32. package/dist/client/{_flavorId-BsIWL0XK.mjs.map → _flavorId-CFmkmg2Y.mjs.map} +1 -1
  33. package/dist/client/{_floatingIpId-B_M3gyMA.mjs → _floatingIpId-Bb9ZEJ6b.mjs} +6 -6
  34. package/dist/client/{_floatingIpId-B_M3gyMA.mjs.map → _floatingIpId-Bb9ZEJ6b.mjs.map} +1 -1
  35. package/dist/client/{_floatingIpId-8-UPUV8M.mjs → _floatingIpId-Dzh6_JCI.mjs} +2 -2
  36. package/dist/client/{_floatingIpId-8-UPUV8M.mjs.map → _floatingIpId-Dzh6_JCI.mjs.map} +1 -1
  37. package/dist/client/{_imageId-D1Z0xIco.mjs → _imageId-C3As7sHE.mjs} +5 -5
  38. package/dist/client/{_imageId-D1Z0xIco.mjs.map → _imageId-C3As7sHE.mjs.map} +1 -1
  39. package/dist/client/{_pcaId-BcwGho7g.mjs → _pcaId-n0q0aDb6.mjs} +6 -6
  40. package/dist/client/{_pcaId-BcwGho7g.mjs.map → _pcaId-n0q0aDb6.mjs.map} +1 -1
  41. package/dist/client/{_projectId-DJLjspKf.mjs → _projectId-BuBIFdgG.mjs} +25 -24
  42. package/dist/client/{_projectId-DJLjspKf.mjs.map → _projectId-BuBIFdgG.mjs.map} +1 -1
  43. package/dist/client/{_projectId-B4ScifQf.mjs → _projectId-CAQkJHZ4.mjs} +3 -3
  44. package/dist/client/{_projectId-B4ScifQf.mjs.map → _projectId-CAQkJHZ4.mjs.map} +1 -1
  45. package/dist/client/_projectId-D-b7paXE.mjs +29 -0
  46. package/dist/client/_projectId-D-b7paXE.mjs.map +1 -0
  47. package/dist/client/{_projectId-CYq4KZXB.mjs → _projectId-DNZsNxJw.mjs} +4 -4
  48. package/dist/client/{_projectId-CYq4KZXB.mjs.map → _projectId-DNZsNxJw.mjs.map} +1 -1
  49. package/dist/client/{_securityGroupId-B5-gJe1u.mjs → _securityGroupId-DFdNKa2l.mjs} +641 -504
  50. package/dist/client/_securityGroupId-DFdNKa2l.mjs.map +1 -0
  51. package/dist/client/{_securityGroupId-fPJWtDPU.mjs → _securityGroupId-DRkY3Gt6.mjs} +2 -2
  52. package/dist/client/_securityGroupId-DRkY3Gt6.mjs.map +1 -0
  53. package/dist/client/{_storageType-BkhbKG_G.mjs → _storageType-BKfQcpgp.mjs} +2 -2
  54. package/dist/client/{_storageType-BkhbKG_G.mjs.map → _storageType-BKfQcpgp.mjs.map} +1 -1
  55. package/dist/client/{_storageType-ByLL106s.mjs → _storageType-sMj9NEJz.mjs} +7 -7
  56. package/dist/client/{_storageType-ByLL106s.mjs.map → _storageType-sMj9NEJz.mjs.map} +1 -1
  57. package/dist/client/{about-B4sGnxeW.mjs → about-C8tTrQaW.mjs} +2 -2
  58. package/dist/client/{about-B4sGnxeW.mjs.map → about-C8tTrQaW.mjs.map} +1 -1
  59. package/dist/client/assets/objectDownload.worker-BAc5Au4B.js.map +1 -0
  60. package/dist/client/{aurora-Dp_NPGe8.mjs → aurora-jyvXcI4T.mjs} +2 -2
  61. package/dist/client/{aurora-Dp_NPGe8.mjs.map → aurora-jyvXcI4T.mjs.map} +1 -1
  62. package/dist/client/{build-DgeVmENN.mjs → build-CRLQyqu2.mjs} +2616 -3346
  63. package/dist/client/{build-DgeVmENN.mjs.map → build-CRLQyqu2.mjs.map} +1 -1
  64. package/dist/client/{flavors-CT1bHP61.mjs → flavors-BfTXqmoD.mjs} +6 -6
  65. package/dist/client/{flavors-CT1bHP61.mjs.map → flavors-BfTXqmoD.mjs.map} +1 -1
  66. package/dist/client/{flavors-q1j-y3e-.mjs → flavors-Dy-2mRGv.mjs} +2 -2
  67. package/dist/client/{flavors-q1j-y3e-.mjs.map → flavors-Dy-2mRGv.mjs.map} +1 -1
  68. package/dist/client/floatingips-zhNK6Xxn.mjs +562 -0
  69. package/dist/client/floatingips-zhNK6Xxn.mjs.map +1 -0
  70. package/dist/client/{hooks-D0wGUhRF.mjs → hooks-Bw3sHHOg.mjs} +2 -2
  71. package/dist/client/{hooks-D0wGUhRF.mjs.map → hooks-Bw3sHHOg.mjs.map} +1 -1
  72. package/dist/client/{images-CPYewah0.mjs → images-DPKUXryV.mjs} +2 -2
  73. package/dist/client/{images-CPYewah0.mjs.map → images-DPKUXryV.mjs.map} +1 -1
  74. package/dist/client/{images-BklcxYWi.mjs → images-DhZnqUG_.mjs} +29 -29
  75. package/dist/client/images-DhZnqUG_.mjs.map +1 -0
  76. package/dist/client/images-NBf2bV43.mjs.map +1 -1
  77. package/dist/client/index.js +301 -309
  78. package/dist/client/index.js.map +1 -1
  79. package/dist/client/{objects-DvIxpzGI.mjs → objects-BG1saVLZ.mjs} +1153 -862
  80. package/dist/client/objects-BG1saVLZ.mjs.map +1 -0
  81. package/dist/client/{objects-CEBrL7k-.mjs → objects-Dahys529.mjs} +2 -2
  82. package/dist/client/{objects-CEBrL7k-.mjs.map → objects-Dahys529.mjs.map} +1 -1
  83. package/dist/client/{pca-Ddk0YfgK.mjs → pca-B60iWWfG.mjs} +7 -7
  84. package/dist/client/{pca-Ddk0YfgK.mjs.map → pca-B60iWWfG.mjs.map} +1 -1
  85. package/dist/client/{pca-BAuZA0K3.mjs → pca-D0kKxHp4.mjs} +2 -2
  86. package/dist/client/{pca-BAuZA0K3.mjs.map → pca-D0kKxHp4.mjs.map} +1 -1
  87. package/dist/client/projects-yiK0HGSA.mjs.map +1 -1
  88. package/dist/client/routeInfo-CdTRlSxv.mjs +32 -0
  89. package/dist/client/routeInfo-CdTRlSxv.mjs.map +1 -0
  90. package/dist/client/{routes-BzBTVAjK.mjs → routes-BOf-GDMM.mjs} +41 -34
  91. package/dist/client/routes-BOf-GDMM.mjs.map +1 -0
  92. package/dist/client/{routes-DsisKFfG.mjs → routes-CtfnI-aY.mjs} +2 -2
  93. package/dist/client/routes-CtfnI-aY.mjs.map +1 -0
  94. package/dist/client/securitygroups-B8aLyFK7.mjs +17 -0
  95. package/dist/client/securitygroups-B8aLyFK7.mjs.map +1 -0
  96. package/dist/client/securitygroups-DRhFle2O.mjs +589 -0
  97. package/dist/client/securitygroups-DRhFle2O.mjs.map +1 -0
  98. package/dist/client/trpcClient-Di56hpVv.mjs +71 -0
  99. package/dist/client/trpcClient-Di56hpVv.mjs.map +1 -0
  100. package/dist/client/trpcClient.d.ts +40 -4
  101. package/dist/client/useListWithFiltering-aPTUNRaW.mjs +32 -0
  102. package/dist/client/useListWithFiltering-aPTUNRaW.mjs.map +1 -0
  103. package/dist/client/useSecurityGroupPermissions-BPS1ibWq.mjs +161 -0
  104. package/dist/client/useSecurityGroupPermissions-BPS1ibWq.mjs.map +1 -0
  105. package/dist/server/index.d.ts +56 -53
  106. package/dist/server/index.js +297 -20
  107. package/package.json +15 -15
  108. package/dist/client/EditSecurityGroupModal-BGPXglju.mjs +0 -137
  109. package/dist/client/EditSecurityGroupModal-BGPXglju.mjs.map +0 -1
  110. package/dist/client/ImageToastNotifications-Dzq6jNTm.mjs.map +0 -1
  111. package/dist/client/_projectId-DxgPaiA7.mjs +0 -25
  112. package/dist/client/_projectId-DxgPaiA7.mjs.map +0 -1
  113. package/dist/client/_securityGroupId-B5-gJe1u.mjs.map +0 -1
  114. package/dist/client/_securityGroupId-fPJWtDPU.mjs.map +0 -1
  115. package/dist/client/buildFilterParams-DoZzMKX9.mjs +0 -15
  116. package/dist/client/buildFilterParams-DoZzMKX9.mjs.map +0 -1
  117. package/dist/client/floatingips-DC5OrR8h.mjs +0 -434
  118. package/dist/client/floatingips-DC5OrR8h.mjs.map +0 -1
  119. package/dist/client/images-B5ktfqg6.mjs +0 -8
  120. package/dist/client/images-B5ktfqg6.mjs.map +0 -1
  121. package/dist/client/images-BklcxYWi.mjs.map +0 -1
  122. package/dist/client/objects-DvIxpzGI.mjs.map +0 -1
  123. package/dist/client/projects-DvSiI5Vg.mjs +0 -12
  124. package/dist/client/projects-DvSiI5Vg.mjs.map +0 -1
  125. package/dist/client/routeInfo-Ct5r4Gen.mjs +0 -56
  126. package/dist/client/routeInfo-Ct5r4Gen.mjs.map +0 -1
  127. package/dist/client/routes-BzBTVAjK.mjs.map +0 -1
  128. package/dist/client/routes-DsisKFfG.mjs.map +0 -1
  129. package/dist/client/securitygroups-JMvcJLpb.mjs +0 -440
  130. package/dist/client/securitygroups-JMvcJLpb.mjs.map +0 -1
  131. package/dist/client/trpcClient-BxcNKnhv.mjs +0 -65
  132. package/dist/client/trpcClient-BxcNKnhv.mjs.map +0 -1
  133. package/dist/client/useListWithFiltering-BuhE81I6.mjs +0 -157
  134. package/dist/client/useListWithFiltering-BuhE81I6.mjs.map +0 -1
@@ -0,0 +1,589 @@
1
+ import { A as e, B as t, E as n, G as r, H as i, K as a, P as o, R as s, U as c, Y as l, at as u, c as d, ct as f, et as p, g as m, lt as h, n as g, o as _, r as v, rt as y, tt as b, ut as x, y as S } from "./build-CRLQyqu2.mjs";
2
+ import { a as C } from "./trpcClient-Di56hpVv.mjs";
3
+ import { t as w } from "./securitygroups-B8aLyFK7.mjs";
4
+ import { t as T } from "./useProjectId-DBc5lpoU.mjs";
5
+ import "./hooks-Bw3sHHOg.mjs";
6
+ import { t as E } from "./SortInput-D_q_jDfe.mjs";
7
+ import { n as D, t as O } from "./FiltersInput-DqT08Ib-.mjs";
8
+ import { n as ee, t as k } from "./useSecurityGroupPermissions-BPS1ibWq.mjs";
9
+ import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
10
+ import { useEffect as N, useRef as P, useState as F } from "react";
11
+ import { useNavigate as I, useSearch as L } from "@tanstack/react-router";
12
+ import { Trans as R, useLingui as z } from "@lingui/react";
13
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/-components/-modals/DeleteSecurityGroupDialog.tsx
14
+ var B = ({ isOpen: e, onClose: n, securityGroup: r, onDelete: i, isDeleting: a = !1, error: o = null }) => {
15
+ let { i18n: s, _: l } = z(), [u, d] = F(""), f = s._({ id: "HNlEFZ" }), p = u.toLowerCase() === f.toLowerCase(), h = r.name || r.id, g = (e) => {
16
+ e.preventDefault(), p && !a && i(r.id);
17
+ }, _ = () => {
18
+ d(""), n();
19
+ };
20
+ return /*#__PURE__*/ j(v, {
21
+ open: e,
22
+ onCancel: _,
23
+ size: "small",
24
+ title: s._({
25
+ id: "Y+2SDm",
26
+ values: { securityGroupName: h }
27
+ }),
28
+ modalFooter: /*#__PURE__*/ j(m, {
29
+ className: "flex justify-end",
30
+ children: /*#__PURE__*/ M(x, { children: [/*#__PURE__*/ j(S, {
31
+ variant: "default",
32
+ onClick: _,
33
+ disabled: a,
34
+ children: /*#__PURE__*/ j(R, { id: "dEgA5A" })
35
+ }), /*#__PURE__*/ j(S, {
36
+ variant: "primary-danger",
37
+ onClick: g,
38
+ disabled: !p || a,
39
+ "data-testid": "confirm-delete-button",
40
+ children: a ? /*#__PURE__*/ j(R, { id: "EF2EU9" }) : /*#__PURE__*/ j(R, { id: "cnGeoo" })
41
+ })] })
42
+ }),
43
+ children: /*#__PURE__*/ M("div", { children: [
44
+ o && /*#__PURE__*/ j(t, {
45
+ dismissible: !1,
46
+ variant: "error",
47
+ className: "mt-4",
48
+ children: o
49
+ }),
50
+ /*#__PURE__*/ j(R, { id: "Qb+14I" }),
51
+ /*#__PURE__*/ M("div", {
52
+ className: "mt-4",
53
+ children: [/*#__PURE__*/ j("p", {
54
+ className: "mb-2 text-sm",
55
+ children: /*#__PURE__*/ j(R, {
56
+ id: "hLp49h",
57
+ values: { deleteWord: f },
58
+ components: { 0: /*#__PURE__*/ j("strong", {}) }
59
+ })
60
+ }), /*#__PURE__*/ j(c, {
61
+ id: "confirmation",
62
+ name: "confirmation",
63
+ value: u,
64
+ onChange: (e) => d(e.target.value),
65
+ placeholder: f,
66
+ disabled: a,
67
+ autoComplete: "off",
68
+ "data-testid": "delete-confirmation-input"
69
+ })]
70
+ })
71
+ ] })
72
+ });
73
+ };
74
+ //#endregion
75
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/-components/SecurityGroupTableRow.tsx
76
+ function V({ securityGroup: t, permissions: i, onEdit: a, onDelete: o, onViewDetails: s, isReadOnly: c = !1, showSelectColumn: l = !1, isSelected: d = !1, onSelect: f }) {
77
+ let { i18n: p, _: m } = z(), g = ({ value: e }) => /*#__PURE__*/ j("span", { children: e ? p._({ id: "l75CjT" }) : p._({ id: "1UzENP" }) }), _ = () => {
78
+ s && s(t);
79
+ };
80
+ return /*#__PURE__*/ M(n, {
81
+ "data-testid": `security-group-row-${t.id}`,
82
+ onClick: _,
83
+ className: "hover:bg-theme-background-lvl-2 cursor-pointer",
84
+ children: [
85
+ l && /*#__PURE__*/ j(r, {
86
+ onClick: (e) => e.stopPropagation(),
87
+ children: /*#__PURE__*/ j(h, {
88
+ checked: d,
89
+ onChange: () => f?.(t)
90
+ })
91
+ }),
92
+ /*#__PURE__*/ j(r, { children: /*#__PURE__*/ M("div", { children: [/*#__PURE__*/ j("p", {
93
+ className: "text-md",
94
+ children: t.name
95
+ }), /*#__PURE__*/ j("p", {
96
+ className: "text-theme-light text-xs",
97
+ children: t.id
98
+ })] }) }),
99
+ /*#__PURE__*/ j(r, { children: t.description || p._({ id: "h47p9L" }) }),
100
+ /*#__PURE__*/ M(r, { children: [/*#__PURE__*/ j(g, { value: t.shared }), t.shared && /*#__PURE__*/ M("p", { children: [
101
+ /*#__PURE__*/ j(R, { id: "LtI9AS" }),
102
+ ": ",
103
+ /*#__PURE__*/ j("span", {
104
+ className: "text-theme-light text-xs",
105
+ children: t.project_id
106
+ })
107
+ ] })] }),
108
+ /*#__PURE__*/ j(r, { children: /*#__PURE__*/ j(g, { value: t.stateful }) }),
109
+ /*#__PURE__*/ j(r, {
110
+ onClick: (e) => e.stopPropagation(),
111
+ className: "items-end justify-end pr-0",
112
+ children: /*#__PURE__*/ j(y, { children: /*#__PURE__*/ M(e, { children: [
113
+ /*#__PURE__*/ j(u, {
114
+ label: p._({ id: "v0hPHE" }),
115
+ onClick: () => _()
116
+ }),
117
+ i.canUpdate && !c && /*#__PURE__*/ j(u, {
118
+ label: p._({ id: "ePK91l" }),
119
+ onClick: () => a(t)
120
+ }),
121
+ i.canDelete && !c && /*#__PURE__*/ j(u, {
122
+ label: p._({ id: "cnGeoo" }),
123
+ onClick: () => o(t)
124
+ })
125
+ ] }) })
126
+ })
127
+ ]
128
+ }, t.id);
129
+ }
130
+ //#endregion
131
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/-components/SecurityGroupListContainer.tsx
132
+ var H = ({ securityGroups: e, isLoading: t, isError: r, error: i, permissions: c, onDeleteSecurityGroup: l, isDeletingSecurityGroup: u = !1, deleteError: d = null, onUpdateSecurityGroup: f, isUpdatingSecurityGroup: p = !1, updateError: m = null, currentProjectId: h, hasAnyBulkAction: g = !1, onClearUpdateError: _ }) => {
133
+ let { i18n: v, _: y } = z(), x = I(), S = T(), [C, w] = F(null), [E, D] = F(!1), [O, k] = F(!1), L = P(!1), H = P(!1), U = (e) => {
134
+ C && C.id !== e.id && _ && _(), w(e), D(!0);
135
+ }, W = (e) => {
136
+ w(e), k(!0);
137
+ }, G = (e) => {
138
+ x({
139
+ to: "/projects/$projectId/network/securitygroups/$securityGroupId",
140
+ params: {
141
+ projectId: S,
142
+ securityGroupId: e.id
143
+ }
144
+ });
145
+ }, K = () => {
146
+ w(null), D(!1);
147
+ }, q = () => {
148
+ w(null), k(!1);
149
+ };
150
+ return N(() => {
151
+ L.current && !u && O && !d && q(), L.current = u;
152
+ }, [
153
+ u,
154
+ d,
155
+ O
156
+ ]), N(() => {
157
+ H.current && !p && E && !m && K(), H.current = p;
158
+ }, [
159
+ p,
160
+ m,
161
+ E
162
+ ]), t ? /*#__PURE__*/ M(b, {
163
+ className: "py-8",
164
+ distribution: "center",
165
+ alignment: "center",
166
+ direction: "vertical",
167
+ children: [/*#__PURE__*/ j(a, {
168
+ variant: "primary",
169
+ size: "large",
170
+ className: "mb-2"
171
+ }), /*#__PURE__*/ j(R, { id: "Z3FXyt" })]
172
+ }) : r ? /*#__PURE__*/ j(b, {
173
+ className: "py-8",
174
+ distribution: "center",
175
+ alignment: "center",
176
+ direction: "vertical",
177
+ children: i?.message ?? v._({ id: "Wca9WC" })
178
+ }) : e.length === 0 ? /*#__PURE__*/ j(R, { id: "SfW/3r" }) : /*#__PURE__*/ M(A, { children: [/*#__PURE__*/ M(o, {
179
+ columns: g ? 6 : 5,
180
+ children: [/*#__PURE__*/ M(n, { children: [g && /*#__PURE__*/ j(s, {}), [
181
+ v._({ id: "6YtxFj" }),
182
+ v._({ id: "Nu4oKW" }),
183
+ v._({ id: "0Gd0NU" }),
184
+ v._({ id: "Jim5X9" }),
185
+ ""
186
+ ].map((e) => /*#__PURE__*/ j(s, { children: e }, e))] }), e.map((e) => /*#__PURE__*/ j(V, {
187
+ securityGroup: e,
188
+ permissions: c,
189
+ onEdit: U,
190
+ onDelete: W,
191
+ onViewDetails: G,
192
+ isReadOnly: !!(h && e.project_id && e.project_id !== h),
193
+ showSelectColumn: g,
194
+ isSelected: !1,
195
+ onSelect: () => {}
196
+ }, e.id))]
197
+ }), C && /*#__PURE__*/ M(A, { children: [/*#__PURE__*/ j(ee, {
198
+ securityGroup: C,
199
+ open: E,
200
+ onClose: K,
201
+ onUpdate: (e, t) => f ? f(e, t) : Promise.resolve(),
202
+ isLoading: p,
203
+ error: m
204
+ }), /*#__PURE__*/ j(B, {
205
+ securityGroup: C,
206
+ isOpen: O,
207
+ onClose: q,
208
+ onDelete: (e) => {
209
+ l && l(e);
210
+ },
211
+ isDeleting: u,
212
+ error: d
213
+ })] })] });
214
+ }, U = {
215
+ name: "",
216
+ description: "",
217
+ stateful: !0
218
+ }, W = ({ isOpen: e, onClose: n, onCreate: r, isLoading: o = !1, error: s = null }) => {
219
+ let { i18n: l, _: u } = z(), [f, g] = F({ ...U }), [y, b] = F({}), C = (e) => {
220
+ let { name: t, value: n, type: r } = e.target, i = e.target.checked;
221
+ g((e) => ({
222
+ ...e,
223
+ [t]: r === "checkbox" ? i : n
224
+ })), y[t] && b((e) => {
225
+ let n = { ...e };
226
+ return delete n[t], n;
227
+ });
228
+ }, w = () => {
229
+ let e = {};
230
+ return (!f.name || f.name.trim() === "") && (e.name = l._({ id: "lN/Z9n" })), b(e), Object.keys(e).length === 0;
231
+ }, T = async (e) => {
232
+ e.preventDefault(), w() && (await r({
233
+ name: f.name.trim(),
234
+ description: f.description.trim() || void 0,
235
+ stateful: f.stateful
236
+ }), E());
237
+ }, E = () => {
238
+ g({ ...U }), b({}), n();
239
+ };
240
+ return /*#__PURE__*/ M(v, {
241
+ open: e,
242
+ onCancel: E,
243
+ size: "large",
244
+ title: l._({ id: "YjAOtb" }),
245
+ modalFooter: /*#__PURE__*/ j(m, {
246
+ className: "flex justify-end",
247
+ children: /*#__PURE__*/ M(x, { children: [/*#__PURE__*/ j(S, {
248
+ variant: "default",
249
+ onClick: E,
250
+ disabled: o,
251
+ children: /*#__PURE__*/ j(R, { id: "dEgA5A" })
252
+ }), /*#__PURE__*/ j(S, {
253
+ variant: "primary",
254
+ onClick: (e) => {
255
+ T(e);
256
+ },
257
+ disabled: o,
258
+ "data-testid": "create-security-group-button",
259
+ children: o ? /*#__PURE__*/ j(a, { size: "small" }) : /*#__PURE__*/ j(R, { id: "YjAOtb" })
260
+ })] })
261
+ }),
262
+ children: [
263
+ s && /*#__PURE__*/ j(t, {
264
+ dismissible: !1,
265
+ variant: "error",
266
+ className: "mb-4",
267
+ children: s
268
+ }),
269
+ o && /*#__PURE__*/ M("div", {
270
+ className: "mb-4 flex items-center justify-center gap-2",
271
+ children: [/*#__PURE__*/ j(a, { variant: "primary" }), /*#__PURE__*/ j("span", {
272
+ className: "text-theme-high text-sm",
273
+ children: /*#__PURE__*/ j(R, { id: "Km4AGG" })
274
+ })]
275
+ }),
276
+ !o && /*#__PURE__*/ j(_, {
277
+ className: "mb-6",
278
+ children: /*#__PURE__*/ M(i, {
279
+ className: "mb-6",
280
+ children: [
281
+ /*#__PURE__*/ j(d, {
282
+ className: "mb-6",
283
+ children: /*#__PURE__*/ j(c, {
284
+ id: "name",
285
+ name: "name",
286
+ label: l._({ id: "6YtxFj" }),
287
+ value: f.name,
288
+ onChange: C,
289
+ required: !0,
290
+ errortext: y.name,
291
+ placeholder: l._({ id: "Ac6dy9" }),
292
+ disabled: o
293
+ })
294
+ }),
295
+ /*#__PURE__*/ j(d, {
296
+ className: "mb-6",
297
+ children: /*#__PURE__*/ j(p, {
298
+ id: "description",
299
+ name: "description",
300
+ label: l._({ id: "Nu4oKW" }),
301
+ value: f.description,
302
+ onChange: C,
303
+ placeholder: l._({ id: "Nu4oKW" }),
304
+ disabled: o,
305
+ rows: 3
306
+ })
307
+ }),
308
+ /*#__PURE__*/ j(d, {
309
+ className: "mb-0",
310
+ children: /*#__PURE__*/ j(h, {
311
+ id: "stateful",
312
+ name: "stateful",
313
+ label: l._({ id: "Jim5X9" }),
314
+ checked: f.stateful,
315
+ onChange: C,
316
+ disabled: o,
317
+ helptext: l._({ id: "4cQTyf" })
318
+ })
319
+ })
320
+ ]
321
+ })
322
+ })
323
+ ]
324
+ });
325
+ }, G = (e) => {
326
+ let t = [];
327
+ return e.shared && t.push({
328
+ name: "shared",
329
+ value: e.shared
330
+ }), t;
331
+ }, K = (e, t) => {
332
+ let n = {};
333
+ if (!e?.length) return n;
334
+ let r = e.filter((e) => !e.inactive).reduce((e, t) => (e[t.name] || (e[t.name] = []), e[t.name].push(t.value), e), {});
335
+ return Object.entries(r).forEach(([e, r]) => {
336
+ t.find((t) => t.filterName === e)?.supportsMultiValue && r.length > 1 ? n[e] = `in:${r.join(",")}` : n[e] = r[0];
337
+ }), n;
338
+ }, q = (e, t, n) => e.some((e) => e.name === t.name && e.value === t.value) ? e : n.find((e) => e.filterName === t.name)?.supportsMultiValue ? [...e, t] : [...e.filter((e) => e.name !== t.name), t], te = (e, t, n) => {
339
+ let r = {
340
+ search: n.search,
341
+ sortBy: n.sortBy,
342
+ sortDirection: n.sortDirection
343
+ };
344
+ if (!e?.length) return r;
345
+ let i = e.filter((e) => !e.inactive).reduce((e, t) => (e[t.name] || (e[t.name] = []), e[t.name].push(t.value), e), {});
346
+ return Object.entries(i).forEach(([e, n]) => {
347
+ t.find((t) => t.filterName === e)?.supportsMultiValue && n.length > 1 ? r[e] = `in:${n.join(",")}` : r[e] = n[0];
348
+ }), r;
349
+ }, J = ({ project: e }) => {
350
+ let { i18n: t, _: n } = z(), r = I(), i = L({ strict: !1 }), [a, o] = F({
351
+ options: [{
352
+ label: t._({ id: "6YtxFj" }),
353
+ value: "name"
354
+ }, {
355
+ label: t._({ id: "podzPY" }),
356
+ value: "project_id"
357
+ }],
358
+ sortBy: i.sortBy || "name",
359
+ sortDirection: i.sortDirection || "asc"
360
+ }), [s, c] = F({
361
+ filters: [{
362
+ displayName: t._({ id: "0Gd0NU" }),
363
+ filterName: "shared",
364
+ values: ["true", "false"],
365
+ supportsMultiValue: !1
366
+ }],
367
+ selectedFilters: G(i)
368
+ }), [l, u] = F(i.search || ""), [d, p] = F(!1), [m, h] = F(null), [_, v] = F(null), [y, x] = F(null), w = C.useUtils();
369
+ N(() => {
370
+ o((e) => ({
371
+ ...e,
372
+ sortBy: i.sortBy || "name",
373
+ sortDirection: i.sortDirection || "asc"
374
+ })), c((e) => ({
375
+ ...e,
376
+ selectedFilters: G(i)
377
+ })), u(i.search || "");
378
+ }, [
379
+ i.sortBy,
380
+ i.sortDirection,
381
+ i.search,
382
+ i.shared
383
+ ]);
384
+ let T = G(i), ee = i.sortBy || "name", P = i.sortDirection || "asc", B = i.search || "", { data: V, isLoading: U, isError: J, error: Y } = C.network.securityGroup.list.useQuery({
385
+ project_id: e || "",
386
+ sort_key: ee,
387
+ sort_dir: P,
388
+ ...K(T, s.filters),
389
+ ...B ? { searchTerm: B } : {}
390
+ }, { refetchOnWindowFocus: !1 }), X = V || [], ne = J && Y?.data?.code === "FORBIDDEN" ? t._({ id: "MdfAJn" }) : null, { permissions: Z } = k(e), Q = C.network.securityGroup.create.useMutation({
391
+ onSuccess: (t) => {
392
+ w.network.securityGroup.list.invalidate(), w.network.securityGroup.getById.invalidate(), v(null), r({
393
+ to: "/projects/$projectId/network/securitygroups/$securityGroupId",
394
+ params: {
395
+ projectId: e,
396
+ securityGroupId: t.id
397
+ }
398
+ });
399
+ },
400
+ onError: (e) => {
401
+ v(e.message || t._({ id: "o6M6l0" }));
402
+ }
403
+ }), re = C.network.securityGroup.deleteById.useMutation({
404
+ onSuccess: () => {
405
+ w.network.securityGroup.list.invalidate(), w.network.securityGroup.getById.invalidate(), h(null);
406
+ },
407
+ onError: (e) => {
408
+ h(e.message || t._({ id: "d0pLfy" }));
409
+ }
410
+ }), ie = C.network.securityGroup.update.useMutation({
411
+ onSuccess: () => {
412
+ w.network.securityGroup.list.invalidate(), w.network.securityGroup.getById.invalidate(), x(null);
413
+ },
414
+ onError: (e) => {
415
+ x(e.message || t._({ id: "jPxavx" }));
416
+ }
417
+ }), ae = async (t) => {
418
+ v(null), await Q.mutateAsync({
419
+ project_id: e,
420
+ ...t
421
+ });
422
+ }, oe = (t) => {
423
+ h(null), re.mutate({
424
+ project_id: e,
425
+ securityGroupId: t
426
+ });
427
+ }, se = async (t, n) => {
428
+ x(null), await ie.mutateAsync({
429
+ project_id: e,
430
+ securityGroupId: t,
431
+ ...n
432
+ });
433
+ }, ce = () => {
434
+ x(null);
435
+ }, le = (e) => {
436
+ let t = {
437
+ options: e.options,
438
+ sortBy: e.sortBy?.toString() || "name",
439
+ sortDirection: e.sortDirection || "asc"
440
+ };
441
+ o(t), r({
442
+ search: (e) => ({
443
+ ...e,
444
+ sortBy: t.sortBy,
445
+ sortDirection: t.sortDirection
446
+ }),
447
+ replace: !0
448
+ });
449
+ }, $ = (e) => {
450
+ c(e), r({
451
+ search: (t) => te(e.selectedFilters || [], e.filters, {
452
+ search: t.search,
453
+ sortBy: t.sortBy,
454
+ sortDirection: t.sortDirection
455
+ }),
456
+ replace: !0
457
+ });
458
+ }, ue = (e) => {
459
+ let t = typeof e == "string" ? e : "";
460
+ u(t), r({
461
+ search: (e) => ({
462
+ ...e,
463
+ search: t || void 0
464
+ }),
465
+ replace: !0
466
+ });
467
+ };
468
+ return U ? /*#__PURE__*/ j(b, {
469
+ className: "py-8",
470
+ distribution: "center",
471
+ alignment: "center",
472
+ direction: "vertical",
473
+ children: /*#__PURE__*/ j(R, { id: "Z3FXyt" })
474
+ }) : J && !X.length ? /*#__PURE__*/ j(b, {
475
+ className: "py-8",
476
+ distribution: "center",
477
+ alignment: "center",
478
+ direction: "vertical",
479
+ children: ne || t._({ id: "Wca9WC" })
480
+ }) : /*#__PURE__*/ M(A, { children: [
481
+ /*#__PURE__*/ j(b, {
482
+ distribution: "end",
483
+ alignment: "center",
484
+ gap: "2",
485
+ className: "pb-2",
486
+ children: /*#__PURE__*/ M(b, {
487
+ gap: "2",
488
+ children: [/*#__PURE__*/ j(E, {
489
+ options: a.options,
490
+ sortBy: a.sortBy,
491
+ sortDirection: a.sortDirection ?? "asc",
492
+ onSortByChange: (e) => le({
493
+ ...a,
494
+ sortBy: e,
495
+ sortDirection: a.sortDirection
496
+ }),
497
+ onSortDirectionChange: (e) => le({
498
+ ...a,
499
+ sortDirection: e
500
+ })
501
+ }), Z.canCreate && /*#__PURE__*/ j(S, {
502
+ onClick: () => p(!0),
503
+ variant: "primary",
504
+ className: "whitespace-nowrap",
505
+ children: /*#__PURE__*/ j(R, { id: "YjAOtb" })
506
+ })]
507
+ })
508
+ }),
509
+ /*#__PURE__*/ j(f, { children: /*#__PURE__*/ M(b, {
510
+ direction: "vertical",
511
+ gap: "2",
512
+ children: [/*#__PURE__*/ M(b, {
513
+ distribution: "between",
514
+ alignment: "center",
515
+ children: [/*#__PURE__*/ j(O, {
516
+ filters: s.filters,
517
+ onChange: (e) => {
518
+ let t = q(s.selectedFilters || [], e, s.filters);
519
+ t !== (s.selectedFilters || []) && $({
520
+ ...s,
521
+ selectedFilters: t
522
+ });
523
+ }
524
+ }), /*#__PURE__*/ j(g, {
525
+ placeholder: t._({ id: "rp7Ili" }),
526
+ "data-testid": "searchbar",
527
+ value: l,
528
+ onInput: (e) => {
529
+ let t = e.currentTarget.value;
530
+ u(t);
531
+ },
532
+ onSearch: (e) => {
533
+ ue(typeof e == "string" ? e : "");
534
+ },
535
+ onClear: () => {
536
+ u(""), ue("");
537
+ }
538
+ })]
539
+ }), s.selectedFilters && s.selectedFilters.length > 0 && /*#__PURE__*/ j(D, {
540
+ selectedFilters: s.selectedFilters,
541
+ onDelete: (e) => $({
542
+ ...s,
543
+ selectedFilters: (s.selectedFilters || []).filter((t) => !(t.name === e.name && t.value === e.value))
544
+ }),
545
+ onClear: () => $({
546
+ ...s,
547
+ selectedFilters: []
548
+ })
549
+ })]
550
+ }) }),
551
+ /*#__PURE__*/ j(H, {
552
+ securityGroups: X,
553
+ isLoading: !1,
554
+ isError: !1,
555
+ error: null,
556
+ permissions: Z,
557
+ onCreateClick: () => p(!0),
558
+ onDeleteSecurityGroup: oe,
559
+ isDeletingSecurityGroup: re.isPending,
560
+ deleteError: m,
561
+ onUpdateSecurityGroup: se,
562
+ isUpdatingSecurityGroup: ie.isPending,
563
+ updateError: y,
564
+ currentProjectId: e,
565
+ hasAnyBulkAction: !1,
566
+ onClearUpdateError: ce
567
+ }),
568
+ /*#__PURE__*/ j(W, {
569
+ isOpen: d,
570
+ onClose: () => {
571
+ v(null), p(!1);
572
+ },
573
+ onCreate: ae,
574
+ isLoading: Q.isPending,
575
+ error: _
576
+ })
577
+ ] });
578
+ };
579
+ //#endregion
580
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/index.tsx?tsr-split=component
581
+ function Y() {
582
+ let { i18n: e, _: t } = z(), { projectId: n } = w.useParams(), { trpcClient: r } = w.useRouteContext();
583
+ if (!r) throw Error("trpcClient is not available in route context");
584
+ return /*#__PURE__*/ M(A, { children: [/*#__PURE__*/ j(l, { children: e._({ id: "4opp4r" }) }), /*#__PURE__*/ j(J, { project: n })] });
585
+ }
586
+ //#endregion
587
+ export { Y as component };
588
+
589
+ //# sourceMappingURL=securitygroups-DRhFle2O.mjs.map