Update ui/components.py
Browse files- ui/components.py +54 -80
ui/components.py
CHANGED
|
@@ -1,108 +1,82 @@
|
|
| 1 |
"""
|
| 2 |
-
Minimalist,
|
| 3 |
-
|
| 4 |
-
Version: v1.1
|
| 5 |
"""
|
| 6 |
|
| 7 |
-
from __future__ import annotations
|
| 8 |
-
from typing import Dict, List, Any, Optional
|
| 9 |
import gradio as gr
|
|
|
|
| 10 |
|
| 11 |
# -----------------------------
|
| 12 |
-
# Header &
|
| 13 |
# -----------------------------
|
| 14 |
-
def create_header(
|
| 15 |
-
"
|
| 16 |
-
header_text = f"🚀 Agentic Reliability Framework v{version} · "
|
| 17 |
-
header_text += "ENTERPRISE" if is_enterprise else "OSS Edition"
|
| 18 |
-
return gr.Markdown(header_text, elem_classes=["mono"])
|
| 19 |
|
| 20 |
-
def
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
# -----------------------------
|
| 25 |
-
# Status Bar
|
| 26 |
-
# -----------------------------
|
| 27 |
-
def create_status_bar():
|
| 28 |
-
"""Minimalist status bar."""
|
| 29 |
-
return gr.Markdown("**Status:** idle", elem_classes=["mono"])
|
| 30 |
|
| 31 |
# -----------------------------
|
| 32 |
# Tab 1: Incident Demo
|
| 33 |
# -----------------------------
|
| 34 |
-
def create_tab1_incident_demo(
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
"""
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
# Display area for metrics/results
|
| 58 |
-
metrics_display = gr.Markdown("```\nExecution state: idle\n```", elem_classes=["mono"])
|
| 59 |
-
|
| 60 |
-
return scenario_dropdown, execution_mode, run_button, metrics_display
|
| 61 |
|
| 62 |
# -----------------------------
|
| 63 |
# Tab 2: Business ROI
|
| 64 |
# -----------------------------
|
| 65 |
-
def create_tab2_business_roi():
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
roi_markdown = gr.Markdown(
|
| 69 |
-
"## Business Impact & ROI\n```\nROI calculations will appear here\n```",
|
| 70 |
-
elem_classes=["mono"]
|
| 71 |
-
)
|
| 72 |
-
return roi_markdown
|
| 73 |
|
| 74 |
# -----------------------------
|
| 75 |
# Tab 3: Enterprise Features
|
| 76 |
# -----------------------------
|
| 77 |
-
def create_tab3_enterprise_features():
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
)
|
| 84 |
-
return features_markdown
|
| 85 |
|
| 86 |
# -----------------------------
|
| 87 |
# Tab 4: Audit Trail
|
| 88 |
# -----------------------------
|
| 89 |
-
def create_tab4_audit_trail():
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
audit_markdown = gr.Markdown(
|
| 93 |
-
"## Audit Trail & History\n```\nRecent actions will appear here\n```",
|
| 94 |
-
elem_classes=["mono"]
|
| 95 |
-
)
|
| 96 |
-
return audit_markdown
|
| 97 |
|
| 98 |
# -----------------------------
|
| 99 |
# Tab 5: Learning Engine
|
| 100 |
# -----------------------------
|
| 101 |
-
def create_tab5_learning_engine():
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
|
|
|
|
|
| 1 |
"""
|
| 2 |
+
Minimalist, math-first Gradio UI for Agentic Reliability Framework (ARF)
|
| 3 |
+
Only Gradio components; Streamlit removed
|
|
|
|
| 4 |
"""
|
| 5 |
|
|
|
|
|
|
|
| 6 |
import gradio as gr
|
| 7 |
+
from typing import Dict, List, Any
|
| 8 |
|
| 9 |
# -----------------------------
|
| 10 |
+
# Header & Status
|
| 11 |
# -----------------------------
|
| 12 |
+
def create_header() -> gr.HTML:
|
| 13 |
+
return gr.HTML("<h2>🚀 Agentic Reliability Framework v3.3.6 (OSS Edition)</h2>")
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
def create_status_bar() -> gr.HTML:
|
| 16 |
+
return gr.HTML(
|
| 17 |
+
"✅ System Online · 🧠 Agentic Core Active · 📦 OSS Mode"
|
| 18 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# -----------------------------
|
| 21 |
# Tab 1: Incident Demo
|
| 22 |
# -----------------------------
|
| 23 |
+
def create_tab1_incident_demo() -> tuple:
|
| 24 |
+
"""
|
| 25 |
+
Returns 12 Gradio components (matching previous unpacking in app.py)
|
| 26 |
+
"""
|
| 27 |
+
scenario_dropdown = gr.Dropdown(choices=["Cache Miss Storm", "DB Latency Spike"], label="Incident Scenario")
|
| 28 |
+
scenario_description = gr.Textbox(value="Select a scenario to begin analysis.", label="Description")
|
| 29 |
+
metrics_display = gr.Textbox(value="Live Metrics: TBD", label="Metrics")
|
| 30 |
+
impact_display = gr.Textbox(value="Estimated Business Impact: TBD", label="Impact")
|
| 31 |
+
|
| 32 |
+
approval_display = gr.Textbox(value="Approval Status: N/A", label="Approval")
|
| 33 |
+
oss_results_display = gr.Textbox(value="OSS Results: N/A", label="OSS")
|
| 34 |
+
enterprise_results_display = gr.Textbox(value="Enterprise Results: N/A", label="Enterprise")
|
| 35 |
+
|
| 36 |
+
run_oss_btn = gr.Button("Run OSS Analysis")
|
| 37 |
+
execute_enterprise_btn = gr.Button("Execute Enterprise Healing")
|
| 38 |
+
require_human_btn = gr.Button("Require Human Approval")
|
| 39 |
+
run_demo_btn = gr.Button("Run Demo")
|
| 40 |
+
|
| 41 |
+
return (
|
| 42 |
+
scenario_dropdown, scenario_description, metrics_display, impact_display,
|
| 43 |
+
approval_display, oss_results_display, enterprise_results_display,
|
| 44 |
+
run_oss_btn, execute_enterprise_btn, require_human_btn, run_demo_btn, gr.Textbox(value="", visible=False)
|
| 45 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
# -----------------------------
|
| 48 |
# Tab 2: Business ROI
|
| 49 |
# -----------------------------
|
| 50 |
+
def create_tab2_business_roi() -> tuple:
|
| 51 |
+
roi_display = gr.Textbox(value="ROI Calculator Output: TBD", label="ROI")
|
| 52 |
+
return (roi_display,)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# -----------------------------
|
| 55 |
# Tab 3: Enterprise Features
|
| 56 |
# -----------------------------
|
| 57 |
+
def create_tab3_enterprise_features() -> tuple:
|
| 58 |
+
features_display = gr.Textbox(
|
| 59 |
+
value="- Self-Healing Agentic Core\n- Enhanced Monitoring\n- Auto-Scaling",
|
| 60 |
+
label="Enterprise Features"
|
| 61 |
+
)
|
| 62 |
+
return (features_display,)
|
|
|
|
|
|
|
| 63 |
|
| 64 |
# -----------------------------
|
| 65 |
# Tab 4: Audit Trail
|
| 66 |
# -----------------------------
|
| 67 |
+
def create_tab4_audit_trail() -> tuple:
|
| 68 |
+
audit_display = gr.Textbox(value="Audit logs will appear here.", label="Audit Trail")
|
| 69 |
+
return (audit_display,)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
# -----------------------------
|
| 72 |
# Tab 5: Learning Engine
|
| 73 |
# -----------------------------
|
| 74 |
+
def create_tab5_learning_engine() -> tuple:
|
| 75 |
+
learning_display = gr.Textbox(value="Learning engine stats TBD.", label="Learning Engine")
|
| 76 |
+
return (learning_display,)
|
| 77 |
+
|
| 78 |
+
# -----------------------------
|
| 79 |
+
# Footer
|
| 80 |
+
# -----------------------------
|
| 81 |
+
def create_footer() -> gr.HTML:
|
| 82 |
+
return gr.HTML("ARF © 2025 · Self-Healing Agentic Systems")
|