mirror of
https://github.com/rustfs/console.git
synced 2026-09-01 15:17:45 +08:00
Objectcount (#49)
* feat: dataobject count sub account permissions * Update lib/console-policy-parser.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update hooks/use-system.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: resolve lint errors (no-explicit-any, no-unused-vars) --------- Co-authored-by: 安正超 <anzhengchao@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -16,7 +16,6 @@ import { Spinner } from "@/components/ui/spinner"
|
||||
import { useBucket } from "@/hooks/use-bucket"
|
||||
import { useObject } from "@/hooks/use-object"
|
||||
import { useSystem } from "@/hooks/use-system"
|
||||
import { useAuth } from "@/contexts/auth-context"
|
||||
import { useDialog } from "@/lib/feedback/dialog"
|
||||
import { useMessage } from "@/lib/feedback/message"
|
||||
import { niceBytes } from "@/lib/functions"
|
||||
@@ -39,7 +38,6 @@ function BrowserBucketsPage() {
|
||||
const router = useRouter()
|
||||
const message = useMessage()
|
||||
const dialog = useDialog()
|
||||
const { isAdmin } = useAuth()
|
||||
const { listBuckets, deleteBucket } = useBucket()
|
||||
const { getDataUsageInfo } = useSystem()
|
||||
|
||||
@@ -58,8 +56,14 @@ function BrowserBucketsPage() {
|
||||
}
|
||||
|
||||
try {
|
||||
const usage = (await getDataUsageInfo()) as { buckets_usage?: BucketUsageMap }
|
||||
const usage = (await getDataUsageInfo()) as { buckets_usage?: BucketUsageMap } | undefined
|
||||
if (fetchId !== fetchIdRef.current) return
|
||||
|
||||
// getDataUsageInfo returns undefined on 403; don't update data so table shows "--"
|
||||
if (!usage) {
|
||||
return
|
||||
}
|
||||
|
||||
const bucketUsage = usage?.buckets_usage ?? {}
|
||||
|
||||
setData((prev) =>
|
||||
@@ -77,6 +81,7 @@ function BrowserBucketsPage() {
|
||||
)
|
||||
} catch {
|
||||
if (fetchId !== fetchIdRef.current) return
|
||||
// On error, don't update the data - keep showing "--"
|
||||
} finally {
|
||||
if (fetchId === fetchIdRef.current) {
|
||||
setUsageLoading(false)
|
||||
|
||||
Reference in New Issue
Block a user