""" Admin GPU Infrastructure Component. Provides UI controls for vast.ai GPU management: - Start/Stop buttons - Status display with GPU info - Cost tracking - Auto-shutdown timer """ def get_admin_gpu_css() -> str: """CSS fuer GPU Control Panel.""" return """ /* ========================================== GPU INFRASTRUCTURE STYLES ========================================== */ .gpu-control-panel { background: var(--bp-surface-elevated); border-radius: 12px; padding: 20px; margin-bottom: 20px; border: 1px solid var(--bp-border); } .gpu-status-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; } .gpu-status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; } .gpu-status-badge.running { background: rgba(34, 197, 94, 0.15); color: #22c55e; } .gpu-status-badge.stopped { background: rgba(156, 163, 175, 0.15); color: #9ca3af; } .gpu-status-badge.loading { background: rgba(59, 130, 246, 0.15); color: #3b82f6; } .gpu-status-badge.error { background: rgba(239, 68, 68, 0.15); color: #ef4444; } .gpu-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; } .gpu-status-dot.running { animation: pulse 2s infinite; } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } .gpu-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; } .gpu-info-card { background: var(--bp-surface); border-radius: 8px; padding: 12px; border: 1px solid var(--bp-border-subtle); } .gpu-info-label { font-size: 11px; color: var(--bp-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; } .gpu-info-value { font-size: 16px; font-weight: 600; color: var(--bp-text); } .gpu-info-value.cost { color: #f59e0b; } .gpu-info-value.time { color: #3b82f6; } .gpu-controls { display: flex; gap: 12px; margin-top: 20px; } .gpu-btn { flex: 1; padding: 12px 20px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.2s ease; } .gpu-btn:disabled { opacity: 0.5; cursor: not-allowed; } .gpu-btn-start { background: #22c55e; color: white; } .gpu-btn-start:hover:not(:disabled) { background: #16a34a; } .gpu-btn-stop { background: #ef4444; color: white; } .gpu-btn-stop:hover:not(:disabled) { background: #dc2626; } .gpu-btn-refresh { background: var(--bp-surface); color: var(--bp-text); border: 1px solid var(--bp-border); flex: 0 0 auto; padding: 12px; } .gpu-btn-refresh:hover:not(:disabled) { background: var(--bp-surface-elevated); } .gpu-shutdown-warning { background: rgba(251, 191, 36, 0.1); border: 1px solid rgba(251, 191, 36, 0.3); border-radius: 8px; padding: 12px; margin-top: 16px; display: flex; align-items: center; gap: 10px; color: #fbbf24; font-size: 13px; } .gpu-shutdown-warning svg { flex-shrink: 0; } .gpu-cost-summary { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--bp-border); } .gpu-cost-summary h4 { margin: 0 0 12px 0; font-size: 14px; color: var(--bp-text-muted); } .gpu-audit-log { margin-top: 20px; max-height: 200px; overflow-y: auto; background: var(--bp-surface); border-radius: 8px; border: 1px solid var(--bp-border-subtle); } .gpu-audit-entry { padding: 8px 12px; border-bottom: 1px solid var(--bp-border-subtle); font-size: 12px; font-family: monospace; } .gpu-audit-entry:last-child { border-bottom: none; } .gpu-audit-time { color: var(--bp-text-muted); margin-right: 8px; } .gpu-audit-event { color: var(--bp-text); } .gpu-endpoint-url { margin-top: 12px; padding: 10px 12px; background: var(--bp-surface); border-radius: 8px; font-family: monospace; font-size: 12px; color: var(--bp-text-muted); word-break: break-all; } .gpu-endpoint-url.active { color: #22c55e; } .gpu-spinner { width: 16px; height: 16px; border: 2px solid transparent; border-top-color: currentColor; border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } } [data-theme="light"] .gpu-control-panel { background: #fafafa; } [data-theme="light"] .gpu-info-card { background: #ffffff; } """ def get_admin_gpu_html() -> str: """HTML fuer GPU Control Tab.""" return """