Skip to content

Commit a9406ce

Browse files
Restore save locally and backups list
1 parent 41fbabf commit a9406ce

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

nixos/admin-app/static/css/admin.css

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,58 @@ input:focus {
18981898
padding: 0.9rem 1rem;
18991899
}
19001900

1901+
.recovery-subsection {
1902+
margin-bottom: 0;
1903+
border: 1px solid rgb(var(--ln-border));
1904+
border-radius: 0.9rem;
1905+
background: rgb(var(--ln-card) / 0.65);
1906+
overflow: hidden;
1907+
}
1908+
1909+
.recovery-subsection-summary {
1910+
list-style: none;
1911+
display: flex;
1912+
align-items: center;
1913+
justify-content: space-between;
1914+
gap: 1rem;
1915+
cursor: pointer;
1916+
padding: 0.9rem 1rem;
1917+
}
1918+
1919+
.recovery-subsection-summary::-webkit-details-marker {
1920+
display: none;
1921+
}
1922+
1923+
.recovery-subsection-summary::after {
1924+
content: "+";
1925+
color: rgb(var(--ln-muted));
1926+
font-family: 'JetBrains Mono', monospace;
1927+
font-size: 1rem;
1928+
line-height: 1;
1929+
}
1930+
1931+
.recovery-subsection[open] .recovery-subsection-summary {
1932+
border-bottom: 1px solid rgb(var(--ln-border));
1933+
}
1934+
1935+
.recovery-subsection[open] .recovery-subsection-summary::after {
1936+
content: "-";
1937+
color: rgb(var(--ln-pink));
1938+
}
1939+
1940+
.recovery-subsection-meta {
1941+
margin-left: auto;
1942+
color: rgb(var(--ln-muted));
1943+
font-family: 'JetBrains Mono', monospace;
1944+
font-size: 0.74rem;
1945+
text-transform: uppercase;
1946+
letter-spacing: 0.08em;
1947+
}
1948+
1949+
.recovery-subsection-body {
1950+
padding: 0.9rem 1rem;
1951+
}
1952+
19011953
.recovery-saved-list {
19021954
display: grid;
19031955
gap: 0.7rem;

nixos/admin-app/static/js/dashboard-db.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,18 @@
4949
D.renderSavedBackups = function (backups) {
5050
const container = el('recovery-saved-backups');
5151
const localSelect = el('restore-local-backup');
52+
const countLabel = el('recovery-saved-backups-count');
53+
const section = el('recovery-saved-backups-section');
5254
if (container) {
5355
container.innerHTML = '';
5456
}
57+
if (countLabel) {
58+
const total = backups && backups.length ? backups.length : 0;
59+
countLabel.textContent = total === 1 ? '1 backup' : total + ' backups';
60+
}
61+
if (section && backups && backups.length) {
62+
section.open = false;
63+
}
5564
if (localSelect) {
5665
localSelect.innerHTML = '<option value="">Choose a saved backup</option>';
5766
}

nixos/admin-app/templates/partials/cards/recovery_center.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
placeholder="Required for every backup">
7070
</label>
7171

72+
<p class="recovery-helper-text mb-3" id="recovery-destination-note">
73+
Save a protected backup on this box for later restores, or download one now to keep elsewhere.
74+
</p>
75+
7276
<div class="recovery-callout">
7377
<div class="recovery-callout-title">What is included?</div>
7478
<p class="recovery-helper-text mb-0">
@@ -81,7 +85,23 @@
8185
class="bg-ln-pink hover:bg-ln-pink-dim text-white font-mono text-sm py-2 px-4 rounded-lg transition-colors">
8286
Download Backup
8387
</button>
88+
<button id="recovery-save-btn"
89+
class="text-ln-muted hover:text-ln-pink text-xs font-mono uppercase tracking-wider transition-colors px-3 py-2 border border-ln-border rounded-lg hover:border-ln-pink/30">
90+
Save on This Box
91+
</button>
8492
</div>
93+
94+
<details class="recovery-subsection mt-4" id="recovery-saved-backups-section">
95+
<summary class="recovery-subsection-summary">
96+
<span class="recovery-callout-title">Saved Backups On This Box</span>
97+
<span class="recovery-subsection-meta" id="recovery-saved-backups-count">0 backups</span>
98+
</summary>
99+
<div class="recovery-subsection-body">
100+
<div id="recovery-saved-backups" class="recovery-saved-list">
101+
<div class="recovery-helper-text">No saved backups yet.</div>
102+
</div>
103+
</div>
104+
</details>
85105
</div>
86106
</section>
87107

0 commit comments

Comments
 (0)