@cobaltcore-dev/aurora 0.4.0 → 0.6.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 (178) hide show
  1. package/README.md +73 -77
  2. package/dist/client/AuroraApp.d.ts +15 -0
  3. package/dist/client/{AuthProvider-D-5Jpa6F.mjs → AuthProvider-Co4d0WzB.mjs} +3 -3
  4. package/dist/client/{AuthProvider-D-5Jpa6F.mjs.map → AuthProvider-Co4d0WzB.mjs.map} +1 -1
  5. package/dist/client/{ContentHeader-BXZoN3B9.mjs → ContentHeader-kx1Th5Sq.mjs} +29 -29
  6. package/dist/client/{ContentHeader-BXZoN3B9.mjs.map → ContentHeader-kx1Th5Sq.mjs.map} +1 -1
  7. package/dist/client/DeleteFlavorModal-C3cb7YiJ.mjs +638 -0
  8. package/dist/client/DeleteFlavorModal-C3cb7YiJ.mjs.map +1 -0
  9. package/dist/client/{EditSecurityGroupModal-DK3WYikA.mjs → EditSecurityGroupModal-CpP54WIK.mjs} +22 -22
  10. package/dist/client/{EditSecurityGroupModal-DK3WYikA.mjs.map → EditSecurityGroupModal-CpP54WIK.mjs.map} +1 -1
  11. package/dist/client/{FiltersInput-OVeIJzIo.mjs → FiltersInput-DxcyR6Bp.mjs} +18 -18
  12. package/dist/client/{FiltersInput-OVeIJzIo.mjs.map → FiltersInput-DxcyR6Bp.mjs.map} +1 -1
  13. package/dist/client/{FloatingIpActionModals-Dok7fJss.mjs → FloatingIpActionModals-BP8RWHbu.mjs} +77 -77
  14. package/dist/client/{FloatingIpActionModals-Dok7fJss.mjs.map → FloatingIpActionModals-BP8RWHbu.mjs.map} +1 -1
  15. package/dist/client/ImageToastNotifications-TZ3EfQg-.mjs +1219 -0
  16. package/dist/client/ImageToastNotifications-TZ3EfQg-.mjs.map +1 -0
  17. package/dist/client/{RouteError-pDEWC_k7.mjs → RouteError-QSV7qOoJ.mjs} +6 -6
  18. package/dist/client/{RouteError-pDEWC_k7.mjs.map → RouteError-QSV7qOoJ.mjs.map} +1 -1
  19. package/dist/client/{SortInput-DXWSqSny.mjs → SortInput-CYv2_Pur.mjs} +6 -6
  20. package/dist/client/{SortInput-DXWSqSny.mjs.map → SortInput-CYv2_Pur.mjs.map} +1 -1
  21. package/dist/client/{_auth-CJj1Cnbm.mjs → _auth-DXJkv9QO.mjs} +3 -3
  22. package/dist/client/{_auth-CJj1Cnbm.mjs.map → _auth-DXJkv9QO.mjs.map} +1 -1
  23. package/dist/client/{_flavorId-BoNcxYmF.mjs → _flavorId-C2x43-6S.mjs} +15 -15
  24. package/dist/client/_flavorId-C2x43-6S.mjs.map +1 -0
  25. package/dist/client/_flavorId-CR8ZUI-P.mjs +194 -0
  26. package/dist/client/_flavorId-CR8ZUI-P.mjs.map +1 -0
  27. package/dist/client/{_floatingIpId-D33bOEmH.mjs → _floatingIpId-BCk41_Lb.mjs} +3 -3
  28. package/dist/client/{_floatingIpId-D33bOEmH.mjs.map → _floatingIpId-BCk41_Lb.mjs.map} +1 -1
  29. package/dist/client/{_floatingIpId-DF_BSJN6.mjs → _floatingIpId-BGrOAmPT.mjs} +48 -48
  30. package/dist/client/{_floatingIpId-DF_BSJN6.mjs.map → _floatingIpId-BGrOAmPT.mjs.map} +1 -1
  31. package/dist/client/_imageId-CvfD832b.mjs +534 -0
  32. package/dist/client/_imageId-CvfD832b.mjs.map +1 -0
  33. package/dist/client/_pcaId-BxBt5DXi.mjs +459 -0
  34. package/dist/client/_pcaId-BxBt5DXi.mjs.map +1 -0
  35. package/dist/client/{_pcaId-BYCoeK6_.mjs → _pcaId-DOHycvCf.mjs} +3 -3
  36. package/dist/client/{_pcaId-BYCoeK6_.mjs.map → _pcaId-DOHycvCf.mjs.map} +1 -1
  37. package/dist/client/_projectId-BDSWnMGj.mjs +46 -0
  38. package/dist/client/_projectId-BDSWnMGj.mjs.map +1 -0
  39. package/dist/client/{_projectId-OW2xkK43.mjs → _projectId-DOgwFiqD.mjs} +3 -3
  40. package/dist/client/{_projectId-OW2xkK43.mjs.map → _projectId-DOgwFiqD.mjs.map} +1 -1
  41. package/dist/client/_projectId-DS4nR59B.mjs +299 -0
  42. package/dist/client/_projectId-DS4nR59B.mjs.map +1 -0
  43. package/dist/client/{_projectId-BwLMEMGC.mjs → _projectId-MxcHrXW4.mjs} +21 -21
  44. package/dist/client/_projectId-MxcHrXW4.mjs.map +1 -0
  45. package/dist/client/{_securityGroupId-B-Z-CzLp.mjs → _securityGroupId-CJJanWiY.mjs} +3 -3
  46. package/dist/client/{_securityGroupId-B-Z-CzLp.mjs.map → _securityGroupId-CJJanWiY.mjs.map} +1 -1
  47. package/dist/client/{_securityGroupId-B1bOYRbX.mjs → _securityGroupId-KKw4RPdH.mjs} +445 -446
  48. package/dist/client/{_securityGroupId-B1bOYRbX.mjs.map → _securityGroupId-KKw4RPdH.mjs.map} +1 -1
  49. package/dist/client/{containers-BjWqjNOx.mjs → _storageType-4wSxI__0.mjs} +19 -16
  50. package/dist/client/_storageType-4wSxI__0.mjs.map +1 -0
  51. package/dist/client/_storageType-DYjo-6ej.mjs +3243 -0
  52. package/dist/client/_storageType-DYjo-6ej.mjs.map +1 -0
  53. package/dist/client/_storageType-zeSZe--V.mjs +7 -0
  54. package/dist/client/_storageType-zeSZe--V.mjs.map +1 -0
  55. package/dist/client/about-Bo9vxGHy.mjs +92 -0
  56. package/dist/client/{about-DLn1ShhF.mjs.map → about-Bo9vxGHy.mjs.map} +1 -1
  57. package/dist/client/aurora-DDzsst74.mjs +19 -0
  58. package/dist/client/{aurora-CRcxVUCo.mjs.map → aurora-DDzsst74.mjs.map} +1 -1
  59. package/dist/client/{build-BJDfnAyi.mjs → build-DeJcDjPi.mjs} +3802 -3376
  60. package/dist/client/build-DeJcDjPi.mjs.map +1 -0
  61. package/dist/client/{buildFilterParams-TeyosGyK.mjs → buildFilterParams-DoZzMKX9.mjs} +1 -1
  62. package/dist/client/{buildFilterParams-TeyosGyK.mjs.map → buildFilterParams-DoZzMKX9.mjs.map} +1 -1
  63. package/dist/client/{cn-C3laVXMm.mjs → cn-DM4Cy3jv.mjs} +1 -1
  64. package/dist/client/{cn-C3laVXMm.mjs.map → cn-DM4Cy3jv.mjs.map} +1 -1
  65. package/dist/client/constants-BmcGYeR-.mjs +153 -0
  66. package/dist/client/constants-BmcGYeR-.mjs.map +1 -0
  67. package/dist/client/{flavors-D8oElC2K.mjs → flavors-BxFVqgnb.mjs} +2 -2
  68. package/dist/client/{flavors-D8oElC2K.mjs.map → flavors-BxFVqgnb.mjs.map} +1 -1
  69. package/dist/client/flavors-CfdgjsZY.mjs +632 -0
  70. package/dist/client/flavors-CfdgjsZY.mjs.map +1 -0
  71. package/dist/client/{flavors-BXPYAFyQ.mjs → flavors-DWMZ6TuJ.mjs} +2 -2
  72. package/dist/client/{flavors-BXPYAFyQ.mjs.map → flavors-DWMZ6TuJ.mjs.map} +1 -1
  73. package/dist/client/{floatingips-Fa6ocNUu.mjs → floatingips-ByRb82wS.mjs} +138 -139
  74. package/dist/client/{floatingips-Fa6ocNUu.mjs.map → floatingips-ByRb82wS.mjs.map} +1 -1
  75. package/dist/client/{formatBytes-tQBEnPoL.mjs → formatBytes-CZv_XyCY.mjs} +1 -1
  76. package/dist/client/{formatBytes-tQBEnPoL.mjs.map → formatBytes-CZv_XyCY.mjs.map} +1 -1
  77. package/dist/client/{helpers--JWXi40U.mjs → helpers-1PpYf-fC.mjs} +1 -1
  78. package/dist/client/{helpers--JWXi40U.mjs.map → helpers-1PpYf-fC.mjs.map} +1 -1
  79. package/dist/client/hooks-dSArr2Ca.mjs +2 -0
  80. package/dist/client/images-CKqIXUq52.mjs +1873 -0
  81. package/dist/client/images-CKqIXUq52.mjs.map +1 -0
  82. package/dist/client/{images-tYfyOkX8.mjs → images-C_dX7nY6.mjs} +3 -3
  83. package/dist/client/{images-tYfyOkX8.mjs.map → images-C_dX7nY6.mjs.map} +1 -1
  84. package/dist/client/{images-CTLCY-yY.mjs → images-CenluYV8.mjs} +2 -2
  85. package/dist/client/{images-CTLCY-yY.mjs.map → images-CenluYV8.mjs.map} +1 -1
  86. package/dist/client/{images-DM9I8G0p.mjs → images-NBf2bV43.mjs} +2 -2
  87. package/dist/client/{images-DM9I8G0p.mjs.map → images-NBf2bV43.mjs.map} +1 -1
  88. package/dist/client/index.js +428 -477
  89. package/dist/client/index.js.map +1 -1
  90. package/dist/client/{md-BivyCkGC.mjs → md-CYTrL5dq.mjs} +58 -22
  91. package/dist/client/{md-BivyCkGC.mjs.map → md-CYTrL5dq.mjs.map} +1 -1
  92. package/dist/client/{network-rYLHyf15.mjs → network-DuZm76BZ.mjs} +2 -2
  93. package/dist/client/{network-rYLHyf15.mjs.map → network-DuZm76BZ.mjs.map} +1 -1
  94. package/dist/client/objects-BJM6YeuF.mjs +5708 -0
  95. package/dist/client/objects-BJM6YeuF.mjs.map +1 -0
  96. package/dist/client/objects-gxSjvbvF.mjs +101 -0
  97. package/dist/client/objects-gxSjvbvF.mjs.map +1 -0
  98. package/dist/client/objects-o2Cj_ndZ.mjs +8 -0
  99. package/dist/client/objects-o2Cj_ndZ.mjs.map +1 -0
  100. package/dist/client/{pca-COmKvp3J.mjs → pca-Bl8NmoVZ.mjs} +2 -2
  101. package/dist/client/{pca-COmKvp3J.mjs.map → pca-Bl8NmoVZ.mjs.map} +1 -1
  102. package/dist/client/pca-RSiWpJs9.mjs +182 -0
  103. package/dist/client/pca-RSiWpJs9.mjs.map +1 -0
  104. package/dist/client/projects-CgclWI16.mjs +105 -0
  105. package/dist/client/projects-CgclWI16.mjs.map +1 -0
  106. package/dist/client/{projects-DI_L4oDw.mjs → projects-D2iewAzu.mjs} +2 -2
  107. package/dist/client/{projects-DI_L4oDw.mjs.map → projects-D2iewAzu.mjs.map} +1 -1
  108. package/dist/client/{projects-Dl5XkXUP.mjs → projects-pe2_dCnV.mjs} +3 -3
  109. package/dist/client/{projects-Dl5XkXUP.mjs.map → projects-pe2_dCnV.mjs.map} +1 -1
  110. package/dist/client/{projects-HoQ0gE5Y.mjs → projects-yiK0HGSA.mjs} +2 -2
  111. package/dist/client/{projects-HoQ0gE5Y.mjs.map → projects-yiK0HGSA.mjs.map} +1 -1
  112. package/dist/client/{securitygroups-BjkmHk2J.mjs → securitygroups-DahZkVYQ.mjs} +139 -140
  113. package/dist/client/{securitygroups-BjkmHk2J.mjs.map → securitygroups-DahZkVYQ.mjs.map} +1 -1
  114. package/dist/client/{trpcClient-BxguzNYF.mjs → trpcClient-BzPUgiM2.mjs} +1 -1
  115. package/dist/client/{trpcClient-BxguzNYF.mjs.map → trpcClient-BzPUgiM2.mjs.map} +1 -1
  116. package/dist/client/{useErrorTranslation-TZVwIAzq.mjs → useErrorTranslation-Dc0eE8Zt.mjs} +1 -1
  117. package/dist/client/{useErrorTranslation-TZVwIAzq.mjs.map → useErrorTranslation-Dc0eE8Zt.mjs.map} +1 -1
  118. package/dist/client/useListWithFiltering-DaYcu5AB.mjs +157 -0
  119. package/dist/client/useListWithFiltering-DaYcu5AB.mjs.map +1 -0
  120. package/dist/client/{useModal-DxxlilRm.mjs → useModal-DCs1OJh7.mjs} +1 -1
  121. package/dist/client/{useModal-DxxlilRm.mjs.map → useModal-DCs1OJh7.mjs.map} +1 -1
  122. package/dist/client/{useProjectId-OQv2KBbG.mjs → useProjectId-DBc5lpoU.mjs} +1 -1
  123. package/dist/client/{useProjectId-OQv2KBbG.mjs.map → useProjectId-DBc5lpoU.mjs.map} +1 -1
  124. package/dist/server/index.js +1285 -435
  125. package/package.json +5 -4
  126. package/dist/client/DeleteFlavorModal-BusYn32r.mjs +0 -629
  127. package/dist/client/DeleteFlavorModal-BusYn32r.mjs.map +0 -1
  128. package/dist/client/ImageToastNotifications-BG9LPnXf.mjs +0 -1267
  129. package/dist/client/ImageToastNotifications-BG9LPnXf.mjs.map +0 -1
  130. package/dist/client/ListToolbar-BojRTNbo.mjs +0 -129
  131. package/dist/client/ListToolbar-BojRTNbo.mjs.map +0 -1
  132. package/dist/client/_flavorId-BRonXvCo.mjs +0 -188
  133. package/dist/client/_flavorId-BRonXvCo.mjs.map +0 -1
  134. package/dist/client/_flavorId-BoNcxYmF.mjs.map +0 -1
  135. package/dist/client/_imageId-BL0I5_pv.mjs +0 -527
  136. package/dist/client/_imageId-BL0I5_pv.mjs.map +0 -1
  137. package/dist/client/_pcaId-CbBhBrX1.mjs +0 -466
  138. package/dist/client/_pcaId-CbBhBrX1.mjs.map +0 -1
  139. package/dist/client/_projectId-5NiasyXm.mjs +0 -26
  140. package/dist/client/_projectId-5NiasyXm.mjs.map +0 -1
  141. package/dist/client/_projectId-BwLMEMGC.mjs.map +0 -1
  142. package/dist/client/_projectId-D35MN1kY.mjs +0 -316
  143. package/dist/client/_projectId-D35MN1kY.mjs.map +0 -1
  144. package/dist/client/about-DLn1ShhF.mjs +0 -92
  145. package/dist/client/aurora-CRcxVUCo.mjs +0 -19
  146. package/dist/client/build-BJDfnAyi.mjs.map +0 -1
  147. package/dist/client/constants-B-P2r5F1.mjs +0 -128
  148. package/dist/client/constants-B-P2r5F1.mjs.map +0 -1
  149. package/dist/client/containers-BjWqjNOx.mjs.map +0 -1
  150. package/dist/client/containers-DsRWc1L5.mjs +0 -7
  151. package/dist/client/containers-DsRWc1L5.mjs.map +0 -1
  152. package/dist/client/containers-J7WFA18U.mjs +0 -3120
  153. package/dist/client/containers-J7WFA18U.mjs.map +0 -1
  154. package/dist/client/flavors-qvgPSI7J.mjs +0 -613
  155. package/dist/client/flavors-qvgPSI7J.mjs.map +0 -1
  156. package/dist/client/hooks-DEjb9d1F.mjs +0 -2
  157. package/dist/client/images-CSFfefAu.mjs +0 -1901
  158. package/dist/client/images-CSFfefAu.mjs.map +0 -1
  159. package/dist/client/objects-BciXwZ00.mjs +0 -86
  160. package/dist/client/objects-BciXwZ00.mjs.map +0 -1
  161. package/dist/client/objects-Cdew99tK.mjs +0 -8
  162. package/dist/client/objects-Cdew99tK.mjs.map +0 -1
  163. package/dist/client/objects-DaElrban.mjs +0 -5340
  164. package/dist/client/objects-DaElrban.mjs.map +0 -1
  165. package/dist/client/overview-BMhjFMIV.mjs +0 -15
  166. package/dist/client/overview-BMhjFMIV.mjs.map +0 -1
  167. package/dist/client/overview-BYIRj7_X.mjs +0 -15
  168. package/dist/client/overview-BYIRj7_X.mjs.map +0 -1
  169. package/dist/client/overview-DRCKNBH2.mjs +0 -15
  170. package/dist/client/overview-DRCKNBH2.mjs.map +0 -1
  171. package/dist/client/overview-urYLOVQE.mjs +0 -173
  172. package/dist/client/overview-urYLOVQE.mjs.map +0 -1
  173. package/dist/client/pca-oc7J0_Xd.mjs +0 -167
  174. package/dist/client/pca-oc7J0_Xd.mjs.map +0 -1
  175. package/dist/client/projects-BUabCzvw.mjs +0 -95
  176. package/dist/client/projects-BUabCzvw.mjs.map +0 -1
  177. package/dist/client/useListWithFiltering-CbhHJO4V.mjs +0 -32
  178. package/dist/client/useListWithFiltering-CbhHJO4V.mjs.map +0 -1
