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