@cobaltcore-dev/aurora 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +59 -9
  2. package/dist/client/App.d.ts +2 -2
  3. package/dist/client/AuroraApp.d.ts +33 -13
  4. package/dist/client/{AuthProvider-BS5OVv8n.mjs → AuthProvider-CVSAwW9f.mjs} +22 -8
  5. package/dist/client/AuthProvider-CVSAwW9f.mjs.map +1 -0
  6. package/dist/client/{ContentHeader-BHMUzd9H.mjs → ContentHeader-CPJbgYWn.mjs} +18 -18
  7. package/dist/client/{ContentHeader-BHMUzd9H.mjs.map → ContentHeader-CPJbgYWn.mjs.map} +1 -1
  8. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs +773 -0
  9. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs.map +1 -0
  10. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs +26 -0
  11. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs.map +1 -0
  12. package/dist/client/{FiltersInput-B8CNBg1L.mjs → FiltersInput-CKI6zWnm.mjs} +18 -18
  13. package/dist/client/{FiltersInput-B8CNBg1L.mjs.map → FiltersInput-CKI6zWnm.mjs.map} +1 -1
  14. package/dist/client/FloatingIpActionModals-CwEC5GR-.mjs +460 -0
  15. package/dist/client/FloatingIpActionModals-CwEC5GR-.mjs.map +1 -0
  16. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs +1152 -0
  17. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs.map +1 -0
  18. package/dist/client/SortInput-4g7nSTHW.mjs +34 -0
  19. package/dist/client/SortInput-4g7nSTHW.mjs.map +1 -0
  20. package/dist/client/{TwoColumnDescriptionList-DiDx3PnH.mjs → TwoColumnDescriptionList-NvgvErua.mjs} +2 -2
  21. package/dist/client/{TwoColumnDescriptionList-DiDx3PnH.mjs.map → TwoColumnDescriptionList-NvgvErua.mjs.map} +1 -1
  22. package/dist/client/_-CAsCx-Ay.mjs +6 -0
  23. package/dist/client/_-CAsCx-Ay.mjs.map +1 -0
  24. package/dist/client/_auth-SrDjHL6j.mjs +12 -0
  25. package/dist/client/_auth-SrDjHL6j.mjs.map +1 -0
  26. package/dist/client/_flavorId-9PcBBW52.mjs +231 -0
  27. package/dist/client/_flavorId-9PcBBW52.mjs.map +1 -0
  28. package/dist/client/{_flavorId-BN_qessZ.mjs → _flavorId-a9Gu66R1.mjs} +3 -9
  29. package/dist/client/_flavorId-a9Gu66R1.mjs.map +1 -0
  30. package/dist/client/_floatingIpId-AE9Fu8l6.mjs +210 -0
  31. package/dist/client/_floatingIpId-AE9Fu8l6.mjs.map +1 -0
  32. package/dist/client/{_floatingIpId-CwDGHkWm.mjs → _floatingIpId-AZ11Ksmu.mjs} +3 -9
  33. package/dist/client/_floatingIpId-AZ11Ksmu.mjs.map +1 -0
  34. package/dist/client/{_imageId-BtJ7GmYB.mjs → _imageId-BtAql2Kr.mjs} +104 -92
  35. package/dist/client/_imageId-BtAql2Kr.mjs.map +1 -0
  36. package/dist/client/_imageId-D76BxvFY.mjs +39 -0
  37. package/dist/client/_imageId-D76BxvFY.mjs.map +1 -0
  38. package/dist/client/{_projectId-Byt3GQDW.mjs → _projectId-7Nl1MQTJ.mjs} +5 -5
  39. package/dist/client/_projectId-7Nl1MQTJ.mjs.map +1 -0
  40. package/dist/client/_projectId-B3wmSala.mjs +281 -0
  41. package/dist/client/_projectId-B3wmSala.mjs.map +1 -0
  42. package/dist/client/_projectId-DPzv0CCp.mjs +77 -0
  43. package/dist/client/_projectId-DPzv0CCp.mjs.map +1 -0
  44. package/dist/client/_projectId-DfeVJy0G.mjs +30 -0
  45. package/dist/client/_projectId-DfeVJy0G.mjs.map +1 -0
  46. package/dist/client/_securityGroupId-C5huJNfO.mjs +1810 -0
  47. package/dist/client/_securityGroupId-C5huJNfO.mjs.map +1 -0
  48. package/dist/client/{_securityGroupId-BcbkRhsN.mjs → _securityGroupId-D85mSigA.mjs} +3 -9
  49. package/dist/client/_securityGroupId-D85mSigA.mjs.map +1 -0
  50. package/dist/client/_serviceType-DS8DxsrP.mjs +20 -0
  51. package/dist/client/_serviceType-DS8DxsrP.mjs.map +1 -0
  52. package/dist/client/_serviceType-M8d9rOT6.mjs +6 -0
  53. package/dist/client/_serviceType-M8d9rOT6.mjs.map +1 -0
  54. package/dist/client/_storageType-BRWWJtow.mjs +14 -0
  55. package/dist/client/_storageType-BRWWJtow.mjs.map +1 -0
  56. package/dist/client/_storageType-CzZ4u9x_.mjs +12 -0
  57. package/dist/client/_storageType-CzZ4u9x_.mjs.map +1 -0
  58. package/dist/client/_storageType-Dy9uCVXr.mjs +845 -0
  59. package/dist/client/_storageType-Dy9uCVXr.mjs.map +1 -0
  60. package/dist/client/_storageType-zeSZe--V.mjs.map +1 -1
  61. package/dist/client/{about-_73VmpTB.mjs → about-BmQTyLWc.mjs} +2 -2
  62. package/dist/client/{about-_73VmpTB.mjs.map → about-BmQTyLWc.mjs.map} +1 -1
  63. package/dist/client/{aurora-EbwGRLLf.mjs → aurora-CIml-f2f.mjs} +2 -2
  64. package/dist/client/{aurora-EbwGRLLf.mjs.map → aurora-CIml-f2f.mjs.map} +1 -1
  65. package/dist/client/{build-C_4vRMCq.mjs → build-WuxXRAqf.mjs} +121 -24
  66. package/dist/client/{build-C_4vRMCq.mjs.map → build-WuxXRAqf.mjs.map} +1 -1
  67. package/dist/client/components/Breadcrumbs.d.ts +1 -0
  68. package/dist/client/components/ListToolbar/SortInput.d.ts +3 -0
  69. package/dist/client/context/BreadcrumbExtensionContext.d.ts +9 -0
  70. package/dist/client/context/DynamicBreadcrumbContext.d.ts +9 -0
  71. package/dist/client/{flavors-CiHCYrtZ.mjs → flavors-B0rbqffG.mjs} +3 -5
  72. package/dist/client/flavors-B0rbqffG.mjs.map +1 -0
  73. package/dist/client/flavors-DWMZ6TuJ.mjs.map +1 -1
  74. package/dist/client/flavors-Rl20bxVU.mjs +628 -0
  75. package/dist/client/flavors-Rl20bxVU.mjs.map +1 -0
  76. package/dist/client/floatingips-Cz9k80cc.mjs +8 -0
  77. package/dist/client/floatingips-Cz9k80cc.mjs.map +1 -0
  78. package/dist/client/floatingips-xbO_mu4f.mjs +576 -0
  79. package/dist/client/floatingips-xbO_mu4f.mjs.map +1 -0
  80. package/dist/client/hooks/useBreadcrumbs.d.ts +16 -0
  81. package/dist/client/hooks/usePushBreadcrumbs.d.ts +10 -0
  82. package/dist/client/hooks/useSetBreadcrumb.d.ts +11 -0
  83. package/dist/client/{hooks-LutR2Yg3.mjs → hooks-D0yKIumu.mjs} +2 -2
  84. package/dist/client/{hooks-LutR2Yg3.mjs.map → hooks-D0yKIumu.mjs.map} +1 -1
  85. package/dist/client/images-BGQv9kKT.mjs +1983 -0
  86. package/dist/client/images-BGQv9kKT.mjs.map +1 -0
  87. package/dist/client/{images-CS4kZQyu.mjs → images-CPmMa4SQ.mjs} +3 -5
  88. package/dist/client/images-CPmMa4SQ.mjs.map +1 -0
  89. package/dist/client/images-NBf2bV43.mjs.map +1 -1
  90. package/dist/client/index.d.ts +7 -3
  91. package/dist/client/index.js +549 -535
  92. package/dist/client/index.js.map +1 -1
  93. package/dist/client/{objects-C3azvW8m.mjs → objects-BE_u5yRt.mjs} +7087 -4211
  94. package/dist/client/objects-BE_u5yRt.mjs.map +1 -0
  95. package/dist/client/objects-BN-59Th0.mjs +66 -0
  96. package/dist/client/objects-BN-59Th0.mjs.map +1 -0
  97. package/dist/client/objects-D9Luf9KB.mjs +66 -0
  98. package/dist/client/objects-D9Luf9KB.mjs.map +1 -0
  99. package/dist/client/projects-yiK0HGSA.mjs.map +1 -1
  100. package/dist/client/routeInfo-DP3v74Wg.mjs +19 -0
  101. package/dist/client/routeInfo-DP3v74Wg.mjs.map +1 -0
  102. package/dist/client/router.d.ts +2 -2
  103. package/dist/client/{routes-CdDm-hhO.mjs → routes-CJj7SR_K.mjs} +2 -2
  104. package/dist/client/routes-CJj7SR_K.mjs.map +1 -0
  105. package/dist/client/routes-xofA3ksU.mjs +110 -0
  106. package/dist/client/routes-xofA3ksU.mjs.map +1 -0
  107. package/dist/client/securitygroups-BjhgLBHm.mjs +620 -0
  108. package/dist/client/securitygroups-BjhgLBHm.mjs.map +1 -0
  109. package/dist/client/securitygroups-CtKne8UQ.mjs +8 -0
  110. package/dist/client/securitygroups-CtKne8UQ.mjs.map +1 -0
  111. package/dist/client/{securitygroups-Byte-iSp.mjs → securitygroups-DEJQBcxm.mjs} +3 -5
  112. package/dist/client/securitygroups-DEJQBcxm.mjs.map +1 -0
  113. package/dist/client/trpcClient.d.ts +135 -3
  114. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs +54 -0
  115. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs.map +1 -0
  116. package/dist/client/useModalTracking-BcOKTYRN.mjs +33 -0
  117. package/dist/client/useModalTracking-BcOKTYRN.mjs.map +1 -0
  118. package/dist/client/{useSecurityGroupPermissions-C29mzb3b.mjs → useSecurityGroupPermissions-BOyLQLdC.mjs} +85 -19
  119. package/dist/client/useSecurityGroupPermissions-BOyLQLdC.mjs.map +1 -0
  120. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs +19 -0
  121. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs.map +1 -0
  122. package/dist/client/utils/formatSwiftDate.d.ts +30 -0
  123. package/dist/server/index.d.ts +136 -4
  124. package/dist/server/index.js +845 -260
  125. package/package.json +37 -36
  126. package/dist/client/AuthProvider-BS5OVv8n.mjs.map +0 -1
  127. package/dist/client/DeleteFlavorModal-BP83t9zX.mjs +0 -721
  128. package/dist/client/DeleteFlavorModal-BP83t9zX.mjs.map +0 -1
  129. package/dist/client/FloatingIpActionModals-BraiJWBi.mjs +0 -417
  130. package/dist/client/FloatingIpActionModals-BraiJWBi.mjs.map +0 -1
  131. package/dist/client/ImageToastNotifications-BXMHJaIH.mjs +0 -1131
  132. package/dist/client/ImageToastNotifications-BXMHJaIH.mjs.map +0 -1
  133. package/dist/client/RouteError-hAF8_jbe.mjs +0 -25
  134. package/dist/client/RouteError-hAF8_jbe.mjs.map +0 -1
  135. package/dist/client/SortInput-Cqs2poV3.mjs +0 -34
  136. package/dist/client/SortInput-Cqs2poV3.mjs.map +0 -1
  137. package/dist/client/StatusError-C5KodQOq.mjs +0 -39
  138. package/dist/client/StatusError-C5KodQOq.mjs.map +0 -1
  139. package/dist/client/_auth-DJ9wHZaj.mjs +0 -11
  140. package/dist/client/_auth-DJ9wHZaj.mjs.map +0 -1
  141. package/dist/client/_flavorId-BN_qessZ.mjs.map +0 -1
  142. package/dist/client/_flavorId-CJjEB_Ao.mjs +0 -210
  143. package/dist/client/_flavorId-CJjEB_Ao.mjs.map +0 -1
  144. package/dist/client/_floatingIpId-CwDGHkWm.mjs.map +0 -1
  145. package/dist/client/_floatingIpId-foMIwbE4.mjs +0 -215
  146. package/dist/client/_floatingIpId-foMIwbE4.mjs.map +0 -1
  147. package/dist/client/_imageId-BtJ7GmYB.mjs.map +0 -1
  148. package/dist/client/_projectId-BmtCuzJu.mjs +0 -29
  149. package/dist/client/_projectId-BmtCuzJu.mjs.map +0 -1
  150. package/dist/client/_projectId-Byt3GQDW.mjs.map +0 -1
  151. package/dist/client/_projectId-NYk1IN_a.mjs +0 -291
  152. package/dist/client/_projectId-NYk1IN_a.mjs.map +0 -1
  153. package/dist/client/_projectId-QueiFczy.mjs +0 -46
  154. package/dist/client/_projectId-QueiFczy.mjs.map +0 -1
  155. package/dist/client/_securityGroupId-BcbkRhsN.mjs.map +0 -1
  156. package/dist/client/_securityGroupId-pPtJsCoe.mjs +0 -1797
  157. package/dist/client/_securityGroupId-pPtJsCoe.mjs.map +0 -1
  158. package/dist/client/_storageType-BmqrU06i.mjs +0 -2202
  159. package/dist/client/_storageType-BmqrU06i.mjs.map +0 -1
  160. package/dist/client/components/Error/StatusError.d.ts +0 -11
  161. package/dist/client/components/ProjectView/ProjectInfoBox.d.ts +0 -12
  162. package/dist/client/flavors-CiHCYrtZ.mjs.map +0 -1
  163. package/dist/client/flavors-DY-bDc8l.mjs +0 -650
  164. package/dist/client/flavors-DY-bDc8l.mjs.map +0 -1
  165. package/dist/client/floatingips-Ci4jHkaG.mjs +0 -591
  166. package/dist/client/floatingips-Ci4jHkaG.mjs.map +0 -1
  167. package/dist/client/images-91U7tr9Y2.mjs +0 -1976
  168. package/dist/client/images-91U7tr9Y2.mjs.map +0 -1
  169. package/dist/client/images-CS4kZQyu.mjs.map +0 -1
  170. package/dist/client/objects-C3azvW8m.mjs.map +0 -1
  171. package/dist/client/objects-CM265S6b.mjs +0 -56
  172. package/dist/client/objects-CM265S6b.mjs.map +0 -1
  173. package/dist/client/objects-EE9Cd1wI.mjs +0 -56
  174. package/dist/client/objects-EE9Cd1wI.mjs.map +0 -1
  175. package/dist/client/routeInfo-DXqB2HCf.mjs +0 -32
  176. package/dist/client/routeInfo-DXqB2HCf.mjs.map +0 -1
  177. package/dist/client/routes-CBd8CCuM.mjs +0 -115
  178. package/dist/client/routes-CBd8CCuM.mjs.map +0 -1
  179. package/dist/client/routes-CdDm-hhO.mjs.map +0 -1
  180. package/dist/client/securitygroups-Bd_uV4S9.mjs +0 -595
  181. package/dist/client/securitygroups-Bd_uV4S9.mjs.map +0 -1
  182. package/dist/client/securitygroups-Byte-iSp.mjs.map +0 -1
  183. package/dist/client/useSecurityGroupPermissions-C29mzb3b.mjs.map +0 -1
