File tree Expand file tree Collapse file tree 1 file changed +43
-1
lines changed
services/static-webserver/client/source/class/osparc/dashboard Expand file tree Collapse file tree 1 file changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -112,11 +112,53 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
112112 this . fireEvent ( "trashContext" ) ;
113113 }
114114 } ) ;
115+ this . evaluateTrashEmpty ( ) ;
115116 return trashButton ;
116117 } ,
117118
118119 evaluateTrashEmpty : function ( ) {
119-
120+ const studiesParams = {
121+ url : {
122+ offset : 0 ,
123+ limit : 1 , // just one
124+ orderBy : JSON . stringify ( {
125+ field : "last_change_date" ,
126+ direction : "desc"
127+ } ) ,
128+ }
129+ } ;
130+ const foldersParams = {
131+ url : {
132+ offset : 0 ,
133+ limit : 1 , // just one
134+ orderBy : JSON . stringify ( {
135+ field : "modified_at" ,
136+ direction : "desc"
137+ } ) ,
138+ }
139+ } ;
140+ const workspacesParams = {
141+ url : {
142+ offset : 0 ,
143+ limit : 1 , // just one
144+ orderBy : JSON . stringify ( {
145+ field : "modified_at" ,
146+ direction : "desc"
147+ } ) ,
148+ }
149+ } ;
150+ Promise . all ( [
151+ osparc . data . Resources . fetch ( "studies" , "getPageTrashed" , studiesParams ) ,
152+ osparc . data . Resources . fetch ( "folders" , "getPageTrashed" , foldersParams ) ,
153+ osparc . data . Resources . fetch ( "workspaces" , "getPageTrashed" , workspacesParams ) ,
154+ ] )
155+ . then ( values => {
156+ const nTrashedStudies = values [ 0 ] . length ;
157+ const nTrashedFolders = values [ 1 ] . length ;
158+ const nTrashedWorkspaces = values [ 2 ] . length ;
159+ this . setTrashEmpty ( ( nTrashedStudies + nTrashedFolders + nTrashedWorkspaces ) === 0 ) ;
160+ } )
161+ . catch ( err => console . error ( err ) ) ;
120162 } ,
121163
122164 setTrashEmpty : function ( isEmpty ) {
You can’t perform that action at this time.
0 commit comments