feat: implement JSON backup export functionality with improved download handling
All checks were successful
Publish Container / publish (push) Successful in 3m25s
All checks were successful
Publish Container / publish (push) Successful in 3m25s
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
e8bbae0496
commit
bf333c4a00
7 changed files with 96 additions and 5 deletions
|
|
@ -76,7 +76,7 @@ else
|
|||
<p class="text-muted mb-3">Export the full database as JSON or restore a previously exported JSON backup. Restore replaces the current database only when the backup format version and database schema version are supported.</p>
|
||||
|
||||
<div class="d-flex flex-wrap gap-2 align-items-center mb-4">
|
||||
<a class="btn btn-outline-secondary" href="/api/database-backup/export">Export JSON backup</a>
|
||||
<button class="btn btn-outline-secondary" type="button" @onclick="ExportAsync">Export JSON backup</button>
|
||||
<span class="small text-muted">Current database schema version: @DatabaseSchemaVersion</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -193,4 +193,20 @@ else
|
|||
isRestoring = false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ExportAsync()
|
||||
{
|
||||
backupStatusMessage = null;
|
||||
backupErrorMessage = null;
|
||||
|
||||
try
|
||||
{
|
||||
await JS.InvokeVoidAsync("workTrackerDownloads.downloadFromUrl", "/api/database-backup/export");
|
||||
backupStatusMessage = $"Backup export started at {DateTime.Now:t}.";
|
||||
}
|
||||
catch (JSException)
|
||||
{
|
||||
backupErrorMessage = "Unable to start the backup download.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue