refactor: update storage quota configuration from megabytes to gigabytes

This commit is contained in:
Yashwin 2026-05-12 15:50:17 +05:30
parent 4024711100
commit eefd4f995a

View File

@ -4,7 +4,6 @@ import {
ShieldCheck, ShieldCheck,
Building2, Building2,
Package, Package,
// AlertCircle,
Pencil, Pencil,
HardDrive, HardDrive,
Files, Files,
@ -58,12 +57,13 @@ const QuotaEditModal = ({
quota, quota,
onUpdated, onUpdated,
}: QuotaEditModalProps) => { }: QuotaEditModalProps) => {
const [maxStorageMB, setMaxStorageMB] = useState( const [maxStorageGB, setMaxStorageGB] = useState(
Math.floor( Math.floor(
(typeof quota.max_storage_bytes === "string" (typeof quota.max_storage_bytes === "string"
? parseInt(quota.max_storage_bytes) ? parseInt(quota.max_storage_bytes)
: quota.max_storage_bytes) / : quota.max_storage_bytes) /
1024 / 1024 /
1024 /
1024, 1024,
), ),
); );
@ -76,7 +76,7 @@ const QuotaEditModal = ({
setIsUpdating(true); setIsUpdating(true);
try { try {
await fileAttachmentService.updateQuota({ await fileAttachmentService.updateQuota({
max_storage_bytes: maxStorageMB * 1024 * 1024, max_storage_bytes: maxStorageGB * 1024 * 1024 * 1024,
max_file_size_bytes: maxFileMB * 1024 * 1024, max_file_size_bytes: maxFileMB * 1024 * 1024,
}); });
onUpdated(); onUpdated();
@ -114,11 +114,11 @@ const QuotaEditModal = ({
> >
<div className="p-6 space-y-5"> <div className="p-6 space-y-5">
<FormField <FormField
label="Max Total Storage (MB)" label="Max Total Storage (GB)"
type="number" type="number"
value={maxStorageMB} value={maxStorageGB}
onChange={(e) => setMaxStorageMB(parseInt(e.target.value) || 0)} onChange={(e) => setMaxStorageGB(parseInt(e.target.value) || 0)}
placeholder="e.g. 10240 for 10GB" placeholder="e.g. 10 for 10GB"
/> />
<FormField <FormField
label="Max Per-File Size (MB)" label="Max Per-File Size (MB)"