File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 55from monsterui .all import *
66
77from dashboard .app import app , rt
8- from .batch_view import ChartManager
8+ from .batch_view import ChartManager , get_batch_view , DEFAULT_LOAD_N_CHARTS
9+ from dashboard .data import get_data
910
1011
1112@rt ("/batch/{batch_name}/search" )
@@ -79,3 +80,22 @@ def get(batch_name: str, start_index: int):
7980 hx_swap_oob = "true" ,
8081 ),
8182 ]
83+
84+ @rt ("/batch/{batch_name}/update-n" )
85+ def post (batch_name : str , last_n : str = "30n" , session = None ):
86+ """Update time window."""
87+ try :
88+ app .state .last_n [batch_name ] = last_n
89+ app .state .clear_batch_cache (batch_name )
90+ app .state .df_cache [batch_name ] = get_data (
91+ app .state .specs_enabled [batch_name ],
92+ last_n = last_n ,
93+ ensure_timestamp = True
94+ )
95+ app .state .calculate_metric_stats (batch_name )
96+ return get_batch_view (batch_name , initial_load = DEFAULT_LOAD_N_CHARTS )
97+ except ValueError as e :
98+ return Div (
99+ P (str (e ), cls = "text-red-500 p-4 text-center" ),
100+ id = "main-content" ,
101+ )
You can’t perform that action at this time.
0 commit comments