Skip to content

Commit

Permalink
Clear notifications for activities on handling a response and added c…
Browse files Browse the repository at this point in the history
…ross icon to notifications to indicate they can be closed.
  • Loading branch information
barnettwilliam committed Nov 7, 2023
1 parent b0193a5 commit e3ab7fc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 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,7 +664,6 @@ function handleResponseActionFunction(action, requestPromise){

if (response.editorUrl) {
// Language workbench
Metro.notify.killAll();
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 @@ -811,16 +810,16 @@ function runAction(source, sourceButton) {


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});
Metro.notify.create( "<div class=\"default-icon-cross\" style=\"float:right\"></div>" + "<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});
}

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

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});
Metro.notify.create( "<div class=\"default-icon-cross\" style=\"float:right\"></div>" + "<b>Error:</b> "+ message + "<br>", null, {keepOpen: true, cls: "bg-red fg-white", width: 300});
}


Expand Down

0 comments on commit e3ab7fc

Please sign in to comment.