@@ -68,6 +68,14 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
6868 } ) ;
6969 } ) ;
7070 break ;
71+ case "study-menu-share" :
72+ control = new qx . ui . menu . Button ( ) . set ( {
73+ label : this . tr ( "Share..." ) ,
74+ icon : "@FontAwesome5Solid/share-alt/14" ,
75+ ...this . self ( ) . BUTTON_OPTIONS
76+ } ) ;
77+ control . addListener ( "execute" , ( ) => this . __openAccessRights ( ) ) ;
78+ break ;
7179 case "study-menu-reload" :
7280 control = new qx . ui . menu . Button ( ) . set ( {
7381 label : this . tr ( "Reload" ) ,
@@ -100,6 +108,7 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
100108 const optionsMenu = new qx . ui . menu . Menu ( ) ;
101109 optionsMenu . setAppearance ( "menu-wider" ) ;
102110 optionsMenu . add ( this . getChildControl ( "study-menu-info" ) ) ;
111+ optionsMenu . add ( this . getChildControl ( "study-menu-share" ) ) ;
103112 optionsMenu . add ( this . getChildControl ( "study-menu-reload" ) ) ;
104113 optionsMenu . add ( this . getChildControl ( "study-menu-conversations" ) ) ;
105114 if ( osparc . product . Utils . showConvertToPipeline ( ) ) {
@@ -133,6 +142,17 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
133142 return control || this . base ( arguments , id ) ;
134143 } ,
135144
145+ __openAccessRights : function ( ) {
146+ const studyData = this . getStudy ( ) . serialize ( ) ;
147+ studyData [ "resourceType" ] = this . getStudy ( ) . getTemplateType ( ) ? "template" : "study" ;
148+ const collaboratorsView = osparc . info . StudyUtils . openAccessRights ( studyData ) ;
149+ collaboratorsView . addListener ( "updateAccessRights" , e => {
150+ const updatedData = e . getData ( ) ;
151+ this . getStudy ( ) . setAccessRights ( updatedData [ "accessRights" ] ) ;
152+ this . fireDataEvent ( "updateStudy" , updatedData ) ;
153+ } , this ) ;
154+ } ,
155+
136156 __reloadIFrame : function ( ) {
137157 const nodes = this . getStudy ( ) . getWorkbench ( ) . getNodes ( ) ;
138158 if ( Object . keys ( nodes ) . length === 1 ) {
@@ -145,6 +165,9 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
145165 const editTitle = this . getChildControl ( "edit-title-label" ) ;
146166 study . bind ( "name" , editTitle , "value" ) ;
147167
168+ const shareButton = this . getChildControl ( "study-menu-share" ) ;
169+ shareButton . setEnabled ( osparc . data . model . Study . canIWrite ( study . getAccessRights ( ) ) ) ;
170+
148171 const reloadButton = this . getChildControl ( "study-menu-reload" ) ;
149172 study . getUi ( ) . bind ( "mode" , reloadButton , "visibility" , {
150173 converter : mode => mode === "standalone" ? "visible" : "excluded"
0 commit comments