GuglielmoTor commited on
Commit
4343ee5
·
verified ·
1 Parent(s): bb1bc48

Update ui/ui_main_page_enhancements.py

Browse files
Files changed (1) hide show
  1. ui/ui_main_page_enhancements.py +21 -3
ui/ui_main_page_enhancements.py CHANGED
@@ -532,7 +532,9 @@ def build_main_app_ui(
532
  build_home_tab_ui_func,
533
  create_enhanced_report_tab_func,
534
  create_enhanced_okr_tab_func,
535
- format_report_for_display_func # New argument to pass the formatting function
 
 
536
  ):
537
  """
538
  Builds the main Gradio application UI with enhanced styling and structure.
@@ -540,6 +542,8 @@ def build_main_app_ui(
540
  Args:
541
  (All necessary functions and constants are passed as arguments to ensure self-containment
542
  within the UI module without direct imports of non-UI related logic)
 
 
543
 
544
  Returns:
545
  tuple: A tuple containing:
@@ -686,6 +690,20 @@ def build_main_app_ui(
686
  <p>Agentic modules could not be loaded. This tab is currently unavailable.</p>
687
  </div>
688
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689
  else:
690
  # Keep the old components but make them invisible to maintain load_and_display_agentic_results signature
691
  with gr.Column(visible=False):
@@ -721,7 +739,7 @@ def build_main_app_ui(
721
  report_header_html_display, # 7: New HTML output for header
722
  report_body_markdown_display, # 8: New Markdown output for body
723
  reconstruction_cache_st, # 9: Reconstruction cache state
724
- enhanced_okr_display_html if AGENTIC_MODULES_LOADED else gr.State(get_initial_okr_display()), # NEW: The enhanced HTML display for OKRs
725
  actionable_okrs_data_st # 11: NEW: The actionable_okrs dictionary state
726
  ]
727
 
@@ -730,4 +748,4 @@ def build_main_app_ui(
730
  tabs, report_selector_dd, agentic_display_outputs,
731
  analytics_tab_instance, chat_histories_st,
732
  current_chat_plot_id_st, plot_data_for_chatbot_st, # Return these as well
733
- format_report_for_display_func) # Return format_report_for_display_func as well
 
532
  build_home_tab_ui_func,
533
  create_enhanced_report_tab_func,
534
  create_enhanced_okr_tab_func,
535
+ format_report_for_display_func, # New argument to pass the formatting function
536
+ AGENTIC_MODULES_LOADED, # ADD THIS PARAMETER
537
+ get_initial_okr_display_func=None # ADD THIS PARAMETER TOO
538
  ):
539
  """
540
  Builds the main Gradio application UI with enhanced styling and structure.
 
542
  Args:
543
  (All necessary functions and constants are passed as arguments to ensure self-containment
544
  within the UI module without direct imports of non-UI related logic)
545
+ AGENTIC_MODULES_LOADED (bool): Whether agentic modules are loaded
546
+ get_initial_okr_display_func (callable): Function to get initial OKR display
547
 
548
  Returns:
549
  tuple: A tuple containing:
 
690
  <p>Agentic modules could not be loaded. This tab is currently unavailable.</p>
691
  </div>
692
  """)
693
+ # Create dummy components to maintain compatibility
694
+ enhanced_okr_display_html = gr.HTML("""
695
+ <div class="card" style="text-align: center; padding: 2rem;">
696
+ <div style="font-size: 2rem; margin-bottom: 1rem;">🔴</div>
697
+ <h3 style="color: var(--error-color);">OKR Display Unavailable</h3>
698
+ <p>Agentic modules are not loaded.</p>
699
+ </div>
700
+ """)
701
+ # Create hidden old components for compatibility
702
+ with gr.Column(visible=False):
703
+ gr.Markdown("### Suggested Key Results (OLD UI - HIDDEN)")
704
+ key_results_cbg = gr.CheckboxGroup(label="Select Key Results", choices=[], value=[], interactive=True)
705
+ gr.Markdown("### Detailed OKRs and Tasks (OLD UI - HIDDEN)")
706
+ okr_detail_display_md = gr.Markdown("I dettagli OKR appariranno qui.")
707
  else:
708
  # Keep the old components but make them invisible to maintain load_and_display_agentic_results signature
709
  with gr.Column(visible=False):
 
739
  report_header_html_display, # 7: New HTML output for header
740
  report_body_markdown_display, # 8: New Markdown output for body
741
  reconstruction_cache_st, # 9: Reconstruction cache state
742
+ enhanced_okr_display_html, # 10: The enhanced HTML display for OKRs
743
  actionable_okrs_data_st # 11: NEW: The actionable_okrs dictionary state
744
  ]
745
 
 
748
  tabs, report_selector_dd, agentic_display_outputs,
749
  analytics_tab_instance, chat_histories_st,
750
  current_chat_plot_id_st, plot_data_for_chatbot_st, # Return these as well
751
+ format_report_for_display_func) # Return format_report_for_display_func as well