@@ -0,0 +1,638 @@
1
+ import { B as e, F as t, G as n, Q as r, R as i, U as a, ct as o, f as s, i as c, k as l, r as u, w as d } from "./build-DeJcDjPi.mjs";
2
+ import { t as f } from "./useErrorTranslation-Dc0eE8Zt.mjs";
3
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
4
+ import g, { Suspense as _, startTransition as v, use as y, useEffect as b, useMemo as x, useState as S } from "react";
5
+ import { Trans as C, useLingui as w } from "@lingui/react";
6
+ import { ErrorBoundary as T } from "react-error-boundary";
7
+ //#region src/client/routes/_auth/projects/$projectId/compute/-components/Flavors/-components/SpecFormRow.tsx
8
+ var E = ({ specKey: e, value: t, errors: r, isLoading: i, onKeyChange: s, onValueChange: l, onSave: u, onCancel: f }) => {
9
+ let { i18n: p, _: g } = w();
10
+ return /*#__PURE__*/ h(d, { children: [
11
+ /*#__PURE__*/ m(n, {
12
+ className: "pl-0",
13
+ children: /*#__PURE__*/ m(a, {
14
+ value: e,
15
+ onChange: (e) => s(e.target.value),
16
+ placeholder: p._({ id: "wPrtGF" }),
17
+ errortext: r.key,
18
+ required: !0
19
+ })
20
+ }),
21
+ /*#__PURE__*/ m(n, {
22
+ className: "pl-0",
23
+ children: /*#__PURE__*/ m(a, {
24
+ value: t,
25
+ onChange: (e) => l(e.target.value),
26
+ placeholder: p._({ id: "pubQie" }),
27
+ errortext: r.value,
28
+ required: !0
29
+ })
30
+ }),
31
+ /*#__PURE__*/ m(n, { children: /*#__PURE__*/ h(c, { children: [/*#__PURE__*/ m(o, {
32
+ icon: "check",
33
+ onClick: u,
34
+ variant: "primary",
35
+ title: p._({ id: "TyODHt" }),
36
+ disabled: i
37
+ }), /*#__PURE__*/ m(o, {
38
+ icon: "cancel",
39
+ onClick: f,
40
+ title: p._({ id: "dEgA5A" }),
41
+ disabled: i
42
+ })] }) })
43
+ ] });
44
+ }, D = ({ specKey: e, value: t, isDeleting: a, onDelete: s, canDelete: c }) => {
45
+ let { i18n: l, _: u } = w(), [f, g] = S(!1);
46
+ return b(() => {
47
+ if (f) {
48
+ let e = setTimeout(() => {
49
+ g(!1);
50
+ }, 3e3);
51
+ return () => clearTimeout(e);
52
+ }
53
+ }, [f]), /*#__PURE__*/ h(d, { children: [
54
+ /*#__PURE__*/ m(n, { children: e }),
55
+ /*#__PURE__*/ m(n, {
56
+ className: "break-all",
57
+ children: t
58
+ }),
59
+ /*#__PURE__*/ m(n, { children: a ? /*#__PURE__*/ m(r, {
60
+ distribution: "center",
61
+ alignment: "center",
62
+ children: /*#__PURE__*/ m(i, { variant: "primary" })
63
+ }) : /*#__PURE__*/ m(r, {
64
+ distribution: "end",
65
+ alignment: "end",
66
+ children: c ? f ? /*#__PURE__*/ m(o, {
67
+ variant: "primary-danger",
68
+ onClick: () => {
69
+ g(!1), s();
70
+ },
71
+ title: l._({ id: "cnGeoo" }),
72
+ "aria-label": l._({ id: "cnGeoo" }),
73
+ "data-testid": "confirm-deletion",
74
+ disabled: a,
75
+ children: l._({ id: "cnGeoo" })
76
+ }) : /*#__PURE__*/ m(o, {
77
+ icon: "deleteForever",
78
+ onClick: () => g(!0),
79
+ title: l._({
80
+ id: "2G6hLq",
81
+ values: { specKey: e }
82
+ }),
83
+ "aria-label": l._({
84
+ id: "2G6hLq",
85
+ values: { specKey: e }
86
+ }),
87
+ "data-testid": `delete-${e}`,
88
+ disabled: a
89
+ }) : /*#__PURE__*/ m(p, {})
90
+ }) })
91
+ ] });
92
+ }, O = (e, t) => e.compute.canUser.query({
93
+ project_id: t,
94
+ permission: ["flavor_specs:create", "flavor_specs:delete"]
95
+ }).then(([e, t]) => ({
96
+ canCreate: e,
97
+ canDelete: t
98
+ })), k = (e, t, n) => e.compute.getExtraSpecs.query({
99
+ project_id: t,
100
+ flavorId: n
101
+ });
102
+ function A() {
103
+ return /*#__PURE__*/ m(d, { children: /*#__PURE__*/ m(n, {
104
+ colSpan: 3,
105
+ children: /*#__PURE__*/ m(r, {
106
+ distribution: "center",
107
+ alignment: "center",
108
+ children: /*#__PURE__*/ m(i, { variant: "primary" })
109
+ })
110
+ }) });
111
+ }
112
+ function j({ error: t }) {
113
+ let { i18n: n, _: r } = w(), { translateError: i } = f();
114
+ return /*#__PURE__*/ m(e, {
115
+ variant: "error",
116
+ text: t instanceof Error ? i(t.message) : n._({ id: "W5A0Ly" })
117
+ });
118
+ }
119
+ function M({ permissionsPromise: e, extraSpecsPromise: i, client: a, project: s, flavor: c, onSpecsUpdate: u, isAddingSpec: g, setIsAddingSpec: _, setMessage: v }) {
120
+ let { i18n: b, _: x } = w(), { translateError: C } = f(), T = y(e), [O, k] = S(y(i)), [A, j] = S(""), [M, N] = S(""), [P, F] = S({}), [I, L] = S(null), R = () => {
121
+ let e = A.trim(), t = M.trim(), n = {};
122
+ return e ? Object.keys(O).includes(e) && (n.key = "Key already exists.") : n.key = "Key is required.", t || (n.value = "Value is required."), F(n), Object.keys(n).length === 0;
123
+ }, z = () => {
124
+ j(""), N(""), F({});
125
+ }, B = async () => {
126
+ if (!R()) {
127
+ v({
128
+ text: b._({ id: "CBFSfX" }),
129
+ type: "error"
130
+ });
131
+ return;
132
+ }
133
+ try {
134
+ let e = A.trim(), t = M.trim();
135
+ await a.compute.createExtraSpecs.mutate({
136
+ project_id: s,
137
+ flavorId: c.id,
138
+ extra_specs: { [e]: t }
139
+ });
140
+ let n = {
141
+ [e]: t,
142
+ ...O
143
+ };
144
+ k(n), u(n), v({
145
+ text: b._({
146
+ id: "2mbisJ",
147
+ values: { trimmedKey: e }
148
+ }),
149
+ type: "info"
150
+ }), z(), _(!1);
151
+ } catch (e) {
152
+ v({
153
+ text: C(e instanceof Error ? e.message : "Failed to create extra spec"),
154
+ type: "error"
155
+ });
156
+ }
157
+ }, V = async (e) => {
158
+ try {
159
+ L(e), await a.compute.deleteExtraSpec.mutate({
160
+ project_id: s,
161
+ flavorId: c.id,
162
+ key: e
163
+ });
164
+ let t = { ...O };
165
+ delete t[e], k(t), u(t), v({
166
+ text: b._({
167
+ id: "7UlHhT",
168
+ values: { keyToDelete: e }
169
+ }),
170
+ type: "info"
171
+ });
172
+ } catch (t) {
173
+ v({
174
+ text: C(t instanceof Error ? t.message : `Failed to delete extra spec "${e}"`),
175
+ type: "error"
176
+ });
177
+ } finally {
178
+ L(null);
179
+ }
180
+ }, H = (e) => {
181
+ j(e), P.key && F((e) => ({
182
+ ...e,
183
+ key: void 0
184
+ }));
185
+ }, U = (e) => {
186
+ N(e), P.value && F((e) => ({
187
+ ...e,
188
+ value: void 0
189
+ }));
190
+ }, W = Object.keys(O).length === 0 && !g;
191
+ return /*#__PURE__*/ h(p, { children: [T.canCreate && /*#__PURE__*/ m(r, {
192
+ direction: "horizontal",
193
+ className: "bg-theme-background-lvl-1 justify-end p-2",
194
+ children: /*#__PURE__*/ m(o, {
195
+ label: b._({ id: "u7En0V" }),
196
+ "data-testid": "addExtraButton",
197
+ onClick: () => _(!0),
198
+ variant: "primary",
199
+ disabled: g
200
+ })
201
+ }), /*#__PURE__*/ h(l, {
202
+ columns: 3,
203
+ children: [
204
+ /*#__PURE__*/ h(d, { children: [
205
+ /*#__PURE__*/ m(t, { children: b._({ id: "7sMeHQ" }) }),
206
+ /*#__PURE__*/ m(t, { children: b._({ id: "wMHvYH" }) }),
207
+ /*#__PURE__*/ m(t, {})
208
+ ] }),
209
+ g && /*#__PURE__*/ m(E, {
210
+ specKey: A,
211
+ value: M,
212
+ errors: P,
213
+ isLoading: !1,
214
+ onKeyChange: H,
215
+ onValueChange: U,
216
+ onSave: B,
217
+ onCancel: () => {
218
+ z(), _(!1), v(null);
219
+ }
220
+ }),
221
+ Object.entries(O).map(([e, t]) => /*#__PURE__*/ m(D, {
222
+ specKey: e,
223
+ value: t,
224
+ isDeleting: I === e,
225
+ onDelete: () => V(e),
226
+ canDelete: T.canDelete
227
+ }, e)),
228
+ W && /*#__PURE__*/ m(d, { children: /*#__PURE__*/ m(n, {
229
+ colSpan: 3,
230
+ className: "text-theme-default py-4 text-center",
231
+ children: b._({ id: "S3olSf" })
232
+ }) })
233
+ ]
234
+ })] });
235
+ }
236
+ var N = ({ client: t, isOpen: n, onClose: r, project: i, flavor: a, canEdit: o }) => {
237
+ let { i18n: s, _: c } = w(), [l, d] = S(null), [f, p] = S(!1), [y, b] = S(null), [x, C] = S(o), E = g.useMemo(() => n ? o === void 0 ? O(t, i) : Promise.resolve({
238
+ canCreate: o,
239
+ canDelete: o
240
+ }) : null, [
241
+ t,
242
+ i,
243
+ n,
244
+ o
245
+ ]);
246
+ g.useEffect(() => {
247
+ if (o !== void 0) {
248
+ C(o);
249
+ return;
250
+ }
251
+ E?.then(({ canCreate: e, canDelete: t }) => C(e || t));
252
+ }, [E, o]);
253
+ let D = x ? s._({ id: "SIfYq6" }) : s._({ id: "6GBt0m" });
254
+ return g.useEffect(() => {
255
+ n && a?.id && v(() => {
256
+ b(k(t, i, a.id));
257
+ });
258
+ }, [
259
+ n,
260
+ a?.id,
261
+ t,
262
+ i
263
+ ]), !n || !a || !E || !y ? null : /*#__PURE__*/ m(u, {
264
+ onCancel: () => {
265
+ d(null), p(!1), b(null), r();
266
+ },
267
+ title: D,
268
+ open: n,
269
+ size: "xl",
270
+ children: /*#__PURE__*/ h("div", { children: [l && /*#__PURE__*/ m(e, {
271
+ onDismiss: () => d(null),
272
+ text: l.text,
273
+ variant: l.type,
274
+ className: "mb-4"
275
+ }), /*#__PURE__*/ m(T, {
276
+ fallbackRender: ({ error: e }) => /*#__PURE__*/ m(j, { error: e }),
277
+ children: /*#__PURE__*/ m(_, {
278
+ fallback: /*#__PURE__*/ m(A, {}),
279
+ children: /*#__PURE__*/ m(M, {
280
+ permissionsPromise: E,
281
+ extraSpecsPromise: y,
282
+ client: t,
283
+ project: i,
284
+ flavor: a,
285
+ onSpecsUpdate: (e) => {
286
+ v(() => {
287
+ b(Promise.resolve(e));
288
+ });
289
+ },
290
+ isAddingSpec: f,
291
+ setIsAddingSpec: p,
292
+ message: l,
293
+ setMessage: d
294
+ })
295
+ })
296
+ })] })
297
+ });
298
+ }, P = ({ tenantId: e, errors: t, isLoading: r, onTenantIdChange: i, onSave: s, onCancel: l }) => {
299
+ let { i18n: u, _: f } = w();
300
+ return /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(n, {
301
+ className: "pl-0",
302
+ children: /*#__PURE__*/ m(a, {
303
+ value: e,
304
+ onChange: (e) => i(e.target.value),
305
+ placeholder: u._({ id: "wa1Bcq" }),
306
+ errortext: t.tenantId,
307
+ required: !0
308
+ })
309
+ }), /*#__PURE__*/ m(n, { children: /*#__PURE__*/ h(c, { children: [/*#__PURE__*/ m(o, {
310
+ icon: "check",
311
+ onClick: s,
312
+ variant: "primary",
313
+ title: u._({ id: "q0Rla3" }),
314
+ disabled: r
315
+ }), /*#__PURE__*/ m(o, {
316
+ icon: "cancel",
317
+ onClick: l,
318
+ title: u._({ id: "dEgA5A" }),
319
+ disabled: r
320
+ })] }) })] });
321
+ }, F = ({ access: e, isDeleting: t, onDelete: a, canDelete: s }) => {
322
+ let { i18n: c, _: l } = w(), [u, f] = S(!1);
323
+ b(() => {
324
+ if (u) {
325
+ let e = setTimeout(() => {
326
+ f(!1);
327
+ }, 3e3);
328
+ return () => clearTimeout(e);
329
+ }
330
+ }, [u]);
331
+ let g = () => {
332
+ f(!1), a();
333
+ };
334
+ return /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(n, {
335
+ className: "break-all",
336
+ children: e.tenant_id
337
+ }), /*#__PURE__*/ m(n, { children: t ? /*#__PURE__*/ m(r, {
338
+ distribution: "center",
339
+ alignment: "center",
340
+ children: /*#__PURE__*/ m(i, { variant: "primary" })
341
+ }) : /*#__PURE__*/ m(r, {
342
+ distribution: "end",
343
+ alignment: "end",
344
+ children: (() => {
345
+ if (!s) return /*#__PURE__*/ m(p, {});
346
+ if (u) return /*#__PURE__*/ m(o, {
347
+ variant: "primary-danger",
348
+ onClick: g,
349
+ title: c._({ id: "w9+8d7" }),
350
+ "aria-label": c._({ id: "w9+8d7" }),
351
+ "data-testid": "confirm-removal",
352
+ disabled: t,
353
+ children: c._({ id: "t/YqKh" })
354
+ });
355
+ {
356
+ let n = e.tenant_id;
357
+ return /*#__PURE__*/ m(o, {
358
+ icon: "deleteForever",
359
+ onClick: () => f(!0),
360
+ title: c._({
361
+ id: "tfxu04",
362
+ values: { tenantId: n }
363
+ }),
364
+ "aria-label": c._({
365
+ id: "tfxu04",
366
+ values: { tenantId: n }
367
+ }),
368
+ "data-testid": `remove-${n}`,
369
+ disabled: t
370
+ });
371
+ }
372
+ })()
373
+ }) })] });
374
+ }, I = (e, t) => e.compute.canUser.query({
375
+ project_id: t,
376
+ permission: ["flavors:add_project", "flavors:remove_project"]
377
+ }).then(([e, t]) => ({
378
+ canAdd: e,
379
+ canRemove: t
380
+ })), L = (e, t, n) => e.compute.getFlavorAccess.query({
381
+ project_id: t,
382
+ flavorId: n
383
+ });
384
+ function R() {
385
+ return /*#__PURE__*/ m(d, { children: /*#__PURE__*/ m(n, {
386
+ colSpan: 2,
387
+ children: /*#__PURE__*/ m(r, {
388
+ distribution: "center",
389
+ alignment: "center",
390
+ children: /*#__PURE__*/ m(i, { variant: "primary" })
391
+ })
392
+ }) });
393
+ }
394
+ function z({ permissionsPromise: e, flavorAccessPromise: i, client: a, project: s, flavor: c, onAccessUpdate: u, isAddingAccess: g, setIsAddingAccess: _, setMessage: v }) {
395
+ let { i18n: b, _: x } = w(), { translateError: C } = f(), T = y(e), E = y(i), [D, O] = S(""), [k, A] = S({}), [j, M] = S(/* @__PURE__ */ new Set()), [N, I] = S(!1), L = c["os-flavor-access:is_public"] !== !1, R = E.length === 0 && !g, z = () => {
396
+ let e = D.trim(), t = {};
397
+ return e ? E.some((t) => t.tenant_id === e) && (t.tenantId = "This tenant already has access to this flavor.") : t.tenantId = "Tenant ID is required.", A(t), Object.keys(t).length === 0;
398
+ }, B = () => {
399
+ O(""), A({});
400
+ }, V = async () => {
401
+ if (!z()) {
402
+ v({
403
+ text: b._({ id: "CBFSfX" }),
404
+ type: "error"
405
+ });
406
+ return;
407
+ }
408
+ I(!0);
409
+ try {
410
+ let e = D.trim();
411
+ u(await a.compute.addTenantAccess.mutate({
412
+ project_id: s,
413
+ flavorId: c.id,
414
+ targetProjectId: e
415
+ })), v({
416
+ text: b._({
417
+ id: "7flw0l",
418
+ values: { trimmedTenantId: e }
419
+ }),
420
+ type: "info"
421
+ }), B(), _(!1);
422
+ } catch (e) {
423
+ v({
424
+ text: C(e?.message || "Failed to add tenant access"),
425
+ type: "error"
426
+ });
427
+ } finally {
428
+ I(!1);
429
+ }
430
+ }, H = async (e) => {
431
+ M((t) => new Set(t).add(e));
432
+ try {
433
+ u(await a.compute.removeTenantAccess.mutate({
434
+ project_id: s,
435
+ flavorId: c.id,
436
+ targetProjectId: e
437
+ })), v({
438
+ text: b._({
439
+ id: "rvXsSb",
440
+ values: { tenantIdToRemove: e }
441
+ }),
442
+ type: "info"
443
+ });
444
+ } catch (e) {
445
+ v({
446
+ text: C(e?.message || "Failed to remove tenant access"),
447
+ type: "error"
448
+ });
449
+ } finally {
450
+ M((t) => {
451
+ let n = new Set(t);
452
+ return n.delete(e), n;
453
+ });
454
+ }
455
+ };
456
+ return L ? /*#__PURE__*/ h(l, {
457
+ columns: 2,
458
+ children: [/*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "T9Mtpi" }) }), /*#__PURE__*/ m(t, { children: " " })] }), /*#__PURE__*/ m(d, { children: /*#__PURE__*/ m(n, {
459
+ colSpan: 2,
460
+ className: "text-theme-default py-4 text-center",
461
+ children: b._({ id: "9x6EkK" })
462
+ }) })]
463
+ }) : /*#__PURE__*/ h(p, { children: [T.canAdd && /*#__PURE__*/ m(r, {
464
+ direction: "horizontal",
465
+ className: "bg-theme-background-lvl-1 justify-end p-2",
466
+ children: /*#__PURE__*/ m(o, {
467
+ label: b._({ id: "q0Rla3" }),
468
+ "data-testid": "addTenantButton",
469
+ onClick: () => _(!0),
470
+ variant: "primary",
471
+ disabled: g
472
+ })
473
+ }), /*#__PURE__*/ h(l, {
474
+ columns: 2,
475
+ children: [
476
+ /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "T9Mtpi" }) }), /*#__PURE__*/ m(t, {})] }),
477
+ g && /*#__PURE__*/ m(P, {
478
+ tenantId: D,
479
+ errors: k,
480
+ isLoading: N,
481
+ onTenantIdChange: (e) => {
482
+ O(e), k.tenantId && A((e) => ({
483
+ ...e,
484
+ tenantId: void 0
485
+ }));
486
+ },
487
+ onSave: V,
488
+ onCancel: () => {
489
+ B(), _(!1), v(null);
490
+ }
491
+ }),
492
+ E.map((e) => /*#__PURE__*/ m(F, {
493
+ access: e,
494
+ isDeleting: j.has(e.tenant_id),
495
+ onDelete: () => H(e.tenant_id),
496
+ canDelete: T.canRemove
497
+ }, e.tenant_id)),
498
+ R && /*#__PURE__*/ m(d, { children: /*#__PURE__*/ m(n, {
499
+ colSpan: 2,
500
+ className: "text-theme-default py-4 text-center",
501
+ children: b._({ id: "Gyd3No" })
502
+ }) })
503
+ ]
504
+ })] });
505
+ }
506
+ var B = ({ client: t, isOpen: n, onClose: r, project: i, flavor: a }) => {
507
+ let { i18n: o, _: s } = w(), { translateError: c } = f(), [l, d] = S(null), [p, g] = S(!1), y = x(() => n ? I(t, i) : null, [
508
+ t,
509
+ i,
510
+ n
511
+ ]), C = x(() => !n || !a?.id ? null : L(t, i, a.id).then((e) => e.filter((e, t, n) => n.findIndex((t) => t.tenant_id === e.tenant_id) === t)).catch((e) => (d({
512
+ text: c(e?.message || "GET_FLAVOR_ACCESS_FAILED"),
513
+ type: "error"
514
+ }), [])), [
515
+ n,
516
+ a?.id,
517
+ t,
518
+ i
519
+ ]);
520
+ b(() => {
521
+ n && d(null);
522
+ }, [n, a?.id]);
523
+ let [T, E] = S(null), D = `${n}-${a?.id}`, O = T?.key === D ? T.promise : C, k = () => {
524
+ d(null), g(!1), E(null), r();
525
+ }, A = (e) => {
526
+ let t = e.filter((e, t, n) => n.findIndex((t) => t.tenant_id === e.tenant_id) === t);
527
+ v(() => {
528
+ E({
529
+ key: D,
530
+ promise: Promise.resolve(t)
531
+ });
532
+ });
533
+ };
534
+ if (!n || !a || !y || !O) return null;
535
+ let j = a.name;
536
+ return /*#__PURE__*/ m(u, {
537
+ onCancel: k,
538
+ title: o._({
539
+ id: "6Rnrsz",
540
+ values: { flavorName: j }
541
+ }),
542
+ open: n,
543
+ size: "xl",
544
+ children: /*#__PURE__*/ h("div", { children: [l && /*#__PURE__*/ m(e, {
545
+ onDismiss: () => d(null),
546
+ text: l.text,
547
+ variant: l.type,
548
+ className: "mb-4",
549
+ dismissible: !0
550
+ }), /*#__PURE__*/ m(_, {
551
+ fallback: /*#__PURE__*/ m(R, {}),
552
+ children: /*#__PURE__*/ m(z, {
553
+ permissionsPromise: y,
554
+ flavorAccessPromise: O,
555
+ client: t,
556
+ project: i,
557
+ flavor: a,
558
+ onAccessUpdate: A,
559
+ isAddingAccess: p,
560
+ setIsAddingAccess: g,
561
+ setMessage: d
562
+ })
563
+ })] })
564
+ });
565
+ }, V = ({ client: a, isOpen: p, onClose: g, project: _, flavor: v, onSuccess: y }) => {
566
+ let { i18n: b, _: x } = w(), { translateError: T } = f(), [E, D] = S(!1), [O, k] = S(null), A = async () => {
567
+ if (!v?.id) {
568
+ k(b._({ id: "NlcF/v" }));
569
+ return;
570
+ }
571
+ k(null);
572
+ try {
573
+ D(!0), await a.compute.deleteFlavor.mutate({
574
+ project_id: _,
575
+ flavorId: v.id
576
+ }), y(), j();
577
+ } catch (e) {
578
+ k(e?.message ? T(e.message) : b._({ id: "8zAn1f" }));
579
+ } finally {
580
+ D(!1);
581
+ }
582
+ }, j = () => {
583
+ k(null), g();
584
+ };
585
+ return /*#__PURE__*/ h(u, {
586
+ onCancel: j,
587
+ title: b._({ id: "JT3I1g" }),
588
+ open: p,
589
+ onConfirm: A,
590
+ modalFooter: /*#__PURE__*/ m(s, {
591
+ className: "flex justify-end",
592
+ children: /*#__PURE__*/ h(c, { children: [/*#__PURE__*/ m(o, {
593
+ variant: "primary-danger",
594
+ onClick: A,
595
+ disabled: E,
596
+ children: E ? /*#__PURE__*/ m(i, { size: "small" }) : /*#__PURE__*/ m(C, { id: "cnGeoo" })
597
+ }), /*#__PURE__*/ m(o, {
598
+ variant: "default",
599
+ onClick: j,
600
+ children: /*#__PURE__*/ m(C, { id: "dEgA5A" })
601
+ })] })
602
+ }),
603
+ children: [E && /*#__PURE__*/ m(r, {
604
+ distribution: "center",
605
+ alignment: "center",
606
+ children: /*#__PURE__*/ m(i, { variant: "primary" })
607
+ }), !E && /*#__PURE__*/ h("div", { children: [
608
+ O && /*#__PURE__*/ m(e, {
609
+ onDismiss: () => {
610
+ k(null);
611
+ },
612
+ text: O,
613
+ variant: "error",
614
+ className: "mb-4"
615
+ }),
616
+ /*#__PURE__*/ m(e, {
617
+ text: b._({ id: "QQ8wUG" }),
618
+ variant: "danger",
619
+ className: "mb-4"
620
+ }),
621
+ v && /*#__PURE__*/ h(l, {
622
+ columns: 2,
623
+ children: [
624
+ /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "6YtxFj" }) }), /*#__PURE__*/ m(n, { children: v.name })] }),
625
+ /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "S0kLOH" }) }), /*#__PURE__*/ m(n, { children: v.id })] }),
626
+ /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "MZGbkp" }) }), /*#__PURE__*/ m(n, { children: v.vcpus })] }),
627
+ /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "RGhYAo" }) }), /*#__PURE__*/ h(n, { children: [v.ram, " MiB"] })] }),
628
+ /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "sPFHpI" }) }), /*#__PURE__*/ h(n, { children: [v.disk, " GiB"] })] }),
629
+ v.swap && /*#__PURE__*/ h(d, { children: [/*#__PURE__*/ m(t, { children: b._({ id: "vH2C/2" }) }), /*#__PURE__*/ h(n, { children: [v.swap, " MiB"] })] })
630
+ ]
631
+ })
632
+ ] })]
633
+ });
634
+ };
635
+ //#endregion
636
+ export { B as n, N as r, V as t };
637
+
638
+ //# sourceMappingURL=DeleteFlavorModal-C3cb7YiJ.mjs.map