@@ -44,6 +44,7 @@ import {
4444 downloadDebugBundle ,
4545} from "@/lib/api" ;
4646import { t } from "@/lib/i18n" ;
47+ import { formatDiskSizeFromGB } from "@/lib/utils" ;
4748import { useToast } from "@/hooks/use-toast" ;
4849import { useDvrSelection } from "@/lib/dvr-selection-context" ;
4950import type { SystemInfo , AppSettings , DVRStatusInfo } from "@/lib/types" ;
@@ -444,11 +445,7 @@ export function DiagnosticsPanel() {
444445 return t ( "diagnostics.system.na" ) ;
445446 }
446447
447- if ( sizeInGB >= 1000 ) {
448- return ( sizeInGB / 1000 ) . toFixed ( 2 ) + " TB" ;
449- } else {
450- return Math . round ( sizeInGB ) + " GB" ;
451- }
448+ return formatDiskSizeFromGB ( sizeInGB , { gbDecimals : 0 } ) ;
452449 } ;
453450
454451 const calculateDiskUsage = ( ) => {
@@ -459,9 +456,9 @@ export function DiagnosticsPanel() {
459456 ) {
460457 return {
461458 usedGB : null ,
462- usedTB : t ( "diagnostics.system.na" ) ,
459+ usedFormatted : t ( "diagnostics.system.na" ) ,
463460 totalGB : null ,
464- totalTB : t ( "diagnostics.system.na" ) ,
461+ totalFormatted : t ( "diagnostics.system.na" ) ,
465462 freeGB : null ,
466463 } ;
467464 }
@@ -470,17 +467,11 @@ export function DiagnosticsPanel() {
470467 const freeGB = systemInfo . disk_free_gb ;
471468 const usedGB = totalGB - freeGB ;
472469
473- const totalTB = ( totalGB / 1000 ) . toFixed ( 2 ) ;
474- const usedTB = ( usedGB / 1000 ) . toFixed ( 2 ) ;
475-
476- const totalTBFormatted = `${ totalTB } TB` ;
477- const usedTBFormatted = `${ usedTB } TB` ;
478-
479470 return {
480471 usedGB,
481- usedTB : usedTBFormatted ,
472+ usedFormatted : formatDiskSize ( usedGB ) ,
482473 totalGB,
483- totalTB : totalTBFormatted ,
474+ totalFormatted : formatDiskSize ( totalGB ) ,
484475 freeGB,
485476 usedPercent : systemInfo . disk_usage_percent ,
486477 } ;
@@ -633,8 +624,8 @@ export function DiagnosticsPanel() {
633624 value :
634625 diskInfo . usedGB != null
635626 ? t ( "diagnostics.export.usedOf" , {
636- used : formatDiskSize ( diskInfo . usedGB ) ,
637- total : String ( diskInfo . totalTB ) ,
627+ used : diskInfo . usedFormatted ,
628+ total : diskInfo . totalFormatted ,
638629 percent : String ( diskInfo . usedPercent ) ,
639630 } )
640631 : t ( "diagnostics.system.na" ) ,
@@ -1149,8 +1140,8 @@ export function DiagnosticsPanel() {
11491140 { t ( "diagnostics.system.usedKey" ) }
11501141 </ span >
11511142 < span >
1152- { diskInfo . usedGB
1153- ? formatDiskSize ( diskInfo . usedGB )
1143+ { diskInfo . usedGB != null
1144+ ? diskInfo . usedFormatted
11541145 : t ( "diagnostics.system.na" ) }
11551146 </ span >
11561147 </ div >
@@ -1159,7 +1150,7 @@ export function DiagnosticsPanel() {
11591150 { t ( "diagnostics.system.freeKey" ) }
11601151 </ span >
11611152 < span >
1162- { diskInfo . freeGB
1153+ { diskInfo . freeGB != null
11631154 ? formatDiskSize ( diskInfo . freeGB )
11641155 : t ( "diagnostics.system.na" ) }
11651156 </ span >
@@ -1168,7 +1159,7 @@ export function DiagnosticsPanel() {
11681159 < span className = "text-muted-foreground" >
11691160 { t ( "diagnostics.system.totalKey" ) }
11701161 </ span >
1171- < span > { diskInfo . totalTB } </ span >
1162+ < span > { diskInfo . totalFormatted } </ span >
11721163 </ div >
11731164 { systemInfo . disk_usage_percent != null && (
11741165 < Progress
0 commit comments