import React from 'react'; import { Loader, CheckCircle, XCircle, Server, Database, Globe, Box, ExternalLink } from 'lucide-react'; import Modal from '../Modal'; import { Button } from '@/components/ui/button'; // Categorical node tints (redesign palette; docker brand blue kept). const nodeTypeConfig = { dockerApp: { icon: Server, label: 'Docker App', color: '#2496ed' }, database: { icon: Database, label: 'Database', color: '#f5b945' }, domain: { icon: Globe, label: 'Domain', color: '#3ddc97' }, service: { icon: Box, label: 'Service', color: '#6d7cff' } }; const DeploymentProgressModal = ({ isDeploying, results, nodes, onClose }) => { // Build node status map from results const nodeStatusMap = {}; if (results?.results) { results.results.forEach((result) => { nodeStatusMap[result.nodeId] = result; }); } const hasErrors = results?.errors?.length > 0; const isComplete = !isDeploying && results; return (
{isDeploying && !results && (

Deploying infrastructure...

This may take a moment
)} {results && ( <> {/* Summary */}
{hasErrors ? ( <> {results.results?.filter(r => r.success).length || 0} of {results.results?.length || 0} nodes deployed ) : ( <> All {results.results?.length || 0} nodes deployed successfully )}
{/* Node Results */}
{nodes.map((node) => { const result = nodeStatusMap[node.id]; const config = nodeTypeConfig[node.type] || nodeTypeConfig.service; const Icon = config.icon; return (
{node.data?.name || node.id}
{config.label}
{isDeploying && !result ? ( ) : result?.success ? ( ) : result ? ( ) : ( Pending )}
{result?.resourceId && ( e.stopPropagation()} > )}
); })}
{/* Errors */} {hasErrors && (

Errors

{results.errors.map((error, index) => (
{error.error || 'Unknown error'}
))}
)} )}
{isComplete && ( )}
); }; function getResourceLink(nodeType, resourceId) { switch (nodeType) { case 'dockerApp': case 'service': return `/apps/${resourceId}`; case 'domain': return `/domains/${resourceId}`; default: return '#'; } } export default DeploymentProgressModal;