@cobaltcore-dev/aurora 0.1.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.
- package/LICENSE +201 -0
- package/README.md +141 -0
- package/dist/client/AuroraApp.d.ts +7 -0
- package/dist/client/AuthProvider-D-5Jpa6F.mjs +100 -0
- package/dist/client/AuthProvider-D-5Jpa6F.mjs.map +1 -0
- package/dist/client/ContentHeader-H8KGY3Wd.mjs +81 -0
- package/dist/client/ContentHeader-H8KGY3Wd.mjs.map +1 -0
- package/dist/client/DeleteFlavorModal-B98oiHWx.mjs +629 -0
- package/dist/client/DeleteFlavorModal-B98oiHWx.mjs.map +1 -0
- package/dist/client/EditSecurityGroupModal-wQVNIVg1.mjs +137 -0
- package/dist/client/EditSecurityGroupModal-wQVNIVg1.mjs.map +1 -0
- package/dist/client/FloatingIpActionModals-qu1NMI5a.mjs +417 -0
- package/dist/client/FloatingIpActionModals-qu1NMI5a.mjs.map +1 -0
- package/dist/client/ImageToastNotifications-wsQDNEh7.mjs +1267 -0
- package/dist/client/ImageToastNotifications-wsQDNEh7.mjs.map +1 -0
- package/dist/client/ListToolbar-CHlkZrpl.mjs +223 -0
- package/dist/client/ListToolbar-CHlkZrpl.mjs.map +1 -0
- package/dist/client/RouteError-BwgDIwJE.mjs +25 -0
- package/dist/client/RouteError-BwgDIwJE.mjs.map +1 -0
- package/dist/client/_auth-CsliQdkJ.mjs +11 -0
- package/dist/client/_auth-CsliQdkJ.mjs.map +1 -0
- package/dist/client/_flavorId-D_A53VYa.mjs +56 -0
- package/dist/client/_flavorId-D_A53VYa.mjs.map +1 -0
- package/dist/client/_flavorId-DbhYLFxY.mjs +190 -0
- package/dist/client/_flavorId-DbhYLFxY.mjs.map +1 -0
- package/dist/client/_floatingIpId-BGgftRBQ.mjs +21 -0
- package/dist/client/_floatingIpId-BGgftRBQ.mjs.map +1 -0
- package/dist/client/_floatingIpId-D5myuLFz.mjs +228 -0
- package/dist/client/_floatingIpId-D5myuLFz.mjs.map +1 -0
- package/dist/client/_imageId-BoHX155h.mjs +27 -0
- package/dist/client/_imageId-BoHX155h.mjs.map +1 -0
- package/dist/client/_imageId-CTa0c3Av.mjs +530 -0
- package/dist/client/_imageId-CTa0c3Av.mjs.map +1 -0
- package/dist/client/_pcaId-C7Lrv1H_.mjs +242 -0
- package/dist/client/_pcaId-C7Lrv1H_.mjs.map +1 -0
- package/dist/client/_pcaId-DBgz5V_9.mjs +21 -0
- package/dist/client/_pcaId-DBgz5V_9.mjs.map +1 -0
- package/dist/client/_projectId-B9fln31N.mjs +8 -0
- package/dist/client/_projectId-B9fln31N.mjs.map +1 -0
- package/dist/client/_projectId-Be1Erj68.mjs +300 -0
- package/dist/client/_projectId-Be1Erj68.mjs.map +1 -0
- package/dist/client/_projectId-C-E4NNgo.mjs +84 -0
- package/dist/client/_projectId-C-E4NNgo.mjs.map +1 -0
- package/dist/client/_projectId-INhedXor.mjs +26 -0
- package/dist/client/_projectId-INhedXor.mjs.map +1 -0
- package/dist/client/_securityGroupId-DQoRQ-yA.mjs +1647 -0
- package/dist/client/_securityGroupId-DQoRQ-yA.mjs.map +1 -0
- package/dist/client/_securityGroupId-ihjy8Lcd.mjs +21 -0
- package/dist/client/_securityGroupId-ihjy8Lcd.mjs.map +1 -0
- package/dist/client/about-oT6ccz8T.mjs +92 -0
- package/dist/client/about-oT6ccz8T.mjs.map +1 -0
- package/dist/client/aurora-D_NPTbo-.mjs +19 -0
- package/dist/client/aurora-D_NPTbo-.mjs.map +1 -0
- package/dist/client/build-eu9eg0zF.mjs +14619 -0
- package/dist/client/build-eu9eg0zF.mjs.map +1 -0
- package/dist/client/buildFilterParams-BDOIRDeD.mjs +15 -0
- package/dist/client/buildFilterParams-BDOIRDeD.mjs.map +1 -0
- package/dist/client/cn-C3laVXMm.mjs +10 -0
- package/dist/client/cn-C3laVXMm.mjs.map +1 -0
- package/dist/client/constants-ByHCdNsI.mjs +128 -0
- package/dist/client/constants-ByHCdNsI.mjs.map +1 -0
- package/dist/client/containers-B_ozmVlx.mjs +74 -0
- package/dist/client/containers-B_ozmVlx.mjs.map +1 -0
- package/dist/client/containers-Dx7TYruP.mjs +7 -0
- package/dist/client/containers-Dx7TYruP.mjs.map +1 -0
- package/dist/client/containers-rn_ntCJu.mjs +3029 -0
- package/dist/client/containers-rn_ntCJu.mjs.map +1 -0
- package/dist/client/flavors-CT4auvLO.mjs +565 -0
- package/dist/client/flavors-CT4auvLO.mjs.map +1 -0
- package/dist/client/flavors-DRZb9LJP.mjs +8 -0
- package/dist/client/flavors-DRZb9LJP.mjs.map +1 -0
- package/dist/client/flavors-DtgMd0Ii.mjs +12 -0
- package/dist/client/flavors-DtgMd0Ii.mjs.map +1 -0
- package/dist/client/floatingips-DG5cFJSZ.mjs +12 -0
- package/dist/client/floatingips-DG5cFJSZ.mjs.map +1 -0
- package/dist/client/floatingips-iCMR0ZiL.mjs +436 -0
- package/dist/client/floatingips-iCMR0ZiL.mjs.map +1 -0
- package/dist/client/formatBytes-GYujK0dP.mjs +38 -0
- package/dist/client/formatBytes-GYujK0dP.mjs.map +1 -0
- package/dist/client/helpers--JWXi40U.mjs +6 -0
- package/dist/client/helpers--JWXi40U.mjs.map +1 -0
- package/dist/client/hooks-s-I8vWww.mjs +2 -0
- package/dist/client/images-BTqRflJv2.mjs +1794 -0
- package/dist/client/images-BTqRflJv2.mjs.map +1 -0
- package/dist/client/images-DRTfx8k2.mjs +8 -0
- package/dist/client/images-DRTfx8k2.mjs.map +1 -0
- package/dist/client/images-xBfsjxkX.mjs +12 -0
- package/dist/client/images-xBfsjxkX.mjs.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +1033 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/md-CI9FmfYv.mjs +390 -0
- package/dist/client/md-CI9FmfYv.mjs.map +1 -0
- package/dist/client/network-DFVVVNS5.mjs +8 -0
- package/dist/client/network-DFVVVNS5.mjs.map +1 -0
- package/dist/client/objects-CKk6cST_.mjs +4762 -0
- package/dist/client/objects-CKk6cST_.mjs.map +1 -0
- package/dist/client/objects-DkDKVSmQ.mjs +8 -0
- package/dist/client/objects-DkDKVSmQ.mjs.map +1 -0
- package/dist/client/objects-r_Vl31oj.mjs +80 -0
- package/dist/client/objects-r_Vl31oj.mjs.map +1 -0
- package/dist/client/overview-B7pXx6bt.mjs +173 -0
- package/dist/client/overview-B7pXx6bt.mjs.map +1 -0
- package/dist/client/overview-CKGLIu6W.mjs +12 -0
- package/dist/client/overview-CKGLIu6W.mjs.map +1 -0
- package/dist/client/overview-Ca8r3SAz.mjs +16 -0
- package/dist/client/overview-Ca8r3SAz.mjs.map +1 -0
- package/dist/client/overview-DkPM0Od5.mjs +12 -0
- package/dist/client/overview-DkPM0Od5.mjs.map +1 -0
- package/dist/client/overview-Dxm7Ef3X.mjs +12 -0
- package/dist/client/overview-Dxm7Ef3X.mjs.map +1 -0
- package/dist/client/overview-ag4Envez.mjs +16 -0
- package/dist/client/overview-ag4Envez.mjs.map +1 -0
- package/dist/client/pca-BGv7Mprl.mjs +12 -0
- package/dist/client/pca-BGv7Mprl.mjs.map +1 -0
- package/dist/client/pca-DpULpMu5.mjs +167 -0
- package/dist/client/pca-DpULpMu5.mjs.map +1 -0
- package/dist/client/projects-BuN69cxO.mjs +144 -0
- package/dist/client/projects-BuN69cxO.mjs.map +1 -0
- package/dist/client/projects-D1pP0XdA.mjs +12 -0
- package/dist/client/projects-D1pP0XdA.mjs.map +1 -0
- package/dist/client/projects-MbS1USl2.mjs +7 -0
- package/dist/client/projects-MbS1USl2.mjs.map +1 -0
- package/dist/client/projects-_Dfn6eQT.mjs +22 -0
- package/dist/client/projects-_Dfn6eQT.mjs.map +1 -0
- package/dist/client/securitygroups-DURjFfYK.mjs +12 -0
- package/dist/client/securitygroups-DURjFfYK.mjs.map +1 -0
- package/dist/client/securitygroups-KC2qvmH8.mjs +442 -0
- package/dist/client/securitygroups-KC2qvmH8.mjs.map +1 -0
- package/dist/client/trpcClient-BxguzNYF.mjs +57 -0
- package/dist/client/trpcClient-BxguzNYF.mjs.map +1 -0
- package/dist/client/useErrorTranslation-TZVwIAzq.mjs +83 -0
- package/dist/client/useErrorTranslation-TZVwIAzq.mjs.map +1 -0
- package/dist/client/useListWithFiltering-mMX_EfyI.mjs +32 -0
- package/dist/client/useListWithFiltering-mMX_EfyI.mjs.map +1 -0
- package/dist/client/useModal-Dg4CBeqL.mjs +12 -0
- package/dist/client/useModal-Dg4CBeqL.mjs.map +1 -0
- package/dist/client/useProjectId-BWaeJZOy.mjs +11 -0
- package/dist/client/useProjectId-BWaeJZOy.mjs.map +1 -0
- package/dist/server/index.d.ts +35 -0
- package/dist/server/index.js +36514 -0
- package/package.json +129 -0
|
@@ -0,0 +1,1794 @@
|
|
|
1
|
+
import { $ as e, D as t, H as n, I as r, K as i, N as a, Q as o, R as s, S as c, W as l, _ as u, a as d, b as f, g as p, h as m, i as h, it as g, j as _, k as ee, n as v, q as y, rt as b, s as x, t as S, v as C, w } from "./build-eu9eg0zF.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-xBfsjxkX.mjs";
|
|
5
|
+
import { t as k } from "./useModal-Dg4CBeqL.mjs";
|
|
6
|
+
import { t as A } from "./ContentHeader-H8KGY3Wd.mjs";
|
|
7
|
+
import { t as te } from "./ListToolbar-CHlkZrpl.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-wsQDNEh7.mjs";
|
|
9
|
+
import { t as Te } from "./useProjectId-BWaeJZOy.mjs";
|
|
10
|
+
import "./hooks-s-I8vWww.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: t, isPending: n, isAccepted: s, permissions: c, onEditDetails: u, onEditMetadata: d, onDelete: f, onSelect: p, onActivationStatusChange: m, onManageAccess: h, onUpdateVisibility: g, setToastData: _, uploadId: ee, uploadProgressPercent: y, 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
|
+
}), _(H(e, { onDismiss: () => _(null) })), S?.();
|
|
30
|
+
} catch (e) {
|
|
31
|
+
let t = e?.message;
|
|
32
|
+
_(U(t, { onDismiss: () => _(null) }));
|
|
33
|
+
}
|
|
34
|
+
}, V = I === M, ae = n || s, oe = re.isPending, [se, ce] = k(), [le, ue] = k();
|
|
35
|
+
return /* @__PURE__ */ K(r, {
|
|
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(a, {
|
|
46
|
+
onClick: (e) => e.stopPropagation(),
|
|
47
|
+
children: /* @__PURE__ */ G(o, {
|
|
48
|
+
checked: t,
|
|
49
|
+
onChange: () => p(e)
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ G(a, { children: O }),
|
|
53
|
+
/* @__PURE__ */ G(a, { children: N }),
|
|
54
|
+
/* @__PURE__ */ G(a, { children: A }),
|
|
55
|
+
/* @__PURE__ */ G(a, { children: e.protected ? C._({ id: "l75CjT" }) : C._({ id: "1UzENP" }) }),
|
|
56
|
+
/* @__PURE__ */ G(a, { children: ee && ee === T ? `${y}%` : /* @__PURE__ */ G(F, { size: te }) }),
|
|
57
|
+
/* @__PURE__ */ G(a, { children: j || C._({ id: "fj5byd" }) }),
|
|
58
|
+
/* @__PURE__ */ G(a, { children: ne ? new Date(ne).toLocaleDateString() : C._({ id: "fj5byd" }) }),
|
|
59
|
+
/* @__PURE__ */ K(a, {
|
|
60
|
+
onClick: (e) => e.stopPropagation(),
|
|
61
|
+
children: [
|
|
62
|
+
oe ? /* @__PURE__ */ G(l, {
|
|
63
|
+
variant: "primary",
|
|
64
|
+
size: "small"
|
|
65
|
+
}) : /* @__PURE__ */ G(v, { children: /* @__PURE__ */ K(b, { children: [
|
|
66
|
+
/* @__PURE__ */ G(i, {
|
|
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 && c.canUpdateMember && /* @__PURE__ */ K(W, { children: [n && /* @__PURE__ */ G(i, {
|
|
77
|
+
label: C._({ id: "g3UF2V" }),
|
|
78
|
+
onClick: ce
|
|
79
|
+
}), /* @__PURE__ */ G(i, {
|
|
80
|
+
label: C._({ id: "1t/NnN" }),
|
|
81
|
+
onClick: ue
|
|
82
|
+
})] }),
|
|
83
|
+
!ae && c.canUpdate && /* @__PURE__ */ K(W, { children: [
|
|
84
|
+
/* @__PURE__ */ G(i, {
|
|
85
|
+
label: C._({ id: "Y1YKad" }),
|
|
86
|
+
onClick: () => u(e)
|
|
87
|
+
}),
|
|
88
|
+
/* @__PURE__ */ G(i, {
|
|
89
|
+
label: C._({ id: "SIfYq6" }),
|
|
90
|
+
onClick: () => d(e)
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ G(i, {
|
|
93
|
+
label: e.status === L.DEACTIVATED ? C._({ id: "FQBaXG" }) : C._({ id: "5y3O+A" }),
|
|
94
|
+
onClick: () => m(e)
|
|
95
|
+
}),
|
|
96
|
+
e.visibility === z.SHARED && V && (c.canCreateMember || c.canDeleteMember) && /* @__PURE__ */ G(i, {
|
|
97
|
+
label: C._({ id: "cWbW6w" }),
|
|
98
|
+
onClick: () => h(e)
|
|
99
|
+
}),
|
|
100
|
+
e.visibility === z.PRIVATE && /* @__PURE__ */ G(i, {
|
|
101
|
+
label: C._({ id: "gMYsdZ" }),
|
|
102
|
+
onClick: () => g(e.id, z.SHARED, N)
|
|
103
|
+
})
|
|
104
|
+
] }),
|
|
105
|
+
!ae && c.canDelete && !e.protected && /* @__PURE__ */ G(i, {
|
|
106
|
+
label: C._({ id: "cnGeoo" }),
|
|
107
|
+
onClick: () => f(e)
|
|
108
|
+
})
|
|
109
|
+
] }) }),
|
|
110
|
+
se && /* @__PURE__ */ G(x, {
|
|
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(x, {
|
|
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: r, onClose: i, onCreate: a, isLoading: s = !1, isUploadPending: u = !1, uploadProgressPercent: d }) => {
|
|
203
|
+
let { i18n: g, _: ee } = Y(), [v, b] = q({ ...Ve }), [S, C] = q(""), [w, T] = q(null), [E, O] = q({}), [k, A] = q(!1), [te, j] = q(null), ne = v.name.trim() !== "" && w !== 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, M = je(() => v.disk_format ? X(v.disk_format) : [], [v.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
|
+
b((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: g._({ id: "wyIOMP" })
|
|
230
|
+
}));
|
|
231
|
+
}, R = (e, t) => {
|
|
232
|
+
if (e === "disk_format") {
|
|
233
|
+
let e = t, n = Z(e);
|
|
234
|
+
b((t) => ({
|
|
235
|
+
...t,
|
|
236
|
+
disk_format: e,
|
|
237
|
+
container_format: n
|
|
238
|
+
}));
|
|
239
|
+
} else b((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) || (b((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: g._({ id: "K3bUTE" })
|
|
260
|
+
})) : e === "min_ram" && O((e) => ({
|
|
261
|
+
...e,
|
|
262
|
+
min_ram: g._({ 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: g._({
|
|
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
|
+
C(e.target.value);
|
|
289
|
+
}, ce = () => {
|
|
290
|
+
let e = S.trim();
|
|
291
|
+
if (e !== "") {
|
|
292
|
+
if (v.tags.includes(e)) {
|
|
293
|
+
C("");
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
b((t) => ({
|
|
297
|
+
...t,
|
|
298
|
+
tags: [...t.tags, e]
|
|
299
|
+
})), C("");
|
|
300
|
+
}
|
|
301
|
+
}, le = (e) => {
|
|
302
|
+
e.key === "Enter" && (e.preventDefault(), ce());
|
|
303
|
+
}, ue = (e) => {
|
|
304
|
+
b((t) => ({
|
|
305
|
+
...t,
|
|
306
|
+
tags: t.tags.filter((t) => t !== e)
|
|
307
|
+
}));
|
|
308
|
+
}, de = () => {
|
|
309
|
+
let e = {};
|
|
310
|
+
return (!v.name || v.name.trim() === "") && (e.name = g._({ id: "wyIOMP" })), w || (e.file = g._({ id: "aTqCTq" })), (!v.disk_format || v.disk_format.trim() === "") && (e.disk_format = g._({ id: "LK0pQN" })), (!v.container_format || v.container_format.trim() === "") && (e.container_format = g._({ id: "J4DKSM" })), v.disk_format && v.container_format && (Be(v.disk_format, v.container_format) || (e.container_format = g._({ id: "BgMp/T" }))), v.min_disk < 0 && (e.min_disk = g._({ id: "K3bUTE" })), v.min_ram < 0 && (e.min_ram = g._({ id: "PEGvy+" })), O(e), Object.keys(e).length === 0;
|
|
311
|
+
}, fe = async (e) => {
|
|
312
|
+
if (e.preventDefault(), j(null), !de()) {
|
|
313
|
+
j(g._({ id: "CBFSfX" }));
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
try {
|
|
317
|
+
await a({
|
|
318
|
+
name: v.name.trim(),
|
|
319
|
+
tags: v.tags,
|
|
320
|
+
visibility: v.visibility,
|
|
321
|
+
disk_format: v.disk_format,
|
|
322
|
+
container_format: v.container_format,
|
|
323
|
+
protected: v.protected,
|
|
324
|
+
min_disk: v.min_disk,
|
|
325
|
+
min_ram: v.min_ram
|
|
326
|
+
}, w), pe();
|
|
327
|
+
} catch (e) {
|
|
328
|
+
j(e instanceof Error ? e.message : g._({ id: "TQn3hH" }));
|
|
329
|
+
}
|
|
330
|
+
}, pe = () => {
|
|
331
|
+
b({ ...Ve }), C(""), T(null), O({}), j(null), i();
|
|
332
|
+
};
|
|
333
|
+
return /* @__PURE__ */ K(x, {
|
|
334
|
+
open: r,
|
|
335
|
+
onCancel: s ? void 0 : pe,
|
|
336
|
+
size: "large",
|
|
337
|
+
title: g._({ id: "xw2UtT" }),
|
|
338
|
+
onConfirm: fe,
|
|
339
|
+
confirmButtonLabel: g._({ id: "a/nTb8" }),
|
|
340
|
+
cancelButtonLabel: g._({ id: "dEgA5A" }),
|
|
341
|
+
disableConfirmButton: s || !ne,
|
|
342
|
+
closeable: !s,
|
|
343
|
+
closeOnEsc: !s,
|
|
344
|
+
children: [
|
|
345
|
+
s && !d && /* @__PURE__ */ K(y, {
|
|
346
|
+
distribution: "center",
|
|
347
|
+
alignment: "center",
|
|
348
|
+
className: "mt-4",
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ G(l, { variant: "primary" }),
|
|
351
|
+
!u && /* @__PURE__ */ G(J, { id: "98Fs4G" }),
|
|
352
|
+
u && /* @__PURE__ */ G(J, { id: "3q1GLx" })
|
|
353
|
+
]
|
|
354
|
+
}),
|
|
355
|
+
s && !!d && /* @__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: `${d}%` },
|
|
360
|
+
children: [d, "%"]
|
|
361
|
+
})
|
|
362
|
+
}),
|
|
363
|
+
!s && /* @__PURE__ */ K(t, {
|
|
364
|
+
className: "mb-6",
|
|
365
|
+
children: [
|
|
366
|
+
te && /* @__PURE__ */ G(f, {
|
|
367
|
+
variant: "error",
|
|
368
|
+
className: "mb-6",
|
|
369
|
+
children: te
|
|
370
|
+
}),
|
|
371
|
+
/* @__PURE__ */ G(h, {
|
|
372
|
+
className: "mb-6",
|
|
373
|
+
children: /* @__PURE__ */ G(_, { 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: [g._({ 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: g._({ id: "vXmL4D" }) }) : /* @__PURE__ */ K(W, { children: [
|
|
412
|
+
/* @__PURE__ */ G("span", {
|
|
413
|
+
className: "font-semibold",
|
|
414
|
+
children: g._({ id: "gYe+hC" })
|
|
415
|
+
}),
|
|
416
|
+
" ",
|
|
417
|
+
g._({ id: "Np28ib" })
|
|
418
|
+
] })
|
|
419
|
+
}),
|
|
420
|
+
/* @__PURE__ */ G("p", {
|
|
421
|
+
className: "text-xs text-gray-400",
|
|
422
|
+
children: g._({ 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: s
|
|
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: s,
|
|
462
|
+
children: g._({ 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(h, {
|
|
473
|
+
className: "mb-6",
|
|
474
|
+
children: [
|
|
475
|
+
/* @__PURE__ */ G(_, {
|
|
476
|
+
className: "mb-6",
|
|
477
|
+
children: /* @__PURE__ */ G(e, {
|
|
478
|
+
id: "name",
|
|
479
|
+
name: "name",
|
|
480
|
+
label: g._({ id: "ExLULX" }),
|
|
481
|
+
value: v.name,
|
|
482
|
+
onChange: F,
|
|
483
|
+
onBlur: L,
|
|
484
|
+
required: !0,
|
|
485
|
+
errortext: E.name,
|
|
486
|
+
placeholder: g._({ id: "PsEGri" }),
|
|
487
|
+
disabled: s
|
|
488
|
+
})
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ G(_, {
|
|
491
|
+
className: "mb-6",
|
|
492
|
+
children: /* @__PURE__ */ K("div", {
|
|
493
|
+
className: "w-full",
|
|
494
|
+
children: [/* @__PURE__ */ K(y, {
|
|
495
|
+
gap: "1",
|
|
496
|
+
direction: "horizontal",
|
|
497
|
+
alignment: "start",
|
|
498
|
+
children: [/* @__PURE__ */ G("div", {
|
|
499
|
+
className: "flex-1",
|
|
500
|
+
children: /* @__PURE__ */ G(e, {
|
|
501
|
+
id: "tags",
|
|
502
|
+
name: "tags",
|
|
503
|
+
label: g._({ id: "OYHzN1" }),
|
|
504
|
+
value: S,
|
|
505
|
+
onChange: se,
|
|
506
|
+
onKeyDown: le,
|
|
507
|
+
helptext: g._({ id: "AN0DBJ" }),
|
|
508
|
+
placeholder: g._({ id: "tmpGvt" }),
|
|
509
|
+
disabled: s
|
|
510
|
+
})
|
|
511
|
+
}), /* @__PURE__ */ G(p, {
|
|
512
|
+
variant: "primary",
|
|
513
|
+
onClick: ce,
|
|
514
|
+
disabled: s || S.trim() === "",
|
|
515
|
+
children: /* @__PURE__ */ G(J, { id: "m16xKo" })
|
|
516
|
+
})]
|
|
517
|
+
}), v.tags.length > 0 && /* @__PURE__ */ G(y, {
|
|
518
|
+
gap: "1",
|
|
519
|
+
wrap: !0,
|
|
520
|
+
alignment: "center",
|
|
521
|
+
className: "mt-1",
|
|
522
|
+
children: v.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(_, {
|
|
532
|
+
className: "mb-6",
|
|
533
|
+
children: /* @__PURE__ */ K(c, {
|
|
534
|
+
id: "visibility",
|
|
535
|
+
name: "visibility",
|
|
536
|
+
label: g._({ id: "2q/Q7x" }),
|
|
537
|
+
value: v.visibility,
|
|
538
|
+
onChange: (e) => R("visibility", e),
|
|
539
|
+
disabled: s,
|
|
540
|
+
loading: s,
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ G(n, {
|
|
543
|
+
value: z.PUBLIC,
|
|
544
|
+
label: g._({ id: "7d1a0d" })
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ G(n, {
|
|
547
|
+
value: z.PRIVATE,
|
|
548
|
+
label: g._({ id: "zwBp5t" })
|
|
549
|
+
}),
|
|
550
|
+
/* @__PURE__ */ G(n, {
|
|
551
|
+
value: z.SHARED,
|
|
552
|
+
label: g._({ id: "0Gd0NU" })
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ G(n, {
|
|
555
|
+
value: z.COMMUNITY,
|
|
556
|
+
label: g._({ id: "chL5IG" })
|
|
557
|
+
})
|
|
558
|
+
]
|
|
559
|
+
})
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ G(_, {
|
|
562
|
+
className: "mb-6",
|
|
563
|
+
children: /* @__PURE__ */ K(y, {
|
|
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(c, {
|
|
571
|
+
id: "disk_format",
|
|
572
|
+
name: "disk_format",
|
|
573
|
+
label: g._({ id: "NopYGU" }),
|
|
574
|
+
value: v.disk_format,
|
|
575
|
+
onChange: (e) => R("disk_format", e),
|
|
576
|
+
disabled: s,
|
|
577
|
+
loading: s,
|
|
578
|
+
required: !0,
|
|
579
|
+
errortext: E.disk_format,
|
|
580
|
+
children: [
|
|
581
|
+
/* @__PURE__ */ G(n, {
|
|
582
|
+
value: I.QCOW2,
|
|
583
|
+
label: "QCOW2 - QEMU Emulator"
|
|
584
|
+
}),
|
|
585
|
+
/* @__PURE__ */ G(n, {
|
|
586
|
+
value: I.RAW,
|
|
587
|
+
label: "Raw"
|
|
588
|
+
}),
|
|
589
|
+
/* @__PURE__ */ G(n, {
|
|
590
|
+
value: I.VMDK,
|
|
591
|
+
label: "VMDK - Virtual Machine Disk"
|
|
592
|
+
}),
|
|
593
|
+
/* @__PURE__ */ G(n, {
|
|
594
|
+
value: I.VHD,
|
|
595
|
+
label: "VHD - Virtual Hard Disk"
|
|
596
|
+
}),
|
|
597
|
+
/* @__PURE__ */ G(n, {
|
|
598
|
+
value: I.VHDX,
|
|
599
|
+
label: "VHDX - Virtual Hard Disk Extended"
|
|
600
|
+
}),
|
|
601
|
+
/* @__PURE__ */ G(n, {
|
|
602
|
+
value: I.VDI,
|
|
603
|
+
label: "VDI - Virtual Disk Image"
|
|
604
|
+
}),
|
|
605
|
+
/* @__PURE__ */ G(n, {
|
|
606
|
+
value: I.AMI,
|
|
607
|
+
label: "AMI - Amazon Machine Image"
|
|
608
|
+
}),
|
|
609
|
+
/* @__PURE__ */ G(n, {
|
|
610
|
+
value: I.ARI,
|
|
611
|
+
label: "ARI - Amazon Ramdisk Image"
|
|
612
|
+
}),
|
|
613
|
+
/* @__PURE__ */ G(n, {
|
|
614
|
+
value: I.AKI,
|
|
615
|
+
label: "AKI - Amazon Kernel Image"
|
|
616
|
+
}),
|
|
617
|
+
/* @__PURE__ */ G(n, {
|
|
618
|
+
value: I.ISO,
|
|
619
|
+
label: "ISO - Optical Disk Image"
|
|
620
|
+
}),
|
|
621
|
+
/* @__PURE__ */ G(n, {
|
|
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(c, {
|
|
630
|
+
id: "container_format",
|
|
631
|
+
name: "container_format",
|
|
632
|
+
label: g._({ id: "6/xipy" }),
|
|
633
|
+
value: v.container_format,
|
|
634
|
+
onChange: (e) => R("container_format", e),
|
|
635
|
+
disabled: s || !v.disk_format || !M.length,
|
|
636
|
+
required: !0,
|
|
637
|
+
errortext: E.container_format,
|
|
638
|
+
helptext: !M.length && g._({ id: "A7CVME" }),
|
|
639
|
+
children: M.map((e) => /* @__PURE__ */ G(n, {
|
|
640
|
+
value: e,
|
|
641
|
+
label: e.toUpperCase()
|
|
642
|
+
}, e))
|
|
643
|
+
})
|
|
644
|
+
})]
|
|
645
|
+
})
|
|
646
|
+
}),
|
|
647
|
+
/* @__PURE__ */ G(_, {
|
|
648
|
+
className: "mb-0",
|
|
649
|
+
children: /* @__PURE__ */ G(o, {
|
|
650
|
+
id: "protected",
|
|
651
|
+
name: "protected",
|
|
652
|
+
label: g._({ id: "644xgx" }),
|
|
653
|
+
checked: v.protected,
|
|
654
|
+
onChange: F,
|
|
655
|
+
helptext: g._({ id: "aV6KPH" }),
|
|
656
|
+
disabled: s
|
|
657
|
+
})
|
|
658
|
+
})
|
|
659
|
+
]
|
|
660
|
+
}),
|
|
661
|
+
/* @__PURE__ */ G(h, {
|
|
662
|
+
className: "mb-6",
|
|
663
|
+
children: /* @__PURE__ */ G(_, {
|
|
664
|
+
className: "mb-0",
|
|
665
|
+
children: /* @__PURE__ */ K(y, {
|
|
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(e, {
|
|
673
|
+
id: "min_disk",
|
|
674
|
+
name: "min_disk",
|
|
675
|
+
label: g._({ id: "NixRmA" }),
|
|
676
|
+
type: "number",
|
|
677
|
+
value: String(v.min_disk),
|
|
678
|
+
onChange: (e) => B("min_disk", e.target.value),
|
|
679
|
+
onBlur: () => re("min_disk", v.min_disk),
|
|
680
|
+
helptext: g._({ id: "4fh0Wj" }),
|
|
681
|
+
errortext: E.min_disk,
|
|
682
|
+
disabled: s
|
|
683
|
+
})
|
|
684
|
+
}), /* @__PURE__ */ G("div", {
|
|
685
|
+
className: "flex-1",
|
|
686
|
+
children: /* @__PURE__ */ G(e, {
|
|
687
|
+
id: "min_ram",
|
|
688
|
+
name: "min_ram",
|
|
689
|
+
label: g._({ id: "CgZxr7" }),
|
|
690
|
+
type: "number",
|
|
691
|
+
value: String(v.min_ram),
|
|
692
|
+
onChange: (e) => B("min_ram", e.target.value),
|
|
693
|
+
onBlur: () => re("min_ram", v.min_ram),
|
|
694
|
+
helptext: g._({ id: "KsIM0b" }),
|
|
695
|
+
errortext: E.min_ram,
|
|
696
|
+
disabled: s
|
|
697
|
+
})
|
|
698
|
+
})]
|
|
699
|
+
})
|
|
700
|
+
})
|
|
701
|
+
})
|
|
702
|
+
]
|
|
703
|
+
})
|
|
704
|
+
]
|
|
705
|
+
});
|
|
706
|
+
}, Ue = ({ deletableImages: e, protectedImages: t, isOpen: n, isLoading: r, onClose: i, onDelete: a }) => {
|
|
707
|
+
let { i18n: o, _: s } = Y(), c = e.length, u = t.length;
|
|
708
|
+
return /* @__PURE__ */ K(x, {
|
|
709
|
+
onCancel: i,
|
|
710
|
+
size: "small",
|
|
711
|
+
title: o._({ id: "JtHgVz" }),
|
|
712
|
+
open: n,
|
|
713
|
+
modalFooter: /* @__PURE__ */ G(d, {
|
|
714
|
+
className: "flex justify-end",
|
|
715
|
+
children: /* @__PURE__ */ K(C, { children: [/* @__PURE__ */ G(p, {
|
|
716
|
+
variant: "default",
|
|
717
|
+
onClick: i,
|
|
718
|
+
children: /* @__PURE__ */ G(J, { id: "dEgA5A" })
|
|
719
|
+
}), /* @__PURE__ */ G(p, {
|
|
720
|
+
variant: "primary-danger",
|
|
721
|
+
onClick: (t) => {
|
|
722
|
+
t.preventDefault(), a(e);
|
|
723
|
+
},
|
|
724
|
+
disabled: r,
|
|
725
|
+
"data-testid": "delete-image-button",
|
|
726
|
+
children: /* @__PURE__ */ G(J, { id: "cnGeoo" })
|
|
727
|
+
})] })
|
|
728
|
+
}),
|
|
729
|
+
children: [r && /* @__PURE__ */ G(y, {
|
|
730
|
+
distribution: "center",
|
|
731
|
+
alignment: "center",
|
|
732
|
+
children: /* @__PURE__ */ G(l, { variant: "primary" })
|
|
733
|
+
}), !r && /* @__PURE__ */ K("div", {
|
|
734
|
+
className: "my-6",
|
|
735
|
+
children: [
|
|
736
|
+
c > 0 && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(f, {
|
|
737
|
+
text: o._({
|
|
738
|
+
id: "Dh1qvV",
|
|
739
|
+
values: { deletableCount: c }
|
|
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: c }
|
|
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: e.map((e) => /* @__PURE__ */ G("li", {
|
|
756
|
+
className: "jn:text-theme-default font-mono",
|
|
757
|
+
children: e
|
|
758
|
+
}, e))
|
|
759
|
+
})
|
|
760
|
+
})]
|
|
761
|
+
})] }),
|
|
762
|
+
u > 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: t.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: [c > 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: c
|
|
788
|
+
})]
|
|
789
|
+
}), u > 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: u
|
|
797
|
+
})]
|
|
798
|
+
})]
|
|
799
|
+
})
|
|
800
|
+
]
|
|
801
|
+
})]
|
|
802
|
+
});
|
|
803
|
+
}, We = ({ activeImages: e, deactivatedImages: t, isOpen: n, isLoading: r, onClose: i, onDeactivate: a }) => {
|
|
804
|
+
let { i18n: o, _: s } = Y(), c = e.length, u = t.length, d = (t) => {
|
|
805
|
+
t.preventDefault(), a(e);
|
|
806
|
+
};
|
|
807
|
+
return /* @__PURE__ */ K(x, {
|
|
808
|
+
onCancel: i,
|
|
809
|
+
size: "small",
|
|
810
|
+
title: o._({ id: "+9CXS9" }),
|
|
811
|
+
open: n,
|
|
812
|
+
onConfirm: (e) => {
|
|
813
|
+
d(e), i();
|
|
814
|
+
},
|
|
815
|
+
confirmButtonLabel: o._({ id: "5y3O+A" }),
|
|
816
|
+
cancelButtonLabel: o._({ id: "dEgA5A" }),
|
|
817
|
+
disableConfirmButton: r,
|
|
818
|
+
children: [r && /* @__PURE__ */ G(y, {
|
|
819
|
+
distribution: "center",
|
|
820
|
+
alignment: "center",
|
|
821
|
+
children: /* @__PURE__ */ G(l, { variant: "primary" })
|
|
822
|
+
}), !r && /* @__PURE__ */ K("div", {
|
|
823
|
+
className: "my-6",
|
|
824
|
+
children: [
|
|
825
|
+
c > 0 && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G("p", {
|
|
826
|
+
className: "mb-6",
|
|
827
|
+
children: /* @__PURE__ */ G(J, {
|
|
828
|
+
id: "zm7+/D",
|
|
829
|
+
values: { activeCount: c },
|
|
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: c }
|
|
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: e.map((e) => /* @__PURE__ */ G("li", {
|
|
845
|
+
className: "jn:text-theme-default font-mono",
|
|
846
|
+
children: e
|
|
847
|
+
}, e))
|
|
848
|
+
})
|
|
849
|
+
})]
|
|
850
|
+
})] }),
|
|
851
|
+
u > 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: t.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: [c > 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: c
|
|
877
|
+
})]
|
|
878
|
+
}), u > 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: u
|
|
886
|
+
})]
|
|
887
|
+
})]
|
|
888
|
+
})
|
|
889
|
+
]
|
|
890
|
+
})]
|
|
891
|
+
});
|
|
892
|
+
}, Ge = ({ deactivatedImages: e, activeImages: t, isOpen: n, isLoading: r, onClose: i, onActivate: a }) => {
|
|
893
|
+
let { i18n: o, _: s } = Y(), c = e.length, u = t.length;
|
|
894
|
+
return /* @__PURE__ */ K(x, {
|
|
895
|
+
onCancel: i,
|
|
896
|
+
size: "small",
|
|
897
|
+
title: o._({ id: "UdcGJu" }),
|
|
898
|
+
open: n,
|
|
899
|
+
onConfirm: (t) => {
|
|
900
|
+
t.preventDefault(), a(e);
|
|
901
|
+
},
|
|
902
|
+
confirmButtonLabel: o._({ id: "FQBaXG" }),
|
|
903
|
+
cancelButtonLabel: o._({ id: "dEgA5A" }),
|
|
904
|
+
disableConfirmButton: r,
|
|
905
|
+
children: [r && /* @__PURE__ */ G(y, {
|
|
906
|
+
distribution: "center",
|
|
907
|
+
alignment: "center",
|
|
908
|
+
children: /* @__PURE__ */ G(l, { variant: "primary" })
|
|
909
|
+
}), !r && /* @__PURE__ */ K("div", {
|
|
910
|
+
className: "my-6",
|
|
911
|
+
children: [
|
|
912
|
+
c > 0 && /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G("p", {
|
|
913
|
+
className: "mb-6",
|
|
914
|
+
children: /* @__PURE__ */ G(J, {
|
|
915
|
+
id: "MgZyuJ",
|
|
916
|
+
values: { deactivatedCount: c },
|
|
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: c }
|
|
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: e.map((e) => /* @__PURE__ */ G("li", {
|
|
932
|
+
className: "jn:text-theme-default font-mono",
|
|
933
|
+
children: e
|
|
934
|
+
}, e))
|
|
935
|
+
})
|
|
936
|
+
})]
|
|
937
|
+
})] }),
|
|
938
|
+
u > 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: t.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: [c > 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: c
|
|
964
|
+
})]
|
|
965
|
+
}), u > 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: u
|
|
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, l] = q(null), [u, d] = 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
|
+
l(null), d(!1), t();
|
|
985
|
+
};
|
|
986
|
+
if (!e || !n) return null;
|
|
987
|
+
let g = n.name || n.id;
|
|
988
|
+
return /* @__PURE__ */ G(x, {
|
|
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(f, {
|
|
997
|
+
onDismiss: () => l(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: u,
|
|
1009
|
+
setIsAddingMember: d,
|
|
1010
|
+
setMessage: l
|
|
1011
|
+
})] })
|
|
1012
|
+
});
|
|
1013
|
+
};
|
|
1014
|
+
//#endregion
|
|
1015
|
+
//#region src/client/routes/_auth/projects/$projectId/compute/-components/Images/-components/ImageListView.tsx
|
|
1016
|
+
function qe({ images: e, suggestedImages: t, acceptedImages: n, permissions: i, isFetching: s, currentPage: c = 1, totalPages: d = 1, onPageChange: f, children: p, selectedImages: m, setSelectedImages: h, deleteAllModalOpen: _, setDeleteAllModalOpen: v, deactivateAllModalOpen: b, setDeactivateAllModalOpen: x, 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(), h([]);
|
|
1025
|
+
} }), tt = E.compute.activateImages.useMutation({ onSuccess: () => {
|
|
1026
|
+
Q.compute.listImagesWithPagination.invalidate(), h([]);
|
|
1027
|
+
} }), nt = E.compute.deactivateImages.useMutation({ onSuccess: () => {
|
|
1028
|
+
Q.compute.listImagesWithPagination.invalidate(), h([]);
|
|
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(r, { children: /* @__PURE__ */ G(a, {
|
|
1156
|
+
colSpan: 3,
|
|
1157
|
+
children: /* @__PURE__ */ K(y, {
|
|
1158
|
+
distribution: "center",
|
|
1159
|
+
alignment: "center",
|
|
1160
|
+
children: [/* @__PURE__ */ G(l, { variant: "primary" }), /* @__PURE__ */ G(J, { id: "Z3FXyt" })]
|
|
1161
|
+
})
|
|
1162
|
+
}) })
|
|
1163
|
+
}) : /* @__PURE__ */ K(W, { children: [
|
|
1164
|
+
/* @__PURE__ */ G(W, { children: p }),
|
|
1165
|
+
/* @__PURE__ */ K("div", {
|
|
1166
|
+
className: "relative",
|
|
1167
|
+
children: [
|
|
1168
|
+
s && /* @__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(y, {
|
|
1171
|
+
direction: "vertical",
|
|
1172
|
+
alignment: "center",
|
|
1173
|
+
gap: "2",
|
|
1174
|
+
children: [/* @__PURE__ */ G(l, {
|
|
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
|
+
e.length > 0 ? /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K(ee, {
|
|
1184
|
+
columns: 9,
|
|
1185
|
+
minContentColumns: [0, 8],
|
|
1186
|
+
className: "images",
|
|
1187
|
+
"data-testid": "images-table",
|
|
1188
|
+
children: [/* @__PURE__ */ K(r, { children: [
|
|
1189
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(o, {
|
|
1190
|
+
checked: (() => {
|
|
1191
|
+
let t = e.map((e) => e.id);
|
|
1192
|
+
return t.length > 0 && t.every((e) => m.includes(e));
|
|
1193
|
+
})(),
|
|
1194
|
+
onChange: () => {
|
|
1195
|
+
let t = e.map((e) => e.id);
|
|
1196
|
+
return t.every((e) => m.includes(e)) ? h(m.filter((e) => !t.includes(e))) : h([...new Set([...m, ...t])]);
|
|
1197
|
+
}
|
|
1198
|
+
}) }),
|
|
1199
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(J, { id: "uAQUqI" }) }),
|
|
1200
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(J, { id: "ExLULX" }) }),
|
|
1201
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(J, { id: "2q/Q7x" }) }),
|
|
1202
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(J, { id: "644xgx" }) }),
|
|
1203
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(J, { id: "Cj2Gtd" }) }),
|
|
1204
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(J, { id: "NopYGU" }) }),
|
|
1205
|
+
/* @__PURE__ */ G(g, { children: /* @__PURE__ */ G(J, { id: "d+F6q9" }) }),
|
|
1206
|
+
/* @__PURE__ */ G(g, {})
|
|
1207
|
+
] }), e.map((e) => /* @__PURE__ */ G(Le, {
|
|
1208
|
+
image: e,
|
|
1209
|
+
isSelected: m.includes(e.id),
|
|
1210
|
+
isPending: !!t.find(({ id: t }) => t === e.id),
|
|
1211
|
+
isAccepted: !!n.find(({ id: t }) => t === e.id),
|
|
1212
|
+
permissions: i,
|
|
1213
|
+
onEditDetails: gt,
|
|
1214
|
+
onEditMetadata: _t,
|
|
1215
|
+
onDelete: vt,
|
|
1216
|
+
onManageAccess: yt,
|
|
1217
|
+
onSelect: (e) => {
|
|
1218
|
+
if (m.includes(e.id)) return h(m.filter((t) => t !== e.id));
|
|
1219
|
+
h([...m, 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
|
+
}), d > 1 && /* @__PURE__ */ G("div", {
|
|
1229
|
+
className: "flex justify-center py-4",
|
|
1230
|
+
children: /* @__PURE__ */ G(u, {
|
|
1231
|
+
variant: "input",
|
|
1232
|
+
currentPage: c,
|
|
1233
|
+
pages: d,
|
|
1234
|
+
onPressPrevious: () => f?.(Math.max(c - 1, 1)),
|
|
1235
|
+
onPressNext: () => f?.(Math.min(c + 1, d)),
|
|
1236
|
+
onSelectChange: (e) => f?.(e)
|
|
1237
|
+
})
|
|
1238
|
+
})] }) : /* @__PURE__ */ G(ee, {
|
|
1239
|
+
columns: 7,
|
|
1240
|
+
minContentColumns: [0, 6],
|
|
1241
|
+
className: "images",
|
|
1242
|
+
"data-testid": "no-images",
|
|
1243
|
+
children: /* @__PURE__ */ G(r, { children: /* @__PURE__ */ K(a, {
|
|
1244
|
+
colSpan: 7,
|
|
1245
|
+
children: [/* @__PURE__ */ G(w, { 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 || !i.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: i
|
|
1302
|
+
})
|
|
1303
|
+
] }),
|
|
1304
|
+
/* @__PURE__ */ G(Ue, {
|
|
1305
|
+
isOpen: _,
|
|
1306
|
+
deletableImages: A,
|
|
1307
|
+
protectedImages: te,
|
|
1308
|
+
isLoading: st,
|
|
1309
|
+
onClose: () => v(!1),
|
|
1310
|
+
onDelete: async (e) => {
|
|
1311
|
+
v(!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: b,
|
|
1326
|
+
activeImages: j,
|
|
1327
|
+
deactivatedImages: P,
|
|
1328
|
+
isLoading: st,
|
|
1329
|
+
onClose: () => x(!1),
|
|
1330
|
+
onDeactivate: async (e) => {
|
|
1331
|
+
x(!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(S, {
|
|
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: e, imageOverrides: t, deletedImageIds: n, permissionsPromise: r, searchTerm: a, setSearchTerm: o, sortSettings: c, handleSortChange: l, filterSettings: u, handleFilterChange: d, selectedImages: f, setSelectedImages: m, createModalOpen: h, setCreateModalOpen: g, deleteAllModalOpen: _, setDeleteAllModalOpen: ee, deactivateAllModalOpen: x, 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(e), F = Oe(r), I = P.images.filter((e) => !n.has(e.id)).map((e) => t.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
|
+
...u,
|
|
1476
|
+
filters: u.filters.filter((e) => e.filterName !== "visibility"),
|
|
1477
|
+
selectedFilters: (u.selectedFilters || []).filter((e) => e.name !== "visibility")
|
|
1478
|
+
} : u, ie = new Set(I.map((e) => e.id)), V = f.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: c,
|
|
1493
|
+
filterSettings: re,
|
|
1494
|
+
searchTerm: a,
|
|
1495
|
+
onSort: l,
|
|
1496
|
+
onFilter: d,
|
|
1497
|
+
onSearch: o,
|
|
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(y, {
|
|
1517
|
+
gap: "2",
|
|
1518
|
+
children: [F.canCreate && /* @__PURE__ */ G(p, {
|
|
1519
|
+
onClick: () => g(!0),
|
|
1520
|
+
variant: "primary",
|
|
1521
|
+
children: "Create Image"
|
|
1522
|
+
}), /* @__PURE__ */ K(v, { children: [/* @__PURE__ */ G(s, { children: /* @__PURE__ */ G(p, {
|
|
1523
|
+
icon: "moreVert",
|
|
1524
|
+
children: /* @__PURE__ */ G(J, { id: "PgNNGl" })
|
|
1525
|
+
}) }), /* @__PURE__ */ K(b, { children: [
|
|
1526
|
+
/* @__PURE__ */ G(i, {
|
|
1527
|
+
disabled: ce,
|
|
1528
|
+
label: M._({ id: "c6b6fz" }),
|
|
1529
|
+
onClick: () => ee(!0)
|
|
1530
|
+
}),
|
|
1531
|
+
/* @__PURE__ */ G(i, {
|
|
1532
|
+
disabled: le,
|
|
1533
|
+
label: M._({ id: "UmQ3/m" }),
|
|
1534
|
+
onClick: () => S(!0)
|
|
1535
|
+
}),
|
|
1536
|
+
/* @__PURE__ */ G(i, {
|
|
1537
|
+
disabled: ue,
|
|
1538
|
+
label: M._({ id: "d/I0J3" }),
|
|
1539
|
+
onClick: () => w(!0)
|
|
1540
|
+
})
|
|
1541
|
+
] })] })]
|
|
1542
|
+
}) })
|
|
1543
|
+
}), /* @__PURE__ */ G(qe, {
|
|
1544
|
+
images: B,
|
|
1545
|
+
suggestedImages: T === "pending" ? B : [],
|
|
1546
|
+
acceptedImages: T === "accepted" ? B : [],
|
|
1547
|
+
permissions: F,
|
|
1548
|
+
isFetching: D,
|
|
1549
|
+
currentPage: z,
|
|
1550
|
+
totalPages: R,
|
|
1551
|
+
onPageChange: k,
|
|
1552
|
+
selectedImages: f,
|
|
1553
|
+
setSelectedImages: m,
|
|
1554
|
+
deleteAllModalOpen: _,
|
|
1555
|
+
setDeleteAllModalOpen: ee,
|
|
1556
|
+
deactivateAllModalOpen: x,
|
|
1557
|
+
setDeactivateAllModalOpen: S,
|
|
1558
|
+
activateAllModalOpen: C,
|
|
1559
|
+
setActivateAllModalOpen: w,
|
|
1560
|
+
createModalOpen: h,
|
|
1561
|
+
setCreateModalOpen: g,
|
|
1562
|
+
deletableImages: ae,
|
|
1563
|
+
protectedImages: oe,
|
|
1564
|
+
activeImages: H,
|
|
1565
|
+
deactivatedImages: se,
|
|
1566
|
+
onImageUpdated: A,
|
|
1567
|
+
onImageDeleted: j,
|
|
1568
|
+
onMemberStatusChanged: ne
|
|
1569
|
+
})] });
|
|
1570
|
+
}
|
|
1571
|
+
var et = ({ client: e, project: t }) => {
|
|
1572
|
+
let { i18n: n, _: r } = Y(), i = Me(), a = Pe({ strict: !1 }), [o, s] = q({
|
|
1573
|
+
options: [
|
|
1574
|
+
{
|
|
1575
|
+
label: n._({ id: "88kg0+" }),
|
|
1576
|
+
value: "created_at"
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
label: n._({ id: "Llcakz" }),
|
|
1580
|
+
value: "updated_at"
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
label: n._({ id: "6YtxFj" }),
|
|
1584
|
+
value: "name"
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
label: n._({ id: "Cj2Gtd" }),
|
|
1588
|
+
value: "size"
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
label: n._({ id: "uAQUqI" }),
|
|
1592
|
+
value: "status"
|
|
1593
|
+
}
|
|
1594
|
+
],
|
|
1595
|
+
sortBy: a.sortBy || "created_at",
|
|
1596
|
+
sortDirection: a.sortDirection || "desc"
|
|
1597
|
+
}), [c, u] = q({
|
|
1598
|
+
filters: [
|
|
1599
|
+
{
|
|
1600
|
+
displayName: n._({ id: "uAQUqI" }),
|
|
1601
|
+
filterName: "status",
|
|
1602
|
+
values: Object.values(L),
|
|
1603
|
+
supportsMultiValue: !0
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
displayName: n._({ id: "2q/Q7x" }),
|
|
1607
|
+
filterName: "visibility",
|
|
1608
|
+
values: Object.values(z),
|
|
1609
|
+
supportsMultiValue: !1
|
|
1610
|
+
},
|
|
1611
|
+
{
|
|
1612
|
+
displayName: n._({ id: "NopYGU" }),
|
|
1613
|
+
filterName: "disk_format",
|
|
1614
|
+
values: Object.values(I),
|
|
1615
|
+
supportsMultiValue: !0
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
displayName: n._({ id: "6/xipy" }),
|
|
1619
|
+
filterName: "container_format",
|
|
1620
|
+
values: Object.values(de),
|
|
1621
|
+
supportsMultiValue: !0
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
displayName: n._({ id: "644xgx" }),
|
|
1625
|
+
filterName: "protected",
|
|
1626
|
+
values: ["true", "false"],
|
|
1627
|
+
supportsMultiValue: !1
|
|
1628
|
+
}
|
|
1629
|
+
],
|
|
1630
|
+
selectedFilters: Je(a)
|
|
1631
|
+
}), [d, f] = q(a.search || ""), p = a.page ?? 1, [m, h] = q([]), [g, _] = q(!1), [ee, v] = q(!1), [b, x] = q(!1), [S, C] = q(!1), w = a.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(e, t)), M = ke((e) => {
|
|
1632
|
+
O((t) => new Map(t).set(e.id, e));
|
|
1633
|
+
}, []), N = ke((e) => {
|
|
1634
|
+
A((t) => {
|
|
1635
|
+
let n = new Set(t);
|
|
1636
|
+
return Array.isArray(e) ? e.forEach((e) => n.add(e)) : n.add(e), n;
|
|
1637
|
+
});
|
|
1638
|
+
}, []), P = ke(() => {
|
|
1639
|
+
O(/* @__PURE__ */ new Map()), E(!0);
|
|
1640
|
+
let n = a.memberStatus ?? "all", r = n === "all" ? void 0 : n;
|
|
1641
|
+
De(() => {
|
|
1642
|
+
let i = n === "pending" || n === "accepted" ? (c.selectedFilters || []).filter((e) => e.name !== "visibility") : c.selectedFilters || [], a = Q(e, t, o.sortBy, o.sortDirection, d, {
|
|
1643
|
+
...Ye(i, c.filters),
|
|
1644
|
+
member_status: r
|
|
1645
|
+
});
|
|
1646
|
+
a.catch(() => {}).finally(() => E(!1)), j(a);
|
|
1647
|
+
});
|
|
1648
|
+
}, [
|
|
1649
|
+
e,
|
|
1650
|
+
o,
|
|
1651
|
+
d,
|
|
1652
|
+
c,
|
|
1653
|
+
a.memberStatus
|
|
1654
|
+
]);
|
|
1655
|
+
Ae(() => {
|
|
1656
|
+
let n = Je(a), r = a.sortBy || "created_at", i = a.sortDirection || "desc", o = a.search || "";
|
|
1657
|
+
u((e) => ({
|
|
1658
|
+
...e,
|
|
1659
|
+
selectedFilters: n
|
|
1660
|
+
})), s((e) => ({
|
|
1661
|
+
...e,
|
|
1662
|
+
sortBy: r,
|
|
1663
|
+
sortDirection: i
|
|
1664
|
+
})), f(o), h([]), O(/* @__PURE__ */ new Map()), E(!0);
|
|
1665
|
+
let l = a.memberStatus ?? "all", d = l === "all" ? void 0 : l;
|
|
1666
|
+
De(() => {
|
|
1667
|
+
let a = Q(e, t, r, i, o, {
|
|
1668
|
+
...Ye(l === "pending" || l === "accepted" ? (n || []).filter((e) => e.name !== "visibility") : n || [], c.filters),
|
|
1669
|
+
member_status: d
|
|
1670
|
+
});
|
|
1671
|
+
a.catch(() => {}).finally(() => E(!1)), j(a);
|
|
1672
|
+
});
|
|
1673
|
+
}, [
|
|
1674
|
+
a.status,
|
|
1675
|
+
a.visibility,
|
|
1676
|
+
a.disk_format,
|
|
1677
|
+
a.container_format,
|
|
1678
|
+
a.protected,
|
|
1679
|
+
a.sortBy,
|
|
1680
|
+
a.sortDirection,
|
|
1681
|
+
a.search,
|
|
1682
|
+
a.memberStatus
|
|
1683
|
+
]);
|
|
1684
|
+
let F = (e) => {
|
|
1685
|
+
let t = {
|
|
1686
|
+
options: e.options,
|
|
1687
|
+
sortBy: e.sortBy?.toString() || "created_at",
|
|
1688
|
+
sortDirection: e.sortDirection || "desc"
|
|
1689
|
+
};
|
|
1690
|
+
s(t), i({
|
|
1691
|
+
search: (e) => ({
|
|
1692
|
+
...e,
|
|
1693
|
+
sortBy: t.sortBy,
|
|
1694
|
+
sortDirection: t.sortDirection,
|
|
1695
|
+
page: void 0
|
|
1696
|
+
}),
|
|
1697
|
+
replace: !0
|
|
1698
|
+
});
|
|
1699
|
+
}, R = (e) => {
|
|
1700
|
+
u(e), i({
|
|
1701
|
+
search: (t) => Xe(e.selectedFilters || [], e.filters, {
|
|
1702
|
+
search: t.search,
|
|
1703
|
+
sortBy: t.sortBy,
|
|
1704
|
+
sortDirection: t.sortDirection,
|
|
1705
|
+
memberStatus: t.memberStatus
|
|
1706
|
+
}),
|
|
1707
|
+
replace: !0
|
|
1708
|
+
});
|
|
1709
|
+
}, B = (e) => {
|
|
1710
|
+
let t = typeof e == "string" ? e : "";
|
|
1711
|
+
f(t), i({
|
|
1712
|
+
search: (e) => ({
|
|
1713
|
+
...e,
|
|
1714
|
+
search: t || void 0,
|
|
1715
|
+
page: void 0
|
|
1716
|
+
}),
|
|
1717
|
+
replace: !0
|
|
1718
|
+
});
|
|
1719
|
+
}, re = (e) => {
|
|
1720
|
+
i({ search: (t) => ({
|
|
1721
|
+
sortBy: t.sortBy,
|
|
1722
|
+
sortDirection: t.sortDirection,
|
|
1723
|
+
search: t.search,
|
|
1724
|
+
memberStatus: e === "all" ? void 0 : e
|
|
1725
|
+
}) });
|
|
1726
|
+
}, ie = ke((e) => {
|
|
1727
|
+
i({ search: (t) => ({
|
|
1728
|
+
...t,
|
|
1729
|
+
page: e === 1 ? void 0 : e
|
|
1730
|
+
}) });
|
|
1731
|
+
}, [i]);
|
|
1732
|
+
return /* @__PURE__ */ G("div", {
|
|
1733
|
+
className: "relative",
|
|
1734
|
+
children: /* @__PURE__ */ G(Ee, {
|
|
1735
|
+
fallback: /* @__PURE__ */ K(y, {
|
|
1736
|
+
className: "fixed inset-0",
|
|
1737
|
+
distribution: "center",
|
|
1738
|
+
alignment: "center",
|
|
1739
|
+
direction: "vertical",
|
|
1740
|
+
children: [/* @__PURE__ */ G(l, {
|
|
1741
|
+
variant: "primary",
|
|
1742
|
+
size: "large",
|
|
1743
|
+
className: "mb-2"
|
|
1744
|
+
}), /* @__PURE__ */ G(J, { id: "HBpi4q" })]
|
|
1745
|
+
}),
|
|
1746
|
+
children: /* @__PURE__ */ G($e, {
|
|
1747
|
+
imagesPromise: te,
|
|
1748
|
+
imageOverrides: D,
|
|
1749
|
+
deletedImageIds: k,
|
|
1750
|
+
permissionsPromise: ne,
|
|
1751
|
+
searchTerm: d,
|
|
1752
|
+
setSearchTerm: B,
|
|
1753
|
+
sortSettings: o,
|
|
1754
|
+
handleSortChange: F,
|
|
1755
|
+
filterSettings: c,
|
|
1756
|
+
handleFilterChange: R,
|
|
1757
|
+
selectedImages: m,
|
|
1758
|
+
setSelectedImages: h,
|
|
1759
|
+
createModalOpen: g,
|
|
1760
|
+
setCreateModalOpen: _,
|
|
1761
|
+
deleteAllModalOpen: ee,
|
|
1762
|
+
setDeleteAllModalOpen: v,
|
|
1763
|
+
deactivateAllModalOpen: b,
|
|
1764
|
+
setDeactivateAllModalOpen: x,
|
|
1765
|
+
activateAllModalOpen: S,
|
|
1766
|
+
setActivateAllModalOpen: C,
|
|
1767
|
+
memberStatusView: w,
|
|
1768
|
+
setMemberStatusView: re,
|
|
1769
|
+
isFetching: T,
|
|
1770
|
+
currentPage: p,
|
|
1771
|
+
onPageChange: ie,
|
|
1772
|
+
onImageUpdated: M,
|
|
1773
|
+
onImageDeleted: N,
|
|
1774
|
+
onMemberStatusChanged: P
|
|
1775
|
+
})
|
|
1776
|
+
})
|
|
1777
|
+
});
|
|
1778
|
+
};
|
|
1779
|
+
//#endregion
|
|
1780
|
+
//#region src/client/routes/_auth/projects/$projectId/compute/images/index.tsx?tsr-split=component
|
|
1781
|
+
function tt() {
|
|
1782
|
+
let { i18n: e, _: t } = Y(), { projectId: n } = O.useParams(), { trpcClient: r, setPageTitle: i } = O.useRouteContext();
|
|
1783
|
+
return i(e._({ id: "an5hVd" })), /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ G(A, {
|
|
1784
|
+
title: e._({ id: "an5hVd" }),
|
|
1785
|
+
projectId: n
|
|
1786
|
+
}), /* @__PURE__ */ G(et, {
|
|
1787
|
+
client: r,
|
|
1788
|
+
project: n
|
|
1789
|
+
})] });
|
|
1790
|
+
}
|
|
1791
|
+
//#endregion
|
|
1792
|
+
export { tt as component };
|
|
1793
|
+
|
|
1794
|
+
//# sourceMappingURL=images-BTqRflJv2.mjs.map
|