@@ -1,1976 +0,0 @@
1
- import { C as e, F as t, I as n, J as r, O as i, S as a, T as o, V as s, W as c, X as l, a as u, at as d, c as f, g as p, h as m, it as h, l as g, m as _, nt as v, o as y, p as b, r as x, rt as S, t as C, tt as ee, ut as w, x as T, z as E } from "./build-C_4vRMCq.mjs";
2
- import { a as D, i as O } from "./trpcClient-D7gpR7YG.mjs";
3
- import { t as k } from "./cn-DM4Cy3jv.mjs";
4
- import { t as A } from "./images-CS4kZQyu.mjs";
5
- import { t as te } from "./useProjectId-DBc5lpoU.mjs";
6
- import { t as j } from "./SortInput-Cqs2poV3.mjs";
7
- import { t as M } from "./ContentHeader-BHMUzd9H.mjs";
8
- import "./hooks-LutR2Yg3.mjs";
9
- import { A as N, C as P, D as ne, E as re, F as ie, I as F, M as I, N as L, O as R, P as z, S as ae, T as B, _ as V, a as H, b as oe, c as se, d as U, f as W, g as ce, h as G, i as le, j as ue, k as de, l as fe, m as pe, n as me, o as he, p as ge, r as _e, s as ve, t as ye, u as be, v as xe, w as Se, x as Ce, y as we } from "./ImageToastNotifications-BXMHJaIH.mjs";
10
- import { n as Te, t as Ee } from "./FiltersInput-B8CNBg1L.mjs";
11
- import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
12
- import { Suspense as De, startTransition as Oe, use as ke, useCallback as Ae, useEffect as je, useMemo as Me, useRef as Ne, useState as Y } from "react";
13
- import { useNavigate as Pe, useParams as Fe, useSearch as X } from "@tanstack/react-router";
14
- import { TRPCClientError as Ie } from "@trpc/client";
15
- import { Trans as Z, useLingui as Q } from "@lingui/react";
16
- import { ErrorBoundary as Le } from "react-error-boundary";
17
- import { i18n as Re } from "@lingui/core";
18
- import "@trpc/server";
19
- //#region src/client/routes/_auth/projects/$projectId/compute/-components/Images/-components/ImageTableRow.tsx
20
- function ze({ image: e, isSelected: t, isPending: n, isAccepted: r, permissions: a, onEditDetails: s, onEditMetadata: l, onDelete: u, onSelect: f, onActivationStatusChange: m, onManageAccess: g, onUpdateVisibility: _, uploadId: v, uploadProgressPercent: y, onMemberStatusChanged: b, showSelectColumn: x = !1 }) {
21
- let { i18n: S, _: ee } = Q(), { id: w, name: E, status: O, visibility: k, size: A, disk_format: te, created_at: j, owner: M } = e, N = E || S._({ id: "MEIAzV" }), { projectId: P } = Fe({ from: "/_auth/projects/$projectId/compute/images/" }), ne = Pe(), re = D.useUtils(), I = D.compute.updateImageMember.useMutation({ onSuccess: () => {
22
- re.compute.listImagesWithPagination.invalidate(), re.compute.listSharedImagesByMemberStatus.invalidate();
23
- } }), R = async (e) => {
24
- try {
25
- await I.mutateAsync({
26
- project_id: P,
27
- imageId: w,
28
- memberId: P,
29
- status: e
30
- });
31
- let { message: t, ...n } = U(e);
32
- h.info(t, n), b?.();
33
- } catch (e) {
34
- let t = e?.message, { message: n, ...r } = be(t);
35
- h.error(n, r);
36
- }
37
- }, ae = P === M, B = n || r, V = I.isPending;
38
- return /*#__PURE__*/ J(o, {
39
- "data-testid": `image-row-${w}`,
40
- onClick: () => ne({
41
- to: "/projects/$projectId/compute/images/$imageId",
42
- params: {
43
- projectId: P,
44
- imageId: w
45
- }
46
- }),
47
- children: [
48
- x && /*#__PURE__*/ q(C, {
49
- onClick: (e) => e.stopPropagation(),
50
- children: /*#__PURE__*/ q(d, {
51
- checked: t,
52
- onChange: () => f(e)
53
- })
54
- }),
55
- /*#__PURE__*/ q(C, { children: O }),
56
- /*#__PURE__*/ q(C, { children: N }),
57
- /*#__PURE__*/ q(C, { children: k }),
58
- /*#__PURE__*/ q(C, { children: e.protected ? S._({ id: "l75CjT" }) : S._({ id: "1UzENP" }) }),
59
- /*#__PURE__*/ q(C, { children: v && v === w ? `${y}%` : /*#__PURE__*/ q(F, { size: A }) }),
60
- /*#__PURE__*/ q(C, { children: te || S._({ id: "fj5byd" }) }),
61
- /*#__PURE__*/ q(C, { children: j ? new Date(j).toLocaleDateString() : S._({ id: "fj5byd" }) }),
62
- /*#__PURE__*/ q(C, {
63
- onClick: (e) => e.stopPropagation(),
64
- children: V ? /*#__PURE__*/ q(c, {
65
- variant: "primary",
66
- size: "small"
67
- }) : /*#__PURE__*/ q(i, { children: /*#__PURE__*/ J(p, { children: [
68
- /*#__PURE__*/ q(T, {
69
- label: S._({ id: "v0hPHE" }),
70
- onClick: () => ne({
71
- to: "/projects/$projectId/compute/images/$imageId",
72
- params: {
73
- projectId: P,
74
- imageId: w
75
- }
76
- })
77
- }),
78
- B && a.canUpdateMember && /*#__PURE__*/ J(K, { children: [n && /*#__PURE__*/ q(T, {
79
- label: S._({ id: "g3UF2V" }),
80
- onClick: () => R(ie.ACCEPTED)
81
- }), /*#__PURE__*/ q(T, {
82
- label: S._({ id: "1t/NnN" }),
83
- onClick: () => R(ie.REJECTED)
84
- })] }),
85
- !B && a.canUpdate && /*#__PURE__*/ J(K, { children: [
86
- /*#__PURE__*/ q(T, {
87
- label: S._({ id: "Y1YKad" }),
88
- onClick: () => s(e)
89
- }),
90
- /*#__PURE__*/ q(T, {
91
- label: S._({ id: "SIfYq6" }),
92
- onClick: () => l(e)
93
- }),
94
- /*#__PURE__*/ q(T, {
95
- label: e.status === L.DEACTIVATED ? S._({ id: "FQBaXG" }) : S._({ id: "5y3O+A" }),
96
- onClick: () => m(e)
97
- }),
98
- e.visibility === z.SHARED && ae && (a.canCreateMember || a.canDeleteMember) && /*#__PURE__*/ q(T, {
99
- label: S._({ id: "cWbW6w" }),
100
- onClick: () => g(e)
101
- }),
102
- e.visibility === z.PRIVATE && /*#__PURE__*/ q(T, {
103
- label: S._({ id: "gMYsdZ" }),
104
- onClick: () => _(e.id, z.SHARED, N)
105
- })
106
- ] }),
107
- !B && a.canDelete && !e.protected && /*#__PURE__*/ q(T, {
108
- label: S._({ id: "cnGeoo" }),
109
- onClick: () => u(e)
110
- })
111
- ] }) })
112
- })
113
- ]
114
- }, w);
115
- }
116
- //#endregion
117
- //#region src/server/Compute/helpers/imageHelpers.ts
118
- var Be = {
119
- qcow2: [
120
- "bare",
121
- "ova",
122
- "docker"
123
- ],
124
- raw: [
125
- "bare",
126
- "ova",
127
- "docker"
128
- ],
129
- vmdk: ["bare", "ova"],
130
- vhd: ["bare", "ova"],
131
- vhdx: ["bare", "ova"],
132
- vdi: ["bare", "ova"],
133
- iso: ["bare"],
134
- ami: ["ami"],
135
- aki: ["aki"],
136
- ari: ["ari"],
137
- ploop: ["bare"]
138
- }, Ve = {
139
- qcow2: "bare",
140
- raw: "bare",
141
- vmdk: "bare",
142
- vhd: "bare",
143
- vhdx: "bare",
144
- vdi: "bare",
145
- iso: "bare",
146
- ami: "ami",
147
- aki: "aki",
148
- ari: "ari",
149
- ploop: "bare"
150
- };
151
- function He(e) {
152
- return Be[e] || [];
153
- }
154
- function Ue(e) {
155
- return Ve[e] || "";
156
- }
157
- function We(e, t) {
158
- return He(e).includes(t);
159
- }
160
- //#endregion
161
- //#region src/client/routes/_auth/projects/$projectId/compute/-components/Images/-components/CreateImageModal.tsx
162
- var Ge = {
163
- name: "",
164
- tags: [],
165
- visibility: z.PRIVATE,
166
- disk_format: void 0,
167
- container_format: void 0,
168
- protected: !1,
169
- min_disk: 0,
170
- min_ram: 0
171
- }, Ke = ({ isOpen: e, onClose: i, onCreate: a, isLoading: o = !1, isUploadPending: f = !1, uploadProgressPercent: p }) => {
172
- let { i18n: h, _: g } = Q(), [v, y] = Y({ ...Ge }), [x, S] = Y(""), [C, T] = Y(null), [E, D] = Y({}), [O, A] = Y(!1), [te, j] = Y(null), M = v.name.trim() !== "" && C !== null && v.disk_format !== void 0 && v.disk_format.trim() !== "" && v.container_format !== void 0 && v.container_format.trim() !== "" && v.min_disk >= 0 && v.min_ram >= 0, N = Me(() => v.disk_format ? He(v.disk_format) : [], [v.disk_format]), P = [
173
- ".qcow2",
174
- ".raw",
175
- ".vmdk",
176
- ".vhd",
177
- ".vhdx",
178
- ".vdi",
179
- ".ami",
180
- ".ari",
181
- ".aki",
182
- ".iso",
183
- ".ploop",
184
- ".img"
185
- ], ne = P.join(", "), re = (e) => {
186
- let { name: t, value: n, type: r, checked: i } = e.target;
187
- y((e) => ({
188
- ...e,
189
- [t]: r === "checkbox" ? i : n
190
- })), E[t] && D((e) => {
191
- let n = { ...e };
192
- return delete n[t], n;
193
- });
194
- }, ie = (e) => {
195
- let { name: t, value: n } = e.target;
196
- t === "name" && (!n || n.trim() === "") && D((e) => ({
197
- ...e,
198
- name: h._({ id: "wyIOMP" })
199
- }));
200
- }, F = (e, t) => {
201
- if (e === "disk_format") {
202
- let e = t, n = Ue(e);
203
- y((t) => ({
204
- ...t,
205
- disk_format: e,
206
- container_format: n
207
- }));
208
- } else y((n) => ({
209
- ...n,
210
- [e]: t
211
- }));
212
- E[e] && D((t) => {
213
- let n = { ...t };
214
- return delete n[e], n;
215
- });
216
- }, L = (e, t) => {
217
- let n = t === "" ? 0 : parseInt(t, 10);
218
- isNaN(n) || (y((t) => ({
219
- ...t,
220
- [e]: n
221
- })), E[e] && D((t) => {
222
- let n = { ...t };
223
- return delete n[e], n;
224
- }));
225
- }, R = (e, t) => {
226
- t < 0 && (e === "min_disk" ? D((e) => ({
227
- ...e,
228
- min_disk: h._({ id: "K3bUTE" })
229
- })) : e === "min_ram" && D((e) => ({
230
- ...e,
231
- min_ram: h._({ id: "PEGvy+" })
232
- })));
233
- }, ae = (e) => {
234
- let t = e.name.toLowerCase();
235
- P.some((e) => t.endsWith(e)) ? (T(e), E.file && D((e) => {
236
- let t = { ...e };
237
- return delete t.file, t;
238
- })) : D((e) => ({
239
- ...e,
240
- file: h._({
241
- id: "qzIZOL",
242
- values: { supportedFileFormats: ne }
243
- })
244
- }));
245
- }, B = (e) => {
246
- let t = e.target.files?.[0];
247
- t && ae(t);
248
- }, V = (e) => {
249
- e.preventDefault(), e.stopPropagation(), A(!0);
250
- }, H = (e) => {
251
- e.preventDefault(), e.stopPropagation(), A(!1);
252
- }, oe = (e) => {
253
- e.preventDefault(), e.stopPropagation(), A(!1);
254
- let t = e.dataTransfer.files;
255
- t && t.length > 0 && ae(t[0]);
256
- }, se = (e) => {
257
- S(e.target.value);
258
- }, U = () => {
259
- let e = x.trim();
260
- if (e !== "") {
261
- if (v.tags.includes(e)) {
262
- S("");
263
- return;
264
- }
265
- y((t) => ({
266
- ...t,
267
- tags: [...t.tags, e]
268
- })), S("");
269
- }
270
- }, W = (e) => {
271
- e.key === "Enter" && (e.preventDefault(), U());
272
- }, ce = (e) => {
273
- y((t) => ({
274
- ...t,
275
- tags: t.tags.filter((t) => t !== e)
276
- }));
277
- }, G = () => {
278
- let e = {};
279
- return (!v.name || v.name.trim() === "") && (e.name = h._({ id: "wyIOMP" })), C || (e.file = h._({ id: "aTqCTq" })), (!v.disk_format || v.disk_format.trim() === "") && (e.disk_format = h._({ id: "LK0pQN" })), (!v.container_format || v.container_format.trim() === "") && (e.container_format = h._({ id: "J4DKSM" })), v.disk_format && v.container_format && (We(v.disk_format, v.container_format) || (e.container_format = h._({ id: "BgMp/T" }))), v.min_disk < 0 && (e.min_disk = h._({ id: "K3bUTE" })), v.min_ram < 0 && (e.min_ram = h._({ id: "PEGvy+" })), D(e), Object.keys(e).length === 0;
280
- }, le = async (e) => {
281
- if (e.preventDefault(), j(null), !G()) {
282
- j(h._({ id: "CBFSfX" }));
283
- return;
284
- }
285
- try {
286
- await a({
287
- name: v.name.trim(),
288
- tags: v.tags,
289
- visibility: v.visibility,
290
- disk_format: v.disk_format,
291
- container_format: v.container_format,
292
- protected: v.protected,
293
- min_disk: v.min_disk,
294
- min_ram: v.min_ram
295
- }, C), ue();
296
- } catch (e) {
297
- let t = e instanceof Error ? e.message : h._({ id: "TQn3hH" });
298
- j(t);
299
- }
300
- }, ue = () => {
301
- y({ ...Ge }), S(""), T(null), D({}), j(null), i();
302
- };
303
- return /*#__PURE__*/ J(r, {
304
- open: e,
305
- onCancel: o ? void 0 : ue,
306
- size: "large",
307
- title: h._({ id: "xw2UtT" }),
308
- onConfirm: le,
309
- confirmButtonLabel: h._({ id: "a/nTb8" }),
310
- cancelButtonLabel: h._({ id: "dEgA5A" }),
311
- disableConfirmButton: o || !M,
312
- closeable: !o,
313
- closeOnEsc: !o,
314
- children: [
315
- o && !p && /*#__PURE__*/ J(l, {
316
- distribution: "center",
317
- alignment: "center",
318
- className: "mt-4",
319
- children: [
320
- /*#__PURE__*/ q(c, { variant: "primary" }),
321
- !f && /*#__PURE__*/ q(Z, { id: "98Fs4G" }),
322
- f && /*#__PURE__*/ q(Z, { id: "3q1GLx" })
323
- ]
324
- }),
325
- o && !!p && /*#__PURE__*/ q("div", {
326
- className: "bg-neutral-quaternary mt-4 w-full rounded-full",
327
- children: /*#__PURE__*/ J("div", {
328
- className: "bg-theme-info flex h-4 items-center justify-center rounded-full p-0.5 text-center text-xs leading-none font-medium text-white",
329
- style: { width: `${p}%` },
330
- children: [p, "%"]
331
- })
332
- }),
333
- !o && /*#__PURE__*/ J(w, {
334
- className: "mb-6",
335
- children: [
336
- te && /*#__PURE__*/ q(t, {
337
- variant: "error",
338
- className: "mb-6",
339
- children: te
340
- }),
341
- /*#__PURE__*/ q(b, {
342
- className: "mb-6",
343
- children: /*#__PURE__*/ q(m, { children: /*#__PURE__*/ J("div", {
344
- className: "w-full",
345
- children: [
346
- /*#__PURE__*/ J("label", {
347
- htmlFor: "image-file",
348
- className: "mb-2 block text-sm font-medium text-gray-900",
349
- children: [h._({ id: "UKwOYH" }), /*#__PURE__*/ q("span", {
350
- className: "ml-1 text-red-500",
351
- children: "*"
352
- })]
353
- }),
354
- /*#__PURE__*/ q("div", {
355
- className: "flex w-full items-center justify-center",
356
- children: /*#__PURE__*/ J("label", {
357
- htmlFor: "image-file",
358
- onDragOver: V,
359
- onDragLeave: H,
360
- onDrop: oe,
361
- className: k("flex h-24 w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed transition-all", O ? "border-blue-500 bg-blue-50" : "border-gray-300 bg-gray-50 hover:bg-gray-100"),
362
- children: [/*#__PURE__*/ J("div", {
363
- className: "flex flex-col items-center justify-center pt-3 pb-3",
364
- children: [
365
- /*#__PURE__*/ q("svg", {
366
- className: k("mb-1 h-6 w-6 transition-colors", O ? "text-blue-500" : "text-gray-500"),
367
- "aria-hidden": "true",
368
- xmlns: "http://www.w3.org/2000/svg",
369
- fill: "none",
370
- viewBox: "0 0 20 16",
371
- children: /*#__PURE__*/ q("path", {
372
- stroke: "currentColor",
373
- strokeLinecap: "round",
374
- strokeLinejoin: "round",
375
- strokeWidth: "2",
376
- d: "M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 5.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
377
- })
378
- }),
379
- /*#__PURE__*/ q("p", {
380
- className: k("text-xs transition-colors", O ? "font-semibold text-blue-600" : "text-gray-500"),
381
- children: O ? /*#__PURE__*/ q("span", { children: h._({ id: "vXmL4D" }) }) : /*#__PURE__*/ J(K, { children: [
382
- /*#__PURE__*/ q("span", {
383
- className: "font-semibold",
384
- children: h._({ id: "gYe+hC" })
385
- }),
386
- " ",
387
- h._({ id: "Np28ib" })
388
- ] })
389
- }),
390
- /*#__PURE__*/ q("p", {
391
- className: "text-xs text-gray-400",
392
- children: h._({ id: "jBIkmi" })
393
- })
394
- ]
395
- }), /*#__PURE__*/ q("input", {
396
- id: "image-file",
397
- type: "file",
398
- className: "hidden",
399
- onChange: B,
400
- accept: ne,
401
- disabled: o
402
- })]
403
- })
404
- }),
405
- C && /*#__PURE__*/ J("div", {
406
- className: "mt-2 flex items-center justify-between rounded-lg border border-green-200 bg-green-50 p-2 text-xs",
407
- children: [/*#__PURE__*/ J("div", {
408
- className: "flex items-center",
409
- children: [/*#__PURE__*/ q("svg", {
410
- className: "mr-2 h-4 w-4 text-green-600",
411
- fill: "currentColor",
412
- viewBox: "0 0 20 20",
413
- children: /*#__PURE__*/ q("path", {
414
- fillRule: "evenodd",
415
- d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
416
- clipRule: "evenodd"
417
- })
418
- }), /*#__PURE__*/ q("span", {
419
- className: "text-gray-700",
420
- children: C.name
421
- })]
422
- }), /*#__PURE__*/ q("button", {
423
- type: "button",
424
- onClick: () => {
425
- T(null), E.file && D((e) => {
426
- let t = { ...e };
427
- return delete t.file, t;
428
- });
429
- },
430
- className: "font-medium text-red-600 hover:text-red-800",
431
- disabled: o,
432
- children: h._({ id: "t/YqKh" })
433
- })]
434
- }),
435
- E.file && /*#__PURE__*/ q("p", {
436
- className: "text-theme-error mt-1 text-xs text-red-600",
437
- children: E.file
438
- })
439
- ]
440
- }) })
441
- }),
442
- /*#__PURE__*/ J(b, {
443
- className: "mb-6",
444
- children: [
445
- /*#__PURE__*/ q(m, {
446
- className: "mb-6",
447
- children: /*#__PURE__*/ q(_, {
448
- id: "name",
449
- name: "name",
450
- label: h._({ id: "ExLULX" }),
451
- value: v.name,
452
- onChange: re,
453
- onBlur: ie,
454
- required: !0,
455
- errortext: E.name,
456
- placeholder: h._({ id: "PsEGri" }),
457
- disabled: o
458
- })
459
- }),
460
- /*#__PURE__*/ q(m, {
461
- className: "mb-6",
462
- children: /*#__PURE__*/ J("div", {
463
- className: "w-full",
464
- children: [/*#__PURE__*/ J(l, {
465
- gap: "1",
466
- direction: "horizontal",
467
- alignment: "start",
468
- children: [/*#__PURE__*/ q("div", {
469
- className: "flex-1",
470
- children: /*#__PURE__*/ q(_, {
471
- id: "tags",
472
- name: "tags",
473
- label: h._({ id: "OYHzN1" }),
474
- value: x,
475
- onChange: se,
476
- onKeyDown: W,
477
- helptext: h._({ id: "AN0DBJ" }),
478
- placeholder: h._({ id: "tmpGvt" }),
479
- disabled: o
480
- })
481
- }), /*#__PURE__*/ q(u, {
482
- variant: "primary",
483
- onClick: U,
484
- disabled: o || x.trim() === "",
485
- children: /*#__PURE__*/ q(Z, { id: "m16xKo" })
486
- })]
487
- }), v.tags.length > 0 && /*#__PURE__*/ q(l, {
488
- gap: "1",
489
- wrap: !0,
490
- alignment: "center",
491
- className: "mt-1",
492
- children: v.tags.map((e) => /*#__PURE__*/ q(s, {
493
- closeable: !0,
494
- pillKey: "",
495
- pillValue: e,
496
- onClose: () => ce(e)
497
- }, e))
498
- })]
499
- })
500
- }),
501
- /*#__PURE__*/ q(m, {
502
- className: "mb-6",
503
- children: /*#__PURE__*/ J(ee, {
504
- id: "visibility",
505
- name: "visibility",
506
- label: h._({ id: "2q/Q7x" }),
507
- value: v.visibility,
508
- onChange: (e) => F("visibility", e),
509
- disabled: o,
510
- loading: o,
511
- children: [
512
- /*#__PURE__*/ q(n, {
513
- value: z.PUBLIC,
514
- label: h._({ id: "7d1a0d" })
515
- }),
516
- /*#__PURE__*/ q(n, {
517
- value: z.PRIVATE,
518
- label: h._({ id: "zwBp5t" })
519
- }),
520
- /*#__PURE__*/ q(n, {
521
- value: z.SHARED,
522
- label: h._({ id: "0Gd0NU" })
523
- }),
524
- /*#__PURE__*/ q(n, {
525
- value: z.COMMUNITY,
526
- label: h._({ id: "chL5IG" })
527
- })
528
- ]
529
- })
530
- }),
531
- /*#__PURE__*/ q(m, {
532
- className: "mb-6",
533
- children: /*#__PURE__*/ J(l, {
534
- direction: "horizontal",
535
- gap: "3",
536
- distribution: "evenly",
537
- className: "w-full",
538
- children: [/*#__PURE__*/ q("div", {
539
- className: "flex-1",
540
- children: /*#__PURE__*/ J(ee, {
541
- id: "disk_format",
542
- name: "disk_format",
543
- label: h._({ id: "NopYGU" }),
544
- value: v.disk_format,
545
- onChange: (e) => F("disk_format", e),
546
- disabled: o,
547
- loading: o,
548
- required: !0,
549
- errortext: E.disk_format,
550
- children: [
551
- /*#__PURE__*/ q(n, {
552
- value: I.QCOW2,
553
- label: "QCOW2 - QEMU Emulator"
554
- }),
555
- /*#__PURE__*/ q(n, {
556
- value: I.RAW,
557
- label: "Raw"
558
- }),
559
- /*#__PURE__*/ q(n, {
560
- value: I.VMDK,
561
- label: "VMDK - Virtual Machine Disk"
562
- }),
563
- /*#__PURE__*/ q(n, {
564
- value: I.VHD,
565
- label: "VHD - Virtual Hard Disk"
566
- }),
567
- /*#__PURE__*/ q(n, {
568
- value: I.VHDX,
569
- label: "VHDX - Virtual Hard Disk Extended"
570
- }),
571
- /*#__PURE__*/ q(n, {
572
- value: I.VDI,
573
- label: "VDI - Virtual Disk Image"
574
- }),
575
- /*#__PURE__*/ q(n, {
576
- value: I.AMI,
577
- label: "AMI - Amazon Machine Image"
578
- }),
579
- /*#__PURE__*/ q(n, {
580
- value: I.ARI,
581
- label: "ARI - Amazon Ramdisk Image"
582
- }),
583
- /*#__PURE__*/ q(n, {
584
- value: I.AKI,
585
- label: "AKI - Amazon Kernel Image"
586
- }),
587
- /*#__PURE__*/ q(n, {
588
- value: I.ISO,
589
- label: "ISO - Optical Disk Image"
590
- }),
591
- /*#__PURE__*/ q(n, {
592
- value: I.PLOOP,
593
- label: "PLOOP - Virtuozzo/Parallels Loopback Disk"
594
- })
595
- ]
596
- })
597
- }), /*#__PURE__*/ q("div", {
598
- className: "flex-1",
599
- children: /*#__PURE__*/ q(ee, {
600
- id: "container_format",
601
- name: "container_format",
602
- label: h._({ id: "6/xipy" }),
603
- value: v.container_format,
604
- onChange: (e) => F("container_format", e),
605
- disabled: o || !v.disk_format || !N.length,
606
- required: !0,
607
- errortext: E.container_format,
608
- helptext: !N.length && h._({ id: "A7CVME" }),
609
- children: N.map((e) => /*#__PURE__*/ q(n, {
610
- value: e,
611
- label: e.toUpperCase()
612
- }, e))
613
- })
614
- })]
615
- })
616
- }),
617
- /*#__PURE__*/ q(m, {
618
- className: "mb-0",
619
- children: /*#__PURE__*/ q(d, {
620
- id: "protected",
621
- name: "protected",
622
- label: h._({ id: "644xgx" }),
623
- checked: v.protected,
624
- onChange: re,
625
- helptext: h._({ id: "aV6KPH" }),
626
- disabled: o
627
- })
628
- })
629
- ]
630
- }),
631
- /*#__PURE__*/ q(b, {
632
- className: "mb-6",
633
- children: /*#__PURE__*/ q(m, {
634
- className: "mb-0",
635
- children: /*#__PURE__*/ J(l, {
636
- direction: "horizontal",
637
- gap: "3",
638
- distribution: "evenly",
639
- className: "w-full",
640
- children: [/*#__PURE__*/ q("div", {
641
- className: "flex-1",
642
- children: /*#__PURE__*/ q(_, {
643
- id: "min_disk",
644
- name: "min_disk",
645
- label: h._({ id: "NixRmA" }),
646
- type: "number",
647
- value: String(v.min_disk),
648
- onChange: (e) => L("min_disk", e.target.value),
649
- onBlur: () => R("min_disk", v.min_disk),
650
- helptext: h._({ id: "4fh0Wj" }),
651
- errortext: E.min_disk,
652
- disabled: o
653
- })
654
- }), /*#__PURE__*/ q("div", {
655
- className: "flex-1",
656
- children: /*#__PURE__*/ q(_, {
657
- id: "min_ram",
658
- name: "min_ram",
659
- label: h._({ id: "CgZxr7" }),
660
- type: "number",
661
- value: String(v.min_ram),
662
- onChange: (e) => L("min_ram", e.target.value),
663
- onBlur: () => R("min_ram", v.min_ram),
664
- helptext: h._({ id: "KsIM0b" }),
665
- errortext: E.min_ram,
666
- disabled: o
667
- })
668
- })]
669
- })
670
- })
671
- })
672
- ]
673
- })
674
- ]
675
- });
676
- }, qe = 20, $ = 100, Je = ({ deletableImages: e, protectedImages: t, isOpen: n, isLoading: i, onClose: a, onDelete: o }) => {
677
- let { i18n: s, _: c } = Q(), [u, d] = Y(""), [f, p] = Y(null), m = e.length, h = t.length, g = () => {
678
- d(""), p(null), a();
679
- }, v = () => {
680
- f === null ? o(e) : g();
681
- }, y = u === "delete";
682
- if (f !== null) {
683
- let e = f.errors.slice(0, $), t = f.errors.length - e.length;
684
- return /*#__PURE__*/ q(r, {
685
- open: n,
686
- onCancel: g,
687
- title: /*#__PURE__*/ q(Z, { id: "ExvQL2" }),
688
- size: "large",
689
- confirmButtonLabel: s._({ id: "DPfwMq" }),
690
- onConfirm: v,
691
- children: /*#__PURE__*/ J(l, {
692
- direction: "vertical",
693
- gap: "4",
694
- children: [(() => {
695
- let e = f.deletedCount, t = f.errorCount;
696
- return /*#__PURE__*/ q("p", {
697
- className: "text-theme-default",
698
- children: /*#__PURE__*/ q(Z, {
699
- id: "deleteResults.summary",
700
- values: {
701
- deletedCount: e,
702
- errorCount: t
703
- }
704
- })
705
- });
706
- })(), f.errors.length > 0 && /*#__PURE__*/ J("div", { children: [/*#__PURE__*/ q("p", {
707
- className: "text-theme-light mb-2 text-sm",
708
- children: /*#__PURE__*/ q(Z, { id: "SDohXA" })
709
- }), /*#__PURE__*/ q("div", {
710
- className: "bg-theme-background-lvl-2 max-h-96 overflow-y-auto rounded p-4",
711
- children: /*#__PURE__*/ J(l, {
712
- direction: "vertical",
713
- gap: "2",
714
- children: [e.map((e) => /*#__PURE__*/ J("div", {
715
- className: "border-theme-background-lvl-3 border-b pb-2 last:border-0 last:pb-0",
716
- children: [/*#__PURE__*/ q("div", {
717
- className: "overflow-x-hidden font-medium [overflow-wrap:anywhere]",
718
- title: e.imageId,
719
- children: e.imageId
720
- }), e.message && /*#__PURE__*/ q("div", {
721
- className: "text-juno-red mt-1 text-sm",
722
- children: e.message
723
- })]
724
- }, e.imageId)), t > 0 && /*#__PURE__*/ q("div", {
725
- className: "text-theme-light pt-2 text-sm",
726
- children: /*#__PURE__*/ q(Z, {
727
- id: "K4EkxW",
728
- values: { hiddenErrorCount: t }
729
- })
730
- })]
731
- })
732
- })] })]
733
- })
734
- });
735
- }
736
- let b = e.slice(0, qe), x = e.length - b.length, S = t.slice(0, qe), C = t.length - S.length, ee = i ? s._({ id: "EF2EU9" }) : m === 1 ? s._({ id: "KWa0gi" }) : s._({ id: "JtHgVz" });
737
- return /*#__PURE__*/ q(r, {
738
- open: n,
739
- onCancel: g,
740
- title: /*#__PURE__*/ q(Z, {
741
- id: "FZc7ea",
742
- values: { deletableCount: m }
743
- }),
744
- size: "large",
745
- confirmButtonLabel: ee,
746
- confirmButtonVariant: "primary-danger",
747
- onConfirm: v,
748
- cancelButtonLabel: s._({ id: "dEgA5A" }),
749
- disableConfirmButton: !y || i,
750
- disableCancelButton: i,
751
- disableCloseButton: i,
752
- children: /*#__PURE__*/ J(l, {
753
- direction: "vertical",
754
- gap: "4",
755
- children: [
756
- /*#__PURE__*/ q("p", {
757
- className: "text-theme-default",
758
- children: /*#__PURE__*/ q(Z, { id: "V89FyE" })
759
- }),
760
- /*#__PURE__*/ J("div", {
761
- className: "space-y-3",
762
- children: [m > 0 && /*#__PURE__*/ J("div", { children: [/*#__PURE__*/ q("p", {
763
- className: "text-sm font-semibold",
764
- children: /*#__PURE__*/ q(Z, { id: "MJtNLd" })
765
- }), /*#__PURE__*/ q("div", {
766
- className: "bg-theme-background-lvl-2 mt-2 max-h-48 overflow-y-auto rounded p-3",
767
- children: /*#__PURE__*/ J(l, {
768
- direction: "vertical",
769
- gap: "1",
770
- children: [b.map((e) => /*#__PURE__*/ q("div", {
771
- className: "text-theme-default overflow-x-hidden text-sm [overflow-wrap:anywhere]",
772
- children: e
773
- }, e)), x > 0 && /*#__PURE__*/ q("div", {
774
- className: "text-theme-light pt-2 text-sm",
775
- children: /*#__PURE__*/ q(Z, {
776
- id: "0TREPo",
777
- values: { hiddenDeletableCount: x }
778
- })
779
- })]
780
- })
781
- })] }), h > 0 && /*#__PURE__*/ J("div", { children: [/*#__PURE__*/ q("p", {
782
- className: "text-sm font-semibold",
783
- children: /*#__PURE__*/ q(Z, { id: "8tFjKD" })
784
- }), /*#__PURE__*/ q("div", {
785
- className: "bg-theme-warning/10 mt-2 max-h-48 overflow-y-auto rounded border border-yellow-500/20 p-3",
786
- children: /*#__PURE__*/ J(l, {
787
- direction: "vertical",
788
- gap: "1",
789
- children: [S.map((e) => /*#__PURE__*/ q("div", {
790
- className: "text-theme-default overflow-x-hidden text-sm [overflow-wrap:anywhere]",
791
- children: e
792
- }, e)), C > 0 && /*#__PURE__*/ q("div", {
793
- className: "text-theme-light pt-2 text-sm",
794
- children: /*#__PURE__*/ q(Z, {
795
- id: "yZrrKY",
796
- values: { hiddenProtectedCount: C }
797
- })
798
- })]
799
- })
800
- })] })]
801
- }),
802
- /*#__PURE__*/ q("div", { children: /*#__PURE__*/ q(_, {
803
- label: s._({ id: "QytzQr" }),
804
- value: u,
805
- onChange: (e) => d(e.target.value),
806
- placeholder: "delete",
807
- autoFocus: !0
808
- }) })
809
- ]
810
- })
811
- });
812
- }, Ye = ({ activeImages: e, deactivatedImages: t, isOpen: n, isLoading: i, onClose: a, onDeactivate: o }) => {
813
- let { i18n: s, _: u } = Q(), d = e.length, f = t.length, p = (t) => {
814
- t.preventDefault(), o(e);
815
- };
816
- return /*#__PURE__*/ J(r, {
817
- onCancel: a,
818
- size: "small",
819
- title: s._({ id: "+9CXS9" }),
820
- open: n,
821
- onConfirm: (e) => {
822
- p(e), a();
823
- },
824
- confirmButtonLabel: s._({ id: "5y3O+A" }),
825
- cancelButtonLabel: s._({ id: "dEgA5A" }),
826
- disableConfirmButton: i,
827
- children: [i && /*#__PURE__*/ q(l, {
828
- distribution: "center",
829
- alignment: "center",
830
- children: /*#__PURE__*/ q(c, { variant: "primary" })
831
- }), !i && /*#__PURE__*/ J("div", {
832
- className: "my-6",
833
- children: [
834
- d > 0 && /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q("p", {
835
- className: "mb-6",
836
- children: /*#__PURE__*/ q(Z, {
837
- id: "zm7+/D",
838
- values: { activeCount: d },
839
- components: { 0: /*#__PURE__*/ q("strong", {}) }
840
- })
841
- }), /*#__PURE__*/ J("div", {
842
- className: "mb-6",
843
- children: [/*#__PURE__*/ q("h3", {
844
- className: "jn:text-theme-high mb-3 font-semibold",
845
- children: /*#__PURE__*/ q(Z, {
846
- id: "ryxYVo",
847
- values: { activeCount: d }
848
- })
849
- }), /*#__PURE__*/ q("div", {
850
- className: "jn:bg-theme-background-lvl-1 max-h-24 overflow-y-auto rounded p-4",
851
- children: /*#__PURE__*/ q("ul", {
852
- className: "space-y-2",
853
- children: e.map((e) => /*#__PURE__*/ q("li", {
854
- className: "jn:text-theme-default",
855
- children: e
856
- }, e))
857
- })
858
- })]
859
- })] }),
860
- f > 0 && /*#__PURE__*/ J("div", {
861
- className: "mb-6",
862
- children: [/*#__PURE__*/ q("h3", {
863
- className: "jn:text-theme-high mb-3 font-semibold",
864
- children: /*#__PURE__*/ q(Z, { id: "JpZn1L" })
865
- }), /*#__PURE__*/ q("div", {
866
- className: "jn:bg-theme-background-lvl-1 max-h-24 overflow-y-auto rounded p-4",
867
- children: /*#__PURE__*/ q("ul", {
868
- className: "space-y-2",
869
- children: t.map((e) => /*#__PURE__*/ q("li", {
870
- className: "jn:text-theme-default",
871
- children: e
872
- }, e))
873
- })
874
- })]
875
- }),
876
- /*#__PURE__*/ J("div", {
877
- className: "jn:bg-theme-background-lvl-2 mb-6 rounded p-4",
878
- children: [d > 0 && /*#__PURE__*/ J("div", {
879
- className: "mb-2 flex justify-between",
880
- children: [/*#__PURE__*/ q("span", {
881
- className: "jn:text-theme-default",
882
- children: /*#__PURE__*/ q(Z, { id: "rD9yV1" })
883
- }), /*#__PURE__*/ q("span", {
884
- className: "jn:text-theme-highest font-semibold",
885
- children: d
886
- })]
887
- }), f > 0 && /*#__PURE__*/ J("div", {
888
- className: "flex justify-between",
889
- children: [/*#__PURE__*/ q("span", {
890
- className: "jn:text-theme-default",
891
- children: /*#__PURE__*/ q(Z, { id: "NH2fsP" })
892
- }), /*#__PURE__*/ q("span", {
893
- className: "jn:text-theme-warning font-semibold",
894
- children: f
895
- })]
896
- })]
897
- })
898
- ]
899
- })]
900
- });
901
- }, Xe = ({ deactivatedImages: e, activeImages: t, isOpen: n, isLoading: i, onClose: a, onActivate: o }) => {
902
- let { i18n: s, _: u } = Q(), d = e.length, f = t.length;
903
- return /*#__PURE__*/ J(r, {
904
- onCancel: a,
905
- size: "small",
906
- title: s._({ id: "UdcGJu" }),
907
- open: n,
908
- onConfirm: (t) => {
909
- t.preventDefault(), o(e);
910
- },
911
- confirmButtonLabel: s._({ id: "FQBaXG" }),
912
- cancelButtonLabel: s._({ id: "dEgA5A" }),
913
- disableConfirmButton: i,
914
- children: [i && /*#__PURE__*/ q(l, {
915
- distribution: "center",
916
- alignment: "center",
917
- children: /*#__PURE__*/ q(c, { variant: "primary" })
918
- }), !i && /*#__PURE__*/ J("div", {
919
- className: "my-6",
920
- children: [
921
- d > 0 && /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q("p", {
922
- className: "mb-6",
923
- children: /*#__PURE__*/ q(Z, {
924
- id: "MgZyuJ",
925
- values: { deactivatedCount: d },
926
- components: { 0: /*#__PURE__*/ q("strong", {}) }
927
- })
928
- }), /*#__PURE__*/ J("div", {
929
- className: "mb-6",
930
- children: [/*#__PURE__*/ q("h3", {
931
- className: "jn:text-theme-high mb-3 font-semibold",
932
- children: /*#__PURE__*/ q(Z, {
933
- id: "shKIZu",
934
- values: { deactivatedCount: d }
935
- })
936
- }), /*#__PURE__*/ q("div", {
937
- className: "jn:bg-theme-background-lvl-1 max-h-24 overflow-y-auto rounded p-4",
938
- children: /*#__PURE__*/ q("ul", {
939
- className: "space-y-2",
940
- children: e.map((e) => /*#__PURE__*/ q("li", {
941
- className: "jn:text-theme-default",
942
- children: e
943
- }, e))
944
- })
945
- })]
946
- })] }),
947
- f > 0 && /*#__PURE__*/ J("div", {
948
- className: "mb-6",
949
- children: [/*#__PURE__*/ q("h3", {
950
- className: "jn:text-theme-high mb-3 font-semibold",
951
- children: /*#__PURE__*/ q(Z, { id: "pOPvlj" })
952
- }), /*#__PURE__*/ q("div", {
953
- className: "jn:bg-theme-warning/10 max-h-24 overflow-y-auto rounded border border-yellow-500/20 p-4",
954
- children: /*#__PURE__*/ q("ul", {
955
- className: "space-y-2",
956
- children: t.map((e) => /*#__PURE__*/ q("li", {
957
- className: "jn:text-theme-default",
958
- children: e
959
- }, e))
960
- })
961
- })]
962
- }),
963
- /*#__PURE__*/ J("div", {
964
- className: "jn:bg-theme-background-lvl-2 mb-6 rounded p-4",
965
- children: [d > 0 && /*#__PURE__*/ J("div", {
966
- className: "mb-2 flex justify-between",
967
- children: [/*#__PURE__*/ q("span", {
968
- className: "jn:text-theme-default",
969
- children: /*#__PURE__*/ q(Z, { id: "4fvDRe" })
970
- }), /*#__PURE__*/ q("span", {
971
- className: "jn:text-theme-highest font-semibold",
972
- children: d
973
- })]
974
- }), f > 0 && /*#__PURE__*/ J("div", {
975
- className: "flex justify-between",
976
- children: [/*#__PURE__*/ q("span", {
977
- className: "jn:text-theme-default",
978
- children: /*#__PURE__*/ q(Z, { id: "x5l/TK" })
979
- }), /*#__PURE__*/ q("span", {
980
- className: "jn:text-theme-warning font-semibold",
981
- children: f
982
- })]
983
- })]
984
- })
985
- ]
986
- })]
987
- });
988
- }, Ze = ({ isOpen: e, onClose: n, image: i, permissions: { canCreateMember: a, canDeleteMember: o } }) => {
989
- let { i18n: s, _: c } = Q(), l = te(), [u, d] = Y(null), [f, p] = Y(!1), { data: m, isLoading: h } = D.compute.listImageMembers.useQuery({
990
- project_id: l,
991
- imageId: i?.id || ""
992
- }, { enabled: e && !!i?.id }), g = () => {
993
- d(null), p(!1), n();
994
- };
995
- if (!e || !i) return null;
996
- let _ = i.name || i.id;
997
- return /*#__PURE__*/ q(r, {
998
- onCancel: g,
999
- title: s._({
1000
- id: "UQ7Wyv",
1001
- values: { imageName: _ }
1002
- }),
1003
- open: e,
1004
- size: "xl",
1005
- children: /*#__PURE__*/ J("div", { children: [u && /*#__PURE__*/ q(t, {
1006
- onDismiss: () => d(null),
1007
- text: u.text,
1008
- variant: u.type,
1009
- className: "mb-4"
1010
- }), /*#__PURE__*/ q(N, {
1011
- projectId: l,
1012
- image: i,
1013
- imageMembers: m,
1014
- isMembersLoading: h,
1015
- canAdd: a,
1016
- canRemove: o,
1017
- isAddingMember: f,
1018
- setIsAddingMember: p,
1019
- setMessage: d
1020
- })] })
1021
- });
1022
- };
1023
- //#endregion
1024
- //#region src/client/routes/_auth/projects/$projectId/compute/-components/Images/-components/ImageListView.tsx
1025
- function Qe({ images: e, suggestedImages: t, acceptedImages: n, permissions: r, isFetching: i, currentPage: s = 1, totalPages: u = 1, onPageChange: f, children: p, selectedImages: m, setSelectedImages: g, deleteAllModalOpen: _, setDeleteAllModalOpen: b, deactivateAllModalOpen: x, setDeactivateAllModalOpen: S, activateAllModalOpen: ee, setActivateAllModalOpen: w, createModalOpen: T, setCreateModalOpen: k, deletableImages: A, protectedImages: j, activeImages: M, deactivatedImages: N, onImageUpdated: ie, onImageDeleted: F, onMemberStatusChanged: I, hasAnyBulkAction: z }) {
1026
- let U = te(), [ue, be] = Y(!1), [Te, Ee] = Y(!1), [De, Oe] = Y(!1), [ke, Ae] = Y(!1), [Me, Ne] = Y(!1), [Pe, Fe] = Y(!1), [X, Q] = Y(null), [Le, Be] = Y(!1), [Ve, He] = Y(null), [Ue, We] = Y(!1), [Ge, qe] = Y(s.toString());
1027
- je(() => {
1028
- qe(s.toString());
1029
- }, [s]);
1030
- let $ = D.useUtils(), Qe = D.compute.deleteImage.useMutation({ onSuccess: () => {
1031
- $.compute.listImagesWithPagination.invalidate();
1032
- } }), $e = D.compute.deactivateImage.useMutation({ onSuccess: () => {
1033
- $.compute.listImagesWithPagination.invalidate(), $.compute.getImageById.invalidate();
1034
- } }), et = D.compute.reactivateImage.useMutation({ onSuccess: () => {
1035
- $.compute.listImagesWithPagination.invalidate(), $.compute.getImageById.invalidate();
1036
- } }), tt = D.compute.deleteImages.useMutation({ onSuccess: () => {
1037
- $.compute.listImagesWithPagination.invalidate(), g([]);
1038
- } }), nt = D.compute.activateImages.useMutation({ onSuccess: () => {
1039
- $.compute.listImagesWithPagination.invalidate(), g([]);
1040
- } }), rt = D.compute.deactivateImages.useMutation({ onSuccess: () => {
1041
- $.compute.listImagesWithPagination.invalidate(), g([]);
1042
- } }), it = D.compute.updateImage.useMutation({ onSuccess: (e) => {
1043
- $.compute.listImagesWithPagination.invalidate(), $.compute.getImageById.setData({
1044
- project_id: U,
1045
- imageId: e.id
1046
- }, e);
1047
- } }), at = D.compute.createImage.useMutation({ onSuccess: () => {
1048
- $.compute.listImagesWithPagination.invalidate();
1049
- } }), ot = D.compute.updateImageVisibility.useMutation({ onSuccess: (e) => {
1050
- ie(e);
1051
- } }), { data: st } = D.compute.watchUploadProgress.useSubscription({
1052
- project_id: U,
1053
- uploadId: Ve || ""
1054
- }, { enabled: !!Ve && Ue }), ct = Qe.isPending || $e.isPending || et.isPending || tt.isPending || nt.isPending || rt.isPending || it.isPending, lt = async (e, t, n) => {
1055
- try {
1056
- await ot.mutateAsync({
1057
- project_id: U,
1058
- imageId: e,
1059
- visibility: t
1060
- });
1061
- let { message: r, ...i } = Se(n, t);
1062
- h.success(r, i);
1063
- } catch (e) {
1064
- let r = e?.message || Re._({
1065
- id: "J9cmxx",
1066
- values: { newVisibility: t }
1067
- }), { message: i, ...a } = P(n, r);
1068
- h.error(i, a);
1069
- }
1070
- }, ut = (e, t) => {
1071
- let n = [];
1072
- return Object.entries(e).forEach(([e, r]) => {
1073
- let i = `/${e}`;
1074
- r == null ? e in t && n.push({
1075
- op: "remove",
1076
- path: i
1077
- }) : e in t ? n.push({
1078
- op: "replace",
1079
- path: i,
1080
- value: r
1081
- }) : n.push({
1082
- op: "add",
1083
- path: i,
1084
- value: r
1085
- });
1086
- }), n;
1087
- }, dt = async (e) => {
1088
- if (!X) return !1;
1089
- let t = X.id, n = e.name || X.name || t;
1090
- try {
1091
- let r = ut(e, X), i = await it.mutateAsync({
1092
- project_id: U,
1093
- imageId: t,
1094
- operations: r
1095
- });
1096
- be(!1);
1097
- let { message: a, ...o } = ae(n);
1098
- return h.success(a, o), Q(i), ie(i), !0;
1099
- } catch (e) {
1100
- let t = e?.message ?? "", { message: r, ...i } = Ce(n, t);
1101
- return h.error(r, i), Q(null), !1;
1102
- }
1103
- }, ft = async (e, t) => {
1104
- let n = e.name || "Unnamed";
1105
- try {
1106
- Be(!0);
1107
- let r = await at.mutateAsync({
1108
- project_id: U,
1109
- ...e
1110
- });
1111
- He(r.id), We(!0), await O.compute.uploadImage.mutate(t, { context: { headers: {
1112
- "x-project-id": U,
1113
- "x-upload-id": r.id,
1114
- "x-upload-size": String(t.size)
1115
- } } });
1116
- let { message: i, ...a } = G(n);
1117
- h.success(i, a), $.compute.listImagesWithPagination.invalidate();
1118
- } catch (e) {
1119
- if (e instanceof Ie && e.data?.path === "compute.createImage") {
1120
- let { message: t, ...r } = pe(n, e.message);
1121
- h.error(t, r);
1122
- } else {
1123
- let n = e?.message ?? "", { message: r, ...i } = oe(t.name, n);
1124
- h.error(r, i);
1125
- }
1126
- } finally {
1127
- Be(!1), k(!1), We(!1), He(null);
1128
- }
1129
- }, pt = async (e) => {
1130
- be(!1), Ee(!1);
1131
- let t = e.name || e.id, n = e.id;
1132
- try {
1133
- await Qe.mutateAsync({
1134
- project_id: U,
1135
- imageId: n
1136
- });
1137
- let { message: e, ...r } = we(t);
1138
- h.success(e, r), F(n);
1139
- } catch (e) {
1140
- let t = e?.message ?? "", { message: r, ...i } = xe(n, t);
1141
- h.error(r, i);
1142
- }
1143
- Q(null);
1144
- }, mt = async (e) => {
1145
- e.status === L.DEACTIVATED ? (Q(e), Ne(!0)) : (Q(e), Ae(!0));
1146
- }, ht = async (e) => {
1147
- let t = e.name || e.id, n = e.id;
1148
- try {
1149
- await et.mutateAsync({
1150
- project_id: U,
1151
- imageId: n
1152
- }), Ne(!1), Q(null);
1153
- let { message: e, ...r } = W(t);
1154
- h.success(e, r);
1155
- } catch (e) {
1156
- let t = e?.message ?? "", { message: r, ...i } = ge(n, t);
1157
- h.error(r, i);
1158
- }
1159
- }, gt = async (e) => {
1160
- let t = e.name || e.id, n = e.id;
1161
- try {
1162
- await $e.mutateAsync({
1163
- project_id: U,
1164
- imageId: n
1165
- }), Ae(!1), Q(null);
1166
- let { message: e, ...r } = ce(t);
1167
- h.success(e, r);
1168
- } catch (e) {
1169
- let t = e?.message ?? "", { message: r, ...i } = V(n, t);
1170
- h.error(r, i);
1171
- }
1172
- }, _t = (e) => {
1173
- Q(e), be(!0);
1174
- }, vt = (e) => {
1175
- Q(e), Ee(!0);
1176
- }, yt = (e) => {
1177
- Q(e), Oe(!0);
1178
- }, bt = (e) => {
1179
- Q(e), Fe(!0);
1180
- }, xt = () => {
1181
- Q(null), be(!1);
1182
- }, St = () => {
1183
- Q(null), Ee(!1);
1184
- }, Ct = () => {
1185
- Q(null), Oe(!1);
1186
- }, wt = () => {
1187
- Q(null), Ae(!1);
1188
- }, Tt = () => {
1189
- Q(null), Ne(!1);
1190
- }, Et = () => {
1191
- Q(null), Fe(!1);
1192
- }, Dt = async (e) => {
1193
- b(!1);
1194
- try {
1195
- let t = await tt.mutateAsync({
1196
- project_id: U,
1197
- imageIds: e
1198
- }), n = t.successful.length, r = t.failed.length, i = e.length;
1199
- if (r === 0) {
1200
- let { message: e, ...t } = fe(n, i);
1201
- h.success(e, t);
1202
- } else if (n === 0) {
1203
- let { message: e, ...t } = ve(r, i);
1204
- h.error(e, t);
1205
- } else {
1206
- let { message: e, ...t } = se(n, r);
1207
- h.warning(e, t);
1208
- }
1209
- t.successful.length > 0 && F(t.successful);
1210
- } catch (t) {
1211
- let n = t?.message ?? "";
1212
- console.log("Bulk delete error: ", n);
1213
- let { message: r, ...i } = ve(e.length, e.length);
1214
- h.error(r, i);
1215
- }
1216
- }, Ot = async (e) => {
1217
- w(!1);
1218
- try {
1219
- let t = await nt.mutateAsync({
1220
- project_id: U,
1221
- imageIds: e
1222
- }), n = t.successful.length, r = t.failed.length, i = e.length;
1223
- if (r === 0) {
1224
- let { message: e, ...t } = _e(n, i);
1225
- h.success(e, t);
1226
- } else if (n === 0) {
1227
- let { message: e, ...t } = ye(r, i);
1228
- h.error(e, t);
1229
- } else {
1230
- let { message: e, ...t } = me(n, r);
1231
- h.warning(e, t);
1232
- }
1233
- } catch (t) {
1234
- let n = t?.message ?? "";
1235
- console.log("Bulk activate error: ", n);
1236
- let { message: r, ...i } = ye(e.length, e.length);
1237
- h.error(r, i);
1238
- }
1239
- }, kt = async (e) => {
1240
- S(!1);
1241
- try {
1242
- let t = await rt.mutateAsync({
1243
- project_id: U,
1244
- imageIds: e
1245
- }), n = t.successful.length, r = t.failed.length, i = e.length;
1246
- if (r === 0) {
1247
- let { message: e, ...t } = he(n, i);
1248
- h.success(e, t);
1249
- } else if (n === 0) {
1250
- let { message: e, ...t } = le(r, i);
1251
- h.error(e, t);
1252
- } else {
1253
- let { message: e, ...t } = H(n, r);
1254
- h.warning(e, t);
1255
- }
1256
- } catch (t) {
1257
- let n = t?.message ?? "";
1258
- console.log("Bulk deactivate error: ", n);
1259
- let { message: r, ...i } = le(e.length, e.length);
1260
- h.error(r, i);
1261
- }
1262
- }, At = (e) => {
1263
- e >= 1 && e <= u && (f?.(e), qe(e.toString()));
1264
- };
1265
- return ct ? /*#__PURE__*/ q("div", {
1266
- "data-testid": "loading",
1267
- children: /*#__PURE__*/ q(o, { children: /*#__PURE__*/ q(C, {
1268
- colSpan: 3,
1269
- children: /*#__PURE__*/ J(l, {
1270
- distribution: "center",
1271
- alignment: "center",
1272
- children: [/*#__PURE__*/ q(c, { variant: "primary" }), /*#__PURE__*/ q(Z, { id: "Z3FXyt" })]
1273
- })
1274
- }) })
1275
- }) : /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q(K, { children: p }), /*#__PURE__*/ J("div", {
1276
- className: "relative",
1277
- children: [
1278
- i && /*#__PURE__*/ q("div", {
1279
- className: "bg-theme-background-lvl-0/50 absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm",
1280
- children: /*#__PURE__*/ J(l, {
1281
- direction: "vertical",
1282
- alignment: "center",
1283
- gap: "2",
1284
- children: [/*#__PURE__*/ q(c, {
1285
- variant: "primary",
1286
- size: "large"
1287
- }), /*#__PURE__*/ q("span", {
1288
- className: "text-theme-high font-medium",
1289
- children: /*#__PURE__*/ q(Z, { id: "sihD20" })
1290
- })]
1291
- })
1292
- }),
1293
- e.length > 0 ? /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ J(y, {
1294
- columns: z ? 9 : 8,
1295
- minContentColumns: z ? [0, 8] : [7],
1296
- className: "images",
1297
- "data-testid": "images-table",
1298
- children: [/*#__PURE__*/ J(o, { children: [
1299
- z && /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(d, {
1300
- checked: (() => {
1301
- let t = e.map((e) => e.id);
1302
- return t.length > 0 && t.every((e) => m.includes(e));
1303
- })(),
1304
- onChange: () => {
1305
- let t = e.map((e) => e.id);
1306
- return t.every((e) => m.includes(e)) ? g(m.filter((e) => !t.includes(e))) : g([.../* @__PURE__ */ new Set([...m, ...t])]);
1307
- }
1308
- }) }),
1309
- /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(Z, { id: "uAQUqI" }) }),
1310
- /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(Z, { id: "ExLULX" }) }),
1311
- /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(Z, { id: "2q/Q7x" }) }),
1312
- /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(Z, { id: "644xgx" }) }),
1313
- /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(Z, { id: "Cj2Gtd" }) }),
1314
- /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(Z, { id: "NopYGU" }) }),
1315
- /*#__PURE__*/ q(a, { children: /*#__PURE__*/ q(Z, { id: "d+F6q9" }) }),
1316
- /*#__PURE__*/ q(a, {})
1317
- ] }), e.map((e) => /*#__PURE__*/ q(ze, {
1318
- image: e,
1319
- isSelected: m.includes(e.id),
1320
- isPending: !!t.find(({ id: t }) => t === e.id),
1321
- isAccepted: !!n.find(({ id: t }) => t === e.id),
1322
- permissions: r,
1323
- onEditDetails: _t,
1324
- onEditMetadata: vt,
1325
- onDelete: yt,
1326
- onManageAccess: bt,
1327
- showSelectColumn: z,
1328
- onSelect: (e) => {
1329
- if (m.includes(e.id)) return g(m.filter((t) => t !== e.id));
1330
- g([...m, e.id]);
1331
- },
1332
- onActivationStatusChange: mt,
1333
- onUpdateVisibility: lt,
1334
- uploadId: Ve,
1335
- uploadProgressPercent: st?.percent,
1336
- onMemberStatusChanged: I
1337
- }, e.id))]
1338
- }), u > 1 && /*#__PURE__*/ q("div", {
1339
- className: "flex justify-center py-4",
1340
- children: /*#__PURE__*/ q(E, {
1341
- variant: "input",
1342
- currentPage: s,
1343
- pages: u,
1344
- onPressPrevious: () => At(Math.max(s - 1, 1)),
1345
- onPressNext: () => At(Math.min(s + 1, u)),
1346
- onSelectChange: (e) => {
1347
- At(e);
1348
- },
1349
- onInputChange: (e) => {
1350
- qe(e === void 0 ? "" : String(e));
1351
- },
1352
- onKeyDown: (e) => {
1353
- if (e.key === "Enter" && Ge !== "") {
1354
- let e = parseInt(Ge, 10);
1355
- !isNaN(e) && e >= 1 && e <= u && At(e);
1356
- }
1357
- }
1358
- })
1359
- })] }) : /*#__PURE__*/ q(y, {
1360
- columns: 7,
1361
- minContentColumns: [0, 6],
1362
- className: "images",
1363
- "data-testid": "no-images",
1364
- children: /*#__PURE__*/ q(o, { children: /*#__PURE__*/ J(C, {
1365
- colSpan: 7,
1366
- children: [/*#__PURE__*/ q(v, { children: /*#__PURE__*/ q(Z, { id: "eYlnXt" }) }), /*#__PURE__*/ q("p", { children: /*#__PURE__*/ q(Z, { id: "qvF2D8" }) })]
1367
- }) })
1368
- }),
1369
- X && /*#__PURE__*/ J(K, { children: [
1370
- /*#__PURE__*/ q(de, {
1371
- isOpen: ue,
1372
- onClose: xt,
1373
- image: X,
1374
- onSave: dt,
1375
- isLoading: it.isPending
1376
- }),
1377
- /*#__PURE__*/ q(R, {
1378
- isOpen: Te,
1379
- onClose: St,
1380
- image: X,
1381
- onSave: dt,
1382
- isLoading: it.isPending
1383
- }),
1384
- /*#__PURE__*/ q(ne, {
1385
- image: X,
1386
- isOpen: De,
1387
- isLoading: ct,
1388
- isDisabled: X.protected || !r.canDelete,
1389
- onClose: Ct,
1390
- onDelete: pt
1391
- }),
1392
- /*#__PURE__*/ q(B, {
1393
- image: X,
1394
- isOpen: ke,
1395
- isLoading: $e.isPending,
1396
- onClose: wt,
1397
- onDeactivate: gt
1398
- }),
1399
- /*#__PURE__*/ q(re, {
1400
- image: X,
1401
- isOpen: Me,
1402
- isLoading: et.isPending,
1403
- onClose: Tt,
1404
- onActivate: ht
1405
- }),
1406
- /*#__PURE__*/ q(Ze, {
1407
- image: X,
1408
- isOpen: Pe,
1409
- onClose: Et,
1410
- permissions: r
1411
- })
1412
- ] }),
1413
- /*#__PURE__*/ q(Je, {
1414
- isOpen: _,
1415
- deletableImages: A,
1416
- protectedImages: j,
1417
- isLoading: ct,
1418
- onClose: () => b(!1),
1419
- onDelete: Dt
1420
- }),
1421
- /*#__PURE__*/ q(Ye, {
1422
- isOpen: x,
1423
- activeImages: M,
1424
- deactivatedImages: N,
1425
- isLoading: ct,
1426
- onClose: () => S(!1),
1427
- onDeactivate: kt
1428
- }),
1429
- /*#__PURE__*/ q(Xe, {
1430
- isOpen: ee,
1431
- deactivatedImages: N,
1432
- activeImages: M,
1433
- isLoading: ct,
1434
- onClose: () => w(!1),
1435
- onActivate: Ot
1436
- }),
1437
- /*#__PURE__*/ q(Ke, {
1438
- isOpen: T,
1439
- onClose: () => {
1440
- Ve && $.compute.listImagesWithPagination.invalidate(), k(!1);
1441
- },
1442
- onCreate: ft,
1443
- isLoading: at.isPending || Ue || Le,
1444
- isUploadPending: Ue && !!Ve,
1445
- uploadProgressPercent: st?.percent
1446
- })
1447
- ]
1448
- })] });
1449
- }
1450
- //#endregion
1451
- //#region src/client/routes/_auth/projects/$projectId/compute/-components/Images/urlHelpers.ts
1452
- var $e = (e) => {
1453
- let t = [];
1454
- return e.status && (e.status.startsWith("in:") ? e.status.replace("in:", "").split(",") : [e.status]).forEach((e) => {
1455
- t.push({
1456
- name: "status",
1457
- value: e
1458
- });
1459
- }), e.visibility && t.push({
1460
- name: "visibility",
1461
- value: e.visibility
1462
- }), e.disk_format && (e.disk_format.startsWith("in:") ? e.disk_format.replace("in:", "").split(",") : [e.disk_format]).forEach((e) => {
1463
- t.push({
1464
- name: "disk_format",
1465
- value: e
1466
- });
1467
- }), e.container_format && (e.container_format.startsWith("in:") ? e.container_format.replace("in:", "").split(",") : [e.container_format]).forEach((e) => {
1468
- t.push({
1469
- name: "container_format",
1470
- value: e
1471
- });
1472
- }), e.protected && t.push({
1473
- name: "protected",
1474
- value: e.protected
1475
- }), t;
1476
- }, et = (e, t) => {
1477
- let n = {};
1478
- if (!e?.length) return n;
1479
- let r = e.filter((e) => !e.inactive).reduce((e, t) => (e[t.name] || (e[t.name] = []), e[t.name].push(t.value), e), {});
1480
- return Object.entries(r).forEach(([e, r]) => {
1481
- t.find((t) => t.filterName === e)?.supportsMultiValue && r.length > 1 ? n[e] = `in:${r.join(",")}` : n[e] = r[0];
1482
- }), n;
1483
- }, tt = (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], nt = (e, t, n) => {
1484
- let r = {
1485
- search: n.search,
1486
- sortBy: n.sortBy,
1487
- sortDirection: n.sortDirection,
1488
- memberStatus: n.memberStatus === "all" ? void 0 : n.memberStatus
1489
- };
1490
- if (!e?.length) return r;
1491
- let i = e.filter((e) => !e.inactive).reduce((e, t) => (e[t.name] || (e[t.name] = []), e[t.name].push(t.value), e), {});
1492
- return Object.entries(i).forEach(([e, n]) => {
1493
- t.find((t) => t.filterName === e)?.supportsMultiValue && n.length > 1 ? r[e] = `in:${n.join(",")}` : r[e] = n[0];
1494
- }), r;
1495
- }, rt = {
1496
- images: [],
1497
- first: void 0,
1498
- next: void 0,
1499
- schema: "/v2/schemas/images",
1500
- listError: void 0
1501
- }, it = (e, t, n, r, i, a) => a.member_status && a.member_status !== "all" ? e.compute.listSharedImagesByMemberStatus.query({
1502
- project_id: t,
1503
- memberStatus: a.member_status,
1504
- name: i || void 0,
1505
- status: a.status,
1506
- disk_format: a.disk_format,
1507
- container_format: a.container_format,
1508
- protected: a.protected,
1509
- sort: `${n}:${r}`
1510
- }).then((e) => ({
1511
- ...rt,
1512
- images: e
1513
- })).catch((e) => {
1514
- if (e instanceof Ie && e.data?.code === "FORBIDDEN") return {
1515
- ...rt,
1516
- listError: e.message
1517
- };
1518
- throw e;
1519
- }) : e.compute.listImagesWithSearch.query({
1520
- project_id: t,
1521
- sort: `${n}:${r}`,
1522
- name: i || void 0,
1523
- ...a,
1524
- member_status: void 0
1525
- }).then((e) => ({
1526
- ...e,
1527
- listError: void 0
1528
- })).catch((e) => {
1529
- if (e instanceof Ie && e.data?.code === "FORBIDDEN") return {
1530
- ...rt,
1531
- listError: e.message
1532
- };
1533
- throw e;
1534
- }), at = (e, t) => e.compute.canUser.query({
1535
- project_id: t,
1536
- permission: [
1537
- "images:create",
1538
- "images:delete",
1539
- "images:update",
1540
- "images:create_member",
1541
- "images:delete_member",
1542
- "images:update_member"
1543
- ]
1544
- }).then(([e, t, n, r, i, a]) => ({
1545
- canCreate: e,
1546
- canDelete: t,
1547
- canUpdate: n,
1548
- canCreateMember: r,
1549
- canDeleteMember: i,
1550
- canUpdateMember: a ?? !1
1551
- })), ot = 50;
1552
- function st({ imagesPromise: t, imageOverrides: n, deletedImageIds: r, permissionsPromise: a, searchTerm: o, setSearchTerm: s, sortSettings: c, handleSortChange: m, filterSettings: h, handleFilterChange: _, selectedImages: v, setSelectedImages: y, createModalOpen: b, setCreateModalOpen: C, deleteAllModalOpen: ee, setDeleteAllModalOpen: w, deactivateAllModalOpen: E, setDeactivateAllModalOpen: D, activateAllModalOpen: O, setActivateAllModalOpen: k, memberStatusView: A, setMemberStatusView: te, isFetching: M, currentPage: N, onPageChange: P, onImageUpdated: ne, onImageDeleted: re, onMemberStatusChanged: ie }) {
1553
- let { i18n: F, _: I } = Q(), R = ke(t), z = ke(a), [ae, B] = Y(o), V = Ne(void 0);
1554
- if (je(() => () => clearTimeout(V.current), []), R.listError) return /*#__PURE__*/ q("p", { children: R.listError });
1555
- let H = R.images.filter((e) => !r.has(e.id)).map((e) => n.get(e.id) ?? e), oe = Math.max(1, Math.ceil(H.length / ot)), se = Math.min(N, oe), U = H.slice((se - 1) * ot, se * ot);
1556
- je(() => {
1557
- N !== 1 && N > oe && P(1);
1558
- }, [
1559
- oe,
1560
- N,
1561
- P
1562
- ]);
1563
- let W = A === "pending" || A === "accepted" ? {
1564
- ...h,
1565
- filters: h.filters.filter((e) => e.filterName !== "visibility"),
1566
- selectedFilters: (h.selectedFilters || []).filter((e) => e.name !== "visibility")
1567
- } : h, ce = new Set(H.map((e) => e.id)), G = v.filter((e) => ce.has(e)), le = G.filter((e) => {
1568
- let t = H.find((t) => t.id === e);
1569
- return t && !t.protected;
1570
- }), ue = G.filter((e) => {
1571
- let t = H.find((t) => t.id === e);
1572
- return t && t.protected;
1573
- }), de = G.filter((e) => {
1574
- let t = H.find((t) => t.id === e);
1575
- return t && t.status === L.ACTIVE;
1576
- }), fe = G.filter((e) => {
1577
- let t = H.find((t) => t.id === e);
1578
- return t && t.status === L.DEACTIVATED;
1579
- }), pe = !z.canDelete || G.length === 0 || H.filter((e) => G.includes(e.id)).every((e) => e.protected), me = !z.canUpdate || G.length === 0 || H.filter((e) => G.includes(e.id)).every((e) => e.status === L.DEACTIVATED), he = !z.canUpdate || G.length === 0 || H.filter((e) => G.includes(e.id)).every((e) => e.status === L.ACTIVE), ge = {
1580
- items: [
1581
- {
1582
- label: F._({ id: "SFo0kK" }),
1583
- value: "all"
1584
- },
1585
- {
1586
- label: F._({ id: "thHAVL" }),
1587
- value: "accepted"
1588
- },
1589
- {
1590
- label: F._({ id: "E4QYe7" }),
1591
- value: "pending"
1592
- }
1593
- ],
1594
- activeItem: A,
1595
- onActiveItemChange: (e) => te(e)
1596
- };
1597
- return /*#__PURE__*/ J(K, { children: [
1598
- /*#__PURE__*/ J(l, {
1599
- distribution: "between",
1600
- alignment: "center",
1601
- gap: "2",
1602
- children: [/*#__PURE__*/ q(S, {
1603
- activeItem: A,
1604
- onActiveItemChange: ge.onActiveItemChange,
1605
- children: ge.items.map((e) => /*#__PURE__*/ q(x, {
1606
- label: e.label,
1607
- value: e.value
1608
- }, e.value))
1609
- }), /*#__PURE__*/ J(l, {
1610
- gap: "0.5",
1611
- alignment: "center",
1612
- children: [/*#__PURE__*/ q(j, {
1613
- options: c.options,
1614
- sortBy: c.sortBy,
1615
- sortDirection: c.sortDirection ?? "desc",
1616
- selectClassName: "min-w-40",
1617
- onSortByChange: (e) => m({
1618
- ...c,
1619
- sortBy: e,
1620
- sortDirection: c.sortDirection
1621
- }),
1622
- onSortDirectionChange: (e) => m({
1623
- ...c,
1624
- sortDirection: e
1625
- })
1626
- }), z.canCreate && /*#__PURE__*/ q(u, {
1627
- onClick: () => C(!0),
1628
- variant: "primary",
1629
- children: /*#__PURE__*/ q(Z, { id: "a/nTb8" })
1630
- })]
1631
- })]
1632
- }),
1633
- /*#__PURE__*/ q(g, { children: /*#__PURE__*/ J(l, {
1634
- direction: "vertical",
1635
- gap: "2",
1636
- children: [/*#__PURE__*/ J(l, {
1637
- distribution: "between",
1638
- alignment: "center",
1639
- children: [/*#__PURE__*/ q(Ee, {
1640
- filters: W.filters,
1641
- selectClassName: "sm:min-w-40",
1642
- comboboxClassName: "sm:min-w-40",
1643
- onChange: (e) => {
1644
- let t = tt(W.selectedFilters || [], e, W.filters);
1645
- t !== (W.selectedFilters || []) && _({
1646
- ...h,
1647
- selectedFilters: t
1648
- });
1649
- }
1650
- }), /*#__PURE__*/ q(e, {
1651
- placeholder: F._({ id: "0cl0a5" }),
1652
- "data-testid": "searchbar",
1653
- value: ae,
1654
- onInput: (e) => {
1655
- let t = e.currentTarget.value;
1656
- B(t), clearTimeout(V.current), V.current = window.setTimeout(() => s(t), 500);
1657
- },
1658
- onSearch: (e) => {
1659
- clearTimeout(V.current), s(typeof e == "string" ? e : "");
1660
- },
1661
- onClear: () => {
1662
- clearTimeout(V.current), B(""), s("");
1663
- }
1664
- })]
1665
- }), W.selectedFilters && W.selectedFilters.length > 0 && /*#__PURE__*/ q(Te, {
1666
- selectedFilters: W.selectedFilters,
1667
- onDelete: (e) => _({
1668
- ...h,
1669
- selectedFilters: (h.selectedFilters || []).filter((t) => t.name !== e.name || t.value !== e.value)
1670
- }),
1671
- onClear: () => _({
1672
- ...h,
1673
- selectedFilters: []
1674
- })
1675
- })]
1676
- }) }),
1677
- (z.canDelete || z.canUpdate) && /*#__PURE__*/ q(g, { children: /*#__PURE__*/ q(l, {
1678
- distribution: "between",
1679
- alignment: "center",
1680
- children: /*#__PURE__*/ J(l, {
1681
- gap: "2",
1682
- alignment: "center",
1683
- children: [/*#__PURE__*/ q(d, {
1684
- checked: G.length > 0 && U.every((e) => G.includes(e.id)),
1685
- indeterminate: G.length > 0 && !U.every((e) => G.includes(e.id)),
1686
- onChange: () => {
1687
- let e = U.map((e) => e.id);
1688
- e.every((e) => G.includes(e)) ? y(G.filter((t) => !e.includes(t))) : y([.../* @__PURE__ */ new Set([...G, ...e])]);
1689
- }
1690
- }), /*#__PURE__*/ J(i, { children: [/*#__PURE__*/ q(f, {
1691
- as: "div",
1692
- children: /*#__PURE__*/ q(u, {
1693
- size: "small",
1694
- icon: "moreVert",
1695
- label: F._({ id: "7L01XJ" })
1696
- })
1697
- }), /*#__PURE__*/ J(p, { children: [
1698
- z.canDelete && /*#__PURE__*/ q(T, {
1699
- disabled: pe,
1700
- label: F._({ id: "c6b6fz" }),
1701
- onClick: () => w(!0)
1702
- }),
1703
- z.canUpdate && /*#__PURE__*/ q(T, {
1704
- disabled: me,
1705
- label: F._({ id: "UmQ3/m" }),
1706
- onClick: () => D(!0)
1707
- }),
1708
- z.canUpdate && /*#__PURE__*/ q(T, {
1709
- disabled: he,
1710
- label: F._({ id: "d/I0J3" }),
1711
- onClick: () => k(!0)
1712
- })
1713
- ] })] })]
1714
- })
1715
- }) }),
1716
- /*#__PURE__*/ q(Qe, {
1717
- images: U,
1718
- suggestedImages: A === "pending" ? U : [],
1719
- acceptedImages: A === "accepted" ? U : [],
1720
- permissions: z,
1721
- isFetching: M,
1722
- currentPage: se,
1723
- totalPages: oe,
1724
- onPageChange: P,
1725
- selectedImages: v,
1726
- setSelectedImages: y,
1727
- deleteAllModalOpen: ee,
1728
- setDeleteAllModalOpen: w,
1729
- deactivateAllModalOpen: E,
1730
- setDeactivateAllModalOpen: D,
1731
- activateAllModalOpen: O,
1732
- setActivateAllModalOpen: k,
1733
- createModalOpen: b,
1734
- setCreateModalOpen: C,
1735
- deletableImages: le,
1736
- protectedImages: ue,
1737
- activeImages: de,
1738
- deactivatedImages: fe,
1739
- onImageUpdated: ne,
1740
- onImageDeleted: re,
1741
- onMemberStatusChanged: ie,
1742
- hasAnyBulkAction: z.canDelete || z.canUpdate
1743
- })
1744
- ] });
1745
- }
1746
- var ct = ({ client: e, project: n }) => {
1747
- let { i18n: r, _: i } = Q(), a = Pe(), o = X({ strict: !1 }), [s, u] = Y({
1748
- options: [
1749
- {
1750
- label: r._({ id: "88kg0+" }),
1751
- value: "created_at"
1752
- },
1753
- {
1754
- label: r._({ id: "Llcakz" }),
1755
- value: "updated_at"
1756
- },
1757
- {
1758
- label: r._({ id: "6YtxFj" }),
1759
- value: "name"
1760
- },
1761
- {
1762
- label: r._({ id: "Cj2Gtd" }),
1763
- value: "size"
1764
- },
1765
- {
1766
- label: r._({ id: "uAQUqI" }),
1767
- value: "status"
1768
- }
1769
- ],
1770
- sortBy: o.sortBy || "created_at",
1771
- sortDirection: o.sortDirection || "desc"
1772
- }), [d, f] = Y({
1773
- filters: [
1774
- {
1775
- displayName: r._({ id: "uAQUqI" }),
1776
- filterName: "status",
1777
- values: Object.values(L),
1778
- supportsMultiValue: !0
1779
- },
1780
- {
1781
- displayName: r._({ id: "2q/Q7x" }),
1782
- filterName: "visibility",
1783
- values: Object.values(z),
1784
- supportsMultiValue: !1
1785
- },
1786
- {
1787
- displayName: r._({ id: "NopYGU" }),
1788
- filterName: "disk_format",
1789
- values: Object.values(I),
1790
- supportsMultiValue: !0
1791
- },
1792
- {
1793
- displayName: r._({ id: "6/xipy" }),
1794
- filterName: "container_format",
1795
- values: Object.values(ue),
1796
- supportsMultiValue: !0
1797
- },
1798
- {
1799
- displayName: r._({ id: "644xgx" }),
1800
- filterName: "protected",
1801
- values: ["true", "false"],
1802
- supportsMultiValue: !1
1803
- }
1804
- ],
1805
- selectedFilters: $e(o)
1806
- }), [p, m] = Y(o.search || ""), h = o.page ?? 1, [g, _] = Y([]), [v, y] = Y(!1), [b, x] = Y(!1), [S, C] = Y(!1), [ee, w] = Y(!1), T = o.memberStatus ?? "all", [E, D] = Y(!0), [O, k] = Y(/* @__PURE__ */ new Map()), [A, te] = Y(/* @__PURE__ */ new Set()), [j, M] = Y(() => new Promise(() => {})), [N] = Y(() => at(e, n)), P = Ae((e) => {
1807
- k((t) => new Map(t).set(e.id, e));
1808
- }, []), ne = Ae((e) => {
1809
- te((t) => {
1810
- let n = new Set(t);
1811
- return Array.isArray(e) ? e.forEach((e) => n.add(e)) : n.add(e), n;
1812
- });
1813
- }, []), re = Ae(() => {
1814
- k(/* @__PURE__ */ new Map()), D(!0);
1815
- let t = o.memberStatus ?? "all", r = t === "all" ? void 0 : t;
1816
- Oe(() => {
1817
- let i = t === "pending" || t === "accepted" ? (d.selectedFilters || []).filter((e) => e.name !== "visibility") : d.selectedFilters || [], a = it(e, n, s.sortBy, s.sortDirection, p, {
1818
- ...et(i, d.filters),
1819
- member_status: r
1820
- });
1821
- a.catch(() => {}).finally(() => D(!1)), M(a);
1822
- });
1823
- }, [
1824
- e,
1825
- s,
1826
- p,
1827
- d,
1828
- o.memberStatus
1829
- ]);
1830
- je(() => {
1831
- let t = $e(o), r = o.sortBy || "created_at", i = o.sortDirection || "desc", a = o.search || "";
1832
- f((e) => ({
1833
- ...e,
1834
- selectedFilters: t
1835
- })), u((e) => ({
1836
- ...e,
1837
- sortBy: r,
1838
- sortDirection: i
1839
- })), m(a), _([]), k(/* @__PURE__ */ new Map()), D(!0);
1840
- let s = o.memberStatus ?? "all", c = s === "all" ? void 0 : s;
1841
- Oe(() => {
1842
- let o = s === "pending" || s === "accepted" ? (t || []).filter((e) => e.name !== "visibility") : t || [], l = it(e, n, r, i, a, {
1843
- ...et(o, d.filters),
1844
- member_status: c
1845
- });
1846
- l.catch(() => {}).finally(() => D(!1)), M(l);
1847
- });
1848
- }, [
1849
- o.status,
1850
- o.visibility,
1851
- o.disk_format,
1852
- o.container_format,
1853
- o.protected,
1854
- o.sortBy,
1855
- o.sortDirection,
1856
- o.search,
1857
- o.memberStatus
1858
- ]);
1859
- let ie = (e) => {
1860
- let t = {
1861
- options: e.options,
1862
- sortBy: e.sortBy?.toString() || "created_at",
1863
- sortDirection: e.sortDirection || "desc"
1864
- };
1865
- u(t), a({
1866
- search: (e) => ({
1867
- ...e,
1868
- sortBy: t.sortBy,
1869
- sortDirection: t.sortDirection,
1870
- page: void 0
1871
- }),
1872
- replace: !0
1873
- });
1874
- }, F = (e) => {
1875
- f(e), a({
1876
- search: (t) => nt(e.selectedFilters || [], e.filters, {
1877
- search: t.search,
1878
- sortBy: t.sortBy,
1879
- sortDirection: t.sortDirection,
1880
- memberStatus: t.memberStatus
1881
- }),
1882
- replace: !0
1883
- });
1884
- }, R = (e) => {
1885
- let t = typeof e == "string" ? e : "";
1886
- m(t), a({
1887
- search: (e) => ({
1888
- ...e,
1889
- search: t || void 0,
1890
- page: void 0
1891
- }),
1892
- replace: !0
1893
- });
1894
- }, ae = (e) => {
1895
- a({ search: (t) => ({
1896
- sortBy: t.sortBy,
1897
- sortDirection: t.sortDirection,
1898
- search: t.search,
1899
- memberStatus: e === "all" ? void 0 : e
1900
- }) });
1901
- }, B = Ae((e) => {
1902
- a({ search: (t) => ({
1903
- ...t,
1904
- page: e === 1 ? void 0 : e
1905
- }) });
1906
- }, [a]);
1907
- return /*#__PURE__*/ q("div", {
1908
- className: "relative",
1909
- children: /*#__PURE__*/ q(Le, {
1910
- fallbackRender: ({ error: e }) => /*#__PURE__*/ q(t, {
1911
- variant: "error",
1912
- text: e instanceof Error ? e.message : r._({ id: "W5A0Ly" })
1913
- }),
1914
- children: /*#__PURE__*/ q(De, {
1915
- fallback: /*#__PURE__*/ J(l, {
1916
- className: "fixed inset-0",
1917
- distribution: "center",
1918
- alignment: "center",
1919
- direction: "vertical",
1920
- children: [/*#__PURE__*/ q(c, {
1921
- variant: "primary",
1922
- size: "large",
1923
- className: "mb-2"
1924
- }), /*#__PURE__*/ q(Z, { id: "HBpi4q" })]
1925
- }),
1926
- children: /*#__PURE__*/ q(st, {
1927
- imagesPromise: j,
1928
- imageOverrides: O,
1929
- deletedImageIds: A,
1930
- permissionsPromise: N,
1931
- searchTerm: p,
1932
- setSearchTerm: R,
1933
- sortSettings: s,
1934
- handleSortChange: ie,
1935
- filterSettings: d,
1936
- handleFilterChange: F,
1937
- selectedImages: g,
1938
- setSelectedImages: _,
1939
- createModalOpen: v,
1940
- setCreateModalOpen: y,
1941
- deleteAllModalOpen: b,
1942
- setDeleteAllModalOpen: x,
1943
- deactivateAllModalOpen: S,
1944
- setDeactivateAllModalOpen: C,
1945
- activateAllModalOpen: ee,
1946
- setActivateAllModalOpen: w,
1947
- memberStatusView: T,
1948
- setMemberStatusView: ae,
1949
- isFetching: E,
1950
- currentPage: h,
1951
- onPageChange: B,
1952
- onImageUpdated: P,
1953
- onImageDeleted: ne,
1954
- onMemberStatusChanged: re
1955
- })
1956
- })
1957
- })
1958
- });
1959
- };
1960
- //#endregion
1961
- //#region src/client/routes/_auth/projects/$projectId/compute/images/index.tsx?tsr-split=component
1962
- function lt() {
1963
- let { i18n: e, _: t } = Q(), { projectId: n } = A.useParams(), { trpcClient: r } = A.useRouteContext();
1964
- if (!r) throw Error("trpcClient is not available in route context");
1965
- return /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q(M, {
1966
- title: e._({ id: "an5hVd" }),
1967
- projectId: n
1968
- }), /*#__PURE__*/ q(ct, {
1969
- client: r,
1970
- project: n
1971
- })] });
1972
- }
1973
- //#endregion
1974
- export { lt as component };
1975
-
1976
- //# sourceMappingURL=images-91U7tr9Y2.mjs.map