rifacimento grafic
This commit is contained in:
1 parent
48a6aee18f
commit
b52e14b965
3 files changed
+777
-217
No files matched your search
+209
-100
@@ -1,5 +1,5 @@
|
||||
(function(){
|
||||
const qs = (s)=>document.querySelector(s);
|
||||
const qs = (s) => document.querySelector(s);
|
||||
const root = document.documentElement;
|
||||
const baseInput = qs('#baseUrl');
|
||||
const keyInput = qs('#apiKey');
|
||||
@@ -16,20 +16,29 @@
|
||||
const maxKwInput = qs('#maxKw');
|
||||
const maxDkwhInput = qs('#maxDkwh');
|
||||
const themeToggle = qs('#themeToggle');
|
||||
const connectionState = qs('#connectionState');
|
||||
|
||||
// Theme
|
||||
const savedTheme = localStorage.getItem('sdm_theme') || 'dark';
|
||||
root.setAttribute('data-theme', savedTheme);
|
||||
themeToggle.textContent = savedTheme === 'dark' ? '🌙' : '☀️';
|
||||
themeToggle.addEventListener('click', ()=>{
|
||||
const cur = root.getAttribute('data-theme') === 'dark' ? 'light':'dark';
|
||||
root.setAttribute('data-theme', cur);
|
||||
localStorage.setItem('sdm_theme', cur);
|
||||
themeToggle.textContent = cur === 'dark' ? '🌙' : '☀️';
|
||||
if(window._lastData){ setCharts(window._lastData.vP, window._lastData.pP, window._lastData.dP); }
|
||||
function cssVar(name){
|
||||
return getComputedStyle(root).getPropertyValue(name).trim();
|
||||
}
|
||||
|
||||
function setTheme(theme){
|
||||
root.setAttribute('data-theme', theme);
|
||||
localStorage.setItem('sdm_theme', theme);
|
||||
themeToggle.textContent = theme === 'dark' ? 'Tema chiaro' : 'Tema scuro';
|
||||
themeToggle.setAttribute('aria-label', theme === 'dark' ? 'Passa al tema chiaro' : 'Passa al tema scuro');
|
||||
}
|
||||
|
||||
setTheme(localStorage.getItem('sdm_theme') || 'dark');
|
||||
themeToggle.addEventListener('click', () => {
|
||||
const next = root.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
|
||||
setTheme(next);
|
||||
if(window._lastData){
|
||||
setCharts(window._lastData.vP, window._lastData.pP, window._lastData.dP);
|
||||
}
|
||||
});
|
||||
|
||||
baseInput.value = localStorage.getItem('sdm_base') || `${location.origin}`;
|
||||
baseInput.value = localStorage.getItem('sdm_base') || location.origin;
|
||||
keyInput.value = localStorage.getItem('sdm_key') || '';
|
||||
autoChk.checked = (localStorage.getItem('sdm_auto') ?? '1') === '1';
|
||||
rangeSel.value = localStorage.getItem('sdm_range') || '24h';
|
||||
@@ -38,10 +47,15 @@
|
||||
maxKwInput.value = localStorage.getItem('sdm_maxkw') || '3.0';
|
||||
maxDkwhInput.value = localStorage.getItem('sdm_maxdkwh') || '';
|
||||
|
||||
function setConnectionState(text, state){
|
||||
connectionState.textContent = text;
|
||||
connectionState.className = `state-pill${state ? ` is-${state}` : ''}`;
|
||||
}
|
||||
|
||||
function savePrefs(){
|
||||
localStorage.setItem('sdm_base', baseInput.value);
|
||||
localStorage.setItem('sdm_key', keyInput.value);
|
||||
localStorage.setItem('sdm_auto', autoChk.checked ? '1':'0');
|
||||
localStorage.setItem('sdm_auto', autoChk.checked ? '1' : '0');
|
||||
localStorage.setItem('sdm_range', rangeSel.value);
|
||||
localStorage.setItem('sdm_minv', minVInput.value || '');
|
||||
localStorage.setItem('sdm_maxv', maxVInput.value || '');
|
||||
@@ -52,16 +66,17 @@
|
||||
function tsRange(range){
|
||||
const end = new Date();
|
||||
const start = new Date(end);
|
||||
if(range==='1h') start.setHours(end.getHours()-1);
|
||||
else if(range==='6h') start.setHours(end.getHours()-6);
|
||||
else if(range==='24h') start.setDate(end.getDate()-1);
|
||||
else if(range==='7d') start.setDate(end.getDate()-7);
|
||||
return {start:start.toISOString(), end:end.toISOString()};
|
||||
if(range === '1h') start.setHours(end.getHours() - 1);
|
||||
else if(range === '6h') start.setHours(end.getHours() - 6);
|
||||
else if(range === '24h') start.setDate(end.getDate() - 1);
|
||||
else if(range === '7d') start.setDate(end.getDate() - 7);
|
||||
return {start: start.toISOString(), end: end.toISOString()};
|
||||
}
|
||||
|
||||
async function apiGet(path){
|
||||
const headers = keyInput.value ? {'X-API-Key': keyInput.value} : {};
|
||||
const res = await fetch(`${baseInput.value}${path}`, {headers});
|
||||
const baseUrl = (baseInput.value || location.origin).replace(/\/+$/, '');
|
||||
const res = await fetch(`${baseUrl}${path}`, {headers});
|
||||
if(!res.ok){
|
||||
const text = await res.text();
|
||||
throw new Error(text || res.statusText);
|
||||
@@ -69,130 +84,196 @@
|
||||
return res.json();
|
||||
}
|
||||
|
||||
// ECharts instances
|
||||
let ecV = echarts.init(document.getElementById('chartV'));
|
||||
let ecP = echarts.init(document.getElementById('chartP'));
|
||||
let ecE = echarts.init(document.getElementById('chartE'));
|
||||
window.addEventListener('resize', ()=>{ ecV.resize(); ecP.resize(); ecE.resize(); });
|
||||
window.addEventListener('resize', () => {
|
||||
ecV.resize();
|
||||
ecP.resize();
|
||||
ecE.resize();
|
||||
});
|
||||
|
||||
function axisStyle(){
|
||||
const cs = getComputedStyle(document.documentElement);
|
||||
return {
|
||||
axisLine:{lineStyle:{color: cs.getPropertyValue('--axis').trim()}},
|
||||
axisLabel:{color: cs.getPropertyValue('--muted').trim()},
|
||||
splitLine:{show:true,lineStyle:{color: cs.getPropertyValue('--split').trim()}},
|
||||
nameTextStyle:{color: cs.getPropertyValue('--muted').trim()}
|
||||
axisLine: {lineStyle: {color: cssVar('--axis')}},
|
||||
axisTick: {lineStyle: {color: cssVar('--axis')}},
|
||||
axisLabel: {color: cssVar('--muted'), hideOverlap: true},
|
||||
splitLine: {show: true, lineStyle: {color: cssVar('--split')}},
|
||||
nameTextStyle: {color: cssVar('--muted'), fontWeight: 700}
|
||||
};
|
||||
}
|
||||
|
||||
function optionTemplate(yMin, yMax, yName){
|
||||
const cs = getComputedStyle(document.documentElement);
|
||||
const muted = cs.getPropertyValue('--muted').trim();
|
||||
const muted = cssVar('--muted');
|
||||
const yAxis = Object.assign({type: 'value', min: yMin, name: yName}, axisStyle());
|
||||
if(Number.isFinite(yMax)) yAxis.max = yMax;
|
||||
|
||||
return {
|
||||
backgroundColor: 'transparent',
|
||||
textStyle:{color: cs.getPropertyValue('--text').trim()},
|
||||
textStyle: {color: cssVar('--text')},
|
||||
animation: false,
|
||||
grid: { left: 45, right: 10, top: 10, bottom: 35 },
|
||||
grid: {left: 12, right: 18, top: 22, bottom: 56, containLabel: true},
|
||||
tooltip: {
|
||||
backgroundColor: cs.getPropertyValue('--card').trim(),
|
||||
borderColor: cs.getPropertyValue('--border').trim(),
|
||||
textStyle:{color: cs.getPropertyValue('--text').trim()},
|
||||
backgroundColor: cssVar('--surface'),
|
||||
borderColor: cssVar('--border'),
|
||||
textStyle: {color: cssVar('--text')},
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross', label:{backgroundColor: cs.getPropertyValue('--btn').trim()} },
|
||||
axisPointer: {type: 'cross', label: {backgroundColor: cssVar('--primary')}},
|
||||
formatter: (params) => {
|
||||
if(!params || !params.length) return '';
|
||||
const x = params[0].axisValue;
|
||||
const d = new Date(x);
|
||||
const loc = d.toLocaleString();
|
||||
const utc = d.toISOString().replace('.000','');
|
||||
let html = `<div><b>${loc}</b><div style='color:${muted}'>UTC: ${utc}</div>`;
|
||||
const utc = d.toISOString().replace('.000', '');
|
||||
let html = `<div><b>${loc}</b><div style="color:${muted}">UTC: ${utc}</div>`;
|
||||
for(const p of params){
|
||||
const val = Array.isArray(p.data)? p.data[1] : (p.data?.value ?? p.data);
|
||||
const val = Array.isArray(p.data) ? p.data[1] : (p.data?.value ?? p.data);
|
||||
html += `<div><span style="display:inline-block;width:9px;height:9px;background:${p.color};margin-right:6px;border-radius:2px"></span>${p.seriesName}: ${Number(val).toFixed(3)}</div>`;
|
||||
}
|
||||
return html + '</div>';
|
||||
return `${html}</div>`;
|
||||
}
|
||||
},
|
||||
xAxis: Object.assign({ type: 'time' }, axisStyle()),
|
||||
yAxis: Object.assign({ type: 'value', min: yMin, max: yMax, name: yName }, axisStyle() ),
|
||||
dataZoom: [{type:'inside'}, {type:'slider', handleStyle:{color: cs.getPropertyValue('--accent').trim()}}],
|
||||
xAxis: Object.assign({type: 'time'}, axisStyle()),
|
||||
yAxis,
|
||||
dataZoom: [
|
||||
{type: 'inside'},
|
||||
{
|
||||
type: 'slider',
|
||||
height: 22,
|
||||
bottom: 10,
|
||||
borderColor: cssVar('--border'),
|
||||
fillerColor: 'rgba(38, 184, 149, 0.16)',
|
||||
dataBackground: {
|
||||
lineStyle: {color: cssVar('--muted')},
|
||||
areaStyle: {color: cssVar('--surface-2')}
|
||||
},
|
||||
selectedDataBackground: {
|
||||
lineStyle: {color: cssVar('--primary')},
|
||||
areaStyle: {color: 'rgba(38, 184, 149, 0.18)'}
|
||||
},
|
||||
handleStyle: {color: cssVar('--primary')}
|
||||
}
|
||||
],
|
||||
series: []
|
||||
};
|
||||
}
|
||||
|
||||
function lineSeries(name, color, data, extra){
|
||||
return Object.assign({
|
||||
name,
|
||||
type: 'line',
|
||||
showSymbol: false,
|
||||
sampling: 'lttb',
|
||||
lineStyle: {width: 2.5, color},
|
||||
itemStyle: {color},
|
||||
areaStyle: {color, opacity: 0.12},
|
||||
emphasis: {focus: 'series'},
|
||||
data
|
||||
}, extra || {});
|
||||
}
|
||||
|
||||
function applyNoDataState(option, data){
|
||||
if(data.length) return;
|
||||
option.graphic = [{
|
||||
type: 'text',
|
||||
left: 'center',
|
||||
top: 'middle',
|
||||
style: {
|
||||
text: 'Nessun dato per questo intervallo',
|
||||
fill: cssVar('--muted'),
|
||||
fontSize: 14,
|
||||
fontWeight: 700
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
function numberOrDefault(value, fallback){
|
||||
const n = Number(value);
|
||||
return Number.isFinite(n) ? n : fallback;
|
||||
}
|
||||
|
||||
function setCharts(volts, pkw, dkwh){
|
||||
window._lastData = {vP: volts, pP: pkw, dP: dkwh};
|
||||
|
||||
ecV.dispose(); ecP.dispose(); ecE.dispose();
|
||||
ecV = echarts.init(document.getElementById('chartV'));
|
||||
ecP = echarts.init(document.getElementById('chartP'));
|
||||
ecE = echarts.init(document.getElementById('chartE'));
|
||||
const colV = cssVar('--voltage');
|
||||
const colP = cssVar('--power');
|
||||
const colE = cssVar('--energy');
|
||||
|
||||
const colV = '#60a5fa';
|
||||
const colP = '#34d399';
|
||||
const colE = '#f59e0b';
|
||||
const optV = optionTemplate(numberOrDefault(minVInput.value, 180), numberOrDefault(maxVInput.value, 260), 'V');
|
||||
const optP = optionTemplate(0, numberOrDefault(maxKwInput.value, 3), 'kW');
|
||||
const maxDkwh = Number(maxDkwhInput.value);
|
||||
const optE = optionTemplate(0, Number.isFinite(maxDkwh) && maxDkwh > 0 ? maxDkwh : undefined, 'kWh');
|
||||
|
||||
const optV = optionTemplate(Number(minVInput.value)||180, Number(maxVInput.value)||260, 'V');
|
||||
const optP = optionTemplate(0, Number(maxKwInput.value)||3, 'kW');
|
||||
const optE = optionTemplate(0, (Number(maxDkwhInput.value) || null), 'ΔkWh');
|
||||
|
||||
optV.series = [{ name:'Volt', type:'line', showSymbol:false, lineStyle:{width:2,color:colV}, data: volts }];
|
||||
optP.series = [{ name:'kW', type:'line', showSymbol:false, lineStyle:{width:2,color:colP}, data: pkw }];
|
||||
|
||||
if(!optE.yAxis.max){
|
||||
const max = dkwh.reduce((m,pt)=> Math.max(m, pt[1]||0), 0);
|
||||
optE.yAxis.max = max>0 ? max*1.1 : 0.1;
|
||||
if(!Number.isFinite(optE.yAxis.max)){
|
||||
const max = dkwh.reduce((m, pt) => Math.max(m, pt[1] || 0), 0);
|
||||
optE.yAxis.max = max > 0 ? Number((max * 1.1).toFixed(3)) : 0.1;
|
||||
}
|
||||
optE.series = [{ name:'ΔkWh', type:'line', step:'middle', showSymbol:false, lineStyle:{width:2,color:colE}, data: dkwh }];
|
||||
|
||||
ecV.setOption(optV, {notMerge:true, lazyUpdate:false});
|
||||
ecP.setOption(optP, {notMerge:true, lazyUpdate:false});
|
||||
ecE.setOption(optE, {notMerge:true, lazyUpdate:false});
|
||||
optV.series = [lineSeries('Volt', colV, volts)];
|
||||
optP.series = [lineSeries('kW', colP, pkw)];
|
||||
optE.series = [lineSeries('Delta kWh', colE, dkwh, {step: 'middle'})];
|
||||
applyNoDataState(optV, volts);
|
||||
applyNoDataState(optP, pkw);
|
||||
applyNoDataState(optE, dkwh);
|
||||
|
||||
ecV.setOption(optV, {notMerge: true, lazyUpdate: false});
|
||||
ecP.setOption(optP, {notMerge: true, lazyUpdate: false});
|
||||
ecE.setOption(optE, {notMerge: true, lazyUpdate: false});
|
||||
}
|
||||
|
||||
function toPairs(arr){
|
||||
return arr.filter(r => r.ts && r.value!=null && isFinite(+r.value)).map(r => [r.ts, +r.value]);
|
||||
return arr
|
||||
.filter((r) => r.ts && r.value != null && isFinite(+r.value))
|
||||
.map((r) => [r.ts, +r.value]);
|
||||
}
|
||||
|
||||
function setLatest(l){
|
||||
const v = +l.voltage, p = +l.power_kw, e = +l.energy_kwh;
|
||||
qs('#v').textContent = isFinite(v) ? v.toFixed(2) : '—';
|
||||
qs('#p').textContent = isFinite(p) ? p.toFixed(2) : '—';
|
||||
qs('#e').textContent = isFinite(e) ? e.toFixed(2) : '—';
|
||||
const v = +l.voltage;
|
||||
const p = +l.power_kw;
|
||||
const e = +l.energy_kwh;
|
||||
qs('#v').textContent = isFinite(v) ? v.toFixed(2) : '--';
|
||||
qs('#p').textContent = isFinite(p) ? p.toFixed(2) : '--';
|
||||
qs('#e').textContent = isFinite(e) ? e.toFixed(2) : '--';
|
||||
|
||||
if(l.ts){
|
||||
const d = new Date(l.ts);
|
||||
const loc = d.toLocaleString();
|
||||
qs('#tsV').textContent = 'Agg.: ' + loc + ` (UTC: ${l.ts})`;
|
||||
qs('#tsP').textContent = 'Agg.: ' + loc + ` (UTC: ${l.ts})`;
|
||||
qs('#tsE').textContent = 'Agg.: ' + loc + ` (UTC: ${l.ts})`;
|
||||
lastTS.textContent = `Ultimo dato — Locale: ${loc} | UTC: ${l.ts}`;
|
||||
qs('#tsV').textContent = `Aggiornamento: ${loc} | UTC: ${l.ts}`;
|
||||
qs('#tsP').textContent = `Aggiornamento: ${loc} | UTC: ${l.ts}`;
|
||||
qs('#tsE').textContent = `Aggiornamento: ${loc} | UTC: ${l.ts}`;
|
||||
lastTS.textContent = `Ultimo dato: ${loc} | UTC: ${l.ts}`;
|
||||
}
|
||||
}
|
||||
|
||||
function setHistory(raw){
|
||||
let firstE;
|
||||
const volts=[], pkw=[], dkwh=[];
|
||||
const volts = [];
|
||||
const pkw = [];
|
||||
const dkwh = [];
|
||||
for(const r of raw){
|
||||
const ts = r.ts;
|
||||
if(r.voltage!=null) volts.push({ts, value:+r.voltage});
|
||||
if(r.power_kw!=null) pkw.push({ts, value:+r.power_kw});
|
||||
if(r.energy_kwh!=null){
|
||||
if(r.voltage != null) volts.push({ts, value: +r.voltage});
|
||||
if(r.power_kw != null) pkw.push({ts, value: +r.power_kw});
|
||||
if(r.energy_kwh != null){
|
||||
const ek = +r.energy_kwh;
|
||||
if(firstE==null) firstE = ek;
|
||||
dkwh.push({ts, value:+(ek-firstE).toFixed(3)});
|
||||
if(firstE == null) firstE = ek;
|
||||
dkwh.push({ts, value: +(ek - firstE).toFixed(3)});
|
||||
}
|
||||
}
|
||||
const vP = toPairs(volts), pP = toPairs(pkw), dP = toPairs(dkwh);
|
||||
|
||||
const vP = toPairs(volts);
|
||||
const pP = toPairs(pkw);
|
||||
const dP = toPairs(dkwh);
|
||||
setCharts(vP, pP, dP);
|
||||
dbg.textContent = `Punti: V=${vP.length} P=${pP.length} ΔkWh=${dP.length}`;
|
||||
dbg.textContent = `Punti: V=${vP.length} P=${pP.length} Delta kWh=${dP.length}`;
|
||||
|
||||
if(vP.length || pP.length || dP.length){
|
||||
const allTs = [...vP, ...pP, ...dP].map(p=>p[0]).sort();
|
||||
const allTs = [...vP, ...pP, ...dP].map((p) => p[0]).sort();
|
||||
const first = new Date(allTs[0]).toLocaleString();
|
||||
const last = new Date(allTs[allTs.length-1]).toLocaleString();
|
||||
rinfo.textContent = `Intervallo dati ricevuti — ${first} → ${last}`;
|
||||
const last = new Date(allTs[allTs.length - 1]).toLocaleString();
|
||||
rinfo.textContent = `Dati ricevuti: ${first} -> ${last}`;
|
||||
} else {
|
||||
rinfo.textContent = 'Intervallo dati ricevuti — nessun punto';
|
||||
rinfo.textContent = 'Dati ricevuti: nessun punto';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,13 +282,14 @@
|
||||
const start = new Date(startISO).getTime();
|
||||
const end = new Date(endISO).getTime();
|
||||
const totalMs = Math.max(0, end - start);
|
||||
const CHUNKS = Math.min(8, Math.max(1, Math.ceil(totalMs / (24*3600*1000))));
|
||||
const CHUNKS = Math.min(8, Math.max(1, Math.ceil(totalMs / (24 * 3600 * 1000))));
|
||||
const promises = [];
|
||||
for(let i=0;i<CHUNKS;i++){
|
||||
const s = new Date(start + totalMs * (i/CHUNKS)).toISOString();
|
||||
const e = new Date(start + totalMs * ((i+1)/CHUNKS)).toISOString();
|
||||
for(let i = 0; i < CHUNKS; i++){
|
||||
const s = new Date(start + totalMs * (i / CHUNKS)).toISOString();
|
||||
const e = new Date(start + totalMs * ((i + 1) / CHUNKS)).toISOString();
|
||||
promises.push(apiGet(`/api/v1/metrics/history?start=${encodeURIComponent(s)}&end=${encodeURIComponent(e)}&limit=${MAX_LIMIT}`));
|
||||
}
|
||||
|
||||
const results = await Promise.all(promises);
|
||||
const map = new Map();
|
||||
for(const arr of results){
|
||||
@@ -215,41 +297,67 @@
|
||||
if(!map.has(r.ts)) map.set(r.ts, r);
|
||||
}
|
||||
}
|
||||
return Array.from(map.values()).sort((a,b)=> (a.ts < b.ts ? -1 : a.ts > b.ts ? 1 : 0));
|
||||
return Array.from(map.values()).sort((a, b) => (a.ts < b.ts ? -1 : a.ts > b.ts ? 1 : 0));
|
||||
}
|
||||
|
||||
async function refresh(){
|
||||
savePrefs(); banner.style.display = 'none';
|
||||
savePrefs();
|
||||
banner.style.display = 'none';
|
||||
statusEl.textContent = 'Carico...';
|
||||
setConnectionState('Carico', 'loading');
|
||||
|
||||
try{
|
||||
const range = tsRange(rangeSel.value);
|
||||
qinfo.textContent = `Intervallo richiesto — ${new Date(range.start).toLocaleString()} → ${new Date(range.end).toLocaleString()} (UTC: ${range.start} → ${range.end})`;
|
||||
qinfo.textContent = `Richiesta: ${new Date(range.start).toLocaleString()} -> ${new Date(range.end).toLocaleString()} | UTC: ${range.start} -> ${range.end}`;
|
||||
|
||||
const [latest, hist] = await Promise.all([
|
||||
apiGet('/api/v1/metrics/latest'),
|
||||
fetchHistoryChunked(range.start, range.end),
|
||||
]);
|
||||
|
||||
setLatest(latest);
|
||||
setHistory(hist);
|
||||
statusEl.textContent = 'OK';
|
||||
const now = new Date().toLocaleTimeString();
|
||||
statusEl.textContent = `Aggiornato alle ${now}`;
|
||||
setConnectionState('Online', 'ok');
|
||||
}catch(e){
|
||||
statusEl.textContent = 'Errore';
|
||||
banner.textContent = String(e.message||e);
|
||||
setConnectionState('Errore API', 'error');
|
||||
banner.textContent = String(e.message || e);
|
||||
banner.style.display = 'block';
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('refresh').addEventListener('click', refresh);
|
||||
document.getElementById('resetZoom').addEventListener('click', ()=>{
|
||||
ecV.dispatchAction({type:'dataZoom', start:0, end:100});
|
||||
ecP.dispatchAction({type:'dataZoom', start:0, end:100});
|
||||
ecE.dispatchAction({type:'dataZoom', start:0, end:100});
|
||||
document.getElementById('resetZoom').addEventListener('click', () => {
|
||||
ecV.dispatchAction({type: 'dataZoom', start: 0, end: 100});
|
||||
ecP.dispatchAction({type: 'dataZoom', start: 0, end: 100});
|
||||
ecE.dispatchAction({type: 'dataZoom', start: 0, end: 100});
|
||||
});
|
||||
|
||||
baseInput.addEventListener('change', savePrefs);
|
||||
keyInput.addEventListener('change', ()=>{ savePrefs(); banner.style.display='none'; });
|
||||
rangeSel.addEventListener('change', ()=>{ savePrefs(); refresh(); });
|
||||
autoChk.addEventListener('change', ()=>{ savePrefs(); if(autoChk.checked){ tick(); }});
|
||||
keyInput.addEventListener('change', () => {
|
||||
savePrefs();
|
||||
banner.style.display = 'none';
|
||||
});
|
||||
rangeSel.addEventListener('change', () => {
|
||||
savePrefs();
|
||||
refresh();
|
||||
});
|
||||
autoChk.addEventListener('change', () => {
|
||||
savePrefs();
|
||||
if(autoChk.checked) tick();
|
||||
});
|
||||
|
||||
[minVInput, maxVInput, maxKwInput, maxDkwhInput].forEach((input) => {
|
||||
input.addEventListener('change', () => {
|
||||
savePrefs();
|
||||
if(window._lastData){
|
||||
setCharts(window._lastData.vP, window._lastData.pP, window._lastData.dP);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
let timer = null;
|
||||
async function tick(){
|
||||
@@ -259,5 +367,6 @@
|
||||
timer = setInterval(refresh, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
tick();
|
||||
})();
|
||||
})();
|
||||
+119
-66
@@ -3,91 +3,144 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<title>WallBox by Alberto Tilaro</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22><rect width=%2264%22 height=%2264%22 rx=%2212%22 fill=%22%230b1220%22/><path d=%22M38 6L14 36h14l-2 22 24-30H36l2-22z%22 fill=%22%23facc15%22 stroke=%22%23fde68a%22 stroke-width=%222%22/></svg>">
|
||||
<title>WallBox Monitor</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22><rect width=%2264%22 height=%2264%22 rx=%228%22 fill=%22%23101114%22/><path d=%22M38 6L14 36h14l-2 22 24-30H36l2-22z%22 fill=%22%2326b895%22 stroke=%22%23d6f7ea%22 stroke-width=%222%22/></svg>">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<div class="page-shell">
|
||||
<header class="topbar">
|
||||
<div class="brand">
|
||||
<img class="logo" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22><rect width=%2264%22 height=%2264%22 rx=%2212%22 fill=%22%230b1220%22/><path d=%22M38 6L14 36h14l-2 22 24-30H36l2-22z%22 fill=%22%23facc15%22 stroke=%22%23fde68a%22 stroke-width=%222%22/></svg>" alt="⚡" />
|
||||
<h1>WallBox by Alberto Tilaro</h1>
|
||||
<img class="logo" src="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 64%22><rect width=%2264%22 height=%2264%22 rx=%228%22 fill=%22%23101114%22/><path d=%22M38 6L14 36h14l-2 22 24-30H36l2-22z%22 fill=%22%2326b895%22 stroke=%22%23d6f7ea%22 stroke-width=%222%22/></svg>" alt="WallBox">
|
||||
<div>
|
||||
<p class="eyebrow">Monitor energia</p>
|
||||
<h1>WallBox</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="topbar-meta">
|
||||
<span id="connectionState" class="state-pill">In attesa</span>
|
||||
<button id="themeToggle" class="ghost-button" type="button" title="Cambia tema">Tema</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="summary-grid" aria-label="Valori attuali">
|
||||
<article class="metric-card metric-voltage">
|
||||
<div class="metric-label">Tensione</div>
|
||||
<div class="metric-value"><span id="v">--</span> <small>V</small></div>
|
||||
<div class="metric-meta" id="tsV">Aggiornamento: --</div>
|
||||
</article>
|
||||
|
||||
<article class="metric-card metric-power">
|
||||
<div class="metric-label">Potenza</div>
|
||||
<div class="metric-value"><span id="p">--</span> <small>kW</small></div>
|
||||
<div class="metric-meta" id="tsP">Aggiornamento: --</div>
|
||||
</article>
|
||||
|
||||
<article class="metric-card metric-energy">
|
||||
<div class="metric-label">Energia totale</div>
|
||||
<div class="metric-value"><span id="e">--</span> <small>kWh</small></div>
|
||||
<div class="metric-meta" id="tsE">Aggiornamento: --</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="control-panel" aria-label="Impostazioni">
|
||||
<div class="control-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Impostazioni</p>
|
||||
<h2>Intervallo e soglie</h2>
|
||||
</div>
|
||||
<div class="control-actions">
|
||||
<button id="refresh" type="button">Aggiorna</button>
|
||||
<button id="resetZoom" class="secondary-button" type="button">Reset zoom</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="controls">
|
||||
<label>Base URL <input id="baseUrl" placeholder="http://wallbox:8000"></label>
|
||||
<label>API Key <input id="apiKey" placeholder="X-API-Key"></label>
|
||||
<label>Intervallo
|
||||
<label>
|
||||
<span>Base URL</span>
|
||||
<input id="baseUrl" placeholder="http://wallbox:8000">
|
||||
</label>
|
||||
<label>
|
||||
<span>API Key</span>
|
||||
<input id="apiKey" placeholder="X-API-Key">
|
||||
</label>
|
||||
<label>
|
||||
<span>Intervallo</span>
|
||||
<select id="range">
|
||||
<option value="1h">Ultima 1h</option>
|
||||
<option value="6h">Ultime 6h</option>
|
||||
<option value="24h" selected>Ultime 24h</option>
|
||||
<option value="1h">Ultima 1 ora</option>
|
||||
<option value="6h">Ultime 6 ore</option>
|
||||
<option value="24h" selected>Ultime 24 ore</option>
|
||||
<option value="7d">Ultimi 7 giorni</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Min V <input id="minV" type="number" step="1" min="0" value="180"></label>
|
||||
<label>Max V <input id="maxV" type="number" step="1" min="0" value="260"></label>
|
||||
<label>Max kW <input id="maxKw" type="number" step="0.1" min="0" value="3.0"></label>
|
||||
<label>Max ΔkWh <input id="maxDkwh" type="number" step="0.01" min="0" placeholder="auto"></label>
|
||||
<button id="refresh">Aggiorna</button>
|
||||
<button id="resetZoom">Reset zoom</button>
|
||||
<label class="switch">Auto <input id="auto" type="checkbox" checked></label>
|
||||
<div class="theme">
|
||||
<button id="themeToggle" title="Dark/Light">🌙/☀️</button>
|
||||
</div>
|
||||
<label>
|
||||
<span>Min V</span>
|
||||
<input id="minV" type="number" step="1" min="0" value="180">
|
||||
</label>
|
||||
<label>
|
||||
<span>Max V</span>
|
||||
<input id="maxV" type="number" step="1" min="0" value="260">
|
||||
</label>
|
||||
<label>
|
||||
<span>Max kW</span>
|
||||
<input id="maxKw" type="number" step="0.1" min="0" value="3.0">
|
||||
</label>
|
||||
<label>
|
||||
<span>Max Delta kWh</span>
|
||||
<input id="maxDkwh" type="number" step="0.01" min="0" placeholder="auto">
|
||||
</label>
|
||||
<label class="switch">
|
||||
<span>Auto refresh</span>
|
||||
<input id="auto" type="checkbox" checked>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div id="banner" class="banner" style="display:none"></div>
|
||||
</header>
|
||||
|
||||
<section class="cards">
|
||||
<div class="card">
|
||||
<div class="card-title">Tensione</div>
|
||||
<div class="card-value"><span id="v">—</span> <small>V</small></div>
|
||||
<div class="card-ts" id="tsV">Agg.: —</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-title">Potenza</div>
|
||||
<div class="card-value"><span id="p">—</span> <small>kW</small></div>
|
||||
<div class="card-ts" id="tsP">Agg.: —</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-title">Energia</div>
|
||||
<div class="card-value"><span id="e">—</span> <small>kWh</small></div>
|
||||
<div class="card-ts" id="tsE">Agg.: —</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="chart-block">
|
||||
<div class="chart-header">
|
||||
<h2>Tensione (ora locale)</h2>
|
||||
<span class="tz-note">X in ora locale (Europe/Rome), dati in UTC.</span>
|
||||
</div>
|
||||
<div id="chartV" class="chart-fixed"></div>
|
||||
</section>
|
||||
<main class="chart-grid">
|
||||
<section class="chart-panel">
|
||||
<div class="chart-header">
|
||||
<div>
|
||||
<p class="eyebrow">Linea rete</p>
|
||||
<h2>Tensione</h2>
|
||||
</div>
|
||||
<span class="tz-note">Ora locale Europe/Rome, dati UTC</span>
|
||||
</div>
|
||||
<div id="chartV" class="chart-fixed"></div>
|
||||
</section>
|
||||
|
||||
<section class="chart-block">
|
||||
<div class="chart-header">
|
||||
<h2>Potenza (ora locale)</h2>
|
||||
<span class="tz-note">X in ora locale (Europe/Rome), dati in UTC.</span>
|
||||
</div>
|
||||
<div id="chartP" class="chart-fixed"></div>
|
||||
</section>
|
||||
<section class="chart-panel">
|
||||
<div class="chart-header">
|
||||
<div>
|
||||
<p class="eyebrow">Carico</p>
|
||||
<h2>Potenza</h2>
|
||||
</div>
|
||||
<span class="tz-note">Ora locale Europe/Rome, dati UTC</span>
|
||||
</div>
|
||||
<div id="chartP" class="chart-fixed"></div>
|
||||
</section>
|
||||
|
||||
<section class="chart-block">
|
||||
<div class="chart-header">
|
||||
<h2>Energia Δ dal primo punto (ora locale)</h2>
|
||||
<span class="tz-note">X in ora locale (Europe/Rome), dati in UTC.</span>
|
||||
</div>
|
||||
<div id="chartE" class="chart-fixed"></div>
|
||||
</section>
|
||||
<section class="chart-panel chart-wide">
|
||||
<div class="chart-header">
|
||||
<div>
|
||||
<p class="eyebrow">Consumo</p>
|
||||
<h2>Energia dal primo punto</h2>
|
||||
</div>
|
||||
<span class="tz-note">Ora locale Europe/Rome, dati UTC</span>
|
||||
</div>
|
||||
<div id="chartE" class="chart-fixed chart-large"></div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<footer class="statusbar">
|
||||
<span id="status">Pronto</span>
|
||||
<span id="dbg" class="dbg"></span>
|
||||
<span id="lastTS" class="dbg"></span>
|
||||
<span id="qinfo" class="dbg"></span>
|
||||
<span id="rinfo" class="dbg"></span>
|
||||
<span id="dbg"></span>
|
||||
<span id="lastTS"></span>
|
||||
<span id="qinfo"></span>
|
||||
<span id="rinfo"></span>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
|
||||
+449
-51
@@ -1,54 +1,452 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
*{box-sizing:border-box}
|
||||
:root{ /* light */
|
||||
--bg:#f5f7fb;
|
||||
--panel:#ffffff;
|
||||
--card:#ffffff;
|
||||
--muted:#475569;
|
||||
--text:#0f172a;
|
||||
--accent:#ca8a04;
|
||||
--border:#e5e7eb;
|
||||
--btn:#0f172a;
|
||||
--btn-hover:#1f2937;
|
||||
--axis:#94a3b8;
|
||||
--split:#e5e7eb;
|
||||
:root {
|
||||
--bg: #f3f5f7;
|
||||
--surface: #ffffff;
|
||||
--surface-2: #f8fafb;
|
||||
--text: #131619;
|
||||
--muted: #5d6773;
|
||||
--border: #d9dee5;
|
||||
--primary: #176b5c;
|
||||
--primary-strong: #0f5147;
|
||||
--voltage: #2f7dd1;
|
||||
--power: #168a60;
|
||||
--energy: #b7790f;
|
||||
--danger: #b42318;
|
||||
--danger-bg: #fff1f0;
|
||||
--btn-text: #ffffff;
|
||||
--shadow: 0 16px 40px rgba(19, 22, 25, 0.08);
|
||||
--axis: #7b8794;
|
||||
--split: #e4e8ed;
|
||||
}
|
||||
:root[data-theme="dark"]{
|
||||
--bg:#0b1220;
|
||||
--panel:#0f172a;
|
||||
--card:#111827;
|
||||
--muted:#94a3b8;
|
||||
--text:#e5e7eb;
|
||||
--accent:#facc15;
|
||||
--border:#1f2937;
|
||||
--btn:#1f2937;
|
||||
--btn-hover:#374151;
|
||||
--axis:#334155;
|
||||
--split:#1f2937;
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
--bg: #101114;
|
||||
--surface: #181a1f;
|
||||
--surface-2: #202329;
|
||||
--text: #f2f4f7;
|
||||
--muted: #a9b1bc;
|
||||
--border: #333842;
|
||||
--primary: #26b895;
|
||||
--primary-strong: #46d0ac;
|
||||
--voltage: #62a7e8;
|
||||
--power: #39c98e;
|
||||
--energy: #d89a28;
|
||||
--danger: #ff7166;
|
||||
--danger-bg: #321f21;
|
||||
--btn-text: #07110e;
|
||||
--shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
|
||||
--axis: #687380;
|
||||
--split: #2b3038;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.page-shell {
|
||||
width: min(100%, 1320px);
|
||||
margin: 0 auto;
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 18px 0 20px;
|
||||
}
|
||||
|
||||
.brand,
|
||||
.topbar-meta,
|
||||
.control-actions,
|
||||
.chart-header,
|
||||
.statusbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.brand {
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: #101114;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 30px;
|
||||
line-height: 1.05;
|
||||
font-weight: 760;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
line-height: 1.25;
|
||||
font-weight: 720;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
color: var(--primary-strong);
|
||||
font-size: 12px;
|
||||
font-weight: 760;
|
||||
line-height: 1.4;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.topbar-meta {
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.state-pill {
|
||||
min-width: 92px;
|
||||
padding: 7px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--surface);
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.state-pill.is-ok {
|
||||
border-color: var(--primary);
|
||||
color: var(--primary-strong);
|
||||
}
|
||||
|
||||
.state-pill.is-loading {
|
||||
border-color: var(--energy);
|
||||
color: var(--energy);
|
||||
}
|
||||
|
||||
.state-pill.is-error {
|
||||
border-color: var(--danger);
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.summary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.metric-card,
|
||||
.control-panel,
|
||||
.chart-panel {
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--surface);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
min-height: 158px;
|
||||
padding: 18px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.metric-card::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0 auto 0 0;
|
||||
width: 5px;
|
||||
background: var(--primary);
|
||||
}
|
||||
|
||||
.metric-voltage::before {
|
||||
background: var(--voltage);
|
||||
}
|
||||
|
||||
.metric-power::before {
|
||||
background: var(--power);
|
||||
}
|
||||
|
||||
.metric-energy::before {
|
||||
background: var(--energy);
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
margin-top: 12px;
|
||||
color: var(--text);
|
||||
font-size: 44px;
|
||||
font-weight: 780;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.metric-value small {
|
||||
color: var(--muted);
|
||||
font-size: 18px;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.metric-meta {
|
||||
margin-top: 14px;
|
||||
min-height: 32px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.35;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.control-panel {
|
||||
margin-top: 14px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.control-heading {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.control-actions {
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.controls {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 1.6fr) minmax(170px, 1.1fr) repeat(5, minmax(112px, 0.8fr)) minmax(126px, 0.7fr);
|
||||
gap: 10px;
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
label {
|
||||
min-width: 0;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
label span {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
input,
|
||||
select {
|
||||
width: 100%;
|
||||
min-height: 40px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--surface-2);
|
||||
color: var(--text);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
select:focus {
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 3px rgba(38, 184, 149, 0.22);
|
||||
}
|
||||
|
||||
button {
|
||||
min-height: 40px;
|
||||
padding: 8px 14px;
|
||||
border: 1px solid var(--primary);
|
||||
border-radius: 6px;
|
||||
background: var(--primary);
|
||||
color: var(--btn-text);
|
||||
cursor: pointer;
|
||||
font-weight: 760;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: var(--primary-strong);
|
||||
border-color: var(--primary-strong);
|
||||
}
|
||||
|
||||
.secondary-button,
|
||||
.ghost-button {
|
||||
background: transparent;
|
||||
color: var(--text);
|
||||
border-color: var(--border);
|
||||
}
|
||||
|
||||
.secondary-button:hover,
|
||||
.ghost-button:hover {
|
||||
background: var(--surface-2);
|
||||
border-color: var(--primary);
|
||||
}
|
||||
|
||||
.switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 40px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--surface-2);
|
||||
}
|
||||
|
||||
.switch span {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
width: 18px;
|
||||
min-height: 18px;
|
||||
accent-color: var(--primary);
|
||||
}
|
||||
|
||||
.banner {
|
||||
margin-top: 12px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--danger);
|
||||
border-radius: 6px;
|
||||
background: var(--danger-bg);
|
||||
color: var(--danger);
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.chart-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.chart-panel {
|
||||
min-width: 0;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.chart-wide {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.chart-header {
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.tz-note {
|
||||
max-width: 230px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.35;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.chart-fixed {
|
||||
width: 100%;
|
||||
height: 320px;
|
||||
}
|
||||
|
||||
.chart-large {
|
||||
height: 340px;
|
||||
}
|
||||
|
||||
.statusbar {
|
||||
gap: 14px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 14px;
|
||||
padding-bottom: 4px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.statusbar span {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
.controls {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 820px) {
|
||||
.page-shell {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.topbar,
|
||||
.control-heading,
|
||||
.chart-header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.topbar-meta,
|
||||
.control-actions {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.summary-grid,
|
||||
.chart-grid,
|
||||
.controls {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
min-height: 140px;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
font-size: 38px;
|
||||
}
|
||||
|
||||
.tz-note {
|
||||
max-width: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.chart-fixed,
|
||||
.chart-large {
|
||||
height: 280px;
|
||||
}
|
||||
}
|
||||
html,body{height:100%}
|
||||
body{margin:0;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--text)}
|
||||
.container{max-width:1150px;margin:0 auto;padding:18px}
|
||||
header{display:flex;flex-direction:column;gap:12px;margin-bottom:14px}
|
||||
.brand{display:flex;align-items:center;gap:10px}
|
||||
h1{margin:0;font-size:24px;letter-spacing:.3px}
|
||||
.logo{width:28px;height:28px;border-radius:6px}
|
||||
.controls{display:flex;flex-wrap:wrap;gap:10px;background:var(--panel);padding:10px;border-radius:12px;border:1px solid var(--border)}
|
||||
label{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:8px}
|
||||
input,select,button{padding:8px 10px;border:1px solid var(--border);border-radius:10px;font-size:14px;background:var(--card);color:var(--text)}
|
||||
button{background:var(--btn);cursor:pointer;color:#fff}
|
||||
button:hover{background:var(--btn-hover)}
|
||||
.banner{background:#3f1d1d;color:#fecaca;border:1px solid #7f1d1d;padding:10px 12px;border-radius:10px}
|
||||
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:12px 0}
|
||||
.card{background:var(--panel);border:1px solid var(--border);border-radius:14px;padding:14px;box-shadow:0 1px 2px rgba(0,0,0,.1)}
|
||||
.card-title{font-size:12px;color:var(--muted)}
|
||||
.card-value{font-size:30px;font-weight:700;margin-top:6px;color:var(--text)}
|
||||
.card-value small{font-weight:400;color:var(--muted)}
|
||||
.card-ts{font-size:11px;color:var(--muted);margin-top:6px}
|
||||
.chart-block{background:var(--panel);border:1px solid var(--border);border-radius:14px;padding:14px;margin-top:12px}
|
||||
.chart-header{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:6px}
|
||||
.tz-note{font-size:12px;color:var(--muted)}
|
||||
.chart-fixed{height:280px;width:100%}
|
||||
footer{margin-top:12px;font-size:12px;color:var(--muted);display:flex;gap:16px;align-items:center;flex-wrap:wrap}
|
||||
.switch{display:flex;align-items:center;gap:6px}
|
||||
.theme button{border-color:var(--accent)}
|
||||
Reference in new issue
Block a user