@cobaltcore-dev/aurora 1.3.0 → 2.0.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 (122) hide show
  1. package/dist/client/DeleteFlavorModal-C2MqUgGR.mjs +801 -0
  2. package/dist/client/DeleteFlavorModal-C2MqUgGR.mjs.map +1 -0
  3. package/dist/client/{FiltersInput-CKI6zWnm.mjs → FiltersInput-Becwxo_J.mjs} +36 -33
  4. package/dist/client/FiltersInput-Becwxo_J.mjs.map +1 -0
  5. package/dist/client/{FloatingIpActionModals-Ch8uozH9.mjs → FloatingIpActionModals-Cq10WljB.mjs} +2 -2
  6. package/dist/client/{FloatingIpActionModals-Ch8uozH9.mjs.map → FloatingIpActionModals-Cq10WljB.mjs.map} +1 -1
  7. package/dist/client/ImageToastNotifications-BWfzOUMc.mjs +1135 -0
  8. package/dist/client/ImageToastNotifications-BWfzOUMc.mjs.map +1 -0
  9. package/dist/client/RouteIdLevelDefaultError-CSseJ1yG.mjs +26 -0
  10. package/dist/client/RouteIdLevelDefaultError-CSseJ1yG.mjs.map +1 -0
  11. package/dist/client/{_flavorId-Dg7MS0Af.mjs → _flavorId-CaA4-Pnf.mjs} +4 -3
  12. package/dist/client/_flavorId-CaA4-Pnf.mjs.map +1 -0
  13. package/dist/client/_flavorId-DYv_StX22.mjs +276 -0
  14. package/dist/client/_flavorId-DYv_StX22.mjs.map +1 -0
  15. package/dist/client/_flavorId-YV3jCS5g.mjs +22 -0
  16. package/dist/client/_flavorId-YV3jCS5g.mjs.map +1 -0
  17. package/dist/client/{_floatingIpId-C9xfRWot.mjs → _floatingIpId-BeYElanB.mjs} +2 -2
  18. package/dist/client/{_floatingIpId-C9xfRWot.mjs.map → _floatingIpId-BeYElanB.mjs.map} +1 -1
  19. package/dist/client/{_floatingIpId-DNn6ABCB.mjs → _floatingIpId-Dpsc7GU4.mjs} +5 -5
  20. package/dist/client/{_floatingIpId-DNn6ABCB.mjs.map → _floatingIpId-Dpsc7GU4.mjs.map} +1 -1
  21. package/dist/client/_imageId-mfKp3JHn.mjs +558 -0
  22. package/dist/client/_imageId-mfKp3JHn.mjs.map +1 -0
  23. package/dist/client/_imageId-mpXUMCh_.mjs +22 -0
  24. package/dist/client/_imageId-mpXUMCh_.mjs.map +1 -0
  25. package/dist/client/{_imageId-8JIbFmGB.mjs → _imageId-pBSS0YcC.mjs} +4 -3
  26. package/dist/client/_imageId-pBSS0YcC.mjs.map +1 -0
  27. package/dist/client/{_projectId-B3wmSala.mjs → _projectId-AjgJX6Gl.mjs} +2 -2
  28. package/dist/client/_projectId-AjgJX6Gl.mjs.map +1 -0
  29. package/dist/client/{_projectId-DPzv0CCp.mjs → _projectId-BnTBxKfp.mjs} +4 -4
  30. package/dist/client/_projectId-BnTBxKfp.mjs.map +1 -0
  31. package/dist/client/{_projectId-DfeVJy0G.mjs → _projectId-CVrdJ52s.mjs} +2 -2
  32. package/dist/client/_projectId-CVrdJ52s.mjs.map +1 -0
  33. package/dist/client/_projectId-DgciZslU.mjs +92 -0
  34. package/dist/client/_projectId-DgciZslU.mjs.map +1 -0
  35. package/dist/client/{_securityGroupId-C6eHmrx_.mjs → _securityGroupId-AO3wnH8g.mjs} +2 -2
  36. package/dist/client/_securityGroupId-AO3wnH8g.mjs.map +1 -0
  37. package/dist/client/{_securityGroupId-DmplhDgt.mjs → _securityGroupId-Bq0ZyG6z.mjs} +750 -741
  38. package/dist/client/_securityGroupId-Bq0ZyG6z.mjs.map +1 -0
  39. package/dist/client/_storageType-c-DAu8qr.mjs +858 -0
  40. package/dist/client/_storageType-c-DAu8qr.mjs.map +1 -0
  41. package/dist/client/components/{Error → Errors}/RouteError.d.ts +5 -0
  42. package/dist/client/components/Errors/RouteIdLevelDefaultError.d.ts +17 -0
  43. package/dist/client/components/Errors/ServiceLevelDefaultError.d.ts +9 -0
  44. package/dist/client/components/ListToolbar/SelectedFilters.d.ts +7 -2
  45. package/dist/client/components/ListToolbar/types.d.ts +6 -0
  46. package/dist/client/components/ListToolbar/valueLabels.d.ts +11 -0
  47. package/dist/client/flavors-Bgq3KZmx.mjs +659 -0
  48. package/dist/client/flavors-Bgq3KZmx.mjs.map +1 -0
  49. package/dist/client/{flavors-B1SDOPDu.mjs → flavors-ZudiAiTU.mjs} +2 -2
  50. package/dist/client/{flavors-B1SDOPDu.mjs.map → flavors-ZudiAiTU.mjs.map} +1 -1
  51. package/dist/client/{floatingips-DrCvtXtT.mjs → floatingips-B1oLH8z6.mjs} +6 -6
  52. package/dist/client/{floatingips-DrCvtXtT.mjs.map → floatingips-B1oLH8z6.mjs.map} +1 -1
  53. package/dist/client/floatingips-BeQEkVH8.mjs +14 -0
  54. package/dist/client/floatingips-BeQEkVH8.mjs.map +1 -0
  55. package/dist/client/floatingips-BtLg3yEQ.mjs +22 -0
  56. package/dist/client/floatingips-BtLg3yEQ.mjs.map +1 -0
  57. package/dist/client/floatingips-Cz9k80cc.mjs.map +1 -1
  58. package/dist/client/{images-BGQv9kKT.mjs → images-CnTW3bpy.mjs} +810 -770
  59. package/dist/client/images-CnTW3bpy.mjs.map +1 -0
  60. package/dist/client/{images-CPmMa4SQ.mjs → images-DZHDYDQu.mjs} +2 -2
  61. package/dist/client/{images-CPmMa4SQ.mjs.map → images-DZHDYDQu.mjs.map} +1 -1
  62. package/dist/client/index.js +412 -409
  63. package/dist/client/index.js.map +1 -1
  64. package/dist/client/{objects-DVccbrL1.mjs → objects-25xsh4Ia.mjs} +2 -2
  65. package/dist/client/objects-25xsh4Ia.mjs.map +1 -0
  66. package/dist/client/objects-KXY6dgwq.mjs +82 -0
  67. package/dist/client/objects-KXY6dgwq.mjs.map +1 -0
  68. package/dist/client/objects-QryuClU3.mjs +82 -0
  69. package/dist/client/objects-QryuClU3.mjs.map +1 -0
  70. package/dist/client/{objects-BR3eeSNH.mjs → objects-jYQBFzwg.mjs} +4668 -4699
  71. package/dist/client/objects-jYQBFzwg.mjs.map +1 -0
  72. package/dist/client/projects-yiK0HGSA.mjs.map +1 -1
  73. package/dist/client/securitygroups--0PS2wbM.mjs +580 -0
  74. package/dist/client/securitygroups--0PS2wbM.mjs.map +1 -0
  75. package/dist/client/{securitygroups-DEJQBcxm.mjs → securitygroups-BRndk7wh.mjs} +2 -2
  76. package/dist/client/{securitygroups-DEJQBcxm.mjs.map → securitygroups-BRndk7wh.mjs.map} +1 -1
  77. package/dist/client/securitygroups-CdN4yAAw.mjs +14 -0
  78. package/dist/client/securitygroups-CdN4yAAw.mjs.map +1 -0
  79. package/dist/client/securitygroups-Cs2Op-tu.mjs +22 -0
  80. package/dist/client/securitygroups-Cs2Op-tu.mjs.map +1 -0
  81. package/dist/client/securitygroups-CtKne8UQ.mjs.map +1 -1
  82. package/dist/client/trpcClient.d.ts +6 -1
  83. package/dist/client/useModalTracking-BYd37pXm.mjs +37 -0
  84. package/dist/client/useModalTracking-BYd37pXm.mjs.map +1 -0
  85. package/dist/client/useSecurityGroupPermissions--hK4aR8Y.mjs +294 -0
  86. package/dist/client/useSecurityGroupPermissions--hK4aR8Y.mjs.map +1 -0
  87. package/dist/server/index.d.ts +6 -1
  88. package/dist/server/index.js +96 -30
  89. package/package.json +4 -4
  90. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs +0 -773
  91. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs.map +0 -1
  92. package/dist/client/FiltersInput-CKI6zWnm.mjs.map +0 -1
  93. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs +0 -1152
  94. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs.map +0 -1
  95. package/dist/client/_flavorId-Dg7MS0Af.mjs.map +0 -1
  96. package/dist/client/_flavorId-kHl-b8rI.mjs +0 -232
  97. package/dist/client/_flavorId-kHl-b8rI.mjs.map +0 -1
  98. package/dist/client/_imageId-8JIbFmGB.mjs.map +0 -1
  99. package/dist/client/_imageId-BBAlRioC.mjs +0 -574
  100. package/dist/client/_imageId-BBAlRioC.mjs.map +0 -1
  101. package/dist/client/_projectId-7Nl1MQTJ.mjs +0 -99
  102. package/dist/client/_projectId-7Nl1MQTJ.mjs.map +0 -1
  103. package/dist/client/_projectId-B3wmSala.mjs.map +0 -1
  104. package/dist/client/_projectId-DPzv0CCp.mjs.map +0 -1
  105. package/dist/client/_projectId-DfeVJy0G.mjs.map +0 -1
  106. package/dist/client/_securityGroupId-C6eHmrx_.mjs.map +0 -1
  107. package/dist/client/_securityGroupId-DmplhDgt.mjs.map +0 -1
  108. package/dist/client/_storageType-C5gS9eut.mjs +0 -845
  109. package/dist/client/_storageType-C5gS9eut.mjs.map +0 -1
  110. package/dist/client/flavors-D8_PzQUB.mjs +0 -628
  111. package/dist/client/flavors-D8_PzQUB.mjs.map +0 -1
  112. package/dist/client/images-BGQv9kKT.mjs.map +0 -1
  113. package/dist/client/objects-AERkhfiM.mjs +0 -66
  114. package/dist/client/objects-AERkhfiM.mjs.map +0 -1
  115. package/dist/client/objects-BR3eeSNH.mjs.map +0 -1
  116. package/dist/client/objects-DVccbrL1.mjs.map +0 -1
  117. package/dist/client/securitygroups-BjhgLBHm.mjs +0 -620
  118. package/dist/client/securitygroups-BjhgLBHm.mjs.map +0 -1
  119. package/dist/client/useModalTracking-BcOKTYRN.mjs +0 -33
  120. package/dist/client/useModalTracking-BcOKTYRN.mjs.map +0 -1
  121. package/dist/client/useSecurityGroupPermissions-BOyLQLdC.mjs +0 -227
  122. package/dist/client/useSecurityGroupPermissions-BOyLQLdC.mjs.map +0 -1
