From 71c4972e6a70835ccf9b019860ae39c27cb1168b Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Tue, 3 Jan 2023 15:03:09 +0100 Subject: [PATCH] added config values to dashboard --- app/static/assets/js/helper.js | 11 +++++++++++ app/templates/views/dashboard.html | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/app/static/assets/js/helper.js b/app/static/assets/js/helper.js index 27327b8..dd49606 100644 --- a/app/static/assets/js/helper.js +++ b/app/static/assets/js/helper.js @@ -1,3 +1,14 @@ +async function fetchConfig(element) { + let xhr = new XMLHttpRequest(); + xhr.open("GET", '/-/config', true); + xhr.onreadystatechange = function () { + if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { + element.innerHTML = JSON.stringify(JSON.parse(xhr.response),null,2); + } + }; + xhr.send(); +} + async function fetchOriginsWithLeases(element) { let xhr = new XMLHttpRequest(); xhr.open("GET", '/-/origins?leases=true', true); diff --git a/app/templates/views/dashboard.html b/app/templates/views/dashboard.html index 3557170..14a7378 100644 --- a/app/templates/views/dashboard.html +++ b/app/templates/views/dashboard.html @@ -28,6 +28,8 @@ + +

 
 {% endblock %}
 
@@ -37,5 +39,12 @@
     function downloadClientToken() {
         window.open('/-/client-token', "_blank")
     }
+
+    function load() {
+        const config = document.getElementById('config')
+        fetchConfig(config)
+    }
+
+    load()
 
 {% endblock %}