fix non disappearing persistent toast

This commit is contained in:
zadam 2019-10-28 20:26:40 +01:00
parent 5bba18191f
commit c4d5060a0b
5 changed files with 15 additions and 3 deletions

View file

@ -92,6 +92,7 @@ app.use((err, req, res, next) => {
err.message.includes("Invalid package")
|| (err.message.includes("Router not found for request") && err.message.includes("node_modules"))
|| (err.message.includes("Router not found for request") && err.message.includes(".js.map"))
|| (err.message.includes("Router not found for request") && err.message.includes(".css.map"))
)) {
// electron 6 outputs a lot of such errors which do not seem important
}

View file

@ -33,7 +33,7 @@ function toast(options) {
}
function showPersistent(options) {
let $toast = $("#toast-" + options.id);
let $toast = $("#toast-persistent-" + options.id);
if ($toast.length > 0) {
$toast.find('.toast-body').html(options.message);

View file

@ -173,7 +173,8 @@ subscribeToMessages(message => {
});
}
else if (message.type === 'sync-pull-finished') {
toastService.closePersistent('sync');
// this gives user a chance to see the toast in case of fast sync finish
setTimeout(() => toastService.closePersistent('sync'), 1000);
}
});

View file

@ -42,6 +42,10 @@ function request(req) {
}
}
if (req.url.includes(".js.map") || req.url.includes(".css.map")) {
return;
}
logger.info(req.method + " " + req.url);
}

View file

@ -117,6 +117,8 @@ async function doLogin() {
}
async function pullSync(syncContext) {
let appliedPulls = 0;
while (true) {
const lastSyncedPull = await getLastSyncedPull();
const changesUri = '/api/sync/changed?lastSyncId=' + lastSyncedPull;
@ -150,9 +152,13 @@ async function pullSync(syncContext) {
}
await setLastSyncedPull(rows[rows.length - 1].sync.id);
appliedPulls += rows.length;
}
ws.syncPullFinished();
if (appliedPulls > 0) {
ws.syncPullFinished();
}
log.info("Finished pull");
}