Update ui/components.py
Browse files- ui/components.py +21 -7
ui/components.py
CHANGED
|
@@ -3,6 +3,7 @@ Gradio-only UI components for ARF
|
|
| 3 |
Ensures full compatibility with app.py
|
| 4 |
Updated with proper imports and error handling
|
| 5 |
NOW WITH REAL ARF INSTALLATION DETECTION
|
|
|
|
| 6 |
"""
|
| 7 |
|
| 8 |
import gradio as gr
|
|
@@ -102,13 +103,13 @@ def create_status_bar() -> gr.HTML:
|
|
| 102 |
""")
|
| 103 |
|
| 104 |
# -----------------------------
|
| 105 |
-
# Tab 1: Live Incident Demo - UPDATED
|
| 106 |
# -----------------------------
|
| 107 |
def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Cache Miss Storm") -> tuple:
|
| 108 |
"""
|
| 109 |
Create an expressive, comprehensive incident demo tab for ARF.
|
| 110 |
Shows the complete OSS analysis → Enterprise execution workflow.
|
| 111 |
-
UPDATED:
|
| 112 |
"""
|
| 113 |
|
| 114 |
# Get the default scenario data
|
|
@@ -340,6 +341,17 @@ def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Ca
|
|
| 340 |
show_label=False,
|
| 341 |
elem_id="timeline_plot"
|
| 342 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
|
| 344 |
# Right Column: Results & Metrics
|
| 345 |
with gr.Column(scale=1, variant="panel") as right_col:
|
|
@@ -448,14 +460,15 @@ def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Ca
|
|
| 448 |
return (
|
| 449 |
# Left column returns
|
| 450 |
scenario_dropdown, scenario_card, telemetry_viz, impact_viz,
|
| 451 |
-
# Middle column returns
|
| 452 |
workflow_header, detection_agent, recall_agent, decision_agent,
|
| 453 |
oss_section, enterprise_section, oss_btn, enterprise_btn,
|
| 454 |
-
approval_toggle, mcp_mode, timeline_viz,
|
| 455 |
# Right column returns
|
| 456 |
detection_time, mttr, auto_heal, savings,
|
| 457 |
oss_results_display, enterprise_results_display, approval_display, demo_btn
|
| 458 |
)
|
|
|
|
| 459 |
# -----------------------------
|
| 460 |
# Tab 2: Business ROI - Updated
|
| 461 |
# -----------------------------
|
|
@@ -648,8 +661,9 @@ def create_tab5_learning_engine() -> tuple:
|
|
| 648 |
return (learning_graph, graph_type, show_labels, search_query, search_btn,
|
| 649 |
clear_btn_search, search_results, stats_display, patterns_display, performance_display)
|
| 650 |
|
| 651 |
-
#
|
| 652 |
-
|
|
|
|
| 653 |
def create_realism_panel(scenario_data: Dict, scenario_name: str) -> gr.HTML:
|
| 654 |
"""
|
| 655 |
Create a realism panel showing ranked actions, risks, and uncertainty.
|
|
@@ -936,7 +950,7 @@ def create_realism_panel(scenario_data: Dict, scenario_name: str) -> gr.HTML:
|
|
| 936 |
"""
|
| 937 |
|
| 938 |
return gr.HTML(full_html)
|
| 939 |
-
|
| 940 |
# -----------------------------
|
| 941 |
# Footer
|
| 942 |
# -----------------------------
|
|
|
|
| 3 |
Ensures full compatibility with app.py
|
| 4 |
Updated with proper imports and error handling
|
| 5 |
NOW WITH REAL ARF INSTALLATION DETECTION
|
| 6 |
+
UPDATED: Added realism panel integration for Tab 1
|
| 7 |
"""
|
| 8 |
|
| 9 |
import gradio as gr
|
|
|
|
| 103 |
""")
|
| 104 |
|
| 105 |
# -----------------------------
|
| 106 |
+
# Tab 1: Live Incident Demo - UPDATED WITH REALISM PANEL
|
| 107 |
# -----------------------------
|
| 108 |
def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Cache Miss Storm") -> tuple:
|
| 109 |
"""
|
| 110 |
Create an expressive, comprehensive incident demo tab for ARF.
|
| 111 |
Shows the complete OSS analysis → Enterprise execution workflow.
|
| 112 |
+
UPDATED: Now includes realism panel for enterprise-seasoned SRE experience
|
| 113 |
"""
|
| 114 |
|
| 115 |
# Get the default scenario data
|
|
|
|
| 341 |
show_label=False,
|
| 342 |
elem_id="timeline_plot"
|
| 343 |
)
|
| 344 |
+
|
| 345 |
+
# ============ NEW: Realism Panel Section ============
|
| 346 |
+
realism_header = gr.Markdown("### 🎭 Realism: Trade-offs & Uncertainty")
|
| 347 |
+
realism_panel = gr.HTML(
|
| 348 |
+
value="""<div style="text-align: center; padding: 30px; color: #64748b;">
|
| 349 |
+
<div style="font-size: 48px; margin-bottom: 10px;">🔧</div>
|
| 350 |
+
<h4 style="margin: 0 0 10px 0;">Realism Panel</h4>
|
| 351 |
+
<p style="margin: 0;">Select a scenario to see ranked actions, risks, and trade-offs</p>
|
| 352 |
+
</div>""",
|
| 353 |
+
elem_id="realism_panel"
|
| 354 |
+
)
|
| 355 |
|
| 356 |
# Right Column: Results & Metrics
|
| 357 |
with gr.Column(scale=1, variant="panel") as right_col:
|
|
|
|
| 460 |
return (
|
| 461 |
# Left column returns
|
| 462 |
scenario_dropdown, scenario_card, telemetry_viz, impact_viz,
|
| 463 |
+
# Middle column returns (WITH REALISM PANEL)
|
| 464 |
workflow_header, detection_agent, recall_agent, decision_agent,
|
| 465 |
oss_section, enterprise_section, oss_btn, enterprise_btn,
|
| 466 |
+
approval_toggle, mcp_mode, timeline_viz, realism_panel,
|
| 467 |
# Right column returns
|
| 468 |
detection_time, mttr, auto_heal, savings,
|
| 469 |
oss_results_display, enterprise_results_display, approval_display, demo_btn
|
| 470 |
)
|
| 471 |
+
|
| 472 |
# -----------------------------
|
| 473 |
# Tab 2: Business ROI - Updated
|
| 474 |
# -----------------------------
|
|
|
|
| 661 |
return (learning_graph, graph_type, show_labels, search_query, search_btn,
|
| 662 |
clear_btn_search, search_results, stats_display, patterns_display, performance_display)
|
| 663 |
|
| 664 |
+
# -----------------------------
|
| 665 |
+
# Realism Panel Component
|
| 666 |
+
# -----------------------------
|
| 667 |
def create_realism_panel(scenario_data: Dict, scenario_name: str) -> gr.HTML:
|
| 668 |
"""
|
| 669 |
Create a realism panel showing ranked actions, risks, and uncertainty.
|
|
|
|
| 950 |
"""
|
| 951 |
|
| 952 |
return gr.HTML(full_html)
|
| 953 |
+
|
| 954 |
# -----------------------------
|
| 955 |
# Footer
|
| 956 |
# -----------------------------
|