petter2025 commited on
Commit
a400436
ยท
verified ยท
1 Parent(s): 17b2161

Update ui/components.py

Browse files
Files changed (1) hide show
  1. ui/components.py +109 -33
ui/components.py CHANGED
@@ -1,5 +1,5 @@
1
  """
2
- UI components for the 5-tab demo - FIXED VERSION
3
  """
4
 
5
  import gradio as gr
@@ -7,11 +7,11 @@ from typing import Dict, List, Any, Optional, Tuple
7
  import plotly.graph_objects as go
8
 
9
 
10
- def create_header(oss_version: str, oss_available: bool) -> gr.HTML: # CHANGED from gr.Markdown to gr.HTML
11
  """Create the demo header - FIXED VERSION"""
12
  status_badge = "โœ… Connected" if oss_available else "โš ๏ธ Mock Mode"
13
 
14
- return gr.HTML(f""" # CHANGED from gr.Markdown to gr.HTML
15
  <div style="text-align: center; padding: 30px 20px 20px 20px; background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%); border-radius: 0 0 20px 20px; margin-bottom: 30px; border-bottom: 3px solid #4ECDC4;">
16
  <h1 style="margin-bottom: 10px;">๐Ÿš€ Agentic Reliability Framework</h1>
17
  <h2 style="color: #4a5568; font-weight: 600; margin-bottom: 20px;">Investor Demo v3.8.0</h2>
@@ -152,7 +152,7 @@ def create_tab1_incident_demo(scenarios: Dict, default_scenario: str = "Cache Mi
152
  approval_display, oss_results_display, enterprise_results_display)
153
 
154
 
155
- def create_tab2_business_roi() -> Tuple:
156
  """Create Tab 2: Business Impact & ROI - FIXED VERSION"""
157
  with gr.Column():
158
  gr.Markdown("### ๐Ÿ“Š Executive Dashboard")
@@ -161,10 +161,10 @@ def create_tab2_business_roi() -> Tuple:
161
  gr.Markdown("### ๐Ÿงฎ ROI Calculator")
162
  with gr.Row():
163
  with gr.Column(scale=1):
164
- # Scenario selector
165
  roi_scenario_dropdown = gr.Dropdown(
166
- choices=[],
167
- value="",
168
  label="Select scenario for ROI calculation:",
169
  interactive=True
170
  )
@@ -200,7 +200,7 @@ def create_tab2_business_roi() -> Tuple:
200
 
201
 
202
  def create_tab3_enterprise_features() -> Tuple:
203
- """Create Tab 3: Enterprise Features"""
204
  with gr.Row():
205
  # Left Column
206
  with gr.Column(scale=1):
@@ -210,8 +210,9 @@ def create_tab3_enterprise_features() -> Tuple:
210
  value={
211
  "status": "Active",
212
  "tier": "Enterprise",
213
- "expires": "2024-12-31",
214
- "features": ["autonomous_healing", "compliance", "audit_trail"]
 
215
  },
216
  label="Current License"
217
  )
@@ -253,6 +254,10 @@ def create_tab3_enterprise_features() -> Tuple:
253
  ["Multi-Cloud Support", "โŒ", "โœ…"],
254
  ["Audit Trail", "Basic", "Comprehensive"],
255
  ["Role-Based Access", "โŒ", "โœ…"],
 
 
 
 
256
  ],
257
  label="",
258
  interactive=False
@@ -261,14 +266,23 @@ def create_tab3_enterprise_features() -> Tuple:
261
  gr.Markdown("### ๐Ÿ”— Integrations")
262
 
263
  integrations_table = gr.Dataframe(
264
- headers=["Platform", "Status"],
265
  value=[
266
- ["AWS", "โœ… Connected"],
267
- ["Azure", "โœ… Connected"],
268
- ["GCP", "โœ… Connected"],
269
- ["Datadog", "โœ… Connected"],
270
- ["PagerDuty", "โœ… Connected"],
271
- ["ServiceNow", "โœ… Connected"],
 
 
 
 
 
 
 
 
 
272
  ],
273
  label="",
274
  interactive=False
@@ -279,7 +293,31 @@ def create_tab3_enterprise_features() -> Tuple:
279
 
280
 
281
  def create_tab4_audit_trail() -> Tuple:
282
- """Create Tab 4: Audit Trail & History"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  with gr.Row():
284
  # Left Column
285
  with gr.Column(scale=1):
@@ -292,7 +330,7 @@ def create_tab4_audit_trail() -> Tuple:
292
 
293
  execution_table = gr.Dataframe(
294
  headers=["Time", "Scenario", "Mode", "Status", "Savings", "Details"],
295
- value=[],
296
  label="",
297
  interactive=False
298
  )
@@ -303,7 +341,7 @@ def create_tab4_audit_trail() -> Tuple:
303
 
304
  incident_table = gr.Dataframe(
305
  headers=["Time", "Component", "Scenario", "Severity", "Status"],
306
- value=[],
307
  label="",
308
  interactive=False
309
  )
@@ -320,13 +358,39 @@ def create_tab4_audit_trail() -> Tuple:
320
 
321
 
322
  def create_tab5_learning_engine() -> Tuple:
323
- """Create Tab 5: Learning Engine"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  with gr.Row():
325
  # Left Column
326
  with gr.Column(scale=2):
327
  gr.Markdown("### ๐Ÿง  Incident Memory Graph")
328
 
329
- learning_graph = gr.Plot(label="", show_label=False)
330
 
331
  with gr.Row():
332
  graph_type = gr.Radio(
@@ -352,7 +416,7 @@ def create_tab5_learning_engine() -> Tuple:
352
 
353
  search_results = gr.Dataframe(
354
  headers=["Incident", "Similarity", "Resolution", "Actions"],
355
- value=[],
356
  label="",
357
  interactive=False
358
  )
@@ -363,10 +427,12 @@ def create_tab5_learning_engine() -> Tuple:
363
 
364
  stats_display = gr.JSON(
365
  value={
366
- "total_incidents": 0,
367
- "patterns_detected": 0,
368
- "similarity_searches": 0,
369
- "confidence_threshold": 0.85
 
 
370
  },
371
  label="Statistics"
372
  )
@@ -374,7 +440,14 @@ def create_tab5_learning_engine() -> Tuple:
374
  gr.Markdown("### ๐ŸŽฏ Pattern Detection")
375
 
376
  patterns_display = gr.JSON(
377
- value={},
 
 
 
 
 
 
 
378
  label="Detected Patterns"
379
  )
380
 
@@ -382,9 +455,12 @@ def create_tab5_learning_engine() -> Tuple:
382
 
383
  performance_display = gr.JSON(
384
  value={
385
- "avg_resolution_time": "0 min",
386
- "success_rate": "0%",
387
- "auto_heal_rate": "0%"
 
 
 
388
  },
389
  label="Performance Metrics"
390
  )
@@ -393,9 +469,9 @@ def create_tab5_learning_engine() -> Tuple:
393
  clear_btn, search_results, stats_display, patterns_display, performance_display)
394
 
395
 
396
- def create_footer() -> gr.HTML: # CHANGED from gr.Markdown to gr.HTML
397
  """Create the demo footer - UPDATED FOR 2026"""
398
- return gr.HTML(""" # CHANGED from gr.Markdown to gr.HTML
399
  <div style="margin-top: 40px; padding: 30px; background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%); border-radius: 20px; color: white;">
400
  <div style="border-top: 1px solid #4a5568; padding-top: 20px; text-align: center; color: #a0aec0; font-size: 0.9rem;">
401
  <p style="margin: 0;">ยฉ 2026 Agentic Reliability Framework. Demo v3.8.0 Enterprise Edition.</p>
 
1
  """
2
+ UI components for the 5-tab demo - COMPLETE FIXED VERSION
3
  """
4
 
5
  import gradio as gr
 
7
  import plotly.graph_objects as go
8
 
9
 
10
+ def create_header(oss_version: str, oss_available: bool) -> gr.HTML:
11
  """Create the demo header - FIXED VERSION"""
12
  status_badge = "โœ… Connected" if oss_available else "โš ๏ธ Mock Mode"
13
 
14
+ return gr.HTML(f"""
15
  <div style="text-align: center; padding: 30px 20px 20px 20px; background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%); border-radius: 0 0 20px 20px; margin-bottom: 30px; border-bottom: 3px solid #4ECDC4;">
16
  <h1 style="margin-bottom: 10px;">๐Ÿš€ Agentic Reliability Framework</h1>
17
  <h2 style="color: #4a5568; font-weight: 600; margin-bottom: 20px;">Investor Demo v3.8.0</h2>
 
152
  approval_display, oss_results_display, enterprise_results_display)
153
 
154
 
155
+ def create_tab2_business_roi(scenarios: Dict) -> Tuple:
156
  """Create Tab 2: Business Impact & ROI - FIXED VERSION"""
157
  with gr.Column():
158
  gr.Markdown("### ๐Ÿ“Š Executive Dashboard")
 
161
  gr.Markdown("### ๐Ÿงฎ ROI Calculator")
162
  with gr.Row():
163
  with gr.Column(scale=1):
164
+ # Scenario selector - FIXED: Initialize with scenarios
165
  roi_scenario_dropdown = gr.Dropdown(
166
+ choices=list(scenarios.keys()),
167
+ value="Cache Miss Storm",
168
  label="Select scenario for ROI calculation:",
169
  interactive=True
170
  )
 
200
 
201
 
202
  def create_tab3_enterprise_features() -> Tuple:
203
+ """Create Tab 3: Enterprise Features - UPDATED"""
204
  with gr.Row():
205
  # Left Column
206
  with gr.Column(scale=1):
 
210
  value={
211
  "status": "Active",
212
  "tier": "Enterprise",
213
+ "expires": "2026-12-31",
214
+ "features": ["autonomous_healing", "compliance", "audit_trail",
215
+ "predictive_analytics", "multi_cloud", "role_based_access"]
216
  },
217
  label="Current License"
218
  )
 
254
  ["Multi-Cloud Support", "โŒ", "โœ…"],
255
  ["Audit Trail", "Basic", "Comprehensive"],
256
  ["Role-Based Access", "โŒ", "โœ…"],
257
+ ["Custom Dashboards", "โŒ", "โœ…"],
258
+ ["Enterprise Support", "Community", "24/7 SLA"],
259
+ ["Custom Integrations", "โŒ", "โœ…"],
260
+ ["Advanced Analytics", "โŒ", "โœ…"]
261
  ],
262
  label="",
263
  interactive=False
 
266
  gr.Markdown("### ๐Ÿ”— Integrations")
267
 
268
  integrations_table = gr.Dataframe(
269
+ headers=["Platform", "Status", "Type"],
270
  value=[
271
+ ["AWS", "โœ… Connected", "Cloud"],
272
+ ["Azure", "โœ… Connected", "Cloud"],
273
+ ["GCP", "โœ… Connected", "Cloud"],
274
+ ["Datadog", "โœ… Connected", "Monitoring"],
275
+ ["PagerDuty", "โœ… Connected", "Alerting"],
276
+ ["ServiceNow", "โœ… Connected", "ITSM"],
277
+ ["Slack", "โœ… Connected", "Collaboration"],
278
+ ["Teams", "โœ… Connected", "Collaboration"],
279
+ ["GitHub", "โœ… Connected", "DevOps"],
280
+ ["GitLab", "โœ… Connected", "DevOps"],
281
+ ["Jira", "โœ… Connected", "Project Management"],
282
+ ["Splunk", "โœ… Connected", "Monitoring"],
283
+ ["New Relic", "โœ… Connected", "APM"],
284
+ ["Prometheus", "โœ… Connected", "Metrics"],
285
+ ["Elasticsearch", "โœ… Connected", "Logging"]
286
  ],
287
  label="",
288
  interactive=False
 
293
 
294
 
295
  def create_tab4_audit_trail() -> Tuple:
296
+ """Create Tab 4: Audit Trail & History - WITH DEMO DATA"""
297
+ # Demo data
298
+ demo_executions = [
299
+ ["14:30", "Cache Miss Storm", "Autonomous", "โœ… Success", "$7,225", "Auto-execution"],
300
+ ["14:15", "Database Connection Pool", "Approval", "โœ… Success", "$3,570", "Approved by admin"],
301
+ ["13:45", "Memory Leak", "Advisory", "โš ๏ธ Analysis", "$0", "OSS analysis only"],
302
+ ["13:20", "Cache Miss Storm", "Autonomous", "โœ… Success", "$7,225", "Pattern match"],
303
+ ["12:50", "API Rate Limit", "Approval", "โœ… Success", "$3,230", "Scheduled fix"],
304
+ ["12:15", "Network Partition", "Autonomous", "โœ… Success", "$10,200", "Emergency response"],
305
+ ["11:40", "Storage I/O", "Advisory", "โš ๏ธ Analysis", "$0", "Performance review"]
306
+ ]
307
+
308
+ demo_incidents = [
309
+ ["14:30", "redis_cache", "Cache Miss Storm", "CRITICAL", "Resolved"],
310
+ ["14:15", "postgresql", "Database Connection Pool", "HIGH", "Resolved"],
311
+ ["13:45", "java_service", "Memory Leak", "HIGH", "Analyzed"],
312
+ ["13:20", "redis_cache", "Cache Miss Storm", "CRITICAL", "Resolved"],
313
+ ["12:50", "api_gateway", "API Rate Limit", "MEDIUM", "Resolved"],
314
+ ["12:15", "database", "Network Partition", "CRITICAL", "Resolved"],
315
+ ["11:40", "storage", "Storage I/O", "HIGH", "Analyzed"],
316
+ ["11:10", "redis_cache", "Cache Performance", "LOW", "Monitoring"],
317
+ ["10:45", "load_balancer", "Traffic Spike", "MEDIUM", "Auto-scaled"],
318
+ ["10:20", "api_gateway", "Rate Limit", "MEDIUM", "Resolved"]
319
+ ]
320
+
321
  with gr.Row():
322
  # Left Column
323
  with gr.Column(scale=1):
 
330
 
331
  execution_table = gr.Dataframe(
332
  headers=["Time", "Scenario", "Mode", "Status", "Savings", "Details"],
333
+ value=demo_executions,
334
  label="",
335
  interactive=False
336
  )
 
341
 
342
  incident_table = gr.Dataframe(
343
  headers=["Time", "Component", "Scenario", "Severity", "Status"],
344
+ value=demo_incidents,
345
  label="",
346
  interactive=False
347
  )
 
358
 
359
 
360
  def create_tab5_learning_engine() -> Tuple:
361
+ """Create Tab 5: Learning Engine - WITH DEMO DATA"""
362
+ # Demo data
363
+ demo_search_results = [
364
+ ["Cache Miss Storm", "92%", "Scale Redis + Circuit Breaker", "โœ… Auto-healed"],
365
+ ["Database Connection", "85%", "Increase pool + Monitoring", "โœ… Approved"],
366
+ ["Memory Leak Pattern", "78%", "Heap analysis + Restart", "โš ๏ธ Advisory"],
367
+ ["API Rate Limit", "72%", "Backoff + Queue", "โœ… Auto-healed"],
368
+ ["Network Partition", "65%", "Quorum + Consensus", "โœ… Emergency"]
369
+ ]
370
+
371
+ # Create a simple demo graph
372
+ fig = go.Figure(data=go.Scatter(
373
+ x=[1, 2, 3, 4, 5],
374
+ y=[2, 5, 3, 8, 7],
375
+ mode='markers+text',
376
+ marker=dict(size=[20, 30, 25, 40, 35], color=['#FF6B6B', '#4ECDC4', '#45B7D1', '#FFE66D', '#9B59B6']),
377
+ text=['Cache', 'DB', 'Memory', 'API', 'Network'],
378
+ textposition="top center"
379
+ ))
380
+
381
+ fig.update_layout(
382
+ title="Incident Pattern Relationships",
383
+ height=400,
384
+ paper_bgcolor="rgba(0,0,0,0)",
385
+ plot_bgcolor="rgba(0,0,0,0)"
386
+ )
387
+
388
  with gr.Row():
389
  # Left Column
390
  with gr.Column(scale=2):
391
  gr.Markdown("### ๐Ÿง  Incident Memory Graph")
392
 
393
+ learning_graph = gr.Plot(value=fig, label="", show_label=False)
394
 
395
  with gr.Row():
396
  graph_type = gr.Radio(
 
416
 
417
  search_results = gr.Dataframe(
418
  headers=["Incident", "Similarity", "Resolution", "Actions"],
419
+ value=demo_search_results,
420
  label="",
421
  interactive=False
422
  )
 
427
 
428
  stats_display = gr.JSON(
429
  value={
430
+ "total_incidents": 42,
431
+ "patterns_detected": 6,
432
+ "similarity_searches": 128,
433
+ "confidence_threshold": 0.85,
434
+ "successful_predictions": 38,
435
+ "accuracy_rate": "90.5%"
436
  },
437
  label="Statistics"
438
  )
 
440
  gr.Markdown("### ๐ŸŽฏ Pattern Detection")
441
 
442
  patterns_display = gr.JSON(
443
+ value={
444
+ "cache_miss_storm": {"occurrences": 12, "confidence": 0.92, "auto_heal": True},
445
+ "db_connection_exhaustion": {"occurrences": 8, "confidence": 0.88, "auto_heal": True},
446
+ "memory_leak_java": {"occurrences": 5, "confidence": 0.85, "auto_heal": False},
447
+ "api_rate_limit": {"occurrences": 10, "confidence": 0.91, "auto_heal": True},
448
+ "network_partition": {"occurrences": 3, "confidence": 0.79, "auto_heal": True},
449
+ "storage_io_saturation": {"occurrences": 4, "confidence": 0.86, "auto_heal": False}
450
+ },
451
  label="Detected Patterns"
452
  )
453
 
 
455
 
456
  performance_display = gr.JSON(
457
  value={
458
+ "avg_resolution_time": "8.2 min",
459
+ "success_rate": "95.2%",
460
+ "auto_heal_rate": "78.6%",
461
+ "mttr_reduction": "85%",
462
+ "cost_savings": "$1.2M",
463
+ "roi_multiplier": "5.2ร—"
464
  },
465
  label="Performance Metrics"
466
  )
 
469
  clear_btn, search_results, stats_display, patterns_display, performance_display)
470
 
471
 
472
+ def create_footer() -> gr.HTML:
473
  """Create the demo footer - UPDATED FOR 2026"""
474
+ return gr.HTML("""
475
  <div style="margin-top: 40px; padding: 30px; background: linear-gradient(135deg, #1a365d 0%, #2d3748 100%); border-radius: 20px; color: white;">
476
  <div style="border-top: 1px solid #4a5568; padding-top: 20px; text-align: center; color: #a0aec0; font-size: 0.9rem;">
477
  <p style="margin: 0;">ยฉ 2026 Agentic Reliability Framework. Demo v3.8.0 Enterprise Edition.</p>