From 586b2641e246df9715ab746e1a7e1e25adec291b Mon Sep 17 00:00:00 2001 From: rxf Date: Fri, 17 Mar 2023 17:38:19 +0100 Subject: [PATCH] *** WIP WIP *** same more changes ! --- public/javascripts/datetime.js | 4 +++ public/javascripts/global.js | 2 +- public/javascripts/map.js | 42 +++++++++++++++++++++++++++++--- public/stylesheets/style.css | 9 +++++++ public/stylesheets/style.css.map | 2 +- public/stylesheets/style.sass | 9 +++++++ 6 files changed, 62 insertions(+), 6 deletions(-) diff --git a/public/javascripts/datetime.js b/public/javascripts/datetime.js index c53efcc..4359fa8 100644 --- a/public/javascripts/datetime.js +++ b/public/javascripts/datetime.js @@ -13,3 +13,7 @@ export const showDate = (sofort) => { export const formatJSDate = (d) => { return DateTime.fromJSDate(d).toFormat('yyyy-LL-dd HH:mm:ss') } + +export const formatISODate = (d) => { + return DateTime.fromISO(d).toFormat('yyyy-LL-dd HH:mm:ss') +} diff --git a/public/javascripts/global.js b/public/javascripts/global.js index 49b5787..9918eab 100644 --- a/public/javascripts/global.js +++ b/public/javascripts/global.js @@ -18,7 +18,7 @@ import * as dt from './datetime.js' device: '', coordinates: false, center: Stuttgart, - zoom: 13, + zoom: 10, refresh: 0, starttime: '2023-01-01T00:00:00Z', //date2ISO(defaultStartime), endtime: '2023-03-01T00:00:00Z' //date2ISO(emptyTimes.emptyHMtime) diff --git a/public/javascripts/map.js b/public/javascripts/map.js index 0215126..c088112 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -154,7 +154,7 @@ function getMedian(markers) { console.log(markers); let i = 0; // now find the 'offlines' (value == -1) for (i = 0; i < markers.length; i++) { - if (markers[i].options.value != -1) { + if (markers[i].options.value > 0) { break; } } @@ -196,7 +196,7 @@ function buildIcon(color, n, indoor) { 'y="400" font-size="1500%" font-family="Verdana,Lucida Sans Unicode,sans-serif" ' + 'fill="' + txtColor + '">' + n + ''; } - if(indoor !== 0) { + if(indoor) { circIcon += '' } circIcon += ''; @@ -242,7 +242,7 @@ export async function buildMarkers() { name: x.id, value: x.value, url: '/graph?sid=' + x.id, - lastseen: dt.formatJSDate(x.lastseen), + lastseen: dt.formatISODate(x.lastseen), indoor: x.indoor }) .on('click', e => onMarkerClick(e, true)) // define click- and @@ -273,7 +273,7 @@ async function onMarkerClick(e, click) { ${item.value < 0 ? offlinetext : normaltext} ` @@ -298,3 +298,37 @@ async function setCenter(adr) { map.setView([parseFloat(data.lat), parseFloat(data.lon)]); console.log(data); } + +/* +// Show the last date below tha map grafics +async function showLastDate(dt) { + const url = `http://localhost:3004/getproperties?type=noise&box=${bounds.toBBoxString()}` + + let ret = await fetch(url) + .catch(e => { + console.log(e) + }); + let sensors = await ret.json() + + let url = '/api/getdata'; + let ld = moment(dt); + let last = ld.subtract(1,'h') + let erg; + let allsens + try { + erg = await $.getJSON(url + `?data=props&last=1900-01-01`); + allsens = erg.count + erg = await $.getJSON(url + `?data=props&last=${last.format('YYYY-MM-DD HH:mm')}`); + if ((erg != undefined) && (erg.values[0].error != undefined)) { + showError(3,erg.values[0].error,aktsensorid); + return; + } + } + catch(e) { + console.log(e) + } + $('#mapdate').html('Werte von ' + ld.format('YYYY-MM-DD HH:mm')); + $('#actsensors').html(`${erg.count} aktive Sensoren (angemeldet ${allsens})`) +} + + */ \ No newline at end of file diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index b4ec14b..d815efa 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -73,6 +73,15 @@ header #h1datum { overflow: hidden; z-index: 1; } +#map #infoTable table, #map #infoTable tr, #map #infoTable td { + margin: auto; + text-align: center; + border: none !important; +} +#map #infoBtn { + margin-top: 10px; + text-align: center; +} #author { font-size: 80%; diff --git a/public/stylesheets/style.css.map b/public/stylesheets/style.css.map index 6127f7c..fdec3aa 100644 --- a/public/stylesheets/style.css.map +++ b/public/stylesheets/style.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["style.sass"],"names":[],"mappings":"AAUA;EACE;EACA;EACA;EACA;EACA;EACA;EACA,kBAfW;;;AAiBb;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;;;AAEJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AACA;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA,eAzEc;EA0Ed;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;;AAGJ;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA","file":"style.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["style.sass"],"names":[],"mappings":"AAUA;EACE;EACA;EACA;EACA;EACA;EACA;EACA,kBAfW;;;AAiBb;EACE;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;;;AAEJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAEF;EACE;EACA;;AACA;EACE;;;AAEN;EACE;EACA;EACA;EACA;EACA,eAzEc;EA0Ed;EACA;EACA;;AAEA;EACE;EACA;EACA;;AACF;EACE;EACA;;;AAGJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;;AAGJ;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;EACA;;;AAEF;EACE;EACA;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;;;AAEF;EACE;;;AAEF;EACE;EACA","file":"style.css"} \ No newline at end of file diff --git a/public/stylesheets/style.sass b/public/stylesheets/style.sass index aed6785..104e690 100644 --- a/public/stylesheets/style.sass +++ b/public/stylesheets/style.sass @@ -76,6 +76,15 @@ header overflow: hidden z-index: 1 + #infoTable table, #infoTable tr, #infoTable td + margin: auto + text-align: center + border: none !important + #infoBtn + margin-top: 10px + text-align: center + + #author font-size: 80% width: 95%