feat: add storage info to settings page and improve NFS export handling

Backend:
- Add source/used_by/available/error fields to diskUsage in system status
- collectDiskUsage() now reads /proc/mounts, samba shares and NFS exports from DB
- Paths are deduplicated; shared paths list all shares/exports using them
- syscall.Statfs errors surface as available=false with user-facing error
- collectServiceStatus made a method of Server (receiver consistency)

Frontend:
- Settings page now shows two cards: mount points and shared resources
- Each path shows source badge (Sistema/Mount/SMB/NFS), used_by chips, progress bar
- Unavailable paths show amber warning instead of progress bar
- DiskUsage interface updated with new fields
- NFSExport interface updated with structured fields (fsid, async, etc)
- NFS page updated to use new export fields
This commit is contained in:
2026-07-05 22:56:39 -04:00
parent 72a8336087
commit 65cd753818
14 changed files with 696 additions and 100 deletions
+23 -3
View File
@@ -61,10 +61,30 @@ func (d *DB) ReplaceNFSExports(exports []NFSExport) error {
if err != nil {
return err
}
readOnly := 0
if exp.ReadOnly {
readOnly = 1
}
async_ := 0
if exp.Async {
async_ = 1
}
rootSquash := 0
if exp.RootSquash {
rootSquash = 1
}
subtreeCheck := 0
if exp.SubtreeCheck {
subtreeCheck = 1
}
advanced := exp.Advanced
if advanced == "" {
advanced = "{}"
}
_, err = tx.Exec(`
INSERT INTO nfs_exports (path, clients, options)
VALUES (?, ?, ?)`,
exp.Path, clients, exp.Options,
INSERT INTO nfs_exports (path, clients, read_only, async_, root_squash, subtree_check, fsid, advanced)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
exp.Path, clients, readOnly, async_, rootSquash, subtreeCheck, exp.FSID, advanced,
)
if err != nil {
return fmt.Errorf("insert nfs export %s: %w", exp.Path, err)