@cobaltcore-dev/aurora 0.14.0 → 0.15.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.
@@ -1 +1 @@
1
- {"version":3,"file":"objects-o2Cj_ndZ.mjs","names":["Trans","Route","SplitNotFoundComponent","notFoundComponent"],"sources":["../../src/client/routes/_auth/projects/$projectId/storage/$provider/$storageType/$containerName/objects/index.tsx?tsr-split=notFoundComponent"],"sourcesContent":["import { createFileRoute, useParams } from \"@tanstack/react-router\"\nimport { checkServiceAvailability } from \"../../../../-components/utils/serviceAvailability\"\nimport { ErrorBoundary } from \"react-error-boundary\"\nimport { Trans } from \"@lingui/react/macro\"\nimport { SwiftObjects } from \"../../../../-components/Swift/Objects\"\nimport { CephObjects } from \"../../../../-components/Ceph/Objects\"\nimport { z } from \"zod\"\nimport type { RouteInfo } from \"@/client/routes/routeInfo\"\nimport { BucketHeader } from \"../../../../-components/Ceph/Buckets/BucketHeader\"\n\n// Search params schema\n// - prefix: base64-encoded current folder path, safe to carry \"/\" chars in the URL\n// - sortBy: active sort column key — persisted so deep links and back navigation restore sort state\n// Accepts both Swift keys (last_modified, bytes) and Ceph keys (lastModified, size) for compatibility\n// - sortDirection: \"asc\" | \"desc\" — persisted alongside sortBy\nconst objectsSearchSchema = z.object({\n prefix: z.string().optional(),\n sortBy: z.enum([\"name\", \"last_modified\", \"bytes\", \"lastModified\", \"size\"]).optional(),\n sortDirection: z.enum([\"asc\", \"desc\"]).optional(),\n search: z.string().optional(),\n tab: z.enum([\"all\", \"deleted\"]).optional().default(\"all\"),\n})\n\nexport const Route = createFileRoute(\n \"/_auth/projects/$projectId/storage/$provider/$storageType/$containerName/objects/\"\n)({\n staticData: {\n section: \"storage\",\n service: \"containers\",\n analytics: {\n name: \"storage.objectstore.detail\",\n },\n isDetail: true,\n sectionCrumb: { labelKey: \"Storage\" },\n crumb: { useParamAsLabel: \"provider\", to: \"/projects/$projectId/storage/$provider/$storageType\" },\n } satisfies RouteInfo,\n validateSearch: objectsSearchSchema,\n head: ({ match }) => ({\n meta: [{ title: match.params.containerName }],\n }),\n component: () => {\n return <ObjectsDashboard />\n },\n notFoundComponent: () => {\n return (\n <p>\n <Trans>Storage container not found</Trans>\n </p>\n )\n },\n loader: async ({ context }) => {\n const { trpcClient } = context\n const availableServices = await trpcClient?.auth.getAvailableServices.query()\n\n return {\n client: trpcClient,\n availableServices,\n }\n },\n beforeLoad: async ({ context, params }) => {\n const { trpcClient } = context\n const availableServices = await trpcClient?.auth.getAvailableServices.query()\n checkServiceAvailability(availableServices!, params)\n },\n})\n\nfunction ObjectsDashboard() {\n const { projectId, provider, containerName } = useParams({\n from: \"/_auth/projects/$projectId/storage/$provider/$storageType/$containerName/objects/\",\n select: (params) => ({\n projectId: params.projectId,\n provider: params.provider,\n containerName: params.containerName,\n }),\n })\n\n const { prefix, sortBy, sortDirection, search } = Route.useSearch()\n\n // For Ceph buckets, we show ContentHeader with badges and actions\n // For Swift containers, the component handles its own header\n const showContentHeader = provider === \"ceph\"\n\n return (\n <>\n {showContentHeader && <BucketHeader bucketName={containerName} />}\n <div>\n {projectId ? (\n <ErrorBoundary\n resetKeys={[projectId, provider, containerName, prefix, sortBy, sortDirection, search]}\n fallback={\n <div className=\"p-4 text-center\">\n <Trans>Error loading component</Trans>\n </div>\n }\n >\n {(() => {\n switch (provider) {\n case \"swift\":\n return <SwiftObjects provider={provider} containerName={containerName} />\n case \"ceph\":\n return <CephObjects bucketName={containerName} />\n default:\n return (\n <div className=\"p-4\">\n <Trans>Objects: {containerName}</Trans>\n </div>\n )\n }\n })()}\n </ErrorBoundary>\n ) : (\n <div className=\"p-4 text-center\">\n <Trans>No project selected</Trans>\n </div>\n )}\n </div>\n </>\n )\n}\n"],"mappings":";;;AAcA,IAAAE,UA+BM,gBAAC,KAAA,EAAA,UACC,gBAAA,GAAA,EAAA,IAAA,SAAA,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"objects-o2Cj_ndZ.mjs","names":["Trans","Route","SplitNotFoundComponent","notFoundComponent"],"sources":["../../src/client/routes/_auth/projects/$projectId/storage/$provider/$storageType/$containerName/objects/index.tsx?tsr-split=notFoundComponent"],"sourcesContent":["import { createFileRoute, useParams } from \"@tanstack/react-router\"\nimport { checkServiceAvailability } from \"../../../../-components/utils/serviceAvailability\"\nimport { ErrorBoundary } from \"react-error-boundary\"\nimport { Trans } from \"@lingui/react/macro\"\nimport { SwiftObjects } from \"../../../../-components/Swift/Objects\"\nimport { CephObjects } from \"../../../../-components/Ceph/Objects\"\nimport { z } from \"zod\"\nimport type { RouteInfo } from \"@/client/routes/routeInfo\"\nimport { BucketHeader } from \"../../../../-components/Ceph/Buckets/BucketHeader\"\n\n// Search params schema\n// - prefix: base64-encoded current folder path, safe to carry \"/\" chars in the URL\n// - sortBy: active sort column key — persisted so deep links and back navigation restore sort state\n// Accepts both Swift keys (last_modified, bytes) and Ceph keys (lastModified, size) for compatibility\n// - sortDirection: \"asc\" | \"desc\" — persisted alongside sortBy\nconst objectsSearchSchema = z.object({\n prefix: z.string().optional(),\n sortBy: z.enum([\"name\", \"last_modified\", \"bytes\", \"lastModified\", \"size\"]).optional().default(\"name\"),\n sortDirection: z.enum([\"asc\", \"desc\"]).optional().default(\"asc\"),\n search: z.string().optional(),\n tab: z.enum([\"all\", \"deleted\"]).optional().default(\"all\"),\n})\n\nexport const Route = createFileRoute(\n \"/_auth/projects/$projectId/storage/$provider/$storageType/$containerName/objects/\"\n)({\n staticData: {\n section: \"storage\",\n service: \"containers\",\n analytics: {\n name: \"storage.objectstore.detail\",\n },\n isDetail: true,\n sectionCrumb: { labelKey: \"Storage\" },\n crumb: { useParamAsLabel: \"provider\", to: \"/projects/$projectId/storage/$provider/$storageType\" },\n } satisfies RouteInfo,\n validateSearch: objectsSearchSchema,\n head: ({ match }) => ({\n meta: [{ title: match.params.containerName }],\n }),\n component: () => {\n return <ObjectsDashboard />\n },\n notFoundComponent: () => {\n return (\n <p>\n <Trans>Storage container not found</Trans>\n </p>\n )\n },\n loader: async ({ context }) => {\n const { trpcClient } = context\n const availableServices = await trpcClient?.auth.getAvailableServices.query()\n\n return {\n client: trpcClient,\n availableServices,\n }\n },\n beforeLoad: async ({ context, params }) => {\n const { trpcClient } = context\n const availableServices = await trpcClient?.auth.getAvailableServices.query()\n checkServiceAvailability(availableServices!, params)\n },\n})\n\nfunction ObjectsDashboard() {\n const { projectId, provider, containerName } = useParams({\n from: \"/_auth/projects/$projectId/storage/$provider/$storageType/$containerName/objects/\",\n select: (params) => ({\n projectId: params.projectId,\n provider: params.provider,\n containerName: params.containerName,\n }),\n })\n\n const { prefix, sortBy, sortDirection, search } = Route.useSearch()\n\n // For Ceph buckets, we show ContentHeader with badges and actions\n // For Swift containers, the component handles its own header\n const showContentHeader = provider === \"ceph\"\n\n return (\n <>\n {showContentHeader && <BucketHeader bucketName={containerName} />}\n <div>\n {projectId ? (\n <ErrorBoundary\n resetKeys={[projectId, provider, containerName, prefix, sortBy, sortDirection, search]}\n fallback={\n <div className=\"p-4 text-center\">\n <Trans>Error loading component</Trans>\n </div>\n }\n >\n {(() => {\n switch (provider) {\n case \"swift\":\n return <SwiftObjects provider={provider} containerName={containerName} />\n case \"ceph\":\n return <CephObjects bucketName={containerName} />\n default:\n return (\n <div className=\"p-4\">\n <Trans>Objects: {containerName}</Trans>\n </div>\n )\n }\n })()}\n </ErrorBoundary>\n ) : (\n <div className=\"p-4 text-center\">\n <Trans>No project selected</Trans>\n </div>\n )}\n </div>\n </>\n )\n}\n"],"mappings":";;;AAcA,IAAAE,UA+BM,gBAAC,KAAA,EAAA,UACC,gBAAA,GAAA,EAAA,IAAA,SAAA,CAAA,EAAA,CAAA"}
@@ -41,6 +41,12 @@ interface AuroraServerConfig {
41
41
  * Never set this in production.
42
42
  */
43
43
  insecureCookies?: boolean;
44
+ /**
45
+ * Enable debug logging for OpenStack session operations.
46
+ * Logs HTTP requests/responses to help diagnose API issues.
47
+ * Default: false in production, true in development
48
+ */
49
+ debug?: boolean;
44
50
  /**
45
51
  * Absolute path to a directory containing consumer-supplied OpenStack policy
46
52
  * files (e.g. compute.yaml, image.yaml). Files found here take precedence
@@ -35269,10 +35269,11 @@ var versioningRouter = {
35269
35269
  }
35270
35270
  }),
35271
35271
  /**
35272
- * Check if folders contain deleted files (files with delete markers).
35272
+ * Check if folders contain deleted files (files with delete markers) or if the folder marker itself is deleted.
35273
35273
  *
35274
- * For each folder, performs a query without delimiter to check all nested objects.
35275
- * Returns whether each folder contains at least one file with a delete marker as latest version.
35274
+ * For each folder, checks:
35275
+ * 1. If the folder marker itself (key ending in "/") has a delete marker
35276
+ * 2. If any nested objects have delete markers
35276
35277
  *
35277
35278
  * Note: This can be expensive for many folders (N S3 requests for N folders).
35278
35279
  * Use sparingly and consider caching.
@@ -35290,6 +35291,7 @@ var versioningRouter = {
35290
35291
  const results = await Promise.all(input.folders.map(async (folderPrefix) => {
35291
35292
  try {
35292
35293
  let hasDeleteMarkers = false;
35294
+ let isFolderMarkerDeleted = false;
35293
35295
  let keyMarker;
35294
35296
  let versionIdMarker;
35295
35297
  while (!hasDeleteMarkers) {
@@ -35300,6 +35302,15 @@ var versioningRouter = {
35300
35302
  KeyMarker: keyMarker,
35301
35303
  VersionIdMarker: versionIdMarker
35302
35304
  }));
35305
+ if (!isFolderMarkerDeleted && response.DeleteMarkers) {
35306
+ const folderMarkerDeleteMarkers = response.DeleteMarkers.filter((dm) => dm.Key === folderPrefix);
35307
+ if (folderMarkerDeleteMarkers.length > 0) {
35308
+ const latestFolderMarker = folderMarkerDeleteMarkers.find((dm) => dm.IsLatest);
35309
+ if (latestFolderMarker) {
35310
+ isFolderMarkerDeleted = true;
35311
+ }
35312
+ }
35313
+ }
35303
35314
  hasDeleteMarkers = (response.DeleteMarkers?.length ?? 0) > 0;
35304
35315
  if (!response.IsTruncated || hasDeleteMarkers) {
35305
35316
  break;
@@ -35309,13 +35320,15 @@ var versioningRouter = {
35309
35320
  }
35310
35321
  return {
35311
35322
  prefix: folderPrefix,
35312
- hasDeletedContent: hasDeleteMarkers
35323
+ hasDeletedContent: hasDeleteMarkers,
35324
+ isFolderDeleted: isFolderMarkerDeleted
35313
35325
  };
35314
35326
  } catch (error) {
35315
35327
  console.error(`Failed to check deleted content for folder ${folderPrefix}:`, error);
35316
35328
  return {
35317
35329
  prefix: folderPrefix,
35318
- hasDeletedContent: false
35330
+ hasDeletedContent: false,
35331
+ isFolderDeleted: false
35319
35332
  };
35320
35333
  }
35321
35334
  }));
@@ -38147,7 +38160,8 @@ async function createServer(config) {
38147
38160
  imageMetadataExcludedProperties: config.imageMetadataExcludedProperties,
38148
38161
  cookieName: config.cookieName,
38149
38162
  cookieDomain: config.cookieDomain,
38150
- insecureCookies: config.insecureCookies
38163
+ insecureCookies: config.insecureCookies,
38164
+ debug: config.debug
38151
38165
  };
38152
38166
  const appRouter = buildAppRouter(config.policyDir, config.routers ?? []);
38153
38167
  const server = (0, import_fastify.default)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobaltcore-dev/aurora",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "private": false,
5
5
  "description": "Aurora OpenStack dashboard — server and client library",
6
6
  "license": "Apache-2.0",
@@ -108,9 +108,9 @@
108
108
  "vite-plugin-svgr": "^5.0.0",
109
109
  "vite-tsconfig-paths": "^6.1.1",
110
110
  "vitest": "^4.1.2",
111
- "@cobaltcore-dev/aurora-config": "0.0.1",
112
111
  "@cobaltcore-dev/signal-openstack": "1.0.0",
113
- "@cobaltcore-dev/policy-engine": "2.0.0"
112
+ "@cobaltcore-dev/policy-engine": "2.0.0",
113
+ "@cobaltcore-dev/aurora-config": "0.0.1"
114
114
  },
115
115
  "scripts": {
116
116
  "build": "pnpm build:server && pnpm build:client",
@@ -1,562 +0,0 @@
1
- import { B as e, K as t, U as n, g as r, lt as i, r as a, tt as o, ut as s, y as c } from "./build-DgeVmENN.mjs";
2
- import { r as l } from "./trpcClient-Dy_MP_Pv.mjs";
3
- import { t as u } from "./useProjectId-DBc5lpoU.mjs";
4
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
5
- import { useEffect as m, useState as h } from "react";
6
- import { Trans as g, useLingui as _ } from "@lingui/react";
7
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Buckets/DeleteBucketPolicyModal.tsx
8
- var v = ({ isOpen: n, bucketName: r, onClose: i, onSuccess: s, onError: c }) => {
9
- let { i18n: h, _: v } = _(), y = u(), b = l.useUtils(), { data: x, isLoading: S, error: C } = l.storage.ceph.bucketPolicy.get.useQuery({
10
- project_id: y,
11
- bucketName: r
12
- }, {
13
- enabled: n && !!y,
14
- retry: !1
15
- }), w = l.storage.ceph.bucketPolicy.delete.useMutation({
16
- onSuccess: () => {
17
- b.storage.ceph.bucketPolicy.get.invalidate(), s?.(r), T();
18
- },
19
- onError: (e) => {
20
- c?.(r, e.message);
21
- }
22
- });
23
- m(() => {
24
- n || w.reset();
25
- }, [n, r]);
26
- let T = () => {
27
- w.reset(), i();
28
- }, E = () => {
29
- w.mutate({
30
- project_id: y,
31
- bucketName: r
32
- });
33
- };
34
- if (!n) return null;
35
- let D = !!x?.policy, O = w.isPending;
36
- return /*#__PURE__*/ f(a, {
37
- title: h._({ id: "On9AgT" }),
38
- open: n,
39
- onCancel: T,
40
- confirmButtonLabel: h._({ id: "VMoZmg" }),
41
- confirmButtonVariant: "primary-danger",
42
- onConfirm: E,
43
- cancelButtonLabel: h._({ id: "dEgA5A" }),
44
- size: "small",
45
- disableConfirmButton: O || S || !D || !!C,
46
- children: /*#__PURE__*/ p(o, {
47
- direction: "vertical",
48
- gap: "4",
49
- children: [
50
- S && /*#__PURE__*/ f("div", {
51
- className: "flex items-center justify-center py-4",
52
- children: /*#__PURE__*/ f(t, {
53
- variant: "primary",
54
- size: "large"
55
- })
56
- }),
57
- C && /*#__PURE__*/ f(e, {
58
- variant: "error",
59
- title: h._({ id: "XicAqm" }),
60
- children: C.message
61
- }),
62
- !S && !C && !D && /*#__PURE__*/ f(e, {
63
- variant: "warning",
64
- title: h._({ id: "GZjazt" }),
65
- children: /*#__PURE__*/ f(g, { id: "/HejCc" })
66
- }),
67
- !S && !C && D && /*#__PURE__*/ p(d, { children: [/*#__PURE__*/ f("p", {
68
- className: "text-theme-default",
69
- children: /*#__PURE__*/ f(g, {
70
- id: "QDUXIq",
71
- values: { bucketName: r },
72
- components: { 0: /*#__PURE__*/ f("strong", {}) }
73
- })
74
- }), /*#__PURE__*/ f("p", {
75
- className: "text-theme-default",
76
- children: /*#__PURE__*/ f(g, { id: "Rsh494" })
77
- })] }),
78
- w.isError && /*#__PURE__*/ f(e, {
79
- variant: "error",
80
- title: h._({ id: "+Pe7SS" }),
81
- children: w.error?.message
82
- })
83
- ]
84
- })
85
- });
86
- };
87
- //#endregion
88
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/hooks/bucketStateHelpers.ts
89
- function y(e, t, n) {
90
- let r = e.filter((e) => e.isLatest && !e.isDeleteMarker), i = e.filter((e) => !e.isDeleteMarker), a = t && e.length > 0 && i.length === 0, o = t && e.some((e) => e.isDeleteMarker || !e.isLatest && !e.isDeleteMarker), s = t ? n > 0 ? n : r.length : n + i.length;
91
- return {
92
- currentVersions: r,
93
- hasOnlyDeleteMarkers: a,
94
- hasOldVersionsOrDeleteMarkers: o,
95
- effectiveCurrentObjectCount: s,
96
- isBucketEmpty: s === 0
97
- };
98
- }
99
- //#endregion
100
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Buckets/EmptyBucketModal.tsx
101
- var b = ({ isOpen: e, bucket: r, onClose: s, onSuccess: c, onError: d }) => {
102
- let { i18n: m, _: v } = _(), b = u(), [x, S] = h(""), [C, w] = h(null), [T, E] = h(!1), D = l.useUtils(), { data: O, isLoading: k, error: A } = l.storage.ceph.versioning.getStatus.useQuery({
103
- project_id: b ?? "",
104
- bucket: r?.name ?? ""
105
- }, {
106
- enabled: !!b && !!r && e,
107
- staleTime: 30 * 1e3
108
- }), { data: j, isLoading: M, error: N } = l.storage.ceph.objects.list.useQuery({
109
- project_id: b ?? "",
110
- containerName: r?.name ?? "",
111
- maxKeys: 100,
112
- delimiter: "",
113
- showVersions: !0
114
- }, {
115
- enabled: !!b && !!r && e && O?.status !== "Unversioned",
116
- staleTime: 30 * 1e3
117
- }), P = O?.status === "Enabled" || O?.status === "Suspended", { isBucketEmpty: F, hasOnlyDeleteMarkers: I } = y(j?.versions ?? [], P, r?.count ?? 0), L = F && I, R = l.storage.ceph.objects.deleteAll.useMutation({ onSettled: () => {
118
- D.storage.ceph.containers.list.invalidate(), D.storage.ceph.objects.list.invalidate(), z();
119
- } }), z = () => {
120
- S(""), w(null), E(!1), R.reset(), s();
121
- }, B = (e) => {
122
- let t = e.target.value;
123
- S(t), C && w(null);
124
- }, V = () => {
125
- if (!r) return;
126
- if (x.trim() !== r.name) {
127
- w(m._({ id: "wxVsr5" }));
128
- return;
129
- }
130
- let e = r.name, t = L || T;
131
- R.mutate({
132
- project_id: b,
133
- containerName: e,
134
- includeVersionsAndDeleteMarkers: t
135
- }, {
136
- onSuccess: (t) => {
137
- c?.(e, t);
138
- },
139
- onError: (t) => {
140
- d?.(e, t.message);
141
- }
142
- });
143
- }, H = (e) => {
144
- e.key === "Enter" && V();
145
- };
146
- if (!e || !r) return null;
147
- let U = r.name, W = k || M, G = !!A || !!N;
148
- return L && !W ? /*#__PURE__*/ f(a, {
149
- title: m._({ id: "1mFMeP" }),
150
- open: e,
151
- onCancel: z,
152
- confirmButtonLabel: m._({ id: "1mFMeP" }),
153
- confirmButtonVariant: "primary-danger",
154
- onConfirm: V,
155
- cancelButtonLabel: m._({ id: "dEgA5A" }),
156
- size: "small",
157
- disableConfirmButton: R.isPending || x.trim() !== r.name || G,
158
- children: /*#__PURE__*/ p(o, {
159
- direction: "vertical",
160
- gap: "6",
161
- children: [
162
- G && /*#__PURE__*/ f("div", {
163
- className: "bg-theme-danger-10 text-theme-danger rounded p-4",
164
- children: /*#__PURE__*/ f(g, { id: "5p97CR" })
165
- }),
166
- /*#__PURE__*/ f("p", {
167
- className: "text-theme-default m-0",
168
- children: /*#__PURE__*/ f(g, { id: "T3+VKR" })
169
- }),
170
- /*#__PURE__*/ f(n, {
171
- label: m._({ id: "dEHa3L" }),
172
- required: !0,
173
- value: x,
174
- onChange: B,
175
- onKeyDown: H,
176
- invalid: !!C,
177
- errortext: C || void 0,
178
- disabled: R.isPending || G,
179
- placeholder: r.name,
180
- autoFocus: !0
181
- })
182
- ]
183
- })
184
- }) : /*#__PURE__*/ f(a, {
185
- title: m._({ id: "CfKRC1" }),
186
- open: e,
187
- onCancel: z,
188
- confirmButtonLabel: m._({ id: "CfKRC1" }),
189
- confirmButtonVariant: "primary-danger",
190
- onConfirm: V,
191
- cancelButtonLabel: m._({ id: "dEgA5A" }),
192
- size: "small",
193
- disableConfirmButton: R.isPending || x.trim() !== r.name || G,
194
- children: W ? /*#__PURE__*/ p(o, {
195
- direction: "horizontal",
196
- gap: "2",
197
- alignment: "center",
198
- children: [/*#__PURE__*/ f(t, {}), /*#__PURE__*/ f("span", {
199
- className: "text-juno-grey-light-1 text-sm",
200
- children: /*#__PURE__*/ f(g, { id: "rPuPb+" })
201
- })]
202
- }) : /*#__PURE__*/ p(o, {
203
- direction: "vertical",
204
- gap: "6",
205
- children: [
206
- G && /*#__PURE__*/ f("div", {
207
- className: "bg-theme-danger-10 text-theme-danger rounded p-4",
208
- children: /*#__PURE__*/ f(g, { id: "5p97CR" })
209
- }),
210
- /*#__PURE__*/ f("p", {
211
- className: "text-theme-default m-0",
212
- children: O && O.status !== "Unversioned" ? /*#__PURE__*/ f(g, {
213
- id: "i9I/nL",
214
- values: { bucketName: U }
215
- }) : /*#__PURE__*/ f(g, {
216
- id: "KvQbFT",
217
- values: { bucketName: U }
218
- })
219
- }),
220
- O && O.status !== "Unversioned" && /*#__PURE__*/ f(i, {
221
- checked: T,
222
- onChange: (e) => E(e.target.checked),
223
- label: m._({ id: "mbmb/h" }),
224
- disabled: R.isPending || G
225
- }),
226
- /*#__PURE__*/ f(n, {
227
- label: m._({ id: "dEHa3L" }),
228
- required: !0,
229
- value: x,
230
- onChange: B,
231
- onKeyDown: H,
232
- invalid: !!C,
233
- errortext: C || void 0,
234
- disabled: R.isPending || G,
235
- placeholder: r.name,
236
- autoFocus: !0
237
- })
238
- ]
239
- })
240
- });
241
- }, x = ({ isOpen: e, bucket: i, onClose: v, onSuccess: b, onError: x }) => {
242
- let { i18n: S, _: C } = _(), w = u(), [T, E] = h(""), [D, O] = h(null), k = l.useUtils(), { data: A, isLoading: j } = l.storage.ceph.versioning.getStatus.useQuery({
243
- project_id: w ?? "",
244
- bucket: i?.name ?? ""
245
- }, { enabled: e && i !== null }), M = A?.status === "Enabled" || A?.status === "Suspended", { data: N, isLoading: P, error: F } = l.storage.ceph.objects.list.useQuery({
246
- project_id: w ?? "",
247
- containerName: i?.name ?? "",
248
- maxKeys: 100,
249
- delimiter: "",
250
- showVersions: !0
251
- }, { enabled: e && i !== null }), I = l.storage.ceph.containers.delete.useMutation({ onSettled: () => {
252
- k.storage.ceph.containers.list.invalidate();
253
- } });
254
- m(() => {
255
- e || (E(""), O(null), I.reset());
256
- }, [e, i?.name]);
257
- let L = () => {
258
- E(""), O(null), I.reset(), v();
259
- }, R = (e) => {
260
- let t = e.target.value;
261
- E(t), D && O(null);
262
- }, z = () => {
263
- if (!i || F) return;
264
- if (T.trim() !== i.name) {
265
- O(S._({ id: "wxVsr5" }));
266
- return;
267
- }
268
- let e = i.name;
269
- I.mutate({
270
- project_id: w,
271
- bucketName: e
272
- }, {
273
- onSuccess: () => {
274
- L(), b?.(e);
275
- },
276
- onError: (t) => {
277
- L(), x?.(e, t.message);
278
- }
279
- });
280
- }, B = (e) => {
281
- e.key === "Enter" && z();
282
- };
283
- if (!e || !i) return null;
284
- let V = N?.objects?.length ?? 0, { effectiveCurrentObjectCount: H, hasOldVersionsOrDeleteMarkers: U } = y(N?.versions ?? [], M, V), W = H > 0, G = U, K = W || G, q = F?.message, J = P || j;
285
- return /*#__PURE__*/ f(a, {
286
- title: S._({ id: "IwlPLb" }),
287
- open: e,
288
- onCancel: L,
289
- confirmButtonLabel: K ? void 0 : S._({ id: "IwlPLb" }),
290
- confirmButtonVariant: K ? void 0 : "primary-danger",
291
- onConfirm: K ? void 0 : z,
292
- cancelButtonLabel: K ? void 0 : S._({ id: "dEgA5A" }),
293
- modalFooter: K ? /*#__PURE__*/ f(r, {
294
- className: "flex justify-end",
295
- children: /*#__PURE__*/ f(s, { children: /*#__PURE__*/ f(c, {
296
- variant: "primary",
297
- onClick: L,
298
- "data-testid": "delete-has-objects-close-button",
299
- children: /*#__PURE__*/ f(g, { id: "yz7wBu" })
300
- }) })
301
- }) : void 0,
302
- size: "small",
303
- disableConfirmButton: I.isPending || J || !!F || T.trim() !== i.name,
304
- children: /*#__PURE__*/ p(o, {
305
- direction: "vertical",
306
- gap: "6",
307
- children: [F && /*#__PURE__*/ f("p", {
308
- className: "text-theme-error",
309
- role: "alert",
310
- "aria-live": "assertive",
311
- children: /*#__PURE__*/ f(g, {
312
- id: "MJLqeY",
313
- values: { errorMessage: q }
314
- })
315
- }), J ? /*#__PURE__*/ p(o, {
316
- direction: "horizontal",
317
- gap: "2",
318
- alignment: "center",
319
- children: [/*#__PURE__*/ f(t, {}), /*#__PURE__*/ f("span", {
320
- className: "text-juno-grey-light-1 text-sm",
321
- children: /*#__PURE__*/ f(g, { id: "rPuPb+" })
322
- })]
323
- }) : K ? /*#__PURE__*/ p("div", {
324
- className: "text-theme-default",
325
- children: [/*#__PURE__*/ f("p", {
326
- className: "mb-4",
327
- children: /*#__PURE__*/ f(g, { id: "8/m18Q" })
328
- }), /*#__PURE__*/ p("ul", {
329
- className: "list-disc space-y-1 pl-5",
330
- children: [W && /*#__PURE__*/ f("li", { children: /*#__PURE__*/ f(g, { id: "5Od/iS" }) }), G && /*#__PURE__*/ f("li", { children: /*#__PURE__*/ f(g, { id: "vi0pmB" }) })]
331
- })]
332
- }) : /*#__PURE__*/ p(d, { children: [/*#__PURE__*/ f("p", {
333
- className: "text-theme-default",
334
- children: /*#__PURE__*/ f(g, { id: "/pOQrn" })
335
- }), /*#__PURE__*/ f(n, {
336
- label: S._({ id: "dEHa3L" }),
337
- required: !0,
338
- value: T,
339
- onChange: R,
340
- onKeyDown: B,
341
- invalid: !!D,
342
- errortext: D || void 0,
343
- disabled: I.isPending,
344
- placeholder: i.name
345
- })] })]
346
- })
347
- });
348
- }, S = ({ isOpen: e, bucket: t, onClose: r, onSuccess: i, onError: s }) => {
349
- let { i18n: c, _: d } = _(), m = u(), [v, y] = h(""), [b, x] = h(null), S = l.useUtils(), C = l.storage.ceph.objects.deleteAll.useMutation({ onSettled: () => {
350
- S.storage.ceph.containers.list.invalidate(), S.storage.ceph.objects.list.invalidate(), w();
351
- } }), w = () => {
352
- y(""), x(null), C.reset(), r();
353
- }, T = (e) => {
354
- let t = e.target.value;
355
- y(t), b && x(null);
356
- }, E = () => {
357
- if (!t) return;
358
- if (v.trim() !== t.name) {
359
- x(c._({ id: "wxVsr5" }));
360
- return;
361
- }
362
- let e = t.name;
363
- C.mutate({
364
- project_id: m,
365
- containerName: e,
366
- includeVersionsAndDeleteMarkers: !0
367
- }, {
368
- onSuccess: (t) => {
369
- i?.(e, t);
370
- },
371
- onError: (t) => {
372
- s?.(e, t.message);
373
- }
374
- });
375
- };
376
- return !e || !t ? null : /*#__PURE__*/ f(a, {
377
- title: c._({ id: "1mFMeP" }),
378
- open: e,
379
- onCancel: w,
380
- confirmButtonLabel: c._({ id: "1mFMeP" }),
381
- confirmButtonVariant: "primary-danger",
382
- onConfirm: E,
383
- cancelButtonLabel: c._({ id: "dEgA5A" }),
384
- size: "small",
385
- disableConfirmButton: C.isPending || v.trim() !== t.name,
386
- children: /*#__PURE__*/ p(o, {
387
- direction: "vertical",
388
- gap: "6",
389
- children: [/*#__PURE__*/ f("p", {
390
- className: "text-theme-default m-0",
391
- children: /*#__PURE__*/ f(g, { id: "T3+VKR" })
392
- }), /*#__PURE__*/ f(n, {
393
- label: c._({ id: "dEHa3L" }),
394
- required: !0,
395
- value: v,
396
- onChange: T,
397
- onKeyDown: (e) => {
398
- e.key === "Enter" && E();
399
- },
400
- invalid: !!b,
401
- errortext: b || void 0,
402
- disabled: C.isPending,
403
- placeholder: t.name,
404
- autoFocus: !0,
405
- className: "overflow-x-hidden [overflow-wrap:anywhere]"
406
- })]
407
- })
408
- });
409
- }, C = (e) => ({
410
- message: /*#__PURE__*/ f(g, { id: "M3bysB" }),
411
- description: /*#__PURE__*/ f(g, {
412
- id: "VKCkZH",
413
- values: { bucketName: e }
414
- })
415
- }), w = (e, t) => ({
416
- message: /*#__PURE__*/ f(g, { id: "UaP7Th" }),
417
- description: /*#__PURE__*/ f(g, {
418
- id: "boefwq",
419
- values: {
420
- bucketName: e,
421
- errorMessage: t
422
- }
423
- })
424
- }), T = (e, t) => ({
425
- message: /*#__PURE__*/ f(g, { id: "b95YH9" }),
426
- description: t === 0 ? /*#__PURE__*/ f(g, {
427
- id: "8erw15",
428
- values: { bucketName: e }
429
- }) : t === 1 ? /*#__PURE__*/ f(g, {
430
- id: "QpbWpf",
431
- values: {
432
- bucketName: e,
433
- deletedCount: t
434
- }
435
- }) : /*#__PURE__*/ f(g, {
436
- id: "JPWqr2",
437
- values: {
438
- bucketName: e,
439
- deletedCount: t
440
- }
441
- })
442
- }), E = (e, t) => ({
443
- message: /*#__PURE__*/ f(g, { id: "66YUKF" }),
444
- description: /*#__PURE__*/ f(g, {
445
- id: "t7ewhH",
446
- values: {
447
- bucketName: e,
448
- errorMessage: t
449
- }
450
- })
451
- }), D = (e) => ({
452
- message: /*#__PURE__*/ f(g, { id: "bHUarC" }),
453
- description: /*#__PURE__*/ f(g, {
454
- id: "hQdfmR",
455
- values: { bucketName: e }
456
- })
457
- }), O = (e, t) => ({
458
- message: /*#__PURE__*/ f(g, { id: "1NFtQz" }),
459
- description: /*#__PURE__*/ f(g, {
460
- id: "CongmL",
461
- values: {
462
- bucketName: e,
463
- errorMessage: t
464
- }
465
- })
466
- }), k = (e, t, n) => {
467
- let r = n.length > 0, i = e + n.length, a = n.length;
468
- return {
469
- message: r ? /*#__PURE__*/ f(g, { id: "6fuDFZ" }) : /*#__PURE__*/ f(g, { id: "BOoOLQ" }),
470
- description: r ? /*#__PURE__*/ f(g, {
471
- id: "pD/2BQ",
472
- values: {
473
- emptiedCount: e,
474
- totalBuckets: i,
475
- totalDeleted: t,
476
- errorsLength: a
477
- }
478
- }) : /*#__PURE__*/ f(g, {
479
- id: "YVLcyI",
480
- values: {
481
- emptiedCount: e,
482
- totalDeleted: t
483
- }
484
- })
485
- };
486
- }, A = (e) => ({
487
- message: /*#__PURE__*/ f(g, { id: "nU1mHK" }),
488
- description: /*#__PURE__*/ f(g, {
489
- id: "z/5vyM",
490
- values: { bucketName: e }
491
- })
492
- }), j = (e, t) => ({
493
- message: /*#__PURE__*/ f(g, { id: "eslBIK" }),
494
- description: /*#__PURE__*/ f(g, {
495
- id: "jMaofI",
496
- values: {
497
- bucketName: e,
498
- errorMessage: t
499
- }
500
- })
501
- }), M = (e) => ({
502
- message: /*#__PURE__*/ f(g, { id: "Ni6RvO" }),
503
- description: /*#__PURE__*/ f(g, {
504
- id: "RHm1CB",
505
- values: { bucketName: e }
506
- })
507
- }), N = (e, t) => ({
508
- message: /*#__PURE__*/ f(g, { id: "5PhMH2" }),
509
- description: /*#__PURE__*/ f(g, {
510
- id: "pQB7Sy",
511
- values: {
512
- bucketName: e,
513
- errorMessage: t
514
- }
515
- })
516
- }), P = (e) => ({
517
- message: /*#__PURE__*/ f(g, { id: "QAoi3Q" }),
518
- description: /*#__PURE__*/ f(g, {
519
- id: "LT2Vv7",
520
- values: { bucketName: e }
521
- })
522
- }), F = (e, t) => ({
523
- message: /*#__PURE__*/ f(g, { id: "cBfLPr" }),
524
- description: /*#__PURE__*/ f(g, {
525
- id: "XjGaah",
526
- values: {
527
- bucketName: e,
528
- errorMessage: t
529
- }
530
- })
531
- }), I = (e, t) => ({
532
- message: /*#__PURE__*/ f(g, { id: "V6AQa5" }),
533
- description: t === 0 ? /*#__PURE__*/ f(g, {
534
- id: "EJqSbS",
535
- values: { bucketName: e }
536
- }) : t === 1 ? /*#__PURE__*/ f(g, {
537
- id: "NwXhO7",
538
- values: {
539
- deletedCount: t,
540
- bucketName: e
541
- }
542
- }) : /*#__PURE__*/ f(g, {
543
- id: "nPI6Rk",
544
- values: {
545
- deletedCount: t,
546
- bucketName: e
547
- }
548
- })
549
- }), L = (e, t) => ({
550
- message: /*#__PURE__*/ f(g, { id: "W1ZvXE" }),
551
- description: /*#__PURE__*/ f(g, {
552
- id: "pPr2iF",
553
- values: {
554
- bucketName: e,
555
- errorMessage: t
556
- }
557
- })
558
- });
559
- //#endregion
560
- export { x as _, T as a, v as b, P as c, A as d, N as f, S as g, I as h, D as i, k as l, L as m, C as n, E as o, M as p, O as r, F as s, w as t, j as u, b as v, y };
561
-
562
- //# sourceMappingURL=BucketToastNotifications-CxQ0_Spa.mjs.map