X-Git-Url: https://git-public.kairo.at//?a=blobdiff_plain;f=js%2Fui.js;h=0c8af9aeebe0f22c290ad24ae4dc98511c597041;hb=740a3861f7b1132362e3006ab32ac5bd37174b76;hp=e20a4ae800238573b162bdfe942a66c634a38257;hpb=fd6126e2c117b7712e947151e72d37530034bd50;p=lantea.git diff --git a/js/ui.js b/js/ui.js index e20a4ae..0c8af9a 100644 --- a/js/ui.js +++ b/js/ui.js @@ -14,7 +14,7 @@ var gWaitCounter = 0; var gTrackUpdateInterval; var gAction, gActionLabel; var authData = null, userData = null; -var gBackendURL = "https://backend.lantea.kairo.at"; +var gBackendURL = "https://backend.lantea.kairo.at/"; var gAuthClientID = "lantea"; window.onload = function() { @@ -112,6 +112,9 @@ window.onresize = function() { } function startLogin() { + var logerr = document.getElementById("loginerror"); + logerr.classList.add("hidden"); + logerr.title = ""; if (!authData || !authData["state"]) { // We have no oAuth state, try to fetch it and call ourselves again if it worked. prepareLoginButton(function() { @@ -121,6 +124,8 @@ function startLogin() { else if (!userData) { // Only warn if we didn't actually end up being logged in. console.log("No OAuth state and fetching fails, client or server may be offline."); + logerr.classList.remove("hidden"); + logerr.title = "Client or server may be offline."; } }); return; @@ -132,6 +137,8 @@ function startLogin() { } else { console.log("Opening Sign In window failed."); + logerr.classList.remove("hidden"); + logerr.title = "Opening Sign-In window failed."; } } @@ -232,11 +239,15 @@ function initDB(aEvent) { request.onerror = function(event) { // Errors can be handled here. Error codes explain in: // https://developer.mozilla.org/en/IndexedDB/IDBDatabaseException#Constants - if (gDebug) - console.log("error opening mainDB: " + event.target.errorCode); + console.log("error opening mainDB: " + event.target.error); + showDBErrorDialog(); + if (gDebug) { + console.log("error code: " + event.target.error.code + + " - name: " + event.target.error.name); + } }; request.onsuccess = function(event) { - mainDB = request.result; + mainDB = event.target.result; var throwEv = new CustomEvent("dbinit-done"); gAction.dispatchEvent(throwEv); }; @@ -375,6 +386,16 @@ function showGLWarningDialog() { dia.classList.remove("hidden"); } +function showDBErrorDialog() { + var dia = document.getElementById("dialogArea"); + var areas = dia.children; + for (var i = 0; i <= areas.length - 1; i++) { + areas[i].style.display = "none"; + } + document.getElementById("DBError").style.display = "block"; + dia.classList.remove("hidden"); +} + function showFirstRunDialog() { var dia = document.getElementById("dialogArea"); var areas = dia.children;