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:
GatewayJ
2026-02-27 20:41:34 +08:00
committed by GitHub
parent 85d73ad6d6
commit f84d0dccd4
7 changed files with 144 additions and 14 deletions
+8 -3
View File
@@ -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)