feat: enhance backup management in AdvancedSettingsPage
- Added backup management functionality to `AdvancedSettingsPageClient`, including creating and verifying backups. - Updated `package.json` with new backup-related scripts. - Improved UI to display backup status and next scheduled backup time. - Updated `.gitignore` to exclude backup files. - Enhanced server-side data fetching to include backup data and database statistics.
This commit is contained in:
@@ -1,12 +1,46 @@
|
||||
import { userPreferencesService } from '@/services/user-preferences';
|
||||
import { tasksService } from '@/services/tasks';
|
||||
import { tagsService } from '@/services/tags';
|
||||
import { backupService } from '@/services/backup';
|
||||
import { backupScheduler } from '@/services/backup-scheduler';
|
||||
import { AdvancedSettingsPageClient } from '@/components/settings/AdvancedSettingsPageClient';
|
||||
|
||||
// Force dynamic rendering for real-time data
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function AdvancedSettingsPage() {
|
||||
// Fetch data server-side
|
||||
const preferences = await userPreferencesService.getAllPreferences();
|
||||
// Fetch all data server-side
|
||||
const [preferences, taskStats, tags] = await Promise.all([
|
||||
userPreferencesService.getAllPreferences(),
|
||||
tasksService.getTaskStats(),
|
||||
tagsService.getTags()
|
||||
]);
|
||||
|
||||
return <AdvancedSettingsPageClient initialPreferences={preferences} />;
|
||||
// Compose backup data like the API does
|
||||
const backups = await backupService.listBackups();
|
||||
const schedulerStatus = backupScheduler.getStatus();
|
||||
const config = backupService.getConfig();
|
||||
|
||||
const backupData = {
|
||||
backups,
|
||||
scheduler: {
|
||||
...schedulerStatus,
|
||||
nextBackup: schedulerStatus.nextBackup?.toISOString() || null
|
||||
},
|
||||
config
|
||||
};
|
||||
|
||||
const dbStats = {
|
||||
taskCount: taskStats.total,
|
||||
tagCount: tags.length,
|
||||
completionRate: taskStats.completionRate
|
||||
};
|
||||
|
||||
return (
|
||||
<AdvancedSettingsPageClient
|
||||
initialPreferences={preferences}
|
||||
initialDbStats={dbStats}
|
||||
initialBackupData={backupData}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
26
src/app/settings/backup/page.tsx
Normal file
26
src/app/settings/backup/page.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import BackupSettingsPageClient from '@/components/settings/BackupSettingsPageClient';
|
||||
import { backupService } from '@/services/backup';
|
||||
import { backupScheduler } from '@/services/backup-scheduler';
|
||||
|
||||
// Force dynamic rendering pour les données en temps réel
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default async function BackupSettingsPage() {
|
||||
// Fetch data server-side
|
||||
const backups = await backupService.listBackups();
|
||||
const schedulerStatus = backupScheduler.getStatus();
|
||||
const config = backupService.getConfig();
|
||||
|
||||
const initialData = {
|
||||
backups,
|
||||
scheduler: {
|
||||
...schedulerStatus,
|
||||
nextBackup: schedulerStatus.nextBackup ? schedulerStatus.nextBackup.toISOString() : null,
|
||||
},
|
||||
config,
|
||||
};
|
||||
|
||||
return (
|
||||
<BackupSettingsPageClient initialData={initialData} />
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user