@@ -75,6 +75,41 @@ qx.Class.define("osparc.store.Study", {
7575 return osparc . data . Resources . fetch ( "studies" , "patch" , params ) ;
7676 } ,
7777
78+ patchStudyData : function ( studyData , fieldKey , value ) {
79+ if ( osparc . data . model . Study . OwnPatch . includes ( fieldKey ) ) {
80+ console . error ( fieldKey , "has it's own PATCH path" ) ;
81+ return null ;
82+ }
83+
84+ const patchData = { } ;
85+ patchData [ fieldKey ] = value ;
86+ return this . patchStudy ( studyData [ "uuid" ] , patchData )
87+ . then ( ( ) => {
88+ studyData [ fieldKey ] = value ;
89+ // A bit hacky, but it's not sent back to the backend
90+ studyData [ "lastChangeDate" ] = new Date ( ) . toISOString ( ) ;
91+ } ) ;
92+ } ,
93+
94+ patchTemplateType : function ( templateId , templateType ) {
95+ const patchData = {
96+ "templateType" : templateType ,
97+ } ;
98+ return this . patchStudy ( templateId , patchData )
99+ . catch ( err => osparc . FlashMessenger . logError ( err ) ) ;
100+ } ,
101+
102+ updateMetadata : function ( studyId , metadata ) {
103+ const params = {
104+ url : {
105+ studyId,
106+ } ,
107+ data : metadata
108+ } ;
109+ osparc . data . Resources . fetch ( "studies" , "updateMetadata" , params )
110+ . catch ( err => console . error ( err ) ) ;
111+ } ,
112+
78113 trashStudy : function ( studyId ) {
79114 const params = {
80115 url : {
@@ -118,30 +153,6 @@ qx.Class.define("osparc.store.Study", {
118153 return osparc . data . Resources . fetch ( "studies" , "moveToFolder" , params ) ;
119154 } ,
120155
121- patchStudyData : function ( studyData , fieldKey , value ) {
122- if ( osparc . data . model . Study . OwnPatch . includes ( fieldKey ) ) {
123- console . error ( fieldKey , "has it's own PATCH path" ) ;
124- return null ;
125- }
126-
127- const patchData = { } ;
128- patchData [ fieldKey ] = value ;
129- return this . patchStudy ( studyData [ "uuid" ] , patchData )
130- . then ( ( ) => {
131- studyData [ fieldKey ] = value ;
132- // A bit hacky, but it's not sent back to the backend
133- studyData [ "lastChangeDate" ] = new Date ( ) . toISOString ( ) ;
134- } ) ;
135- } ,
136-
137- patchTemplateType : function ( templateId , templateType ) {
138- const patchData = {
139- "templateType" : templateType ,
140- } ;
141- return this . patchStudy ( templateId , patchData )
142- . catch ( err => osparc . FlashMessenger . logError ( err ) ) ;
143- } ,
144-
145156 patchNodeData : function ( studyData , nodeId , patchData ) {
146157 const params = {
147158 url : {
0 commit comments