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