Skip to content

Commit

Permalink
Placebo flashing progress
Browse files Browse the repository at this point in the history
  • Loading branch information
pkendall64 committed Nov 25, 2021
1 parent 878e915 commit 339ff33
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions html/scan.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,26 @@ function completeHandler(type_suffix) {
_("progressBar_" + type_suffix).value = 0;
var data = JSON.parse(event.target.responseText);
if (data.status === 'ok') {
cuteAlert({
type: 'success',
title: "Update Succeeded",
message: data.msg
});
function show_message() {
cuteAlert({
type: 'success',
title: "Update Succeeded",
message: data.msg
});
}
// This is basically a delayed display of the success dialog with a fake progress
var percent = 0;
var interval = setInterval(()=>{
percent = percent + 1;
_("progressBar_" + type_suffix).value = percent;
_("status_" + type_suffix).innerHTML = percent + "% flashed... please wait";
if (percent == 100) {
clearInterval(interval);
_("status_" + type_suffix).innerHTML = "";
_("progressBar_" + type_suffix).value = 0;
show_message();
}
}, 100);
} else if (data.status === 'mismatch') {
cuteAlert({
type: 'question',
Expand Down Expand Up @@ -257,9 +272,9 @@ function errorHandler(type_suffix) {
_("status_" + type_suffix).innerHTML = "";
_("progressBar_" + type_suffix).value = 0;
cuteAlert({
type: "error",
title: "Update Failed",
message: event.target.responseText
type: "error",
title: "Update Failed",
message: event.target.responseText
});
}
}
Expand All @@ -269,9 +284,9 @@ function abortHandler(type_suffix) {
_("status_" + type_suffix).innerHTML = "";
_("progressBar_" + type_suffix).value = 0;
cuteAlert({
type: "info",
title: "Update Aborted",
message: event.target.responseText
type: "info",
title: "Update Aborted",
message: event.target.responseText
});
}
}
Expand Down

0 comments on commit 339ff33

Please sign in to comment.