File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
services/static-webserver/client/source/class/osparc Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,10 @@ qx.Class.define("osparc.data.model.Study", {
259259 // ------ ignore for serializing ------
260260 } ,
261261
262+ events : {
263+ "updateStudyDocument" : "qx.event.type.Data" ,
264+ } ,
265+
262266 statics : {
263267 IgnoreSerializationProps : [
264268 "permalink" ,
@@ -375,6 +379,22 @@ qx.Class.define("osparc.data.model.Study", {
375379 } ,
376380
377381 members : {
382+ listenToStudyChanges : function ( ) {
383+ const propertyKeys = this . self ( ) . getProperties ( ) ;
384+ propertyKeys . forEach ( key => {
385+ if ( ! this . self ( ) . IgnoreSerializationProps . includes ( key ) ) {
386+ this . addListener ( "change" + qx . lang . String . firstUp ( key ) , e => {
387+ const data = e . getData ( ) ;
388+ this . fireDataEvent ( "updateStudyDocument" , {
389+ "op" : "replace" ,
390+ "path" : "/" + key ,
391+ "value" : data
392+ } ) ;
393+ } , this ) ;
394+ }
395+ } ) ;
396+ } ,
397+
378398 serialize : function ( clean = true ) {
379399 let jsonObject = { } ;
380400 const propertyKeys = this . self ( ) . getProperties ( ) ;
Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ qx.Class.define("osparc.desktop.StudyEditor", {
146146
147147 study . openStudy ( )
148148 . then ( studyData => {
149+ study . listenToStudyChanges ( ) ;
150+
149151 this . __setStudyDataInBackend ( studyData ) ;
150152
151153 this . __workbenchView . setStudy ( study ) ;
You can’t perform that action at this time.
0 commit comments