@cobaltcore-dev/aurora 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/client/DeleteVersionsModal-CyYZfB8d.mjs +331 -0
  2. package/dist/client/DeleteVersionsModal-CyYZfB8d.mjs.map +1 -0
  3. package/dist/client/{SortInput-VK7IYqQv.mjs → SortInput-DLcusjGZ.mjs} +8 -8
  4. package/dist/client/SortInput-DLcusjGZ.mjs.map +1 -0
  5. package/dist/client/_auth-DXJkv9QO.mjs.map +1 -1
  6. package/dist/client/{_pcaId-BwTvJJgh.mjs → _pcaId-Bo7yHkNW.mjs} +3 -3
  7. package/dist/client/{_pcaId-BwTvJJgh.mjs.map → _pcaId-Bo7yHkNW.mjs.map} +1 -1
  8. package/dist/client/{_pcaId-DUHQd0rB.mjs → _pcaId-CKkCVC7b.mjs} +2 -2
  9. package/dist/client/{_pcaId-DUHQd0rB.mjs.map → _pcaId-CKkCVC7b.mjs.map} +1 -1
  10. package/dist/client/_projectId-B_2sZKk-.mjs.map +1 -1
  11. package/dist/client/{_projectId-DR_2U10f.mjs → _projectId-CY8W0IF6.mjs} +2 -2
  12. package/dist/client/_projectId-CY8W0IF6.mjs.map +1 -0
  13. package/dist/client/{_projectId-BaqZ4W50.mjs → _projectId-Dbck_MFa.mjs} +43 -49
  14. package/dist/client/_projectId-Dbck_MFa.mjs.map +1 -0
  15. package/dist/client/{_securityGroupId-DYxmXUOP.mjs → _securityGroupId-CkN0CGVg.mjs} +3 -3
  16. package/dist/client/{_securityGroupId-DYxmXUOP.mjs.map → _securityGroupId-CkN0CGVg.mjs.map} +1 -1
  17. package/dist/client/{_securityGroupId-fhK1CuZh.mjs → _securityGroupId-gSEZbBII.mjs} +2 -2
  18. package/dist/client/{_securityGroupId-fhK1CuZh.mjs.map → _securityGroupId-gSEZbBII.mjs.map} +1 -1
  19. package/dist/client/{_storageType-D7-_Xwwl.mjs → _storageType-6k8lUnQo.mjs} +2 -2
  20. package/dist/client/{_storageType-D7-_Xwwl.mjs.map → _storageType-6k8lUnQo.mjs.map} +1 -1
  21. package/dist/client/_storageType-CLTxXjQZ.mjs +3048 -0
  22. package/dist/client/_storageType-CLTxXjQZ.mjs.map +1 -0
  23. package/dist/client/{constants-J5nm9hbP.mjs → constants-PMXUGI4Q.mjs} +2 -2
  24. package/dist/client/{constants-J5nm9hbP.mjs.map → constants-PMXUGI4Q.mjs.map} +1 -1
  25. package/dist/client/{flavors-Dwy1ID_f.mjs → flavors-BclEwobO.mjs} +2 -2
  26. package/dist/client/{flavors-Dwy1ID_f.mjs.map → flavors-BclEwobO.mjs.map} +1 -1
  27. package/dist/client/{flavors-C-gY4XeQ.mjs → flavors-p2TKcqP-.mjs} +3 -3
  28. package/dist/client/{flavors-C-gY4XeQ.mjs.map → flavors-p2TKcqP-.mjs.map} +1 -1
  29. package/dist/client/{floatingips-Dq4DXQYb.mjs → floatingips-ph0ZxJw8.mjs} +3 -3
  30. package/dist/client/{floatingips-Dq4DXQYb.mjs.map → floatingips-ph0ZxJw8.mjs.map} +1 -1
  31. package/dist/client/{images-HG7TneK0.mjs → images-BblnyWJq.mjs} +3 -3
  32. package/dist/client/{images-HG7TneK0.mjs.map → images-BblnyWJq.mjs.map} +1 -1
  33. package/dist/client/{images-bG-MZZ7V.mjs → images-CXdghaMW.mjs} +2 -2
  34. package/dist/client/{images-bG-MZZ7V.mjs.map → images-CXdghaMW.mjs.map} +1 -1
  35. package/dist/client/index.js +121 -117
  36. package/dist/client/index.js.map +1 -1
  37. package/dist/client/{md-CYTrL5dq.mjs → md-CyCflQee.mjs} +10 -28
  38. package/dist/client/{md-CYTrL5dq.mjs.map → md-CyCflQee.mjs.map} +1 -1
  39. package/dist/client/{objects-DKWp9RtR.mjs → objects-B9Jh3SMG.mjs} +4 -3
  40. package/dist/client/objects-B9Jh3SMG.mjs.map +1 -0
  41. package/dist/client/objects-Bw25cE1m.mjs +5970 -0
  42. package/dist/client/objects-Bw25cE1m.mjs.map +1 -0
  43. package/dist/client/objects-o2Cj_ndZ.mjs.map +1 -1
  44. package/dist/client/{pca-BBxPCAH0.mjs → pca-CiLPHmK7.mjs} +3 -3
  45. package/dist/client/{pca-BBxPCAH0.mjs.map → pca-CiLPHmK7.mjs.map} +1 -1
  46. package/dist/client/{pca-D7DF_BZZ.mjs → pca-DUrQ_tIg.mjs} +2 -2
  47. package/dist/client/{pca-D7DF_BZZ.mjs.map → pca-DUrQ_tIg.mjs.map} +1 -1
  48. package/dist/client/{securitygroups-CNFLu9zS.mjs → securitygroups-CcA2TpAt.mjs} +2 -2
  49. package/dist/client/{securitygroups-CNFLu9zS.mjs.map → securitygroups-CcA2TpAt.mjs.map} +1 -1
  50. package/dist/client/{useListWithFiltering-v2A0-SZb.mjs → useListWithFiltering-CVzhMyEA.mjs} +2 -2
  51. package/dist/client/{useListWithFiltering-v2A0-SZb.mjs.map → useListWithFiltering-CVzhMyEA.mjs.map} +1 -1
  52. package/dist/server/index.js +282 -48
  53. package/package.json +3 -3
  54. package/dist/client/SortInput-VK7IYqQv.mjs.map +0 -1
  55. package/dist/client/_projectId-BaqZ4W50.mjs.map +0 -1
  56. package/dist/client/_projectId-DR_2U10f.mjs.map +0 -1
  57. package/dist/client/_storageType-B0eJODiQ.mjs +0 -3244
  58. package/dist/client/_storageType-B0eJODiQ.mjs.map +0 -1
  59. package/dist/client/objects-DKWp9RtR.mjs.map +0 -1
  60. package/dist/client/objects-DaCuy_CB.mjs +0 -5708
  61. package/dist/client/objects-DaCuy_CB.mjs.map +0 -1
