feat: enhance backup functionality and logging

- Updated `createBackup` method to accept a `force` parameter, allowing backups to be created even if no changes are detected.
- Added user alerts in `AdvancedSettingsPageClient` and `BackupSettingsPageClient` for backup status feedback.
- Implemented `getBackupLogs` method in `BackupService` to retrieve backup logs, with a new API route for accessing logs.
- Enhanced UI in `BackupSettingsPageClient` to display backup logs and provide a refresh option.
- Updated `BackupManagerCLI` to support forced backups via command line.
This commit is contained in:
Julien Froidefond
2025-09-21 07:27:23 +02:00
parent 618e774a30
commit 43998425e6
10 changed files with 649 additions and 179 deletions

View File

@@ -28,11 +28,17 @@ export class BackupClient {
/**
* Crée une nouvelle sauvegarde manuelle
*/
async createBackup(): Promise<BackupInfo> {
const response = await httpClient.post<{ data: BackupInfo }>(this.baseUrl, {
action: 'create'
async createBackup(force: boolean = false): Promise<BackupInfo | null> {
const response = await httpClient.post<{ data?: BackupInfo; skipped?: boolean; message?: string }>(this.baseUrl, {
action: 'create',
force
});
return response.data;
if (response.skipped) {
return null; // Backup was skipped
}
return response.data!;
}
/**
@@ -95,6 +101,14 @@ export class BackupClient {
action: 'restore'
});
}
/**
* Récupère les logs de backup
*/
async getBackupLogs(maxLines: number = 100): Promise<string[]> {
const response = await httpClient.get<{ data: { logs: string[] } }>(`${this.baseUrl}?action=logs&maxLines=${maxLines}`);
return response.data.logs;
}
}
export const backupClient = new BackupClient();