@@ -90,72 +90,85 @@ qx.Class.define("osparc.info.ServiceLarge", {
9090 vBox . add ( deprecated ) ;
9191 }
9292
93- const title = this . __createTitle ( ) ;
94- const titleLayout = this . __createViewWithEdit ( title , this . __openTitleEditor ) ;
95-
96- const extraInfo = this . __extraInfo ( ) ;
97- const extraInfoLayout = this . __createExtraInfo ( extraInfo ) ;
98-
99- const bounds = this . getBounds ( ) ;
100- const offset = 30 ;
101- const maxThumbnailHeight = extraInfo . length * 20 ;
102- let widgetWidth = bounds ? bounds . width - offset : 500 - offset ;
103- let thumbnailWidth = widgetWidth - 2 * osparc . info . CardLarge . PADDING - osparc . info . CardLarge . EXTRA_INFO_WIDTH ;
104- thumbnailWidth = Math . min ( thumbnailWidth - 20 , osparc . info . CardLarge . THUMBNAIL_MAX_WIDTH ) ;
105- const thumbnail = this . __createThumbnail ( thumbnailWidth , maxThumbnailHeight ) ;
106- const thumbnailLayout = this . __createViewWithEdit ( thumbnail , this . __openThumbnailEditor ) ;
107- thumbnailLayout . getLayout ( ) . set ( {
108- alignX : "center"
109- } ) ;
110-
111- const infoAndThumbnail = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 3 ) . set ( {
112- alignX : "center"
113- } ) ) ;
114- infoAndThumbnail . add ( extraInfoLayout ) ;
115- infoAndThumbnail . add ( thumbnailLayout , {
116- flex : 1
117- } ) ;
118-
119- let descriptionUi = null ;
120- if ( osparc . service . Utils . canIWrite ( this . getService ( ) [ "accessRights" ] ) ) {
121- descriptionUi = this . __createDescriptionUi ( ) ;
122- }
123-
12493 const description = this . __createDescription ( ) ;
12594 const editInTitle = this . __createViewWithEdit ( description . getChildren ( ) [ 0 ] , this . __openDescriptionEditor ) ;
12695 description . addAt ( editInTitle , 0 ) ;
12796
128- let resources = null ;
129- if ( ! osparc . desktop . credits . Utils . areWalletsEnabled ( ) ) {
130- resources = this . __createResources ( ) ;
131- }
132-
13397 const copyMetadataButton = new qx . ui . form . Button ( this . tr ( "Copy Raw metadata" ) , "@FontAwesome5Solid/copy/12" ) . set ( {
13498 allowGrowX : false
13599 } ) ;
136100 copyMetadataButton . addListener ( "execute" , ( ) => osparc . utils . Utils . copyTextToClipboard ( osparc . utils . Utils . prettifyJson ( this . getService ( ) ) ) , this ) ;
137101
138-
139102 if (
140103 this . getService ( ) [ "descriptionUi" ] &&
141104 ! osparc . service . Utils . canIWrite ( this . getService ( ) [ "accessRights" ] ) &&
142105 description . getChildren ( ) . length > 1
143106 ) {
144107 // Show description only
145108 vBox . add ( description . getChildren ( ) [ 1 ] ) ;
109+ // And copy Id buttons too
110+ const buttonsLayout = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 10 ) ) ;
111+ if ( this . getNodeId ( ) ) {
112+ const studyAlias = osparc . product . Utils . getStudyAlias ( { firstUpperCase : true } ) ;
113+ const copyStudyIdButton = new qx . ui . form . Button ( this . tr ( `Copy ${ studyAlias } Id` ) , "@FontAwesome5Solid/copy/12" ) . set ( {
114+ toolTipText : qx . locale . Manager . tr ( "Copy to clipboard" ) ,
115+ } ) ;
116+ copyStudyIdButton . addListener ( "execute" , this . __copyStudyIdToClipboard , this ) ;
117+ buttonsLayout . add ( copyStudyIdButton ) ;
118+ vBox . add ( buttonsLayout ) ;
119+
120+ const copyNodeIdButton = new qx . ui . form . Button ( this . tr ( "Copy Service Id" ) , "@FontAwesome5Solid/copy/12" ) . set ( {
121+ toolTipText : qx . locale . Manager . tr ( "Copy to clipboard" ) ,
122+ } ) ;
123+ copyNodeIdButton . addListener ( "execute" , this . __copyNodeIdToClipboard , this ) ;
124+ buttonsLayout . add ( copyNodeIdButton ) ;
125+ vBox . add ( buttonsLayout ) ;
126+ }
127+ // Also copyMetadataButton if tester
146128 if ( osparc . data . Permissions . getInstance ( ) . isTester ( ) ) {
147- // Also copyMetadataButton if tester
148- vBox . add ( copyMetadataButton ) ;
129+ buttonsLayout . add ( copyMetadataButton ) ;
130+ vBox . add ( buttonsLayout ) ;
149131 }
150132 } else {
133+ const title = this . __createTitle ( ) ;
134+ const titleLayout = this . __createViewWithEdit ( title , this . __openTitleEditor ) ;
151135 vBox . add ( titleLayout ) ;
136+
137+ const extraInfo = this . __extraInfo ( ) ;
138+ const extraInfoLayout = this . __createExtraInfo ( extraInfo ) ;
139+ const bounds = this . getBounds ( ) ;
140+ const offset = 30 ;
141+ const maxThumbnailHeight = extraInfo . length * 20 ;
142+ let widgetWidth = bounds ? bounds . width - offset : 500 - offset ;
143+ let thumbnailWidth = widgetWidth - 2 * osparc . info . CardLarge . PADDING - osparc . info . CardLarge . EXTRA_INFO_WIDTH ;
144+ thumbnailWidth = Math . min ( thumbnailWidth - 20 , osparc . info . CardLarge . THUMBNAIL_MAX_WIDTH ) ;
145+ const thumbnail = this . __createThumbnail ( thumbnailWidth , maxThumbnailHeight ) ;
146+ const thumbnailLayout = this . __createViewWithEdit ( thumbnail , this . __openThumbnailEditor ) ;
147+ thumbnailLayout . getLayout ( ) . set ( {
148+ alignX : "center"
149+ } ) ;
150+ const infoAndThumbnail = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 3 ) . set ( {
151+ alignX : "center"
152+ } ) ) ;
153+ infoAndThumbnail . add ( extraInfoLayout ) ;
154+ infoAndThumbnail . add ( thumbnailLayout , {
155+ flex : 1
156+ } ) ;
152157 vBox . add ( infoAndThumbnail ) ;
153- if ( descriptionUi ) {
154- vBox . add ( descriptionUi ) ;
158+
159+ if ( osparc . service . Utils . canIWrite ( this . getService ( ) [ "accessRights" ] ) ) {
160+ const descriptionUi = this . __createDescriptionUi ( ) ;
161+ if ( descriptionUi ) {
162+ vBox . add ( descriptionUi ) ;
163+ }
155164 }
156165 vBox . add ( description ) ;
157- if ( resources ) {
158- vBox . add ( resources ) ;
166+
167+ if ( ! osparc . desktop . credits . Utils . areWalletsEnabled ( ) ) {
168+ const resources = this . __createResources ( ) ;
169+ if ( resources ) {
170+ vBox . add ( resources ) ;
171+ }
159172 }
160173 vBox . add ( copyMetadataButton ) ;
161174 }
@@ -429,6 +442,10 @@ qx.Class.define("osparc.info.ServiceLarge", {
429442 titleEditor . open ( ) ;
430443 } ,
431444
445+ __copyStudyIdToClipboard : function ( ) {
446+ osparc . utils . Utils . copyTextToClipboard ( this . getStudyId ( ) ) ;
447+ } ,
448+
432449 __copyNodeIdToClipboard : function ( ) {
433450 osparc . utils . Utils . copyTextToClipboard ( this . getNodeId ( ) ) ;
434451 } ,
0 commit comments