diff options
Diffstat (limited to 'web/gui/main.js')
-rw-r--r-- | web/gui/main.js | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/web/gui/main.js b/web/gui/main.js index c6a2bac1..8a61673e 100644 --- a/web/gui/main.js +++ b/web/gui/main.js @@ -4044,6 +4044,14 @@ function runOnceOnDashboardWithjQuery() { // ------------------------------------------------------------------------ // sidebar / affix + if (shouldShowSignInBanner()) { + const el = document.getElementById("sign-in-banner"); + if (el) { + el.style.display = "initial"; + el.classList.add(`theme-${netdataTheme}`); + } + } + $('#sidebar') .affix({ offset: { @@ -4361,12 +4369,6 @@ function finalizePage() { // do not to give errors on netdata demo servers for 60 seconds NETDATA.options.current.retries_on_data_failures = 60; - if (urlOptions.nowelcome !== true) { - setTimeout(function () { - $('#welcomeModal').modal(); - }, 1000); - } - // google analytics when this is used for the home page of the demo sites // this does not run on user's installations setTimeout(function () { @@ -4405,6 +4407,12 @@ function finalizePage() { NETDATA.globalPanAndZoom.setMaster(NETDATA.options.targets[0], netdataSnapshotData.after_ms, netdataSnapshotData.before_ms); } + //if (urlOptions.nowelcome !== true) { + // setTimeout(function () { + // $('#welcomeModal').modal(); + // }, 2000); + //} + // var netdataEnded = performance.now(); // console.log('start up time: ' + (netdataEnded - netdataStarted).toString() + ' ms'); } @@ -4685,6 +4693,26 @@ function signInDidClick(e) { signIn(); } +function shouldShowSignInBanner() { + if (isSignedIn()) { + return false; + } + + return localStorage.getItem("signInBannerClosed") != "true"; +} + +function closeSignInBanner() { + localStorage.setItem("signInBannerClosed", "true"); + const el = document.getElementById("sign-in-banner"); + if (el) { + el.style.display = "none"; + } +} + +function closeSignInBannerDidClick(e) { + closeSignInBanner(); +} + function signOutDidClick(e) { e.preventDefault(); e.stopPropagation(); @@ -4779,7 +4807,7 @@ function renderAccountUI() { container.setAttribute("data-original-title", "sign in"); container.setAttribute("data-placement", "bottom"); container.innerHTML = ( - `<a href="#" class="btn" onclick="signInDidClick(event); return false"> + `<a href="#" class="btn sign-in-btn theme-${netdataTheme}" onclick="signInDidClick(event); return false"> <i class="fas fa-sign-in-alt"></i> <span class="hidden-sm hidden-md">Sign In</span> </a>` ) @@ -4802,6 +4830,7 @@ function handleMessage(e) { } function handleSignInMessage(e) { + closeSignInBanner(); localStorage.setItem("cloud.baseURL", NETDATA.registry.cloudBaseURL); cloudAccountID = e.data.accountID; |