@@ -1,3244 +0,0 @@
1
- import { $ as e, A as t, C as n, D as r, G as i, H as a, J as o, L as s, N as c, T as l, U as u, V as d, Y as f, _ as p, c as m, ct as h, d as g, et as _, f as v, it as y, k as b, lt as x, m as S, nt as C, o as w, ot as T, rt as E, t as D } from "./build-BdRRmNf5.mjs";
2
- import { r as O } from "./trpcClient-BzPUgiM2.mjs";
3
- import { t as k } from "./_storageType-D7-_Xwwl.mjs";
4
- import { t as A } from "./ContentHeader-D4jlOG-9.mjs";
5
- import { t as j } from "./SortInput-VK7IYqQv.mjs";
6
- import { t as M } from "./formatBytes-CZv_XyCY.mjs";
7
- import { t as N } from "./useProjectId-DBc5lpoU.mjs";
8
- import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
9
- import { startTransition as L, useCallback as R, useEffect as z, useRef as B, useState as V } from "react";
10
- import { useNavigate as ee, useParams as H } from "@tanstack/react-router";
11
- import { Trans as U, useLingui as W } from "@lingui/react";
12
- import { i18n as G } from "@lingui/core";
13
- import { ErrorBoundary as te } from "react-error-boundary";
14
- import { useVirtualizer as ne } from "@tanstack/react-virtual";
15
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Containers/CreateContainerModal.tsx
16
- var K = ({ isOpen: e, onClose: t, onSuccess: n, onError: r, maxContainerNameLength: i = 256 }) => {
17
- let { i18n: a, _: o } = W(), s = N(), [c, l] = V(""), [u, d] = V(null), p = O.useUtils(), m = O.storage.swift.createContainer.useMutation({
18
- onSuccess: () => {
19
- p.storage.swift.listContainers.invalidate();
20
- let e = c.trim();
21
- n?.(e);
22
- },
23
- onError: (e) => {
24
- r?.(c.trim(), e.message);
25
- },
26
- onSettled: () => {
27
- g();
28
- }
29
- }), g = () => {
30
- l(""), d(null), m.reset(), t();
31
- }, _ = (e) => e.trim() ? e.length > i ? (d(a._({
32
- id: "r5SQFW",
33
- values: { maxContainerNameLength: i }
34
- })), !1) : e.includes("/") ? (d(a._({ id: "9J93Xr" })), !1) : (d(null), !0) : (d(a._({ id: "JNGYAW" })), !1), v = (e) => {
35
- let t = e.target.value;
36
- l(t), u && _(t);
37
- }, y = () => {
38
- _(c) && m.mutate({
39
- project_id: s,
40
- container: c.trim()
41
- });
42
- };
43
- return e ? /*#__PURE__*/ F(h, {
44
- title: a._({ id: "vTh35P" }),
45
- open: e,
46
- onCancel: g,
47
- confirmButtonLabel: a._({ id: "hYgDIe" }),
48
- onConfirm: y,
49
- cancelButtonLabel: a._({ id: "dEgA5A" }),
50
- size: "small",
51
- disableConfirmButton: m.isPending || !c.trim(),
52
- children: /*#__PURE__*/ I(f, {
53
- direction: "vertical",
54
- gap: "6",
55
- children: [/*#__PURE__*/ F("p", {
56
- className: "text-theme-default",
57
- children: /*#__PURE__*/ F(U, { id: "ne/GWZ" })
58
- }), /*#__PURE__*/ F(S, {
59
- label: a._({ id: "SUSS9i" }),
60
- required: !0,
61
- value: c,
62
- onChange: v,
63
- onKeyDown: (e) => {
64
- e.key === "Enter" && y();
65
- },
66
- invalid: !!u,
67
- errortext: u || void 0,
68
- disabled: m.isPending,
69
- autoFocus: !0,
70
- placeholder: a._({ id: "W5FkH9" })
71
- })]
72
- })
73
- }) : null;
74
- }, re = ({ isOpen: e, container: t, onClose: n, onSuccess: r, onError: o }) => {
75
- let { i18n: l, _: u } = W(), d = N(), [g, y] = V(""), [b, C] = V(null), [w, T] = V(!1), E = B(""), D = () => {
76
- t && navigator.clipboard.writeText(t.name).then(() => {
77
- T(!0), setTimeout(() => T(!1), 2e3);
78
- });
79
- }, k = O.useUtils(), { data: A, isLoading: j, error: P } = O.storage.swift.listObjects.useQuery({
80
- project_id: d,
81
- container: t?.name ?? "",
82
- format: "json",
83
- limit: 100
84
- }, { enabled: e && t !== null }), L = O.storage.swift.emptyContainer.useMutation({
85
- onSuccess: (e) => {
86
- k.storage.swift.listContainers.invalidate(), k.storage.swift.listObjects.invalidate({
87
- project_id: d,
88
- container: E.current
89
- }), r?.(E.current, e);
90
- },
91
- onError: (e) => {
92
- o?.(E.current, e.message);
93
- },
94
- onSettled: () => {
95
- R();
96
- }
97
- }), R = () => {
98
- y(""), C(null), L.reset(), n();
99
- }, z = (e) => {
100
- let t = e.target.value;
101
- y(t), b && C(null);
102
- }, ee = () => {
103
- if (t) {
104
- if (g.trim() !== t.name) {
105
- C(l._({ id: "jS4B2+" }));
106
- return;
107
- }
108
- E.current = t.name, L.mutate({
109
- project_id: d,
110
- container: t.name
111
- });
112
- }
113
- }, H = (e) => {
114
- e.key === "Enter" && ee();
115
- };
116
- if (!e || !t) return null;
117
- let G = A?.length ?? 0, te = !j && t.count === 0 && G === 0, ne = !j && t.count > 0 && G === 0, K = te || ne;
118
- return /*#__PURE__*/ I(h, {
119
- title: /* @__PURE__ */ I("span", {
120
- className: "flex max-w-[400px] items-center gap-2",
121
- children: [
122
- /*#__PURE__*/ F("span", {
123
- className: "shrink-0",
124
- children: /*#__PURE__*/ F(U, { id: "5Okch2" })
125
- }),
126
- /*#__PURE__*/ F("span", {
127
- className: "truncate",
128
- title: t.name,
129
- children: t.name
130
- }),
131
- !j && !K && /*#__PURE__*/ F("button", {
132
- type: "button",
133
- onClick: D,
134
- title: w ? l._({ id: "PiH3UR" }) : l._({ id: "NQU1Nn" }),
135
- className: "text-theme-light hover:text-theme-default inline-flex items-center transition-colors",
136
- children: /*#__PURE__*/ F(m, {
137
- icon: w ? "checkCircle" : "contentCopy",
138
- size: "16"
139
- })
140
- })
141
- ]
142
- }),
143
- open: e,
144
- onCancel: R,
145
- confirmButtonLabel: K ? void 0 : l._({ id: "N2S1rs" }),
146
- confirmButtonVariant: "primary-danger",
147
- onConfirm: K ? void 0 : ee,
148
- cancelButtonLabel: K ? void 0 : l._({ id: "dEgA5A" }),
149
- modalFooter: K ? /*#__PURE__*/ F(v, {
150
- className: "flex justify-end",
151
- children: /*#__PURE__*/ F(x, { children: /*#__PURE__*/ F(p, {
152
- variant: "primary",
153
- onClick: R,
154
- "data-testid": "empty-info-close-button",
155
- children: /*#__PURE__*/ F(U, { id: "yz7wBu" })
156
- }) })
157
- }) : void 0,
158
- size: "small",
159
- disableConfirmButton: j || L.isPending || !K && !g.trim() || !K && g.trim() !== t.name,
160
- children: [P && /*#__PURE__*/ F("p", {
161
- className: "text-theme-error mb-4",
162
- children: (() => {
163
- let e = P.message;
164
- return /*#__PURE__*/ F(U, {
165
- id: "56IxdF",
166
- values: { errorMessage: e }
167
- });
168
- })()
169
- }), j ? /*#__PURE__*/ I(f, {
170
- direction: "horizontal",
171
- alignment: "center",
172
- gap: "2",
173
- className: "py-4",
174
- children: [/*#__PURE__*/ F(a, { size: "small" }), /*#__PURE__*/ F(U, { id: "ujK/QN" })]
175
- }) : K && !P ? /*#__PURE__*/ F("p", {
176
- className: "text-theme-default py-2",
177
- children: te ? /*#__PURE__*/ F(U, { id: "jNm/qL" }) : /*#__PURE__*/ F(U, { id: "WefafP" })
178
- }) : P ? null : /*#__PURE__*/ I(f, {
179
- direction: "vertical",
180
- gap: "6",
181
- children: [
182
- /*#__PURE__*/ I("p", {
183
- className: "text-theme-default",
184
- children: [
185
- /*#__PURE__*/ F(U, { id: "Ioblgz" }),
186
- /*#__PURE__*/ F("br", {}),
187
- /*#__PURE__*/ F(U, {
188
- id: "kiRrtv",
189
- components: {
190
- 0: /*#__PURE__*/ F("strong", {}),
191
- 1: /*#__PURE__*/ F("strong", {}),
192
- 2: /*#__PURE__*/ F("strong", {})
193
- }
194
- })
195
- ]
196
- }),
197
- /*#__PURE__*/ I("div", {
198
- className: "border-theme-background-lvl-3 overflow-hidden rounded border",
199
- children: [
200
- t.count > G && /*#__PURE__*/ F("p", {
201
- className: "text-theme-light px-3 py-2 text-xs",
202
- children: (() => {
203
- let e = t.count;
204
- return /*#__PURE__*/ F(U, {
205
- id: "1iQtS2",
206
- values: {
207
- actualObjectCount: G,
208
- total: e
209
- }
210
- });
211
- })()
212
- }),
213
- /*#__PURE__*/ F(_, {
214
- columns: 3,
215
- className: "text-sm",
216
- children: /*#__PURE__*/ I(c, { children: [
217
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "6YtxFj" }) }),
218
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "Cj2Gtd" }) }),
219
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "sjMCOP" }) })
220
- ] })
221
- }),
222
- /*#__PURE__*/ F("div", {
223
- className: "max-h-48 overflow-y-auto",
224
- children: /*#__PURE__*/ F(_, {
225
- columns: 3,
226
- className: "text-sm",
227
- children: A.map((e) => /*#__PURE__*/ I(c, { children: [
228
- /*#__PURE__*/ F(i, {
229
- className: "max-w-[200px] truncate",
230
- title: e.name,
231
- children: e.name
232
- }),
233
- /*#__PURE__*/ F(i, { children: M(e.bytes) }),
234
- /*#__PURE__*/ F(i, { children: e.last_modified ? new Date(e.last_modified).toLocaleString() : l._({ id: "fj5byd" }) })
235
- ] }, e.name))
236
- })
237
- })
238
- ]
239
- }),
240
- /*#__PURE__*/ F(S, {
241
- label: l._({ id: "33F2A+" }),
242
- required: !0,
243
- value: g,
244
- onChange: z,
245
- onKeyDown: H,
246
- invalid: !!b,
247
- errortext: b || void 0,
248
- disabled: L.isPending,
249
- autoFocus: !0,
250
- placeholder: t.name
251
- })
252
- ]
253
- })]
254
- });
255
- }, q = ({ isOpen: e, container: t, onClose: n, onSuccess: r, onError: i }) => {
256
- let { i18n: o, _: s } = W(), c = N(), [l, u] = V(""), [d, m] = V(null), [g, _] = V(!1), b = O.useUtils(), { data: C, isLoading: w, error: T } = O.storage.swift.listObjects.useQuery({
257
- project_id: c,
258
- container: t?.name ?? "",
259
- format: "json",
260
- limit: 1
261
- }, { enabled: e && t !== null }), { data: E, error: D } = O.storage.swift.getContainerMetadata.useQuery({
262
- project_id: c,
263
- container: t?.name ?? ""
264
- }, { enabled: e && t !== null }), k = !!(E?.versionsEnabled || E?.versionsLocation || E?.historyLocation), A = O.storage.swift.deleteContainer.useMutation({
265
- onSuccess: () => {
266
- b.storage.swift.listContainers.invalidate(), r?.(t.name);
267
- },
268
- onError: (e) => {
269
- i?.(t.name, e.message);
270
- },
271
- onSettled: () => {
272
- j();
273
- }
274
- });
275
- z(() => {
276
- e || (u(""), m(null), _(!1), A.reset());
277
- }, [e, t?.name]);
278
- let j = () => {
279
- u(""), m(null), _(!1), A.reset(), n();
280
- }, M = (e) => {
281
- let t = e.target.value;
282
- u(t), d && m(null);
283
- }, P = () => {
284
- if (t && !(T || D)) {
285
- if (l.trim() !== "delete") {
286
- m(o._({ id: "b5aNMO" }));
287
- return;
288
- }
289
- k && !g || A.mutate({
290
- project_id: c,
291
- container: t.name
292
- });
293
- }
294
- }, L = (e) => {
295
- e.key === "Enter" && P();
296
- };
297
- if (!e || !t) return null;
298
- let R = C?.length ?? 0, B = !w && (R > 0 || t.count > 0), ee = !w && t.count > 0 && R === 0, H = !!(T || D);
299
- return /*#__PURE__*/ I(h, {
300
- title: /* @__PURE__ */ I("span", {
301
- className: "flex max-w-[400px] items-center gap-2",
302
- children: [/*#__PURE__*/ F("span", {
303
- className: "shrink-0",
304
- children: /*#__PURE__*/ F(U, { id: "Vzlopx" })
305
- }), /*#__PURE__*/ F("span", {
306
- className: "truncate",
307
- title: t.name,
308
- children: t.name
309
- })]
310
- }),
311
- open: e,
312
- onCancel: j,
313
- confirmButtonLabel: B ? void 0 : o._({ id: "cnGeoo" }),
314
- confirmButtonVariant: B ? void 0 : "primary-danger",
315
- onConfirm: B ? void 0 : P,
316
- cancelButtonLabel: B ? void 0 : o._({ id: "dEgA5A" }),
317
- modalFooter: B ? /*#__PURE__*/ F(v, {
318
- className: "flex justify-end",
319
- children: /*#__PURE__*/ F(x, { children: /*#__PURE__*/ F(p, {
320
- variant: "primary",
321
- onClick: j,
322
- "data-testid": "delete-has-objects-close-button",
323
- children: /*#__PURE__*/ F(U, { id: "yz7wBu" })
324
- }) })
325
- }) : void 0,
326
- size: "small",
327
- disableConfirmButton: w || H || A.isPending || !B && l.trim() !== "delete" || !B && k && !g,
328
- children: [(T || D) && /*#__PURE__*/ I(f, {
329
- direction: "vertical",
330
- gap: "2",
331
- className: "mb-4",
332
- role: "alert",
333
- "aria-live": "assertive",
334
- children: [T && /*#__PURE__*/ F("p", {
335
- className: "text-theme-error",
336
- children: (() => {
337
- let e = T.message;
338
- return /*#__PURE__*/ F(U, {
339
- id: "56IxdF",
340
- values: { errorMessage: e }
341
- });
342
- })()
343
- }), D && /*#__PURE__*/ F("p", {
344
- className: "text-theme-error",
345
- children: (() => {
346
- let e = D.message;
347
- return /*#__PURE__*/ F(U, {
348
- id: "BCXapL",
349
- values: { errorMessage: e }
350
- });
351
- })()
352
- })]
353
- }), w ? /*#__PURE__*/ I(f, {
354
- direction: "horizontal",
355
- alignment: "center",
356
- gap: "2",
357
- className: "py-4",
358
- children: [/*#__PURE__*/ F(a, { size: "small" }), /*#__PURE__*/ F(U, { id: "Z3FXyt" })]
359
- }) : B ? /*#__PURE__*/ I(f, {
360
- direction: "vertical",
361
- gap: "3",
362
- children: [/*#__PURE__*/ F("p", {
363
- className: "text-theme-default",
364
- children: /*#__PURE__*/ F(U, { id: "3dBmvU" })
365
- }), ee && /*#__PURE__*/ F("p", {
366
- className: "text-theme-default",
367
- children: /*#__PURE__*/ F(U, { id: "x3T4pq" })
368
- })]
369
- }) : /*#__PURE__*/ I(f, {
370
- direction: "vertical",
371
- gap: "6",
372
- children: [
373
- /*#__PURE__*/ I("p", {
374
- className: "text-theme-default",
375
- children: [
376
- /*#__PURE__*/ F(U, { id: "Y8M9Uc" }),
377
- /*#__PURE__*/ F("br", {}),
378
- /*#__PURE__*/ F(U, {
379
- id: "YzUoh9",
380
- components: { 0: /*#__PURE__*/ F("strong", {}) }
381
- })
382
- ]
383
- }),
384
- k && /*#__PURE__*/ F(y, {
385
- label: o._({ id: "V/8B9A" }),
386
- checked: g,
387
- onChange: (e) => _(e.target.checked),
388
- invalid: !g
389
- }),
390
- /*#__PURE__*/ F(S, {
391
- label: o._({ id: "QytzQr" }),
392
- required: !0,
393
- value: l,
394
- onChange: M,
395
- onKeyDown: L,
396
- invalid: !!d,
397
- errortext: d || void 0,
398
- disabled: A.isPending,
399
- autoFocus: !0,
400
- placeholder: o._({ id: "HNlEFZ" })
401
- })
402
- ]
403
- })]
404
- });
405
- }, ie = new Set([
406
- "quota-bytes",
407
- "quota-count",
408
- "web-index",
409
- "web-listings",
410
- "web-listings-css",
411
- "web-error"
412
- ]), ae = 50, oe = /^[a-zA-Z0-9!#$%&'*+\-.^_`|~]+$/, se = ({ isOpen: e, container: r, onClose: o, onSuccess: l, onError: u }) => {
413
- let { i18n: d, _: v } = W(), b = N(), { data: x, isLoading: C, isError: T, error: E } = O.storage.swift.getContainerMetadata.useQuery({
414
- project_id: b,
415
- container: r?.name ?? ""
416
- }, { enabled: e && r !== null }), k = x?.read === ".r:*,.rlistings", { data: A } = O.storage.swift.getContainerPublicUrl.useQuery({
417
- project_id: b,
418
- container: r?.name ?? ""
419
- }, { enabled: e && r !== null && k }), { data: j } = O.storage.swift.listContainers.useQuery({ project_id: b }, { enabled: e }), [M, P] = V(""), [L, ee] = V(""), H = B(null), G = R((e) => {
420
- let t = e.target.value;
421
- P(t), H.current && clearTimeout(H.current), H.current = setTimeout(() => ee(t), 300);
422
- }, []), te = L.trim().length > 0 ? (j ?? []).filter((e) => e.name !== r?.name && e.name.toLowerCase().includes(L.toLowerCase())) : [], ne = te.slice(0, ae), K = te.length - ne.length, re = O.useUtils(), [q, se] = V(""), [ce, J] = V(null), [Y, le] = V(""), [ue, de] = V(null), [X, fe] = V(""), [pe, me] = V(!1), [he, Z] = V(!1), [ge, _e] = V(""), [Q, ve] = V([]), [ye, be] = V({}), [xe, Se] = V(!1), [Ce, we] = V(""), [Te, $] = V(""), [Ee, De] = V(null), [Oe, ke] = V(null);
423
- z(() => {
424
- if (!x) return;
425
- se(x.quotaBytes == null ? "" : String(x.quotaBytes)), le(x.quotaCount == null ? "" : String(x.quotaCount)), Z(!!(x.versionsEnabled || x.versionsLocation || x.historyLocation)), _e(x.versionsLocation || x.historyLocation || "");
426
- let e = x.metadata ?? {};
427
- fe(e["web-index"] ?? ""), me(e["web-listings"] === "1" || e["web-listings"] === "true");
428
- let t = x.metadata ?? {};
429
- ve(Object.entries(t).filter(([e]) => !ie.has(e)).map(([e, t]) => ({
430
- key: e,
431
- value: t,
432
- isNew: !1,
433
- isEditing: !1,
434
- originalKey: e,
435
- originalValue: t
436
- })));
437
- }, [x]), z(() => {
438
- e || Ae();
439
- }, [e]);
440
- let Ae = () => {
441
- se(""), J(null), le(""), de(null), fe(""), me(!1), Z(!1), _e(""), P(""), ee(""), H.current && clearTimeout(H.current), ve([]), be({}), Se(!1), we(""), $(""), De(null), ke(null), je.reset();
442
- }, je = O.storage.swift.updateContainerMetadata.useMutation({
443
- onSuccess: () => {
444
- re.storage.swift.getContainerMetadata.invalidate({ container: r.name }), re.storage.swift.listContainers.invalidate(), l?.(r.name), Ue();
445
- },
446
- onError: (e) => {
447
- u?.(r.name, e.message);
448
- }
449
- }), Me = () => {
450
- let e = !0;
451
- return q !== "" && (isNaN(Number(q)) || Number(q) < 0) ? (J(d._({ id: "AuQtzx" })), e = !1) : J(null), Y !== "" && (isNaN(Number(Y)) || Number(Y) < 0) ? (de(d._({ id: "AuQtzx" })), e = !1) : de(null), e;
452
- }, Ne = (e, t) => e.trim() ? oe.test(e) ? /[a-zA-Z0-9]/.test(e) ? ie.has(e.toLowerCase()) ? d._({ id: "JeRXll" }) : Q.some((n) => n.key.toLowerCase() === e.toLowerCase() && n.originalKey !== t) ? d._({ id: "i6/ygf" }) : null : d._({ id: "dTNzBI" }) : d._({ id: "XYZLy9" }) : d._({ id: "QV1ZPO" }), Pe = () => {
453
- let e = Ne(Ce);
454
- if (e) {
455
- De(e);
456
- return;
457
- }
458
- if (!Te.trim()) {
459
- ke(d._({ id: "hXUWyd" }));
460
- return;
461
- }
462
- ve([...Q, {
463
- key: Ce.trim(),
464
- value: Te.trim(),
465
- isNew: !0,
466
- isEditing: !1
467
- }]), we(""), $(""), Se(!1), De(null), ke(null);
468
- }, Fe = () => {
469
- we(""), $(""), Se(!1), De(null), ke(null);
470
- }, Ie = (e) => {
471
- ve(Q.map((t, n) => n === e ? {
472
- ...t,
473
- isEditing: !0
474
- } : {
475
- ...t,
476
- isEditing: !1
477
- })), Se(!1);
478
- }, Le = (e) => {
479
- let t = Q[e], n = Ne(t.key, t.originalKey);
480
- if (n) {
481
- be({ [`edit-${e}`]: n });
482
- return;
483
- }
484
- if (!t.value.trim()) {
485
- be({ [`edit-${e}`]: d._({ id: "hXUWyd" }) });
486
- return;
487
- }
488
- ve(Q.map((t, n) => n === e ? {
489
- ...t,
490
- isEditing: !1,
491
- key: t.key.trim(),
492
- value: t.value.trim()
493
- } : t)), be({});
494
- }, Re = (e) => {
495
- ve(Q.map((t, n) => n === e ? {
496
- ...t,
497
- isEditing: !1,
498
- key: t.originalKey ?? t.key,
499
- value: t.originalValue ?? t.value
500
- } : t)), be({});
501
- }, ze = (e) => {
502
- ve(Q.filter((t, n) => n !== e)), be({});
503
- }, Be = (e, t) => {
504
- ve(Q.map((n, r) => r === e ? {
505
- ...n,
506
- key: t
507
- } : n)), be((t) => {
508
- let n = { ...t };
509
- return delete n[`edit-${e}`], n;
510
- });
511
- }, Ve = (e, t) => {
512
- ve(Q.map((n, r) => r === e ? {
513
- ...n,
514
- value: t
515
- } : n)), be((t) => {
516
- let n = { ...t };
517
- return delete n[`edit-${e}`], n;
518
- });
519
- }, He = () => {
520
- if (!r || !Me()) return;
521
- let e = x?.metadata ?? {}, t = {}, n = [];
522
- Q.forEach((e) => {
523
- (e.isNew || e.value !== e.originalValue || e.key !== e.originalKey) && (t[e.key] = e.value, !e.isNew && e.originalKey && e.key !== e.originalKey && n.push(e.originalKey));
524
- });
525
- let i = Object.keys(e).filter((e) => !ie.has(e)), a = Q.map((e) => e.originalKey).filter(Boolean);
526
- i.forEach((e) => {
527
- !a.includes(e) && !n.includes(e) && n.push(e);
528
- }), k && (X ? t["web-index"] = X : x?.metadata?.["web-index"] && n.push("web-index"), pe ? t["web-listings"] = "1" : x?.metadata?.["web-listings"] && n.push("web-listings"));
529
- let o = !!(x?.versionsEnabled || x?.versionsLocation || x?.historyLocation), s = x?.versionsLocation || x?.historyLocation || "";
530
- je.mutate({
531
- project_id: b,
532
- container: r.name,
533
- metadata: t,
534
- removeMetadata: n.length ? n : void 0,
535
- quotaBytes: q === "" ? void 0 : Number(q),
536
- quotaCount: Y === "" ? void 0 : Number(Y),
537
- versionsLocation: he && (!o || ge !== s) && ge ? ge : void 0,
538
- removeVersionsLocation: !he && o ? !0 : void 0
539
- });
540
- }, Ue = () => {
541
- Ae(), o();
542
- };
543
- if (!e || !r) return null;
544
- let We = C || je.isPending, Ge = T && !C, Ke = Q.some((e) => e.isEditing), qe = x?.quotaBytes == null ? "" : String(x.quotaBytes), Je = x?.quotaCount == null ? "" : String(x.quotaCount), Ye = !!x?.versionsEnabled, Xe = x?.versionsLocation || x?.historyLocation || "", Ze = x?.metadata?.["web-index"] ?? "", Qe = x?.metadata?.["web-listings"] === "1" || x?.metadata?.["web-listings"] === "true", $e = Object.keys(x?.metadata ?? {}).filter((e) => !ie.has(e)), et = Q.length === $e.length && Q.every((e) => !e.isNew && e.key === e.originalKey && e.value === e.originalValue), tt = q === qe && Y === Je && he === Ye && ge === Xe && X === Ze && pe === Qe && et, nt = x?.quotaBytes == null ? null : `${x.quotaBytes} B`;
545
- return /*#__PURE__*/ I(h, {
546
- title: /*#__PURE__*/ I("span", {
547
- className: "flex max-w-[500px] items-center gap-2",
548
- children: [/*#__PURE__*/ F("span", {
549
- className: "shrink-0",
550
- children: /*#__PURE__*/ F(U, { id: "y02Bu1" })
551
- }), /*#__PURE__*/ F("span", {
552
- className: "truncate",
553
- title: r.name,
554
- children: r.name
555
- })]
556
- }),
557
- open: e,
558
- onCancel: Ue,
559
- confirmButtonLabel: d._({ id: "tfDRzk" }),
560
- onConfirm: He,
561
- cancelButtonLabel: d._({ id: "dEgA5A" }),
562
- size: "large",
563
- disableConfirmButton: We || xe || Ke || tt || Ge,
564
- children: [je.isError && /*#__PURE__*/ F("p", {
565
- className: "text-theme-error mb-4",
566
- children: (() => {
567
- let e = je.error.message;
568
- return /*#__PURE__*/ F(U, {
569
- id: "nUuaq8",
570
- values: { errorMessage: e }
571
- });
572
- })()
573
- }), C ? /*#__PURE__*/ I(f, {
574
- direction: "horizontal",
575
- alignment: "center",
576
- gap: "2",
577
- className: "py-8",
578
- children: [/*#__PURE__*/ F(a, { size: "small" }), /*#__PURE__*/ F(U, { id: "WRZ3Mt" })]
579
- }) : Ge ? /*#__PURE__*/ F("p", {
580
- className: "text-theme-error py-8 text-center",
581
- children: /*#__PURE__*/ F(U, {
582
- id: "BCXapL",
583
- values: { errorMessage: E?.message ?? "Unknown error" }
584
- })
585
- }) : /*#__PURE__*/ F("div", {
586
- className: "max-h-[65vh] overflow-y-auto pr-1 pl-1",
587
- children: /*#__PURE__*/ I(f, {
588
- direction: "vertical",
589
- gap: "6",
590
- children: [
591
- /*#__PURE__*/ I("div", {
592
- className: "grid grid-cols-2 gap-4",
593
- children: [/*#__PURE__*/ F(S, {
594
- label: d._({ id: "z45o5B" }),
595
- value: String(r.count),
596
- disabled: !0,
597
- readOnly: !0
598
- }), /*#__PURE__*/ F(S, {
599
- label: d._({ id: "/InK0O" }),
600
- value: x?.bytesUsed == null ? `${r.bytes.toLocaleString()} B` : `${x.bytesUsed.toLocaleString()} B`,
601
- disabled: !0,
602
- readOnly: !0
603
- })]
604
- }),
605
- /*#__PURE__*/ I("div", {
606
- className: "grid grid-cols-2 gap-4",
607
- children: [/*#__PURE__*/ F("div", { children: /*#__PURE__*/ F(S, {
608
- label: d._({ id: "k0vAWv" }),
609
- value: Y,
610
- onChange: (e) => {
611
- le(e.target.value), ue && de(null);
612
- },
613
- placeholder: d._({ id: "qtoOYG" }),
614
- invalid: !!ue,
615
- errortext: ue ?? void 0,
616
- disabled: We
617
- }) }), /*#__PURE__*/ F("div", { children: /*#__PURE__*/ F(S, {
618
- label: d._({ id: "KOpPMt" }),
619
- value: q,
620
- onChange: (e) => {
621
- se(e.target.value), ce && J(null);
622
- },
623
- placeholder: d._({ id: "qtoOYG" }),
624
- invalid: !!ce,
625
- errortext: ce ?? void 0,
626
- disabled: We,
627
- helptext: q && nt ? nt : void 0
628
- }) })]
629
- }),
630
- k && A && /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ I("p", {
631
- className: "text-theme-default mb-1 text-sm font-semibold",
632
- children: [
633
- /*#__PURE__*/ F(U, { id: "mvz5Eo" }),
634
- " ",
635
- /*#__PURE__*/ F("a", {
636
- href: A,
637
- target: "_blank",
638
- rel: "noopener noreferrer",
639
- className: "text-theme-info text-xs font-normal underline",
640
- children: /*#__PURE__*/ F(U, { id: "Alx2/L" })
641
- })
642
- ]
643
- }), /*#__PURE__*/ F(S, {
644
- value: A,
645
- disabled: !0,
646
- readOnly: !0
647
- })] }),
648
- /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F("p", {
649
- className: "text-theme-default mb-3 text-sm font-semibold",
650
- children: /*#__PURE__*/ F(U, { id: "6CDYXS" })
651
- }), k ? /*#__PURE__*/ I(f, {
652
- direction: "vertical",
653
- gap: "4",
654
- children: [/*#__PURE__*/ I(f, {
655
- direction: "vertical",
656
- gap: "1",
657
- children: [/*#__PURE__*/ F(y, {
658
- label: d._({ id: "6+7EwD" }),
659
- checked: !!X,
660
- onChange: (e) => {
661
- e.target.checked ? X || fe("index.html") : fe("");
662
- },
663
- disabled: We
664
- }), /*#__PURE__*/ F("div", {
665
- className: "pl-6",
666
- children: /*#__PURE__*/ F(S, {
667
- value: X,
668
- onChange: (e) => fe(e.target.value),
669
- placeholder: "index.html",
670
- disabled: We || !X,
671
- className: "flex-1"
672
- })
673
- })]
674
- }), /*#__PURE__*/ I(f, {
675
- direction: "horizontal",
676
- alignment: "start",
677
- gap: "2",
678
- children: [/*#__PURE__*/ F(y, {
679
- label: d._({ id: "NeUjqc" }),
680
- checked: pe,
681
- onChange: (e) => me(e.target.checked),
682
- disabled: We
683
- }), /*#__PURE__*/ I(t, {
684
- triggerEvent: "hover",
685
- children: [/*#__PURE__*/ F(w, { children: /*#__PURE__*/ F(m, {
686
- icon: "help",
687
- size: "16",
688
- className: "text-theme-light cursor-help"
689
- }) }), /*#__PURE__*/ F(n, {
690
- className: "z-10 max-w-[220px]",
691
- children: /*#__PURE__*/ F(U, { id: "Oxl1UN" })
692
- })]
693
- })]
694
- })]
695
- }) : /*#__PURE__*/ F("p", {
696
- className: "text-theme-default text-sm",
697
- children: /*#__PURE__*/ F(U, {
698
- id: "aSsVD3",
699
- components: { 0: /*#__PURE__*/ F("strong", {}) }
700
- })
701
- })] }),
702
- /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F("p", {
703
- className: "text-theme-default mb-2 text-sm font-semibold",
704
- children: /*#__PURE__*/ F(U, { id: "jNzyQo" })
705
- }), Ye && !ge ? /*#__PURE__*/ F(y, {
706
- label: d._({ id: "Nvfd2b" }),
707
- checked: !0,
708
- onChange: (e) => {
709
- e.target.checked || (Z(!1), _e(""), P(""), ee(""));
710
- },
711
- disabled: !0
712
- }) : !he && !ge ? /*#__PURE__*/ F(y, {
713
- label: d._({ id: "WyKwnD" }),
714
- checked: !1,
715
- onChange: (e) => Z(e.target.checked),
716
- disabled: We
717
- }) : /*#__PURE__*/ I(f, {
718
- direction: "vertical",
719
- gap: "1",
720
- children: [/*#__PURE__*/ F(y, {
721
- label: d._({ id: "b0uU1G" }),
722
- checked: he,
723
- onChange: (e) => {
724
- Z(e.target.checked), e.target.checked || (_e(""), P(""), ee(""));
725
- },
726
- disabled: We
727
- }), he && /*#__PURE__*/ F("div", {
728
- className: "pl-6",
729
- children: /*#__PURE__*/ F(g, {
730
- value: ge,
731
- onChange: (e) => _e(e),
732
- onInputChange: G,
733
- placeholder: d._({ id: "a13wDR" }),
734
- helptext: (() => {
735
- if (M.trim().length === 0) return d._({ id: "c+fUtV" });
736
- if (K > 0) {
737
- let e = ae, t = te.length;
738
- return d._({
739
- id: "qzhUb9",
740
- values: {
741
- maxOptions: e,
742
- totalCount: t
743
- }
744
- });
745
- }
746
- })(),
747
- disabled: We,
748
- children: ne.map((e) => /*#__PURE__*/ F(D, {
749
- value: e.name,
750
- children: e.name
751
- }, e.name))
752
- })
753
- })]
754
- })] }),
755
- /*#__PURE__*/ I("div", { children: [
756
- /*#__PURE__*/ I(f, {
757
- direction: "horizontal",
758
- alignment: "center",
759
- distribution: "between",
760
- className: "mb-3",
761
- children: [/*#__PURE__*/ F("p", {
762
- className: "text-theme-default text-sm font-semibold",
763
- children: /*#__PURE__*/ F(U, { id: "6GBt0m" })
764
- }), /*#__PURE__*/ F("p", {
765
- className: "text-theme-light text-xs",
766
- children: /*#__PURE__*/ F(U, { id: "kuYWaD" })
767
- })]
768
- }),
769
- /*#__PURE__*/ F(f, {
770
- direction: "horizontal",
771
- className: "jn:bg-theme-background-lvl-1 justify-end p-2",
772
- children: /*#__PURE__*/ F(p, {
773
- label: d._({ id: "sWBLli" }),
774
- onClick: () => Se(!0),
775
- variant: "primary",
776
- icon: "addCircle",
777
- size: "small",
778
- disabled: xe || Ke || We
779
- })
780
- }),
781
- /*#__PURE__*/ I(_, {
782
- columns: 3,
783
- children: [
784
- /*#__PURE__*/ I(c, { children: [
785
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "7sMeHQ" }) }),
786
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "wMHvYH" }) }),
787
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "7L01XJ" }) })
788
- ] }),
789
- xe && /*#__PURE__*/ I(c, { children: [
790
- /*#__PURE__*/ F(i, { children: /*#__PURE__*/ F(S, {
791
- value: Ce,
792
- onChange: (e) => {
793
- we(e.target.value), Ee && De(null);
794
- },
795
- placeholder: d._({ id: "x9AdZ8" }),
796
- errortext: Ee ?? void 0,
797
- invalid: !!Ee,
798
- autoFocus: !0
799
- }) }),
800
- /*#__PURE__*/ F(i, { children: /*#__PURE__*/ F(S, {
801
- value: Te,
802
- onChange: (e) => {
803
- $(e.target.value), Oe && ke(null);
804
- },
805
- placeholder: d._({ id: "wMHvYH" }),
806
- errortext: Oe ?? void 0,
807
- invalid: !!Oe
808
- }) }),
809
- /*#__PURE__*/ F(i, { children: /*#__PURE__*/ I(f, {
810
- direction: "horizontal",
811
- gap: "2",
812
- children: [/*#__PURE__*/ F(p, {
813
- size: "small",
814
- variant: "primary",
815
- onClick: Pe,
816
- icon: "check",
817
- title: d._({ id: "tfDRzk" })
818
- }), /*#__PURE__*/ F(p, {
819
- size: "small",
820
- variant: "subdued",
821
- onClick: Fe,
822
- icon: "close",
823
- title: d._({ id: "bzSI52" })
824
- })]
825
- }) })
826
- ] }),
827
- Q.map((e, t) => /*#__PURE__*/ I(c, { children: [
828
- /*#__PURE__*/ F(i, { children: e.isEditing ? /*#__PURE__*/ F(S, {
829
- value: e.key,
830
- onChange: (e) => Be(t, e.target.value),
831
- errortext: ye[`edit-${t}`],
832
- invalid: !!ye[`edit-${t}`]
833
- }) : /*#__PURE__*/ F("span", {
834
- className: "block max-w-xs truncate font-mono text-sm",
835
- title: e.key,
836
- children: e.key
837
- }) }),
838
- /*#__PURE__*/ F(i, { children: e.isEditing ? /*#__PURE__*/ F(S, {
839
- value: e.value,
840
- onChange: (e) => Ve(t, e.target.value)
841
- }) : /*#__PURE__*/ F("span", {
842
- className: "block max-w-md truncate text-sm",
843
- title: e.value,
844
- children: e.value
845
- }) }),
846
- /*#__PURE__*/ F(i, { children: e.isEditing ? /*#__PURE__*/ I(f, {
847
- direction: "horizontal",
848
- gap: "2",
849
- children: [/*#__PURE__*/ F(p, {
850
- size: "small",
851
- variant: "primary",
852
- onClick: () => Le(t),
853
- icon: "check",
854
- title: d._({ id: "tfDRzk" })
855
- }), /*#__PURE__*/ F(p, {
856
- size: "small",
857
- variant: "subdued",
858
- onClick: () => Re(t),
859
- icon: "close",
860
- title: d._({ id: "bzSI52" })
861
- })]
862
- }) : /*#__PURE__*/ I(f, {
863
- direction: "horizontal",
864
- gap: "2",
865
- children: [/*#__PURE__*/ F(p, {
866
- size: "small",
867
- variant: "subdued",
868
- onClick: () => Ie(t),
869
- icon: "edit",
870
- title: d._({ id: "ePK91l" }),
871
- disabled: xe || Ke || We
872
- }), /*#__PURE__*/ F(p, {
873
- size: "small",
874
- variant: "primary-danger",
875
- onClick: () => ze(t),
876
- icon: "deleteForever",
877
- title: d._({ id: "cnGeoo" }),
878
- disabled: xe || Ke || We
879
- })]
880
- }) })
881
- ] }, t)),
882
- Q.length === 0 && !xe && /*#__PURE__*/ F(c, { children: /*#__PURE__*/ F(i, {
883
- colSpan: 3,
884
- className: "py-6 text-center",
885
- children: /*#__PURE__*/ F(f, {
886
- alignment: "center",
887
- children: /*#__PURE__*/ F("span", {
888
- className: "text-theme-light text-sm",
889
- children: /*#__PURE__*/ F(U, { id: "F02e8I" })
890
- })
891
- })
892
- }) })
893
- ]
894
- })
895
- ] })
896
- ]
897
- })
898
- })]
899
- });
900
- };
901
- //#endregion
902
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Containers/ManageContainerAccessModal.tsx
903
- function ce(e) {
904
- let t = e.trim();
905
- if (t === ".r:*") return {
906
- raw: t,
907
- type: "any-referrer",
908
- description: "",
909
- requiresToken: !1
910
- };
911
- if (t.startsWith(".r:")) {
912
- let e = t.slice(3), n = e.startsWith("-"), r = n ? e.slice(1) : e;
913
- return {
914
- raw: t,
915
- type: n ? "denied-referrer" : "specific-referrer",
916
- host: r,
917
- description: "",
918
- requiresToken: !1
919
- };
920
- }
921
- if (t === ".rlistings") return {
922
- raw: t,
923
- type: "listing-access",
924
- description: "",
925
- requiresToken: !1
926
- };
927
- if (/^[^:]+:\*$/.test(t) && !t.startsWith("*")) {
928
- let [e] = t.split(":");
929
- return {
930
- raw: t,
931
- type: "all-project-users",
932
- projectId: e,
933
- description: "",
934
- requiresToken: !0
935
- };
936
- }
937
- if (t.startsWith("*:")) return {
938
- raw: t,
939
- type: "specific-user-any-project",
940
- userId: t.slice(2),
941
- description: "",
942
- requiresToken: !0
943
- };
944
- if (t.includes(":")) {
945
- let [e, n] = t.split(":");
946
- return {
947
- raw: t,
948
- type: "specific-user",
949
- projectId: e,
950
- userId: n,
951
- description: "",
952
- requiresToken: !0
953
- };
954
- }
955
- return {
956
- raw: t,
957
- type: "unknown",
958
- description: "",
959
- requiresToken: !0
960
- };
961
- }
962
- function J(e) {
963
- return e.trim() ? e.split(",").map((e) => e.trim()).filter(Boolean).map(ce) : [];
964
- }
965
- var Y = [".r:*", ".rlistings"];
966
- function le(e) {
967
- let t = e.split(",").map((e) => e.trim()).filter(Boolean);
968
- return Y.every((e) => t.includes(e));
969
- }
970
- function ue(e) {
971
- let t = e.split(",").map((e) => e.trim()).filter(Boolean);
972
- return [...new Set([...Y, ...t])].join(",");
973
- }
974
- function de(e) {
975
- return e.split(",").map((e) => e.trim()).filter((e) => !Y.includes(e)).join(",");
976
- }
977
- function X(e) {
978
- switch (e.type) {
979
- case "any-referrer": return G._({ id: "HVdrr1" });
980
- case "denied-referrer": {
981
- let t = e.host || "";
982
- return G._({
983
- id: "7XQ3QJ",
984
- values: { host: t }
985
- });
986
- }
987
- case "specific-referrer": {
988
- let t = e.host || "";
989
- return G._({
990
- id: "Dqnh7K",
991
- values: { host: t }
992
- });
993
- }
994
- case "listing-access": return G._({ id: "ntNlXu" });
995
- case "all-project-users": {
996
- let t = e.projectId || "";
997
- return G._({
998
- id: "sa4CV6",
999
- values: { projectId: t }
1000
- });
1001
- }
1002
- case "specific-user-any-project": {
1003
- let t = e.userId || "";
1004
- return G._({
1005
- id: "izMhIO",
1006
- values: { userId: t }
1007
- });
1008
- }
1009
- case "specific-user": {
1010
- let t = e.projectId || "", n = e.userId || "";
1011
- return G._({
1012
- id: "cXuXkb",
1013
- values: {
1014
- userId: n,
1015
- projectId: t
1016
- }
1017
- });
1018
- }
1019
- default: return e.raw;
1020
- }
1021
- }
1022
- var fe = ({ isOpen: e, container: t, onClose: n, onSuccess: r, onError: i }) => {
1023
- let { i18n: o, _: s } = W(), c = N(), [l, d] = V(""), [m, g] = V(""), [_, v] = V(!1), [b, x] = V(!1);
1024
- z(() => {
1025
- !l.trim() && !m.trim() && x(!1);
1026
- }, [l, m]);
1027
- let { data: S, isLoading: C, isError: w, error: T } = O.storage.swift.getContainerMetadata.useQuery({
1028
- project_id: c,
1029
- container: t?.name ?? ""
1030
- }, { enabled: e && t !== null });
1031
- z(() => {
1032
- if (!S) return;
1033
- let e = S.read ?? "", t = S.write ?? "";
1034
- d(e), g(t), v(le(e));
1035
- }, [S]);
1036
- let E = O.useUtils(), D = O.storage.swift.updateContainerMetadata.useMutation({
1037
- onSuccess: () => {
1038
- E.storage.swift.getContainerMetadata.invalidate({
1039
- project_id: c,
1040
- container: t.name
1041
- }), E.storage.swift.listContainers.invalidate(), r?.(t.name), A();
1042
- },
1043
- onError: (e) => {
1044
- i?.(t.name, e.message);
1045
- }
1046
- }), k = B(D.reset);
1047
- k.current = D.reset;
1048
- let A = () => {
1049
- d(""), g(""), v(!1), x(!1), D.reset(), n();
1050
- };
1051
- z(() => {
1052
- e || (d(""), g(""), v(!1), k.current());
1053
- }, [e]);
1054
- let j = (e) => {
1055
- let t = e.target.checked;
1056
- v(t), d((e) => t ? ue(e) : de(e));
1057
- }, M = (e) => {
1058
- let t = e.target.value;
1059
- d(t), v(le(t));
1060
- }, L = () => {
1061
- t && D.mutate({
1062
- project_id: c,
1063
- container: t.name,
1064
- read: l.trim(),
1065
- write: m.trim()
1066
- });
1067
- };
1068
- if (!e || !t) return null;
1069
- let R = C || D.isPending, ee = l.trim().length > 0 || m.trim().length > 0, H = J(l), G = J(m);
1070
- return /*#__PURE__*/ I(h, {
1071
- title: /* @__PURE__ */ I("span", {
1072
- className: "flex items-center gap-2",
1073
- children: [/*#__PURE__*/ F(U, { id: "6Kjltl" }), /*#__PURE__*/ F("span", {
1074
- className: "max-w-[250px] truncate font-mono",
1075
- title: t.name,
1076
- children: t.name
1077
- })]
1078
- }),
1079
- open: e,
1080
- onCancel: A,
1081
- confirmButtonLabel: o._({ id: "tfDRzk" }),
1082
- onConfirm: L,
1083
- cancelButtonLabel: o._({ id: "dEgA5A" }),
1084
- size: "xl",
1085
- disableConfirmButton: R || w,
1086
- children: [D.isError && /*#__PURE__*/ F("p", {
1087
- className: "text-theme-error mb-4",
1088
- children: (() => {
1089
- let e = D.error.message;
1090
- return /*#__PURE__*/ F(U, {
1091
- id: "u2xIeO",
1092
- values: { errorMessage: e }
1093
- });
1094
- })()
1095
- }), /*#__PURE__*/ I("div", {
1096
- className: "max-h-[70vh] overflow-y-auto pr-1 pl-1",
1097
- children: [/*#__PURE__*/ I("div", {
1098
- className: "mb-4",
1099
- children: [/*#__PURE__*/ F("p", {
1100
- className: "text-theme-default mb-2",
1101
- children: /*#__PURE__*/ F(U, { id: "PHsq3v" })
1102
- }), /*#__PURE__*/ F("p", {
1103
- className: "text-theme-default",
1104
- children: /*#__PURE__*/ F(U, { id: "g9m7gK" })
1105
- })]
1106
- }), C ? /*#__PURE__*/ I(f, {
1107
- direction: "horizontal",
1108
- alignment: "center",
1109
- gap: "2",
1110
- className: "py-6",
1111
- children: [/*#__PURE__*/ F(a, { size: "small" }), /*#__PURE__*/ F(U, { id: "poCbZw" })]
1112
- }) : w ? /*#__PURE__*/ F("p", {
1113
- className: "text-theme-error py-2",
1114
- children: /*#__PURE__*/ F(U, {
1115
- id: "QNHur0",
1116
- values: { errorMessage: T?.message ?? "" }
1117
- })
1118
- }) : /*#__PURE__*/ F(P, { children: /*#__PURE__*/ I("div", {
1119
- className: "flex gap-6",
1120
- children: [/*#__PURE__*/ F("div", {
1121
- className: "min-w-0 flex-1",
1122
- children: /*#__PURE__*/ I(f, {
1123
- direction: "vertical",
1124
- gap: "6",
1125
- children: [
1126
- /*#__PURE__*/ I("div", { children: [
1127
- /*#__PURE__*/ F(me, { label: o._({ id: "SBGiGm" }) }),
1128
- /*#__PURE__*/ F(u, {
1129
- value: l,
1130
- onChange: M,
1131
- disabled: R || _,
1132
- placeholder: o._({ id: "FKL6Jv" }),
1133
- className: "font-mono text-sm",
1134
- rows: 3
1135
- }),
1136
- /*#__PURE__*/ F(y, {
1137
- label: o._({ id: "23wBCX" }),
1138
- checked: _,
1139
- onChange: j,
1140
- disabled: R,
1141
- className: "mt-2"
1142
- })
1143
- ] }),
1144
- /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F(me, { label: o._({ id: "6qzsuS" }) }), /*#__PURE__*/ F(u, {
1145
- value: m,
1146
- onChange: (e) => {
1147
- let t = e.target.value;
1148
- g(t);
1149
- },
1150
- disabled: R,
1151
- placeholder: o._({ id: "UVFHGY" }),
1152
- className: "font-mono text-sm",
1153
- rows: 3
1154
- })] }),
1155
- ee && /*#__PURE__*/ F(p, {
1156
- label: b ? o._({ id: "we28Pq" }) : o._({ id: "YiMCKk" }),
1157
- onClick: () => x((e) => !e),
1158
- variant: "subdued",
1159
- disabled: R
1160
- }),
1161
- b && (H.length > 0 || G.length > 0) && /*#__PURE__*/ I(f, {
1162
- direction: "vertical",
1163
- gap: "4",
1164
- children: [H.length > 0 && /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F("p", {
1165
- className: "text-theme-default mb-2 text-sm font-semibold",
1166
- children: /*#__PURE__*/ F(U, { id: "SBGiGm" })
1167
- }), /*#__PURE__*/ F("div", {
1168
- className: "border-theme-background-lvl-3 divide-theme-background-lvl-3 divide-y rounded border",
1169
- children: H.map((e, t) => /*#__PURE__*/ I("div", {
1170
- className: "flex flex-col gap-1 px-3 py-2",
1171
- children: [/*#__PURE__*/ I("div", {
1172
- className: "flex items-center justify-between gap-3",
1173
- children: [/*#__PURE__*/ F("p", {
1174
- className: "text-theme-default min-w-0 truncate text-sm font-medium",
1175
- title: X(e),
1176
- children: X(e)
1177
- }), /*#__PURE__*/ F("p", {
1178
- className: "text-theme-light shrink-0 text-xs",
1179
- children: e.requiresToken ? /*#__PURE__*/ F(U, { id: "z+zpLP" }) : /*#__PURE__*/ F(U, { id: "t7ff15" })
1180
- })]
1181
- }), /*#__PURE__*/ F("code", {
1182
- className: "text-theme-light bg-theme-background-lvl-2 block w-full rounded px-2 py-1 font-mono text-xs break-all",
1183
- children: e.raw
1184
- })]
1185
- }, t))
1186
- })] }), G.length > 0 && /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F("p", {
1187
- className: "text-theme-default mb-2 text-sm font-semibold",
1188
- children: /*#__PURE__*/ F(U, { id: "6qzsuS" })
1189
- }), /*#__PURE__*/ F("div", {
1190
- className: "border-theme-background-lvl-3 divide-theme-background-lvl-3 divide-y rounded border",
1191
- children: G.map((e, t) => /*#__PURE__*/ I("div", {
1192
- className: "flex flex-col gap-1 px-3 py-2",
1193
- children: [/*#__PURE__*/ I("div", {
1194
- className: "flex items-center justify-between gap-3",
1195
- children: [/*#__PURE__*/ F("p", {
1196
- className: "text-theme-default min-w-0 truncate text-sm font-medium",
1197
- title: X(e),
1198
- children: X(e)
1199
- }), /*#__PURE__*/ F("p", {
1200
- className: "text-theme-light shrink-0 text-xs",
1201
- children: /*#__PURE__*/ F(U, { id: "z+zpLP" })
1202
- })]
1203
- }), /*#__PURE__*/ F("code", {
1204
- className: "text-theme-light bg-theme-background-lvl-2 block w-full rounded px-2 py-1 font-mono text-xs break-all",
1205
- children: e.raw
1206
- })]
1207
- }, t))
1208
- })] })]
1209
- })
1210
- ]
1211
- })
1212
- }), /*#__PURE__*/ I("div", {
1213
- className: "border-theme-background-lvl-3 w-72 shrink-0 border-l pl-6",
1214
- children: [
1215
- /*#__PURE__*/ F("p", {
1216
- className: "text-theme-light mb-3 text-xs",
1217
- children: /*#__PURE__*/ F(U, { id: "dd2ndz" })
1218
- }),
1219
- /*#__PURE__*/ I(f, {
1220
- direction: "vertical",
1221
- gap: "4",
1222
- children: [
1223
- /*#__PURE__*/ F(pe, {
1224
- code: ".r:*",
1225
- description: o._({ id: "VV1fdg" })
1226
- }),
1227
- /*#__PURE__*/ F(pe, {
1228
- code: ".rlistings",
1229
- description: o._({ id: "s/s1lz" })
1230
- }),
1231
- /*#__PURE__*/ F(pe, {
1232
- code: "PROJECT_ID:USER_ID",
1233
- description: o._({ id: "zhM8FP" })
1234
- }),
1235
- /*#__PURE__*/ F(pe, {
1236
- code: "PROJECT_ID:*",
1237
- description: o._({ id: "BCJPTn" })
1238
- }),
1239
- /*#__PURE__*/ F(pe, {
1240
- code: "*:USER_ID",
1241
- description: o._({ id: "/xnbdQ" })
1242
- })
1243
- ]
1244
- }),
1245
- /*#__PURE__*/ F("p", {
1246
- className: "text-theme-light mt-4 text-xs",
1247
- children: /*#__PURE__*/ F(U, {
1248
- id: "rrjuul",
1249
- components: { 0: /*#__PURE__*/ F("a", {
1250
- href: "https://docs.openstack.org/swift/latest/overview_acl.html",
1251
- target: "_blank",
1252
- rel: "noopener noreferrer",
1253
- className: "text-theme-link underline"
1254
- }) }
1255
- })
1256
- })
1257
- ]
1258
- })]
1259
- }) })]
1260
- })]
1261
- });
1262
- };
1263
- function pe({ code: e, description: t }) {
1264
- return /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F(l, {
1265
- variant: "info",
1266
- className: "mb-1 font-mono text-xs",
1267
- children: e
1268
- }), /*#__PURE__*/ F("p", {
1269
- className: "text-theme-light text-xs leading-relaxed",
1270
- children: t
1271
- })] });
1272
- }
1273
- function me({ label: e }) {
1274
- return /*#__PURE__*/ I("div", {
1275
- className: "mb-1 flex items-center gap-1",
1276
- children: [/*#__PURE__*/ F("label", {
1277
- className: "text-theme-default text-sm font-semibold",
1278
- children: e
1279
- }), /*#__PURE__*/ I(t, {
1280
- triggerEvent: "hover",
1281
- children: [/*#__PURE__*/ F(w, { children: /*#__PURE__*/ F(m, {
1282
- icon: "info",
1283
- size: "14",
1284
- className: "text-theme-light cursor-help"
1285
- }) }), /*#__PURE__*/ F(n, {
1286
- className: "z-10 max-w-[350px]",
1287
- children: /*#__PURE__*/ F(U, { id: "AdtLNV" })
1288
- })]
1289
- })]
1290
- });
1291
- }
1292
- //#endregion
1293
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Containers/ContainerTableView.tsx
1294
- var he = ({ containers: e, createModalOpen: t, setCreateModalOpen: n, maxContainerNameLength: a, onCreateSuccess: o, onCreateError: l, onEmptySuccess: u, onEmptyError: d, onDeleteSuccess: f, onDeleteError: p, onPropertiesSuccess: m, onPropertiesError: h, onAclSuccess: g, onAclError: v, selectedContainers: x, setSelectedContainers: S, hasAnyBulkAction: C = !0 }) => {
1295
- let { projectId: w, provider: E, storageType: D } = H({ from: "/_auth/projects/$projectId/storage/$provider/$storageType/" }), { i18n: O, _: k } = W(), A = ee(), j = B(null), [N, L] = V(0), [R, G] = V(null), [te, ie] = V(null), [ae, oe] = V(null), [ce, J] = V(null);
1296
- z(() => {
1297
- j.current && L(j.current.offsetWidth - j.current.clientWidth);
1298
- }, [e.length]);
1299
- let Y = (e) => {
1300
- try {
1301
- return new Date(e).toLocaleString();
1302
- } catch {
1303
- return O._({ id: "fj5byd" });
1304
- }
1305
- }, le = ne({
1306
- count: e.length,
1307
- getScrollElement: () => j.current,
1308
- estimateSize: () => 48,
1309
- overscan: 10
1310
- }), ue = new Set(x), de = e.length > 0 && e.every((e) => ue.has(e.name)), X = () => {
1311
- S(de ? [] : e.map((e) => e.name));
1312
- }, pe = (e) => {
1313
- x.includes(e) ? S(x.filter((t) => t !== e)) : S([...x, e]);
1314
- };
1315
- if (!e || e.length === 0) return /*#__PURE__*/ I(P, { children: [/*#__PURE__*/ F(_, {
1316
- columns: 4,
1317
- className: "containers",
1318
- "data-testid": "no-containers",
1319
- children: /*#__PURE__*/ F(c, { children: /*#__PURE__*/ F(i, {
1320
- colSpan: 4,
1321
- children: /*#__PURE__*/ I("div", {
1322
- className: "py-8 text-center",
1323
- children: [/*#__PURE__*/ F("h3", {
1324
- className: "text-lg font-semibold",
1325
- children: /*#__PURE__*/ F(U, { id: "Hiw1Ha" })
1326
- }), /*#__PURE__*/ F("p", {
1327
- className: "text-theme-light mt-2",
1328
- children: /*#__PURE__*/ F(U, { id: "x1bK0h" })
1329
- })]
1330
- })
1331
- }) })
1332
- }), /*#__PURE__*/ F(K, {
1333
- isOpen: t,
1334
- onClose: () => n(!1),
1335
- onSuccess: o,
1336
- onError: l,
1337
- maxContainerNameLength: a
1338
- })] });
1339
- let me = C ? 6 : 5, he = C ? "40px minmax(200px, 2fr) minmax(100px, 1fr) minmax(180px, 2fr) minmax(100px, 1fr) 60px" : "minmax(200px, 2fr) minmax(100px, 1fr) minmax(180px, 2fr) minmax(100px, 1fr) 60px";
1340
- return /*#__PURE__*/ I(P, { children: [
1341
- /*#__PURE__*/ I("div", {
1342
- className: "relative",
1343
- children: [/*#__PURE__*/ F("div", {
1344
- style: { paddingRight: `${N}px` },
1345
- children: /*#__PURE__*/ F(_, {
1346
- columns: me,
1347
- gridColumnTemplate: he,
1348
- className: "containers",
1349
- "data-testid": "containers-table-header",
1350
- children: /*#__PURE__*/ I(c, { children: [
1351
- C && /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(y, {
1352
- checked: de,
1353
- onChange: X,
1354
- "data-testid": "select-all-containers"
1355
- }) }),
1356
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "t0X9+8" }) }),
1357
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "sxbP3b" }) }),
1358
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "sjMCOP" }) }),
1359
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "hgpMHD" }) }),
1360
- /*#__PURE__*/ F(s, { style: { marginRight: `-${N}px` } })
1361
- ] })
1362
- })
1363
- }), /*#__PURE__*/ F("div", {
1364
- ref: j,
1365
- className: "overflow-auto",
1366
- style: { height: "calc(100vh - 490px)" },
1367
- "data-testid": "containers-table-body",
1368
- children: /*#__PURE__*/ F("div", {
1369
- style: {
1370
- height: `${le.getTotalSize()}px`,
1371
- width: "100%",
1372
- position: "relative"
1373
- },
1374
- children: le.getVirtualItems().map((t) => {
1375
- let n = e[t.index], a = x.includes(n.name), o = () => A({
1376
- to: "/projects/$projectId/storage/$provider/$storageType/$containerName/objects",
1377
- params: {
1378
- projectId: w,
1379
- provider: E,
1380
- storageType: D,
1381
- containerName: n.name
1382
- }
1383
- });
1384
- return /*#__PURE__*/ I("div", {
1385
- "data-index": t.index,
1386
- ref: le.measureElement,
1387
- className: "juno-datagrid group hover:bg-theme-background-lvl-1 cursor-pointer",
1388
- style: {
1389
- position: "absolute",
1390
- top: 0,
1391
- left: 0,
1392
- width: "100%",
1393
- transform: `translateY(${t.start}px)`,
1394
- display: "grid",
1395
- gridTemplateColumns: he,
1396
- alignItems: "stretch"
1397
- },
1398
- "data-testid": `container-row-${n.name}`,
1399
- role: "link",
1400
- tabIndex: 0,
1401
- onClick: o,
1402
- onKeyDown: (e) => {
1403
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o());
1404
- },
1405
- children: [
1406
- C && /*#__PURE__*/ F(i, {
1407
- onClick: (e) => e.stopPropagation(),
1408
- onKeyDown: (e) => {
1409
- (e.key === "Enter" || e.key === " ") && e.stopPropagation();
1410
- },
1411
- children: /*#__PURE__*/ F(y, {
1412
- checked: a,
1413
- onChange: () => pe(n.name),
1414
- "data-testid": `select-container-${n.name}`
1415
- })
1416
- }),
1417
- /*#__PURE__*/ F(i, {
1418
- className: "min-w-0 overflow-hidden",
1419
- children: /*#__PURE__*/ F("span", {
1420
- className: "block truncate",
1421
- title: n.name,
1422
- children: n.name
1423
- })
1424
- }),
1425
- /*#__PURE__*/ F(i, { children: n.count.toLocaleString() }),
1426
- /*#__PURE__*/ F(i, { children: n.last_modified ? Y(n.last_modified) : O._({ id: "fj5byd" }) }),
1427
- /*#__PURE__*/ F(i, { children: M(n.bytes) }),
1428
- /*#__PURE__*/ F(i, {
1429
- onClick: (e) => e.stopPropagation(),
1430
- children: /*#__PURE__*/ F(r, { children: /*#__PURE__*/ I(T, { children: [
1431
- /*#__PURE__*/ F(b, {
1432
- label: O._({ id: "cWbW6w" }),
1433
- onClick: () => J(n),
1434
- "data-testid": `access-control-action-${n.name}`
1435
- }),
1436
- /*#__PURE__*/ F(b, {
1437
- label: O._({ id: "Oc8Aqv" }),
1438
- onClick: () => oe(n),
1439
- "data-testid": `properties-action-${n.name}`
1440
- }),
1441
- /*#__PURE__*/ F(b, {
1442
- label: O._({ id: "N2S1rs" }),
1443
- onClick: () => G(n),
1444
- "data-testid": `empty-action-${n.name}`
1445
- }),
1446
- /*#__PURE__*/ F(b, {
1447
- label: O._({ id: "cnGeoo" }),
1448
- onClick: () => ie(n),
1449
- "data-testid": `delete-action-${n.name}`
1450
- })
1451
- ] }) })
1452
- })
1453
- ]
1454
- }, n.name);
1455
- })
1456
- })
1457
- })]
1458
- }),
1459
- /*#__PURE__*/ F(K, {
1460
- isOpen: t,
1461
- onClose: () => n(!1),
1462
- onSuccess: o,
1463
- onError: l,
1464
- maxContainerNameLength: a
1465
- }),
1466
- /*#__PURE__*/ F(re, {
1467
- isOpen: R !== null,
1468
- container: R,
1469
- onClose: () => G(null),
1470
- onSuccess: u,
1471
- onError: d
1472
- }),
1473
- /*#__PURE__*/ F(q, {
1474
- isOpen: te !== null,
1475
- container: te,
1476
- onClose: () => ie(null),
1477
- onSuccess: f,
1478
- onError: p
1479
- }),
1480
- /*#__PURE__*/ F(se, {
1481
- isOpen: ae !== null,
1482
- container: ae,
1483
- onClose: () => oe(null),
1484
- onSuccess: m,
1485
- onError: h
1486
- }),
1487
- /*#__PURE__*/ F(fe, {
1488
- isOpen: ce !== null,
1489
- container: ce,
1490
- onClose: () => J(null),
1491
- onSuccess: g,
1492
- onError: v
1493
- })
1494
- ] });
1495
- };
1496
- //#endregion
1497
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Containers/ContainerToastNotifications.tsx
1498
- function Z({ title: e, description: t }) {
1499
- return /*#__PURE__*/ I(f, {
1500
- direction: "vertical",
1501
- gap: "1.5",
1502
- children: [/*#__PURE__*/ F("span", { children: e }), /*#__PURE__*/ F("span", {
1503
- className: "text-theme-light",
1504
- children: t
1505
- })]
1506
- });
1507
- }
1508
- var ge = (e, t) => ({
1509
- variant: "success",
1510
- children: /*#__PURE__*/ F(Z, {
1511
- title: /*#__PURE__*/ F(U, { id: "6w+VnM" }),
1512
- description: /*#__PURE__*/ F(U, {
1513
- id: "XwxJJB",
1514
- values: { containerName: e }
1515
- })
1516
- }),
1517
- onDismiss: t.onDismiss
1518
- }), _e = (e, t, n) => ({
1519
- variant: "error",
1520
- children: /*#__PURE__*/ F(Z, {
1521
- title: /*#__PURE__*/ F(U, { id: "Vj8XFg" }),
1522
- description: /*#__PURE__*/ F(U, {
1523
- id: "Vz+7ZA",
1524
- values: {
1525
- containerName: e,
1526
- errorMessage: t
1527
- }
1528
- })
1529
- }),
1530
- onDismiss: n.onDismiss
1531
- }), Q = (e, t, n) => ({
1532
- variant: "success",
1533
- children: /*#__PURE__*/ F(Z, {
1534
- title: /*#__PURE__*/ F(U, { id: "6OopEX" }),
1535
- description: t === 0 ? /*#__PURE__*/ F(U, {
1536
- id: "nkpZyk",
1537
- values: { containerName: e }
1538
- }) : t === 1 ? /*#__PURE__*/ F(U, {
1539
- id: "TZJiVf",
1540
- values: {
1541
- containerName: e,
1542
- deletedCount: t
1543
- }
1544
- }) : /*#__PURE__*/ F(U, {
1545
- id: "Sb/VT5",
1546
- values: {
1547
- containerName: e,
1548
- deletedCount: t
1549
- }
1550
- })
1551
- }),
1552
- onDismiss: n.onDismiss
1553
- }), ve = (e, t, n) => ({
1554
- variant: "error",
1555
- children: /*#__PURE__*/ F(Z, {
1556
- title: /*#__PURE__*/ F(U, { id: "S8/j2h" }),
1557
- description: /*#__PURE__*/ F(U, {
1558
- id: "1rLu3+",
1559
- values: {
1560
- containerName: e,
1561
- errorMessage: t
1562
- }
1563
- })
1564
- }),
1565
- onDismiss: n.onDismiss
1566
- }), ye = (e, t) => ({
1567
- variant: "success",
1568
- children: /*#__PURE__*/ F(Z, {
1569
- title: /*#__PURE__*/ F(U, { id: "odVI9Y" }),
1570
- description: /*#__PURE__*/ F(U, {
1571
- id: "V1TzeS",
1572
- values: { containerName: e }
1573
- })
1574
- }),
1575
- onDismiss: t.onDismiss
1576
- }), be = (e, t, n) => ({
1577
- variant: "error",
1578
- children: /*#__PURE__*/ F(Z, {
1579
- title: /*#__PURE__*/ F(U, { id: "BJt+PJ" }),
1580
- description: /*#__PURE__*/ F(U, {
1581
- id: "RGrgxg",
1582
- values: {
1583
- containerName: e,
1584
- errorMessage: t
1585
- }
1586
- })
1587
- }),
1588
- onDismiss: n.onDismiss
1589
- }), xe = (e, t) => ({
1590
- variant: "success",
1591
- children: /*#__PURE__*/ F(Z, {
1592
- title: /*#__PURE__*/ F(U, { id: "a7C4YS" }),
1593
- description: /*#__PURE__*/ F(U, {
1594
- id: "/NeNjH",
1595
- values: { containerName: e }
1596
- })
1597
- }),
1598
- onDismiss: t.onDismiss
1599
- }), Se = (e, t, n) => ({
1600
- variant: "error",
1601
- children: /*#__PURE__*/ F(Z, {
1602
- title: /*#__PURE__*/ F(U, { id: "5MF8U2" }),
1603
- description: /*#__PURE__*/ F(U, {
1604
- id: "uLtFAr",
1605
- values: {
1606
- containerName: e,
1607
- errorMessage: t
1608
- }
1609
- })
1610
- }),
1611
- onDismiss: n.onDismiss
1612
- }), Ce = (e, t) => ({
1613
- variant: "success",
1614
- children: /*#__PURE__*/ F(Z, {
1615
- title: /*#__PURE__*/ F(U, { id: "olfSYj" }),
1616
- description: /*#__PURE__*/ F(U, {
1617
- id: "tM5SEI",
1618
- values: { containerName: e }
1619
- })
1620
- }),
1621
- onDismiss: t.onDismiss
1622
- }), we = (e, t, n) => ({
1623
- variant: "error",
1624
- children: /*#__PURE__*/ F(Z, {
1625
- title: /*#__PURE__*/ F(U, { id: "p7DzCB" }),
1626
- description: /*#__PURE__*/ F(U, {
1627
- id: "DcMIiu",
1628
- values: {
1629
- containerName: e,
1630
- errorMessage: t
1631
- }
1632
- })
1633
- }),
1634
- onDismiss: n.onDismiss
1635
- }), Te = (e, t, n, r) => {
1636
- let i = n.length > 0, a = e > 0, o = i && a;
1637
- return {
1638
- variant: o ? "warning" : i ? "error" : "success",
1639
- children: /*#__PURE__*/ F(Z, {
1640
- title: o ? /*#__PURE__*/ F(U, { id: "q44uUq" }) : i ? /*#__PURE__*/ F(U, { id: "wFaT8w" }) : /*#__PURE__*/ F(U, { id: "0WsqO0" }),
1641
- description: /*#__PURE__*/ I(f, {
1642
- direction: "vertical",
1643
- gap: "1",
1644
- children: [a && /*#__PURE__*/ F("span", { children: /*#__PURE__*/ F(U, {
1645
- id: "1NS3nd",
1646
- values: {
1647
- emptiedCount: e,
1648
- totalDeleted: t
1649
- }
1650
- }) }), i && /*#__PURE__*/ F("span", {
1651
- className: "whitespace-pre-line",
1652
- children: /*#__PURE__*/ F(U, {
1653
- id: "JrmKyf",
1654
- values: { errorDetails: n.join("\n") }
1655
- })
1656
- })]
1657
- })
1658
- }),
1659
- onDismiss: r.onDismiss
1660
- };
1661
- }, $ = ({ label: e, value: t }) => t == null ? null : /*#__PURE__*/ I("span", {
1662
- className: "flex items-start gap-1.5",
1663
- children: [/*#__PURE__*/ F(m, {
1664
- icon: "check",
1665
- size: "16px",
1666
- className: "text-theme-success mt-0.5 shrink-0"
1667
- }), /*#__PURE__*/ I("span", { children: [
1668
- /*#__PURE__*/ I("span", {
1669
- className: "font-medium",
1670
- children: [e, ":"]
1671
- }),
1672
- " ",
1673
- t
1674
- ] })]
1675
- }), Ee = ({ label: e }) => /*#__PURE__*/ I("span", {
1676
- className: "flex items-start gap-1.5",
1677
- children: [/*#__PURE__*/ F(m, {
1678
- icon: "check",
1679
- size: "16px",
1680
- className: "text-theme-success mt-0.5 shrink-0"
1681
- }), /*#__PURE__*/ F("span", { children: e })]
1682
- }), De = ({ title: e, children: t }) => /*#__PURE__*/ I("span", {
1683
- className: "flex flex-col gap-1.5",
1684
- children: [/*#__PURE__*/ F("span", {
1685
- className: "text-theme-default block font-semibold",
1686
- children: e
1687
- }), t]
1688
- }), Oe = ({ serviceInfo: e, accountInfo: r, open: i }) => {
1689
- let { i18n: a, _: o } = W(), s = e?.swift, c = {
1690
- account_quotas: a._({ id: "DJT9tB" }),
1691
- container_quotas: a._({ id: "USiuNX" }),
1692
- bulk_delete: a._({ id: "F6YIQe" }),
1693
- bulk_upload: a._({ id: "2Inn83" }),
1694
- slo: a._({ id: "cpw++p" }),
1695
- container_sync: a._({ id: "ezT9KW" }),
1696
- tempurl: a._({ id: "UO3hJ2" }),
1697
- symlink: a._({ id: "Q2xmVl" }),
1698
- versioned_writes: a._({ id: "8jLXs3" })
1699
- }, l = Object.entries(c).filter(([e]) => s?.[e]).map(([, e]) => e);
1700
- return /*#__PURE__*/ I(t, {
1701
- triggerEvent: "hover",
1702
- placement: "bottom-end",
1703
- open: i,
1704
- children: [/*#__PURE__*/ F(w, {
1705
- asChild: !0,
1706
- children: /*#__PURE__*/ F(m, {
1707
- icon: "info",
1708
- size: "20px",
1709
- className: "text-theme-light hover:text-theme-default cursor-pointer"
1710
- })
1711
- }), /*#__PURE__*/ F(n, {
1712
- className: "z-10 w-72 text-sm",
1713
- children: /*#__PURE__*/ I("span", {
1714
- className: "flex flex-col gap-3 p-1",
1715
- children: [
1716
- r && /*#__PURE__*/ I(De, {
1717
- title: /*#__PURE__*/ F(U, { id: "AeXO77" }),
1718
- children: [
1719
- /*#__PURE__*/ F($, {
1720
- label: a._({ id: "ClGcRq" }),
1721
- value: r.containerCount.toLocaleString()
1722
- }),
1723
- /*#__PURE__*/ F($, {
1724
- label: a._({ id: "B3toQF" }),
1725
- value: r.objectCount.toLocaleString()
1726
- }),
1727
- /*#__PURE__*/ F($, {
1728
- label: a._({ id: "aL1w5Z" }),
1729
- value: M(r.bytesUsed)
1730
- }),
1731
- r.quotaBytes !== void 0 && /*#__PURE__*/ F($, {
1732
- label: a._({ id: "vEkTR9" }),
1733
- value: M(r.quotaBytes)
1734
- })
1735
- ]
1736
- }),
1737
- s && /*#__PURE__*/ I(De, {
1738
- title: /*#__PURE__*/ F(U, { id: "6BDqha" }),
1739
- children: [
1740
- /*#__PURE__*/ F($, {
1741
- label: a._({ id: "wTg+FY" }),
1742
- value: s.max_file_size === void 0 ? void 0 : M(s.max_file_size)
1743
- }),
1744
- /*#__PURE__*/ F($, {
1745
- label: a._({ id: "Rih53k" }),
1746
- value: s.max_container_name_length
1747
- }),
1748
- /*#__PURE__*/ F($, {
1749
- label: a._({ id: "qAkkjP" }),
1750
- value: s.max_object_name_length
1751
- }),
1752
- /*#__PURE__*/ F($, {
1753
- label: a._({ id: "OZImTR" }),
1754
- value: s.container_listing_limit?.toLocaleString()
1755
- }),
1756
- /*#__PURE__*/ F($, {
1757
- label: a._({ id: "a4A2uB" }),
1758
- value: s.account_listing_limit?.toLocaleString()
1759
- }),
1760
- /*#__PURE__*/ F($, {
1761
- label: a._({ id: "zWb/Nn" }),
1762
- value: s.max_header_size
1763
- }),
1764
- /*#__PURE__*/ F($, {
1765
- label: a._({ id: "RGwfoL" }),
1766
- value: s.max_meta_count
1767
- }),
1768
- /*#__PURE__*/ F($, {
1769
- label: a._({ id: "8c3/77" }),
1770
- value: s.max_meta_name_length
1771
- }),
1772
- /*#__PURE__*/ F($, {
1773
- label: a._({ id: "5JDSvn" }),
1774
- value: s.max_meta_value_length
1775
- }),
1776
- /*#__PURE__*/ F($, {
1777
- label: a._({ id: "ZAx+d1" }),
1778
- value: s.max_meta_overall_size
1779
- }),
1780
- s.bulk_delete && /*#__PURE__*/ F($, {
1781
- label: a._({ id: "lQ3EIe" }),
1782
- value: s.bulk_delete.max_deletes_per_request.toLocaleString()
1783
- }),
1784
- s.bulk_upload && /*#__PURE__*/ F($, {
1785
- label: a._({ id: "STc+7E" }),
1786
- value: s.bulk_upload.max_containers_per_extraction.toLocaleString()
1787
- }),
1788
- s.slo && /*#__PURE__*/ F($, {
1789
- label: a._({ id: "RNBvdl" }),
1790
- value: s.slo.max_manifest_segments.toLocaleString()
1791
- })
1792
- ]
1793
- }),
1794
- l.length > 0 && /*#__PURE__*/ F(De, {
1795
- title: /*#__PURE__*/ F(U, { id: "Qx7DM7" }),
1796
- children: l.map((e) => /*#__PURE__*/ F(Ee, { label: e }, e))
1797
- })
1798
- ]
1799
- })
1800
- })]
1801
- });
1802
- }, ke = 20, Ae = ({ isOpen: e, containers: t, onClose: n, onComplete: r }) => {
1803
- let { i18n: i, _: o } = W(), s = N(), [c, l] = V(null), u = O.useUtils(), d = O.storage.swift.emptyContainer.useMutation(), p = () => {
1804
- d.reset(), l(null), n();
1805
- }, m = async () => {
1806
- let e = 0, n = 0, i = [], a = t.length;
1807
- for (let r = 0; r < t.length; r++) {
1808
- l({
1809
- current: r + 1,
1810
- total: a
1811
- });
1812
- let o = t[r];
1813
- try {
1814
- let t = await d.mutateAsync({
1815
- project_id: s,
1816
- container: o.name
1817
- });
1818
- n += t, e++;
1819
- } catch (e) {
1820
- let t = e instanceof Error ? e.message : String(e);
1821
- i.push(`${o.name}: ${t}`);
1822
- }
1823
- }
1824
- e > 0 && await u.storage.swift.listContainers.invalidate(), r?.({
1825
- emptiedCount: e,
1826
- totalDeleted: n,
1827
- errors: i
1828
- }), p();
1829
- };
1830
- if (!e || t.length === 0) return null;
1831
- let g = t.length, _ = t.slice(0, ke), v = g - _.length, y = d.isPending || c !== null, b = c?.current, x = c?.total;
1832
- return /*#__PURE__*/ F(h, {
1833
- title: /*#__PURE__*/ F(U, {
1834
- id: "/tejov",
1835
- values: { totalCount: g }
1836
- }),
1837
- open: e,
1838
- onCancel: p,
1839
- confirmButtonLabel: y ? i._({ id: "s4Vnq2" }) : i._({ id: "N2S1rs" }),
1840
- confirmButtonVariant: "primary-danger",
1841
- cancelButtonLabel: i._({ id: "dEgA5A" }),
1842
- onConfirm: m,
1843
- disableConfirmButton: y,
1844
- disableCancelButton: y,
1845
- disableCloseButton: y,
1846
- size: "small",
1847
- children: y ? /*#__PURE__*/ I(f, {
1848
- direction: "vertical",
1849
- distribution: "center",
1850
- alignment: "center",
1851
- gap: "2",
1852
- className: "py-4",
1853
- children: [/*#__PURE__*/ F(a, { variant: "primary" }), c && /*#__PURE__*/ F("p", {
1854
- className: "text-theme-light text-sm",
1855
- children: /*#__PURE__*/ F(U, {
1856
- id: "7NSdfG",
1857
- values: {
1858
- progressCurrent: b,
1859
- progressTotal: x
1860
- }
1861
- })
1862
- })]
1863
- }) : /*#__PURE__*/ I("div", {
1864
- className: "my-6",
1865
- children: [/*#__PURE__*/ I("p", {
1866
- className: "text-theme-default mb-6",
1867
- children: [
1868
- /*#__PURE__*/ F(U, { id: "JuOpPY" }),
1869
- /*#__PURE__*/ F("br", {}),
1870
- /*#__PURE__*/ F(U, {
1871
- id: "sheDTJ",
1872
- components: {
1873
- 0: /*#__PURE__*/ F("strong", {}),
1874
- 1: /*#__PURE__*/ F("strong", {})
1875
- }
1876
- })
1877
- ]
1878
- }), /*#__PURE__*/ I("div", {
1879
- className: "mb-6",
1880
- children: [/*#__PURE__*/ F("h3", {
1881
- className: "jn:text-theme-high mb-3 font-semibold",
1882
- children: /*#__PURE__*/ F(U, {
1883
- id: "VKmlZ+",
1884
- values: { totalCount: g }
1885
- })
1886
- }), /*#__PURE__*/ I("div", {
1887
- className: "jn:bg-theme-background-lvl-1 max-h-48 overflow-y-auto rounded p-4",
1888
- children: [/*#__PURE__*/ F("ul", {
1889
- className: "space-y-1",
1890
- children: _.map((e) => /*#__PURE__*/ F("li", {
1891
- className: "jn:text-theme-default font-mono text-sm",
1892
- children: e.name
1893
- }, e.name))
1894
- }), v > 0 && /*#__PURE__*/ F("p", {
1895
- className: "text-theme-light mt-2 text-xs",
1896
- children: /*#__PURE__*/ F(U, {
1897
- id: "yqPflB",
1898
- values: { hiddenCount: v }
1899
- })
1900
- })]
1901
- })]
1902
- })]
1903
- })
1904
- });
1905
- }, je = () => {
1906
- let { i18n: t, i18n: n, _: i } = W(), o = N(), s = ee({ from: k.fullPath }), { sortBy: c, sortDirection: l, search: u = "" } = k.useSearch(), [m, h] = V(!1), [g, _] = V(!1), [v, x] = V([]), [S, w] = V(null), [D, A] = V(u), R = B(void 0);
1907
- z(() => () => clearTimeout(R.current), []), z(() => {
1908
- A(u);
1909
- }, [u]);
1910
- let H = () => w(null), G = (e) => {
1911
- w(ge(e, { onDismiss: H }));
1912
- }, te = (e, t) => {
1913
- w(_e(e, t, { onDismiss: H }));
1914
- }, ne = (e, t) => {
1915
- w(Q(e, t, { onDismiss: H }));
1916
- }, K = (e, t) => {
1917
- w(ve(e, t, { onDismiss: H }));
1918
- }, re = (e) => {
1919
- w(ye(e, { onDismiss: H }));
1920
- }, q = (e, t) => {
1921
- w(be(e, t, { onDismiss: H }));
1922
- }, ie = (e) => {
1923
- w(xe(e, { onDismiss: H }));
1924
- }, ae = (e, t) => {
1925
- w(Se(e, t, { onDismiss: H }));
1926
- }, oe = (e) => {
1927
- w(Ce(e, { onDismiss: H }));
1928
- }, se = (e, t) => {
1929
- w(we(e, t, { onDismiss: H }));
1930
- }, ce = ({ emptiedCount: e, totalDeleted: t, errors: n }) => {
1931
- if (n.length === 0) x([]);
1932
- else {
1933
- let e = new Set(n.map((e) => e.split(": ")[0]));
1934
- x((t) => t.filter((t) => e.has(t)));
1935
- }
1936
- w(Te(e, t, n, { onDismiss: H }));
1937
- }, J = {
1938
- options: [
1939
- {
1940
- label: t._({ id: "6YtxFj" }),
1941
- value: "name"
1942
- },
1943
- {
1944
- label: t._({ id: "sxbP3b" }),
1945
- value: "count"
1946
- },
1947
- {
1948
- label: t._({ id: "hgpMHD" }),
1949
- value: "bytes"
1950
- },
1951
- {
1952
- label: t._({ id: "sjMCOP" }),
1953
- value: "last_modified"
1954
- }
1955
- ],
1956
- sortBy: c ?? "name",
1957
- sortDirection: l ?? "asc"
1958
- }, { data: Y, isLoading: le, error: ue } = O.storage.swift.listContainers.useQuery({
1959
- project_id: o,
1960
- format: "json"
1961
- }), { data: de } = O.storage.swift.getAccountMetadata.useQuery({ project_id: o }), { data: X } = O.storage.swift.getServiceInfo.useQuery(), fe = (e) => [...e].sort((e, t) => {
1962
- let n;
1963
- switch (c ?? "name") {
1964
- case "name":
1965
- n = e.name.localeCompare(t.name);
1966
- break;
1967
- case "count":
1968
- n = e.count - t.count;
1969
- break;
1970
- case "bytes":
1971
- n = e.bytes - t.bytes;
1972
- break;
1973
- case "last_modified":
1974
- if (!e.last_modified || !t.last_modified) return e.last_modified ? -1 : 1;
1975
- n = new Date(e.last_modified).getTime() - new Date(t.last_modified).getTime();
1976
- break;
1977
- default: n = e.name.localeCompare(t.name);
1978
- }
1979
- return (l ?? "asc") === "desc" ? -n : n;
1980
- }), pe = (Y || []).filter((e) => e.name.toLowerCase().includes(u.toLowerCase())), me = fe(pe), Z = (e) => {
1981
- let t = typeof e == "string" ? e : "";
1982
- L(() => {
1983
- s({ search: (e) => ({
1984
- ...e,
1985
- search: t || void 0
1986
- }) });
1987
- });
1988
- }, $ = (e) => {
1989
- let t = e.sortBy?.toString() || "name", n = e.sortDirection || "asc";
1990
- L(() => {
1991
- s({ search: (e) => ({
1992
- ...e,
1993
- sortBy: t,
1994
- sortDirection: n
1995
- }) });
1996
- });
1997
- };
1998
- if (le) return /*#__PURE__*/ I(f, {
1999
- className: "absolute inset-0",
2000
- distribution: "center",
2001
- alignment: "center",
2002
- direction: "vertical",
2003
- children: [/*#__PURE__*/ F(a, {
2004
- variant: "primary",
2005
- size: "large",
2006
- className: "mb-2"
2007
- }), /*#__PURE__*/ F(U, { id: "WYiUDa" })]
2008
- });
2009
- if (ue) {
2010
- let e = ue.message;
2011
- return /*#__PURE__*/ F(f, {
2012
- className: "absolute inset-0",
2013
- distribution: "center",
2014
- alignment: "center",
2015
- direction: "vertical",
2016
- children: /*#__PURE__*/ F(U, {
2017
- id: "dLFiER",
2018
- values: { errorMessage: e }
2019
- })
2020
- });
2021
- }
2022
- let Ee = de?.bytesUsed || 0, De = de?.quotaBytes || 0, ke = De > 0 ? De - Ee : 0, je = (Y || []).filter((e) => v.includes(e.name)), Me = je.length > 0, Ne = je.length, Pe = (Y || []).length, Fe = pe.length, Ie = Fe !== Pe, Le = me.map((e) => e.name), Re = Le.length > 0 && Le.every((e) => v.includes(e)), ze = Le.some((e) => v.includes(e));
2023
- return /*#__PURE__*/ I("div", {
2024
- className: "relative",
2025
- children: [
2026
- /*#__PURE__*/ I(f, {
2027
- direction: "vertical",
2028
- children: [
2029
- /*#__PURE__*/ I(f, {
2030
- distribution: "end",
2031
- alignment: "center",
2032
- gap: "2",
2033
- className: "pb-2",
2034
- children: [/*#__PURE__*/ F(f, {
2035
- gap: "0.5",
2036
- alignment: "center",
2037
- children: /*#__PURE__*/ F(j, {
2038
- options: J.options,
2039
- sortBy: J.sortBy,
2040
- sortDirection: J.sortDirection ?? "asc",
2041
- onSortByChange: (e) => $({
2042
- ...J,
2043
- sortBy: e,
2044
- sortDirection: J.sortDirection
2045
- }),
2046
- onSortDirectionChange: (e) => $({
2047
- ...J,
2048
- sortDirection: e
2049
- })
2050
- })
2051
- }), /*#__PURE__*/ F(p, {
2052
- variant: "primary",
2053
- className: "whitespace-nowrap",
2054
- onClick: () => h(!0),
2055
- children: /*#__PURE__*/ F(U, { id: "vTh35P" })
2056
- })]
2057
- }),
2058
- /*#__PURE__*/ F(E, { children: /*#__PURE__*/ F(f, {
2059
- direction: "vertical",
2060
- gap: "2",
2061
- children: /*#__PURE__*/ F(f, {
2062
- distribution: "end",
2063
- alignment: "center",
2064
- children: /*#__PURE__*/ F(d, {
2065
- placeholder: t._({ id: "TipzDp" }),
2066
- "data-testid": "searchbar",
2067
- value: D,
2068
- onInput: (e) => {
2069
- let t = e.currentTarget.value;
2070
- A(t), clearTimeout(R.current), R.current = window.setTimeout(() => Z(t), 500);
2071
- },
2072
- onSearch: (e) => {
2073
- clearTimeout(R.current), Z(typeof e == "string" ? e : "");
2074
- },
2075
- onClear: () => {
2076
- clearTimeout(R.current), A(""), Z("");
2077
- }
2078
- })
2079
- })
2080
- }) }),
2081
- /*#__PURE__*/ F(E, { children: /*#__PURE__*/ I(f, {
2082
- distribution: "start",
2083
- gap: "2",
2084
- alignment: "center",
2085
- className: "text-sm",
2086
- children: [/*#__PURE__*/ I(f, {
2087
- gap: "2",
2088
- alignment: "center",
2089
- children: [/*#__PURE__*/ F(y, {
2090
- checked: Re,
2091
- indeterminate: ze && !Re,
2092
- onChange: () => {
2093
- x(Re ? (e) => e.filter((e) => !Le.includes(e)) : (e) => [...new Set([...e, ...Le])]);
2094
- }
2095
- }), /*#__PURE__*/ I(r, {
2096
- className: "flex items-center",
2097
- children: [/*#__PURE__*/ F(C, {
2098
- as: "div",
2099
- children: /*#__PURE__*/ F(p, {
2100
- disabled: !Me,
2101
- size: "small",
2102
- icon: "moreVert",
2103
- label: t._({ id: "7L01XJ" })
2104
- })
2105
- }), Me && /*#__PURE__*/ F(T, { children: /*#__PURE__*/ F(b, {
2106
- disabled: !Me,
2107
- label: n._(t._({
2108
- id: "dBrBc5",
2109
- values: { selectedCount: Ne }
2110
- })),
2111
- onClick: () => _(!0)
2112
- }) })]
2113
- })]
2114
- }), /*#__PURE__*/ I("div", {
2115
- className: "text-theme-light flex items-center gap-1",
2116
- "data-testid": "containers-info-block",
2117
- children: [
2118
- Ie ? /*#__PURE__*/ F(U, {
2119
- id: "8uPTwT",
2120
- values: {
2121
- filteredCount: Fe,
2122
- totalCount: Pe
2123
- }
2124
- }) : /*#__PURE__*/ F(U, {
2125
- id: "ywe1H/",
2126
- values: { totalCount: Pe }
2127
- }),
2128
- De > 0 && /*#__PURE__*/ I(P, { children: [/*#__PURE__*/ F("span", { children: "," }), /*#__PURE__*/ I("span", { children: [
2129
- /*#__PURE__*/ F(U, { id: "kKK8AH" }),
2130
- " ",
2131
- /*#__PURE__*/ F("span", {
2132
- className: "text-theme-default font-semibold",
2133
- children: M(ke)
2134
- })
2135
- ] })] }),
2136
- /*#__PURE__*/ F(Oe, {
2137
- serviceInfo: X,
2138
- accountInfo: de
2139
- })
2140
- ]
2141
- })]
2142
- }) })
2143
- ]
2144
- }),
2145
- /*#__PURE__*/ F(he, {
2146
- containers: me,
2147
- createModalOpen: m,
2148
- setCreateModalOpen: h,
2149
- maxContainerNameLength: X?.swift?.max_container_name_length,
2150
- onCreateSuccess: G,
2151
- onCreateError: te,
2152
- onEmptySuccess: ne,
2153
- onEmptyError: K,
2154
- onDeleteSuccess: re,
2155
- onDeleteError: q,
2156
- onPropertiesSuccess: ie,
2157
- onPropertiesError: ae,
2158
- onAclSuccess: oe,
2159
- onAclError: se,
2160
- selectedContainers: v,
2161
- setSelectedContainers: x,
2162
- hasAnyBulkAction: !0
2163
- }),
2164
- /*#__PURE__*/ F(Ae, {
2165
- isOpen: g,
2166
- containers: je,
2167
- onClose: () => _(!1),
2168
- onComplete: ce
2169
- }),
2170
- S && /*#__PURE__*/ F(e, {
2171
- ...S,
2172
- className: "border-theme-light fixed top-5 right-5 z-50 rounded-lg border shadow-lg"
2173
- })
2174
- ]
2175
- });
2176
- }, Me = /^[a-z0-9][a-z0-9.-]*[a-z0-9]$/, Ne = /^(\d{1,3}\.){3}\d{1,3}$/, Pe = [
2177
- "xn--",
2178
- "sthree-",
2179
- "amzn-s3-demo-"
2180
- ], Fe = [
2181
- "-s3alias",
2182
- "--ol-s3",
2183
- ".mrap",
2184
- "--x-s3",
2185
- "--table-s3"
2186
- ], Ie = ({ isOpen: e, onClose: t, onSuccess: n, onError: r }) => {
2187
- let { i18n: i, _: a } = W(), o = N(), [s, c] = V(""), [l, u] = V(null), [d, p] = V(!1), m = O.useUtils(), g = O.storage.ceph.containers.create.useMutation({
2188
- onSuccess: () => {
2189
- m.storage.ceph.containers.list.invalidate();
2190
- let e = s.trim();
2191
- n?.(e);
2192
- },
2193
- onError: (e) => {
2194
- r?.(s.trim(), e.message);
2195
- },
2196
- onSettled: () => {
2197
- _();
2198
- }
2199
- }), _ = () => {
2200
- c(""), u(null), p(!1), g.reset(), t();
2201
- }, v = (e) => {
2202
- let t = e.trim();
2203
- if (!t) return u(i._({ id: "48bMai" })), !1;
2204
- if (t.length < 3) return u(i._({ id: "gjop1H" })), !1;
2205
- if (t.length > 63) return u(i._({ id: "is0Bhk" })), !1;
2206
- if (!Me.test(t)) return u(i._({ id: "IQldU4" })), !1;
2207
- if (!/^[a-z0-9]/.test(t) || !/[a-z0-9]$/.test(t)) return u(i._({ id: "VG2a+x" })), !1;
2208
- if (t.includes("..")) return u(i._({ id: "V8/eES" })), !1;
2209
- if (Ne.test(t)) return u(i._({ id: "W8Rb/w" })), !1;
2210
- for (let e of Pe) if (t.startsWith(e)) return u(i._({
2211
- id: "B2SpR8",
2212
- values: { prefix: e }
2213
- })), !1;
2214
- for (let e of Fe) if (t.endsWith(e)) return u(i._({
2215
- id: "QRlXaL",
2216
- values: { suffix: e }
2217
- })), !1;
2218
- return u(null), !0;
2219
- }, b = (e) => {
2220
- let t = e.target.value;
2221
- c(t), l && v(t);
2222
- }, x = () => {
2223
- v(s) && g.mutate({
2224
- project_id: o,
2225
- bucketName: s.trim(),
2226
- enableVersioning: d
2227
- });
2228
- };
2229
- return e ? /*#__PURE__*/ F(h, {
2230
- title: i._({ id: "HiDAFk" }),
2231
- open: e,
2232
- onCancel: _,
2233
- confirmButtonLabel: i._({ id: "hYgDIe" }),
2234
- onConfirm: x,
2235
- cancelButtonLabel: i._({ id: "dEgA5A" }),
2236
- size: "small",
2237
- disableConfirmButton: g.isPending || !s.trim(),
2238
- children: /*#__PURE__*/ I(f, {
2239
- direction: "vertical",
2240
- gap: "6",
2241
- children: [
2242
- /*#__PURE__*/ F("p", {
2243
- className: "text-theme-default",
2244
- children: /*#__PURE__*/ F(U, { id: "ASJMIw" })
2245
- }),
2246
- /*#__PURE__*/ F(S, {
2247
- label: i._({ id: "NNpgo3" }),
2248
- required: !0,
2249
- value: s,
2250
- onChange: b,
2251
- onKeyDown: (e) => {
2252
- e.key === "Enter" && x();
2253
- },
2254
- invalid: !!l,
2255
- errortext: l || void 0,
2256
- disabled: g.isPending,
2257
- autoFocus: !0,
2258
- placeholder: i._({ id: "yDHGP+" })
2259
- }),
2260
- /*#__PURE__*/ F(y, {
2261
- label: i._({ id: "ifQSTI" }),
2262
- helptext: i._({ id: "WM+Nm7" }),
2263
- checked: d,
2264
- onChange: (e) => p(e.target.checked),
2265
- disabled: g.isPending
2266
- })
2267
- ]
2268
- })
2269
- }) : null;
2270
- }, Le = ({ isOpen: e, bucket: t, onClose: n, onSuccess: r, onError: i }) => {
2271
- let { i18n: a, _: o } = W(), s = N(), [c, l] = V(""), [u, d] = V(null), [m, g] = V(!1), _ = O.useUtils(), y = () => {
2272
- t && navigator.clipboard.writeText(t.name).then(() => {
2273
- g(!0), setTimeout(() => g(!1), 2e3);
2274
- });
2275
- }, b = O.storage.ceph.objects.deleteAll.useMutation({ onSettled: () => {
2276
- _.storage.ceph.containers.list.invalidate(), C();
2277
- } }), C = () => {
2278
- l(""), d(null), g(!1), b.reset(), n();
2279
- }, w = (e) => {
2280
- let t = e.target.value;
2281
- l(t), u && d(null);
2282
- }, T = () => {
2283
- if (!t) return;
2284
- if (c.trim() !== t.name) {
2285
- d(a._({ id: "wxVsr5" }));
2286
- return;
2287
- }
2288
- let e = t.name;
2289
- b.mutate({
2290
- project_id: s,
2291
- containerName: e
2292
- }, {
2293
- onSuccess: (t) => {
2294
- r?.(e, t);
2295
- },
2296
- onError: (t) => {
2297
- i?.(e, t.message);
2298
- }
2299
- });
2300
- }, E = (e) => {
2301
- e.key === "Enter" && T();
2302
- };
2303
- if (!e || !t) return null;
2304
- let D = t.count === 0, k = t.count, A = t.name;
2305
- return /*#__PURE__*/ F(h, {
2306
- title: a._({ id: "CfKRC1" }),
2307
- open: e,
2308
- onCancel: C,
2309
- confirmButtonLabel: D ? void 0 : a._({ id: "N2S1rs" }),
2310
- confirmButtonVariant: "primary-danger",
2311
- onConfirm: D ? void 0 : T,
2312
- cancelButtonLabel: D ? void 0 : a._({ id: "dEgA5A" }),
2313
- modalFooter: D ? /*#__PURE__*/ F(v, {
2314
- className: "flex justify-end",
2315
- children: /*#__PURE__*/ F(x, { children: /*#__PURE__*/ F(p, {
2316
- variant: "primary",
2317
- onClick: C,
2318
- "data-testid": "empty-info-close-button",
2319
- children: /*#__PURE__*/ F(U, { id: "yz7wBu" })
2320
- }) })
2321
- }) : void 0,
2322
- size: "small",
2323
- disableConfirmButton: b.isPending || !D && c.trim() !== t.name,
2324
- children: D ? /*#__PURE__*/ F("p", {
2325
- className: "text-theme-default py-2",
2326
- children: /*#__PURE__*/ F(U, { id: "tL9it8" })
2327
- }) : /*#__PURE__*/ I(f, {
2328
- direction: "vertical",
2329
- gap: "6",
2330
- children: [
2331
- /*#__PURE__*/ F("p", {
2332
- className: "text-theme-default",
2333
- children: /*#__PURE__*/ F(U, {
2334
- id: "8HrqL8",
2335
- values: {
2336
- bucketCount: k,
2337
- bucketName: A
2338
- },
2339
- components: { 0: /*#__PURE__*/ F("strong", {}) }
2340
- })
2341
- }),
2342
- /*#__PURE__*/ I(f, {
2343
- direction: "vertical",
2344
- gap: "2",
2345
- children: [/*#__PURE__*/ I("div", {
2346
- className: "flex items-center justify-between",
2347
- children: [/*#__PURE__*/ F("span", {
2348
- className: "text-theme-light text-sm",
2349
- children: /*#__PURE__*/ F(U, { id: "FrLdVI" })
2350
- }), /*#__PURE__*/ F(p, {
2351
- size: "small",
2352
- variant: "subdued",
2353
- onClick: y,
2354
- icon: m ? "check" : "contentCopy",
2355
- label: m ? a._({ id: "6V3Ea3" }) : a._({ id: "he3ygx" })
2356
- })]
2357
- }), /*#__PURE__*/ F("div", {
2358
- className: "bg-theme-background-lvl-1 rounded p-2 text-sm",
2359
- children: t.name
2360
- })]
2361
- }),
2362
- /*#__PURE__*/ F(S, {
2363
- label: a._({ id: "dEHa3L" }),
2364
- required: !0,
2365
- value: c,
2366
- onChange: w,
2367
- onKeyDown: E,
2368
- invalid: !!u,
2369
- errortext: u || void 0,
2370
- disabled: b.isPending,
2371
- placeholder: t.name,
2372
- autoFocus: !0
2373
- })
2374
- ]
2375
- })
2376
- });
2377
- }, Re = ({ isOpen: e, bucket: t, onClose: n, onSuccess: r, onError: i }) => {
2378
- let { i18n: o, _: s } = W(), c = N(), [l, u] = V(""), [d, m] = V(null), [g, _] = V(!1), y = () => {
2379
- t && navigator.clipboard.writeText(t.name).then(() => {
2380
- _(!0), setTimeout(() => _(!1), 2e3);
2381
- });
2382
- }, b = O.useUtils(), { data: C, isLoading: w, error: T } = O.storage.ceph.objects.list.useQuery({
2383
- project_id: c ?? "",
2384
- containerName: t?.name ?? "",
2385
- maxKeys: 1
2386
- }, { enabled: e && t !== null }), E = O.storage.ceph.containers.delete.useMutation({ onSettled: () => {
2387
- b.storage.ceph.containers.list.invalidate(), D();
2388
- } });
2389
- z(() => {
2390
- e || (u(""), m(null), E.reset());
2391
- }, [e, t?.name]);
2392
- let D = () => {
2393
- u(""), m(null), E.reset(), n();
2394
- }, k = (e) => {
2395
- let t = e.target.value;
2396
- u(t), d && m(null);
2397
- }, A = () => {
2398
- if (!t || T) return;
2399
- if (l.trim() !== t.name) {
2400
- m(o._({ id: "wxVsr5" }));
2401
- return;
2402
- }
2403
- let e = t.name;
2404
- E.mutate({
2405
- project_id: c,
2406
- bucketName: e
2407
- }, {
2408
- onSuccess: () => {
2409
- r?.(e);
2410
- },
2411
- onError: (t) => {
2412
- i?.(e, t.message);
2413
- }
2414
- });
2415
- }, j = (e) => {
2416
- e.key === "Enter" && A();
2417
- };
2418
- if (!e || !t) return null;
2419
- let M = C?.objects?.length ?? 0, L = M > 0, R = T?.message;
2420
- return /*#__PURE__*/ F(h, {
2421
- title: o._({ id: "IwlPLb" }),
2422
- open: e,
2423
- onCancel: D,
2424
- confirmButtonLabel: L ? void 0 : o._({ id: "IwlPLb" }),
2425
- confirmButtonVariant: L ? void 0 : "primary-danger",
2426
- onConfirm: L ? void 0 : A,
2427
- cancelButtonLabel: L ? void 0 : o._({ id: "dEgA5A" }),
2428
- modalFooter: L ? /*#__PURE__*/ F(v, {
2429
- className: "flex justify-end",
2430
- children: /*#__PURE__*/ F(x, { children: /*#__PURE__*/ F(p, {
2431
- variant: "primary",
2432
- onClick: D,
2433
- "data-testid": "delete-has-objects-close-button",
2434
- children: /*#__PURE__*/ F(U, { id: "yz7wBu" })
2435
- }) })
2436
- }) : void 0,
2437
- size: "small",
2438
- disableConfirmButton: E.isPending || w || !!T || l.trim() !== t.name,
2439
- children: /*#__PURE__*/ I(f, {
2440
- direction: "vertical",
2441
- gap: "6",
2442
- children: [T && /*#__PURE__*/ F("p", {
2443
- className: "text-theme-error",
2444
- role: "alert",
2445
- "aria-live": "assertive",
2446
- children: /*#__PURE__*/ F(U, {
2447
- id: "MJLqeY",
2448
- values: { errorMessage: R }
2449
- })
2450
- }), w ? /*#__PURE__*/ I(f, {
2451
- direction: "horizontal",
2452
- gap: "2",
2453
- alignment: "center",
2454
- children: [/*#__PURE__*/ F(a, {}), /*#__PURE__*/ F("span", {
2455
- className: "text-juno-grey-light-1 text-sm",
2456
- children: /*#__PURE__*/ F(U, { id: "rPuPb+" })
2457
- })]
2458
- }) : L ? /*#__PURE__*/ F("p", {
2459
- className: "text-theme-default",
2460
- children: /*#__PURE__*/ F(U, {
2461
- id: "50Piuj",
2462
- values: { actualObjectCount: M }
2463
- })
2464
- }) : /*#__PURE__*/ I(P, { children: [
2465
- /*#__PURE__*/ F("p", {
2466
- className: "text-theme-default",
2467
- children: /*#__PURE__*/ F(U, { id: "/pOQrn" })
2468
- }),
2469
- /*#__PURE__*/ I(f, {
2470
- direction: "vertical",
2471
- gap: "2",
2472
- children: [/*#__PURE__*/ I("div", {
2473
- className: "flex items-center justify-between",
2474
- children: [/*#__PURE__*/ F("span", {
2475
- className: "text-theme-light text-sm",
2476
- children: /*#__PURE__*/ F(U, { id: "No++00" })
2477
- }), /*#__PURE__*/ F(p, {
2478
- size: "small",
2479
- variant: "subdued",
2480
- onClick: y,
2481
- icon: g ? "check" : "contentCopy",
2482
- label: g ? o._({ id: "6V3Ea3" }) : o._({ id: "he3ygx" })
2483
- })]
2484
- }), /*#__PURE__*/ F("div", {
2485
- className: "bg-theme-background-lvl-1 rounded p-2 text-sm",
2486
- children: t.name
2487
- })]
2488
- }),
2489
- /*#__PURE__*/ F(S, {
2490
- label: o._({ id: "dEHa3L" }),
2491
- required: !0,
2492
- value: l,
2493
- onChange: k,
2494
- onKeyDown: j,
2495
- invalid: !!d,
2496
- errortext: d || void 0,
2497
- disabled: E.isPending,
2498
- placeholder: t.name
2499
- })
2500
- ] })]
2501
- })
2502
- });
2503
- }, ze = ({ buckets: e, createModalOpen: t, setCreateModalOpen: n, onCreateSuccess: a, onCreateError: o, onEmptySuccess: l, onEmptyError: u, onDeleteSuccess: d, onDeleteError: f, selectedBuckets: p, setSelectedBuckets: m, hasAnyBulkAction: h = !0 }) => {
2504
- let { projectId: g, provider: v, storageType: x } = H({ strict: !1 }), { i18n: S, _: C } = W(), w = ee(), E = B(null), [D, O] = V(0), [k, A] = V(null), [j, N] = V(null);
2505
- z(() => {
2506
- E.current && O(E.current.offsetWidth - E.current.clientWidth);
2507
- }, [e.length]);
2508
- let L = (e) => {
2509
- try {
2510
- return new Date(e).toLocaleString();
2511
- } catch {
2512
- return S._({ id: "fj5byd" });
2513
- }
2514
- }, R = ne({
2515
- count: e.length,
2516
- getScrollElement: () => E.current,
2517
- estimateSize: () => 48,
2518
- overscan: 10
2519
- }), G = new Set(p), te = e.length > 0 && e.every((e) => G.has(e.name)), K = () => {
2520
- let t = e.map((e) => e.name);
2521
- m(te ? p.filter((e) => !t.includes(e)) : [...new Set([...p, ...t])]);
2522
- }, re = (e) => {
2523
- p.includes(e) ? m(p.filter((t) => t !== e)) : m([...p, e]);
2524
- };
2525
- if (!e || e.length === 0) return /*#__PURE__*/ F(_, {
2526
- columns: 4,
2527
- className: "buckets",
2528
- "data-testid": "no-buckets",
2529
- children: /*#__PURE__*/ F(c, { children: /*#__PURE__*/ F(i, {
2530
- colSpan: 4,
2531
- children: /*#__PURE__*/ I("div", {
2532
- className: "py-8 text-center",
2533
- children: [/*#__PURE__*/ F("h3", {
2534
- className: "text-lg font-semibold",
2535
- children: /*#__PURE__*/ F(U, { id: "ih2lfP" })
2536
- }), /*#__PURE__*/ F("p", {
2537
- className: "text-theme-light mt-2",
2538
- children: /*#__PURE__*/ F(U, { id: "emkxJa" })
2539
- })]
2540
- })
2541
- }) })
2542
- });
2543
- let q = h ? 6 : 5, ie = h ? "40px minmax(200px, 2fr) minmax(100px, 1fr) minmax(180px, 2fr) minmax(100px, 1fr) 60px" : "minmax(200px, 2fr) minmax(100px, 1fr) minmax(180px, 2fr) minmax(100px, 1fr) 60px";
2544
- return /*#__PURE__*/ I(P, { children: [
2545
- /*#__PURE__*/ I("div", {
2546
- className: "relative",
2547
- children: [/*#__PURE__*/ F("div", {
2548
- style: { paddingRight: `${D}px` },
2549
- children: /*#__PURE__*/ F(_, {
2550
- columns: q,
2551
- gridColumnTemplate: ie,
2552
- className: "buckets",
2553
- "data-testid": "buckets-table-header",
2554
- children: /*#__PURE__*/ I(c, { children: [
2555
- h && /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(y, {
2556
- checked: te,
2557
- onChange: K,
2558
- "data-testid": "select-all-buckets"
2559
- }) }),
2560
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "BTsbBe" }) }),
2561
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "sxbP3b" }) }),
2562
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "sjMCOP" }) }),
2563
- /*#__PURE__*/ F(s, { children: /*#__PURE__*/ F(U, { id: "hgpMHD" }) }),
2564
- /*#__PURE__*/ F(s, { style: { marginRight: `-${D}px` } })
2565
- ] })
2566
- })
2567
- }), /*#__PURE__*/ F("div", {
2568
- ref: E,
2569
- className: "overflow-auto",
2570
- style: { height: "calc(100vh - 490px)" },
2571
- "data-testid": "buckets-table-body",
2572
- children: /*#__PURE__*/ F("div", {
2573
- style: {
2574
- height: `${R.getTotalSize()}px`,
2575
- width: "100%",
2576
- position: "relative"
2577
- },
2578
- children: R.getVirtualItems().map((t) => {
2579
- let n = e[t.index], a = p.includes(n.name), o = () => w({
2580
- to: "/projects/$projectId/storage/$provider/$storageType/$containerName/objects",
2581
- params: {
2582
- projectId: g ?? "",
2583
- provider: v ?? "ceph",
2584
- storageType: x ?? "buckets",
2585
- containerName: n.name
2586
- }
2587
- });
2588
- return /*#__PURE__*/ I("div", {
2589
- "data-index": t.index,
2590
- ref: R.measureElement,
2591
- className: "juno-datagrid group hover:bg-theme-background-lvl-1 cursor-pointer",
2592
- style: {
2593
- position: "absolute",
2594
- top: 0,
2595
- left: 0,
2596
- width: "100%",
2597
- transform: `translateY(${t.start}px)`,
2598
- display: "grid",
2599
- gridTemplateColumns: ie,
2600
- alignItems: "stretch"
2601
- },
2602
- "data-testid": `bucket-row-${n.name}`,
2603
- role: "link",
2604
- tabIndex: 0,
2605
- onClick: o,
2606
- onKeyDown: (e) => {
2607
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o());
2608
- },
2609
- children: [
2610
- h && /*#__PURE__*/ F(i, {
2611
- onClick: (e) => e.stopPropagation(),
2612
- onKeyDown: (e) => {
2613
- (e.key === "Enter" || e.key === " ") && e.stopPropagation();
2614
- },
2615
- children: /*#__PURE__*/ F(y, {
2616
- checked: a,
2617
- onChange: () => re(n.name),
2618
- "data-testid": `select-bucket-${n.name}`
2619
- })
2620
- }),
2621
- /*#__PURE__*/ F(i, {
2622
- className: "min-w-0 overflow-hidden",
2623
- children: /*#__PURE__*/ F("span", {
2624
- className: "block truncate",
2625
- title: n.name,
2626
- children: n.name
2627
- })
2628
- }),
2629
- /*#__PURE__*/ F(i, { children: n.count.toLocaleString() }),
2630
- /*#__PURE__*/ F(i, { children: L(n.last_modified || n.creationDate || "") }),
2631
- /*#__PURE__*/ F(i, { children: M(n.bytes) }),
2632
- /*#__PURE__*/ F(i, {
2633
- onClick: (e) => e.stopPropagation(),
2634
- children: /*#__PURE__*/ F(r, { children: /*#__PURE__*/ I(T, { children: [/*#__PURE__*/ F(b, {
2635
- label: S._({ id: "N2S1rs" }),
2636
- onClick: () => A(n),
2637
- "data-testid": `empty-action-${n.name}`
2638
- }), /*#__PURE__*/ F(b, {
2639
- label: S._({ id: "cnGeoo" }),
2640
- onClick: () => N(n),
2641
- "data-testid": `delete-action-${n.name}`
2642
- })] }) })
2643
- })
2644
- ]
2645
- }, n.name);
2646
- })
2647
- })
2648
- })]
2649
- }),
2650
- /*#__PURE__*/ F(Ie, {
2651
- isOpen: t,
2652
- onClose: () => n(!1),
2653
- onSuccess: a,
2654
- onError: o
2655
- }),
2656
- /*#__PURE__*/ F(Le, {
2657
- isOpen: k !== null,
2658
- bucket: k,
2659
- onClose: () => A(null),
2660
- onSuccess: l,
2661
- onError: u
2662
- }),
2663
- /*#__PURE__*/ F(Re, {
2664
- isOpen: j !== null,
2665
- bucket: j,
2666
- onClose: () => N(null),
2667
- onSuccess: d,
2668
- onError: f
2669
- })
2670
- ] });
2671
- };
2672
- //#endregion
2673
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Buckets/BucketToastNotifications.tsx
2674
- function Be({ title: e, description: t }) {
2675
- return /*#__PURE__*/ I(f, {
2676
- direction: "vertical",
2677
- gap: "1.5",
2678
- children: [/*#__PURE__*/ F("span", { children: e }), /*#__PURE__*/ F("span", {
2679
- className: "text-theme-light",
2680
- children: t
2681
- })]
2682
- });
2683
- }
2684
- var Ve = (e, t) => ({
2685
- variant: "success",
2686
- children: /*#__PURE__*/ F(Be, {
2687
- title: /*#__PURE__*/ F(U, { id: "M3bysB" }),
2688
- description: /*#__PURE__*/ F(U, {
2689
- id: "VKCkZH",
2690
- values: { bucketName: e }
2691
- })
2692
- }),
2693
- onDismiss: t.onDismiss
2694
- }), He = (e, t, n) => ({
2695
- variant: "error",
2696
- children: /*#__PURE__*/ F(Be, {
2697
- title: /*#__PURE__*/ F(U, { id: "UaP7Th" }),
2698
- description: /*#__PURE__*/ F(U, {
2699
- id: "boefwq",
2700
- values: {
2701
- bucketName: e,
2702
- errorMessage: t
2703
- }
2704
- })
2705
- }),
2706
- onDismiss: n.onDismiss
2707
- }), Ue = (e, t, n) => ({
2708
- variant: "success",
2709
- children: /*#__PURE__*/ F(Be, {
2710
- title: /*#__PURE__*/ F(U, { id: "b95YH9" }),
2711
- description: t === 0 ? /*#__PURE__*/ F(U, {
2712
- id: "8erw15",
2713
- values: { bucketName: e }
2714
- }) : t === 1 ? /*#__PURE__*/ F(U, {
2715
- id: "QpbWpf",
2716
- values: {
2717
- bucketName: e,
2718
- deletedCount: t
2719
- }
2720
- }) : /*#__PURE__*/ F(U, {
2721
- id: "JPWqr2",
2722
- values: {
2723
- bucketName: e,
2724
- deletedCount: t
2725
- }
2726
- })
2727
- }),
2728
- onDismiss: n.onDismiss
2729
- }), We = (e, t, n) => ({
2730
- variant: "error",
2731
- children: /*#__PURE__*/ F(Be, {
2732
- title: /*#__PURE__*/ F(U, { id: "66YUKF" }),
2733
- description: /*#__PURE__*/ F(U, {
2734
- id: "t7ewhH",
2735
- values: {
2736
- bucketName: e,
2737
- errorMessage: t
2738
- }
2739
- })
2740
- }),
2741
- onDismiss: n.onDismiss
2742
- }), Ge = (e, t) => ({
2743
- variant: "success",
2744
- children: /*#__PURE__*/ F(Be, {
2745
- title: /*#__PURE__*/ F(U, { id: "bHUarC" }),
2746
- description: /*#__PURE__*/ F(U, {
2747
- id: "hQdfmR",
2748
- values: { bucketName: e }
2749
- })
2750
- }),
2751
- onDismiss: t.onDismiss
2752
- }), Ke = (e, t, n) => ({
2753
- variant: "error",
2754
- children: /*#__PURE__*/ F(Be, {
2755
- title: /*#__PURE__*/ F(U, { id: "1NFtQz" }),
2756
- description: /*#__PURE__*/ F(U, {
2757
- id: "CongmL",
2758
- values: {
2759
- bucketName: e,
2760
- errorMessage: t
2761
- }
2762
- })
2763
- }),
2764
- onDismiss: n.onDismiss
2765
- }), qe = (e, t, n, r) => {
2766
- let i = n.length > 0, a = e + n.length, o = n.length;
2767
- return {
2768
- variant: i ? "warning" : "success",
2769
- children: /*#__PURE__*/ F(Be, {
2770
- title: i ? /*#__PURE__*/ F(U, { id: "6fuDFZ" }) : /*#__PURE__*/ F(U, { id: "BOoOLQ" }),
2771
- description: i ? /*#__PURE__*/ F(U, {
2772
- id: "pD/2BQ",
2773
- values: {
2774
- emptiedCount: e,
2775
- totalBuckets: a,
2776
- totalDeleted: t,
2777
- errorsLength: o
2778
- }
2779
- }) : /*#__PURE__*/ F(U, {
2780
- id: "YVLcyI",
2781
- values: {
2782
- emptiedCount: e,
2783
- totalDeleted: t
2784
- }
2785
- })
2786
- }),
2787
- onDismiss: r.onDismiss
2788
- };
2789
- }, Je = 20, Ye = ({ isOpen: e, buckets: t, onClose: n, onComplete: r }) => {
2790
- let { i18n: i, _: s } = W(), c = N(), [l, u] = V(null), [d, p] = V(""), m = O.useUtils(), g = O.storage.ceph.objects.deleteAll.useMutation(), _ = () => {
2791
- g.reset(), u(null), p(""), n();
2792
- }, v = async () => {
2793
- let e = 0, n = 0, i = [], a = t.length;
2794
- for (let r = 0; r < t.length; r++) {
2795
- u({
2796
- current: r + 1,
2797
- total: a
2798
- });
2799
- let o = t[r];
2800
- try {
2801
- let t = await g.mutateAsync({
2802
- project_id: c,
2803
- containerName: o.name
2804
- });
2805
- n += t, e++;
2806
- } catch (e) {
2807
- let t = e instanceof Error ? e.message : String(e);
2808
- i.push(`${o.name}: ${t}`);
2809
- }
2810
- }
2811
- e > 0 && await m.storage.ceph.containers.list.invalidate(), r?.({
2812
- emptiedCount: e,
2813
- totalDeleted: n,
2814
- errors: i
2815
- }), _();
2816
- };
2817
- if (!e || t.length === 0) return null;
2818
- let y = t.length, b = t.slice(0, Je), x = y - b.length, C = g.isPending || l !== null, w = l?.current, T = l?.total, E = d === "empty";
2819
- return /*#__PURE__*/ F(h, {
2820
- title: /*#__PURE__*/ F(U, {
2821
- id: "DWBWmW",
2822
- values: { totalCount: y }
2823
- }),
2824
- open: e,
2825
- onCancel: _,
2826
- confirmButtonLabel: C ? i._({ id: "s4Vnq2" }) : i._({ id: "N2S1rs" }),
2827
- confirmButtonVariant: "primary-danger",
2828
- cancelButtonLabel: i._({ id: "dEgA5A" }),
2829
- onConfirm: v,
2830
- disableConfirmButton: C || !E,
2831
- disableCancelButton: C,
2832
- disableCloseButton: C,
2833
- size: "small",
2834
- children: C ? /*#__PURE__*/ I(f, {
2835
- direction: "vertical",
2836
- distribution: "center",
2837
- alignment: "center",
2838
- gap: "2",
2839
- className: "py-4",
2840
- children: [/*#__PURE__*/ F(a, { variant: "primary" }), l && /*#__PURE__*/ F("p", {
2841
- className: "text-theme-light text-sm",
2842
- children: /*#__PURE__*/ F(U, {
2843
- id: "NW1XEL",
2844
- values: {
2845
- progressCurrent: w,
2846
- progressTotal: T
2847
- }
2848
- })
2849
- })]
2850
- }) : /*#__PURE__*/ I(f, {
2851
- direction: "vertical",
2852
- gap: "4",
2853
- children: [
2854
- /*#__PURE__*/ F(o, {
2855
- variant: "danger",
2856
- children: /*#__PURE__*/ F(U, {
2857
- id: "CtiFDz",
2858
- values: { totalCount: y }
2859
- })
2860
- }),
2861
- /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F("p", {
2862
- className: "text-theme-light mb-2 text-sm",
2863
- children: /*#__PURE__*/ F(U, { id: "Zshv0H" })
2864
- }), /*#__PURE__*/ I("ul", {
2865
- className: "list-inside list-disc space-y-1 text-sm",
2866
- children: [b.map((e) => {
2867
- let t = e.name, n = e.count;
2868
- return /*#__PURE__*/ I("li", { children: [t, n > 0 && /*#__PURE__*/ I("span", {
2869
- className: "text-theme-light ml-2",
2870
- children: [
2871
- "(",
2872
- n,
2873
- " ",
2874
- /*#__PURE__*/ F(U, {
2875
- id: "gFsjJK",
2876
- values: { bucketCount: n }
2877
- }),
2878
- ")"
2879
- ]
2880
- })] }, t);
2881
- }), x > 0 && /*#__PURE__*/ F("li", {
2882
- className: "text-theme-light",
2883
- children: /*#__PURE__*/ F(U, {
2884
- id: "yqPflB",
2885
- values: { hiddenCount: x }
2886
- })
2887
- })]
2888
- })] }),
2889
- /*#__PURE__*/ F(S, {
2890
- label: i._({ id: "Ghp863" }),
2891
- value: d,
2892
- onChange: (e) => p(e.target.value),
2893
- placeholder: "empty",
2894
- autoFocus: !0
2895
- })
2896
- ]
2897
- })
2898
- });
2899
- };
2900
- //#endregion
2901
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Buckets/CredentialPrompt.tsx
2902
- function Xe({ onSuccess: t }) {
2903
- let n = N(), [r, i] = V(null), a = O.useUtils(), o = O.storage.ceph.ec2Credentials.create.useMutation({
2904
- onSuccess: () => {
2905
- a.storage.ceph.ec2Credentials.list.invalidate(), t();
2906
- },
2907
- onError: (e) => {
2908
- let t = e.message;
2909
- i({
2910
- variant: "error",
2911
- children: /*#__PURE__*/ F(U, {
2912
- id: "rcBt6T",
2913
- values: { errorMessage: t }
2914
- }),
2915
- onDismiss: () => i(null)
2916
- });
2917
- }
2918
- });
2919
- return /*#__PURE__*/ I(f, {
2920
- direction: "vertical",
2921
- gap: "4",
2922
- className: "mt-8 max-w-lg",
2923
- children: [
2924
- r && /*#__PURE__*/ F(e, { ...r }),
2925
- /*#__PURE__*/ F("h2", {
2926
- className: "text-lg font-semibold",
2927
- children: /*#__PURE__*/ F(U, { id: "wXxPjv" })
2928
- }),
2929
- /*#__PURE__*/ F("p", {
2930
- className: "text-theme-default",
2931
- children: /*#__PURE__*/ F(U, { id: "+8m5QE" })
2932
- }),
2933
- /*#__PURE__*/ F("p", {
2934
- className: "text-theme-default text-sm",
2935
- children: /*#__PURE__*/ F(U, { id: "+1xG4p" })
2936
- }),
2937
- /*#__PURE__*/ F("div", { children: /*#__PURE__*/ F(p, {
2938
- onClick: () => n && o.mutate({ project_id: n }),
2939
- disabled: o.isPending || !n,
2940
- children: o.isPending ? /*#__PURE__*/ F(U, { id: "k/zHK7" }) : /*#__PURE__*/ F(U, { id: "FJO48W" })
2941
- }) })
2942
- ]
2943
- });
2944
- }
2945
- //#endregion
2946
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Buckets/index.tsx
2947
- var Ze = () => {
2948
- let { i18n: t, i18n: n, _: i } = W(), o = N(), s = ee({ from: k.fullPath }), { sortBy: c, sortDirection: l, search: u = "" } = k.useSearch(), [m, h] = V(!1), [g, _] = V(!1), [v, x] = V([]), [S, w] = V(null), [D, A] = V(u), M = B(void 0);
2949
- z(() => () => clearTimeout(M.current), []), z(() => {
2950
- A(u);
2951
- }, [u]);
2952
- let P = () => w(null), R = (e) => {
2953
- w(Ve(e, { onDismiss: P }));
2954
- }, H = (e, t) => {
2955
- w(He(e, t, { onDismiss: P }));
2956
- }, G = (e, t) => {
2957
- w(Ue(e, t, { onDismiss: P }));
2958
- }, te = (e, t) => {
2959
- w(We(e, t, { onDismiss: P }));
2960
- }, ne = (e) => {
2961
- w(Ge(e, { onDismiss: P }));
2962
- }, K = (e, t) => {
2963
- w(Ke(e, t, { onDismiss: P }));
2964
- }, re = ({ emptiedCount: e, totalDeleted: t, errors: n }) => {
2965
- if (n.length === 0) x([]);
2966
- else {
2967
- let e = new Set(n.map((e) => e.split(": ")[0]));
2968
- x((t) => t.filter((t) => e.has(t)));
2969
- }
2970
- w(qe(e, t, n, { onDismiss: P }));
2971
- }, q = {
2972
- options: [
2973
- {
2974
- label: t._({ id: "6YtxFj" }),
2975
- value: "name"
2976
- },
2977
- {
2978
- label: t._({ id: "sxbP3b" }),
2979
- value: "count"
2980
- },
2981
- {
2982
- label: t._({ id: "hgpMHD" }),
2983
- value: "bytes"
2984
- },
2985
- {
2986
- label: t._({ id: "sjMCOP" }),
2987
- value: "last_modified"
2988
- }
2989
- ],
2990
- sortBy: c ?? "name",
2991
- sortDirection: l ?? "asc"
2992
- }, { data: ie, isLoading: ae, error: oe } = O.storage.ceph.containers.list.useQuery({
2993
- project_id: o,
2994
- includeMetadata: !0
2995
- }, {
2996
- enabled: !!o,
2997
- retry: !1
2998
- }), se = (e) => [...e].sort((e, t) => {
2999
- let n;
3000
- switch (c ?? "name") {
3001
- case "name":
3002
- n = e.name.localeCompare(t.name);
3003
- break;
3004
- case "count":
3005
- n = e.count - t.count;
3006
- break;
3007
- case "bytes":
3008
- n = e.bytes - t.bytes;
3009
- break;
3010
- case "last_modified":
3011
- if (!e.last_modified && !t.last_modified) return 0;
3012
- if (!e.last_modified) return 1;
3013
- if (!t.last_modified) return -1;
3014
- n = new Date(e.last_modified).getTime() - new Date(t.last_modified).getTime();
3015
- break;
3016
- default: n = e.name.localeCompare(t.name);
3017
- }
3018
- return (l ?? "asc") === "desc" ? -n : n;
3019
- }), ce = (ie || []).filter((e) => e.name.toLowerCase().includes(u.toLowerCase())), J = se(ce), Y = (e) => {
3020
- let t = typeof e == "string" ? e : "";
3021
- L(() => {
3022
- s({ search: (e) => ({
3023
- ...e,
3024
- search: t || void 0
3025
- }) });
3026
- });
3027
- }, le = (e) => {
3028
- let t = e.sortBy?.toString() || "name", n = e.sortDirection || "asc";
3029
- L(() => {
3030
- s({ search: (e) => ({
3031
- ...e,
3032
- sortBy: t,
3033
- sortDirection: n
3034
- }) });
3035
- });
3036
- };
3037
- if (ae) return /*#__PURE__*/ I(f, {
3038
- className: "absolute inset-0",
3039
- distribution: "center",
3040
- alignment: "center",
3041
- direction: "vertical",
3042
- children: [/*#__PURE__*/ F(a, {
3043
- variant: "primary",
3044
- size: "large",
3045
- className: "mb-2"
3046
- }), /*#__PURE__*/ F(U, { id: "c5i+X0" })]
3047
- });
3048
- if (oe) {
3049
- let e = oe.message;
3050
- if (e === "NO_CEPH_CREDENTIALS") return /*#__PURE__*/ F(Xe, { onSuccess: () => window.location.reload() });
3051
- let t = e.includes("Access denied") || e.includes("AccessDenied"), n = e.includes("Invalid access key") || e.includes("InvalidAccessKeyId");
3052
- return /*#__PURE__*/ F("div", {
3053
- className: "p-8",
3054
- children: /*#__PURE__*/ F("p", {
3055
- className: "text-theme-default text-sm",
3056
- children: t ? /*#__PURE__*/ F(U, { id: "HAcOOW" }) : n ? /*#__PURE__*/ F(U, { id: "xIXYTK" }) : /*#__PURE__*/ F(U, {
3057
- id: "yDAMyU",
3058
- values: { errorMessage: e }
3059
- })
3060
- })
3061
- });
3062
- }
3063
- let ue = (ie || []).filter((e) => v.includes(e.name)), de = ue.length > 0, X = ue.length, fe = (ie || []).length, pe = ce.length, me = J.map((e) => e.name), he = me.length > 0 && me.every((e) => v.includes(e)), Z = me.some((e) => v.includes(e));
3064
- return /*#__PURE__*/ I("div", {
3065
- className: "relative",
3066
- children: [
3067
- /*#__PURE__*/ I(f, {
3068
- direction: "vertical",
3069
- children: [
3070
- /*#__PURE__*/ I(f, {
3071
- distribution: "end",
3072
- alignment: "center",
3073
- gap: "2",
3074
- className: "pb-2",
3075
- children: [/*#__PURE__*/ F(f, {
3076
- gap: "0.5",
3077
- alignment: "center",
3078
- children: /*#__PURE__*/ F(j, {
3079
- options: q.options,
3080
- sortBy: q.sortBy,
3081
- sortDirection: q.sortDirection ?? "asc",
3082
- onSortByChange: (e) => le({
3083
- ...q,
3084
- sortBy: e,
3085
- sortDirection: q.sortDirection
3086
- }),
3087
- onSortDirectionChange: (e) => le({
3088
- ...q,
3089
- sortDirection: e
3090
- })
3091
- })
3092
- }), /*#__PURE__*/ F(p, {
3093
- variant: "primary",
3094
- className: "whitespace-nowrap",
3095
- onClick: () => h(!0),
3096
- children: /*#__PURE__*/ F(U, { id: "HiDAFk" })
3097
- })]
3098
- }),
3099
- /*#__PURE__*/ F(E, { children: /*#__PURE__*/ F(f, {
3100
- direction: "vertical",
3101
- gap: "2",
3102
- children: /*#__PURE__*/ F(f, {
3103
- distribution: "end",
3104
- alignment: "center",
3105
- children: /*#__PURE__*/ F(d, {
3106
- placeholder: t._({ id: "VeDAv2" }),
3107
- "data-testid": "searchbar",
3108
- value: D,
3109
- onInput: (e) => {
3110
- let t = e.currentTarget.value;
3111
- A(t), clearTimeout(M.current), M.current = window.setTimeout(() => Y(t), 500);
3112
- },
3113
- onSearch: (e) => {
3114
- clearTimeout(M.current), Y(typeof e == "string" ? e : "");
3115
- },
3116
- onClear: () => {
3117
- clearTimeout(M.current), A(""), Y("");
3118
- }
3119
- })
3120
- })
3121
- }) }),
3122
- /*#__PURE__*/ F(E, { children: /*#__PURE__*/ I(f, {
3123
- distribution: "start",
3124
- gap: "2",
3125
- alignment: "center",
3126
- className: "text-sm",
3127
- children: [/*#__PURE__*/ I(f, {
3128
- gap: "2",
3129
- alignment: "center",
3130
- children: [/*#__PURE__*/ F(y, {
3131
- checked: he,
3132
- indeterminate: Z && !he,
3133
- onChange: () => {
3134
- x(he ? (e) => e.filter((e) => !me.includes(e)) : (e) => [...new Set([...e, ...me])]);
3135
- }
3136
- }), /*#__PURE__*/ I(r, {
3137
- className: "flex items-center",
3138
- children: [/*#__PURE__*/ F(C, {
3139
- as: "div",
3140
- children: /*#__PURE__*/ F(p, {
3141
- disabled: !de,
3142
- size: "small",
3143
- icon: "moreVert",
3144
- label: t._({ id: "7L01XJ" })
3145
- })
3146
- }), de && /*#__PURE__*/ F(T, { children: /*#__PURE__*/ F(b, {
3147
- disabled: !de,
3148
- label: n._(t._({
3149
- id: "P2tWBZ",
3150
- values: { selectedCount: X }
3151
- })),
3152
- onClick: () => _(!0)
3153
- }) })]
3154
- })]
3155
- }), /*#__PURE__*/ F("div", {
3156
- className: "text-theme-light flex items-center gap-1",
3157
- "data-testid": "buckets-info-block",
3158
- children: u.trim() ? /*#__PURE__*/ F(U, {
3159
- id: "xOvKAE",
3160
- values: {
3161
- totalCount: fe,
3162
- filteredCount: pe
3163
- }
3164
- }) : /*#__PURE__*/ F(U, {
3165
- id: "Ux/pNd",
3166
- values: { totalCount: fe }
3167
- })
3168
- })]
3169
- }) })
3170
- ]
3171
- }),
3172
- /*#__PURE__*/ F(ze, {
3173
- buckets: J,
3174
- createModalOpen: m,
3175
- setCreateModalOpen: h,
3176
- onCreateSuccess: R,
3177
- onCreateError: H,
3178
- onEmptySuccess: G,
3179
- onEmptyError: te,
3180
- onDeleteSuccess: ne,
3181
- onDeleteError: K,
3182
- selectedBuckets: v,
3183
- setSelectedBuckets: x,
3184
- hasAnyBulkAction: !0
3185
- }),
3186
- /*#__PURE__*/ F(Ye, {
3187
- isOpen: g,
3188
- buckets: ue,
3189
- onClose: () => _(!1),
3190
- onComplete: re
3191
- }),
3192
- S && /*#__PURE__*/ F(e, {
3193
- ...S,
3194
- className: "border-theme-light fixed top-5 right-5 z-50 rounded-lg border shadow-lg"
3195
- })
3196
- ]
3197
- });
3198
- };
3199
- //#endregion
3200
- //#region src/client/routes/_auth/projects/$projectId/storage/$provider/$storageType/index.tsx?tsr-split=component
3201
- function Qe() {
3202
- let { project: e, provider: t } = H({
3203
- from: "/_auth/projects/$projectId/storage/$provider/$storageType/",
3204
- select: (e) => ({
3205
- project: e.projectId,
3206
- provider: e.provider,
3207
- storageType: e.storageType
3208
- })
3209
- }), { i18n: n, _: r } = W(), i;
3210
- switch (t) {
3211
- case "swift":
3212
- i = n._({ id: "+OEi73" });
3213
- break;
3214
- case "ceph":
3215
- i = n._({ id: "KhNDX4" });
3216
- break;
3217
- default: i = n._({ id: "IWF68U" });
3218
- }
3219
- return /*#__PURE__*/ I("div", { children: [/*#__PURE__*/ F(A, {
3220
- title: i,
3221
- projectId: e
3222
- }), e ? /*#__PURE__*/ F(te, {
3223
- resetKeys: [e, t],
3224
- fallback: /*#__PURE__*/ F("div", {
3225
- className: "p-4 text-center",
3226
- children: /*#__PURE__*/ F(U, { id: "diFNkW" })
3227
- }),
3228
- children: (() => {
3229
- switch (t) {
3230
- case "swift": return /*#__PURE__*/ F(je, {});
3231
- case "ceph": return /*#__PURE__*/ F(Ze, {});
3232
- default: return /*#__PURE__*/ F("div", { children: "Storage Overview Page" });
3233
- }
3234
- })()
3235
- }) : /*#__PURE__*/ F("div", {
3236
- className: "p-4 text-center",
3237
- children: /*#__PURE__*/ F(U, { id: "Z2fZGD" })
3238
- })] });
3239
- }
3240
- var $e = () => /*#__PURE__*/ F(Qe, {});
3241
- //#endregion
3242
- export { $e as component };
3243
-
3244
- //# sourceMappingURL=_storageType-B0eJODiQ.mjs.map