Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions app/(dashboard)/browser/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
const router = useRouter()
const message = useMessage()
const dialog = useDialog()
const { isAdmin } = useAuth()

Check warning on line 41 in app/(dashboard)/browser/page.tsx

View workflow job for this annotation

GitHub Actions / 💅 Code Formatting

'isAdmin' is assigned a value but never used

Check warning on line 41 in app/(dashboard)/browser/page.tsx

View workflow job for this annotation

GitHub Actions / 💅 Code Formatting

'isAdmin' is assigned a value but never used

Check warning on line 41 in app/(dashboard)/browser/page.tsx

View workflow job for this annotation

GitHub Actions / 🔍 Code Quality

'isAdmin' is assigned a value but never used
const { listBuckets, deleteBucket } = useBucket()
const { getDataUsageInfo } = useSystem()

Expand All @@ -51,7 +51,7 @@

const loadBucketUsage = useCallback(
async (fetchId: number, bucketNames: string[]) => {
if (!isAdmin || bucketNames.length === 0) {
if (bucketNames.length === 0) {
setUsageLoading(false)
return
}
Expand Down Expand Up @@ -81,7 +81,7 @@
}
}
},
[getDataUsageInfo, isAdmin],
[getDataUsageInfo],
)

const fetchBuckets = useCallback(
Expand Down Expand Up @@ -111,15 +111,12 @@
setData(buckets)
setPending(false)

if (isAdmin) {
setUsageLoading(true)
void loadBucketUsage(
fetchId,
buckets.map((bucket) => bucket.Name),
)
} else {
setUsageLoading(false)
}
setUsageLoading(true)
void loadBucketUsage(
fetchId,
buckets.map((bucket) => bucket.Name),
)

} catch (error) {
if (fetchId !== fetchIdRef.current) return
console.error("Failed to fetch buckets:", error)
Expand All @@ -130,7 +127,7 @@
}
}
},
[isAdmin, listBuckets, loadBucketUsage],
[listBuckets, loadBucketUsage],
)

useEffect(() => {
Expand Down Expand Up @@ -165,7 +162,6 @@
},
]

if (isAdmin) {
baseColumns.push(
{
header: () => t("Object Count"),
Expand All @@ -186,8 +182,7 @@
row.original.Size ?? (usageLoading ? <Spinner className="size-3 text-muted-foreground" /> : "--"),
},
)
}


baseColumns.push({
id: "actions",
header: () => t("Actions"),
Expand Down