@@ -79,18 +79,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
79
79
apply : "__applyDescription"
80
80
} ,
81
81
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
-
94
82
lastModified : {
95
83
check : "Date" ,
96
84
nullable : true ,
@@ -103,7 +91,8 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
103
91
let control ;
104
92
switch ( id ) {
105
93
case "icon" : {
106
- control = new osparc . dashboard . FolderWithSharedIcon ( ) . set ( {
94
+ control = new qx . ui . basic . Image ( ) . set ( {
95
+ source : "@FontAwesome5Solid/folder/26" ,
107
96
anonymous : true ,
108
97
height : 40 ,
109
98
padding : 5
@@ -155,9 +144,9 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
155
144
folder . bind ( "parentId" , this , "parentFolderId" ) ;
156
145
folder . bind ( "name" , this , "title" ) ;
157
146
folder . bind ( "description" , this , "description" ) ;
158
- folder . bind ( "accessRights" , this , "accessRights" ) ;
159
147
folder . bind ( "lastModified" , this , "lastModified" ) ;
160
- folder . bind ( "myAccessRights" , this , "myAccessRights" ) ;
148
+
149
+ this . __addMenuButton ( ) ;
161
150
} ,
162
151
163
152
__applyTitle : function ( value ) {
@@ -177,73 +166,51 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
177
166
}
178
167
} ,
179
168
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" ) ;
184
172
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
+ } ) ;
188
176
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 ( )
218
184
} ) ;
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 ) ;
230
208
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 ) ;
234
212
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 ) ;
247
214
} ,
248
215
249
216
__updateTooltip : function ( ) {
@@ -260,18 +227,6 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {
260
227
this . setValue ( false ) ;
261
228
} ,
262
229
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
-
275
230
__deleteStudyRequested : function ( ) {
276
231
const msg = this . tr ( "Are you sure you want to delete" ) + " <b>" + this . getTitle ( ) + "</b>?" ;
277
232
const confirmationWin = new osparc . ui . window . Confirmation ( msg ) . set ( {
0 commit comments