Sprach- und Stadt-Wechsel geht wieder
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
Changes ab AUG-23
|
||||
|
||||
- i18n in /:sid in idex.js rein
|
||||
- Messung und Anzeige auf Console der Ladezeit der 5 Pages im Hintergrund
|
||||
|
||||
Generated
+1182
-1014
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "laerm-web-sensorapi",
|
||||
"version": "3.1.3",
|
||||
"date": "2024-08-02 14:15 UTC",
|
||||
"version": "3.1.4",
|
||||
"date": "2024-08-14 14:15 UTC",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node bin/www.js >>/var/log/noise.log 2>&1"
|
||||
|
||||
@@ -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}`
|
||||
}
|
||||
|
||||
|
||||
@@ -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,8 +78,14 @@ import * as utils from "./chart_utilities.js";
|
||||
if(elem.type === 'checkbox') {
|
||||
val = elem.checked
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,33 +91,41 @@ 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) {
|
||||
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}`)
|
||||
}
|
||||
}
|
||||
|
||||
export const setNoUTC = () => {
|
||||
Highcharts.setOptions({
|
||||
global: {
|
||||
useUTC: false // Don't use UTC on the charts
|
||||
},
|
||||
accessibility: { // supress warning concerning accessability
|
||||
enabled: false
|
||||
}
|
||||
});
|
||||
}
|
||||
+6
-1
@@ -42,7 +42,7 @@ te page again with correct language (chglang.js))
|
||||
router.get('/', function (req, res, next) {
|
||||
// req.i18n.changeLanguage('de')
|
||||
if (req.query.lng === undefined) {
|
||||
res.render('chglang')
|
||||
res.render('chglang', {sensorid: ''})
|
||||
} else {
|
||||
i18n = req.i18n
|
||||
let opts = renderOpts(-1, req.app.get('category'))
|
||||
@@ -61,12 +61,17 @@ router.get('/', function(req, res, next) {
|
||||
router.get('/:sid', async function (req, res, next) {
|
||||
const sid = req.params.sid
|
||||
let opts
|
||||
if (req.query.lng === undefined) {
|
||||
res.render('chglang', { sensorid: sid })
|
||||
} else {
|
||||
i18n = req.i18n
|
||||
if (isNaN(sid)) {
|
||||
opts = renderOpts(-1, req.app.get('category'))
|
||||
} else {
|
||||
opts = renderOpts(sid, req.app.get('category'))
|
||||
}
|
||||
res.render(getIndex(opts.category), opts)
|
||||
}
|
||||
})
|
||||
|
||||
//export default router
|
||||
|
||||
@@ -4,6 +4,9 @@ html
|
||||
title= title
|
||||
meta(name="viewport" content="width=device-width, initial-scale=1" charset="utf-8")
|
||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||
script.
|
||||
const sensorid = '#{sensorid}';
|
||||
|
||||
body
|
||||
#first
|
||||
h1 Loading...
|
||||
|
||||
@@ -106,7 +106,7 @@ block content
|
||||
button#btnSave.btn.btn-primary(type="button" data-bs-dismiss="modal") #{t("Save_changes")}
|
||||
|
||||
|
||||
// Error-Dialog
|
||||
// Reset-Dialog
|
||||
.modal.fade#dialogReset(tabindex="-1" role="dialog" aria-labelledby="Error" aria-hidden="true")
|
||||
.modal-dialog.modal-dialog-centered(role="document")
|
||||
.modal-content
|
||||
|
||||
Reference in New Issue
Block a user