Files
car-tracker/app/views/backups/show.html.erb
2026-10-01 09:56:32 -06:00

59 lines
2.0 KiB
Plaintext

<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>
<div class="action-row">
<%= link_to "Download data backup", download_backup_path, class: "button button--primary" %>
<%= link_to "Download backup with images", download_with_images_backup_path, class: "button button--secondary" %>
</div>
</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>