mirror of https://github.com/vladmandic/automatic
Fix error message display
parent
6971f3438c
commit
9f9d67713d
|
|
@ -183,6 +183,7 @@ class SimpleProgressBar {
|
|||
#hideTimeout = null;
|
||||
#interval = null;
|
||||
#max = 0;
|
||||
#errorState = false;
|
||||
/** @type {Set} */
|
||||
#monitoredSet;
|
||||
|
||||
|
|
@ -199,6 +200,7 @@ class SimpleProgressBar {
|
|||
}
|
||||
|
||||
start(total) {
|
||||
if (this.#errorState) return;
|
||||
this.clear();
|
||||
this.#max = total;
|
||||
this.#interval = setInterval(() => {
|
||||
|
|
@ -215,6 +217,7 @@ class SimpleProgressBar {
|
|||
|
||||
clear() {
|
||||
this.#stop();
|
||||
this.#errorState = false;
|
||||
clearTimeout(this.#hideTimeout);
|
||||
this.#hideTimeout = null;
|
||||
this.#container.style.display = 'none';
|
||||
|
|
@ -224,12 +227,17 @@ class SimpleProgressBar {
|
|||
}
|
||||
|
||||
error(message) {
|
||||
this.#stop();
|
||||
clearTimeout(this.#hideTimeout);
|
||||
this.#text.textContent = message;
|
||||
this.#hideTimeout = setTimeout(() => {
|
||||
this.clear();
|
||||
}, 2000);
|
||||
if (!this.#errorState) {
|
||||
this.#errorState = true;
|
||||
this.#stop();
|
||||
this.#container.style.display = 'block';
|
||||
this.#visible = true;
|
||||
clearTimeout(this.#hideTimeout);
|
||||
this.#text.textContent = message;
|
||||
this.#hideTimeout = setTimeout(() => {
|
||||
this.clear();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
#update(loaded, max) {
|
||||
|
|
@ -653,6 +661,7 @@ async function addSeparators() {
|
|||
const gallerySendImage = (_images) => [currentImage]; // invoked by gradio button
|
||||
|
||||
async function getHash(str) {
|
||||
galleryProgressBar.error('File hash error');
|
||||
try {
|
||||
let hex = '';
|
||||
const strBuf = new TextEncoder().encode(str);
|
||||
|
|
|
|||
Loading…
Reference in New Issue