@@ -108,101 +108,23 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
108108 } ,
109109
110110 statics : {
111- NODE_INDEX : {
112- LABEL : 0 ,
113- CALC : 1 ,
114- HALO : 2 ,
115- } ,
116-
117111 DISCLAIMER_TIME : 50000 ,
118112
119- createTaskLayout : function ( label ) {
120- const layout = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 5 ) . set ( {
121- alignY : "middle"
122- } ) ) . set ( {
123- padding : [ 2 , 10 ]
124- } ) ;
125-
126- const lbl = new qx . ui . basic . Label ( label ) ;
127- lbl . set ( {
128- textColor : "text" ,
129- allowGrowX : true ,
130- allowShrinkX : true ,
131- } ) ;
132- layout . addAt ( lbl , this . NODE_INDEX . LABEL , {
133- flex : 1
134- } ) ;
135-
136- const iconContainer = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( ) . set ( {
137- alignY : "middle" ,
138- alignX : "center" ,
139- } ) ) . set ( {
140- height : 18 ,
141- width : 18 ,
142- allowGrowY : false ,
143- allowGrowX : false ,
144- } ) ;
145- const icon = new qx . ui . basic . Image ( "@FontAwesome5Solid/check/10" ) . set ( {
146- visibility : "excluded" ,
147- textColor : "success"
148- } ) ;
149- iconContainer . add ( icon ) ;
150- const progressColor = qx . theme . manager . Color . getInstance ( ) . resolve ( "progressbar" ) ;
151- osparc . service . StatusUI . getStatusHalo ( iconContainer , progressColor , 0 ) ;
152- layout . addAt ( iconContainer , this . NODE_INDEX . HALO ) ;
153-
154- const progressState = new qx . ui . basic . Label ( ) ;
155- progressState . set ( {
156- value : qx . locale . Manager . tr ( "Waiting ..." ) ,
157- textColor : "text" ,
158- allowGrowX : true ,
159- allowShrinkX : true
113+ createDisclaimerText : function ( ) {
114+ const disclaimerText = new qx . ui . basic . Atom ( ) . set ( {
115+ label : qx . locale . Manager . tr ( "Please be patient, this process can take a few minutes ..." ) ,
116+ padding : [ 20 , 10 ] ,
117+ gap : 15 ,
118+ icon : "@FontAwesome5Solid/exclamation-triangle/16" ,
119+ backgroundColor : "disclaimer-bg" ,
120+ textColor : "info" ,
121+ alignX : "center"
160122 } ) ;
161- layout . addAt ( progressState , this . NODE_INDEX . CALC ) ;
162-
163- return layout ;
164- } ,
165-
166- createProgressBar : function ( max = 1 ) {
167- const progressBar = new qx . ui . indicator . ProgressBar ( ) . set ( {
168- maximum : max ,
169- height : 4 ,
170- margin : 0 ,
171- padding : 0
123+ disclaimerText . getChildControl ( "icon" ) . set ( {
124+ textColor : "info"
172125 } ) ;
173- progressBar . exclude ( ) ;
174- return progressBar ;
175- } ,
176-
177- updateProgressLabel : function ( atom , { value, progressLabel} ) {
178- if ( [ null , undefined ] . includes ( value ) ) {
179- return ;
180- }
181-
182- if ( atom ) {
183- const halo = atom . getChildren ( ) [ this . NODE_INDEX . HALO ] ;
184- const icon = halo . getChildren ( ) [ 0 ] ;
185- icon . setVisibility ( value === 1 ? "visible" : "excluded" ) ;
186- const progressColor = qx . theme . manager . Color . getInstance ( ) . resolve ( "progressbar" )
187- osparc . service . StatusUI . getStatusHalo ( halo , progressColor , value * 100 ) ;
188-
189- const label = atom . getChildren ( ) [ this . NODE_INDEX . CALC ] ;
190- label . setValue ( progressLabel ) ;
191- }
126+ return disclaimerText ;
192127 } ,
193-
194- progressReceived : function ( pBar , value ) {
195- if ( [ null , undefined ] . includes ( value ) ) {
196- return ;
197- }
198-
199- if ( pBar ) {
200- pBar . set ( {
201- value,
202- visibility : ( value >= 0 ) ? "visible" : "excluded"
203- } ) ;
204- }
205- }
206128 } ,
207129
208130 members : {
@@ -290,60 +212,21 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
290212 __initLayout : function ( ) {
291213 this . __mainLoadingPage = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 8 ) ) ;
292214
293-
294- const sequenceLoadingPage = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 9 ) ) . set ( {
295- backgroundColor : "window-popup-background" ,
296- paddingBottom : 8
297- } ) ;
298-
299- const progressTitle = new qx . ui . basic . Label ( qx . locale . Manager . tr ( "LOADING ..." ) ) . set ( {
300- font : "text-12" ,
301- alignX : "center" ,
302- alignY : "middle" ,
303- margin : 10
304- } ) ;
215+ const sequenceLoadingPage = new osparc . widget . ProgressSequence ( qx . locale . Manager . tr ( "LOADING ..." ) ) ;
305216 const nTasks = 6 ;
306- const overallPBar = this . __overallProgressBar = this . self ( ) . createProgressBar ( nTasks ) ;
307- sequenceLoadingPage . add ( progressTitle ) ;
308- sequenceLoadingPage . add ( overallPBar ) ;
309-
310- const disclaimerText = this . __disclaimerText = new qx . ui . basic . Atom ( ) . set ( {
311- label : qx . locale . Manager . tr ( "Please be patient, this process can take a few minutes ..." ) ,
312- padding : [ 20 , 10 ] ,
313- gap : 15 ,
314- icon : "@FontAwesome5Solid/exclamation-triangle/16" ,
315- backgroundColor : "disclaimer-bg" ,
316- textColor : "info" ,
317- alignX : "center"
318- } ) ;
319- const icon = disclaimerText . getChildControl ( "icon" ) ;
320- icon . set ( {
321- textColor : "info"
322- } )
323- disclaimerText . exclude ( ) ;
324-
325-
326- const scalingLayout = this . __clusterUpScalingLayout = this . self ( ) . createTaskLayout ( qx . locale . Manager . tr ( "Increasing system capacity ..." ) ) ;
327- sequenceLoadingPage . add ( scalingLayout ) ;
328-
329- const pullingSidecarLayout = this . __pullingSidecarLayout = this . self ( ) . createTaskLayout ( qx . locale . Manager . tr ( "Setting up key components ..." ) ) ;
330- sequenceLoadingPage . add ( pullingSidecarLayout ) ;
331-
332- const pullingOutputsLayout = this . __pullingOutputsLayout = this . self ( ) . createTaskLayout ( qx . locale . Manager . tr ( "Retrieving your output data ..." ) ) ;
333- sequenceLoadingPage . add ( pullingOutputsLayout ) ;
334-
335- const pullingStateLayout = this . __pullingStateLayout = this . self ( ) . createTaskLayout ( qx . locale . Manager . tr ( "Retrieving your work ..." ) ) ;
336- sequenceLoadingPage . add ( pullingStateLayout ) ;
337-
338- const pullingImagesLayout = this . __pullingImagesLayout = this . self ( ) . createTaskLayout ( qx . locale . Manager . tr ( "Installing software ..." ) ) ;
339- sequenceLoadingPage . add ( pullingImagesLayout ) ;
340-
341- const pullingInputsLayout = this . __pullingInputsLayout = this . self ( ) . createTaskLayout ( qx . locale . Manager . tr ( "Retrieving your input data ..." ) ) ;
342- sequenceLoadingPage . add ( pullingInputsLayout ) ;
343-
217+ this . __overallProgressBar = sequenceLoadingPage . addOverallProgressBar ( nTasks ) ;
218+ this . __clusterUpScalingLayout = sequenceLoadingPage . addNewTask ( qx . locale . Manager . tr ( "Increasing system capacity ..." ) ) ;
219+ this . __pullingSidecarLayout = sequenceLoadingPage . addNewTask ( qx . locale . Manager . tr ( "Setting up key components ..." ) ) ;
220+ this . __pullingOutputsLayout = sequenceLoadingPage . addNewTask ( qx . locale . Manager . tr ( "Retrieving your output data ..." ) ) ;
221+ this . __pullingStateLayout = sequenceLoadingPage . addNewTask ( qx . locale . Manager . tr ( "Retrieving your work ..." ) ) ;
222+ this . __pullingImagesLayout = sequenceLoadingPage . addNewTask ( qx . locale . Manager . tr ( "Installing software ..." ) ) ;
223+ this . __pullingInputsLayout = sequenceLoadingPage . addNewTask ( qx . locale . Manager . tr ( "Retrieving your input data ..." ) ) ;
344224 this . __mainLoadingPage . addAt ( sequenceLoadingPage , 0 , {
345225 flex : 1
346226 } ) ;
227+
228+ const disclaimerText = this . __disclaimerText = this . self ( ) . createDisclaimerText ( ) ;
229+ disclaimerText . exclude ( ) ;
347230 this . __mainLoadingPage . addAt ( this . __disclaimerText , 1 , {
348231 flex : 1
349232 } ) ;
@@ -366,11 +249,11 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
366249 this . __disclaimerText . exclude ( ) ;
367250 }
368251
369- this . self ( ) . progressReceived ( this . __overallProgressBar , value ) ;
252+ osparc . widget . ProgressSequence . progressUpdate ( this . __overallProgressBar , value ) ;
370253 } ,
371254
372255 __applyClusterUpScaling : function ( value ) {
373- this . self ( ) . updateProgressLabel ( this . __clusterUpScalingLayout , value ) ;
256+ osparc . widget . ProgressSequence . updateTaskProgress ( this . __clusterUpScalingLayout , value ) ;
374257
375258 this . __computeOverallProgress ( ) ;
376259 } ,
@@ -380,7 +263,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
380263 const defaultEndVals = this . getDefaultEndValues ( ) ;
381264 this . setClusterUpScaling ( defaultEndVals ) ;
382265 }
383- this . self ( ) . updateProgressLabel ( this . __pullingSidecarLayout , value ) ;
266+ osparc . widget . ProgressSequence . updateTaskProgress ( this . __pullingSidecarLayout , value ) ;
384267
385268 this . __computeOverallProgress ( ) ;
386269 } ,
@@ -390,7 +273,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
390273 const defaultEndVals = this . getDefaultEndValues ( ) ;
391274 this . setSidecarPulling ( defaultEndVals ) ;
392275 }
393- this . self ( ) . updateProgressLabel ( this . __pullingOutputsLayout , value ) ;
276+ osparc . widget . ProgressSequence . updateTaskProgress ( this . __pullingOutputsLayout , value ) ;
394277
395278 this . __computeOverallProgress ( ) ;
396279 } ,
@@ -400,7 +283,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
400283 const defaultEndVals = this . getDefaultEndValues ( ) ;
401284 this . setSidecarPulling ( defaultEndVals ) ;
402285 }
403- this . self ( ) . updateProgressLabel ( this . __pullingStateLayout , value ) ;
286+ osparc . widget . ProgressSequence . updateTaskProgress ( this . __pullingStateLayout , value ) ;
404287
405288 this . __computeOverallProgress ( ) ;
406289 } ,
@@ -410,7 +293,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
410293 const defaultEndVals = this . getDefaultEndValues ( ) ;
411294 this . setSidecarPulling ( defaultEndVals ) ;
412295 }
413- this . self ( ) . updateProgressLabel ( this . __pullingImagesLayout , value ) ;
296+ osparc . widget . ProgressSequence . updateTaskProgress ( this . __pullingImagesLayout , value ) ;
414297
415298 this . __computeOverallProgress ( ) ;
416299 } ,
@@ -420,7 +303,7 @@ qx.Class.define("osparc.data.model.NodeProgressSequence", {
420303 const defaultEndVals = this . getDefaultEndValues ( ) ;
421304 this . setSidecarPulling ( defaultEndVals ) ;
422305 }
423- this . self ( ) . updateProgressLabel ( this . __pullingInputsLayout , value ) ;
306+ osparc . widget . ProgressSequence . updateTaskProgress ( this . __pullingInputsLayout , value ) ;
424307
425308 this . __computeOverallProgress ( ) ;
426309 }
0 commit comments