diff options
author | Peter Mikus <pmikus@cisco.com> | 2022-02-24 14:19:54 +0100 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2022-03-16 15:06:29 +0000 |
commit | 646c242bfaea75db747df8c178c050499994c789 (patch) | |
tree | 5b55404db1c923253d8a4199825e3d6c15d759a1 /resources/tools/dash/app/pal/report/report.py | |
parent | 6d99a2a08376860e18701174146506046c46b92c (diff) |
feat(uti): Data source
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: Idbd1f0f5a4b08909c2c8e783da62024c850ec90a
Diffstat (limited to 'resources/tools/dash/app/pal/report/report.py')
-rw-r--r-- | resources/tools/dash/app/pal/report/report.py | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/resources/tools/dash/app/pal/report/report.py b/resources/tools/dash/app/pal/report/report.py index d22a0b6705..769a6dd63e 100644 --- a/resources/tools/dash/app/pal/report/report.py +++ b/resources/tools/dash/app/pal/report/report.py @@ -18,10 +18,10 @@ import dash from dash import dcc from dash import html from dash import dash_table -import numpy as np -import pandas as pd -from .data import create_dataframe +from .data import read_stats +from .data import read_trending_mrr, read_trending_ndrpdr +from .data import read_iterative_mrr, read_iterative_ndrpdr from .layout import html_layout @@ -43,34 +43,66 @@ def init_report(server): ], ) - # Load DataFrame - df = create_dataframe() - # Custom HTML layout dash_app.index_string = html_layout # Create Layout dash_app.layout = html.Div( children=[ - create_data_table(df), + html.Div( + children=create_data_table( + read_stats().dropna(), + u"database-table-stats" + ) + ), + html.Div( + children=create_data_table( + read_trending_mrr().dropna(), + u"database-table-mrr" + ) + ), + html.Div( + children=create_data_table( + read_trending_ndrpdr().dropna(), + u"database-table-ndrpdr" + ) + ), + html.Div( + children=create_data_table( + read_iterative_mrr().dropna(), + u"database-table-iterative-mrr" + ) + ), + html.Div( + children=create_data_table( + read_iterative_ndrpdr().dropna(), + u"database-table-iterative-ndrpdr" + ) + ) ], id=u"dash-container", ) return dash_app.server -def create_data_table(df): +def create_data_table(df, id): """Create Dash datatable from Pandas DataFrame. DEMO """ table = dash_table.DataTable( - id=u"database-table", + id=id, columns=[{u"name": i, u"id": i} for i in df.columns], data=df.to_dict(u"records"), + fixed_rows={'headers': True}, sort_action=u"native", sort_mode=u"native", page_size=5, + style_header={ + 'overflow': 'hidden', + 'textOverflow': 'ellipsis', + 'minWidth': 95, 'maxWidth': 95, 'width': 95, + } ) return table |