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
+32
View File
@@ -0,0 +1,32 @@
package nfs
import (
"crypto/rand"
"encoding/binary"
"fmt"
)
func generateRandomFSID() (uint32, error) {
var b [4]byte
if _, err := rand.Read(b[:]); err != nil {
return 0, fmt.Errorf("crypto/rand read: %w", err)
}
n := binary.BigEndian.Uint32(b[:])
if n == 0 {
n = 1
}
return n, nil
}
func UniqueFSID(used map[uint32]struct{}) (uint32, error) {
for i := 0; i < 64; i++ {
n, err := generateRandomFSID()
if err != nil {
return 0, err
}
if _, dup := used[n]; !dup {
return n, nil
}
}
return 0, fmt.Errorf("fsid space exhausted after 64 attempts")
}