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