File size: 5,501 Bytes
bbe2211 6814bd9 bbe2211 d203412 d6a094c 0212d29 6814bd9 d6a094c 7655fd6 0212d29 7655fd6 6814bd9 7655fd6 0212d29 a438938 7655fd6 6814bd9 0212d29 6814bd9 0212d29 6814bd9 0212d29 ebdbbf6 7655fd6 6814bd9 d203412 7655fd6 0212d29 6814bd9 d6a094c 7655fd6 0212d29 6814bd9 16a1427 7655fd6 0212d29 6814bd9 0212d29 | 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 | """
Gradio-only UI components for ARF
Ensures full compatibility with app.py
"""
import gradio as gr
from typing import Dict, List, Any
from demo.scenarios import INCIDENT_SCENARIOS
# -----------------------------
# Header & Status
# -----------------------------
def create_header(version="3.3.6", mock_mode=False) -> gr.HTML:
mock_text = " · MOCK MODE" if mock_mode else ""
return gr.HTML(f"<h2>🚀 Agentic Reliability Framework v{version} (OSS Edition){mock_text}</h2>")
def create_status_bar() -> gr.HTML:
return gr.HTML(
"✅ System Online · 🧠 Agentic Core Active · 📦 OSS Mode"
)
# -----------------------------
# Tab 1: Incident Demo
# -----------------------------
def create_tab1_incident_demo(scenarios=INCIDENT_SCENARIOS, default_scenario="Cache Miss Storm") -> tuple:
scenario_dropdown = gr.Dropdown(choices=list(scenarios.keys()), value=default_scenario, label="Incident Scenario")
scenario_description = gr.Textbox(value="Select a scenario to begin analysis.", label="Description")
metrics_display = gr.Textbox(value="Live Metrics: TBD", label="Metrics")
impact_display = gr.Textbox(value="Estimated Business Impact: TBD", label="Impact")
timeline_output = gr.Textbox(value="Incident timeline TBD.", label="Timeline")
oss_btn = gr.Button("Run OSS Analysis")
enterprise_btn = gr.Button("Execute Enterprise Healing")
approval_toggle = gr.Checkbox(label="Require Human Approval?", value=False)
demo_btn = gr.Button("Run Demo")
approval_display = gr.Textbox(value="Approval Status: N/A", label="Approval")
oss_results_display = gr.Textbox(value="OSS Results: N/A", label="OSS")
enterprise_results_display = gr.Textbox(value="Enterprise Results: N/A", label="Enterprise")
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: Business ROI
# -----------------------------
def create_tab2_business_roi(scenarios=INCIDENT_SCENARIOS) -> tuple:
dashboard_output = gr.Textbox(value="Dashboard TBD", label="Dashboard")
roi_scenario_dropdown = gr.Dropdown(choices=list(scenarios.keys()), value="Cache Miss Storm", label="Scenario")
monthly_slider = gr.Slider(minimum=1, maximum=50, value=15, step=1, label="Monthly Incidents")
team_slider = gr.Slider(minimum=1, maximum=50, value=5, step=1, label="Team Size")
calculate_btn = gr.Button("Calculate ROI")
roi_output = gr.Textbox(value="ROI Output TBD", label="ROI")
roi_chart = gr.Plot()
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() -> tuple:
license_display = gr.Textbox(value="License info TBD", label="License")
validate_btn = gr.Button("Validate License")
trial_btn = gr.Button("Start Trial")
upgrade_btn = gr.Button("Upgrade")
mcp_mode = gr.Dropdown(choices=["advisory", "approval", "autonomous"], value="advisory", label="MCP Mode")
mcp_mode_info = gr.Textbox(value="MCP Mode Info TBD", label="Mode Info")
features_table = gr.Dataframe(headers=["Feature", "Status"], value=[["Self-Healing Core", "Active"]])
integrations_table = gr.Dataframe(headers=["Integration", "Status"], value=[["Monitoring", "Connected"]])
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() -> tuple:
refresh_btn = gr.Button("Refresh")
clear_btn = gr.Button("Clear History")
export_btn = gr.Button("Export")
execution_table = gr.Dataframe(headers=["Time", "Scenario", "Mode", "Status", "Savings", "Details"])
incident_table = gr.Dataframe(headers=["Time", "Component", "Scenario", "Severity", "Status"])
export_text = gr.Textbox(value="Export JSON will appear here", label="Export")
return (refresh_btn, clear_btn, export_btn, execution_table, incident_table, export_text)
# -----------------------------
# Tab 5: Learning Engine
# -----------------------------
def create_tab5_learning_engine() -> tuple:
learning_graph = gr.Plot()
graph_type = gr.Dropdown(choices=["Graph A", "Graph B"], value="Graph A", label="Graph Type")
show_labels = gr.Checkbox(label="Show Labels", value=True)
search_query = gr.Textbox(label="Search Patterns")
search_btn = gr.Button("Search")
clear_btn_search = gr.Button("Clear Search")
search_results = gr.Textbox(value="Search Results TBD", label="Results")
stats_display = gr.Textbox(value="Stats TBD", label="Stats")
patterns_display = gr.Textbox(value="Patterns TBD", label="Patterns")
performance_display = gr.Textbox(value="Performance TBD", label="Performance")
return (learning_graph, graph_type, show_labels, search_query, search_btn,
clear_btn_search, search_results, stats_display, patterns_display, performance_display)
# -----------------------------
# Footer
# -----------------------------
def create_footer() -> gr.HTML:
return gr.HTML("ARF © 2025 · Self-Healing Agentic Systems")
|