Skip to content

Commit

Permalink
Merge pull request #103 from mdenet/98-executing-program-popup-does-n…
Browse files Browse the repository at this point in the history
…ot-automatically-disappear

Clear notifications for activities on handling a response and added icon
  • Loading branch information
barnettwilliam authored Nov 9, 2023
2 parents b0193a5 + 8574c4e commit 7ca97fb
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions platform/src/Playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,8 @@ function handleResponseActionFunction(action, requestPromise){
var response = JSON.parse(responseText);
var outputPanel = panels.find( pn => pn.id == action.output.id);

Metro.notify.killAll();

if (response.hasOwnProperty("error")) {
consolePanel.setError(response.error);
} else {
Expand All @@ -662,8 +664,7 @@ function handleResponseActionFunction(action, requestPromise){

if (response.editorUrl) {
// Language workbench
Metro.notify.killAll();
longNotification("Building editor...");
longNotification("Building editor");
checkEditorReady( response.editorStatusUrl, response.editorUrl, action.source.editorPanel, action.source.editorActivity);


Expand Down Expand Up @@ -737,8 +738,6 @@ function handleResponseActionFunction(action, requestPromise){
}

}

//Metro.notify.killAll();
});

}
Expand Down Expand Up @@ -809,18 +808,22 @@ function runAction(source, sourceButton) {
longNotification("Executing program");
}

function notification(title, message, cls="light"){
const crossIcon = "<div class=\"default-icon-cross\" style=\"float:right\"></div>"
Metro.notify.create(crossIcon + "<b>" + title + "</b>" + "<br>" + message + "<br>", null, {keepOpen: true, cls: cls, width: 300});
}

function longNotification(title, cls="light") {
Metro.notify.create("<b>" + title + "...</b><br>This may take a few seconds to complete if the back end is not warmed up.", null, {keepOpen: true, cls: cls, width: 300});
notification(title + "...", "This may take a few seconds to complete if the back end is not warmed up.", cls);
}

function successNotification(message, cls="light") {
Metro.notify.create("<b>Success:</b> "+ message +"<br>", null, {keepOpen: true, cls: cls, width: 300});
notification("Success:", message, cls);
}

function errorNotification(message) {
console.log("ERROR: " + message);
Metro.notify.create("<b>Error:</b> "+ message +"<br>", null, {keepOpen: true, cls: "bg-red fg-white", width: 300});
notification("Error:", message, "bg-red fg-white");
}


Expand Down

0 comments on commit 7ca97fb

Please sign in to comment.