File size: 6,683 Bytes
bbe2211 d6a094c bbe2211 d203412 d6a094c d203412 d6a094c cc6b2b9 d6a094c d203412 d6a094c adb7e74 d203412 d6a094c d203412 d6a094c d203412 d6a094c d203412 cc6b2b9 d6a094c d203412 d6a094c d203412 d6a094c d203412 d6a094c d203412 d6a094c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | """
ARF UI Components
Gradio-first, Hugging Face Spaces safe
Compatible with app.py v3.8.0
"""
from __future__ import annotations
import gradio as gr
import plotly.graph_objects as go
from typing import Dict, Any, List
# ============================================================
# HEADER / FOOTER
# ============================================================
def create_header(version: str, enterprise: bool = False):
badge = "ENTERPRISE EDITION" if enterprise else "OSS EDITION"
return gr.HTML(
f"""
<div style="padding:20px;border-bottom:1px solid #eee">
<h1>🚀 Agentic Reliability Framework</h1>
<p><b>Version:</b> {version} · <b>{badge}</b></p>
</div>
"""
)
def create_footer():
return gr.HTML(
"""
<div style="padding:20px;border-top:1px solid #eee;text-align:center;color:#666">
ARF © 2025 · Self-Healing Agentic Systems
</div>
"""
)
def create_status_bar():
return gr.HTML(
"""
<div style="padding:10px;background:#f5f7fa;border-radius:8px">
✅ System Online · 🧠 Agentic Core Active · 📦 OSS Mode
</div>
"""
)
# ============================================================
# TAB 1 — INCIDENT DEMO
# ============================================================
def create_tab1_incident_demo(scenarios: Dict[str, Any], default: str):
scenario_dropdown = gr.Dropdown(
choices=list(scenarios.keys()),
value=default,
label="Incident Scenario"
)
scenario_description = gr.Markdown("Select a scenario to begin analysis.")
metrics_display = gr.JSON(label="Live Metrics")
impact_display = gr.Markdown("### Estimated Business Impact")
timeline_output = gr.Markdown("Timeline will render here")
oss_btn = gr.Button("Run OSS Analysis")
enterprise_btn = gr.Button("Execute Enterprise Healing", variant="primary")
approval_toggle = gr.Checkbox(label="Require Human Approval", value=True)
demo_btn = gr.Button("Run Demo")
approval_display = gr.HTML()
oss_results_display = gr.JSON(label="OSS Results")
enterprise_results_display = gr.JSON(label="Enterprise Results")
return (
scenario_dropdown,
scenario_description,
metrics_display,
impact_display,
timeline_output,
oss_btn,
enterprise_btn,
approval_toggle,
demo_btn,
approval_display,
oss_results_display,
enterprise_results_display,
)
# ============================================================
# TAB 2 — ROI / BUSINESS IMPACT
# ============================================================
def create_tab2_business_roi(scenarios: Dict[str, Any]):
dashboard_output = gr.Plot(label="Executive ROI Dashboard")
roi_scenario_dropdown = gr.Dropdown(
choices=list(scenarios.keys()),
label="Scenario"
)
monthly_slider = gr.Slider(
1, 100, value=15, step=1, label="Monthly Incidents"
)
team_slider = gr.Slider(
1, 50, value=5, step=1, label="On-call Team Size"
)
calculate_btn = gr.Button("Calculate ROI", variant="primary")
roi_output = gr.JSON(label="ROI Breakdown")
roi_chart = gr.Plot(label="ROI Multiplier")
return (
dashboard_output,
roi_scenario_dropdown,
monthly_slider,
team_slider,
calculate_btn,
roi_output,
roi_chart,
)
# ============================================================
# TAB 3 — ENTERPRISE FEATURES
# ============================================================
def create_tab3_enterprise_features():
license_display = gr.JSON(label="License Status")
validate_btn = gr.Button("Validate License")
trial_btn = gr.Button("Start Trial")
upgrade_btn = gr.Button("Upgrade")
mcp_mode = gr.Radio(
["advisory", "approval", "autonomous"],
value="advisory",
label="MCP Execution Mode"
)
mcp_mode_info = gr.JSON(label="Mode Details")
features_table = gr.Dataframe(
headers=["Feature", "Available"],
value=[
["Autonomous Healing", "Enterprise"],
["Audit Trail", "Enterprise"],
["Compliance", "Enterprise"],
],
interactive=False
)
integrations_table = gr.Dataframe(
headers=["Integration", "Status"],
value=[
["Kubernetes", "Ready"],
["AWS", "Ready"],
["GCP", "Ready"],
],
interactive=False
)
return (
license_display,
validate_btn,
trial_btn,
upgrade_btn,
mcp_mode,
mcp_mode_info,
features_table,
integrations_table,
)
# ============================================================
# TAB 4 — AUDIT TRAIL
# ============================================================
def create_tab4_audit_trail():
refresh_btn = gr.Button("Refresh")
clear_btn = gr.Button("Clear")
export_btn = gr.Button("Export")
execution_table = gr.Dataframe(
headers=["Time", "Scenario", "Mode", "Status", "Savings", "Details"],
interactive=False
)
incident_table = gr.Dataframe(
headers=["Time", "Component", "Scenario", "Severity", "Status"],
interactive=False
)
export_text = gr.Textbox(
label="Exported Audit JSON",
lines=15
)
return (
refresh_btn,
clear_btn,
export_btn,
execution_table,
incident_table,
export_text,
)
# ============================================================
# TAB 5 — LEARNING ENGINE
# ============================================================
def create_tab5_learning_engine():
learning_graph = gr.Plot(label="Learning Graph")
graph_type = gr.Dropdown(
["patterns", "performance", "confidence"],
value="patterns",
label="Graph Type"
)
show_labels = gr.Checkbox(value=True, label="Show Labels")
search_query = gr.Textbox(label="Search Incidents")
search_btn = gr.Button("Search")
clear_btn_search = gr.Button("Clear")
search_results = gr.JSON(label="Search Results")
stats_display = gr.JSON(label="Learning Stats")
patterns_display = gr.JSON(label="Detected Patterns")
performance_display = gr.JSON(label="Performance Metrics")
return (
learning_graph,
graph_type,
show_labels,
search_query,
search_btn,
clear_btn_search,
search_results,
stats_display,
patterns_display,
performance_display,
)
|