@ -4,8 +4,9 @@ define([
'marionette' ,
'marionette' ,
'backgrid' ,
'backgrid' ,
'System/DiskSpace/DiskSpaceCollection' ,
'System/DiskSpace/DiskSpaceCollection' ,
'Shared/LoadingView'
'Shared/LoadingView' ,
] , function ( vent , Marionette , Backgrid , DiskSpaceCollection , LoadingView ) {
'Cells/FileSizeCell'
] , function ( vent , Marionette , Backgrid , DiskSpaceCollection , LoadingView , FileSizeCell ) {
return Marionette . Layout . extend ( {
return Marionette . Layout . extend ( {
template : 'System/DiskSpace/DiskSpaceTemplate' ,
template : 'System/DiskSpace/DiskSpaceTemplate' ,
@ -17,35 +18,32 @@ define([
{
{
name : 'driveLetter' ,
name : 'driveLetter' ,
label : 'Drive' ,
label : 'Drive' ,
cell : Backgrid . StringCell
cell : 'string'
} ,
} ,
{
{
name : 'freeSpace' ,
name : 'freeSpace' ,
label : 'Free Space' ,
label : 'Free Space' ,
cell : Backgrid . StringCell
cell : FileSizeCell ,
sortable : true
} ,
} ,
{
{
name : 'totalSpace' ,
name : 'totalSpace' ,
label : 'Total Space' ,
label : 'Total Space' ,
cell : Backgrid . StringCell
cell : FileSizeCell ,
sortable : true
}
}
] ,
] ,
initialize : function ( ) {
initialize : function ( ) {
this . collection = new DiskSpaceCollection ( ) ;
this . collection = new DiskSpaceCollection ( ) ;
this . collectionPromise = this . collection . fetch ( ) ;
this . listenTo ( this . collection , 'sync' , this . _showTable ) ;
vent . on ( vent . Events . CommandComplete , this . _commandComplete , this ) ;
} ,
} ,
onRender : function ( ) {
onRender : function ( ) {
this . grid . show ( new LoadingView ( ) ) ;
this . grid . show ( new LoadingView ( ) ) ;
} ,
} ,
onShow : function ( ) {
onShow : function ( ) {
var self = this ;
this . collection . fetch ( ) ;
this . collectionPromise . done ( function ( ) {
self . _showTable ( ) ;
} ) ;
} ,
} ,
_showTable : function ( ) {
_showTable : function ( ) {
this . grid . show ( new Backgrid . Grid ( {
this . grid . show ( new Backgrid . Grid ( {