diff --git a/frontend-modern/src/api/updates.ts b/frontend-modern/src/api/updates.ts index 4f9915a65..a7eb2092e 100644 --- a/frontend-modern/src/api/updates.ts +++ b/frontend-modern/src/api/updates.ts @@ -29,6 +29,40 @@ export interface VersionInfo { deploymentType?: string; } +export interface UpdatePlan { + canAutoUpdate: boolean; + instructions?: string[]; + prerequisites?: string[]; + estimatedTime?: string; + requiresRoot: boolean; + rollbackSupport: boolean; + downloadUrl?: string; +} + +export interface UpdateHistoryEntry { + event_id: string; + timestamp: string; + action: 'update' | 'rollback'; + channel: string; + version_from: string; + version_to: string; + deployment_type: string; + initiated_by: 'user' | 'auto' | 'api'; + initiated_via: 'ui' | 'cli' | 'script' | 'webhook'; + status: 'in_progress' | 'success' | 'failed' | 'rolled_back' | 'cancelled'; + duration_ms: number; + backup_path?: string; + log_path?: string; + error?: { + message: string; + code?: string; + details?: string; + }; + download_bytes?: number; + related_event_id?: string; + notes?: string; +} + export class UpdatesAPI { static async checkForUpdates(channel?: string): Promise { const url = channel ? `/api/updates/check?channel=${channel}` : '/api/updates/check'; @@ -49,4 +83,26 @@ export class UpdatesAPI { static async getVersion(): Promise { return apiFetchJSON('/api/version'); } + + static async getUpdatePlan(version: string, channel?: string): Promise { + const url = channel + ? `/api/updates/plan?version=${version}&channel=${channel}` + : `/api/updates/plan?version=${version}`; + return apiFetchJSON(url); + } + + static async getUpdateHistory( + limit?: number, + status?: string + ): Promise { + const params = new URLSearchParams(); + if (limit) params.append('limit', limit.toString()); + if (status) params.append('status', status); + const url = `/api/updates/history${params.toString() ? `?${params.toString()}` : ''}`; + return apiFetchJSON(url); + } + + static async getUpdateHistoryEntry(eventId: string): Promise { + return apiFetchJSON(`/api/updates/history/entry?id=${eventId}`); + } }