ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat(backups): port the design's Overview, Schedules, Snapshots and Storage
Juan Denis98ea0f6b106f
diff --git a/docs/screenshots/backups-schedules.png b/docs/screenshots/backups-schedules.pngnew file mode 100644index 00000000..ead64434Binary files /dev/null and b/docs/screenshots/backups-schedules.png differdiff --git a/docs/screenshots/backups-snapshots.png b/docs/screenshots/backups-snapshots.pngnew file mode 100644index 00000000..ceedc9c5Binary files /dev/null and b/docs/screenshots/backups-snapshots.png differdiff --git a/docs/screenshots/backups-storage.png b/docs/screenshots/backups-storage.pngnew file mode 100644index 00000000..f781c402Binary files /dev/null and b/docs/screenshots/backups-storage.png differdiff --git a/docs/screenshots/backups.png b/docs/screenshots/backups.pngindex 34b59be2..64d6cc31 100644Binary files a/docs/screenshots/backups.png and b/docs/screenshots/backups.png differdiff --git a/frontend/src/components/backups/BackupsOverview.jsx b/frontend/src/components/backups/BackupsOverview.jsxnew file mode 100644index 00000000..ab201541--- /dev/null+++ b/frontend/src/components/backups/BackupsOverview.jsx@@ -0,0 +1,457 @@+import { useState, useEffect, useMemo } from 'react';+import {+ AlertTriangle, Archive, ChevronRight, Cloud, Database, Globe, HardDrive,+ History, Package, ShieldCheck, Timer,+} from 'lucide-react';+import api from '../../services/api';+import { formatBytes } from '@/utils/formatBytes';+import { KpiBand, MetricCard, Pill } from '@/components/ds';+import EmptyState from '../EmptyState';++// Daily activity cells: one column per week, one row per weekday. Half a year+// rather than the mock's 18 weeks — the cells stretch to fill the card (see+// `.bk-heat` in _backups.scss), and at 18 columns that left the panel visibly+// half empty. 26 also covers a 90-day retention window with room either side.+const HEATMAP_WEEKS = 26;+const HEATMAP_DAYS = HEATMAP_WEEKS * 7;++const TARGET_LABEL = {+ application: ['site', 'sites'],+ app: ['site', 'sites'],+ wordpress_site: ['site', 'sites'],+ database: ['DB', 'DBs'],+ files: ['volume', 'volumes'],+ server: ['server', 'servers'],+};++const KIND_ICON = {+ application: Package,+ app: Package,+ wordpress_site: Globe,+ database: Database,+ files: Archive,+ server: HardDrive,+};++const dayKey = (d) => d.toISOString().slice(0, 10);++function relativeTime(iso) {+ if (!iso) return '—';+ const diff = (Date.now() - new Date(iso).getTime()) / 1000;+ if (Number.isNaN(diff)) return '—';+ if (diff < 90) return 'just now';+ if (diff < 3600) return `${Math.round(diff / 60)}m ago`;+ if (diff < 86400) return `${Math.round(diff / 3600)}h ago`;+ if (diff < 172800) return 'yesterday';+ return `${Math.round(diff / 86400)}d ago`;+}++function formatDuration(seconds) {+ if (!seconds && seconds !== 0) return '—';+ if (seconds < 60) return `${Math.round(seconds)}s`;+ const m = Math.floor(seconds / 60);+ const s = Math.round(seconds % 60);+ return s ? `${m}m ${s}s` : `${m}m`;+}++// "in 1h 12m" / "in 3d" — the shape the mock's Next-scheduled tile uses.+function untilLabel(date) {+ const ms = date.getTime() - Date.now();+ if (ms <= 0) return 'due now';+ const mins = Math.round(ms / 60000);+ if (mins < 60) return `in ${mins}m`;+ const h = Math.floor(mins / 60);+ if (h < 24) return `in ${h}h ${mins % 60}m`;+ return `in ${Math.round(h / 24)}d`;+}++// Next fire of a legacy schedule row ({ schedule_time: '02:00', days: [...] }).+// Deliberately reads the same list the Schedules tab renders rather than+// parsing policy crons — the number on the tile then matches the rows you'd+// click through to. Returns null for anything it can't place.+const DAY_INDEX = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };++function nextFire(schedule) {+ const [hh, mm] = String(schedule.schedule_time || '').split(':').map(Number);+ if (Number.isNaN(hh) || Number.isNaN(mm)) return null;++ const days = Array.isArray(schedule.days) ? schedule.days : ['daily'];+ const daily = days.length === 0 || days.includes('daily');+ const wanted = daily+ ? null+ : new Set(days.map((d) => DAY_INDEX[String(d).slice(0, 3).toLowerCase()]).filter((n) => n != null));+ if (!daily && (!wanted || wanted.size === 0)) return null;++ // Walk forward a week at most; the first slot that is still in the future+ // on an allowed weekday wins.+ for (let offset = 0; offset <= 7; offset += 1) {+ const candidate = new Date();+ candidate.setDate(candidate.getDate() + offset);+ candidate.setHours(hh, mm, 0, 0);+ if (candidate.getTime() <= Date.now()) continue;+ if (daily || wanted.has(candidate.getDay())) return candidate;+ }+ return null;+}++// The Backups overview, ported from the design mock: what is protected, how+// reliably it has been running, where the bytes live, and what happened lately.+// The archive table lives on its own Snapshots section — this page answers+// "is my data safe?", not "show me every file".+export default function BackupsOverview({+ stats, storageConfig, costSummary, schedules = [], backups = [], onGo,+}) {+ const [policies, setPolicies] = useState(null);+ const [runs, setRuns] = useState(null);++ useEffect(() => {+ let cancelled = false;+ // Both are admin-only and both are optional: a panel that has never used+ // policy-driven backups still renders this page off the archive listing.+ api.listBackupPolicies()+ .then((res) => { if (!cancelled) setPolicies(res?.policies || []); })+ .catch(() => { if (!cancelled) setPolicies([]); });+ api.listBackupRuns({ limit: 500 })+ .then((res) => { if (!cancelled) setRuns(res?.runs || []); })+ .catch(() => { if (!cancelled) setRuns([]); });+ return () => { cancelled = true; };+ }, []);++ // Activity events, newest first. Policy runs are richer (status, duration,+ // errors) so they win; the filesystem archive is the fallback for panels+ // that only ever used manual backups.+ const events = useMemo(() => {+ if (runs?.length) {+ return runs.map((r) => ({+ id: `run-${r.id}`,+ at: r.finished_at || r.started_at,+ status: r.status === 'success' ? 'complete' : r.status === 'running' ? 'running' : 'failed',+ name: r.target_meta?.name || `${r.target_type} #${r.target_id}`,+ kind: r.target_type,+ size: r.size_total || r.size_local || 0,+ duration: r.duration_seconds,+ error: r.error_message,+ sub: r.kind === 'full' ? 'Full' : 'Incremental',+ }));+ }+ return (backups || []).map((b, i) => ({+ id: `bk-${i}`,+ at: b.timestamp,+ status: 'complete',+ name: b.name || b.app_name,+ kind: b.type,+ size: b.size || 0,+ duration: null,+ error: null,+ sub: b.type === 'database' ? 'Database' : b.type === 'files' ? 'Files' : 'Application',+ }));+ }, [runs, backups]);++ // Daily buckets over the heatmap window. A day is "failed" if anything that+ // day failed — the point of the strip is to make a bad day findable.+ const heatmap = useMemo(() => {+ const byDay = new Map();+ events.forEach((e) => {+ if (!e.at) return;+ const key = e.at.slice(0, 10);+ const cell = byDay.get(key) || { count: 0, failed: false };+ cell.count += 1;+ if (e.status === 'failed') cell.failed = true;+ byDay.set(key, cell);+ });+ const cells = [];+ for (let i = HEATMAP_DAYS - 1; i >= 0; i -= 1) {+ const d = new Date();+ d.setDate(d.getDate() - i);+ const key = dayKey(d);+ cells.push({ key, ...(byDay.get(key) || { count: 0, failed: false }) });+ }+ return cells;+ }, [events]);++ const window30 = useMemo(() => {+ const cutoff = Date.now() - 30 * 86400000;+ return events.filter((e) => e.at && new Date(e.at).getTime() >= cutoff);+ }, [events]);++ const failed30 = window30.filter((e) => e.status === 'failed').length;+ const finished30 = window30.filter((e) => e.status !== 'running');+ const successRate = finished30.length+ ? ((finished30.length - failed30) / finished30.length) * 100+ : null;++ const thisWeek = useMemo(() => {+ const cutoff = Date.now() - 7 * 86400000;+ return events.filter((e) => e.at && new Date(e.at).getTime() >= cutoff).length;+ }, [events]);++ const avgDuration = useMemo(() => {+ const withDuration = events.filter((e) => typeof e.duration === 'number' && e.duration > 0);+ if (!withDuration.length) return null;+ return withDuration.reduce((a, e) => a + e.duration, 0) / withDuration.length;+ }, [events]);++ // Protected resources, grouped the way the mock labels them.+ const protection = useMemo(() => {+ const active = (policies || []).filter((p) => p.enabled);+ const counts = {};+ active.forEach((p) => {+ const [one, many] = TARGET_LABEL[p.target_type] || [p.target_type, `${p.target_type}s`];+ const label = one;+ counts[label] = counts[label] || { one, many, n: 0 };+ counts[label].n += 1;+ });+ const parts = Object.values(counts).map((c) => `${c.n} ${c.n === 1 ? c.one : c.many}`);+ return { total: active.length, detail: parts.join(' · ') };+ }, [policies]);++ const destinations = useMemo(() => {+ const provider = storageConfig?.provider || 'local';+ const rates = costSummary?.cost_rates || {};+ const localBytes = stats?.total_size || 0;+ const remoteBytes = stats?.remote_size || 0;+ const rows = [+ {+ key: 'local',+ name: 'Local disk',+ sub: 'this server',+ bytes: localBytes,+ tone: 'local',+ primary: provider === 'local',+ cost: (localBytes / 1024 ** 3) * (rates.local || 0),+ },+ ];+ if (provider !== 'local') {+ rows.unshift({+ key: provider,+ name: provider === 'b2' ? 'Backblaze B2' : 'S3-compatible',+ sub: storageConfig?.[provider]?.bucket || 'remote bucket',+ bytes: remoteBytes,+ tone: 'remote',+ primary: true,+ cost: (remoteBytes / 1024 ** 3) * (rates[provider] || 0),+ });+ }+ const peak = Math.max(...rows.map((r) => r.bytes), 1);+ return { rows, peak, count: rows.length };+ }, [stats, storageConfig, costSummary]);++ const nextScheduled = useMemo(() => {+ const upcoming = (schedules || [])+ .filter((s) => s.enabled !== false)+ .map((s) => ({ schedule: s, at: nextFire(s) }))+ .filter((x) => x.at)+ .sort((a, b) => a.at - b.at);+ return upcoming[0] || null;+ }, [schedules]);++ const totalBytes = (stats?.total_size || 0) + (stats?.remote_size || 0);+ const latest = events.slice(0, 5);++ return (+ <div className="bk-overview">+ <KpiBand max={4}>+ <MetricCard+ tone="green"+ icon={<ShieldCheck size={16} />}+ value={protection.total || stats?.total_backups || 0}+ label="Protected resources"+ >+ <div className="sk-kpi__sub">+ <span>{protection.detail || 'from the backup archive'}</span>+ </div>+ </MetricCard>+ <MetricCard+ tone="accent"+ icon={<Database size={16} />}+ value={formatBytes(totalBytes, { defaultValue: '0 B' })}+ label="Storage used"+ >+ <div className="sk-kpi__sub">+ <span>across {destinations.count} destination{destinations.count === 1 ? '' : 's'}</span>+ </div>+ </MetricCard>+ <MetricCard+ tone={successRate == null ? 'accent' : successRate >= 99 ? 'green' : successRate >= 90 ? 'amber' : 'red'}+ icon={<History size={16} />}+ value={successRate == null ? '—' : `${successRate.toFixed(1)}`}+ unit={successRate == null ? undefined : '%'}+ label="Success rate"+ >+ <div className="sk-kpi__sub">+ <span>{finished30.length ? `${finished30.length} runs · last 30 days` : 'no runs recorded yet'}</span>+ </div>+ </MetricCard>+ <MetricCard+ tone="violet"+ icon={<Timer size={16} />}+ value={nextScheduled ? untilLabel(nextScheduled.at) : 'Not set'}+ label="Next scheduled"+ >+ <div className="sk-kpi__sub">+ <span>+ {nextScheduled+ ? `${nextScheduled.schedule.name || 'schedule'} · ${nextScheduled.schedule.schedule_time}`+ : 'no enabled schedules'}+ </span>+ </div>+ </MetricCard>+ </KpiBand>++ <div className="bk-grid2">+ <section className="bk-panel">+ <div className="bk-panel__head">+ <div>+ <h3>Backup activity</h3>+ <span className="bk-panel__sub">Last {HEATMAP_WEEKS} weeks · daily snapshots</span>+ </div>+ <div className="bk-heat__legend">+ less+ <i className="l1" /><i className="l2" /><i className="l3" />+ more+ </div>+ </div>++ <div className="bk-heat__scroll">+ <div className="bk-heat">+ {heatmap.map((cell) => (+ <i+ key={cell.key}+ className={cell.failed ? 'fail' : cell.count === 0 ? '' : cell.count <= 2 ? 'l1' : cell.count <= 4 ? 'l2' : 'l3'}+ title={`${cell.key} · ${cell.failed ? 'failed' : `${cell.count} backup${cell.count === 1 ? '' : 's'}`}`}+ />+ ))}+ </div>+ </div>++ <div className="bk-heat__stats">+ {[+ ['Total snapshots', events.length.toLocaleString()],+ ['This week', String(thisWeek)],+ ['Avg duration', formatDuration(avgDuration)],+ ['Failed (30d)', String(failed30)],+ ].map(([label, value]) => (+ <div key={label}>+ <span>{label}</span>+ <strong>{value}</strong>+ </div>+ ))}+ </div>+ </section>++ <section className="bk-panel">+ <div className="bk-panel__head">+ <h3>Recent activity</h3>+ <button type="button" className="bk-link" onClick={() => onGo('snapshots')}>+ All snapshots <ChevronRight size={14} />+ </button>+ </div>+ {events.length === 0 ? (+ <p className="bk-hint">Nothing has run yet — the first backup will show up here.</p>+ ) : (+ <div className="bk-feed">+ {events.slice(0, 5).map((e) => (+ <div key={e.id} className="bk-feed__item">+ <span className={`bk-feed__dot is-${e.status}`}>+ {e.status === 'failed'+ ? <AlertTriangle size={14} />+ : e.status === 'running'+ ? <History size={14} />+ : <Archive size={14} />}+ </span>+ <div className="bk-feed__body">+ <div className="bk-feed__txt">+ {e.status === 'failed'+ ? <>Backup failed · <b>{e.name}</b>{e.error ? ` — ${e.error}` : ''}</>+ : e.status === 'running'+ ? <>Backup running · <b>{e.name}</b></>+ : <>Backup completed · <b>{e.name}</b>{e.size ? ` (${formatBytes(e.size)})` : ''}</>}+ </div>+ <div className="bk-feed__time">{relativeTime(e.at)}</div>+ </div>+ </div>+ ))}+ </div>+ )}+ </section>+ </div>++ <div className="bk-grid2">+ <section className="bk-panel">+ <div className="bk-panel__head">+ <h3>Storage destinations</h3>+ <button type="button" className="bk-link" onClick={() => onGo('storage')}>+ Manage <ChevronRight size={14} />+ </button>+ </div>+ {destinations.rows.map((row) => (+ <div key={row.key} className="bk-dest__row">+ <div className="bk-dest__top">+ <span className="bk-dest__name">+ {row.tone === 'local' ? <HardDrive size={14} /> : <Cloud size={14} />}+ {row.name}+ {row.primary && <span className="bk-dest__tag">PRIMARY</span>}+ <small>{row.sub}</small>+ </span>+ <span className="bk-dest__size">+ {formatBytes(row.bytes, { defaultValue: '0 B' })}+ {row.cost > 0 && <em>· ${row.cost.toFixed(2)}/mo</em>}+ </span>+ </div>+ <div className={`bk-dest__bar bk-dest__bar--${row.tone}`}>+ <i style={{ width: `${Math.max(2, (row.bytes / destinations.peak) * 100)}%` }} />+ </div>+ </div>+ ))}+ {destinations.count === 1 && (+ <p className="bk-hint bk-hint--warn">+ <AlertTriangle size={13} />+ Everything is on one disk. Add a remote destination so a dead+ server doesn't take the backups with it.+ </p>+ )}+ </section>++ <section className="bk-panel bk-panel--flush">+ <div className="bk-panel__head">+ <h3>Latest snapshots</h3>+ </div>+ {latest.length === 0 ? (+ <EmptyState+ icon={Archive}+ title="No snapshots yet"+ description="Run a backup or enable a schedule to start building an archive."+ />+ ) : (+ <table className="sk-dtable bk-latest">+ <tbody>+ {latest.map((e) => {+ const Icon = KIND_ICON[e.kind] || Archive;+ return (+ <tr key={e.id}>+ <td>+ <div className="sk-cell-name">+ <span className="bk-ico"><Icon size={14} /></span>+ <span>+ <div>{e.name}</div>+ <div className="sk-cell-sub">{e.sub} · {relativeTime(e.at)}</div>+ </span>+ </div>+ </td>+ <td className="sk-cell-mono">{formatBytes(e.size, { defaultValue: '—' })}</td>+ <td>+ <Pill kind={e.status === 'complete' ? 'green' : e.status === 'running' ? 'cyan' : 'red'}>+ {e.status}+ </Pill>+ </td>+ </tr>+ );+ })}+ </tbody>+ </table>+ )}+ </section>+ </div>+ </div>+ );+}diff --git a/frontend/src/components/backups/SchedulesTable.jsx b/frontend/src/components/backups/SchedulesTable.jsxnew file mode 100644index 00000000..d51c33b6--- /dev/null+++ b/frontend/src/components/backups/SchedulesTable.jsx@@ -0,0 +1,180 @@+import { Archive, Database, Globe, HardDrive, Package, Play, ShieldCheck, Trash2 } from 'lucide-react';+import { Switch } from '@/components/ui/switch';++const KIND_ICON = {+ application: Package,+ database: Database,+ files: Archive,+ wordpress: Globe,+ server: HardDrive,+};++const DAY_INDEX = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };+const DAY_LABEL = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];++// Next fire of a schedule row. Deliberately the same walk-forward the overview+// tile uses, so "in 4h 48m" here and on Overview can never disagree.+function nextFire(schedule) {+ const [hh, mm] = String(schedule.schedule_time || '').split(':').map(Number);+ if (Number.isNaN(hh) || Number.isNaN(mm)) return null;+ const days = Array.isArray(schedule.days) ? schedule.days : ['daily'];+ const daily = days.length === 0 || days.includes('daily');+ const wanted = daily+ ? null+ : new Set(days.map((d) => DAY_INDEX[String(d).slice(0, 3).toLowerCase()]).filter((n) => n != null));+ if (!daily && (!wanted || wanted.size === 0)) return null;+ for (let offset = 0; offset <= 7; offset += 1) {+ const candidate = new Date();+ candidate.setDate(candidate.getDate() + offset);+ candidate.setHours(hh, mm, 0, 0);+ if (candidate.getTime() <= Date.now()) continue;+ if (daily || wanted.has(candidate.getDay())) return candidate;+ }+ return null;+}++function untilLabel(date) {+ const ms = date.getTime() - Date.now();+ if (ms <= 0) return 'due now';+ const mins = Math.round(ms / 60000);+ if (mins < 60) return `in ${mins}m`;+ const h = Math.floor(mins / 60);+ if (h < 24) return `in ${h}h ${mins % 60}m`;+ return `in ${Math.round(h / 24)}d`;+}++function agoLabel(iso) {+ if (!iso) return 'Never';+ const diff = (Date.now() - new Date(iso).getTime()) / 1000;+ if (Number.isNaN(diff)) return 'Never';+ if (diff < 3600) return `${Math.max(1, Math.round(diff / 60))}m ago`;+ if (diff < 86400) return `${Math.round(diff / 3600)}h ago`;+ if (diff < 172800) return 'yesterday';+ return `${Math.round(diff / 86400)}d ago`;+}++// Frequency in the mock's phrasing: "Daily · 03:00" / "Weekly · Sun 02:00".+function frequencyLabel(schedule) {+ const time = schedule.schedule_time || '—';+ const days = Array.isArray(schedule.days) ? schedule.days : ['daily'];+ if (days.length === 0 || days.includes('daily')) return `Daily · ${time}`;+ if (days.length === 1) {+ const idx = DAY_INDEX[String(days[0]).slice(0, 3).toLowerCase()];+ return `Weekly · ${idx == null ? days[0] : DAY_LABEL[idx]} ${time}`;+ }+ return `${days.length}×/week · ${time}`;+}++// Policy list in the design mock's shape: what runs, how often, how long it is+// kept, where it lands, and whether it is on. The columns the mock fills from+// its fixtures but this panel has no source for (per-policy size, run-now) are+// left out rather than faked.+export default function SchedulesTable({+ schedules, retentionDays, remoteLabel, onToggle, onRemove, onRun,+}) {+ return (+ <>+ <div className="bk-card">+ <table className="sk-dtable bk-table bk-table--schedules">+ <thead>+ <tr>+ <th>Policy</th>+ <th>Frequency</th>+ <th>Retention</th>+ <th>Destination</th>+ <th>Last run</th>+ <th>Next</th>+ <th className="bk-col-on">On</th>+ <th aria-label="Actions" />+ </tr>+ </thead>+ <tbody>+ {schedules.map((schedule) => {+ const Icon = KIND_ICON[schedule.backup_type] || Archive;+ const next = schedule.enabled ? nextFire(schedule) : null;+ const failed = schedule.last_status === 'failed';+ return (+ <tr key={schedule.id} className={schedule.enabled ? undefined : 'is-off'}>+ <td>+ <div className="sk-cell-name bk-name">+ <span className={`bk-ico bk-ico--${schedule.backup_type}`}>+ <Icon size={15} />+ </span>+ <span>+ <div>{schedule.name}</div>+ <div className="sk-cell-sub">+ {[schedule.target, schedule.backup_type,+ schedule.upload_remote ? 'off-box copy' : null]+ .filter(Boolean).join(' · ')}+ </div>+ </span>+ </div>+ </td>+ <td className="sk-cell-mono">{frequencyLabel(schedule)}</td>+ <td>+ <span className="bk-ret">+ <span>{retentionDays} d</span>+ </span>+ </td>+ <td className="sk-cell-mono">+ {schedule.upload_remote ? remoteLabel : 'Local disk'}+ </td>+ <td>+ {failed ? (+ <span className="bk-lastrun is-failed">+ <i />{agoLabel(schedule.last_run)}+ </span>+ ) : (+ <span className="bk-lastrun">{agoLabel(schedule.last_run)}</span>+ )}+ </td>+ <td className="sk-cell-mono">+ {schedule.enabled+ ? (next ? untilLabel(next) : '—')+ : <span className="bk-paused">paused</span>}+ </td>+ <td className="bk-col-on">+ <Switch+ checked={Boolean(schedule.enabled)}+ onCheckedChange={() => onToggle(schedule)}+ aria-label={`${schedule.enabled ? 'Disable' : 'Enable'} ${schedule.name}`}+ />+ </td>+ <td>+ <div className="bk-actions">+ {onRun && (+ <button+ type="button"+ className="bk-iconbtn"+ onClick={() => onRun(schedule)}+ title="Run this policy now"+ aria-label={`Run ${schedule.name} now`}+ >+ <Play size={15} />+ </button>+ )}+ <button+ type="button"+ className="bk-iconbtn bk-iconbtn--danger"+ onClick={() => onRemove(schedule.id)}+ title="Delete this policy"+ aria-label={`Delete ${schedule.name}`}+ >+ <Trash2 size={15} />+ </button>+ </div>+ </td>+ </tr>+ );+ })}+ </tbody>+ </table>+ </div>+ <p className="bk-hint bk-hint--foot">+ <ShieldCheck size={13} />+ Snapshots older than {retentionDays} days are pruned automatically. Per-resource+ policies (with their own retention) are set on each site or database.+ </p>+ </>+ );+}diff --git a/frontend/src/components/backups/StorageDestinations.jsx b/frontend/src/components/backups/StorageDestinations.jsxnew file mode 100644index 00000000..bc743b38--- /dev/null+++ b/frontend/src/components/backups/StorageDestinations.jsx@@ -0,0 +1,125 @@+import { Activity, Archive, Cloud, HardDrive, Plus } from 'lucide-react';+import { formatBytes } from '@/utils/formatBytes';+import { Pill } from '@/components/ds';+import { Button } from '@/components/ui/button';++const PROVIDER_META = {+ s3: { name: 'S3-compatible', type: 'Object storage', icon: Cloud },+ b2: { name: 'Backblaze B2', type: 'Object storage', icon: Cloud },+};++// Where the archive can land, as a card per destination — the design mock's+// Storage section. Local disk is always present (it is where a backup is+// written before anything is uploaded); a configured remote joins it and takes+// the PRIMARY badge, because that is the copy that survives losing the box.+export default function StorageDestinations({+ stats, storageConfig, costSummary, onTest, onBrowse, onAdd, testing,+}) {+ const provider = storageConfig?.provider || 'local';+ const rates = costSummary?.cost_rates || {};+ const remote = PROVIDER_META[provider];++ const cards = [];++ if (remote) {+ const bytes = stats?.remote_size || 0;+ cards.push({+ key: provider,+ icon: remote.icon,+ name: remote.name,+ type: remote.type,+ primary: true,+ connected: true,+ bytes,+ quota: null,+ cost: (bytes / 1024 ** 3) * (rates[provider] || 0),+ rows: [+ ['Bucket', storageConfig?.[provider]?.bucket || '—'],+ provider === 's3' ? ['Region', storageConfig?.s3?.region || '—'] : null,+ ['Path prefix', storageConfig?.[provider]?.path_prefix || '—'],+ ['Auto-upload', storageConfig?.auto_upload ? 'on' : 'off'],+ ].filter(Boolean),+ testable: true,+ });+ }++ const localBytes = stats?.total_size || 0;+ cards.push({+ key: 'local',+ icon: HardDrive,+ name: 'Local disk',+ type: 'On this server',+ primary: !remote,+ connected: true,+ bytes: localBytes,+ quota: null,+ cost: (localBytes / 1024 ** 3) * (rates.local || 0),+ rows: [+ ['Snapshots', String(stats?.total_backups || 0)],+ ['Kept after upload', storageConfig?.keep_local_copy === false ? 'no' : 'yes'],+ ],+ testable: false,+ });++ const peak = Math.max(...cards.map((c) => c.bytes), 1);++ return (+ <div className="bk-dests">+ {cards.map((card) => {+ const Icon = card.icon;+ return (+ <article key={card.key} className={`bk-destcard${card.primary ? ' is-primary' : ''}`}>+ <div className="bk-destcard__head">+ <span className="bk-destcard__ico"><Icon size={19} /></span>+ <div className="bk-destcard__id">+ <div className="bk-destcard__name">+ {card.name}+ {card.primary && <span className="bk-dest__tag">PRIMARY</span>}+ </div>+ <div className="bk-destcard__type">{card.type}</div>+ </div>+ <Pill kind={card.connected ? 'green' : 'gray'}>+ {card.connected ? 'connected' : 'not set up'}+ </Pill>+ </div>++ <div className={`bk-dest__bar bk-dest__bar--${card.key === 'local' ? 'local' : 'remote'}`}>+ <i style={{ width: `${Math.max(2, (card.bytes / peak) * 100)}%` }} />+ </div>+ <div className="bk-destcard__usage">+ <span>{formatBytes(card.bytes, { defaultValue: '0 B' })} stored</span>+ <span>{card.cost > 0 ? `$${card.cost.toFixed(2)}/mo` : 'no charge'}</span>+ </div>++ <dl className="bk-destcard__rows">+ {card.rows.map(([k, v]) => (+ <div key={k}>+ <dt>{k}</dt>+ <dd>{v}</dd>+ </div>+ ))}+ </dl>++ <div className="bk-destcard__actions">+ {card.testable && (+ <Button variant="outline" size="sm" onClick={onTest} disabled={testing}>+ <Activity size={14} /> {testing ? 'Testing…' : 'Test'}+ </Button>+ )}+ <Button variant="outline" size="sm" onClick={onBrowse}>+ <Archive size={14} /> Snapshots+ </Button>+ </div>+ </article>+ );+ })}++ {/* Only one remote can be active at a time, so this reveals the+ configuration form below rather than adding a second card. */}+ <button type="button" className="bk-destcard bk-destcard--add" onClick={onAdd}>+ <Plus size={24} />+ <span>{remote ? 'Change destination' : 'Add destination'}</span>+ </button>+ </div>+ );+}diff --git a/frontend/src/components/backups/backupTabs.jsx b/frontend/src/components/backups/backupTabs.jsxindex 836e7c49..0c052bf0 100644--- a/frontend/src/components/backups/backupTabs.jsx+++ b/frontend/src/components/backups/backupTabs.jsx@@ -1,13 +1,17 @@-import { Archive, Clock, Cloud, Settings } from 'lucide-react';+import { Archive, Clock, Cloud, LayoutGrid, Settings } from 'lucide-react';-// Shared sub-nav for the Backups page group (Backups / Schedules / Storage /-// Settings). Rendered in the shared PageTopbar tabs so the sections live in the-// page top bar — matching the Domains/Services top-bar layout (see-// docs/REDESIGN_MAP.md §6 decision 3). All sections render from the single-// Backups page, keyed off the /backups/:tab route.+// Shared sub-nav for the Backups page group. Rendered in the shared PageTopbar+// tabs so the sections live in the page top bar — matching the Domains/Services+// top-bar layout (see docs/REDESIGN_MAP.md §6 decision 3). All sections render+// from the single Backups page, keyed off the /backups/:tab route.+//+// Overview leads ("is my data safe?") and the archive table moved behind+// Snapshots ("show me every file") — two different questions, and the summary+// band that belongs to the first used to repeat above all of them.export const BACKUP_TABS = [- { to: '/backups', label: 'Backups', end: true, icon: <Archive size={15} /> },+ { to: '/backups', label: 'Overview', end: true, icon: <LayoutGrid size={15} /> },{ to: '/backups/schedules', label: 'Schedules', icon: <Clock size={15} /> },+ { to: '/backups/snapshots', label: 'Snapshots', icon: <Archive size={15} /> },{ to: '/backups/storage', label: 'Storage', icon: <Cloud size={15} /> },{ to: '/backups/settings', label: 'Settings', icon: <Settings size={15} /> },];diff --git a/frontend/src/pages/Backups.jsx b/frontend/src/pages/Backups.jsxindex 75b4d25f..96b83238 100644--- a/frontend/src/pages/Backups.jsx+++ b/frontend/src/pages/Backups.jsx@@ -1,6 +1,6 @@import { useState, useEffect } from 'react';import useTabParam from '../hooks/useTabParam';-import { Upload, Check, AlertTriangle, Clock, Database, Package, FolderArchive, HardDrive, Cloud, CloudOff, RefreshCw, Trash2, Plus, CheckCircle, XCircle, FileArchive, DollarSign, TrendingUp } from 'lucide-react';+import { Upload, Check, AlertTriangle, Archive, Clock, Database, Package, FolderArchive, HardDrive, History, Cloud, RefreshCw, Trash2, Plus, FileArchive, DollarSign } from 'lucide-react';import api from '../services/api';import { formatBytes } from '@/utils/formatBytes';import { useToast } from '../contexts/ToastContext';@@ -11,10 +11,16 @@ import { FormField, FormRow } from '../components/FormField';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Textarea } from '@/components/ui/textarea';-import { MetricCard, Pill, SegControl } from '@/components/ds';+import { Pill, SearchField, SegControl } from '@/components/ds';+import BackupsOverview from '../components/backups/BackupsOverview';+import SchedulesTable from '../components/backups/SchedulesTable';+import StorageDestinations from '../components/backups/StorageDestinations';import { useTopbarActions } from '@/hooks/useTopbarActions';-const VALID_TABS = ['backups', 'schedules', 'storage', 'settings'];+// `backups` is kept as an alias so old /backups/backups links still resolve to+// the archive, which now answers to `snapshots`.+const VALID_TABS = ['overview', 'schedules', 'snapshots', 'storage', 'settings'];+const TAB_ALIASES = { backups: 'snapshots' };const PROVIDER_LABELS = { local: 'Local only', s3: 'S3-Compatible', b2: 'Backblaze B2' };@@ -30,8 +36,10 @@ const Backups = () => {const [apps, setApps] = useState([]);const [loading, setLoading] = useState(true);const [error, setError] = useState(null);- const [activeTab] = useTabParam('/backups', VALID_TABS);+ const [rawTab, setActiveTab] = useTabParam('/backups', VALID_TABS);+ const activeTab = TAB_ALIASES[rawTab] || rawTab;const [filterType, setFilterType] = useState('all');+ const [search, setSearch] = useState('');// Modal statesconst [showBackupModal, setShowBackupModal] = useState(false);@@ -388,22 +396,47 @@ const Backups = () => {}};+ // Search narrows first so the segment counts always describe what a click+ // on that segment would actually show.+ const searchedBackups = (() => {+ const q = search.trim().toLowerCase();+ if (!q) return backups;+ return backups.filter(b => (+ (b.name || '').toLowerCase().includes(q)+ || (b.app_name || '').toLowerCase().includes(q)+ || (b.type || '').toLowerCase().includes(q)+ ));+ })();const filteredBackups = filterType === 'all'- ? backups- : backups.filter(b => b.type === filterType);+ ? searchedBackups+ : searchedBackups.filter(b => b.type === filterType);+ // One primary action per section, the way the mock does it: Schedules+ // offers "New schedule", everything else offers "Back up now". A Create+ // Backup button on the Schedules tab was answering a question nobody on+ // that tab was asking.useTopbarActions(() => (<>- <Button variant="outline" size="sm" onClick={() => setShowScheduleModal(true)}>- <Clock size={16} />- Add Schedule- </Button>- <Button size="sm" onClick={() => setShowBackupModal(true)}>- <Plus size={16} />- Create Backup- </Button>+ {activeTab === 'schedules' ? (+ <Button size="sm" onClick={() => setShowScheduleModal(true)}>+ <Plus size={16} />+ New schedule+ </Button>+ ) : (+ <Button size="sm" onClick={() => setShowBackupModal(true)}>+ <Archive size={16} />+ Back up now+ </Button>+ )}+ {activeTab === 'snapshots' && (+ <SearchField+ value={search}+ onSearch={setSearch}+ placeholder="Search snapshots…"+ />+ )}</>- ), []);+ ), [activeTab, search]);if (loading) {return (@@ -422,41 +455,33 @@ const Backups = () => {</div>)}- {/* KPI strip */}- <div className="bk-kpis">- <MetricCard tone="green" icon={<FileArchive size={16} />} value={stats?.total_backups || 0} label="Total backups">- <div className="sk-kpi__sub"><span>{stats?.file_backups || 0} file backups</span></div>- </MetricCard>- <MetricCard tone="accent" icon={<Package size={16} />} value={stats?.application_backups || 0} label="Application backups" />- <MetricCard tone="violet" icon={<Database size={16} />} value={stats?.database_backups || 0} label="Database backups" />- <MetricCard tone="amber" icon={<HardDrive size={16} />} value={stats?.total_size_human || '0 B'} label="Local size" />- {storageConfig?.provider !== 'local' && (- <MetricCard tone="cyan" icon={<Cloud size={16} />} value={stats?.remote_count || 0} label="Remote backups">- {stats?.remote_size_human && (- <div className="sk-kpi__sub"><span>{stats.remote_size_human} remote</span></div>- )}- </MetricCard>- )}- <MetricCard tone="green" icon={<DollarSign size={16} />} value={formatMoney(costSummary?.total_cost ?? 0)} label="Est. storage cost / mo">- {costSummary?.total_cost_local === 0 && (- <div className="sk-kpi__sub"><span>local disk is free</span></div>- )}- </MetricCard>- <MetricCard tone="amber" icon={<TrendingUp size={16} />} value={formatMoney(costSummary?.projected_monthly_cost ?? 0)} label="Projected at full retention" />- </div>+ {/* Overview answers "is my data safe?" — the KPI band, the+ activity heatmap, the destinations and the recent feed. The+ archive table it used to sit on top of is now its own section. */}+ {activeTab === 'overview' && (+ <BackupsOverview+ stats={stats}+ storageConfig={storageConfig}+ costSummary={costSummary}+ schedules={schedules}+ backups={backups}+ onGo={setActiveTab}+ />+ )}- {activeTab === 'backups' && (+ {activeTab === 'snapshots' && (<>+ {/* Search lives in the top bar with every other list page;+ the segments carry the counts. */}<div className="bk-listhead">- <h2>Backup archive</h2><SegControlvalue={filterType}onChange={setFilterType}options={[- { value: 'all', label: 'All', count: backups.length },- { value: 'application', label: 'Applications', count: backups.filter(b => b.type === 'application').length },- { value: 'database', label: 'Databases', count: backups.filter(b => b.type === 'database').length },- { value: 'files', label: 'Files', count: backups.filter(b => b.type === 'files').length },+ { value: 'all', label: 'All', count: searchedBackups.length },+ { value: 'application', label: 'Applications', count: searchedBackups.filter(b => b.type === 'application').length },+ { value: 'database', label: 'Databases', count: searchedBackups.filter(b => b.type === 'database').length },+ { value: 'files', label: 'Files', count: searchedBackups.filter(b => b.type === 'files').length },]}/><Button size="sm" variant="outline" onClick={loadData}>@@ -472,7 +497,11 @@ const Backups = () => {action={<Button onClick={() => setShowBackupModal(true)}>Create Backup</Button>}/>) : filteredBackups.length === 0 ? (- <div className="bk-empty">No backups match the current filter.</div>+ <div className="bk-empty">+ {search.trim()+ ? `No snapshots match “${search.trim()}”.`+ : 'No snapshots match the current filter.'}+ </div>) : (<div className="bk-card"><table className="sk-dtable bk-table">@@ -492,15 +521,17 @@ const Backups = () => {{filteredBackups.map((backup, index) => (<tr key={index}><td>- <div className="sk-cell-name">+ <div className="sk-cell-name bk-name"><span className={`bk-ico bk-ico--${backup.type}`}>{getBackupIcon(backup.type)}</span>- <span>{backup.name || backup.app_name}</span>+ <span title={backup.name || backup.app_name}>+ {backup.name || backup.app_name}+ </span></div></td><td>- <span className={`bk-type bk-type--${backup.type}`}>{backup.type}</span>+ <span className="sk-tag">{backup.type}</span></td><td>{backup.app_name || backup.name?.split('_')[0] || '—'}</td><td className="sk-cell-mono">{formatBytes(backup.size, { defaultValue: '0 B' })}</td>@@ -510,41 +541,42 @@ const Backups = () => {<td><div className="bk-actions">{backup.type !== 'files' && (- <Button- size="sm"- variant="outline"+ <button+ type="button"+ className="bk-iconbtn"onClick={() => {setSelectedBackup(backup);setShowRestoreModal(true);}}- title="Restore"+ title="Restore this snapshot"+ aria-label={`Restore ${backup.name}`}>- <RefreshCw size={14} />- </Button>+ <History size={15} />+ </button>)}{storageConfig?.provider !== 'local' && backup.remote_status !== 'synced' && (- <Button- size="sm"- variant="outline"+ <button+ type="button"+ className="bk-iconbtn"onClick={() => handleUploadToRemote(backup)}disabled={uploadingBackup === backup.path}- title="Upload to Remote"+ title="Copy to remote storage"+ aria-label={`Upload ${backup.name} to remote storage`}>- {uploadingBackup === backup.path ? (- <RefreshCw size={14} className="spinning" />- ) : (- <Upload size={14} />- )}- </Button>+ {uploadingBackup === backup.path+ ? <RefreshCw size={15} className="spinning" />+ : <Upload size={15} />}+ </button>)}- <Button- size="sm"- variant="destructive"+ <button+ type="button"+ className="bk-iconbtn bk-iconbtn--danger"onClick={() => handleDeleteBackup(backup.path)}- title="Delete"+ title="Delete this snapshot"+ aria-label={`Delete ${backup.name}`}>- <Trash2 size={14} />- </Button>+ <Trash2 size={15} />+ </button></div></td></tr>@@ -558,134 +590,42 @@ const Backups = () => {{activeTab === 'schedules' && (<>- <div className="bk-listhead">- <h2>Backup schedules</h2>- <Button size="sm" onClick={() => setShowScheduleModal(true)}>- <Plus size={14} />- Add Schedule- </Button>- </div>{schedules.length === 0 ? (<EmptyStateicon={Clock}- title="No Schedules"- description="No backup schedules configured. Add a schedule for automated backups."- action={<Button onClick={() => setShowScheduleModal(true)}>Add Schedule</Button>}+ title="No schedules yet"+ description="A schedule runs a backup on its own so you don't have to remember to. Add one and it will appear here with its next fire time."+ action={<Button onClick={() => setShowScheduleModal(true)}>New schedule</Button>}/>) : (- <div className="bk-card">- <table className="sk-dtable bk-table bk-table--schedules">- <thead>- <tr>- <th>Name</th>- <th>Type</th>- <th>Target</th>- <th>Time</th>- <th>Days</th>- <th>Remote</th>- <th>Last Run</th>- <th>Status</th>- <th aria-label="Actions" />- </tr>- </thead>- <tbody>- {schedules.map((schedule) => (- <tr key={schedule.id} className={schedule.enabled ? undefined : 'is-disabled'}>- <td>- <div className="sk-cell-name">- <span className={`bk-ico bk-ico--${schedule.backup_type}`}>- {getBackupIcon(schedule.backup_type)}- </span>- <span>{schedule.name}</span>- </div>- </td>- <td>- <span className={`bk-type bk-type--${schedule.backup_type}`}>{schedule.backup_type}</span>- </td>- <td className="sk-cell-mono">{schedule.target}</td>- <td>- <span className="bk-sched"><Clock size={11} />{schedule.schedule_time}</span>- </td>- <td className="sk-cell-mono">{schedule.days?.join(', ') || 'daily'}</td>- <td>- {schedule.upload_remote ? (- <Cloud size={16} className="bk-remote-on" />- ) : (- <CloudOff size={16} className="bk-remote-off" />- )}- </td>- <td className="bk-when">{schedule.last_run ? formatTimestamp(schedule.last_run) : 'Never'}</td>- <td>- {schedule.last_status === 'success' && (- <Pill kind="green">Success</Pill>- )}- {schedule.last_status === 'failed' && (- <Pill kind="red">Failed</Pill>- )}- {!schedule.last_status && (- <Pill kind={schedule.enabled ? 'green' : 'gray'}>- {schedule.enabled ? 'Active' : 'Disabled'}- </Pill>- )}- </td>- <td>- <div className="bk-actions">- <Button- size="sm"- variant={schedule.enabled ? 'outline' : 'default'}- onClick={() => handleToggleSchedule(schedule)}- title={schedule.enabled ? 'Disable' : 'Enable'}- >- {schedule.enabled ? <XCircle size={14} /> : <CheckCircle size={14} />}- </Button>- <Button- size="sm"- variant="destructive"- onClick={() => handleRemoveSchedule(schedule.id)}- title="Remove"- >- <Trash2 size={14} />- </Button>- </div>- </td>- </tr>- ))}- </tbody>- </table>- </div>+ <SchedulesTable+ schedules={schedules}+ retentionDays={config?.retention_days || 30}+ remoteLabel={PROVIDER_LABELS[storageConfig?.provider] || 'Local disk'}+ onToggle={handleToggleSchedule}+ onRemove={handleRemoveSchedule}+ />)}</>)}{activeTab === 'storage' && (<>- <div className="bk-specs">- <div className="sk-spec-card">- <div className="sk-spec-card__label">Provider</div>- <div className="sk-spec-card__value">{PROVIDER_LABELS[storageConfig?.provider] || 'Local only'}</div>- <div className="sk-spec-card__sub">- {storageConfig && storageConfig.provider !== 'local'- ? (storageConfig.auto_upload ? 'auto-upload on' : 'auto-upload off')- : 'backups stay on this server'}- </div>- </div>- <div className="sk-spec-card">- <div className="sk-spec-card__label">Local archive</div>- <div className="sk-spec-card__value">{stats?.total_size_human || '0 B'}</div>- <div className="sk-spec-card__sub">{stats?.total_backups || 0} backups on disk</div>- </div>- {storageConfig && storageConfig.provider !== 'local' && (- <div className="sk-spec-card">- <div className="sk-spec-card__label">Remote archive</div>- <div className="sk-spec-card__value">{stats?.remote_size_human || '0 B'}</div>- <div className="sk-spec-card__sub">{stats?.remote_count || 0} backups uploaded</div>- </div>- )}- </div>-- <div className="card">+ <StorageDestinations+ stats={stats}+ storageConfig={storageConfig}+ costSummary={costSummary}+ testing={testingConnection}+ onTest={handleTestConnection}+ onBrowse={() => setActiveTab('snapshots')}+ onAdd={() => {+ document.getElementById('bk-storage-form')?.scrollIntoView({ behavior: 'smooth', block: 'start' });+ }}+ />++ <div className="card" id="bk-storage-form"><div className="card-header">- <h3>Remote Storage Configuration</h3>+ <h3>Configure destination</h3></div><div className="card-body"><form onSubmit={handleSaveStorageConfig}>diff --git a/frontend/src/services/api/backupProtection.js b/frontend/src/services/api/backupProtection.jsindex b2e30cbd..837081a7 100644--- a/frontend/src/services/api/backupProtection.js+++ b/frontend/src/services/api/backupProtection.js@@ -57,3 +57,19 @@ export async function runBackupDrill(targetType, targetId) {export async function deleteBackupRun(targetType, targetId, runId) {return this.request(`${runsBase(targetType, targetId)}/${runId}`, { method: 'DELETE' });}++// ---- fleet-wide policy + run views (§8 unification) -----------------------+// The per-target methods above answer "how is THIS site protected?"; these two+// answer "how is everything protected?" and back the Backups overview — the+// protected-resource count, the activity heatmap, and the success rate all come+// from these two lists rather than from the filesystem archive listing.++export async function listBackupPolicies(params = {}) {+ const qs = new URLSearchParams(params).toString();+ return this.request(`/backups/policies${qs ? `?${qs}` : ''}`);+}++export async function listBackupRuns(params = {}) {+ const qs = new URLSearchParams(params).toString();+ return this.request(`/backups/runs${qs ? `?${qs}` : ''}`);+}diff --git a/frontend/src/styles/pages/_backups.scss b/frontend/src/styles/pages/_backups.scssindex b46ff230..fd2738f3 100644--- a/frontend/src/styles/pages/_backups.scss+++ b/frontend/src/styles/pages/_backups.scss@@ -13,10 +13,479 @@}// ---------- KPI strip / generic cards -----------.bk-kpis {+// ---------- Overview (ported from the design mock) ----------+// KPI band, activity heatmap, recent feed, destinations, latest snapshots.+// The summary band lives here only — it used to repeat above Schedules,+// Storage and Settings, where none of its numbers answered the question you+// opened that tab to ask.+.bk-overview {display: grid;- grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));- gap: $space-3;+ gap: $space-5;+}++.bk-grid2 {+ display: grid;+ grid-template-columns: repeat(2, minmax(0, 1fr));+ gap: $space-5;+ align-items: start;++ @media (max-width: 1100px) { grid-template-columns: 1fr; }+}++.bk-panel {+ min-width: 0;+ padding: $space-5;+ background: var(--surface);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);++ // For panels whose body is a table that should meet the card edges.+ &--flush {+ padding: 0;+ overflow: hidden;++ .bk-panel__head { padding: $space-5 $space-5 0; margin-bottom: $space-3; }+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: $space-3;+ margin-bottom: $space-4;++ h3 {+ margin: 0;+ font-size: 14px;+ font-weight: $font-weight-semibold;+ color: var(--text);+ }+ }++ &__sub {+ display: block;+ margin-top: 3px;+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);+ }+}++// "All snapshots ›" / "Manage ›" — a quiet inline jump to the full section.+.bk-link {+ display: inline-flex;+ align-items: center;+ gap: 3px;+ padding: 0;+ border: 0;+ background: none;+ color: var(--text-faint);+ font-size: 12px;+ cursor: pointer;+ white-space: nowrap;++ &:hover { color: var(--accent-bright); }+}++.bk-hint {+ display: flex;+ align-items: center;+ gap: 7px;+ margin: 0;+ font-size: 12.5px;+ color: var(--text-faint);++ svg { flex-shrink: 0; }++ // Amber, not red: keeping backups only on the same disk is a risk to fix,+ // not a failure that has already happened.+ &--warn {+ margin-top: $space-4;+ padding-top: $space-3;+ border-top: 1px solid var(--border-soft);+ color: var(--amber);+ align-items: flex-start;+ line-height: 1.45;+ }+}++// Contribution-style activity grid: one column per week, one row per weekday.+// Columns are `1fr`, not a fixed pixel size — a fixed grid sat at its natural+// width inside a fluid card and left the right half of the panel empty. The+// cells keep their square shape via aspect-ratio, so the whole strip simply+// scales with however much room the card has.+.bk-heat {+ display: grid;+ width: 100%;+ grid-template-rows: repeat(7, auto);+ grid-auto-flow: column;+ grid-auto-columns: minmax(0, 1fr);+ gap: 3px;++ i {+ aspect-ratio: 1;+ min-width: 0;+ border-radius: 2px;+ background: var(--surface-3);++ &.l1 { background: rgba(61, 220, 151, 0.32); }+ &.l2 { background: rgba(61, 220, 151, 0.62); }+ &.l3 { background: var(--green); }+ &.fail { background: var(--red); }+ }++ &__scroll {+ min-width: 0;+ padding-bottom: 4px;+ }++ &__legend {+ display: inline-flex;+ align-items: center;+ gap: 4px;+ font-family: var(--mono);+ font-size: 10.5px;+ color: var(--text-faint);+ white-space: nowrap;++ i {+ width: 10px;+ height: 10px;+ border-radius: 2px;++ &.l1 { background: rgba(61, 220, 151, 0.32); }+ &.l2 { background: rgba(61, 220, 151, 0.62); }+ &.l3 { background: var(--green); }+ }+ }++ // Footer stat row under the grid.+ &__stats {+ display: flex;+ flex-wrap: wrap;+ gap: $space-6;+ margin-top: $space-4;+ padding-top: $space-4;+ border-top: 1px solid var(--border-soft);++ span {+ display: block;+ font-family: var(--mono);+ font-size: 10.5px;+ letter-spacing: 0.06em;+ text-transform: uppercase;+ color: var(--text-faint);+ }++ strong {+ display: block;+ margin-top: 3px;+ font-family: var(--mono);+ font-size: 18px;+ font-weight: 600;+ color: var(--text);+ }+ }+}++// Recent-activity feed.+.bk-feed {+ display: flex;+ flex-direction: column;++ &__item {+ display: flex;+ align-items: flex-start;+ gap: 12px;+ padding: 11px 0;+ border-top: 1px solid var(--border-soft);++ &:first-child { border-top: 0; padding-top: 0; }+ &:last-child { padding-bottom: 0; }+ }++ &__dot {+ width: 28px;+ height: 28px;+ border-radius: 8px;+ display: grid;+ place-items: center;+ flex-shrink: 0;+ background: var(--surface-3);+ color: var(--text-dim);++ &.is-complete { background: var(--green-bg); color: var(--green); }+ &.is-running { background: var(--cyan-bg); color: var(--cyan); }+ &.is-failed { background: var(--red-bg); color: var(--red); }+ }++ &__body { min-width: 0; flex: 1; }++ &__txt {+ font-size: 13px;+ color: var(--text-dim);+ line-height: 1.4;++ b { color: var(--text); font-weight: 600; }+ }++ &__time {+ margin-top: 2px;+ font-family: var(--mono);+ font-size: 10.5px;+ color: var(--text-faint);+ }+}++.bk-latest {+ td { border-bottom: 1px solid var(--border-soft); }+ tr:last-child td { border-bottom: 0; }+}++// ---------- Schedules (mock `BkSchedules`) ----------+// A disabled policy stays readable but visibly inert, so a paused row never+// gets mistaken for a running one.+.bk-table--schedules {+ tr.is-off { opacity: 0.55; }++ .bk-col-on { width: 1%; white-space: nowrap; }+}++// Retention chips (the mock's GFS daily/weekly/monthly row).+.bk-ret {+ display: inline-flex;+ gap: 4px;++ span {+ padding: 2px 7px;+ border-radius: 5px;+ background: var(--surface-3);+ color: var(--text-dim);+ font-family: var(--mono);+ font-size: 10.5px;+ }+}++.bk-lastrun {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ font-family: var(--mono);+ font-size: 11.5px;+ color: var(--text-faint);+ white-space: nowrap;++ // A failed last run gets a dot rather than a pill — it is a footnote on+ // the row, not the row's status.+ &.is-failed {+ color: var(--red);++ i {+ width: 6px;+ height: 6px;+ border-radius: 50%;+ background: var(--red);+ }+ }+}++.bk-paused { color: var(--text-ghost); }++.bk-hint--foot {+ margin-top: $space-3;+ font-family: var(--mono);+ font-size: 11px;+}++// ---------- Storage destinations (mock `BkStorage`) ----------+.bk-dests {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));+ gap: $space-4;+ margin-bottom: $space-5;+}++.bk-destcard {+ display: flex;+ flex-direction: column;+ min-width: 0;+ padding: $space-4 $space-5 $space-5;+ background: var(--surface);+ border: 1px solid var(--border-soft);+ border-radius: var(--radius);++ // The copy that survives losing the box earns the accent border.+ &.is-primary { border-color: var(--accent-dim); }++ &__head {+ display: flex;+ align-items: flex-start;+ gap: $space-3;+ margin-bottom: $space-4;++ .sk-pill { flex-shrink: 0; }+ }++ &__ico {+ width: 38px;+ height: 38px;+ border-radius: 10px;+ display: grid;+ place-items: center;+ flex-shrink: 0;+ background: var(--accent-bg);+ color: var(--accent-bright);+ }++ &__id { flex: 1; min-width: 0; }++ &__name {+ display: flex;+ align-items: center;+ gap: 8px;+ font-size: 14px;+ font-weight: 600;+ color: var(--text);+ @include truncate();+ }++ &__type {+ margin-top: 2px;+ font-family: var(--mono);+ font-size: 11px;+ color: var(--text-faint);+ }++ &__usage {+ display: flex;+ justify-content: space-between;+ gap: $space-3;+ margin-top: 7px;+ font-family: var(--mono);+ font-size: 11.5px;+ color: var(--text-faint);+ }++ &__rows {+ margin: $space-4 0 0;++ > div {+ display: flex;+ justify-content: space-between;+ gap: $space-3;+ padding: 7px 0;+ border-top: 1px solid var(--border-soft);+ }++ dt {+ font-size: 12px;+ color: var(--text-faint);+ }++ dd {+ margin: 0;+ min-width: 0;+ font-family: var(--mono);+ font-size: 11.5px;+ color: var(--text-dim);+ @include truncate();+ }+ }++ &__actions {+ display: flex;+ gap: $space-2;+ margin-top: auto;+ padding-top: $space-4;+ }++ // Dashed "add" tile — the same footprint as a real card so the grid keeps+ // its rhythm whether one destination is configured or three.+ &--add {+ display: grid;+ place-items: center;+ gap: $space-2;+ min-height: 200px;+ border: 1.5px dashed var(--border-strong);+ background: transparent;+ color: var(--text-faint);+ cursor: pointer;+ text-align: center;++ &:hover { color: var(--accent-bright); border-color: var(--accent-dim); }++ span { font-size: 13px; font-weight: 500; }+ }+}++// Storage destinations — one bar per place the archive lives (mock `.dest-bar`).+.bk-dest {+ &__row + &__row { margin-top: $space-3; }++ &__tag {+ padding: 1px 6px;+ border-radius: 4px;+ background: var(--accent-bg);+ color: var(--accent-bright);+ font-family: var(--mono);+ font-size: 9.5px;+ font-weight: 600;+ letter-spacing: 0.06em;+ }++ &__top {+ display: flex;+ align-items: baseline;+ justify-content: space-between;+ gap: $space-3;+ margin-bottom: 7px;+ }++ &__name {+ display: inline-flex;+ align-items: center;+ gap: 8px;+ min-width: 0;+ font-size: 13px;+ font-weight: 550;+ color: var(--text);++ svg { flex-shrink: 0; color: var(--text-faint); }++ small {+ font-family: var(--mono);+ font-size: 10.5px;+ font-weight: 400;+ color: var(--text-faint);+ @include truncate();+ }+ }++ &__size {+ flex-shrink: 0;+ font-family: var(--mono);+ font-size: 11.5px;+ color: var(--text-dim);++ em { font-style: normal; color: var(--text-faint); margin-left: 5px; }+ }++ &__bar {+ height: 6px;+ border-radius: 3px;+ background: var(--surface-3);+ overflow: hidden;++ i {+ display: block;+ height: 100%;+ border-radius: 3px;+ transition: width 0.3s;+ }++ &--local i { background: var(--accent-bright); }+ &--remote i { background: var(--cyan); }+ }}.bk-card {@@ -26,11 +495,37 @@padding: $space-4;}+// Row actions stay on one line at the right edge. They used to wrap, which+// pushed a full-width destructive button onto its own row and made every table+// row a different height..bk-actions {display: flex;- flex-wrap: wrap;+ flex-wrap: nowrap;+ justify-content: flex-end;align-items: center;- gap: $space-2;+ gap: 2px;+ white-space: nowrap;++ // Icon-only affordances: quiet by default, and only the delete goes red —+ // and only on hover, so a table of rows isn't a wall of red slabs.+ .bk-iconbtn {+ display: grid;+ place-items: center;+ width: 30px;+ height: 30px;+ padding: 0;+ border: 0;+ border-radius: 7px;+ background: none;+ color: var(--text-faint);+ cursor: pointer;+ transition: background 0.14s, color 0.14s;++ &:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }+ &:disabled { opacity: 0.45; cursor: default; }++ &--danger:hover:not(:disabled) { background: var(--red-bg); color: var(--red); }+ }}.bk-listhead {@@ -79,6 +574,19 @@letter-spacing: 0.04em;}+ // Snapshot names are long and machine-generated, so they get the room and+ // an ellipsis; everything numeric stays on one line rather than folding a+ // "464 MB" onto two and doubling the row height.+ .bk-name span:last-child {+ min-width: 0;+ @include truncate();+ }++ .sk-cell-mono,+ .bk-when { white-space: nowrap; }++ td:last-child { width: 1%; }+tbody tr:hover {background: $bg-hover;}