Remove host files and uninstall agent when deleting hosts
This commit is contained in:
+18
-2
@@ -1,13 +1,27 @@
|
||||
export type HostMode = 'active' | 'draining' | 'disabled';
|
||||
export type HostReadiness = 'preparing' | 'needs-runtime' | 'needs-game-files' | 'ready' | 'degraded' | 'draining' | 'disabled';
|
||||
export type HostReadiness = 'preparing' | 'needs-runtime' | 'needs-game-files' | 'ready' | 'degraded' | 'draining' | 'disabled' | 'deleting';
|
||||
export type HostOperationState = 'pending' | 'accepted' | 'running' | 'completed' | 'failed' | 'unknown';
|
||||
|
||||
export function hostReadinessLabel(readiness: HostReadiness): string {
|
||||
return { preparing: 'Preparing', 'needs-runtime': 'Needs runtime', 'needs-game-files': 'Needs game files',
|
||||
ready: 'Ready', degraded: 'Degraded', draining: 'Draining', disabled: 'Disabled' }[readiness];
|
||||
ready: 'Ready', degraded: 'Degraded', draining: 'Draining', disabled: 'Disabled', deleting: 'Deleting' }[readiness];
|
||||
}
|
||||
|
||||
export interface HostDeletion { allowed: boolean; blockers: string[] }
|
||||
export interface HostDecommission {
|
||||
operationId: string; stage: 'queued' | 'running' | 'cleaned' | 'failed' | 'completed';
|
||||
requestedAt: string; updatedAt: string; error: string | null; retryable: boolean;
|
||||
}
|
||||
export function hostDeletionMessage(host: Pick<Host, 'connected' | 'decommission'>): string {
|
||||
if (!host.decommission) return '';
|
||||
switch (host.decommission.stage) {
|
||||
case 'queued': return host.connected ? 'Host cleanup is queued.' : 'Waiting for the host to reconnect before removing its files and agent.';
|
||||
case 'running': return 'Removing host files, cached game libraries, and the agent installation.';
|
||||
case 'cleaned': return 'Host data is removed. Waiting for confirmation that the agent has uninstalled itself.';
|
||||
case 'failed': return 'Cleanup needs attention. Complete removal has not been confirmed.';
|
||||
case 'completed': return 'Host files and agent removal confirmed.';
|
||||
}
|
||||
}
|
||||
|
||||
export interface HostLibrary { id: string; state: 'missing' | 'downloading' | 'verifying' | 'ready' | 'failed' | 'outdated'; progress?: number; error?: string }
|
||||
export interface HostInventory {
|
||||
@@ -16,6 +30,7 @@ export interface HostInventory {
|
||||
storageTotal?: number; storageAvailable?: number; dockerVersion?: string; dockerRunning?: boolean;
|
||||
directoriesWritable?: boolean; runtimeImages?: string[]; libraries?: HostLibrary[];
|
||||
currentOperation?: string | null; [key: string]: unknown;
|
||||
capabilities?: string[];
|
||||
}
|
||||
export interface Host {
|
||||
id: string; name: string; hostname: string; mode: HostMode; portMin: number; portMax: number;
|
||||
@@ -23,6 +38,7 @@ export interface Host {
|
||||
lastHeartbeat: string | null; connected: boolean; connectionState: 'online' | 'offline';
|
||||
readiness: HostReadiness; readinessReasons: string[]; inventory: HostInventory;
|
||||
enrolled: boolean; credentialActive: boolean;
|
||||
decommission: HostDecommission | null;
|
||||
}
|
||||
export interface HostOperation {
|
||||
id: string; hostId: string; kind: string; instanceId: string | null; generation: number | null;
|
||||
|
||||
Reference in New Issue
Block a user