GuglielmoTor commited on
Commit
4a9f759
·
verified ·
1 Parent(s): 6cdc55f

Update services/analytics_tab_module.py

Browse files
Files changed (1) hide show
  1. services/analytics_tab_module.py +26 -13
services/analytics_tab_module.py CHANGED
@@ -534,19 +534,19 @@ class AnalyticsTab:
534
  self.explore_outputs_list.extend([self.section_titles_map.get(s_name, gr.update()) for s_name in UNIQUE_ORDERED_SECTIONS])
535
 
536
  def _setup_callbacks(self):
537
- # Apply filter button
538
- # graph_refresh_inputs = [
539
- # self.token_state, self.date_filter_selector,
540
- # self.custom_start_date_picker, self.custom_end_date_picker,
541
- # self.chat_histories_st
542
- # ]
543
- # self.apply_filter_btn.click(
544
- # fn=self._refresh_analytics_graphs_ui,
545
- # inputs=graph_refresh_inputs,
546
- # outputs=self.graph_refresh_outputs_list,
547
- # show_progress="full",
548
- # api_name="refresh_analytics_graphs_module"
549
- # )
550
 
551
  # Panel action buttons (bomb, formula, explore)
552
  action_click_inputs = [
@@ -876,6 +876,19 @@ class AnalyticsTab:
876
  # inputs=[self.date_filter_selector],
877
  # outputs=[self.custom_start_date_picker, self.custom_end_date_picker]
878
  # )
 
 
 
 
 
 
 
 
 
 
 
 
 
879
 
880
  with gr.Row(equal_height=False):
881
  with gr.Column(scale=8) as self.plots_area_col:
 
534
  self.explore_outputs_list.extend([self.section_titles_map.get(s_name, gr.update()) for s_name in UNIQUE_ORDERED_SECTIONS])
535
 
536
  def _setup_callbacks(self):
537
+ #Apply filter button
538
+ graph_refresh_inputs = [
539
+ self.token_state, self.date_filter_selector,
540
+ self.custom_start_date_picker, self.custom_end_date_picker,
541
+ self.chat_histories_st
542
+ ]
543
+ self.apply_filter_btn.click(
544
+ fn=self._refresh_analytics_graphs_ui,
545
+ inputs=graph_refresh_inputs,
546
+ outputs=self.graph_refresh_outputs_list,
547
+ show_progress="full",
548
+ api_name="refresh_analytics_graphs_module"
549
+ )
550
 
551
  # Panel action buttons (bomb, formula, explore)
552
  action_click_inputs = [
 
876
  # inputs=[self.date_filter_selector],
877
  # outputs=[self.custom_start_date_picker, self.custom_end_date_picker]
878
  # )
879
+ with gr.Column(visible=False) as self.date_filter_container:
880
+ # --- END: Added Container ---
881
+
882
+ with gr.Row():
883
+ self.date_filter_selector = gr.Radio(
884
+ ["Sempre", "Ultimi 7 Giorni", "Ultimi 30 Giorni", "Intervallo Personalizzato"],
885
+ label="Seleziona Intervallo Date per Grafici", value="Sempre", scale=3
886
+ )
887
+ with gr.Column(scale=2):
888
+ self.custom_start_date_picker = Calendar(label="Data Inizio", visible=False, type="datetime")
889
+ self.custom_end_date_picker = Calendar(label="Data Fine", visible=False, type="datetime")
890
+
891
+ self.apply_filter_btn = gr.Button("Applica Filtro & Aggiorna Grafici", variant="primary")
892
 
893
  with gr.Row(equal_height=False):
894
  with gr.Column(scale=8) as self.plots_area_col: