added backup/restore feature
CI / scan_ruby (pull_request) Failing after 11s
CI / scan_js (pull_request) Failing after 7s
CI / lint (pull_request) Failing after 10s

This commit is contained in:
2026-09-28 09:46:35 -06:00
parent 87894ad620
commit d535c57347
11 changed files with 789 additions and 1 deletions
+55
View File
@@ -0,0 +1,55 @@
<main class="page-shell">
<% if notice.present? %>
<p class="flash flash--notice"><%= notice %></p>
<% end %>
<% if flash[:alert].present? %>
<p class="flash flash--warning"><%= flash[:alert] %></p>
<% end %>
<p><%= link_to "Back to vehicles", vehicles_path, class: "back-link" %></p>
<header class="page-header">
<div>
<p class="eyebrow">Data portability</p>
<h1>Backup / Restore</h1>
</div>
</header>
<section class="dashboard-section dashboard-section--primary">
<h2>Download Backup</h2>
<p>Download a gzip-compressed YAML backup of vehicles, users, maintenance schedules, fuel entries, and maintenance entries.</p>
<p>Authentication data, access keys, and browser sessions are not included.</p>
<p><%= link_to "Download backup", download_backup_path, class: "button button--primary" %></p>
</section>
<section class="dashboard-section">
<h2>Restore Backup</h2>
<p>Upload a `.yml.gz` backup exported from Car Tracker.</p>
<%= form_with url: restore_backup_path, multipart: true, class: "stacked-form" do |form| %>
<div class="field">
<%= form.label :backup_file, "Backup file" %>
<%= form.file_field :backup_file, accept: ".gz,.yml.gz,application/gzip", required: true %>
</div>
<fieldset class="field">
<legend>Restore mode</legend>
<label>
<%= radio_button_tag :mode, "merge", true %>
Merge data into this installation
</label>
<label>
<%= radio_button_tag :mode, "replace" %>
Replace all existing app data
</label>
</fieldset>
<p class="field-warning">Replace mode deletes existing vehicles, users, schedules, fuel entries, and maintenance entries before importing the backup.</p>
<div>
<%= form.submit "Restore backup", class: "button button--primary" %>
</div>
<% end %>
</section>
</main>
+4 -1
View File
@@ -8,7 +8,10 @@
<p class="eyebrow">Fleet dashboard</p>
<h1>Vehicles</h1>
</div>
<%= link_to "New vehicle", new_vehicle_path, class: "button button--primary" %>
<div class="action-row">
<%= link_to "Backup / Restore", backup_path, class: "button button--secondary" %>
<%= link_to "New vehicle", new_vehicle_path, class: "button button--primary" %>
</div>
</header>
<nav class="filter-nav" aria-label="Vehicle filters">