ZMB Webui: Complete Project – Rebrand & Initial Clean Commit
ARCHITECTURE ============ Backend: FastAPI + uvicorn (port 8000) - JWT authentication with PAM system users - ZFS CLI wrapper with caching (30-60s TTL) - WebSocket pool status broadcaster (30s interval) - Services: auth, zfs_runner, file_manager, shares, identities, system_info - Routers: pools, datasets, snapshots, shares, identities, navigator, system Frontend: Next.js 15 + TypeScript (static export) - Incremental Static Regeneration (ISR) for weak hardware - Type-safe API client (lib/api.ts) - Dark mode + custom Tailwind theme - Pages: Dashboard, Login, Snapshots, Datasets, Shares, etc. DEPLOYMENT ========== Test Target: 192.168.1.179:8090 (Debian LXC) Production: 10.66.120.3:9090 (Raspberry Pi 4GB ARM64) Updater: Automated Gitea-based deployment (update-test.sh, update-pi.sh) FEATURES COMPLETED ================== Phase 3a: Dashboard Quick Stats (System, CPU, Memory, Storage) - Real-time stats with color-coded progress bars - Responsive grid layout (mobile: 1, tablet: 2, desktop: 4 columns) - ISR-optimized for fast loads on weak hardware REBRANDING ========== Renamed throughout: - Project: 'ZFS Manager' → 'ZMB Webui' - Services: 'zfs-manager' → 'zmb-webui' - Systemd units: zfs-manager-backend → zmb-webui-backend - Configuration files and documentation Co-Authored-By: Patrick <patrick@perlbach24.de>
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class PoolHealth(str, Enum):
|
||||
ONLINE = "ONLINE"
|
||||
DEGRADED = "DEGRADED"
|
||||
FAULTED = "FAULTED"
|
||||
OFFLINE = "OFFLINE"
|
||||
UNAVAIL = "UNAVAIL"
|
||||
|
||||
|
||||
class Vdev(BaseModel):
|
||||
name: str
|
||||
state: str
|
||||
read: int = 0 # Read error count
|
||||
write: int = 0 # Write error count
|
||||
cksum: int = 0 # Checksum error count
|
||||
children: List["Vdev"] = []
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"name": "mirror-0",
|
||||
"state": "ONLINE",
|
||||
"read": 0,
|
||||
"write": 0,
|
||||
"cksum": 0,
|
||||
"children": [
|
||||
{"name": "sda", "state": "ONLINE", "read": 0, "write": 0, "cksum": 0},
|
||||
{"name": "sdb", "state": "ONLINE", "read": 0, "write": 0, "cksum": 0}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Update forward reference for recursive type
|
||||
Vdev.model_rebuild()
|
||||
|
||||
|
||||
class Pool(BaseModel):
|
||||
name: str
|
||||
size: int # bytes
|
||||
alloc: int # bytes
|
||||
free: int # bytes
|
||||
fragmentation: str # percentage
|
||||
capacity: str # percentage
|
||||
health: PoolHealth
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"name": "tank",
|
||||
"size": 3865470976,
|
||||
"alloc": 2040109465,
|
||||
"free": 1825361511,
|
||||
"fragmentation": "0%",
|
||||
"capacity": "52%",
|
||||
"health": "ONLINE"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PoolStatus(BaseModel):
|
||||
name: str
|
||||
state: Optional[str] = None
|
||||
health: PoolHealth
|
||||
scan: Optional[str] = None
|
||||
errors: Optional[str] = None
|
||||
last_scrub: Optional[str] = None
|
||||
vdevs: List[Vdev] = []
|
||||
|
||||
class Config:
|
||||
json_schema_extra = {
|
||||
"example": {
|
||||
"name": "tank",
|
||||
"state": "ONLINE",
|
||||
"health": "ONLINE",
|
||||
"scan": "scrub in progress since Sat Apr 14 10:30:00 2026",
|
||||
"errors": "No known data errors",
|
||||
"vdevs": [
|
||||
{
|
||||
"name": "mirror-0",
|
||||
"state": "ONLINE",
|
||||
"read": 0,
|
||||
"write": 0,
|
||||
"cksum": 0,
|
||||
"children": [
|
||||
{"name": "sda", "state": "ONLINE", "read": 0, "write": 0, "cksum": 0},
|
||||
{"name": "sdb", "state": "ONLINE", "read": 0, "write": 0, "cksum": 0}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user