Better upload image flow: more feedback for users

This commit is contained in:
Pieter Vander Vennet 2020-07-30 11:30:04 +02:00
parent e601807fc5
commit ab0d314330
8 changed files with 97 additions and 24 deletions

View file

@ -113,7 +113,7 @@ export class Imgur {
handleSuccessfullUpload(response.data.link);
}).fail((reason) => {
console.log("Uploading to IMGUR failed", reason);
onFail(reason)
onFail(reason);
});
}

View file

@ -10,8 +10,8 @@ export class LayerUpdater {
private _layers: FilteredLayer[];
public readonly runningQuery: UIEventSource<boolean> = new UIEventSource<boolean>(false);
/**
public readonly retries: UIEventSource<number> = new UIEventSource<number>(0);
/**
* The previous bounds for which the query has been run
*/
private previousBounds: Bounds;
@ -69,15 +69,16 @@ export class LayerUpdater {
}
private _failCount = 0;
private handleFail(reason: any) {
console.log("QUERY FAILED (retrying in 5 sec)", reason);
console.log(`QUERY FAILED (retrying in ${5 * this.retries.data} sec)`, reason);
this.previousBounds = undefined;
this.retries.data ++;
this.retries.ping();
const self = this;
this._failCount++;
window?.setTimeout(
function(){self.update()}, this._failCount * 5000
function(){self.update()}, this.retries.data * 5000
)
}