diff --git a/components/admin_database.templ b/components/admin_database.templ new file mode 100644 index 0000000..ca95414 --- /dev/null +++ b/components/admin_database.templ @@ -0,0 +1,342 @@ +package components + +import ( + "context" + "time" +) + +// BackupFile represents a database backup file +type BackupFile struct { + Name string + Size string + Created time.Time + FullPath string +} + +// AdminDatabaseTools renders the database tools page with backup and restore functionality +templ AdminDatabaseTools(ctx context.Context, backups []BackupFile) { + @LayoutWithContext("Database Tools", ctx) { +
+ + + + +
+ +
+

+ + Database Management +

+

Manage database backups, restoration and maintenance

+
+ + +
+ +
+
+
+ +
+

Backup Database

+
+

Create a backup of the current database state.

+
+ +
+
+ + +
+
+
+ +
+

Optimize Database

+
+

Vacuum the database to reclaim space and optimize performance.

+
+ +
+
+ + +
+
+
+ +
+

Clear Job History

+
+

Remove old job history records to free up database space.

+
+ +
+
+ + +
+
+
+ +
+

Export Configuration

+
+

Export system configurations and jobs for backup or migration.

+ +
+
+ + +
+
+

Database Backups

+ + + Refresh + +
+
+ + + + + + + + + + + if len(backups) == 0 { + + + + } else { + for _, backup := range backups { + + + + + + + } + } + +
Backup NameSizeCreatedActions
+ No backups found. Create your first backup to get started. +
{ backup.Name }{ backup.Size }{ backup.Created.Format("2006-01-02 15:04:05") } +
+ + + + + + + + + + +
+
+
+
+ + +
+
+

Restore from Backup File

+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+ + +
+
+ +
+

Important Safety Information

+
    +
  • Always create a backup before making significant changes
  • +
  • Restoring a backup will overwrite all current data
  • +
  • Database optimization may take time for large databases
  • +
  • Clear job history operations cannot be undone
  • +
+
+
+
+
+
+ + + + + + + + + } +} \ No newline at end of file