mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-22 03:04:03 +00:00
feat: add UpdatePlan and history types to frontend API
Add TypeScript interfaces and API methods for new update system: **New Types:** - UpdatePlan: Deployment-specific update plan with canAutoUpdate flag - UpdateHistoryEntry: Complete audit log entry with all metadata **New API Methods:** - getUpdatePlan(version, channel?) - Get deployment-specific update plan - getUpdateHistory(limit?, status?) - List update history with filters - getUpdateHistoryEntry(eventId) - Get specific history entry details These types match the backend Go structs and enable frontend integration with the adapter-based update system. Next: Implement UI components (confirmation modal, progress modal, update banner enhancements, settings history panel).
This commit is contained in:
@@ -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<UpdateInfo> {
|
||||
const url = channel ? `/api/updates/check?channel=${channel}` : '/api/updates/check';
|
||||
@@ -49,4 +83,26 @@ export class UpdatesAPI {
|
||||
static async getVersion(): Promise<VersionInfo> {
|
||||
return apiFetchJSON('/api/version');
|
||||
}
|
||||
|
||||
static async getUpdatePlan(version: string, channel?: string): Promise<UpdatePlan> {
|
||||
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<UpdateHistoryEntry[]> {
|
||||
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<UpdateHistoryEntry> {
|
||||
return apiFetchJSON(`/api/updates/history/entry?id=${eventId}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user