From 0a576b57b06ad8a3df683ae9ef05cc5fa60ee5d8 Mon Sep 17 00:00:00 2001 From: Lukas Metzger Date: Thu, 25 Jun 2020 14:50:54 +0200 Subject: Fixes for machines --- dash/pages/machines.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'dash') diff --git a/dash/pages/machines.py b/dash/pages/machines.py index b82df43..b6cb6f8 100644 --- a/dash/pages/machines.py +++ b/dash/pages/machines.py @@ -55,6 +55,9 @@ def layout(): dbc.Row([dbc.Col([ dcc.Loading(dcc.Graph(id='machines-graph-location')) ])]), + dbc.Row([dbc.Col([ + dcc.Loading(html.Pre(id='machines-sum-location')) + ])]), dbc.Row([ dbc.Col(width=12, md=6, xl=4, children=[ dcc.Loading(dcc.Graph(id='machines-graph-ram')) @@ -65,7 +68,7 @@ def layout(): dbc.Col(width=12, md=6, xl=4, children=[ dcc.Loading(dcc.Graph(id='machines-graph-kvmstate')) ]), - dbc.Col(width=12, xl=8, children=[ + dbc.Col(width=12, xl=7, children=[ dcc.Loading(dcc.Graph(id='machines-graph-systemmodel')), ]), dbc.Col(width=12, xl=4, id='machines-graph-systemmodel-locations-container', children=[ @@ -84,7 +87,7 @@ def layout(): ] )) ]), - dbc.Col(width=12, xl=8, children=[ + dbc.Col(width=12, xl=7, children=[ dcc.Loading(dcc.Graph(id='machines-graph-cpumodel')), ]), dbc.Col(width=12, xl=4, id='machines-graph-cpumodel-locations-container', children=[ @@ -106,7 +109,8 @@ def layout(): ]) ]) -@app.callback(Output('machines-graph-location', 'figure'), +@app.callback([Output('machines-graph-location', 'figure'), + Output('machines-sum-location', 'children')], [Input('machines-days', 'value'), Input('machines-date', 'date'), Input('machines-satellites', 'value')]) @@ -139,16 +143,20 @@ def make_graph_location(days, date, satellites): y=[item['count'] for item in data] )) figure.update_layout( - title_text = 'Locations' + title_text = 'Locations', + yaxis_title = 'Machines' ) - return figure + + totalStr = 'Total Locations: {}'.format(len(data)) + + return figure, totalStr @app.callback(Output('machines-graph-cpumodel', 'figure'), [Input('machines-days', 'value'), Input('machines-date', 'date'), Input('machines-satellites', 'value')]) def make_graph_cpumodel(days, date, satellites): - return make_graph(days, date, satellites, 'cpumodel', 'CPU', typ='bar') + return make_graph(days, date, satellites, 'cpumodel', 'CPU
Click Bar to view Details', typ='bar') @app.callback(Output('machines-graph-realcores', 'figure'), [Input('machines-days', 'value'), @@ -169,7 +177,7 @@ def make_graph_ram(days, date, satellites): Input('machines-date', 'date'), Input('machines-satellites', 'value')]) def make_graph_systemmodel(days, date, satellites): - return make_graph(days, date, satellites, 'systemmodel', 'System Model', typ='bar') + return make_graph(days, date, satellites, 'systemmodel', 'System Model
Click Bar to view Details', typ='bar') @app.callback(Output('machines-graph-kvmstate', 'figure'), [Input('machines-days', 'value'), -- cgit v1.2.3-55-g7522