@@ -27,28 +27,6 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", {
2727 UPDATE_BUTTON : Object . keys ( osparc . metadata . ServicesInStudy . GRID_POS ) . length + 2
2828 } ,
2929
30- anyServiceDeprecated : function ( studyData ) {
31- if ( "workbench" in studyData ) {
32- return osparc . study . Utils . isWorkbenchDeprecated ( studyData [ "workbench" ] ) ;
33- }
34- return false ;
35- } ,
36-
37- anyServiceRetired : function ( studyData ) {
38- if ( "workbench" in studyData ) {
39- return osparc . study . Utils . isWorkbenchRetired ( studyData [ "workbench" ] ) ;
40- }
41- return false ;
42- } ,
43-
44- anyServiceInaccessible : function ( studyData ) {
45- if ( "workbench" in studyData ) {
46- const inaccessibles = osparc . study . Utils . getInaccessibleServices ( studyData [ "workbench" ] ) ;
47- return inaccessibles . length ;
48- }
49- return false ;
50- } ,
51-
5230 updatableNodeIds : function ( workbench ) {
5331 const nodeIds = [ ] ;
5432 for ( const nodeId in workbench ) {
@@ -84,53 +62,54 @@ qx.Class.define("osparc.metadata.ServicesInStudyUpdate", {
8462
8563 _populateIntroText : async function ( ) {
8664 const canIWrite = osparc . data . model . Study . canIWrite ( this . _studyData [ "accessRights" ] ) ;
87- const labels = [ ] ;
88- if ( this . self ( ) . anyServiceInaccessible ( this . _studyData ) ) {
89- const inaccessibleText = this . tr ( "Some services' information is not accessible. Please contact service owner:" ) ;
90- const inaccessibleLabel = new qx . ui . basic . Label ( inaccessibleText ) ;
91- labels . push ( inaccessibleLabel ) ;
92- }
93- if ( this . self ( ) . anyServiceRetired ( this . _studyData ) ) {
94- let retiredText = this . tr ( "Services marked in red are retired: you cannot use them anymore." ) ;
95- if ( canIWrite ) {
96- retiredText += "<br>" + this . tr ( "If the Update button is disabled, they might require manual intervention to be updated:" ) ;
97- retiredText += "<br>- " + this . tr ( "Open the study" ) ;
98- retiredText += "<br>- " + this . tr ( "Click on the retired service, download the data" ) ;
99- retiredText += "<br>- " + this . tr ( "Upload the data to an updated version" ) ;
100- }
101- const retiredLabel = new qx . ui . basic . Label ( retiredText ) ;
102- labels . push ( retiredLabel ) ;
103- }
104- if ( this . self ( ) . anyServiceDeprecated ( this . _studyData ) ) {
105- let deprecatedText = this . tr ( "Services marked in yellow are deprecated, they will be retired soon." ) ;
106- if ( canIWrite ) {
107- deprecatedText += " " + this . tr ( "They can be updated by pressing the Update button." ) ;
65+ const introText = new qx . ui . basic . Label ( ) . set ( {
66+ font : "text-14" ,
67+ rich : true
68+ } ) ;
69+ this . _introText . add ( introText ) ;
70+ let msg = "" ;
71+ const params = {
72+ url : {
73+ studyId : this . _studyData [ "uuid" ]
10874 }
109- const deprecatedLabel = new qx . ui . basic . Label ( deprecatedText ) ;
110- labels . push ( deprecatedLabel ) ;
111- }
112- const updatableServices = this . self ( ) . updatableNodeIds ( this . _studyData [ "workbench" ] ) ;
113- if ( updatableServices . length === 0 ) {
114- const upToDateText = this . tr ( "All services are up to date to their latest compatible version." ) ;
115- const upToDateLabel = new qx . ui . basic . Label ( upToDateText ) ;
116- labels . push ( upToDateLabel ) ;
117- } else if ( canIWrite ) {
118- const useUpdateButtonText = this . tr ( "Use the Update buttons to bring the services to their latest compatible version." ) ;
119- const useUpdateButtonLabel = new qx . ui . basic . Label ( useUpdateButtonText ) ;
120- labels . push ( useUpdateButtonLabel ) ;
121- } else {
122- const notUpToDateText = this . tr ( "Some services are not up to date." ) ;
123- const notUpToDateLabel = new qx . ui . basic . Label ( notUpToDateText ) ;
124- labels . push ( notUpToDateLabel ) ;
125- }
75+ } ;
76+ osparc . data . Resources . fetch ( "studies" , "getServices" , params )
77+ . then ( resp => {
78+ const services = resp [ "services" ] ;
79+ if ( osparc . study . Utils . getInaccessibleServices2 ( services ) ) {
80+ msg += this . tr ( "Some services' are not accessible. Please contact service owner:" ) ;
81+ msg += "<br><br>" ;
82+ }
83+ if ( osparc . study . Utils . anyServiceRetired ( services ) ) {
84+ msg += this . tr ( "Services marked in red are retired: you cannot use them anymore." ) ;
85+ if ( canIWrite ) {
86+ msg += "<br>" + this . tr ( "If the Update button is disabled, they might require manual intervention to be updated:" ) ;
87+ msg += "<br>- " + this . tr ( "Open the study" ) ;
88+ msg += "<br>- " + this . tr ( "Click on the retired service, download the data" ) ;
89+ msg += "<br>- " + this . tr ( "Upload the data to an updated version" ) ;
90+ }
91+ msg += "<br><br>" ;
92+ }
93+ if ( osparc . study . Utils . anyServiceDeprecated ( services ) ) {
94+ msg += this . tr ( "Services marked in yellow are deprecated, they will be retired soon." ) ;
95+ if ( canIWrite ) {
96+ msg += " " + this . tr ( "They can be updated by pressing the Update button." ) ;
97+ }
98+ msg += "<br><br>" ;
99+ }
100+ const anyServiceUpdatable = osparc . study . Utils . anyServiceUpdatable ( services ) ;
101+ if ( anyServiceUpdatable === false && msg === "" ) {
102+ msg += this . tr ( "All services are up to date to their latest compatible version." ) ;
103+ msg += "<br>" ;
104+ } else if ( canIWrite ) {
105+ msg += this . tr ( "Use the Update buttons to bring the services to their latest compatible version." ) ;
106+ msg += "<br>" ;
107+ } else {
108+ msg += this . tr ( "Some services are not up to date." ) ;
109+ }
126110
127- labels . forEach ( label => {
128- label . set ( {
129- font : "text-14" ,
130- rich : true
111+ introText . setValue ( msg ) ;
131112 } ) ;
132- this . _introText . add ( label ) ;
133- } ) ;
134113 } ,
135114
136115 __updateService : async function ( nodeId , key , version , button ) {
0 commit comments