Update ui/styles.py
Browse files- ui/styles.py +178 -484
ui/styles.py
CHANGED
|
@@ -1,541 +1,235 @@
|
|
| 1 |
"""
|
| 2 |
-
|
| 3 |
-
Updated with REAL ARF installation detection - FIXED ENUM ERROR
|
| 4 |
"""
|
| 5 |
-
from typing import Optional, Dict, Any, List
|
| 6 |
-
from enum import Enum
|
| 7 |
-
import os
|
| 8 |
import logging
|
| 9 |
|
| 10 |
logger = logging.getLogger(__name__)
|
| 11 |
|
| 12 |
-
|
| 13 |
-
try:
|
| 14 |
-
from pydantic_settings import BaseSettings
|
| 15 |
-
from pydantic import Field, validator
|
| 16 |
-
PYDANTIC_V2 = True
|
| 17 |
-
logger.info("Using pydantic-settings for BaseSettings")
|
| 18 |
-
except ImportError:
|
| 19 |
-
try:
|
| 20 |
-
from pydantic import BaseSettings, Field, validator
|
| 21 |
-
PYDANTIC_V2 = False
|
| 22 |
-
logger.info("Using pydantic.BaseSettings (older version)")
|
| 23 |
-
except ImportError as e:
|
| 24 |
-
logger.error(f"Failed to import pydantic: {e}")
|
| 25 |
-
# Create minimal fallback
|
| 26 |
-
class BaseSettings:
|
| 27 |
-
def __init__(self, **kwargs):
|
| 28 |
-
for k, v in kwargs.items():
|
| 29 |
-
setattr(self, k, v)
|
| 30 |
-
|
| 31 |
-
class Field:
|
| 32 |
-
@staticmethod
|
| 33 |
-
def default(value):
|
| 34 |
-
return value
|
| 35 |
-
|
| 36 |
-
def validator(*args, **kwargs):
|
| 37 |
-
def decorator(func):
|
| 38 |
-
return func
|
| 39 |
-
return decorator
|
| 40 |
-
|
| 41 |
-
PYDANTIC_V2 = False
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
class ARFMode(str, Enum):
|
| 45 |
-
"""ARF operation modes"""
|
| 46 |
-
DEMO = "demo"
|
| 47 |
-
OSS = "oss"
|
| 48 |
-
ENTERPRISE = "enterprise"
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
class SafetyMode(str, Enum):
|
| 52 |
-
"""Safety modes for execution"""
|
| 53 |
-
ADVISORY = "advisory"
|
| 54 |
-
APPROVAL = "approval"
|
| 55 |
-
AUTONOMOUS = "autonomous"
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
class InstallationStatus(str, Enum):
|
| 59 |
-
"""ARF package installation status"""
|
| 60 |
-
NOT_INSTALLED = "not_installed"
|
| 61 |
-
OSS_ONLY = "oss_only"
|
| 62 |
-
ENTERPRISE = "enterprise"
|
| 63 |
-
BOTH = "both"
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
class Settings(BaseSettings):
|
| 67 |
"""
|
| 68 |
-
|
| 69 |
"""
|
|
|
|
|
|
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
)
|
| 76 |
-
|
| 77 |
-
use_true_arf: bool = Field(
|
| 78 |
-
default=True,
|
| 79 |
-
description="Use true ARF integration when available"
|
| 80 |
-
)
|
| 81 |
-
|
| 82 |
-
# ===== Installation Status (Auto-detected) =====
|
| 83 |
-
arf_oss_installed: bool = Field(
|
| 84 |
-
default=False,
|
| 85 |
-
description="ARF OSS package installed"
|
| 86 |
-
)
|
| 87 |
-
|
| 88 |
-
arf_enterprise_installed: bool = Field(
|
| 89 |
-
default=False,
|
| 90 |
-
description="ARF Enterprise package installed"
|
| 91 |
-
)
|
| 92 |
-
|
| 93 |
-
arf_oss_version: Optional[str] = Field(
|
| 94 |
-
default=None,
|
| 95 |
-
description="ARF OSS version if installed"
|
| 96 |
-
)
|
| 97 |
-
|
| 98 |
-
arf_enterprise_version: Optional[str] = Field(
|
| 99 |
-
default=None,
|
| 100 |
-
description="ARF Enterprise version if installed"
|
| 101 |
-
)
|
| 102 |
-
|
| 103 |
-
# ===== ARF Configuration =====
|
| 104 |
-
arf_api_key: Optional[str] = Field(
|
| 105 |
-
default=None,
|
| 106 |
-
description="ARF API key for real integration"
|
| 107 |
-
)
|
| 108 |
-
|
| 109 |
-
arf_base_url: str = Field(
|
| 110 |
-
default="https://api.arf.dev",
|
| 111 |
-
description="ARF API base URL"
|
| 112 |
-
)
|
| 113 |
-
|
| 114 |
-
# ===== Business Configuration =====
|
| 115 |
-
engineer_hourly_rate: float = Field(
|
| 116 |
-
default=150.0,
|
| 117 |
-
description="Engineer hourly rate in USD"
|
| 118 |
-
)
|
| 119 |
-
|
| 120 |
-
engineer_annual_cost: float = Field(
|
| 121 |
-
default=125000.0,
|
| 122 |
-
description="Engineer annual cost in USD"
|
| 123 |
-
)
|
| 124 |
-
|
| 125 |
-
default_savings_rate: float = Field(
|
| 126 |
-
default=0.82,
|
| 127 |
-
description="Default savings rate with ARF"
|
| 128 |
-
)
|
| 129 |
-
|
| 130 |
-
# ===== UI Configuration =====
|
| 131 |
-
auto_refresh_seconds: int = Field(
|
| 132 |
-
default=30,
|
| 133 |
-
description="Auto-refresh interval in seconds"
|
| 134 |
-
)
|
| 135 |
-
|
| 136 |
-
max_history_items: int = Field(
|
| 137 |
-
default=100,
|
| 138 |
-
description="Maximum history items to display"
|
| 139 |
-
)
|
| 140 |
-
|
| 141 |
-
# ===== Demo Configuration =====
|
| 142 |
-
default_scenario: str = Field(
|
| 143 |
-
default="Cache Miss Storm",
|
| 144 |
-
description="Default incident scenario"
|
| 145 |
-
)
|
| 146 |
-
|
| 147 |
-
scenario_config_path: str = Field(
|
| 148 |
-
default="config/scenarios",
|
| 149 |
-
description="Path to scenario configuration files"
|
| 150 |
-
)
|
| 151 |
-
|
| 152 |
-
# ===== Safety Configuration =====
|
| 153 |
-
default_safety_mode: str = Field(
|
| 154 |
-
default="advisory", # Changed from SafetyMode to string
|
| 155 |
-
description="Default safety mode: advisory, approval, autonomous"
|
| 156 |
-
)
|
| 157 |
-
|
| 158 |
-
require_approval: bool = Field(
|
| 159 |
-
default=True,
|
| 160 |
-
description="Require human approval for execution"
|
| 161 |
-
)
|
| 162 |
-
|
| 163 |
-
# ===== Validation =====
|
| 164 |
-
@validator("arf_api_key")
|
| 165 |
-
def validate_api_key(cls, v: Optional[str], values: Dict[str, Any]) -> Optional[str]:
|
| 166 |
-
if values.get("arf_mode") == "enterprise" and not v:
|
| 167 |
-
raise ValueError("ARF API key required for Enterprise mode")
|
| 168 |
-
return v
|
| 169 |
-
|
| 170 |
-
@validator("use_true_arf")
|
| 171 |
-
def validate_true_arf(cls, v: bool, values: Dict[str, Any]) -> bool:
|
| 172 |
-
if v and not values.get("arf_oss_installed"):
|
| 173 |
-
logger.warning("True ARF requested but OSS package not installed. Using mock mode.")
|
| 174 |
-
return False
|
| 175 |
-
return v
|
| 176 |
-
|
| 177 |
-
# ===== Installation Detection =====
|
| 178 |
-
@classmethod
|
| 179 |
-
def detect_installation(cls):
|
| 180 |
-
"""Detect ARF package installation"""
|
| 181 |
-
results = {
|
| 182 |
-
"oss_installed": False,
|
| 183 |
-
"enterprise_installed": False,
|
| 184 |
-
"oss_version": None,
|
| 185 |
-
"enterprise_version": None
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
# Check OSS package
|
| 189 |
-
try:
|
| 190 |
-
import agentic_reliability_framework as arf_oss
|
| 191 |
-
results["oss_installed"] = True
|
| 192 |
-
results["oss_version"] = getattr(arf_oss, '__version__', '3.3.7')
|
| 193 |
-
logger.info(f"✅ ARF OSS v{results['oss_version']} detected")
|
| 194 |
-
except ImportError:
|
| 195 |
-
logger.info("⚠️ ARF OSS not installed - will use mock mode")
|
| 196 |
-
|
| 197 |
-
# Check Enterprise package
|
| 198 |
-
try:
|
| 199 |
-
import arf_enterprise
|
| 200 |
-
results["enterprise_installed"] = True
|
| 201 |
-
results["enterprise_version"] = getattr(arf_enterprise, '__version__', '1.0.2')
|
| 202 |
-
logger.info(f"✅ ARF Enterprise v{results['enterprise_version']} detected")
|
| 203 |
-
except ImportError:
|
| 204 |
-
logger.info("⚠️ ARF Enterprise not installed - will use simulation")
|
| 205 |
-
|
| 206 |
-
return results
|
| 207 |
-
|
| 208 |
-
def get_installation_status(self) -> InstallationStatus:
|
| 209 |
-
"""Get current installation status"""
|
| 210 |
-
if self.arf_oss_installed and self.arf_enterprise_installed:
|
| 211 |
-
return InstallationStatus.BOTH
|
| 212 |
-
elif self.arf_enterprise_installed:
|
| 213 |
-
return InstallationStatus.ENTERPRISE
|
| 214 |
-
elif self.arf_oss_installed:
|
| 215 |
-
return InstallationStatus.OSS_ONLY
|
| 216 |
-
else:
|
| 217 |
-
return InstallationStatus.NOT_INSTALLED
|
| 218 |
-
|
| 219 |
-
def get_installation_badges(self) -> Dict[str, Any]:
|
| 220 |
-
"""Get badge information for UI display"""
|
| 221 |
-
if self.arf_oss_installed:
|
| 222 |
-
oss_badge = {
|
| 223 |
-
"text": f"✅ ARF OSS v{self.arf_oss_version}",
|
| 224 |
-
"color": "#10b981",
|
| 225 |
-
"icon": "✅"
|
| 226 |
-
}
|
| 227 |
-
else:
|
| 228 |
-
oss_badge = {
|
| 229 |
-
"text": "⚠️ Mock ARF",
|
| 230 |
-
"color": "#f59e0b",
|
| 231 |
-
"icon": "⚠️"
|
| 232 |
-
}
|
| 233 |
-
|
| 234 |
-
if self.arf_enterprise_installed:
|
| 235 |
-
enterprise_badge = {
|
| 236 |
-
"text": f"🚀 Enterprise v{self.arf_enterprise_version}",
|
| 237 |
-
"color": "#8b5cf6",
|
| 238 |
-
"icon": "🚀"
|
| 239 |
-
}
|
| 240 |
-
else:
|
| 241 |
-
enterprise_badge = {
|
| 242 |
-
"text": "🔒 Enterprise Required",
|
| 243 |
-
"color": "#64748b",
|
| 244 |
-
"icon": "🔒"
|
| 245 |
-
}
|
| 246 |
-
|
| 247 |
-
return {
|
| 248 |
-
"oss": oss_badge,
|
| 249 |
-
"enterprise": enterprise_badge
|
| 250 |
-
}
|
| 251 |
-
|
| 252 |
-
def get_installation_recommendations(self) -> List[str]:
|
| 253 |
-
"""Get installation recommendations"""
|
| 254 |
-
recommendations = []
|
| 255 |
-
|
| 256 |
-
if not self.arf_oss_installed:
|
| 257 |
-
recommendations.append(
|
| 258 |
-
"Install real ARF OSS: `pip install agentic-reliability-framework==3.3.7`"
|
| 259 |
-
)
|
| 260 |
-
|
| 261 |
-
if not self.arf_enterprise_installed:
|
| 262 |
-
recommendations.append(
|
| 263 |
-
"Install ARF Enterprise: `pip install agentic-reliability-enterprise` (requires license)"
|
| 264 |
-
)
|
| 265 |
-
|
| 266 |
-
return recommendations
|
| 267 |
-
|
| 268 |
-
class Config:
|
| 269 |
-
env_file = ".env"
|
| 270 |
-
env_file_encoding = "utf-8"
|
| 271 |
-
case_sensitive = False
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
# Global settings instance with installation detection
|
| 275 |
-
try:
|
| 276 |
-
# First detect installation
|
| 277 |
-
installation_info = Settings.detect_installation()
|
| 278 |
-
|
| 279 |
-
# Create settings with installation info
|
| 280 |
-
settings = Settings(
|
| 281 |
-
arf_oss_installed=installation_info["oss_installed"],
|
| 282 |
-
arf_enterprise_installed=installation_info["enterprise_installed"],
|
| 283 |
-
arf_oss_version=installation_info["oss_version"],
|
| 284 |
-
arf_enterprise_version=installation_info["enterprise_version"],
|
| 285 |
-
)
|
| 286 |
-
|
| 287 |
-
# Log installation status
|
| 288 |
-
status = settings.get_installation_status()
|
| 289 |
-
logger.info(f"ARF Installation Status: {status.value}")
|
| 290 |
-
|
| 291 |
-
if status == InstallationStatus.NOT_INSTALLED:
|
| 292 |
-
logger.warning("No ARF packages installed. Demo will use mock mode.")
|
| 293 |
-
logger.warning("For real ARF experience, install: pip install agentic-reliability-framework==3.3.7")
|
| 294 |
-
|
| 295 |
-
except Exception as e:
|
| 296 |
-
logger.warning(f"Failed to load settings: {e}, using defaults")
|
| 297 |
-
settings = Settings(
|
| 298 |
-
arf_mode="demo",
|
| 299 |
-
use_true_arf=False,
|
| 300 |
-
arf_oss_installed=False,
|
| 301 |
-
arf_enterprise_installed=False,
|
| 302 |
-
engineer_hourly_rate=150.0,
|
| 303 |
-
engineer_annual_cost=125000.0,
|
| 304 |
-
default_savings_rate=0.82,
|
| 305 |
-
auto_refresh_seconds=30,
|
| 306 |
-
max_history_items=100,
|
| 307 |
-
default_scenario="Cache Miss Storm",
|
| 308 |
-
scenario_config_path="config/scenarios",
|
| 309 |
-
default_safety_mode="advisory",
|
| 310 |
-
require_approval=True
|
| 311 |
-
)
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
def get_settings() -> Settings:
|
| 315 |
-
"""Get settings instance (singleton pattern)"""
|
| 316 |
-
return settings
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
def print_installation_status():
|
| 320 |
-
"""Print installation status to console - SAFE VERSION"""
|
| 321 |
-
try:
|
| 322 |
-
s = get_settings()
|
| 323 |
-
|
| 324 |
-
print("=" * 70)
|
| 325 |
-
print("🚀 ARF Ultimate Investor Demo - Installation Status")
|
| 326 |
-
print("=" * 70)
|
| 327 |
-
|
| 328 |
-
print(f"📦 ARF OSS: {'✅ v' + s.arf_oss_version if s.arf_oss_installed else '⚠️ Not installed'}")
|
| 329 |
-
print(f"🏢 Enterprise: {'✅ v' + s.arf_enterprise_version if s.arf_enterprise_installed else '⚠️ Not installed'}")
|
| 330 |
-
|
| 331 |
-
# Safe string access
|
| 332 |
-
print(f"🎯 Mode: {s.arf_mode.upper()}")
|
| 333 |
-
print(f"🤖 Using True ARF: {'✅ Yes' if s.use_true_arf else '⚠️ Mock mode'}")
|
| 334 |
-
|
| 335 |
-
recommendations = s.get_installation_recommendations()
|
| 336 |
-
if recommendations:
|
| 337 |
-
print("\n💡 Recommendations:")
|
| 338 |
-
for rec in recommendations:
|
| 339 |
-
print(f" • {rec}")
|
| 340 |
-
|
| 341 |
-
print("=" * 70)
|
| 342 |
-
|
| 343 |
-
except Exception as e:
|
| 344 |
-
print(f"⚠️ Could not print installation status: {e}")
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
def get_styles() -> str:
|
| 348 |
-
"""Return CSS styles for ARF demo - ADDED THIS FUNCTION"""
|
| 349 |
-
return """
|
| 350 |
-
/* ARF Demo Styles - Professional Dark Theme */
|
| 351 |
-
:root {
|
| 352 |
-
--primary: #3b82f6;
|
| 353 |
-
--primary-dark: #1d4ed8;
|
| 354 |
-
--success: #10b981;
|
| 355 |
-
--danger: #ef4444;
|
| 356 |
-
--warning: #f59e0b;
|
| 357 |
-
--dark-bg: #0f172a;
|
| 358 |
-
--dark-card: #1e293b;
|
| 359 |
-
--dark-border: #334155;
|
| 360 |
-
--dark-text: #f8fafc;
|
| 361 |
-
--dark-muted: #94a3b8;
|
| 362 |
-
}
|
| 363 |
-
|
| 364 |
-
/* Modern Glass Effect */
|
| 365 |
-
.glass {
|
| 366 |
-
background: rgba(255, 255, 255, 0.05);
|
| 367 |
-
backdrop-filter: blur(10px);
|
| 368 |
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 369 |
-
}
|
| 370 |
-
|
| 371 |
-
/* Professional Card Styling */
|
| 372 |
-
.arf-card {
|
| 373 |
-
border: 1px solid var(--dark-border);
|
| 374 |
-
border-radius: 14px;
|
| 375 |
-
padding: 20px;
|
| 376 |
-
background: var(--dark-card);
|
| 377 |
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
|
| 378 |
-
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
| 379 |
}
|
| 380 |
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
}
|
| 385 |
|
| 386 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 387 |
.tab-nav {
|
| 388 |
-
background:
|
| 389 |
-
border-bottom: 2px solid
|
| 390 |
}
|
| 391 |
|
| 392 |
.tab-nav .tab {
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
border-radius: 8px 8px 0 0;
|
| 396 |
-
border: 2px solid transparent;
|
| 397 |
-
border-bottom: none;
|
| 398 |
-
transition: all 0.2s ease;
|
| 399 |
}
|
| 400 |
|
| 401 |
.tab-nav .tab.selected {
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
|
|
|
| 405 |
}
|
| 406 |
|
| 407 |
-
/*
|
| 408 |
button {
|
| 409 |
border-radius: 10px !important;
|
| 410 |
font-weight: 600 !important;
|
| 411 |
-
transition: all 0.2s ease !important;
|
| 412 |
}
|
| 413 |
|
| 414 |
button.primary {
|
| 415 |
-
background: linear-gradient(135deg,
|
| 416 |
-
border: none !important;
|
| 417 |
color: white !important;
|
|
|
|
| 418 |
}
|
| 419 |
|
| 420 |
button.secondary {
|
| 421 |
-
background:
|
| 422 |
-
border: 2px solid
|
| 423 |
-
color:
|
| 424 |
}
|
| 425 |
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
|
|
|
|
|
|
| 429 |
}
|
| 430 |
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
.status-success {
|
| 440 |
-
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
|
| 441 |
-
color: white;
|
| 442 |
-
padding: 4px 12px;
|
| 443 |
-
border-radius: 20px;
|
| 444 |
-
font-size: 12px;
|
| 445 |
-
font-weight: bold;
|
| 446 |
-
display: inline-flex;
|
| 447 |
-
align-items: center;
|
| 448 |
-
gap: 6px;
|
| 449 |
-
}
|
| 450 |
-
|
| 451 |
-
.status-warning {
|
| 452 |
-
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
|
| 453 |
-
color: white;
|
| 454 |
-
padding: 4px 12px;
|
| 455 |
-
border-radius: 20px;
|
| 456 |
-
font-size: 12px;
|
| 457 |
-
font-weight: bold;
|
| 458 |
-
display: inline-flex;
|
| 459 |
-
align-items: center;
|
| 460 |
-
gap: 6px;
|
| 461 |
-
}
|
| 462 |
-
|
| 463 |
-
.status-danger {
|
| 464 |
-
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
| 465 |
-
color: white;
|
| 466 |
-
padding: 4px 12px;
|
| 467 |
-
border-radius: 20px;
|
| 468 |
-
font-size: 12px;
|
| 469 |
-
font-weight: bold;
|
| 470 |
-
display: inline-flex;
|
| 471 |
-
align-items: center;
|
| 472 |
-
gap: 6px;
|
| 473 |
-
}
|
| 474 |
-
|
| 475 |
-
/* Metric Cards */
|
| 476 |
-
.metric-card {
|
| 477 |
-
border-left: 4px solid var(--primary);
|
| 478 |
border-radius: 12px;
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
|
|
|
|
|
|
|
|
|
| 485 |
}
|
| 486 |
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
}
|
| 493 |
|
| 494 |
-
/* Agent
|
| 495 |
.agent-card {
|
| 496 |
-
|
|
|
|
| 497 |
border-radius: 14px;
|
| 498 |
-
|
| 499 |
-
background: var(--dark-card);
|
| 500 |
-
text-align: center;
|
| 501 |
-
min-height: 180px;
|
| 502 |
-
display: flex;
|
| 503 |
-
flex-direction: column;
|
| 504 |
-
align-items: center;
|
| 505 |
-
justify-content: center;
|
| 506 |
}
|
| 507 |
|
| 508 |
.agent-card.active {
|
| 509 |
-
border-color:
|
| 510 |
-
background:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 511 |
}
|
| 512 |
|
| 513 |
-
/*
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
padding: 15px;
|
| 517 |
-
}
|
| 518 |
-
|
| 519 |
-
.metric-card {
|
| 520 |
-
min-width: 100%;
|
| 521 |
-
}
|
| 522 |
}
|
| 523 |
|
| 524 |
-
/*
|
| 525 |
-
|
| 526 |
-
|
|
|
|
|
|
|
| 527 |
}
|
| 528 |
|
| 529 |
-
|
| 530 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
}
|
| 532 |
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
}
|
| 537 |
|
| 538 |
-
|
| 539 |
-
|
|
|
|
|
|
|
| 540 |
}
|
| 541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
"""
|
| 2 |
+
UI Styles for ARF Demo - LIGHT THEME FOR READABILITY
|
|
|
|
| 3 |
"""
|
|
|
|
|
|
|
|
|
|
| 4 |
import logging
|
| 5 |
|
| 6 |
logger = logging.getLogger(__name__)
|
| 7 |
|
| 8 |
+
def get_styles() -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
"""
|
| 10 |
+
Return CSS styles for the ARF demo - LIGHT THEME FOR READABILITY
|
| 11 |
"""
|
| 12 |
+
css = """
|
| 13 |
+
/* ARF Demo Styles - Clean Light Theme */
|
| 14 |
|
| 15 |
+
/* Fix for all text to be readable */
|
| 16 |
+
body, .gr-box, .gr-form, .gr-panel, .gr-tab, .gr-container {
|
| 17 |
+
background-color: #f8fafc !important;
|
| 18 |
+
color: #1e293b !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
}
|
| 20 |
|
| 21 |
+
/* Make all text black/dark */
|
| 22 |
+
h1, h2, h3, h4, h5, h6, p, span, div, label, .markdown, .gr-markdown {
|
| 23 |
+
color: #1e293b !important;
|
| 24 |
}
|
| 25 |
|
| 26 |
+
/* Header gradient - keep but ensure text is white */
|
| 27 |
+
.header-gradient {
|
| 28 |
+
background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
|
| 29 |
+
border-radius: 16px;
|
| 30 |
+
padding: 30px 40px !important;
|
| 31 |
+
color: white !important;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.header-gradient h1,
|
| 35 |
+
.header-gradient h2,
|
| 36 |
+
.header-gradient h3,
|
| 37 |
+
.header-gradient p {
|
| 38 |
+
color: white !important;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* Status bar */
|
| 42 |
+
.status-bar {
|
| 43 |
+
background: #f1f5f9 !important;
|
| 44 |
+
border: 1px solid #e2e8f0 !important;
|
| 45 |
+
border-radius: 12px;
|
| 46 |
+
padding: 15px !important;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/* Cards - white background with readable text */
|
| 50 |
+
.arf-card, .gr-box, .gr-panel {
|
| 51 |
+
background: white !important;
|
| 52 |
+
border: 1px solid #e2e8f0 !important;
|
| 53 |
+
border-radius: 14px !important;
|
| 54 |
+
color: #1e293b !important;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/* Tab navigation */
|
| 58 |
.tab-nav {
|
| 59 |
+
background: white !important;
|
| 60 |
+
border-bottom: 2px solid #e2e8f0 !important;
|
| 61 |
}
|
| 62 |
|
| 63 |
.tab-nav .tab {
|
| 64 |
+
color: #64748b !important;
|
| 65 |
+
padding: 12px 24px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
}
|
| 67 |
|
| 68 |
.tab-nav .tab.selected {
|
| 69 |
+
color: #3b82f6 !important;
|
| 70 |
+
background: #f8fafc !important;
|
| 71 |
+
border: 2px solid #e2e8f0 !important;
|
| 72 |
+
border-bottom-color: white !important;
|
| 73 |
}
|
| 74 |
|
| 75 |
+
/* Buttons */
|
| 76 |
button {
|
| 77 |
border-radius: 10px !important;
|
| 78 |
font-weight: 600 !important;
|
|
|
|
| 79 |
}
|
| 80 |
|
| 81 |
button.primary {
|
| 82 |
+
background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
|
|
|
|
| 83 |
color: white !important;
|
| 84 |
+
border: none !important;
|
| 85 |
}
|
| 86 |
|
| 87 |
button.secondary {
|
| 88 |
+
background: white !important;
|
| 89 |
+
border: 2px solid #e2e8f0 !important;
|
| 90 |
+
color: #1e293b !important;
|
| 91 |
}
|
| 92 |
|
| 93 |
+
/* Form elements */
|
| 94 |
+
.gr-dropdown, .gr-slider, .gr-textbox, .gr-checkbox, .gr-radio {
|
| 95 |
+
background: white !important;
|
| 96 |
+
border: 1px solid #e2e8f0 !important;
|
| 97 |
+
color: #1e293b !important;
|
| 98 |
}
|
| 99 |
|
| 100 |
+
.gr-dropdown label, .gr-slider label, .gr-textbox label {
|
| 101 |
+
color: #1e293b !important;
|
| 102 |
+
font-weight: 600 !important;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/* Plots - ensure they have white background */
|
| 106 |
+
.gr-plot, .plotly.js-plotly-plot {
|
| 107 |
+
background: white !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
border-radius: 12px;
|
| 109 |
+
border: 1px solid #e2e8f0;
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
/* JSON display */
|
| 113 |
+
.gr-json {
|
| 114 |
+
background: white !important;
|
| 115 |
+
border: 1px solid #e2e8f0 !important;
|
| 116 |
+
border-radius: 8px;
|
| 117 |
+
color: #1e293b !important;
|
| 118 |
}
|
| 119 |
|
| 120 |
+
/* Dataframes */
|
| 121 |
+
.gr-dataframe {
|
| 122 |
+
background: white !important;
|
| 123 |
+
border: 1px solid #e2e8f0 !important;
|
| 124 |
+
border-radius: 8px;
|
| 125 |
}
|
| 126 |
|
| 127 |
+
/* Agent cards */
|
| 128 |
.agent-card {
|
| 129 |
+
background: white !important;
|
| 130 |
+
border: 2px solid #e2e8f0 !important;
|
| 131 |
border-radius: 14px;
|
| 132 |
+
color: #1e293b !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
}
|
| 134 |
|
| 135 |
.agent-card.active {
|
| 136 |
+
border-color: #10b981 !important;
|
| 137 |
+
background: #f0fdf4 !important;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/* Metric cards */
|
| 141 |
+
.metric-card {
|
| 142 |
+
background: white !important;
|
| 143 |
+
border: 1px solid #e2e8f0 !important;
|
| 144 |
+
border-left: 4px solid #3b82f6 !important;
|
| 145 |
+
border-radius: 12px;
|
| 146 |
+
color: #1e293b !important;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/* Footer */
|
| 150 |
+
footer {
|
| 151 |
+
background: #f1f5f9 !important;
|
| 152 |
+
color: #64748b !important;
|
| 153 |
+
border-top: 2px solid #e2e8f0 !important;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
footer a {
|
| 157 |
+
color: #3b82f6 !important;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
/* Badges */
|
| 161 |
+
.badge {
|
| 162 |
+
color: white !important;
|
| 163 |
+
font-weight: bold !important;
|
| 164 |
}
|
| 165 |
|
| 166 |
+
/* Ensure all HTML content has proper colors */
|
| 167 |
+
.gr-html div, .gr-html span, .gr-html p, .gr-html h1, .gr-html h2, .gr-html h3, .gr-html h4 {
|
| 168 |
+
color: #1e293b !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
}
|
| 170 |
|
| 171 |
+
/* Fix for scenario card */
|
| 172 |
+
.scenario-card {
|
| 173 |
+
background: white !important;
|
| 174 |
+
border: 1px solid #e2e8f0 !important;
|
| 175 |
+
color: #1e293b !important;
|
| 176 |
}
|
| 177 |
|
| 178 |
+
/* Make sure all text in the workflow section is readable */
|
| 179 |
+
#tab1 .gr-markdown,
|
| 180 |
+
#tab1 .gr-html,
|
| 181 |
+
#tab1 h1, #tab1 h2, #tab1 h3,
|
| 182 |
+
#tab1 p, #tab1 span, #tab1 div {
|
| 183 |
+
color: #1e293b !important;
|
| 184 |
}
|
| 185 |
|
| 186 |
+
/* Plot titles */
|
| 187 |
+
.gr-plot h3, .gr-plot .plot-title {
|
| 188 |
+
color: #1e293b !important;
|
| 189 |
}
|
| 190 |
|
| 191 |
+
/* Section headers */
|
| 192 |
+
.section-header {
|
| 193 |
+
color: #1e293b !important;
|
| 194 |
+
border-bottom: 2px solid #e2e8f0 !important;
|
| 195 |
}
|
| 196 |
+
|
| 197 |
+
/* Fix for approval display */
|
| 198 |
+
.approval-display {
|
| 199 |
+
background: white !important;
|
| 200 |
+
border: 2px solid #e2e8f0 !important;
|
| 201 |
+
color: #1e293b !important;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
/* OSS vs Enterprise sections */
|
| 205 |
+
.oss-section, .enterprise-section {
|
| 206 |
+
background: white !important;
|
| 207 |
+
border: 2px solid #e2e8f0 !important;
|
| 208 |
+
color: #1e293b !important;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.oss-section {
|
| 212 |
+
border-color: #0ea5e9 !important;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
.enterprise-section {
|
| 216 |
+
border-color: #10b981 !important;
|
| 217 |
+
}
|
| 218 |
+
"""
|
| 219 |
+
|
| 220 |
+
return css
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
def get_installation_badges() -> str:
|
| 224 |
+
"""Get installation badge HTML - SIMPLIFIED VERSION"""
|
| 225 |
+
return """
|
| 226 |
+
<div style="display: flex; justify-content: center; gap: 10px; margin-top: 10px; flex-wrap: wrap;">
|
| 227 |
+
<span style="padding: 4px 12px; background: #f59e0b;
|
| 228 |
+
color: white; border-radius: 20px; font-size: 12px; font-weight: bold;
|
| 229 |
+
display: flex; align-items: center; gap: 6px;">
|
| 230 |
+
⚠️ Checking ARF Installation...
|
| 231 |
+
</span>
|
| 232 |
+
</div>
|
| 233 |
+
"""
|
| 234 |
+
|
| 235 |
+
__all__ = ["get_styles", "get_installation_badges"]
|