Sprach- und Stadt-Wechsel geht wieder

This commit is contained in:
2024-08-26 13:11:49 +00:00
parent 8d99c73386
commit 6e814fe338
9 changed files with 1241 additions and 1042 deletions
+5 -1
View File
@@ -7,5 +7,9 @@ if (!selectedLang) {
} else {
currentLang = selectedLang
}
window.location.href = '/?lng=' + currentLang
if (sensorid !== '') {
window.location.href = `/${sensorid}?lng=${currentLang}`
} else {
window.location.href = `?lng=${currentLang}`
}
+8 -2
View File
@@ -31,7 +31,7 @@ import * as utils from "./chart_utilities.js";
typ: 'maptab',
show: ['ccity', 'odth'],
val: ['centercity', 'olderthan'],
param: ['center.name', 'weeks']
param: [["center","name"], 'weeks']
},
{
typ: 'livetab',
@@ -78,7 +78,13 @@ import * as utils from "./chart_utilities.js";
if(elem.type === 'checkbox') {
val = elem.checked
}
params[setting[i].param[j]] = val
let x = setting[i].param[j]
console.log('x: ', x)
if ( Array.isArray(x)) {
params[setting[i].param[j][0]][setting[i].param[j][1]] = val
} else {
params[setting[i].param[j]] = val
}
}
break
}
+15 -7
View File
@@ -13,7 +13,6 @@ export const tabtable = [
{id: 'ldentab', type: 'lden', container: 'dlden', func: showChart, div: 1, dformat: "dd.LL"},
]
export async function showChart(params, typ, container) {
function form() {
for (let item of tabtable) {
@@ -60,6 +59,7 @@ export async function showChart(params, typ, container) {
} else if ((typ === 'havg') || (typ === 'davg')) {
url += `&peak=${params.peak}`
}
console.log(`fetch ${typ} from server ${url}`)
let erg = await fetchfromserver(url)
if (!erg.err) {
if(sysparams.category === 'noise') {
@@ -91,26 +91,31 @@ export async function showChart(params, typ, container) {
}).add();
}
})
return true
return {error: false}
} else {
showError(erg.err)
return false
// showError(erg.err)
return {error: erg.err}
}
}
export const loadAll = async (params, start = 2) => {
console.log('now load all in Background')
let messzeit = DateTime.now()
if (start == 0) {
map.showMap(params)
start++
}
if (params.sid !== -1) {
for (let i = start; i < tabtable.length; i++) {
let ok = await showChart(params, tabtable[i].type, tabtable[i].container)
if (!ok) {
break;
let err = await showChart(params, tabtable[i].type, tabtable[i].container)
if (err.error) {
if(tabtable[i].type !== 'live') {
break;
}
}
}
let dauer = DateTime.now().diff(messzeit,['seconds']).toObject().seconds
console.log(`now all loaded. Zeitdauer: ${dauer}`)
}
}
@@ -118,6 +123,9 @@ export const setNoUTC = () => {
Highcharts.setOptions({
global: {
useUTC: false // Don't use UTC on the charts
},
accessibility: { // supress warning concerning accessability
enabled: false
}
});
}