RA-#22 Show info on preloader while first sync

This commit is contained in:
ostertun
2020-10-05 13:56:47 +02:00
parent eaa08ba301
commit c9a90eb77c

View File

@@ -511,6 +511,7 @@ function sync() {
if (typeof onAfterSync === 'function') { if (typeof onAfterSync === 'function') {
onAfterSync(); onAfterSync();
} }
removeSyncInfoToPreloader();
runPageScript(); runPageScript();
} }
}, 100); }, 100);
@@ -946,6 +947,7 @@ function initDatabase() {
if (lastSync > 0) { if (lastSync > 0) {
runPageScript(); runPageScript();
} else { } else {
addSyncInfoToPreloader();
db.transaction('update_times', 'readwrite').objectStore('update_times').put({ table: 'loggedin', status: isLoggedIn() }); db.transaction('update_times', 'readwrite').objectStore('update_times').put({ table: 'loggedin', status: isLoggedIn() });
} }
}; };
@@ -1056,3 +1058,20 @@ function resetDb() {
hideLoader(); hideLoader();
} }
} }
function addSyncInfoToPreloader() {
var preloader = document.getElementById('preloader');
var div = document.createElement('div');
div.id = 'preloader-sync-info';
div.classList = 'rounded-s shadow-m bg-highlight m-3 p-3';
div.style.position = 'fixed';
div.style.top = 0;
div.style.left = 0;
div.style.right = 0;
div.innerHTML = '<h2 class="color-white">Datenbank SYNC</h2><p class="mb-0 color-white">Um Dir alle n&ouml;tigen Informationen anzeigen zu k&ouml;nnen, m&uuml;ssen wir die Datenbank synchronisieren.<br>Dies kann einen Moment dauern. Bitte habe etwas Geduld. Beim n&auml;chsten &Ouml;ffnen geht es schneller.</p>';
preloader.appendChild(div);
}
function removeSyncInfoToPreloader() {
$('#preloader-sync-info').remove();
}