@cobaltcore-dev/aurora 0.2.2 → 0.3.1

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