*** WIP WIP *** same more changes !
This commit is contained in:
@@ -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')
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 + '</text>';
|
||||
}
|
||||
if(indoor !== 0) {
|
||||
if(indoor) {
|
||||
circIcon += '<line x1="125" y1="475" x2="475" y2="125" stroke="black" stroke-width="20" />'
|
||||
}
|
||||
circIcon += '</svg>';
|
||||
@@ -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}
|
||||
</table>
|
||||
<div id="infoBtn">
|
||||
<a href="#" class="speciallink">Grafik anzeigen</a>
|
||||
<a href="#" class="speciallink">Show chart</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>`
|
||||
@@ -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})`)
|
||||
}
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user