@@ -93,6 +93,14 @@ qx.Class.define("osparc.data.model.Node", {
9393 nullable : false
9494 } ,
9595
96+ metadata : {
97+ check : "Object" ,
98+ init : null ,
99+ nullable : false ,
100+ event : "changeMetadata" ,
101+ apply : "__applyMetadata" ,
102+ } ,
103+
96104 label : {
97105 check : "String" ,
98106 init : "Node" ,
@@ -359,7 +367,6 @@ qx.Class.define("osparc.data.model.Node", {
359367 } ,
360368
361369 members : {
362- __metaData : null ,
363370 __inputNodes : null ,
364371 __inputsRequired : null ,
365372 __settingsForm : null ,
@@ -377,7 +384,7 @@ qx.Class.define("osparc.data.model.Node", {
377384 } ,
378385
379386 isInKey : function ( str ) {
380- if ( this . getMetaData ( ) === null ) {
387+ if ( this . getMetadata ( ) === null ) {
381388 return false ;
382389 }
383390 if ( this . getKey ( ) === null ) {
@@ -387,55 +394,51 @@ qx.Class.define("osparc.data.model.Node", {
387394 } ,
388395
389396 isFilePicker : function ( ) {
390- return osparc . data . model . Node . isFilePicker ( this . getMetaData ( ) ) ;
397+ return osparc . data . model . Node . isFilePicker ( this . getMetadata ( ) ) ;
391398 } ,
392399
393400 isParameter : function ( ) {
394- return osparc . data . model . Node . isParameter ( this . getMetaData ( ) ) ;
401+ return osparc . data . model . Node . isParameter ( this . getMetadata ( ) ) ;
395402 } ,
396403
397404 isIterator : function ( ) {
398- return osparc . data . model . Node . isIterator ( this . getMetaData ( ) ) ;
405+ return osparc . data . model . Node . isIterator ( this . getMetadata ( ) ) ;
399406 } ,
400407
401408 isProbe : function ( ) {
402- return osparc . data . model . Node . isProbe ( this . getMetaData ( ) ) ;
409+ return osparc . data . model . Node . isProbe ( this . getMetadata ( ) ) ;
403410 } ,
404411
405412 isDynamic : function ( ) {
406- return osparc . data . model . Node . isDynamic ( this . getMetaData ( ) ) ;
413+ return osparc . data . model . Node . isDynamic ( this . getMetadata ( ) ) ;
407414 } ,
408415
409416 isComputational : function ( ) {
410- return osparc . data . model . Node . isComputational ( this . getMetaData ( ) ) ;
417+ return osparc . data . model . Node . isComputational ( this . getMetadata ( ) ) ;
411418 } ,
412419
413420 isUnknown : function ( ) {
414- return osparc . data . model . Node . isUnknown ( this . getMetaData ( ) ) ;
421+ return osparc . data . model . Node . isUnknown ( this . getMetadata ( ) ) ;
415422 } ,
416423
417424 isUpdatable : function ( ) {
418- return osparc . data . model . Node . isUpdatable ( this . getMetaData ( ) ) ;
425+ return osparc . data . model . Node . isUpdatable ( this . getMetadata ( ) ) ;
419426 } ,
420427
421428 isDeprecated : function ( ) {
422- return osparc . data . model . Node . isDeprecated ( this . getMetaData ( ) ) ;
429+ return osparc . data . model . Node . isDeprecated ( this . getMetadata ( ) ) ;
423430 } ,
424431
425432 isRetired : function ( ) {
426- return osparc . data . model . Node . isRetired ( this . getMetaData ( ) ) ;
433+ return osparc . data . model . Node . isRetired ( this . getMetadata ( ) ) ;
427434 } ,
428435
429436 hasBootModes : function ( ) {
430- return osparc . data . model . Node . hasBootModes ( this . getMetaData ( ) ) ;
437+ return osparc . data . model . Node . hasBootModes ( this . getMetadata ( ) ) ;
431438 } ,
432439
433440 getMinVisibleInputs : function ( ) {
434- return osparc . data . model . Node . getMinVisibleInputs ( this . getMetaData ( ) ) ;
435- } ,
436-
437- getMetaData : function ( ) {
438- return this . __metaData ;
441+ return osparc . data . model . Node . getMinVisibleInputs ( this . getMetadata ( ) ) ;
439442 } ,
440443
441444 hasPropsForm : function ( ) {
@@ -488,7 +491,7 @@ qx.Class.define("osparc.data.model.Node", {
488491 this . __initNodeUiData = nodeUiData ;
489492 return osparc . store . Services . getService ( this . getKey ( ) , this . getVersion ( ) )
490493 . then ( serviceMetadata => {
491- this . populateWithMetadata ( serviceMetadata ) ;
494+ this . setMetadata ( serviceMetadata ) ;
492495 this . setInitState ( "metadataPopulated" ) ;
493496 this . populateNodeData ( nodeData ) ;
494497 // old place to store the position
@@ -505,8 +508,7 @@ qx.Class.define("osparc.data.model.Node", {
505508 } ) ;
506509 } ,
507510
508- populateWithMetadata : function ( metadata ) {
509- this . __metaData = metadata ;
511+ __applyMetadata : function ( metadata ) {
510512 if ( metadata ) {
511513 if ( metadata . name ) {
512514 this . setLabel ( metadata . name ) ;
@@ -842,8 +844,8 @@ qx.Class.define("osparc.data.model.Node", {
842844 // errors to port
843845 if ( loc . length > 2 ) {
844846 const portKey = loc [ 2 ] ;
845- if ( this . hasInputs ( ) && portKey in this . getMetaData ( ) [ "inputs" ] ) {
846- errorMsgData [ "msg" ] = this . getMetaData ( ) [ "inputs" ] [ portKey ] [ "label" ] + ": " + errorMsgData [ "msg" ] ;
847+ if ( this . hasInputs ( ) && portKey in this . getMetadata ( ) [ "inputs" ] ) {
848+ errorMsgData [ "msg" ] = this . getMetadata ( ) [ "inputs" ] [ portKey ] [ "label" ] + ": " + errorMsgData [ "msg" ] ;
847849 } else {
848850 errorMsgData [ "msg" ] = portKey + ": " + errorMsgData [ "msg" ] ;
849851 }
@@ -856,7 +858,7 @@ qx.Class.define("osparc.data.model.Node", {
856858 } ) ;
857859 } else if ( this . hasInputs ( ) ) {
858860 // reset port errors
859- Object . keys ( this . getMetaData ( ) [ "inputs" ] ) . forEach ( portKey => {
861+ Object . keys ( this . getMetadata ( ) [ "inputs" ] ) . forEach ( portKey => {
860862 this . getPropsForm ( ) . setPortErrorMessage ( portKey , null ) ;
861863 } ) ;
862864 }
@@ -1146,7 +1148,7 @@ qx.Class.define("osparc.data.model.Node", {
11461148
11471149 checkState : function ( ) {
11481150 if ( this . isDynamic ( ) ) {
1149- const metadata = this . getMetaData ( ) ;
1151+ const metadata = this . getMetadata ( ) ;
11501152 const msg = "Starting " + metadata . key + ":" + metadata . version + "..." ;
11511153 const msgData = {
11521154 nodeId : this . getNodeId ( ) ,
@@ -1165,7 +1167,7 @@ qx.Class.define("osparc.data.model.Node", {
11651167
11661168 stopDynamicService : function ( ) {
11671169 if ( this . isDynamic ( ) ) {
1168- const metadata = this . getMetaData ( ) ;
1170+ const metadata = this . getMetadata ( ) ;
11691171 const msg = "Stopping " + metadata . key + ":" + metadata . version + "..." ;
11701172 const msgData = {
11711173 nodeId : this . getNodeId ( ) ,
@@ -1300,7 +1302,7 @@ qx.Class.define("osparc.data.model.Node", {
13001302 key : newMetadata [ "key" ] ,
13011303 version : newMetadata [ "version" ] ,
13021304 } ) ;
1303- this . populateWithMetadata ( newMetadata ) ;
1305+ this . setMetadata ( newMetadata ) ;
13041306 this . populateNodeData ( ) ;
13051307 this . setLabel ( label ) ;
13061308 osparc . node . ParameterEditor . setParameterOutputValue ( this , value ) ;
@@ -1320,7 +1322,7 @@ qx.Class.define("osparc.data.model.Node", {
13201322 key : newMetadata [ "key" ] ,
13211323 version : newMetadata [ "version" ] ,
13221324 } ) ;
1323- this . populateWithMetadata ( newMetadata ) ;
1325+ this . setMetadata ( newMetadata ) ;
13241326 this . populateNodeData ( ) ;
13251327 this . setLabel ( label ) ;
13261328 this . __setInputData ( {
0 commit comments