From: peusterm Date: Wed, 11 Jan 2017 18:16:28 +0000 (+0100) Subject: initial dashboard files X-Git-Tag: v3.1~49^2~4 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fvim-emu.git;a=commitdiff_plain;h=0289b604314f2edf88ed7abbe47a8118c2e04716 initial dashboard files --- diff --git a/dashboard/css/main.css b/dashboard/css/main.css new file mode 100644 index 0000000..bbcdc59 --- /dev/null +++ b/dashboard/css/main.css @@ -0,0 +1,40 @@ +body { + margin: 16px; + height: 100%; +} + +#logo { + height: 90px; + text-align: right; +} + +#content { +} + +#input_filter { + width: 100px; +} + + +.tbl-timestamp { + font-size: 10px; + color: #2b669a; +} + +.tbl-message { + font-size: 14px; +} + +.tbl-address { + font-size: 14px; + vertical-align: middle; +} + +.tbl-cat { + font-size: 14px; + vertical-align: middle; +} + +.unitbutton { + cursor: pointer; +} diff --git a/dashboard/img/SONATA_new.png b/dashboard/img/SONATA_new.png new file mode 100644 index 0000000..8fd99f4 Binary files /dev/null and b/dashboard/img/SONATA_new.png differ diff --git a/dashboard/index.html b/dashboard/index.html new file mode 100644 index 0000000..4ef59b6 --- /dev/null +++ b/dashboard/index.html @@ -0,0 +1,76 @@ + + + + + + + MeDICINE Dashboard + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+
+ +
Messages 0Lateness: -
+ + +
+
+ +
+ + + + + + + diff --git a/dashboard/js/main.js b/dashboard/js/main.js new file mode 100644 index 0000000..928adf7 --- /dev/null +++ b/dashboard/js/main.js @@ -0,0 +1,83 @@ +var API_HOST = "http://127.0.0.1:5001"; +var ERROR_ALERT = true; +var TIMESTAMP = 0; + + + +function updateMessageTable(msg_list) { + +} + +function updateMessageCount(msg_list) { + $("#lbl_msg_count").text(msg_list.length); +} + +function fetchMessages() { + +} + + +function autoFetchMessages() { + fetchMessages(); + // do periodic update + if(AUTO_REFRESH) + setTimeout(autoFetchMessages, AUTO_REFRESH_INTERVAL); +} + +function updateLateness() { + lateness = (Date.now() - LAST_UPDATE_TIMESTAMP) / 1000; + $("#lbl_lateness").text("Lateness: " + Number(lateness).toPrecision(3) + "s") + setTimeout(updateLateness, LATENESS_UPDATE_INTERVAL) +} + +function errorAjaxConnection() +{ + // only do once + if(!ERROR_ALERT) + { + ERROR_ALERT = true; + // show message + bootbox.alert("ERROR!\nAPI request failed.\n\n Please check the backend connection.", function() { + // callback + ERROR_ALERT = false; + }); + } +} + +function change_auto_refresh(event) +{ + console.debug("trigger btn_auto_refresh"); + AUTO_REFRESH = !AUTO_REFRESH; + if(AUTO_REFRESH) { + $("#btn_autorefresh").addClass("active"); + autoFetchMessages(); + } + else { + $("#btn_autorefresh").removeClass("active"); + } +} + + +$(document).ready(function(){ + console.info("document ready"); + // setup global connection error handling + $.ajaxSetup({ + "error": errorAjaxConnection + }); + + // add listeners + //TODO + + // activate message fetching + autoFetchMessages(); + LAST_UPDATE_TIMESTAMP = Date.now(); + updateLateness(); + + + // refresh on window focus + $(window).focus(function () { + // TODO observe if this works well + fetchMessages(); + }); + +});