1515
1616************************************************************************ */
1717
18- /**
19- *
20- */
18+ /* eslint-disable no-underscore-dangle */
2119
2220qx . Class . define ( "osparc.desktop.WorkbenchView" , {
2321 extend : qx . ui . splitpane . Pane ,
@@ -99,10 +97,8 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
9997 __nodesTree : null ,
10098 __storagePage : null ,
10199 __studyOptionsPage : null ,
102- __infoPage : null ,
103- __settingsPage : null ,
104- __outputsPage : null ,
105- __nodeOptionsPage : null ,
100+ __fileInfoPage : null ,
101+ __serviceOptionsPage : null ,
106102 __workbenchPanel : null ,
107103 __workbenchPanelPage : null ,
108104 __workbenchUI : null ,
@@ -399,24 +395,13 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
399395 studyOptionsPage . exclude ( ) ;
400396 tabViewSecondary . add ( studyOptionsPage ) ;
401397
402- const infoPage = this . __infoPage = this . __createTabPage ( "@FontAwesome5Solid/info" , this . tr ( "Information" ) ) ;
403- infoPage . exclude ( ) ;
404- tabViewSecondary . add ( infoPage ) ;
398+ const fileInfoPage = this . __fileInfoPage = this . __createTabPage ( "@FontAwesome5Solid/info" , this . tr ( "Information" ) ) ;
399+ fileInfoPage . exclude ( ) ;
400+ tabViewSecondary . add ( fileInfoPage ) ;
405401
406- const settingsPage = this . __settingsPage = this . __createTabPage ( "@FontAwesome5Solid/sign-in-alt" , this . tr ( "Settings" ) ) ;
407- settingsPage . exclude ( ) ;
408- tabViewSecondary . add ( settingsPage ) ;
409-
410- const outputsPage = this . __outputsPage = this . __createTabPage ( "@FontAwesome5Solid/sign-out-alt" , this . tr ( "Outputs" ) ) ;
411- osparc . utils . Utils . setIdToWidget ( outputsPage . getChildControl ( "button" ) , "outputsTabButton" ) ;
412- outputsPage . exclude ( ) ;
413- tabViewSecondary . add ( outputsPage ) ;
414-
415- const nodeOptionsPage = this . __nodeOptionsPage = this . __createTabPage ( "@FontAwesome5Solid/cogs" , this . tr ( "Service Options" ) ) ;
416- nodeOptionsPage . getLayout ( ) . setSpacing ( 20 ) ;
417- osparc . utils . Utils . setIdToWidget ( nodeOptionsPage . getChildControl ( "button" ) , "nodeOptionsTabButton" ) ;
418- nodeOptionsPage . exclude ( ) ;
419- tabViewSecondary . add ( nodeOptionsPage ) ;
402+ const serviceOptionsPage = this . __serviceOptionsPage = this . __createTabPage ( "@FontAwesome5Solid/exchange-alt" , this . tr ( "Service options" ) ) ;
403+ serviceOptionsPage . exclude ( ) ;
404+ tabViewSecondary . add ( serviceOptionsPage ) ;
420405
421406 this . __addTopBarSpacer ( topBar ) ;
422407
@@ -884,10 +869,8 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
884869 __populateSecondPanel : function ( node ) {
885870 [
886871 this . __studyOptionsPage ,
887- this . __infoPage ,
888- this . __settingsPage ,
889- this . __outputsPage ,
890- this . __nodeOptionsPage
872+ this . __fileInfoPage ,
873+ this . __serviceOptionsPage
891874 ] . forEach ( page => {
892875 page . removeAll ( ) ;
893876 page . getChildControl ( "button" ) . exclude ( ) ;
@@ -1079,21 +1062,21 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
10791062 __populateSecondPanelFilePicker : function ( filePicker ) {
10801063 const fpView = new osparc . file . FilePicker ( filePicker , "workbench" ) ;
10811064 if ( osparc . file . FilePicker . hasOutputAssigned ( filePicker . getOutputs ( ) ) ) {
1082- this . __infoPage . getChildControl ( "button" ) . show ( ) ;
1083- this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __infoPage ] ) ;
1065+ this . __fileInfoPage . getChildControl ( "button" ) . show ( ) ;
1066+ this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __fileInfoPage ] ) ;
10841067
1085- this . __infoPage . add ( fpView , {
1068+ this . __fileInfoPage . add ( fpView , {
10861069 flex : 1
10871070 } ) ;
10881071 } else {
10891072 // empty File Picker
10901073 const tabViewLeftPanel = this . getChildControl ( "side-panel-left-tabs" ) ;
10911074 tabViewLeftPanel . setSelection ( [ this . __storagePage ] ) ;
10921075
1093- this . __settingsPage . getChildControl ( "button" ) . show ( ) ;
1094- this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __settingsPage ] ) ;
1076+ this . __serviceOptionsPage . getChildControl ( "button" ) . show ( ) ;
1077+ this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __serviceOptionsPage ] ) ;
10951078
1096- this . __settingsPage . add ( fpView , {
1079+ this . __serviceOptionsPage . add ( fpView , {
10971080 flex : 1
10981081 } ) ;
10991082 }
@@ -1105,123 +1088,83 @@ qx.Class.define("osparc.desktop.WorkbenchView", {
11051088 } ,
11061089
11071090 __populateSecondPanelParameter : function ( parameter ) {
1108- this . __settingsPage . getChildControl ( "button" ) . show ( ) ;
1109- this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __settingsPage ] ) ;
1091+ this . __serviceOptionsPage . getChildControl ( "button" ) . show ( ) ;
1092+ this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __serviceOptionsPage ] ) ;
11101093
11111094 const view = new osparc . node . ParameterEditor ( parameter ) ;
11121095 view . buildForm ( false ) ;
1113- this . __settingsPage . add ( view , {
1096+ this . __serviceOptionsPage . add ( view , {
11141097 flex : 1
11151098 } ) ;
11161099 } ,
11171100
11181101 __populateSecondPanelNode : async function ( node ) {
1119- this . __settingsPage . getChildControl ( "button" ) . show ( ) ;
1120- this . __outputsPage . getChildControl ( "button " ) . show ( ) ;
1121- if ( ! [ this . __settingsPage , this . __outputsPage ] . includes ( this . getChildControl ( "side-panel-right-tabs" ) . getSelection ( ) [ 0 ] ) ) {
1122- this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __settingsPage ] ) ;
1123- }
1102+ this . __serviceOptionsPage . getChildControl ( "button" ) . show ( ) ;
1103+ this . getChildControl ( "side-panel-right-tabs " ) . setSelection ( [ this . __serviceOptionsPage ] ) ;
1104+
1105+ const spacing = 8 ;
1106+ const vBox = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( spacing * 2 ) ) ;
11241107
1108+ // INPUTS FORM
11251109 if ( node . isPropertyInitialized ( "propsForm" ) && node . getPropsForm ( ) ) {
1126- const scrollContainer = new qx . ui . container . Scroll ( ) ;
1127- scrollContainer . add ( node . getPropsForm ( ) ) ;
1128- this . __settingsPage . add ( scrollContainer , {
1129- flex : 1
1110+ const inputsForm = node . getPropsForm ( ) . set ( {
1111+ allowGrowX : false
1112+ } ) ;
1113+ const inputs = new osparc . desktop . PanelView ( this . tr ( "Inputs" ) , inputsForm ) ;
1114+ inputs . _innerContainer . set ( {
1115+ margin : spacing
11301116 } ) ;
1117+ vBox . add ( inputs ) ;
11311118 }
11321119
1120+ // OUTPUTS
1121+ const outputsBox = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( spacing ) ) ;
11331122 if ( node . hasOutputs ( ) ) {
11341123 const nodeOutputs = new osparc . widget . NodeOutputs ( node , node . getMetaData ( ) . outputs ) . set ( {
11351124 offerProbes : true
11361125 } ) ;
1137- this . __outputsPage . add ( nodeOutputs ) ;
1126+ outputsBox . add ( nodeOutputs ) ;
11381127 }
1139-
1140- const outputFilesBtn = new qx . ui . form . Button ( this . tr ( "Service data" ) , "@FontAwesome5Solid/folder-open/14" ) . set ( {
1141- allowGrowX : false
1128+ const outputs = new osparc . desktop . PanelView ( this . tr ( "Outputs" ) , outputsBox ) ;
1129+ outputs . _innerContainer . set ( {
1130+ margin : spacing
11421131 } ) ;
1143- osparc . utils . Utils . setIdToWidget ( outputFilesBtn , "nodeOutputFilesBtn" ) ;
1144- outputFilesBtn . addListener ( "execute" , ( ) => osparc . node . BaseNodeView . openNodeDataManager ( node ) ) ;
1145- this . __outputsPage . add ( outputFilesBtn ) ;
1146-
1147- const showPage = await this . __populateNodeOptionsPage ( node ) ;
1148- // if it's deprecated or retired show the LifeCycleView right away
1149- if ( showPage && node . hasOutputs ( ) && node . isDynamic ( ) && ( node . isDeprecated ( ) || node . isRetired ( ) ) ) {
1150- this . getChildControl ( "side-panel-right-tabs" ) . setSelection ( [ this . __nodeOptionsPage ] ) ;
1132+ vBox . add ( outputs ) ;
1133+
1134+ // NODE OPTIONS
1135+ const nodeOptions = this . __getNodeOptionsPage ( node ) ;
1136+ if ( nodeOptions ) {
1137+ const options = new osparc . desktop . PanelView ( this . tr ( "Options" ) , nodeOptions ) ;
1138+ options . _innerContainer . set ( {
1139+ margin : spacing
1140+ } ) ;
1141+ nodeOptions . bind ( "visibility" , options , "visibility" ) ;
1142+ vBox . add ( options ) ;
11511143 }
1144+
1145+ const scrollContainer = new qx . ui . container . Scroll ( ) ;
1146+ scrollContainer . add ( vBox ) ;
1147+ this . __serviceOptionsPage . add ( scrollContainer , {
1148+ flex : 1
1149+ } ) ;
11521150 } ,
11531151
1154- __populateNodeOptionsPage : async function ( node ) {
1152+ __getNodeOptionsPage : function ( node ) {
11551153 if ( osparc . auth . Data . getInstance ( ) . isGuest ( ) ) {
1156- return false ;
1157- }
1158-
1159- let showPage = false ;
1160- let showStartStopButton = false ;
1161-
1162- const sections = [ ] ;
1163-
1164- // Life Cycle
1165- if (
1166- node . isDynamic ( ) &&
1167- ( node . isUpdatable ( ) || node . isDeprecated ( ) || node . isRetired ( ) )
1168- ) {
1169- const lifeCycleView = new osparc . node . LifeCycleView ( node ) ;
1170- node . addListener ( "versionChanged" , ( ) => this . __populateSecondPanel ( node ) ) ;
1171- sections . push ( lifeCycleView ) ;
1172- showPage = true ;
1173- showStartStopButton = true ;
1154+ return null ;
11741155 }
11751156
1176- // Boot Options
1177- if ( node . hasBootModes ( ) ) {
1178- const bootOptionsView = new osparc . node . BootOptionsView ( node ) ;
1179- node . addListener ( "bootModeChanged" , ( ) => this . __populateSecondPanel ( node ) ) ;
1180- sections . push ( bootOptionsView ) ;
1181- showPage = true ;
1182- showStartStopButton = true ;
1183- }
1184-
1185- // Update Resource Limits
1186- if (
1187- await osparc . data . Permissions . getInstance ( ) . checkCanDo ( "override_services_specifications" ) &&
1188- ( node . isComputational ( ) || node . isDynamic ( ) )
1189- ) {
1190- const updateResourceLimitsView = new osparc . node . UpdateResourceLimitsView ( node ) ;
1191- node . addListener ( "limitsChanged" , ( ) => this . __populateSecondPanel ( node ) ) ;
1192- sections . push ( updateResourceLimitsView ) ;
1193- showPage = true ;
1194- showStartStopButton |= node . isDynamic ( ) ;
1195- }
1196-
1197- this . __nodeOptionsPage . removeAll ( ) ;
1198- if ( showPage ) {
1199- const introLayout = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 10 ) ) ;
1200- const title = new qx . ui . basic . Label ( this . tr ( "Service Options" ) ) . set ( {
1201- font : "text-14"
1202- } ) ;
1203- introLayout . add ( title ) ;
1204-
1205- if ( showStartStopButton ) {
1206- // Only available to dynamic services
1207- const instructions = new qx . ui . basic . Label ( this . tr ( "To proceed with the following actions, the service needs to be Stopped." ) ) . set ( {
1208- font : "text-13" ,
1209- rich : true ,
1210- wrap : true
1211- } ) ;
1212- introLayout . add ( instructions ) ;
1213-
1214- const startStopButton = new osparc . node . StartStopButton ( ) ;
1215- startStopButton . setNode ( node ) ;
1216- introLayout . add ( startStopButton ) ;
1217- }
1218-
1219- this . __nodeOptionsPage . add ( introLayout ) ;
1220- sections . forEach ( section => this . __nodeOptionsPage . add ( section ) ) ;
1221- this . __nodeOptionsPage . getChildControl ( "button" ) . setVisibility ( showPage ? "visible" : "excluded" ) ;
1222- }
1157+ const nodeOptions = new osparc . widget . NodeOptions ( node ) ;
1158+ nodeOptions . buildLayout ( ) ;
1159+ [
1160+ "versionChanged" ,
1161+ "bootModeChanged" ,
1162+ "limitsChanged"
1163+ ] . forEach ( eventName => {
1164+ nodeOptions . addListener ( eventName , ( ) => this . __populateSecondPanel ( node ) ) ;
1165+ } ) ;
12231166
1224- return showPage ;
1167+ return nodeOptions ;
12251168 } ,
12261169
12271170 getLogger : function ( ) {
0 commit comments