Track cancelled deployments separately.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import { Loader2, Upload, Hammer, Rocket, CheckCircle, XCircle, X } from 'lucide
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
export interface BuildProgress {
|
||||
phase: 'uploading' | 'building' | 'deploying' | 'done' | 'failed';
|
||||
phase: 'uploading' | 'building' | 'deploying' | 'done' | 'failed' | 'cancelled';
|
||||
percent: number;
|
||||
bytesUploaded?: number;
|
||||
totalBytes?: number;
|
||||
@@ -26,6 +26,7 @@ const phaseConfig = {
|
||||
deploying: { label: 'Deploying to Kubernetes', icon: Rocket, bg: 'bg-purple-500' },
|
||||
done: { label: 'Deployment complete', icon: CheckCircle, bg: 'bg-green-500' },
|
||||
failed: { label: 'Deployment failed', icon: XCircle, bg: 'bg-red-500' },
|
||||
cancelled: { label: 'Deployment cancelled', icon: XCircle, bg: 'bg-gray-500' },
|
||||
};
|
||||
|
||||
export function BuildProgressModal({ appId, enabled }: { appId: string; enabled: boolean }) {
|
||||
@@ -60,7 +61,7 @@ export function BuildProgressModal({ appId, enabled }: { appId: string; enabled:
|
||||
|
||||
const cfg = phaseConfig[progress.phase];
|
||||
const PhaseIcon = cfg.icon;
|
||||
const isActive = progress.phase !== 'failed';
|
||||
const isActive = progress.phase !== 'failed' && progress.phase !== 'cancelled';
|
||||
const showBytes = progress.phase === 'uploading' && progress.totalBytes;
|
||||
const isCancelling = cancelMutation.isPending;
|
||||
|
||||
@@ -70,7 +71,7 @@ export function BuildProgressModal({ appId, enabled }: { appId: string; enabled:
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => cancelMutation.mutate()}
|
||||
disabled={isCancelling || progress.phase === 'failed'}
|
||||
disabled={isCancelling || progress.phase === 'failed' || progress.phase === 'cancelled'}
|
||||
className="absolute top-4 right-4 p-1.5 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100 transition-colors disabled:opacity-50"
|
||||
aria-label="Cancel and close"
|
||||
title="Cancel deployment"
|
||||
@@ -82,7 +83,7 @@ export function BuildProgressModal({ appId, enabled }: { appId: string; enabled:
|
||||
{isActive ? (
|
||||
<Loader2 className="w-12 h-12 text-primary-600 mx-auto mb-3 animate-spin" />
|
||||
) : (
|
||||
<PhaseIcon className="w-12 h-12 text-red-500 mx-auto mb-3" />
|
||||
<PhaseIcon className={`w-12 h-12 ${progress.phase === 'cancelled' ? 'text-gray-500' : 'text-red-500'} mx-auto mb-3`} />
|
||||
)}
|
||||
<h3 className="text-lg font-semibold text-gray-900">{cfg.label}</h3>
|
||||
{progress.message && (
|
||||
@@ -114,6 +115,10 @@ export function BuildProgressModal({ appId, enabled }: { appId: string; enabled:
|
||||
<p className="text-sm text-red-600 text-center">{progress.message}</p>
|
||||
)}
|
||||
|
||||
{progress.phase === 'cancelled' && progress.message && (
|
||||
<p className="text-sm text-gray-600 text-center">{progress.message}</p>
|
||||
)}
|
||||
|
||||
{isActive && (
|
||||
<p className="text-xs text-gray-400 text-center">
|
||||
Click the close button to cancel and remove cluster build resources.
|
||||
|
||||
Reference in New Issue
Block a user