2026-06-05 16:15:49 +01:00

108 lines
3.9 KiB
Plaintext

@model ProjectRestorePointListViewModel
@{
ViewData["Title"] = "Restore Points";
var defaultRestorePointName = $"Manual restore point - {DateTime.Now:yyyy-MM-dd HH:mm}";
}
@functions {
private static string FormatSize(long bytes)
{
if (bytes >= 1024 * 1024)
{
return $"{bytes / 1024d / 1024d:0.0} MB";
}
if (bytes >= 1024)
{
return $"{bytes / 1024d:0.0} KB";
}
return $"{bytes} bytes";
}
}
<nav class="breadcrumb-trail">
<a asp-controller="Projects" asp-action="Details" asp-route-id="@Model.Project.ProjectID">@Model.Project.ProjectName</a>
<span>Restore Points</span>
</nav>
<div class="page-heading compact">
<div>
<p class="eyebrow">Project backup</p>
<h1>Restore Points</h1>
<p class="lead-text">Create manual database-saved snapshots of the project export JSON.</p>
</div>
<div class="button-row">
<a class="btn btn-outline-secondary" asp-controller="Projects" asp-action="Details" asp-route-id="@Model.Project.ProjectID">Back to project</a>
<a class="btn btn-outline-secondary" asp-controller="Exports" asp-action="ProjectBackup" asp-route-projectId="@Model.Project.ProjectID">Download Project Backup</a>
</div>
</div>
@if (TempData["ProjectRestorePointMessage"] is string message)
{
<div class="alert alert-info">@message</div>
}
<section class="story-bible-section">
<div class="story-bible-section-heading">
<div>
<p class="eyebrow">Manual snapshot</p>
<h2>Create restore point</h2>
</div>
</div>
<form asp-action="Create" method="post" class="row g-3">
<input type="hidden" name="projectId" value="@Model.Project.ProjectID" />
<div class="col-md-5">
<label class="form-label" for="restorePointName">Name</label>
<input class="form-control" id="restorePointName" name="restorePointName" maxlength="255" placeholder="@defaultRestorePointName" />
</div>
<div class="col-md-5">
<label class="form-label" for="notes">Notes</label>
<input class="form-control" id="notes" name="notes" maxlength="1000" placeholder="Optional reason or reminder" />
</div>
<div class="col-md-2 d-flex align-items-end">
<button class="btn btn-primary w-100" type="submit">Create Restore Point</button>
</div>
</form>
</section>
<section class="list-section">
<h2>Saved restore points</h2>
@if (!Model.RestorePoints.Any())
{
<p class="muted">No restore points yet.</p>
}
else
{
<div class="table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Created</th>
<th>Size</th>
<th>Notes</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var restorePoint in Model.RestorePoints)
{
<tr>
<td>@restorePoint.RestorePointName</td>
<td><span class="status-pill">@restorePoint.RestorePointType</span></td>
<td>@restorePoint.CreatedDateUtc.ToLocalTime().ToString("dd MMM yyyy HH:mm")</td>
<td>@FormatSize(restorePoint.JsonSizeBytes)</td>
<td>@restorePoint.Notes</td>
<td class="text-end">
<a class="btn btn-outline-secondary btn-sm" asp-action="Download" asp-route-projectId="@Model.Project.ProjectID" asp-route-id="@restorePoint.ProjectRestorePointID">Download</a>
</td>
</tr>
}
</tbody>
</table>
</div>
}
</section>