Skip to content

Commit 34892ae

Browse files
authored
🎨 [Frontend] Enh: Show pending service_message in loading page (#6570)
1 parent 0180753 commit 34892ae

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

services/static-webserver/client/source/class/osparc/data/model/IframeHandler.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ qx.Class.define("osparc.data.model.IframeHandler", {
115115
const nodeStatus = node.getStatus();
116116
const sequenceWidget = nodeStatus.getProgressSequence().getWidgetForLoadingPage();
117117
nodeStatus.bind("interactive", sequenceWidget, "visibility", {
118-
converter: state => ["starting", "pulling", "pending", "connecting"].includes(state) ? "visible" : "excluded"
118+
converter: state => ["pending", "pulling", "starting", "connecting"].includes(state) ? "visible" : "excluded"
119119
});
120120
loadingPage.addExtraWidget(sequenceWidget);
121121

@@ -189,6 +189,8 @@ qx.Class.define("osparc.data.model.IframeHandler", {
189189
const nodeId = data["service_uuid"];
190190
const node = this.getNode();
191191
const status = node.getStatus();
192+
const loadingPage = this.getLoadingPage();
193+
loadingPage.clearMessages();
192194
switch (serviceState) {
193195
case "idle": {
194196
status.setInteractive(serviceState);
@@ -200,8 +202,14 @@ qx.Class.define("osparc.data.model.IframeHandler", {
200202
}
201203
case "pending": {
202204
if (data["service_message"]) {
203-
const serviceName = node.getLabel();
204205
const serviceMessage = data["service_message"];
206+
loadingPage.setMessages([serviceMessage]);
207+
// show pending messages only after 10"
208+
loadingPage.getMessageLabels().forEach(label => label.exclude());
209+
setTimeout(() => {
210+
loadingPage.getMessageLabels().forEach(label => label.show());
211+
}, 10000);
212+
const serviceName = node.getLabel();
205213
const msg = `The service "${serviceName}" is waiting for available ` +
206214
`resources. Please inform support and provide the following message ` +
207215
`in case this does not resolve in a few minutes: "${nodeId}" ` +

services/static-webserver/client/source/class/osparc/data/model/Node.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,11 @@ qx.Class.define("osparc.data.model.Node", {
11081108
if (nodeStatus.getProgressSequence()) {
11091109
nodeStatus.getProgressSequence().addProgressMessage(progressType, progressReport);
11101110
}
1111+
// there might be some pending ``service_message`` still shown, remove it
1112+
if (this.getIframeHandler()) {
1113+
const loadingPage = this.getIframeHandler().getLoadingPage();
1114+
loadingPage.clearMessages();
1115+
}
11111116
},
11121117

11131118
attachHandlersToStartButton: function(startButton) {

services/static-webserver/client/source/class/osparc/data/model/NodeProgressSequence.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
* [CLUSTER_UP_SCALING]
2323
* [SIDECARS_PULLING]
2424
* [SERVICE_OUTPUTS_PULLING, SERVICE_STATE_PULLING, SERVICE_IMAGES_PULLING] (notice the parallelism here)
25+
* [SERVICE_CONTAINERS_STARTING]
2526
* [SERVICE_INPUTS_PULLING] (when this happens, the frontend has already loaded the service and is displaying it to the user) I would still keep it as is, when we decide to make inputs pulling part of the boot sequence this will be helpful.
2627
*
2728
* This class provides different widgets that render the progress status

services/static-webserver/client/source/class/osparc/ui/message/Loading.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ qx.Class.define("osparc.ui.message.Loading", {
9393
__mainLayout: null,
9494
__thumbnail: null,
9595
__header: null,
96-
__messages: null,
96+
__messagesContainer: null,
9797
__extraWidgets: null,
9898
__maxButton: null,
9999

@@ -162,7 +162,7 @@ qx.Class.define("osparc.ui.message.Loading", {
162162
row: this.self().GRID_POS.WAITING
163163
});
164164

165-
const messages = this.__messages = new qx.ui.container.Composite(new qx.ui.layout.VBox(10).set({
165+
const messages = this.__messagesContainer = new qx.ui.container.Composite(new qx.ui.layout.VBox(10).set({
166166
alignX: "center"
167167
}));
168168
mainLayout.addAt(messages, {
@@ -236,24 +236,28 @@ qx.Class.define("osparc.ui.message.Loading", {
236236
rich: true,
237237
wrap: true
238238
});
239-
this.__messages.add(text);
239+
this.__messagesContainer.add(text);
240240
});
241-
this.__messages.show();
241+
this.__messagesContainer.show();
242242
} else {
243-
this.__messages.exclude();
243+
this.__messagesContainer.exclude();
244244
}
245245
},
246246

247247
clearMessages: function() {
248-
this.__messages.removeAll();
248+
this.__messagesContainer.removeAll();
249+
},
250+
251+
getMessageLabels: function() {
252+
return this.__messagesContainer.getChildren();
249253
},
250254

251255
addWidgetToMessages: function(widget) {
252256
if (widget) {
253-
this.__messages.add(widget);
254-
this.__messages.show();
257+
this.__messagesContainer.add(widget);
258+
this.__messagesContainer.show();
255259
} else {
256-
this.__messages.exclude();
260+
this.__messagesContainer.exclude();
257261
}
258262
},
259263

0 commit comments

Comments
 (0)