@@ -79,18 +79,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
7979 apply : "__applyDescription"
8080 } ,
8181
82- myAccessRights : {
83- check : "Object" ,
84- nullable : true ,
85- apply : "__applyMyAccessRights"
86- } ,
87-
88- accessRights : {
89- check : "Object" ,
90- nullable : true ,
91- apply : "__applyAccessRights"
92- } ,
93-
9482 lastModified : {
9583 check : "Date" ,
9684 nullable : true ,
@@ -103,7 +91,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
10391 let control ;
10492 switch ( id ) {
10593 case "icon" : {
106- control = new osparc . dashboard . FolderWithSharedIcon ( ) . set ( {
94+ control = new qx . ui . basic . Image ( ) . set ( {
95+ source : "@FontAwesome5Solid/folder/26" ,
10796 anonymous : true ,
10897 height : 40 ,
10998 padding : 5
@@ -155,9 +144,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
155144 folder . bind ( "parentId" , this , "parentFolderId" ) ;
156145 folder . bind ( "name" , this , "title" ) ;
157146 folder . bind ( "description" , this , "description" ) ;
158- folder . bind ( "accessRights" , this , "accessRights" ) ;
159147 folder . bind ( "lastModified" , this , "lastModified" ) ;
160- folder . bind ( "myAccessRights" , this , "myAccessRights" ) ;
148+
149+ this . __addMenuButton ( ) ;
161150 } ,
162151
163152 __applyTitle : function ( value ) {
@@ -177,73 +166,51 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
177166 }
178167 } ,
179168
180- __applyMyAccessRights : function ( value ) {
181- if ( value && value [ "delete" ] ) {
182- const menuButton = this . getChildControl ( "menu-button" ) ;
183- menuButton . setVisibility ( "visible" ) ;
169+ __addMenuButton : function ( ) {
170+ const menuButton = this . getChildControl ( "menu-button" ) ;
171+ menuButton . setVisibility ( "visible" ) ;
184172
185- const menu = new qx . ui . menu . Menu ( ) . set ( {
186- position : "bottom-right"
187- } ) ;
173+ const menu = new qx . ui . menu . Menu ( ) . set ( {
174+ position : "bottom-right"
175+ } ) ;
188176
189- const editButton = new qx . ui . menu . Button ( this . tr ( "Rename..." ) , "@FontAwesome5Solid/pencil-alt/12" ) ;
190- editButton . addListener ( "execute" , ( ) => {
191- const folder = this . getFolder ( ) ;
192- const newFolder = false ;
193- const folderEditor = new osparc . editor . FolderEditor ( newFolder ) . set ( {
194- label : folder . getName ( ) ,
195- description : folder . getDescription ( )
196- } ) ;
197- const title = this . tr ( "Edit Folder" ) ;
198- const win = osparc . ui . window . Window . popUpInWindow ( folderEditor , title , 300 , 200 ) ;
199- folderEditor . addListener ( "updateFolder" , ( ) => {
200- const newName = folderEditor . getLabel ( ) ;
201- const newDescription = folderEditor . getDescription ( ) ;
202- const updateData = {
203- "name" : newName ,
204- "description" : newDescription
205- } ;
206- osparc . data . model . Folder . putFolder ( this . getFolderId ( ) , updateData )
207- . then ( ( ) => {
208- folder . set ( {
209- name : newName ,
210- description : newDescription
211- } ) ;
212- this . fireDataEvent ( "folderUpdated" , folder . getFolderId ( ) ) ;
213- } )
214- . catch ( err => console . error ( err ) ) ;
215- win . close ( ) ;
216- } ) ;
217- folderEditor . addListener ( "cancel" , ( ) => win . close ( ) ) ;
177+ const editButton = new qx . ui . menu . Button ( this . tr ( "Rename..." ) , "@FontAwesome5Solid/pencil-alt/12" ) ;
178+ editButton . addListener ( "execute" , ( ) => {
179+ const folder = this . getFolder ( ) ;
180+ const newFolder = false ;
181+ const folderEditor = new osparc . editor . FolderEditor ( newFolder ) . set ( {
182+ label : folder . getName ( ) ,
183+ description : folder . getDescription ( )
218184 } ) ;
219- menu . add ( editButton ) ;
220-
221- const shareButton = new qx . ui . menu . Button ( this . tr ( "Share..." ) , "@FontAwesome5Solid/share-alt/12" ) ;
222- shareButton . addListener ( "execute" , ( ) => this . __openShareWith ( ) , this ) ;
223- menu . add ( shareButton ) ;
224-
225- menu . addSeparator ( ) ;
226-
227- const deleteButton = new qx . ui . menu . Button ( this . tr ( "Delete" ) , "@FontAwesome5Solid/trash/12" ) ;
228- deleteButton . addListener ( "execute" , ( ) => this . __deleteStudyRequested ( ) , this ) ;
229- menu . add ( deleteButton ) ;
185+ const title = this . tr ( "Edit Folder" ) ;
186+ const win = osparc . ui . window . Window . popUpInWindow ( folderEditor , title , 300 , 200 ) ;
187+ folderEditor . addListener ( "updateFolder" , ( ) => {
188+ const newName = folderEditor . getLabel ( ) ;
189+ const newDescription = folderEditor . getDescription ( ) ;
190+ const updateData = {
191+ "name" : newName ,
192+ "description" : newDescription
193+ } ;
194+ osparc . data . model . Folder . putFolder ( this . getFolderId ( ) , updateData )
195+ . then ( ( ) => {
196+ folder . set ( {
197+ name : newName ,
198+ description : newDescription
199+ } ) ;
200+ this . fireDataEvent ( "folderUpdated" , folder . getFolderId ( ) ) ;
201+ } )
202+ . catch ( err => console . error ( err ) ) ;
203+ win . close ( ) ;
204+ } ) ;
205+ folderEditor . addListener ( "cancel" , ( ) => win . close ( ) ) ;
206+ } ) ;
207+ menu . add ( editButton ) ;
230208
231- menuButton . setMenu ( menu ) ;
232- }
233- } ,
209+ const deleteButton = new qx . ui . menu . Button ( this . tr ( "Delete" ) , "@FontAwesome5Solid/trash/12" ) ;
210+ deleteButton . addListener ( "execute" , ( ) => this . __deleteStudyRequested ( ) , this ) ;
211+ menu . add ( deleteButton ) ;
234212
235- __applyAccessRights : function ( value ) {
236- if ( value && Object . keys ( value ) . length ) {
237- const shareIcon = this . getChildControl ( "icon" ) . getChildControl ( "shared-icon" ) ;
238- // if it's not shared don't show the share icon
239- shareIcon . addListener ( "changeSource" , e => {
240- const newSource = e . getData ( ) ;
241- shareIcon . set ( {
242- visibility : newSource . includes ( osparc . dashboard . CardBase . SHARE_ICON ) ? "hidden" : "visible"
243- } ) ;
244- } ) ;
245- osparc . dashboard . CardBase . populateShareIcon ( shareIcon , value ) ;
246- }
213+ menuButton . setMenu ( menu ) ;
247214 } ,
248215
249216 __updateTooltip : function ( ) {
@@ -260,18 +227,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
260227 this . setValue ( false ) ;
261228 } ,
262229
263- __openShareWith : function ( ) {
264- const disableShare = true ;
265- if ( disableShare ) {
266- osparc . FlashMessenger . getInstance ( ) . logAs ( this . tr ( "Not yet implemented" ) , "WARNING" ) ;
267- } else {
268- const title = this . tr ( "Share Folder" ) ;
269- const permissionsView = new osparc . share . CollaboratorsFolder ( this . getFolder ( ) ) ;
270- osparc . ui . window . Window . popUpInWindow ( permissionsView , title ) ;
271- permissionsView . addListener ( "updateAccessRights" , ( ) => this . __applyAccessRights ( this . getFolder ( ) . getAccessRights ( ) ) , this ) ;
272- }
273- } ,
274-
275230 __deleteStudyRequested : function ( ) {
276231 const msg = this . tr ( "Are you sure you want to delete" ) + " <b>" + this . getTitle ( ) + "</b>?" ;
277232 const confirmationWin = new osparc . ui . window . Confirmation ( msg ) . set ( {
0 commit comments