Add cheese to all toasts.

This commit is contained in:
Stephan Porada 2020-01-17 15:10:11 +01:00
parent e5928731ec
commit cc52744109

View File

@ -233,13 +233,7 @@
socket.emit("corpus_analysis", queryData);
queryLoadingElement.classList.remove("hide");
queryResultsTableElement.classList.add("hide");
let toast = M.toast({"html": `<span>Query has been sent!</span><button class="btn-flat toast-action red-text" data-action="close"><i class="material-icons">close</i></button>`});
let toastActionElement = toast.el.querySelector(".toast-action[data-action='close']");
if (toastActionElement) {
toastActionElement.addEventListener("click", function() {
toast.dismiss();
});
}
toast("Query has been sent!")
});
socket.on("corpus_analysis", function(message) {
@ -256,23 +250,11 @@
if (message === null) {
queryResultsTableElement.classList.add("hide");
let toast = M.toast({"classes": "red", "html": `<span>No results for this query!</span><button class="btn-flat toast-action white-text" data-action="close"><i class="material-icons">close</i></button>`});
let toastActionElement = toast.el.querySelector(".toast-action[data-action='close']");
if (toastActionElement) {
toastActionElement.addEventListener("click", function() {
toast.dismiss();
});
}
toast("No results for this query!")
return;
} else if (message === "CQI_CQP_ERROR_GENERAL") {
queryResultsTableElement.classList.add("hide");
let toast = M.toast({"classes": "red", "html": `<span>Invalid query entered!</span><button class="btn-flat toast-action white-text" data-action="close"><i class="material-icons">close</i></button>`});
let toastActionElement = toast.el.querySelector(".toast-action[data-action='close']");
if (toastActionElement) {
toastActionElement.addEventListener("click", function() {
toast.dismiss();
});
}
toast("Invalid query entered!", "red");
return;
} else {
total_nr_matches = message["total_nr_matches"];