Create modern_integration.py
Browse files- ui/modern_integration.py +80 -0
ui/modern_integration.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
ui/modern_integration.py
|
| 3 |
+
Modern UI integration for Gradio app
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import gradio as gr
|
| 7 |
+
from ui.modern_components import (
|
| 8 |
+
initialize_modern_ui,
|
| 9 |
+
Card, Button, Badge, Grid, Stack,
|
| 10 |
+
ObservationGate, SequencingFlow, ProcessDisplay, Chart,
|
| 11 |
+
ResponsiveUtils, Accessibility, DarkMode
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
class ModernUIIntegration:
|
| 15 |
+
"""Integrate modern UI components with Gradio"""
|
| 16 |
+
|
| 17 |
+
@staticmethod
|
| 18 |
+
def inject_css_and_js() -> str:
|
| 19 |
+
"""Inject modern UI CSS and JavaScript"""
|
| 20 |
+
return initialize_modern_ui()
|
| 21 |
+
|
| 22 |
+
@staticmethod
|
| 23 |
+
def create_modern_layout() -> dict:
|
| 24 |
+
"""Create modern layout structure for tabs"""
|
| 25 |
+
return {
|
| 26 |
+
"css": ModernUIIntegration.inject_css_and_js(),
|
| 27 |
+
"container_class": "container container-lg",
|
| 28 |
+
"header": """
|
| 29 |
+
<div class="app-header">
|
| 30 |
+
<h1 class="text-3xl font-bold text-primary mb-2">
|
| 31 |
+
🚀 Agentic Reliability Framework v3.3.9
|
| 32 |
+
</h1>
|
| 33 |
+
<p class="text-muted mb-6">
|
| 34 |
+
OSS advises → Enterprise executes | Modern UI Enabled
|
| 35 |
+
</p>
|
| 36 |
+
</div>
|
| 37 |
+
""",
|
| 38 |
+
"tab_classes": {
|
| 39 |
+
"live_demo": "p-4 bg-gradient-to-br from-green-50 to-white dark:from-green-900/20 dark:to-gray-900",
|
| 40 |
+
"roi": "p-4 bg-gradient-to-br from-blue-50 to-white dark:from-blue-900/20 dark:to-gray-900",
|
| 41 |
+
"enterprise": "p-4 bg-gradient-to-br from-purple-50 to-white dark:from-purple-900/20 dark:to-gray-900",
|
| 42 |
+
"audit": "p-4 bg-gradient-to-br from-orange-50 to-white dark:from-orange-900/20 dark:to-gray-900",
|
| 43 |
+
"learning": "p-4 bg-gradient-to-br from-indigo-50 to-white dark:from-indigo-900/20 dark:to-gray-900"
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
@staticmethod
|
| 48 |
+
def wrap_component(component, card_config=None):
|
| 49 |
+
"""Wrap Gradio component with modern styling"""
|
| 50 |
+
if card_config:
|
| 51 |
+
# Create a card wrapper
|
| 52 |
+
title = card_config.get("title", "")
|
| 53 |
+
variant = card_config.get("variant", "default")
|
| 54 |
+
border_color = card_config.get("border_color", "")
|
| 55 |
+
|
| 56 |
+
with gr.Group(elem_classes=f"card card-{variant}"):
|
| 57 |
+
if title:
|
| 58 |
+
gr.Markdown(f"### {title}", elem_classes="card-title")
|
| 59 |
+
return component
|
| 60 |
+
return component
|
| 61 |
+
|
| 62 |
+
@staticmethod
|
| 63 |
+
def create_boundary_display(oss_content, enterprise_content):
|
| 64 |
+
"""Create OSS vs Enterprise boundary display"""
|
| 65 |
+
with gr.Row(elem_classes="boundary-row"):
|
| 66 |
+
with gr.Column(scale=1, elem_classes="oss-column"):
|
| 67 |
+
with gr.Group(elem_classes="card card-outlined border-l-4 border-l-green-500"):
|
| 68 |
+
gr.Markdown("### 🟢 OSS Advisory Layer",
|
| 69 |
+
elem_classes="text-lg font-semibold mb-2")
|
| 70 |
+
gr.Markdown("*Analysis & Recommendations*",
|
| 71 |
+
elem_classes="text-sm text-muted mb-4")
|
| 72 |
+
yield oss_content
|
| 73 |
+
|
| 74 |
+
with gr.Column(scale=1, elem_classes="enterprise-column"):
|
| 75 |
+
with gr.Group(elem_classes="card card-elevated border-l-4 border-l-purple-500"):
|
| 76 |
+
gr.Markdown("### 🟣 Enterprise Execution Layer",
|
| 77 |
+
elem_classes="text-lg font-semibold mb-2")
|
| 78 |
+
gr.Markdown("*Autonomous Action & Execution*",
|
| 79 |
+
elem_classes="text-sm text-muted mb-4")
|
| 80 |
+
yield enterprise_content
|