@@ -1,628 +0,0 @@
1
- import { C as e, D as t, K as n, L as r, Q as i, S as a, T as o, V as s, X as c, ft as l, g as u, h as d, i as f, l as p, m, o as h, ot as g, p as _, rt as v, st as y, t as b, x } from "./build-WuxXRAqf.mjs";
2
- import { t as S } from "./flavors-B1SDOPDu.mjs";
3
- import { t as C } from "./SortInput-4g7nSTHW.mjs";
4
- import { t as w } from "./ContentHeader-CPJbgYWn.mjs";
5
- import { i as T, n as E, r as D, t as O } from "./DeleteFlavorModal-V44QCJBd.mjs";
6
- import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
7
- import { Suspense as M, startTransition as N, use as P, useCallback as F, useEffect as I, useRef as L, useState as R } from "react";
8
- import { useNavigate as z, useParams as B, useSearch as V } from "@tanstack/react-router";
9
- import { TRPCClientError as H } from "@trpc/client";
10
- import { Trans as U, useLingui as W } from "@lingui/react";
11
- import { ErrorBoundary as G } from "react-error-boundary";
12
- //#region src/client/routes/_auth/projects/$projectId/compute/flavors/-components/FlavorListContainer.tsx
13
- var K = ({ flavors: e, isLoading: n, client: r, project: i, onFlavorDeleted: c, canDeleteFlavor: l, canMangageAccess: d, canManageSpecs: f, canListSpecs: p, currentPage: m = 1, totalPages: g = 1, onPageChange: _ }) => {
14
- let { i18n: y, _: S } = W(), C = z(), [w, T] = R(!1), [M, N] = R(!1), [P, F] = R(!1), [L, V] = R(null), [H, G] = R(m.toString());
15
- I(() => {
16
- G(m.toString());
17
- }, [m]);
18
- let { projectId: K } = B({ from: "/_auth/projects/$projectId/compute/flavors/" }), q = (e) => {
19
- V(e), T(!0);
20
- }, J = (e) => {
21
- V(e), N(!0);
22
- }, Y = (e) => {
23
- V(e), F(!0);
24
- }, X = () => {
25
- T(!1), V(null);
26
- }, Z = () => {
27
- L && c && c(L.name || ""), X();
28
- }, Q = (e) => {
29
- e >= 1 && e <= g && (_?.(e), G(e.toString()));
30
- };
31
- return n ? /*#__PURE__*/ A(v, {
32
- status: "progress",
33
- title: y._({ id: "Z3FXyt" })
34
- }) : /*#__PURE__*/ j(k, { children: [
35
- /*#__PURE__*/ j(h, {
36
- columns: 7,
37
- minContentColumns: [6],
38
- className: "flavors",
39
- "data-testid": "flavors-table",
40
- children: [/*#__PURE__*/ j(o, { children: [
41
- /*#__PURE__*/ A(a, { children: /*#__PURE__*/ A(U, { id: "6YtxFj" }) }),
42
- /*#__PURE__*/ A(a, { children: /*#__PURE__*/ A(U, { id: "k5nYwm" }) }),
43
- /*#__PURE__*/ A(a, { children: /*#__PURE__*/ A(U, { id: "K+e/0e" }) }),
44
- /*#__PURE__*/ A(a, { children: /*#__PURE__*/ A(U, { id: "n0ZttO" }) }),
45
- /*#__PURE__*/ A(a, { children: /*#__PURE__*/ A(U, { id: "p4nMut" }) }),
46
- /*#__PURE__*/ A(a, { children: /*#__PURE__*/ A(U, { id: "HyyJ83" }) }),
47
- /*#__PURE__*/ A(a, {})
48
- ] }), e && e.length > 0 ? e.map((e) => /*#__PURE__*/ j(o, {
49
- "data-testid": `flavor-row-${e.id}`,
50
- onClick: () => C({
51
- to: "/projects/$projectId/compute/flavors/$flavorId",
52
- params: {
53
- projectId: K,
54
- flavorId: e.id
55
- }
56
- }),
57
- children: [
58
- /*#__PURE__*/ A(b, { children: e.name || e.id }),
59
- /*#__PURE__*/ A(b, { children: e.vcpus || "–" }),
60
- /*#__PURE__*/ A(b, { children: e.ram || "–" }),
61
- /*#__PURE__*/ A(b, { children: e.disk || "–" }),
62
- /*#__PURE__*/ A(b, { children: e.swap || "–" }),
63
- /*#__PURE__*/ A(b, { children: e["os-flavor-access:is_public"] === !1 ? y._({ id: "zwBp5t" }) : y._({ id: "7d1a0d" }) }),
64
- /*#__PURE__*/ A(b, {
65
- onClick: (e) => e.stopPropagation(),
66
- children: /*#__PURE__*/ A(t, { children: /*#__PURE__*/ j(u, { children: [
67
- /*#__PURE__*/ A(x, {
68
- label: y._({ id: "URmyfc" }),
69
- onClick: () => C({
70
- to: "/projects/$projectId/compute/flavors/$flavorId",
71
- params: {
72
- projectId: K,
73
- flavorId: e.id
74
- }
75
- })
76
- }),
77
- (f || p) && /*#__PURE__*/ A(x, {
78
- label: f ? y._({ id: "SIfYq6" }) : y._({ id: "6GBt0m" }),
79
- onClick: () => J(e)
80
- }),
81
- d && /*#__PURE__*/ A(x, {
82
- label: y._({ id: "cWbW6w" }),
83
- onClick: () => Y(e),
84
- disabled: e["os-flavor-access:is_public"] !== !1
85
- }),
86
- l && /*#__PURE__*/ A(x, {
87
- label: y._({ id: "JT3I1g" }),
88
- onClick: () => q(e)
89
- })
90
- ] }) })
91
- })
92
- ]
93
- }, e.id)) : /*#__PURE__*/ A(o, { children: /*#__PURE__*/ A(b, {
94
- colSpan: 7,
95
- children: /*#__PURE__*/ A(v, {
96
- status: "empty",
97
- title: y._({ id: "PiyQJ/" }),
98
- body: y._({ id: "KSW/GC" })
99
- })
100
- }) })]
101
- }),
102
- g > 1 && /*#__PURE__*/ A("div", {
103
- className: "flex justify-center py-4",
104
- children: /*#__PURE__*/ A(s, {
105
- variant: "input",
106
- currentPage: m,
107
- pages: g,
108
- onPressPrevious: () => Q(Math.max(m - 1, 1)),
109
- onPressNext: () => Q(Math.min(m + 1, g)),
110
- onSelectChange: (e) => {
111
- Q(e);
112
- },
113
- onInputChange: (e) => {
114
- G(e === void 0 ? "" : String(e));
115
- },
116
- onKeyDown: (e) => {
117
- if (e.key === "Enter" && H !== "") {
118
- let e = parseInt(H, 10);
119
- !isNaN(e) && e >= 1 && e <= g && Q(e);
120
- }
121
- }
122
- })
123
- }),
124
- /*#__PURE__*/ A(O, {
125
- client: r,
126
- isOpen: w,
127
- onClose: X,
128
- project: i,
129
- flavor: L,
130
- onSuccess: Z
131
- }),
132
- /*#__PURE__*/ A(D, {
133
- client: r,
134
- isOpen: M,
135
- onClose: () => N(!1),
136
- project: i,
137
- flavor: L,
138
- canEdit: f
139
- }),
140
- /*#__PURE__*/ A(E, {
141
- client: r,
142
- isOpen: P,
143
- onClose: () => F(!1),
144
- project: i,
145
- flavor: L
146
- })
147
- ] });
148
- }, q = (e, t, n) => {
149
- switch (e) {
150
- case "id":
151
- if (!t) return;
152
- {
153
- let e = String(t).trim();
154
- return /^[a-zA-Z0-9.\-_]*$/.test(e) ? void 0 : n({ id: "AX9Juz" });
155
- }
156
- case "name": {
157
- let e = String(t || "").trim();
158
- return e.length >= 2 && e.length <= 50 ? void 0 : n({ id: "zDS0JC" });
159
- }
160
- case "vcpus": {
161
- let e = Number(t);
162
- return !isNaN(e) && e >= 1 ? void 0 : n({ id: "uSdnuQ" });
163
- }
164
- case "ram": {
165
- let e = Number(t);
166
- return !isNaN(e) && e >= 128 ? void 0 : n({ id: "g1IxCo" });
167
- }
168
- case "disk": {
169
- let e = Number(t);
170
- return !isNaN(e) && e >= 0 ? void 0 : n({ id: "AJRhSM" });
171
- }
172
- case "swap":
173
- if (t === "" || t == null) return;
174
- {
175
- let e = Number(t);
176
- return !isNaN(e) && e >= 0 ? void 0 : n({ id: "g3BSCe" });
177
- }
178
- case "rxtx_factor": {
179
- let e = Number(t);
180
- return !isNaN(e) && e >= 1 ? void 0 : n({ id: "PIbPRX" });
181
- }
182
- case "description": return t ? String(t).length < 65535 ? void 0 : n({ id: "uuKb0T" }) : void 0;
183
- case "OS-FLV-EXT-DATA:ephemeral": {
184
- let e = Number(t);
185
- return !isNaN(e) && e >= 0 ? void 0 : n({ id: "tLerHy" });
186
- }
187
- case "os-flavor-access:is_public": return t == null || typeof t == "boolean" || typeof t == "string" && (t === "true" || t === "false") ? void 0 : n({ id: "MmtQVF" });
188
- default: return;
189
- }
190
- }, J = (e) => {
191
- let t = {
192
- name: String(e.name),
193
- vcpus: Number(e.vcpus),
194
- ram: Number(e.ram),
195
- disk: Number(e.disk)
196
- }, n = (e) => e != null && e !== "" && String(e).trim() !== "", r = (e) => e != null && e !== "" && String(e).trim() !== "" && !isNaN(Number(e));
197
- return n(e.id) && (t.id = String(e.id).trim()), n(e.description) && (t.description = String(e.description).trim()), r(e.swap) && (t.swap = Number(e.swap)), r(e.rxtx_factor) && (t.rxtx_factor = Number(e.rxtx_factor)), r(e["OS-FLV-EXT-DATA:ephemeral"]) && (t["OS-FLV-EXT-DATA:ephemeral"] = Number(e["OS-FLV-EXT-DATA:ephemeral"])), e["os-flavor-access:is_public"] !== void 0 && (t["os-flavor-access:is_public"] = !!e["os-flavor-access:is_public"]), t;
198
- }, Y = ({ client: e, isOpen: t, onClose: a, project: o, onSuccess: s }) => {
199
- let { i18n: u, _: f } = W(), { translateError: p } = T(), [h, g] = R({ "os-flavor-access:is_public": !0 }), [v, b] = R({}), [x, S] = R(!1), [C, w] = R(null), E = (e) => {
200
- let { name: t, value: n, type: r, checked: i } = e.target;
201
- g((e) => ({
202
- ...e,
203
- [t]: r === "checkbox" ? i : n
204
- })), C && w(null);
205
- }, D = (e, t) => {
206
- g((n) => ({
207
- ...n,
208
- [e]: t
209
- })), C && w(null);
210
- }, O = (e) => {
211
- let { name: t, value: n } = e.target, r = q(t, n, f);
212
- b((e) => ({
213
- ...e,
214
- [t]: r
215
- }));
216
- }, k = async (t) => {
217
- t.preventDefault(), w(null);
218
- let n = {};
219
- if ([
220
- "name",
221
- "vcpus",
222
- "ram",
223
- "disk"
224
- ].forEach((e) => {
225
- let t = q(e, h[e], f);
226
- t && (n[e] = t);
227
- }), [
228
- "id",
229
- "swap",
230
- "OS-FLV-EXT-DATA:ephemeral",
231
- "rxtx_factor",
232
- "description",
233
- "os-flavor-access:is_public"
234
- ].forEach((e) => {
235
- let t = h[e];
236
- if (t !== void 0 && t !== "" && t !== null) {
237
- let r = q(e, t, f);
238
- r && (n[e] = r);
239
- }
240
- }), Object.keys(n).length > 0) {
241
- b(n), w(u._({ id: "CBFSfX" }));
242
- return;
243
- }
244
- try {
245
- S(!0);
246
- let t = J(h);
247
- await e.compute.createFlavor.mutate({
248
- project_id: o,
249
- flavor: t
250
- }), s(t.name), M();
251
- } catch (e) {
252
- let t = e?.message ? p(e.message) : u._({ id: "OxDN2m" });
253
- w(t);
254
- } finally {
255
- S(!1);
256
- }
257
- }, M = () => {
258
- g({ "os-flavor-access:is_public": !0 }), b({}), w(null), a();
259
- };
260
- return /*#__PURE__*/ j(c, {
261
- onCancel: M,
262
- size: "large",
263
- title: u._({ id: "Rlp5zj" }),
264
- open: t,
265
- onConfirm: k,
266
- cancelButtonLabel: u._({ id: "dEgA5A" }),
267
- confirmButtonLabel: u._({ id: "wEfZld" }),
268
- children: [x && /*#__PURE__*/ A(i, {
269
- distribution: "center",
270
- alignment: "center",
271
- children: /*#__PURE__*/ A(n, { variant: "primary" })
272
- }), !x && /*#__PURE__*/ j(l, { children: [C && /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(r, {
273
- onDismiss: () => {
274
- w(null);
275
- },
276
- text: C,
277
- variant: "error"
278
- }) }), /*#__PURE__*/ j(_, { children: [
279
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
280
- id: "id",
281
- name: "id",
282
- label: u._({ id: "s2ubkU" }),
283
- value: h.id || "",
284
- onChange: E,
285
- onBlur: O,
286
- errortext: v.id
287
- }) }),
288
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
289
- id: "name",
290
- name: "name",
291
- label: u._({ id: "lWxDDh" }),
292
- value: h.name || "",
293
- onChange: E,
294
- onBlur: O,
295
- errortext: v.name,
296
- required: !0
297
- }) }),
298
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
299
- id: "description",
300
- name: "description",
301
- label: u._({ id: "Nu4oKW" }),
302
- value: h.description || "",
303
- onChange: E,
304
- onBlur: O,
305
- errortext: v.description
306
- }) }),
307
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
308
- id: "vcpus",
309
- name: "vcpus",
310
- label: u._({ id: "MZGbkp" }),
311
- value: String(h.vcpus || ""),
312
- onChange: (e) => D("vcpus", Number(e.target.value)),
313
- onBlur: O,
314
- errortext: v.vcpus,
315
- type: "number",
316
- required: !0
317
- }) }),
318
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
319
- id: "ram",
320
- name: "ram",
321
- label: u._({ id: "K+e/0e" }),
322
- value: String(h.ram || ""),
323
- onChange: (e) => D("ram", Number(e.target.value)),
324
- onBlur: O,
325
- errortext: v.ram,
326
- type: "number",
327
- required: !0
328
- }) }),
329
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
330
- id: "disk",
331
- name: "disk",
332
- label: u._({ id: "AxZkIr" }),
333
- value: String(h.disk || ""),
334
- onChange: (e) => D("disk", Number(e.target.value)),
335
- onBlur: O,
336
- errortext: v.disk,
337
- type: "number",
338
- required: !0
339
- }) }),
340
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
341
- id: "OS-FLV-EXT-DATA:ephemeral",
342
- name: "OS-FLV-EXT-DATA:ephemeral",
343
- label: u._({ id: "X2OnDx" }),
344
- value: String(h["OS-FLV-EXT-DATA:ephemeral"] || ""),
345
- onChange: (e) => D("OS-FLV-EXT-DATA:ephemeral", Number(e.target.value)),
346
- onBlur: O,
347
- errortext: v["OS-FLV-EXT-DATA:ephemeral"],
348
- type: "number"
349
- }) }),
350
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
351
- id: "swap",
352
- name: "swap",
353
- label: u._({ id: "p4nMut" }),
354
- value: String(h.swap || ""),
355
- onChange: (e) => D("swap", e.target.value ? Number(e.target.value) : void 0),
356
- onBlur: O,
357
- errortext: v.swap,
358
- type: "number"
359
- }) }),
360
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(m, {
361
- id: "rxtx_factor",
362
- name: "rxtx_factor",
363
- label: u._({ id: "u5HztT" }),
364
- defaultValue: 1,
365
- value: String(h.rxtx_factor || ""),
366
- onChange: (e) => D("rxtx_factor", Number(e.target.value)),
367
- onBlur: O,
368
- errortext: v.rxtx_factor,
369
- type: "number"
370
- }) }),
371
- /*#__PURE__*/ A(d, { children: /*#__PURE__*/ A(y, {
372
- name: "os-flavor-access:is_public",
373
- label: u._({ id: "vbajgL" }),
374
- helptext: u._({ id: "3nh/7E" }),
375
- checked: !!h["os-flavor-access:is_public"],
376
- onChange: E
377
- }) })
378
- ] })] })]
379
- });
380
- }, X = (e) => ({
381
- message: /*#__PURE__*/ A(U, { id: "82AGsl" }),
382
- description: /*#__PURE__*/ A(U, {
383
- id: "/BrQY5",
384
- values: { name: e }
385
- })
386
- }), Z = (e) => ({
387
- message: /*#__PURE__*/ A(U, { id: "AXvHUK" }),
388
- description: /*#__PURE__*/ A(U, {
389
- id: "zLKgq7",
390
- values: { name: e }
391
- })
392
- }), Q = 50, $ = (e, t, n, r, i) => e.compute.getFlavorsByProjectId.query({
393
- project_id: t,
394
- sortBy: n,
395
- sortDirection: r,
396
- searchTerm: i
397
- }).then((e) => ({
398
- ...e,
399
- listError: void 0
400
- })).catch((e) => {
401
- if (e instanceof H && e.data?.code === "FORBIDDEN") return {
402
- flavors: [],
403
- privateFlavorError: void 0,
404
- listError: e.message
405
- };
406
- throw e;
407
- }), ee = (e, t) => e.compute.canUser.query({
408
- project_id: t,
409
- permission: [
410
- "flavors:create",
411
- "flavors:delete",
412
- "flavors:list_projects",
413
- "flavor_specs:create",
414
- "flavor_specs:delete",
415
- "flavor_specs:list"
416
- ]
417
- }).then(([e, t, n, r, i, a]) => ({
418
- canCreate: e,
419
- canDelete: t,
420
- canManageAccess: n,
421
- canManageSpecs: r || i,
422
- canListSpecs: a
423
- }));
424
- function te({ flavorsPromise: t, permissionsPromise: n, client: a, project: o, onFlavorDeleted: s, onFlavorCreated: c, searchTerm: l, setSearchTerm: u, sortSettings: d, handleSortChange: m, createModalOpen: h, setCreateModalOpen: g, currentPage: _, onPageChange: v }) {
425
- let { i18n: y, _: b } = W(), { flavors: x, privateFlavorError: S, listError: w } = P(t), T = P(n), [E, D] = R(l), O = L(void 0);
426
- if (I(() => () => clearTimeout(O.current), []), w) return /*#__PURE__*/ A("p", { children: w });
427
- let M = Math.max(1, Math.ceil(x.length / Q)), N = Math.min(_, M), F = x.slice((N - 1) * Q, N * Q);
428
- return I(() => {
429
- _ > M && v(1);
430
- }, [
431
- M,
432
- _,
433
- v
434
- ]), /*#__PURE__*/ j(k, { children: [
435
- /*#__PURE__*/ A(Y, {
436
- client: a,
437
- isOpen: h,
438
- project: o,
439
- onClose: () => g(!1),
440
- onSuccess: c
441
- }),
442
- S && /*#__PURE__*/ A(r, {
443
- className: "mb-4",
444
- text: y._({ id: "3oc18/" }),
445
- variant: "warning"
446
- }),
447
- /*#__PURE__*/ A(i, {
448
- distribution: "end",
449
- alignment: "center",
450
- gap: "2",
451
- className: "pb-2",
452
- children: /*#__PURE__*/ j(i, {
453
- gap: "2",
454
- children: [/*#__PURE__*/ A(C, {
455
- options: d.options,
456
- sortBy: d.sortBy,
457
- sortDirection: d.sortDirection ?? "asc",
458
- selectClassName: "min-w-40",
459
- onSortByChange: (e) => m({
460
- ...d,
461
- sortBy: e,
462
- sortDirection: d.sortDirection
463
- }),
464
- onSortDirectionChange: (e) => m({
465
- ...d,
466
- sortDirection: e
467
- })
468
- }), T.canCreate && /*#__PURE__*/ A(f, {
469
- variant: "primary",
470
- label: y._({ id: "Rlp5zj" }),
471
- onClick: () => g(!0)
472
- })]
473
- })
474
- }),
475
- /*#__PURE__*/ A(p, { children: /*#__PURE__*/ A(i, {
476
- distribution: "end",
477
- alignment: "center",
478
- children: /*#__PURE__*/ A(e, {
479
- placeholder: y._({ id: "U0sPCo" }),
480
- "data-testid": "searchbar",
481
- value: E,
482
- onInput: (e) => {
483
- let t = e.currentTarget.value;
484
- D(t), clearTimeout(O.current), O.current = window.setTimeout(() => u(t), 500);
485
- },
486
- onSearch: (e) => {
487
- clearTimeout(O.current), u(typeof e == "string" ? e : "");
488
- },
489
- onClear: () => {
490
- clearTimeout(O.current), D(""), u("");
491
- }
492
- })
493
- }) }),
494
- /*#__PURE__*/ A(K, {
495
- flavors: F,
496
- isLoading: !1,
497
- client: a,
498
- project: o,
499
- onFlavorDeleted: s,
500
- canDeleteFlavor: T.canDelete,
501
- canMangageAccess: T.canManageAccess,
502
- canManageSpecs: T.canManageSpecs,
503
- canListSpecs: T.canListSpecs,
504
- currentPage: N,
505
- totalPages: M,
506
- onPageChange: v
507
- })
508
- ] });
509
- }
510
- var ne = ({ client: e, project: t }) => {
511
- let { i18n: n, _: i } = W(), a = z(), o = V({ strict: !1 }), [s, c] = R({
512
- options: [
513
- {
514
- label: n._({ id: "6YtxFj" }),
515
- value: "name"
516
- },
517
- {
518
- label: n._({ id: "MZGbkp" }),
519
- value: "vcpus"
520
- },
521
- {
522
- label: n._({ id: "RGhYAo" }),
523
- value: "ram"
524
- },
525
- {
526
- label: n._({ id: "cJDQIO" }),
527
- value: "disk"
528
- },
529
- {
530
- label: n._({ id: "vH2C/2" }),
531
- value: "swap"
532
- }
533
- ],
534
- sortBy: o.sortBy || "name",
535
- sortDirection: o.sortDirection || "asc"
536
- }), [l, u] = R(o.search || ""), d = o.page ?? 1, [f, p] = R(!1), [m, h] = R(() => $(e, t, s.sortBy, s.sortDirection, l)), [_] = R(() => ee(e, t)), y = () => {
537
- N(() => {
538
- h($(e, t, s.sortBy, s.sortDirection, l));
539
- });
540
- }, b = (e) => {
541
- let { message: t, ...n } = Z(e);
542
- g.success(t, n), y();
543
- }, x = (e) => {
544
- let { message: t, ...n } = X(e);
545
- g.success(t, n), y();
546
- }, S = (n) => {
547
- let r = {
548
- options: n.options,
549
- sortBy: n.sortBy?.toString() || "name",
550
- sortDirection: n.sortDirection || "asc"
551
- };
552
- c(r), a({
553
- search: (e) => ({
554
- ...e,
555
- sortBy: r.sortBy,
556
- sortDirection: r.sortDirection,
557
- page: void 0
558
- }),
559
- replace: !0
560
- }), N(() => {
561
- h($(e, t, r.sortBy, r.sortDirection, l));
562
- });
563
- }, C = (n) => {
564
- let r = typeof n == "string" ? n : "";
565
- u(r), a({
566
- search: (e) => ({
567
- ...e,
568
- search: r || void 0,
569
- page: void 0
570
- }),
571
- replace: !0
572
- }), N(() => {
573
- h($(e, t, s.sortBy, s.sortDirection, r));
574
- });
575
- }, w = F((e) => {
576
- a({ search: (t) => ({
577
- ...t,
578
- page: e === 1 ? void 0 : e
579
- }) });
580
- }, [a]);
581
- return /*#__PURE__*/ A("div", {
582
- className: "relative",
583
- children: /*#__PURE__*/ A(G, {
584
- fallbackRender: ({ error: e }) => /*#__PURE__*/ A(r, {
585
- variant: "error",
586
- text: e instanceof Error ? e.message : n._({ id: "W5A0Ly" })
587
- }),
588
- children: /*#__PURE__*/ A(M, {
589
- fallback: /*#__PURE__*/ A(v, {
590
- status: "progress",
591
- title: n._({ id: "EqSPkP" })
592
- }),
593
- children: /*#__PURE__*/ A(te, {
594
- flavorsPromise: m,
595
- permissionsPromise: _,
596
- client: e,
597
- project: t,
598
- onFlavorDeleted: b,
599
- onFlavorCreated: x,
600
- searchTerm: l,
601
- setSearchTerm: C,
602
- sortSettings: s,
603
- handleSortChange: S,
604
- createModalOpen: f,
605
- setCreateModalOpen: p,
606
- currentPage: d,
607
- onPageChange: w
608
- })
609
- })
610
- })
611
- });
612
- };
613
- //#endregion
614
- //#region src/client/routes/_auth/projects/$projectId/compute/flavors/index.tsx?tsr-split=component
615
- function re() {
616
- let { i18n: e, _: t } = W(), { projectId: n } = S.useParams(), { trpcClient: r } = S.useRouteContext();
617
- return /*#__PURE__*/ j(k, { children: [/*#__PURE__*/ A(w, {
618
- title: e._({ id: "neiJm0" }),
619
- projectId: n
620
- }), /*#__PURE__*/ A(ne, {
621
- project: n,
622
- client: r
623
- })] });
624
- }
625
- //#endregion
626
- export { re as component };
627
-
628
- //# sourceMappingURL=flavors-D8_PzQUB.mjs.map