File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 6161 drawTable ( ) ;
6262 } ) ;
6363 }
64-
64+ function roundDecimal ( num ) {
65+ return Math . round ( num * 10 ) / 10 ;
66+ }
6567 function drawTable ( ) {
6668 document . getElementById ( "storageTable" ) . innerHTML = `
6769 <table class="table table-striped">
7779 ${ globalApps . map ( app => `
7880 <tr>
7981 <td>${ app [ 0 ] } </td>
80- <td>${ ( app [ 1 ] / 1000 ) . toFixed ( 1 ) } </td>
82+ <td>${ ( app [ 1 ] / 1000 ) . toFixed ( 1 } </td>
8183 <td>${ ( app [ 2 ] / 1000 ) . toFixed ( 1 ) } </td>
8284 <td>${ ( ( app [ 1 ] + app [ 2 ] ) / 1000 ) . toFixed ( 1 ) } </td>
8385 </tr>` ) . join ( "" ) }
9193 // App-specific chart
9294 const chartData = [
9395 [ 'App' , 'Total Size (KB)' ]
94- ] . concat ( globalApps . map ( app => [ app [ 0 ] , ( app [ 1 ] + app [ 2 ] ) / 1000 ] ) ) ;
96+ ] . concat ( globalApps . map ( app => [ app [ 0 ] , roundDecimal ( ( app [ 1 ] + app [ 2 ] ) / 1000 ) ] ) ) ;
9597
9698 const data = google . visualization . arrayToDataTable ( chartData ) ;
9799
106108
107109 // Total storage chart
108110 if ( storageStats ) {
109- const usedKB = storageStats . fileBytes / 1000 ;
110- const freeKB = storageStats . freeBytes / 1000 ;
111- const trashKB = storageStats . trashBytes / 1000 ;
111+ const usedKB = roundDecimal ( storageStats . fileBytes / 1000 ) ;
112+ const freeKB = roundDecimal ( storageStats . freeBytes / 1000 ) ;
113+ const trashKB = roundDecimal ( storageStats . trashBytes / 1000 ) ;
112114 const totalData = google . visualization . arrayToDataTable ( [
113115 [ 'Type' , 'KB' ] ,
114116 [ 'Used' , usedKB ] ,
You can’t perform that action at this time.
0 commit comments