mirror of
https://github.com/khairul169/garage-webui.git
synced 2026-09-15 00:43:21 +07:00
feat: add keys & bucket permissions management
This commit is contained in:
+3
-1
@@ -29,7 +29,9 @@ const api = {
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(res.statusText);
|
||||
const json = await res.json().catch(() => {});
|
||||
const message = json?.message || res.statusText;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
const isJson = res.headers
|
||||
|
||||
+1
-2
@@ -14,8 +14,7 @@ export const readableBytes = (bytes?: number | null, divider = 1024) => {
|
||||
if (bytes == null || Number.isNaN(bytes)) return "n/a";
|
||||
|
||||
const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes === 0) return "n/a";
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(divider));
|
||||
const i = Math.max(0, Math.floor(Math.log(bytes) / Math.log(divider)));
|
||||
|
||||
return `${(bytes / Math.pow(divider, i)).toFixed(1)} ${sizes[i]}`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user