@@ -176,12 +176,12 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", {
176176 const workspaceIdOrigin = studyDataOrigin [ "workspaceId" ] ;
177177 const workspaceOrigin = osparc . store . Workspaces . getInstance ( ) . getWorkspace ( workspaceIdOrigin ) ;
178178 // Compatibility checks:
179- // - My Workspace -> Trash (1 )
179+ // - My Workspace -> Trash (0 )
180180 // - Delete on Study
181- // - Shared Workspace -> Trash (2 )
181+ // - Shared Workspace -> Trash (1 )
182182 // - Delete on Shared Workspace
183183 if ( workspaceIdOrigin === null ) { // (0)
184- compatible = osparc . data . model . Study . canIDelete ( studyDataOrigin [ "accessRights" ] )
184+ compatible = osparc . data . model . Study . canIDelete ( studyDataOrigin [ "accessRights" ] ) ;
185185 } else if ( workspaceIdOrigin !== null ) { // (1)
186186 compatible = workspaceOrigin . getMyAccessRights ( ) [ "delete" ] ;
187187 }
@@ -195,20 +195,41 @@ qx.Class.define("osparc.dashboard.DragDropHelpers", {
195195 dragWidget . setDropAllowed ( compatible ) ;
196196 } ,
197197
198- drop : function ( event , folderItem , destWorkspaceId , destFolderId ) {
199- const studyData = event . getData ( "osparc-moveStudy" ) [ "studyDataOrigin" ] ;
200- const studyToFolderData = {
201- studyData,
202- destWorkspaceId,
203- destFolderId,
204- } ;
205- folderItem . getChildControl ( "icon" ) . resetTextColor ( ) ;
206- return studyToFolderData ;
198+ drop : function ( event ) {
199+ return event . getData ( "osparc-moveStudy" ) [ "studyDataOrigin" ] ;
207200 } ,
208201 } ,
209202
210203 trashFolder : {
204+ dragOver : function ( event ) {
205+ let compatible = false ;
206+ const folderOrigin = event . getData ( "osparc-moveFolder" ) [ "folderOrigin" ] ;
207+ const workspaceIdOrigin = folderOrigin . getWorkspaceId ( ) ;
208+ const workspaceOrigin = osparc . store . Workspaces . getInstance ( ) . getWorkspace ( workspaceIdOrigin ) ;
209+ // Compatibility checks:
210+ // - My Workspace -> Trash (0)
211+ // - Yes
212+ // - Shared Workspace -> Trash (1)
213+ // - Delete on Shared Workspace
214+ if ( workspaceIdOrigin === null ) { // (0)
215+ compatible = true ;
216+ } else if ( workspaceIdOrigin !== null ) { // (1)
217+ compatible = workspaceOrigin . getMyAccessRights ( ) [ "delete" ] ;
218+ }
219+
220+ if ( ! compatible ) {
221+ // do not allow
222+ event . preventDefault ( ) ;
223+ }
224+
225+ const dragWidget = osparc . dashboard . DragWidget . getInstance ( ) ;
226+ dragWidget . setDropAllowed ( compatible ) ;
227+ } ,
211228
229+ drop : function ( event ) {
230+ const folderOrigin = event . getData ( "osparc-moveFolder" ) [ "folderOrigin" ] ;
231+ return folderOrigin . getFolderId ( ) ;
232+ } ,
212233 } ,
213234
214235 dragLeave : function ( item ) {
0 commit comments