@@ -84,31 +84,12 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", {
8484
8585 this . addListener ( "dragover" , e => {
8686 if ( e . supportsType ( "osparc-moveStudy" ) ) {
87- let compatible = false ;
88- const studyData = e . getData ( "osparc-moveStudy" ) [ "studyDataOrigin" ] ;
89- // Compatibility checks:
90- // - My workspace
91- // - None
92- // - Shared workspace
93- // - write access on workspace
94- const workspaceId = studyData [ "workspaceId" ] ;
95- if ( workspaceId ) {
96- const workspace = osparc . store . Workspaces . getInstance ( ) . getWorkspace ( workspaceId ) ;
97- if ( workspace ) {
98- compatible = workspace . getMyAccessRights ( ) [ "write" ] ;
99- }
100- } else {
101- compatible = true ;
102- }
103- if ( compatible ) {
104- this . getChildControl ( "icon" ) . setTextColor ( "strong-main" ) ;
105- } else {
106- this . getChildControl ( "icon" ) . setTextColor ( "danger-red" ) ;
107- // do not allow
87+ const folderDest = this . __getFolder ( ) ;
88+ if ( folderDest == null ) {
10889 e . preventDefault ( ) ;
90+ return ;
10991 }
110- const dragWidget = osparc . dashboard . DragWidget . getInstance ( ) ;
111- dragWidget . setDropAllowed ( compatible ) ;
92+ osparc . dashboard . DragDropHelpers . moveStudy . dragOver ( e , folderDest , this ) ;
11293 } else if ( e . supportsType ( "osparc-moveFolder" ) ) {
11394 const folderDest = this . __getFolder ( ) ;
11495 if ( folderDest == null ) {
@@ -127,24 +108,15 @@ qx.Class.define("osparc.dashboard.WorkspacesAndFoldersTreeItem", {
127108 } ) ;
128109
129110 this . addListener ( "drop" , e => {
111+ const folderDest = this . __getFolder ( ) ;
112+ if ( folderDest == null ) {
113+ e . preventDefault ( ) ;
114+ return ;
115+ }
130116 if ( e . supportsType ( "osparc-moveStudy" ) ) {
131- const folderDest = this . __getFolder ( ) ;
132- if ( folderDest == null ) {
133- e . preventDefault ( ) ;
134- return ;
135- }
136- const studyData = e . getData ( "osparc-moveStudy" ) [ "studyDataOrigin" ] ;
137- const studyToFolderData = {
138- studyData,
139- destFolderId : folderDest . getFolderId ( ) ,
140- } ;
117+ const studyToFolderData = osparc . dashboard . DragDropHelpers . moveStudy . drop ( e , folderDest ) ;
141118 this . fireDataEvent ( "studyToFolderRequested" , studyToFolderData ) ;
142119 } else if ( e . supportsType ( "osparc-moveFolder" ) ) {
143- const folderDest = this . __getFolder ( ) ;
144- if ( folderDest == null ) {
145- e . preventDefault ( ) ;
146- return ;
147- }
148120 const folderToFolderData = osparc . dashboard . DragDropHelpers . moveFolder . drop ( e , folderDest ) ;
149121 this . fireDataEvent ( "folderToFolderRequested" , folderToFolderData ) ;
150122 }
0 commit comments