| """ |
| 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 |
|
|
| |
| |
| |
| 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" |
| ) |
|
|
| |
| |
| |
| 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 |
| ) |
|
|
| |
| |
| |
| 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) |
|
|
| |
| |
| |
| 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) |
|
|
| |
| |
| |
| 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) |
|
|
| |
| |
| |
| 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) |
|
|
| |
| |
| |
| def create_footer() -> gr.HTML: |
| return gr.HTML("ARF © 2025 · Self-Healing Agentic Systems") |
|
|