When monitoring or handling real-time updates from the backend, the frontend uses specific types to represent the lifecycle of an 'expose' or 'unexpose' action. Progress is tracked through phases, statuses, and events.
Progress Phases
An operation moves through these specific phases:
dns: DNS record configuration.proxy: Proxy configuration.
Progress Statuses
Each step in a phase can have one of the following statuses:
pending: The step is waiting to start.running: The step is currently in progress.success: The step completed successfully.error: The step failed.warning: The step completed but with non-critical issues.
Progress Event Structure
Progress updates are delivered via ProgressEvent objects, which include the serviceId, the action being performed, a list of steps, and an optional result upon completion.
// Example of a ProgressEvent structure
const event: ProgressEvent = {
type: 'progress',
serviceId: 'svc_123',
action: 'expose',
steps: [
{ phase: 'dns', status: 'success', progress: 100, message: 'DNS record created' },
{ phase: 'proxy', status: 'running', progress: 45, message: 'Configuring proxy' }
],
timestamp: 1672531200000
};