Skip to content

Commit 9198b5f

Browse files
committed
Display Maintenance message
1 parent 3b37e29 commit 9198b5f

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

services/static-webserver/client/source/class/osparc/MaintenanceTracker.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,27 +129,28 @@ qx.Class.define("osparc.MaintenanceTracker", {
129129
}
130130
},
131131

132+
__messageToRibbon: function(closable) {
133+
this.__removeRibbonMessage();
134+
const text = this.__getText();
135+
const notification = new osparc.notification.RibbonNotification(text, "maintenance", closable);
136+
osparc.notification.RibbonNotifications.getInstance().addNotification(notification);
137+
this.__lastRibbonMessage = notification;
138+
},
139+
132140
__scheduleRibbonMessage: function() {
133141
const now = new Date();
134142
const diffClosable = this.getStart().getTime() - now.getTime() - this.self().CLOSABLE_WARN_IN_ADVANCE;
135143
const diffPermanent = this.getStart().getTime() - now.getTime() - this.self().PERMANENT_WARN_IN_ADVANCE;
136144

137-
const messageToRibbon = closable => {
138-
this.__removeRibbonMessage();
139-
const text = this.__getText();
140-
const notification = new osparc.notification.RibbonNotification(text, "maintenance", closable);
141-
osparc.notification.RibbonNotifications.getInstance().addNotification(notification);
142-
this.__lastRibbonMessage = notification;
143-
};
144145
if (diffClosable < 0) {
145-
messageToRibbon(true);
146+
this.__messageToRibbon(true);
146147
} else {
147-
setTimeout(() => messageToRibbon(true), diffClosable);
148+
setTimeout(() => this.__messageToRibbon(true), diffClosable);
148149
}
149150
if (diffPermanent < 0) {
150-
messageToRibbon(false);
151+
this.__messageToRibbon(false);
151152
} else {
152-
setTimeout(() => messageToRibbon(false), diffPermanent);
153+
setTimeout(() => this.__messageToRibbon(false), diffPermanent);
153154
}
154155
},
155156

services/static-webserver/client/source/class/osparc/admin/Maintenance.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ qx.Class.define("osparc.admin.Maintenance", {
5353
const respLabel = new qx.ui.basic.Label(this.tr("Start and End dates go in UTC time zone"));
5454
vBox.add(respLabel);
5555

56+
const displayMaintenanceBtn = new qx.ui.form.Button(this.tr("Display Maintenance message"));
57+
// eslint-disable-next-line no-underscore-dangle
58+
displayMaintenanceBtn.addListener("execute", () => osparc.MaintenanceTracker.getInstance().__messageToRibbon(true));
59+
vBox.add(displayMaintenanceBtn);
60+
5661
const invitationRespViewer = new osparc.ui.basic.JsonTreeWidget(data, "maintenance-data");
5762
const container = new qx.ui.container.Scroll();
5863
container.add(invitationRespViewer);

0 commit comments

Comments
 (0)