diff options
Diffstat (limited to '')
-rw-r--r-- | web/gui/v2/index.html | 224 |
1 files changed, 0 insertions, 224 deletions
diff --git a/web/gui/v2/index.html b/web/gui/v2/index.html deleted file mode 100644 index f607322c1..000000000 --- a/web/gui/v2/index.html +++ /dev/null @@ -1,224 +0,0 @@ -<!doctype html><html><head><title>Netdata Agent Console</title><script>let pathsRegex = /\/(spaces|nodes|overview|alerts|dashboards|anomalies|events|cloud|v2)\/?.*/ - let getBasename = function() { - return window.location.origin + window.location.pathname.replace(pathsRegex, "") - } - let goToOld = function(path) { - let goToUrl = getBasename() + path; - if (path === "/v2") { - let pathsRegex = /(\/(spaces|nodes|overview|alerts|dashboards|anomalies|events|cloud)\/?.*)/ - if (pathsRegex.test(window.location.origin + window.location.pathname)) { - goToUrl = (window.location.origin + window.location.pathname).replace(pathsRegex, "/v2$1") - } - } - window.location.replace(ensureOneSlash(goToUrl + window.location.search)) - } - let getAssetFile = function(path) { - window.location.replace(__webpack_public_path__ + path) - } - let ensureOneSlash = function(urlStr) { - return urlStr.replace(/([^:]\/)\/+/g, "$1") - } - let searchParams = new URLSearchParams(location.search) - window.envSettings = { - isAgent: true, - apiUrl: "https://app.netdata.cloud", - cloudUrl: "https://app.netdata.cloud", - demoSlug: "netdata-demo", - demoFavourites: {"postgresql":["postgres"],"redis":["redis"],"dns-query":["dns_query"],"http-endpoints":["httpcheck"],"nginx":["web_log","nginx"],"apache":["apache"],"host-reachability":["ping"],"cassandra":["cassandra"],"coredns":["coredns"],"logind":["logind"],"iis":["iis"],"active-directory":["ad"],"windows":["windows","ad","iis","mssql","exchange","netframework"],"docker":["cgroup","docker"],"ups":["upsd"]}, - webpackPublicPath: "", - agentApiUrl: searchParams.get("agent") || getBasename(), - posthogToken: "phc_hnhlqe6D2Q4IcQNrFItaqdXJAxQ8RcHkPAFAp74pubv", - version: "6.66.1", - tracking: false, - cookieDomain: ".netdata.cloud", - onprem: false, - nodeEnv: "production" - } - - function loadStyle(url, { media, insertAfter: aref, insertBefore: bref, rel, type } = {}) { - rel = rel || 'stylesheet' - type = type || 'text/css' - return new Promise(function(resolve, reject) { - let link = document.createElement('link'); - link.type = type; - link.rel = rel; - link.href = url; - link.media = media || 'all'; - - link.onerror = function(err) { - reject(new URIError(`loadStyle: the stylesheet ${err.target.src} is not accessible.`)); - }; - - link.onload = function() { - resolve(); - }; - - if (aref) { - aref.parentNode.insertBefore(link, aref.nextSibling); - return; - } - - if (bref) { - bref.parentNode.insertBefore(link, bref); - return; - } - - document.head.appendChild(link); - }); - } - - loadStyle(window.envSettings.agentApiUrl + "/v2/static/splash.css") - loadStyle(window.envSettings.agentApiUrl + "/v2/favicon.ico", {rel: "icon", type: "image/x-icon"})</script><meta name="application-name" content="netdata"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width,height=device-height,initial-scale=1,minimum-scale=1"/><meta name="apple-mobile-web-app-capable" content="yes"/><meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/></head><body><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N6CBMJD" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div id="app"><div id="agent-splash-screen" class="loading"><div class="hero"><div class="logo-container"><svg width="133" height="105" viewBox="0 0 133 105" fill="none" xmlns="http://www.w3.org/2000/svg" class="logo-blur"><path fill-rule="evenodd" clip-rule="evenodd" d="M81.697 105H55.0693L0.5 0.5H77.9598C108.079 0.554913 132.484 24.7711 132.5 54.6451C132.452 82.485 109.73 105 81.697 105Z" fill="rgba(0,171,68,0.1)"/></svg> <svg width="133" height="105" viewBox="0 0 133 105" fill="none" xmlns="http://www.w3.org/2000/svg" class="logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M81.697 105H55.0693L0.5 0.5H77.9598C108.079 0.554913 132.484 24.7711 132.5 54.6451C132.452 82.485 109.73 105 81.697 105Z" fill="#DDFFEB"/></svg></div><div class="headings"><h1 class="title">Welcome to Netdata</h1><div class="loading-message"><p class="subtitle">Loading latest Netdata UI...</p><div class="flex-center">We couldn't load the latest Netdata UI. <a class="button ghost" href="javascript:location.reload();">You can try again <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18.364 8.05001L17.657 7.34301C16.318 6.00369 14.5472 5.18285 12.6598 5.02654C10.7724 4.87022 8.89077 5.38856 7.34966 6.48934C5.80855 7.59011 4.70794 9.20193 4.24365 11.038C3.77936 12.8741 3.98151 14.8153 4.81412 16.5164C5.64674 18.2174 7.05583 19.5678 8.79067 20.3275C10.5255 21.0871 12.4736 21.2067 14.2883 20.6648C16.103 20.123 17.6666 18.955 18.701 17.3685C19.7353 15.782 20.1733 13.8801 19.937 12.001M18.364 8.05001L14.121 8.05101M18.364 8.05001V3.80701" stroke="#00ab44" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg></a></div></div></div></div><div class="flex-center">Or you can load the <a class="button ghost" href="javascript:goToOld('/v1');">old single node dashboard</a> or a <a class="button ghost" href="javascript:goToOld('/v2');">local copy</a> of Netdata UI</div><div class="flex-center terms"><a href="javascript:getAssetFile('/LICENSE.md');">Netdata UI license</a></div></div></div><script>let status = { - TIMEOUT: 'timeout', - SUCCESS: 'success', - SKIPPED: 'skipped' - }; - function loadScript( - url, - { async = true, defer = false, insertAfter: aref, insertBefore: bref, timeout = 5000, attrs, skipIf } = {} - ) { - return new Promise(function(resolve, reject) { - if (typeof skipIf === 'function' && skipIf()) { - resolve(status.SKIPPED); - return; - } - - let rejectWithTimeout = setTimeout(function() { reject(status.TIMEOUT) }, timeout); - - let script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = url; - script.async = async; - script.defer = defer; - - if (attrs) { - for (let attr in attrs) { - script.setAttribute(attr, attrs[attr]); - } - } - - script.onerror = function(err) { - reject(new URIError(`loadScript: the script ${err.target.src} is not accessible.`)); - }; - - script.onload = function() { - clearTimeout(rejectWithTimeout); - resolve(status.SUCCESS); - }; - - if (aref) { - aref.parentNode.insertBefore(script, aref.nextSibling); - return; - } - - if (bref) { - bref.parentNode.insertBefore(script, bref); - return; - } - - document.body.appendChild(script); - }); - } - - fetch(window.envSettings.agentApiUrl + "/api/v1/registry?action=hello", { cache: "no-cache", credentials: "include" }) - .then(function(response) { return response.json() }) - .then(function(data) { - let to = data.cloud_base_url.lastIndexOf('/'); - to = (to == -1 || to < data.cloud_base_url.length -2) ? data.cloud_base_url.length : to; - let cloudUrl = data.cloud_base_url.substring(0, to); - window.envSettings.apiUrl = cloudUrl - - cloudUrl = /api\.netdata\.cloud/.test(cloudUrl) ? "https://app.netdata.cloud" : cloudUrl - window.envSettings.cloudUrl = cloudUrl - window.envSettings.webpackPublicPath = window.envSettings.webpackPublicPath ? cloudUrl : window.envSettings.webpackPublicPath - __webpack_public_path__ = ensureOneSlash(window.envSettings.webpackPublicPath ? (window.envSettings.webpackPublicPath + "/") : (window.envSettings.agentApiUrl + "/v2/")) - - window.localNetdataRegistry = { - anonymousStatistics: data.anonymous_statistics, - registry: data.registry, - isNetdataRegistry: data.registry === "https://registry.my-netdata.io", - hostname: data.hostname, - mg: data.agent.machine_guid, - nd: data.agent.node_id, - claimId: data.agent.claim_id, - cloudStatus: data.cloud_status, - xNetdataAuthHeader: data["X-Netdata-Auth"] || false - } - - - - if ((window.localNetdataRegistry.cloudStatus === "disabled" || window.localNetdataRegistry.cloudStatus === "unavailable") && !/\/v2/.test(location.pathname)) { - goToOld("/v2") - return - } - - fetch(__webpack_public_path__ + "bundlesManifest."+ window.envSettings.version.toString().replace(/(\d+)\..+/, "$1") +".json") - .then(function(response) { return response.json() }) - .then(function(data) { - Object.keys(data).forEach(function(k) { - if (/\.(map|ico|html)$/.test(data[k])) return - if (/static\//.test(data[k])) return - - if (/\.css.*$/.test(data[k])) { - loadStyle(ensureOneSlash(__webpack_public_path__ + data[k])) - return - } - - if (/\.js.*$/.test(data[k])) { - loadScript(ensureOneSlash(__webpack_public_path__ + data[k]), { - async: false, - }); - } - let el = document.getElementById('agent-splash-screen'); - el.classList.remove("loading"); - }) - }).catch(function() { - let el = document.getElementById('agent-splash-screen'); - el.classList.remove("loading"); - el.classList.add("error"); - }); - - envSettings.tracking = window.localNetdataRegistry.anonymousStatistics !== false - - let withoutNodes = btoa(JSON.stringify({ - registry: data.registry, - machine_guid: data.machine_guid, - hostname: data.hostname, - agent: data.agent, - nodes: [] - })) - let iframe = document.createElement('iframe'); - iframe.src = data.registry + "/registry-access.html?x=" + withoutNodes + "&originUrl=" + window.envSettings.agentApiUrl; - iframe.style = { position: "absolute", left: "-99999999px" }; - iframe.width = 0 ; - iframe.height = 0; - iframe.tabindex = -1; - iframe.title = "empty"; - iframe.classList.add("hidden"); - document.body.appendChild(iframe); - - setTimeout(function () { - document.title = data.hostname + ': Netdata Agent Console'; - iframe.contentWindow.postMessage(["netdata-registry", window.envSettings.agentApiUrl, data], "*") - }, 300); - - window.addEventListener('message', function(event) { - if (event.source !== iframe.contentWindow) return; - - if (event.data.status === "disabled") console.error("Your netdata registry is disabled! Check your configuration.") - - if (event.data) { - if (!window.localNetdataRegistry) { - window.localNetdataRegistry = {} - } - - window.localNetdataRegistry.pg = event.data.person_guid - - if (!window.envSettings) { - window.envSettings = {} - } - - window.envSettings.visitor = event.data.person_guid - } - }); - }).catch(() => {})</script></body></html>
\ No newline at end of file |