From 64448141231942ad4916e6aa8b78fc28a587c6ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?=
Date: Thu, 19 Nov 2026 23:31:16 +0800
Subject: [PATCH] =?UTF-8?q?feat(settings):=20=E5=AD=98=E5=82=A8=E4=B8=8E?=
=?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=8D=95=E9=A1=B5=E5=AF=B9=E9=BD=90=E7=9C=9F?=
=?UTF-8?q?=E5=AE=9E=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
为什么:原型里的单库立备、示例容量、历史批次与目录检查在本仓接口中都不存在;
把整批 run 包装成单库按钮会误触发整批,填示例读数会把演示值当产品事实。
怎么改:按真实契约重排单页——范围/读写方向、四项告警、策略、最近批次、运行进度与
恢复验证。立即备份明确标注整批并禁用单库动作;目录/配额/预留、子库路径、历史批次、
恢复验证保留原型位置并注明未接线;归档与数据库备份分开计量。整盘色带与告警抽成
纯函数,用隔离夹具覆盖正常/不足/缺读数分支。
怎么验:tsc、vitest 618 项、vite build、prettier 通过;本地页面夹具在 1440/1024/768
无横向溢出,未接线与夹具读数两种形态均按预期渲染。
---
CHANGELOG.md | 18 +
web/src/BackupScheduleSection.test.tsx | 184 +++++-
web/src/BackupScheduleSection.tsx | 758 ++++++++++++++++++++-----
web/src/LibraryStorageSection.tsx | 7 +-
web/src/SystemSettings.tsx | 2 +-
web/src/storageBackup.css | 353 ++++++++++++
6 files changed, 1147 insertions(+), 175 deletions(-)
create mode 100644 web/src/storageBackup.css
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 800e5bb..c59402b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
# Changelog
+## 开发快照 0.1.405(存储与备份:单页对齐真实接口)
+
+### Added
+
+- 「系统设置 → 存储与备份」按已批准交互稿落成单页:范围与读写方向、整盘占用与四项告警、
+ 备份策略、最近批次与子库清单、运行进度、恢复验证;立即备份按钮明确标注"整批全部业务库"。
+- 整盘色带与四项告警(磁盘不足/配额不足/两者同时/配额超出物理空闲)抽成纯函数,用隔离夹具
+ 覆盖正常、单项不足、同时不足与缺读数分支;生产页面在无磁盘接口时只显示"未接线"。
+- 策略区保留原型里的目录、总配额、磁盘预留位置,并逐项标注后端无对应字段、不会被保存。
+
+### Changed
+
+- 「立即备份一次」不再显示成单库动作:`POST /api/v1/backup-schedule/run` 没有单库参数,
+ 单库按钮会触发整批,因此页面禁用单库动作并说明"范围未经证实"。
+- 备份记录只展示主机 MANIFEST 的最近一批与库名;历史批次、子库路径、恢复验证没有接口,
+ 保留位置并注明原因,不拼造路径或假成功。
+- 「归档占用」改名为"版本快照,不是数据库备份",与数据库整库备份分开计量,避免把两者相加。
+
## 开发快照 0.1.404(单次任务固定同一 WeKnora 连接)
### Fixed
diff --git a/web/src/BackupScheduleSection.test.tsx b/web/src/BackupScheduleSection.test.tsx
index 7214cd0..75a8e60 100644
--- a/web/src/BackupScheduleSection.test.tsx
+++ b/web/src/BackupScheduleSection.test.tsx
@@ -8,7 +8,11 @@ import {
backupTimeValid,
formatBackupBytes,
runMoment,
+ storageAlerts,
+ storageAlertSummary,
+ storageUsage,
} from './BackupScheduleSection'
+import type { StorageDiskObservation } from './BackupScheduleSection'
import type { BackupSchedule } from './backupSchedule'
const base: BackupSchedule = {
@@ -49,7 +53,25 @@ const base: BackupSchedule = {
run_last_error: '',
}
-const view = (overrides: Partial = {}, extra: Record = {}) => {
+const GiB = 1024 * 1024 * 1024
+
+const diskFixture = (overrides: Partial = {}): StorageDiskObservation => ({
+ total_bytes: 240 * GiB,
+ free_bytes: 48 * GiB,
+ backup_bytes: 62 * GiB,
+ other_volume_backup_bytes: 0,
+ quota_bytes: 100 * GiB,
+ reserve_bytes: 10 * GiB,
+ estimate_bytes: 12 * GiB,
+ sampled_at: '2026-11-19T02:00:00Z',
+ ...overrides,
+})
+
+const view = (
+ overrides: Partial = {},
+ extra: Record = {},
+ disk: StorageDiskObservation | null = null
+) => {
const schedule = { ...base, ...overrides }
return renderToStaticMarkup(
= {}, extra: Record
)
}
describe('BackupScheduleView', () => {
- it('管理员看到定时时间/储存天数与下发按钮,并显示主机上生效的计划与最近一次结果', () => {
+ it('按真实契约给出范围与读写方向,并把立即备份限定为整批', () => {
const html = view()
for (const text of [
'存储与备份',
- '备份执行主机',
- '定时时间',
- '储存天数',
- '每月归档保留',
- '保存并下发到主机',
- '重新下发当前设置',
- '立即备份一次',
- 'weknora-test · 已连接',
- '拨号地址',
+ '数据库整库逻辑备份',
+ '范围与读写方向',
+ '备份执行主机 weknora-test 本机直连 RDS',
+ '最近批次含 2 个数据库',
+ 'weknora-test 本地备份根目录',
+ '具体根目录未由接口返回',
+ '整批 · 2 个数据库(weknora_test、dobotai_prod)',
'100.85.111.121:22',
- '全库,不是 scope 快照',
- '每天 03:30 · 保留 7 天 · 每月 3 份',
- '已一致',
- '20261009T052909Z',
- '33 秒',
- '742.4 MiB',
- 'weknora_test、dobotai_prod',
+ '立即备份一次(整批 2 个数据库)',
+ '不开放单库动作',
+ '仅备份该库(不可用)',
])
expect(html).toContain(text)
+ // 不存在把整批接口包装成单库操作的按钮文案。
+ expect(html).not.toContain('>立即备份')
+ expect(html).not.toContain('生产 090')
+ expect(html).not.toContain('weknora_v090prod')
+ })
+
+ it('策略区分主机生效状态与编辑草稿,保留期与时间仍是真实可保存字段', () => {
+ const html = view({}, { timeDraft: '05:10', daysDraft: '14' })
+ expect(html).toContain('主机生效:每天 03:30 · 保留 7 天 · 每月 3 份 · 与设置已一致')
+ expect(html).toContain('编辑草稿:每天 05:10 · 保留 14 天')
+ expect(html).toContain('有未保存修改,主机仍按生效计划执行')
expect(html).toContain('type="time"')
- expect(html).toContain('value="03:30"')
+ expect(html).toContain('value="05:10"')
+ expect(html).toContain('储存天数')
+ expect(html).toContain('每月归档保留')
+ expect(html).toContain('保存并下发到主机')
+ expect(html).toContain('重新下发当前设置')
+ })
+
+ it('目录/配额/预留没有后端字段:控件禁用并写明原因,不会假装可保存', () => {
+ const html = view()
+ expect(html).toContain('备份主机上的目录')
+ expect(html).toContain('接口未提供备份目录')
+ expect(html).toContain('检查目录(不可用)')
+ expect(html).toContain('备份总配额(GiB)')
+ expect(html).toContain('磁盘预留(GiB)')
+ expect(html).toContain('不会被保存')
+ expect(html).toContain('保存只提交后端契约里的四项')
+ expect(html).toContain('disabled')
+ })
+
+ it('最近批次只展示接口真实字段;子库路径/复制/恢复验证明确未接线', () => {
+ const html = view({ last_run_failed_databases: ['dobotai_prod'] })
+ expect(html).toContain('备份记录')
+ expect(html).toContain('接口只返回最近一批')
+ expect(html).toContain('批次戳 20261009T052909Z')
+ expect(html).toContain('耗时 33 秒')
+ expect(html).toContain('742.4 MiB')
+ expect(html).toContain('weknora_test')
+ expect(html).toContain('dobotai_prod')
+ expect(html).toContain('失败')
+ expect(html).toContain('子库目录与单库字节未由接口返回')
+ expect(html).toContain('复制目录(不可用)')
+ expect(html).toContain('恢复验证:未接线')
+ // 不拼造历史批次或示例子目录。
+ expect(html).not.toContain('/srv/kb-backups/rds-logical')
+ expect(html).not.toContain('11 月 19 日 03:30')
+ })
+
+ it('没有批次时说明不能据此判断成功/失败', () => {
+ const html = view({
+ last_run_stamp: '',
+ last_run_created_at: '',
+ last_run_databases: [],
+ last_run_total_bytes: 0,
+ host_reachable: false,
+ })
+ expect(html).toContain('还没有读到任何批次')
+ expect(html).toContain('不能据此判断备份成功或失败')
})
it('非管理员只读:没有保存/下发/立即备份按钮,只给当前设置', () => {
const html = view({}, { isAdmin: false })
expect(html).toContain('定时备份设置仅管理员可修改')
+ expect(html).toContain('立即备份仅管理员可触发')
expect(html).not.toContain('保存并下发到主机')
- expect(html).not.toContain('立即备份一次')
+ expect(html).not.toContain('立即备份一次(整批')
})
it('未接线:显式说明缺少主机凭据,下发与立即备份不可点', () => {
@@ -121,6 +196,7 @@ describe('BackupScheduleView', () => {
expect(html).toContain('未接线(缺少主机凭据)')
expect(html).toContain('待下发')
expect(html).toContain('目标主机凭据未挂载')
+ expect(html).toContain('主机未接线:定时计划不会执行')
expect(html).toContain('disabled')
})
@@ -137,6 +213,7 @@ describe('BackupScheduleView', () => {
expect(html).toContain('120.76.217.51:22')
expect(html).toContain('未知(未连上主机,未执行主机侧脚本)')
expect(html).not.toContain('缺失')
+ expect(html).toContain('主机连不上:以下"主机生效"状态未知')
})
it('已连上且脚本真的不在:这时才显示"缺失"', () => {
@@ -152,10 +229,11 @@ describe('BackupScheduleView', () => {
expect(html).toContain('每天 05:00')
})
- it('在途备份:按钮变"备份进行中…"并给出开始时间', () => {
+ it('在途备份:只报在途与开始时间,不造百分比', () => {
const html = view({ running: true, running_started_at: '2026-10-09T12:30:00Z' })
expect(html).toContain('备份进行中…')
expect(html).toContain('正在备份')
+ expect(html).toContain('没有真实百分比接口')
})
it('非法输入就地拦截,且保存按钮在未改动时不可点', () => {
@@ -188,3 +266,67 @@ describe('BackupScheduleView', () => {
expect(formatBackupBytes(2 * 1024 * 1024 * 1024)).toBe('2.00 GiB')
})
})
+
+describe('整盘占用与告警', () => {
+ it('没有磁盘接口时:不显示示例容量,四条告警一律无法判定', () => {
+ const html = view()
+ expect(html).toContain('未接线 · 不显示估算容量')
+ expect(html).toContain('后端目前没有「备份主机磁盘总量、空闲、备份目录占用」接口')
+ expect(html).toContain('无法判定')
+ expect(html).toContain('整盘总量 / 空闲 / 备份占用:未接线')
+ // 原型里的示例容量不能被当成产品事实带进来。
+ expect(html).not.toContain('总容量 240 GiB')
+ expect(html).not.toContain('总容量 500 GiB')
+ expect(html).not.toContain('可再写')
+ })
+
+ it('四段色带按真实读数计算:系统其他、备份已用、配额内空闲、配额外空闲', () => {
+ const usage = storageUsage(diskFixture())
+ expect(usage.system_other).toBe(130 * GiB) // 240 - 48 - 62
+ expect(usage.backup).toBe(62 * GiB)
+ expect(usage.quota_free).toBe(38 * GiB)
+ expect(usage.beyond_quota_free).toBe(10 * GiB) // 48 - 38
+ expect(usage.allowance).toBe(38 * GiB)
+ const html = view({}, {}, diskFixture())
+ expect(html).toContain('系统其他占用 130 GiB')
+ expect(html).toContain('备份已用 62 GiB')
+ expect(html).toContain('配额内空闲 38 GiB')
+ expect(html).toContain('配额外空闲 10 GiB')
+ expect(html).toContain('四项均正常')
+ })
+
+ it('磁盘不足:只剩磁盘告警,差值与预计新增都来自读数', () => {
+ const alerts = storageAlerts(diskFixture({ free_bytes: 20 * GiB, quota_bytes: 80 * GiB }))
+ expect(alerts.find((item) => item.code === 'disk_low')?.active).toBe(true)
+ expect(alerts.find((item) => item.code === 'quota_low')?.active).toBe(false)
+ expect(alerts.find((item) => item.code === 'both_low')?.active).toBe(false)
+ expect(storageAlertSummary(alerts)).toBe('磁盘不足')
+ const html = view({}, {}, diskFixture({ free_bytes: 20 * GiB, quota_bytes: 80 * GiB }))
+ expect(html).toContain('差 2 GiB')
+ })
+
+ it('配额不足:磁盘够、配额差 7 GiB', () => {
+ const alerts = storageAlerts(diskFixture({ backup_bytes: 95 * GiB }))
+ expect(alerts.find((item) => item.code === 'quota_low')?.active).toBe(true)
+ expect(alerts.find((item) => item.code === 'disk_low')?.active).toBe(false)
+ expect(alerts.find((item) => item.code === 'quota_low')?.detail).toContain('差 7 GiB')
+ expect(storageAlertSummary(alerts)).toBe('配额不足')
+ })
+
+ it('两者同时不足:第三条告警成立', () => {
+ const alerts = storageAlerts(diskFixture({ free_bytes: 20 * GiB, backup_bytes: 95 * GiB }))
+ expect(alerts.find((item) => item.code === 'both_low')?.active).toBe(true)
+ expect(storageAlertSummary(alerts)).toContain('磁盘与配额同时不足')
+ })
+
+ it('配额超出物理空闲:配额余量大于盘上空闲时单独告警', () => {
+ const alerts = storageAlerts(diskFixture({ quota_bytes: 200 * GiB }))
+ expect(alerts.find((item) => item.code === 'quota_over_physical')?.active).toBe(true)
+ expect(alerts.find((item) => item.code === 'quota_over_physical')?.detail).toContain('超出部分画不进磁盘')
+ })
+
+ it('缺下次新增体积时,磁盘/配额判定保持未知而不是默认正常', () => {
+ const alerts = storageAlerts(diskFixture({ estimate_bytes: null }))
+ expect(alerts.filter((item) => !item.known).map((item) => item.code)).toEqual(['disk_low', 'quota_low', 'both_low'])
+ })
+})
diff --git a/web/src/BackupScheduleSection.tsx b/web/src/BackupScheduleSection.tsx
index cbcdcb2..cfbc7ad 100644
--- a/web/src/BackupScheduleSection.tsx
+++ b/web/src/BackupScheduleSection.tsx
@@ -9,6 +9,7 @@ import {
saveBackupSchedule,
} from './backupSchedule'
import type { BackupSchedule } from './backupSchedule'
+import './storageBackup.css'
export const formatBackupBytes = (bytes: number): string => {
if (!bytes) return '—'
@@ -33,6 +34,170 @@ export const backupTimeValid = (value: string): boolean => /^([01][0-9]|2[0-3]):
export const backupDaysValid = (value: number): boolean => Number.isInteger(value) && value >= 1 && value <= 365
export const backupMonthsValid = (value: number): boolean => Number.isInteger(value) && value >= 0 && value <= 24
+const GIB = 1024 * 1024 * 1024
+
+// 整盘读数是"主机 + 卷 + 备份目录"三件事实的组合,当前后端没有对应接口:
+// 页面只保留原型位置并写明原因,不在产品里填任何示例容量。测试夹具通过这个
+// 只读结构验证色带与告警的完整分支,生产容器恒传 null。
+export interface StorageDiskObservation {
+ total_bytes: number
+ free_bytes: number
+ // 与策略目录同一卷上的备份占用
+ backup_bytes: number
+ // 其他磁盘上历史备份的占用(合计口径也要吃总配额)
+ other_volume_backup_bytes: number
+ quota_bytes: number
+ reserve_bytes: number
+ // 下次任务预计新增;未知时必须为空,不能拿上一次体积冒充
+ estimate_bytes: number | null
+ sampled_at: string
+}
+
+export type StorageAlertCode = 'disk_low' | 'quota_low' | 'both_low' | 'quota_over_physical'
+
+export interface StorageAlert {
+ code: StorageAlertCode
+ label: string
+ active: boolean
+ known: boolean
+ detail: string
+}
+
+export interface StorageUsage {
+ total: number
+ free: number
+ system_other: number
+ backup: number
+ quota_free: number
+ beyond_quota_free: number
+ budget: number
+ used_total: number
+ allowance: number
+ writable: number
+}
+
+export function storageUsage(observation: StorageDiskObservation): StorageUsage {
+ const total = Math.max(0, observation.total_bytes)
+ const free = Math.max(0, observation.free_bytes)
+ const backup = Math.max(0, observation.backup_bytes)
+ const otherBackups = Math.max(0, observation.other_volume_backup_bytes)
+ const reserve = Math.max(0, observation.reserve_bytes)
+ const budget = Math.max(0, observation.quota_bytes)
+ const usedTotal = backup + otherBackups
+ const allowance = Math.max(0, budget - usedTotal)
+ const writable = Math.max(0, free - reserve)
+ const systemOther = Math.max(0, total - free - backup)
+ const onOtherVolumes = Math.max(0, usedTotal - backup)
+ const localQuota = Math.max(0, budget - onOtherVolumes)
+ const inQuota = Math.min(backup, localQuota)
+ // 配额允许但盘上画不下的部分不进入色带,避免把配额当成物理空间。
+ const quotaFree = Math.min(free, allowance)
+ return {
+ total,
+ free,
+ system_other: systemOther,
+ backup: inQuota,
+ quota_free: quotaFree,
+ beyond_quota_free: Math.max(0, free - quotaFree),
+ budget,
+ used_total: usedTotal,
+ allowance,
+ writable,
+ }
+}
+
+// 四种告警与原型一致;读数缺失时每条都只能是"无法判定",不能默认正常。
+export function storageAlerts(observation: StorageDiskObservation | null): StorageAlert[] {
+ if (!observation) {
+ return [
+ { code: 'disk_low', label: '磁盘不足', active: false, known: false, detail: '缺主机磁盘读数' },
+ { code: 'quota_low', label: '配额不足', active: false, known: false, detail: '缺备份占用量与配额读数' },
+ { code: 'both_low', label: '磁盘与配额同时不足', active: false, known: false, detail: '缺主机磁盘读数' },
+ { code: 'quota_over_physical', label: '配额超出物理空闲', active: false, known: false, detail: '缺主机磁盘读数' },
+ ]
+ }
+ const usage = storageUsage(observation)
+ const estimate = observation.estimate_bytes
+ if (estimate === null) {
+ return [
+ {
+ code: 'disk_low',
+ label: '磁盘不足',
+ active: false,
+ known: false,
+ detail: '缺下次新增体积,不能判定是否装得下',
+ },
+ {
+ code: 'quota_low',
+ label: '配额不足',
+ active: false,
+ known: false,
+ detail: '缺下次新增体积,不能判定配额是否够',
+ },
+ { code: 'both_low', label: '磁盘与配额同时不足', active: false, known: false, detail: '缺下次新增体积' },
+ {
+ code: 'quota_over_physical',
+ label: '配额超出物理空闲',
+ active: usage.allowance > usage.free,
+ known: true,
+ detail: `配额余量 ${formatGib(usage.allowance)} GiB,盘上实际空闲 ${formatGib(usage.free)} GiB`,
+ },
+ ]
+ }
+ const diskLow = usage.writable < estimate
+ const quotaLow = usage.allowance < estimate
+ return [
+ {
+ code: 'disk_low',
+ label: '磁盘不足',
+ active: diskLow,
+ known: true,
+ detail: diskLow
+ ? `扣除预留后可写 ${formatGib(usage.writable)} GiB,本次预计新增 ${formatGib(estimate)} GiB,差 ${formatGib(estimate - usage.writable)} GiB`
+ : `扣除预留后可写 ${formatGib(usage.writable)} GiB,够本次 ${formatGib(estimate)} GiB`,
+ },
+ {
+ code: 'quota_low',
+ label: '配额不足',
+ active: quotaLow,
+ known: true,
+ detail: quotaLow
+ ? `配额余量 ${formatGib(usage.allowance)} GiB,本次预计新增 ${formatGib(estimate)} GiB,差 ${formatGib(estimate - usage.allowance)} GiB`
+ : `配额余量 ${formatGib(usage.allowance)} GiB,够本次 ${formatGib(estimate)} GiB`,
+ },
+ {
+ code: 'both_low',
+ label: '磁盘与配额同时不足',
+ active: diskLow && quotaLow,
+ known: true,
+ detail: diskLow && quotaLow ? '两项都不够,本次备份会失败' : '未同时触发',
+ },
+ {
+ code: 'quota_over_physical',
+ label: '配额超出物理空闲',
+ active: usage.allowance > usage.free,
+ known: true,
+ detail:
+ usage.allowance > usage.free
+ ? `配额还允许 ${formatGib(usage.allowance)} GiB,但盘上只剩 ${formatGib(usage.free)} GiB;超出部分画不进磁盘`
+ : '配额余量未超过物理空闲',
+ },
+ ]
+}
+
+const formatGib = (bytes: number): string => String(Number((bytes / GIB).toFixed(2)))
+const percent = (part: number, total: number): string => (total > 0 ? `${(100 * part) / total}%` : '0%')
+
+export const storageAlertSummary = (alerts: StorageAlert[]): string => {
+ const unknown = alerts.filter((item) => !item.known)
+ if (unknown.length) return '无法判定(缺主机磁盘读数)'
+ const active = alerts.filter((item) => item.active)
+ return active.length ? active.map((item) => item.label).join('、') : '四项均正常'
+}
+
+// 备份执行主机上的整库逻辑备份(全部业务库一次 pg_dump)。
+// 页面只展示接口真实给出的读数;目录、配额、预留、子库路径、历史批次与恢复
+// 验证在后端契约里还没有字段,保留原型位置并写明"未接线"。
export interface BackupScheduleViewProps {
schedule: BackupSchedule
isAdmin: boolean
@@ -53,9 +218,10 @@ export interface BackupScheduleViewProps {
onApply: () => void
onRunNow: () => void
onReload: () => void
+ // 仅测试夹具提供;生产容器不传,磁盘区显示"未接线"。
+ disk?: StorageDiskObservation | null
}
-// 纯视图:所有状态由 props 驱动,便于在测试里直接渲染各种状态(管理员/只读、已一致/待下发、在途)。
export function BackupScheduleView(props: BackupScheduleViewProps) {
const {
schedule,
@@ -77,6 +243,7 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
onApply,
onRunNow,
onReload,
+ disk = null,
} = props
const days = Number(daysDraft)
const months = Number(monthsDraft)
@@ -97,6 +264,12 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
: schedule.host_script_present
? '存在'
: '缺失'
+ const databaseCount = schedule.last_run_databases.length
+ const failedCount = schedule.last_run_failed_databases.length
+ const hasLastRun = Boolean(schedule.last_run_stamp)
+ const runFailed = failedCount > 0 || Boolean(schedule.last_run_error)
+ const usage = disk ? storageUsage(disk) : null
+ const alerts = storageAlerts(disk)
return (
@@ -104,8 +277,8 @@ export function BackupScheduleView(props: BackupScheduleViewProps) {
存储与备份
- 整库逻辑备份(pg_dump 目录格式)在备份执行主机(同 VPC 直连 RDS)
- 上本地执行:这里设置定时时间与储存天数,保存即下发到主机 cron,并可读回主机上生效的计划与最近一次结果。
+ 本页管的是数据库整库逻辑备份(pg_dump 目录格式,在备份执行主机本地写盘);
+ 下方「归档占用」是版本快照的归档文件,两者不是同一种数据,体积不能相加。
) : null}
-
-
- - 目标主机
- - {hostLine}
+
+
+
+
范围与读写方向
+
+ {schedule.host_configured ? '主机已接线' : '主机未接线'}
+
+
+
+ - 读取源
+ -
+ {`备份执行主机 ${schedule.host_target || '(未配置)'} 本机直连 RDS`}
+ {databaseCount ? ` · 最近批次含 ${databaseCount} 个数据库` : ' · 数据库清单未从主机读到'}
+
+ - 写入方向
+ -
+ {`${schedule.host_target || '(未配置)'} 本地备份根目录`}
+ 具体根目录未由接口返回,不在页面猜测
+
+ - 执行范围
+ -
+ {databaseCount
+ ? `整批 · ${databaseCount} 个数据库(${schedule.last_run_databases.join('、')})`
+ : '整批 · 数据库清单未读到,无法列出库名'}
+
- 拨号地址
- {schedule.host_endpoint || '—'}
- - 备份脚本
- - {scriptLine}
- - 主机 cron
- -
- {schedule.host_cron_service ? `服务 ${schedule.host_cron_service}` : '—'}
- {schedule.host_checked_at
- ? ` · 状态读取于 ${formatBackupMoment(schedule.host_checked_at)}`
- : ' · 状态读取时间未知'}
-
- - 下次计划(主机读回)
- -
- {schedule.host_next_run
- ? schedule.host_next_run
- : !schedule.host_configured
- ? '未接通备份执行主机:当前计划不会执行'
- : schedule.host_schedule_enabled
- ? `已配置每日 ${schedule.host_schedule_time};尚未核验下一次实际执行(不以历史下发时间推算)`
- : '未启用定时或未从主机读到计划'}
-
- - 最近一次运行
- -
- {schedule.last_run_stamp || '—'}
- {runMoment(schedule) ? ` · ${runMoment(schedule)}` : ''}
- {schedule.last_run_stamp
- ? schedule.last_run_failed_databases.length === 0 && !schedule.last_run_error
- ? ' · 成功'
- : ' · 有失败/读取错误'
- : ''}
-
- - 最近一次成功
- - 未从主机读取(不能用最近一次运行代替成功;失败库/读取错误见下方)
- - 备份耗时 / 体积
- -
- {schedule.last_run_stamp
- ? `${schedule.last_run_duration_seconds} 秒 · ${formatBackupBytes(schedule.last_run_total_bytes)}`
- : '—'}
-
-
- - 覆盖的库
- - {schedule.last_run_databases.length ? schedule.last_run_databases.join('、') : '—'}
- - 失败的库
- -
- {schedule.last_run_failed_databases.length
- ? schedule.last_run_failed_databases.join('、')
- : schedule.last_run_stamp
- ? '无'
- : '未知(还没有读到运行记录,不能据此判断没有失败)'}
-
- - 主机上生效的计划
- -
- {schedule.host_schedule_enabled
- ? `每天 ${schedule.host_schedule_time} · 保留 ${schedule.host_keep_days} 天 · 每月 ${schedule.host_keep_months} 份`
- : schedule.host_configured
- ? '未启用定时'
+
+
+
+ POST /api/v1/backup-schedule/run 没有单库参数,一次就是该主机全部业务库的整批
+ pg_dump。用单库按钮触发会连整批一起跑,因此本页不开放单库动作;单库恢复只能用批次里该库的子目录,
+ 但子目录路径当前接口没有返回。
+
+
+
+
+
+
+
立即备份
+
+ {hasLastRun ? (runFailed ? '最近一批有失败' : '最近一批成功') : '尚无批次读数'}
+
+
+
+ {hasLastRun
+ ? `最近一批 ${schedule.last_run_stamp}${runMoment(schedule) ? ` · ${runMoment(schedule)}` : ''} · ${databaseCount} 个数据库 · ${formatBackupBytes(schedule.last_run_total_bytes)} · ${schedule.last_run_duration_seconds} 秒`
+ : '还没有从主机读到任何批次。'}
+
+ {schedule.running ? (
+
+
+ 正在备份({formatBackupMoment(schedule.running_started_at)} 开始,整批 {databaseCount || '未知'}{' '}
+ 个数据库)。 没有真实百分比接口,这里只报在途状态,完成后自动刷新。
+
+
+
+ ) : null}
+ {schedule.run_last_error && !schedule.running ? (
+ 上一次立即备份失败:{schedule.run_last_error}
+ ) : null}
+ {isAdmin ? (
+
+
+ 触发的是该主机全部业务库的整批备份,不是 scope 快照,也不是单库。
+
+ ) : (
+ 立即备份仅管理员可触发;当前为只读。
+ )}
+
+
+ item.known && item.active) ? 'storage-disk-low' : ''}`}
+ aria-labelledby="storage-disk-heading"
+ >
+
+
整盘占用与告警
+ {usage ? '已读到主机读数' : '未接线'}
+
+ {usage && disk ? (
+ <>
+
+
+
+
+ 系统其他占用 {formatGib(usage.system_other)} GiB
+
+
+
+ 备份已用 {formatGib(usage.backup)} GiB
+
+
+
+ 配额内空闲 {formatGib(usage.quota_free)} GiB
+
+
+
+ 配额外空闲 {formatGib(usage.beyond_quota_free)} GiB
+
+
+
+ 备份已用 {formatGib(usage.used_total)} / {formatGib(usage.budget)} GiB(
+ {usage.budget > 0 ? `${((100 * usage.used_total) / usage.budget).toFixed(2)}%` : '—'})· 总配额占当前整盘{' '}
+ {usage.total > 0 ? `${((100 * usage.budget) / usage.total).toFixed(2)}%` : '—'}
+
+
+ 读数采集于 {formatBackupMoment(disk.sampled_at)} · 本盘实际空闲 {formatGib(usage.free)} GiB,系统预留{' '}
+ {formatGib(disk.reserve_bytes)} GiB
+ {disk.other_volume_backup_bytes > 0
+ ? ` · 其他磁盘的历史备份占用总配额 ${formatGib(disk.other_volume_backup_bytes)} GiB`
+ : ''}
+
+ >
+ ) : (
+ <>
+
+ 未接线 · 不显示估算容量
+
+
+ {['系统其他占用', '备份已用', '配额内空闲', '配额外空闲'].map((label, index) => (
+
+
+ {label} —
+
+ ))}
+
+ 整盘总量 / 空闲 / 备份占用:未接线
+ >
+ )}
+
+ 后端目前没有「备份主机磁盘总量、空闲、备份目录占用」接口:这里保留单条整盘图的位置,
+ 不填示例容量、不用配额推算磁盘。以下四项告警按同一份真实读数判定。
+
+ {storageAlertSummary(alerts)}
+
+ {alerts.map((alert) => (
+ -
+ {alert.label}
+ {alert.known ? (alert.active ? '触发' : '正常') : '无法判定'}
+ {alert.detail}
+
+ ))}
+
+
+
+
+
+
备份策略
+ 北京时间 · 主机读回
+
+
+ {!schedule.host_configured
+ ? '主机未接线:定时计划不会执行。'
+ : !schedule.host_reachable
+ ? '主机连不上:以下"主机生效"状态未知,不能按设置推定。'
+ : schedule.host_schedule_enabled
+ ? `主机生效:每天 ${schedule.host_schedule_time} · 保留 ${schedule.host_keep_days} 天 · 每月 ${schedule.host_keep_months} 份 · ${
+ schedule.in_sync ? '与设置已一致' : '与设置不一致(待下发)'
+ }`
+ : '主机生效:定时备份已关闭(已有备份保留)'}
+ {schedule.host_next_run ? ` · 下次 ${schedule.host_next_run}` : ' · 下一次实际执行未由主机返回'}
+
+
+ 编辑草稿:{enabledDraft ? `每天 ${timeDraft || '—'} · 保留 ${daysDraft || '—'} 天` : '定时备份关闭'} ·
+ 每月归档 {monthsDraft || '—'} 份{dirty ? ' · 有未保存修改,主机仍按生效计划执行' : ' · 与已保存设置一致'}
+
+ {isAdmin ? (
+
+ ) : (
+
+ 定时备份设置仅管理员可修改;当前设置:
+ {schedule.enabled ? `每天 ${schedule.schedule_time} · 保留 ${schedule.retention_days} 天` : '未启用'}。
+
+ )}
+
+
+
+
+
备份记录
+ 接口只返回最近一批
+
+
+ 历史批次列表、每批的数据库明细与子库目录都没有接口:这里只能展示主机 MANIFEST 里的最近一批,
+ 不补造历史记录,也不从时间戳推算目录。
+
+ {hasLastRun ? (
+
+
+ {schedule.last_run_created_at || schedule.last_run_stamp}
+ {databaseCount} 个数据库 · 整批
+
+ {runFailed ? '有失败/读取错误' : '成功 · 共 ' + formatBackupBytes(schedule.last_run_total_bytes)}
+
+
+
+ 批次戳 {schedule.last_run_stamp} · 耗时 {schedule.last_run_duration_seconds} 秒 · 总占盘{' '}
+ {formatBackupBytes(schedule.last_run_total_bytes)} · 单库体积未由清单提供
+
+
+ {schedule.last_run_databases.map((name) => {
+ const failed = schedule.last_run_failed_databases.includes(name)
+ return (
+ -
+
{name}
+ {failed ? '失败' : '已写入'}
+ 子库目录与单库字节未由接口返回
+
+ )
+ })}
+
+ {schedule.last_run_failed_databases.length ? (
+ 失败库:{schedule.last_run_failed_databases.join('、')}
+ ) : null}
+
+
+ 子库路径待接口返回后才能复制;当前不拼接猜测路径。
+
+
+ 恢复验证:未接线(没有数据库备份恢复验证接口,不能把"备份成功"当成"可恢复")。
+
+
+ ) : (
+
+ {schedule.last_run_error
+ ? `最近一次结果读取失败:${schedule.last_run_error}`
+ : '还没有读到任何批次(主机未接线、连不上或尚未执行过);不能据此判断备份成功或失败。'}
+
+ )}
+
+
+
+
+
主机状态(读回)
+
+ {schedule.host_checked_at ? `读取于 ${formatBackupMoment(schedule.host_checked_at)}` : '尚未探测'}
+
+
+
+
+ - 目标主机
+ - {hostLine}
+ - 拨号地址
+ - {schedule.host_endpoint || '—'}
+ - 备份脚本
+ - {scriptLine}
+ - 主机 cron
+ - {schedule.host_cron_service ? `服务 ${schedule.host_cron_service}` : '—'}
+ - 下次计划(主机读回)
+ -
+ {schedule.host_next_run
+ ? schedule.host_next_run
+ : !schedule.host_configured
+ ? '未接通备份执行主机:当前计划不会执行'
+ : schedule.host_schedule_enabled
+ ? `已配置每日 ${schedule.host_schedule_time};尚未核验下一次实际执行(不以历史下发时间推算)`
+ : '未启用定时或未从主机读到计划'}
+
+
+
+ - 最近一次运行
+ -
+ {schedule.last_run_stamp || '—'}
+ {runMoment(schedule) ? ` · ${runMoment(schedule)}` : ''}
+ {schedule.last_run_stamp ? (runFailed ? ' · 有失败/读取错误' : ' · 成功') : ''}
+
+ - 最近一次成功
+ - 未从主机读取(不能用最近一次运行代替成功;失败库/读取错误见上)
+ - 备份耗时 / 体积
+ -
+ {schedule.last_run_stamp
+ ? `${schedule.last_run_duration_seconds} 秒 · ${formatBackupBytes(schedule.last_run_total_bytes)}`
: '—'}
-
- - 与设置是否一致
- - {schedule.in_sync ? '已一致' : '待下发'}
-
-
- {schedule.host_error ? 主机探测:{schedule.host_error}
: null}
- {schedule.last_run_error ? 最近一次结果读取:{schedule.last_run_error}
: null}
- {schedule.host_cron_lines.length ? (
-
- 主机 cron 条目:{schedule.host_cron_lines.join(' ; ')}
-
- ) : null}
- {schedule.last_applied_at ? (
-
- 最后下发:{formatBackupMoment(schedule.last_applied_at)}
- {schedule.last_applied_summary ? ` · ${schedule.last_applied_summary}` : ''}
-
- ) : null}
+
+ - 与设置是否一致
+ - {schedule.in_sync ? '已一致' : '待下发'}
+ - 最后下发
+ -
+ {schedule.last_applied_at
+ ? `${formatBackupMoment(schedule.last_applied_at)}${schedule.last_applied_summary ? ` · ${schedule.last_applied_summary}` : ''}`
+ : '—'}
+
+
+
+ {schedule.host_error ? 主机探测:{schedule.host_error}
: null}
+ {schedule.last_run_error ? 最近一次结果读取:{schedule.last_run_error}
: null}
+ {schedule.host_cron_lines.length ? (
+
+ 主机 cron 条目:{schedule.host_cron_lines.join(' ; ')}
+
+ ) : null}
+
+
留档分层:PG 行级留档(发布前,含 ES 文档)+ ES 快照仓 + OSS 版本控制 + 本节的整库逻辑备份 + RDS
托管备份(控制台配置)。详见 docs/PRODUCTION_BACKUP_RECOVERY.md。
- {isAdmin ? (
-
-
-
-
-
- {!valid ? (
-
定时时间需为 HH:MM(00:00~23:59),储存天数 1~365,每月归档 0~24。
- ) : null}
-
-
-
-
- 「立即备份一次」执行的是主机上的整库逻辑备份(该主机上全部业务库的 pg_dump 目录),
- 不是本次对内/对外 scope 的整库快照;scope 快照在「发布管理 → 整库版本」里封存。
-
- {message ? (
-
- {message}
-
- ) : null}
- {schedule.running ? (
-
正在备份({formatBackupMoment(schedule.running_started_at)} 开始),完成后自动刷新。
- ) : null}
- {schedule.run_last_error && !schedule.running ? (
-
上一次立即备份失败:{schedule.run_last_error}
- ) : null}
-
- ) : (
-
- 定时备份设置仅管理员可修改;当前设置:
- {schedule.enabled ? `每天 ${schedule.schedule_time} · 保留 ${schedule.retention_days} 天` : '未启用'}。
-
- )}
)
}
@@ -399,7 +854,7 @@ export function BackupScheduleSection() {
const start = await runBackupNow()
setMessage(
start.started
- ? '已在目标主机上开始备份(整库 pg_dump,约 30~60 秒),下方会自动刷新结果。'
+ ? '已在目标主机上开始整批备份(全部业务库 pg_dump,约 30~60 秒),下方会自动刷新结果。'
: '已有一个备份任务在执行中。'
)
adopt(await fetchBackupScheduleHost())
@@ -449,6 +904,7 @@ export function BackupScheduleSection() {
onApply={() => void apply()}
onRunNow={() => void runNow()}
onReload={() => void load()}
+ // disk 不传:后端还没有磁盘读数接口,磁盘区显示"未接线",绝不填示例容量。
/>
)
}
diff --git a/web/src/LibraryStorageSection.tsx b/web/src/LibraryStorageSection.tsx
index ef340e2..ab4d59f 100644
--- a/web/src/LibraryStorageSection.tsx
+++ b/web/src/LibraryStorageSection.tsx
@@ -31,8 +31,11 @@ export function LibraryStorageSection() {
return (
- 版本快照与归档占用
- 只读口径:被版本引用的去重内容、blob 文件表观/实际分配字节、未被引用对象、清单文件。
+ 归档占用(版本快照,不是数据库备份)
+
+ 只读口径:被版本引用的去重内容、blob 文件表观/实际分配字节、未被引用对象、清单文件。
+ 这些归档文件与上面的整库数据库备份分开计量,不能相加。
+
{loading ? 读取中…
: null}
{error ? (
diff --git a/web/src/SystemSettings.tsx b/web/src/SystemSettings.tsx
index e61a57d..5773092 100644
--- a/web/src/SystemSettings.tsx
+++ b/web/src/SystemSettings.tsx
@@ -244,8 +244,8 @@ export function SystemSettingsView({
) : null}
{section === 'storage' ? (
<>
-
+
>
) : null}
{section === 'members' && identity?.role === 'admin' ? : null}
diff --git a/web/src/storageBackup.css b/web/src/storageBackup.css
new file mode 100644
index 0000000..354d3f2
--- /dev/null
+++ b/web/src/storageBackup.css
@@ -0,0 +1,353 @@
+/* 「系统设置 → 存储与备份」:数据库整库逻辑备份。
+ 原型里的单条整盘图与告警在这里保留位置;真实读数未接线时用虚底而不是假容量。 */
+.storage-settings-panel {
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+}
+.storage-settings-panel .settings-section-heading p {
+ margin: 0;
+ max-width: 78ch;
+ color: var(--ink-mute, #64748b);
+ font-size: 11px;
+ line-height: 1.7;
+}
+/* 主机读回用两栏事实表;窄列时自动落成一栏,避免 dd 把 dt 挤成竖排。 */
+.settings-panel .storage-settings-grid {
+ grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
+}
+.settings-panel .storage-settings-grid > dl {
+ grid-template-columns: minmax(104px, max-content) minmax(0, 1fr);
+}
+.storage-settings-panel code {
+ overflow-wrap: anywhere;
+}
+.storage-block {
+ border-top: 1px solid var(--border-base, #e2e8f0);
+ padding-top: 12px;
+}
+.storage-block-heading {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px 14px;
+ flex-wrap: wrap;
+ margin-bottom: 6px;
+}
+.storage-block-heading h3 {
+ margin: 0;
+ font-size: 13px;
+ color: var(--ink-base);
+}
+.storage-chip {
+ border-radius: 999px;
+ padding: 2px 9px;
+ font-size: 10px;
+ border: 1px solid var(--border-base, #e2e8f0);
+ color: var(--ink-mute, #64748b);
+}
+.storage-chip.ok {
+ color: #17695a;
+ border-color: #a9d5c8;
+ background: #effaf5;
+}
+.storage-chip.warn {
+ color: #985d10;
+ border-color: #f0d3a4;
+ background: #fff8ec;
+}
+.storage-chip.off {
+ color: var(--ink-mute, #64748b);
+ background: var(--bg-soft, #f6f8fa);
+}
+.settings-panel .storage-facts {
+ display: grid;
+ grid-template-columns: minmax(96px, max-content) minmax(0, 1fr);
+ gap: 5px 14px;
+ margin: 6px 0;
+ font-size: 11px;
+ color: var(--ink-mute, #64748b);
+}
+.settings-panel .storage-facts dd {
+ margin: 0;
+ color: var(--ink-base);
+ overflow-wrap: anywhere;
+}
+.storage-inline-note {
+ display: block;
+ color: var(--ink-mute, #64748b);
+ font-size: 10px;
+}
+.storage-block-actions {
+ display: flex;
+ align-items: center;
+ gap: 8px 12px;
+ flex-wrap: wrap;
+ margin: 7px 0;
+}
+.storage-block-actions .hint {
+ max-width: 72ch;
+}
+.storage-block-actions button {
+ font: inherit;
+ font-size: 11px;
+ padding: 5px 11px;
+ border-radius: 6px;
+ border: 1px solid var(--border-base, #cbd5e1);
+ background: var(--bg-panel, #fff);
+ color: inherit;
+ cursor: pointer;
+}
+.storage-block-actions button:disabled {
+ opacity: 0.55;
+ cursor: default;
+}
+.storage-block-actions button.primary {
+ background: #185f78;
+ border-color: #185f78;
+ color: #fff;
+}
+.storage-progress {
+ margin: 6px 0;
+}
+.storage-running {
+ margin: 0 0 5px;
+ font-size: 11px;
+ color: var(--ink-base);
+}
+.storage-progress-bar {
+ width: 100%;
+ height: 10px;
+}
+.storage-disk-track {
+ display: flex;
+ height: 22px;
+ margin: 8px 0;
+ border-radius: 5px;
+ overflow: hidden;
+ background: #e4e9ef;
+ outline: 1px solid #aab9c1;
+}
+.storage-disk-other {
+ background: #77889a;
+}
+.storage-disk-zone {
+ display: flex;
+ background: #c0dfed;
+ box-shadow: inset 0 0 0 1px #6191a8;
+}
+.storage-disk-used {
+ background: #19698c;
+}
+.storage-disk-blank {
+ background: #e4e9ef;
+}
+.storage-disk-track-unknown {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: repeating-linear-gradient(45deg, #eef2f5 0 6px, #e1e7eb 6px 12px);
+ border: 1px dashed #aab9c1;
+ outline: none;
+ color: #576674;
+ font-size: 10px;
+}
+.storage-disk-low .storage-disk-other {
+ background: #9d625d;
+}
+.storage-disk-low .storage-disk-used {
+ background: #be6c10;
+}
+.storage-disk-low .storage-disk-zone {
+ background: #ffe0a8;
+}
+.storage-disk-legend {
+ display: flex;
+ gap: 6px 16px;
+ flex-wrap: wrap;
+ font-size: 10px;
+ color: #3f5566;
+}
+.storage-dot {
+ display: inline-block;
+ width: 10px;
+ height: 10px;
+ margin-right: 4px;
+ border-radius: 2px;
+ vertical-align: -1px;
+}
+.storage-dot.other {
+ background: #77889a;
+}
+.storage-dot.used {
+ background: #19698c;
+}
+.storage-dot.zone {
+ background: #c0dfed;
+}
+.storage-dot.blank {
+ background: #e4e9ef;
+ outline: 1px solid #c4ced6;
+}
+.storage-metric {
+ margin: 6px 0 2px;
+ font-size: 11px;
+ font-weight: 600;
+}
+.storage-alert-summary {
+ margin: 8px 0 0;
+ font-size: 11px;
+ font-weight: 600;
+ color: #3f5566;
+}
+.storage-alerts {
+ list-style: none;
+ margin: 8px 0 0;
+ padding: 0;
+ display: grid;
+ gap: 5px;
+}
+.storage-alerts li {
+ display: grid;
+ grid-template-columns: max-content max-content minmax(0, 1fr);
+ gap: 4px 10px;
+ align-items: baseline;
+ font-size: 10px;
+ padding: 4px 8px;
+ border-radius: 6px;
+ background: var(--bg-soft, #f6f8fa);
+}
+.storage-alerts li strong {
+ font-size: 11px;
+}
+.storage-alerts li small {
+ color: var(--ink-mute, #64748b);
+ overflow-wrap: anywhere;
+}
+.storage-alerts .alert-on {
+ background: #fff1ec;
+ color: #a03a1e;
+}
+.storage-alerts .alert-ok {
+ background: #f0faf6;
+ color: #17695a;
+}
+.storage-alerts .alert-unknown {
+ background: #f8f5ee;
+ color: #715c2c;
+}
+.storage-plan {
+ margin: 4px 0;
+ font-size: 11px;
+ color: #3f5566;
+}
+.storage-policy-editor {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ margin-top: 6px;
+}
+.storage-policy-editor > label {
+ display: grid;
+ gap: 3px;
+ font-size: 10px;
+ color: var(--ink-mute, #64748b);
+}
+.storage-policy-editor input[type='text'],
+.storage-policy-editor input[type='time'],
+.storage-policy-editor input[type='number'] {
+ width: 100%;
+ max-width: 320px;
+ font: inherit;
+ font-size: 11px;
+ padding: 5px 8px;
+ border-radius: 5px;
+ border: 1px solid var(--border-base, #cbd5e1);
+ background: var(--bg-panel, #fff);
+ color: inherit;
+}
+.storage-policy-editor input:disabled {
+ background: var(--bg-soft, #f1f4f6);
+ color: var(--ink-mute, #64748b);
+}
+.storage-checkbox {
+ display: flex !important;
+ align-items: center;
+ gap: 6px;
+ font-size: 11px !important;
+ color: var(--ink-base) !important;
+}
+.storage-policy-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
+ gap: 8px 12px;
+}
+.storage-policy-grid label {
+ display: grid;
+ gap: 3px;
+ font-size: 10px;
+ color: var(--ink-mute, #64748b);
+}
+.storage-policy-grid input {
+ width: 100%;
+}
+.storage-batch {
+ border: 1px solid var(--border-base, #e2e8f0);
+ border-radius: 8px;
+ padding: 8px 10px;
+ font-size: 11px;
+}
+.storage-batch summary {
+ display: flex;
+ gap: 6px 14px;
+ flex-wrap: wrap;
+ align-items: baseline;
+ cursor: pointer;
+}
+.storage-batch summary strong.ok {
+ color: #17695a;
+}
+.storage-batch summary strong.off {
+ color: #a03a1e;
+}
+.storage-batch p {
+ margin: 6px 0;
+ color: #3f5566;
+}
+.storage-sublibraries {
+ list-style: none;
+ margin: 6px 0;
+ padding: 0;
+ display: grid;
+ gap: 4px;
+}
+.storage-sublibraries li {
+ display: grid;
+ grid-template-columns: minmax(120px, max-content) max-content minmax(0, 1fr);
+ gap: 4px 10px;
+ align-items: baseline;
+ padding: 3px 6px;
+ border-radius: 5px;
+ background: var(--bg-soft, #f6f8fa);
+}
+.storage-sublibraries .ok {
+ color: #17695a;
+}
+.storage-sublibraries .off {
+ color: #a03a1e;
+}
+.storage-sublibraries small {
+ color: var(--ink-mute, #64748b);
+}
+.storage-verify {
+ margin: 6px 0 0;
+ color: #715c2c;
+ font-size: 10px;
+}
+@media (max-width: 700px) {
+ .storage-facts,
+ .storage-sublibraries li,
+ .storage-alerts li {
+ grid-template-columns: minmax(0, 1fr);
+ }
+}