File tree Expand file tree Collapse file tree 2 files changed +59
-15
lines changed
services/static-webserver/client/source/class/osparc Expand file tree Collapse file tree 2 files changed +59
-15
lines changed Original file line number Diff line number Diff line change @@ -108,21 +108,16 @@ qx.Class.define("osparc.dashboard.NewPlusMenu", {
108108 } ,
109109
110110 __addNewStudyItems : async function ( ) {
111- await osparc . utils . Utils . fetchJSON ( "/resource/osparc/new_studies.json" )
112- . then ( newStudiesData => {
113- const product = osparc . product . Utils . getProductName ( )
114- if ( product in newStudiesData ) {
115- osparc . data . Resources . get ( "templates" )
116- . then ( templates => {
117- if ( templates ) {
118- const referencedTemplates = newStudiesData [ product ] ;
119- if ( referencedTemplates [ "linkedResource" ] === "templates" ) {
120- this . __addFromTemplateButtons ( referencedTemplates , templates ) ;
121- }
122- }
123- } ) ;
124- }
125- } ) ;
111+ await Promise . all ( [
112+ osparc . store . Products . getInstance ( ) . getNewStudyConfig ( ) ,
113+ osparc . data . Resources . get ( "templates" )
114+ ] ) . then ( values => {
115+ const newStudiesData = values [ 0 ] ;
116+ const templates = values [ 1 ] ;
117+ if ( newStudiesData [ "linkedResource" ] === "templates" ) {
118+ this . __addFromTemplateButtons ( newStudiesData , templates ) ;
119+ }
120+ } ) ;
126121 } ,
127122
128123 __addFromTemplateButtons : function ( referencedTemplates , templates ) {
Original file line number Diff line number Diff line change 1+ /* ************************************************************************
2+
3+ osparc - the simcore frontend
4+
5+ https://osparc.io
6+
7+ Copyright:
8+ 2025 IT'IS Foundation, https://itis.swiss
9+
10+ License:
11+ MIT: https://opensource.org/licenses/MIT
12+
13+ Authors:
14+ * Odei Maiz (odeimaiz)
15+
16+ ************************************************************************ */
17+
18+ qx . Class . define ( "osparc.store.Products" , {
19+ extend : qx . core . Object ,
20+ type : "singleton" ,
21+
22+ members : {
23+ __newStudyConfig : null ,
24+
25+ fetchNewStudyConfig : function ( ) {
26+ return osparc . utils . Utils . fetchJSON ( "/resource/osparc/new_studies.json" )
27+ . then ( newStudiesData => {
28+ const product = osparc . product . Utils . getProductName ( )
29+ if ( product in newStudiesData ) {
30+ this . __newStudyConfig = newStudiesData [ product ] ;
31+ return this . __newStudyConfig ;
32+ }
33+ return { } ;
34+ } )
35+ . catch ( console . error ) ;
36+ } ,
37+
38+ getNewStudyConfig : function ( ) {
39+ return new Promise ( resolve => {
40+ console . log ( "newStudyConfig" , this . __newStudyConfig ) ;
41+ if ( this . __newStudyConfig ) {
42+ resolve ( this . __newStudyConfig ) ;
43+ } else {
44+ resolve ( this . fetchNewStudyConfig ( ) )
45+ }
46+ } ) ;
47+ } ,
48+ }
49+ } ) ;
You can’t perform that action at this time.
0 commit comments