petter2025 commited on
Commit
cd0e1e1
·
verified ·
1 Parent(s): 23c10b8

Update ui/components.py

Browse files
Files changed (1) hide show
  1. ui/components.py +14 -2
ui/components.py CHANGED
@@ -1,11 +1,23 @@
1
  """
2
  Gradio-only UI components for ARF
3
  Ensures full compatibility with app.py
 
4
  """
5
 
6
  import gradio as gr
7
  from typing import Dict, List, Any
8
- from demo.scenarios import INCIDENT_SCENARIOS
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  # -----------------------------
11
  # Header & Status
@@ -176,7 +188,7 @@ def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Ca
176
  <div>
177
  <p style="margin: 8px 0; font-size: 14px; color: #475569;"><strong>Action:</strong> Scale Redis cluster from 3 to 5 nodes</p>
178
  <p style="margin: 8px 0; font-size: 14px; color: #475569;"><strong>Pattern Match:</strong> Similar incident resolved with scaling (87% success rate)</p>
179
- <p style="margin: 8px 0; font-size: 14px; color: #475569;"><strong>Safety Check:</strong> ✅ Passed (blast radius: 2 services)</p>
180
  <p style="margin: 8px 0; font-size: 14px; color: #475569;"><strong>Estimated Impact:</strong> Reduce MTTR from 45min to 12min</p>
181
  </div>
182
  <div style="margin-top: 20px; text-align: center;">
 
1
  """
2
  Gradio-only UI components for ARF
3
  Ensures full compatibility with app.py
4
+ Updated with proper imports and error handling
5
  """
6
 
7
  import gradio as gr
8
  from typing import Dict, List, Any
9
+ import logging
10
+
11
+ logger = logging.getLogger(__name__)
12
+
13
+ # Try to import scenarios from registry first
14
+ try:
15
+ from config.scenario_registry import ScenarioRegistry
16
+ INCIDENT_SCENARIOS = ScenarioRegistry.load_scenarios()
17
+ logger.info(f"Loaded {len(INCIDENT_SCENARIOS)} scenarios from registry")
18
+ except ImportError:
19
+ logger.warning("Scenario registry not available, falling back to demo scenarios")
20
+ from demo.scenarios import INCIDENT_SCENARIOS
21
 
22
  # -----------------------------
23
  # Header & Status
 
188
  <div>
189
  <p style="margin: 8px 0; font-size: 14px; color: #475569;"><strong>Action:</strong> Scale Redis cluster from 3 to 5 nodes</p>
190
  <p style="margin: 8px 0; font-size: 14px; color: #475569;"><strong>Pattern Match:</strong> Similar incident resolved with scaling (87% success rate)</p>
191
+ <p style="margin: 8px 0; font-size= 14px; color: #475569;"><strong>Safety Check:</strong> ✅ Passed (blast radius: 2 services)</p>
192
  <p style="margin: 8px 0; font-size: 14px; color: #475569;"><strong>Estimated Impact:</strong> Reduce MTTR from 45min to 12min</p>
193
  </div>
194
  <div style="margin-top: 20px; text-align: center;">