Add log visualization tab to dashboard

This commit is contained in:
2026-07-22 21:01:19 +02:00
parent 27998ff879
commit 42f8b844d9
2 changed files with 99 additions and 0 deletions
+30
View File
@@ -19,6 +19,7 @@ from stats.id_viewer import _format_can_id_vec, plot_bits
from stats.frequency import calculate_frequency, plot_frequency
from stats.correlation import calculate_correlation, plot_correlation_heatmap
from stats.entropy import calculate_byte_entropy, plot_entropy_heatmap
from logs import render_logs_table
RAW_LOG_DIR = "data/logs"
@@ -128,6 +129,25 @@ app.layout = dbc.Container([
dbc.Tab(label="Overview", tab_id="overview", children=[
html.Div(id="overview-content")
]),
dbc.Tab(label="Logs", tab_id="logs", children=[
dbc.Row([
dbc.Col(html.Label("Select Vehicle:", className="mt-2"), width="auto"),
dbc.Col(dcc.Dropdown(
id='logs-vehicle-selector',
options=[{'label': v, 'value': v} for v in DATA.keys()],
value=list(DATA.keys())[0] if DATA else None,
clearable=False
), width=3, className="me-4"),
dbc.Col(html.Label("Select Bus:", className="mt-2"), width="auto"),
dbc.Col(dcc.Dropdown(
id='logs-bus-selector',
options=[{'label': 'Bus 1', 'value': 'Bus 1'}, {'label': 'Bus 2', 'value': 'Bus 2'}],
value='Bus 1',
clearable=False
), width=2),
], className="mb-3 mt-3", align="end"),
html.Div(id='logs-table-container')
]),
dbc.Tab(label="Statistics", tab_id="statistics", children=[
dbc.Row([
dbc.Col(html.Label("Select Vehicle:", className="mt-2"), width="auto"),
@@ -156,6 +176,16 @@ app.layout = dbc.Container([
], id="main-tabs", active_tab="statistics")
], fluid=True)
@app.callback(
Output('logs-table-container', 'children'),
Input('logs-vehicle-selector', 'value'),
Input('logs-bus-selector', 'value')
)
def update_logs_table(vehicle, bus):
if not vehicle or not bus or vehicle not in DATA or bus not in DATA[vehicle]:
return html.Div("No data available")
return render_logs_table(DATA[vehicle][bus])
@app.callback(
Output('tab-content', 'children'),
Input('tabs', 'active_tab'),