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:
Claude Code
2026-04-22 00:26:23 +02:00
committed by Patrick
commit 92bed208e0
108 changed files with 29925 additions and 0 deletions
+207
View File
@@ -0,0 +1,207 @@
# Testing Plan ZMB Webui auf 192.168.1.179
**Date**: 2026-04-18
**Target**: Test-LXC Container at 192.168.1.179
**Backend**: Should be running on :8000
**Frontend**: Will test via npm dev or static export
---
## Pre-Test Checklist
- [ ] Backend still running? `curl http://192.168.1.179:8000/health`
- [ ] SSH access available? `ssh root@192.168.1.179`
---
## Test Scenario 1: Frontend Dev Server (Slow, Good for Debugging)
```bash
# On your local machine
cd frontend
npm install # If not done
npm run dev # Starts on http://localhost:3000
# Visit http://localhost:3000
# Browser will call API at: http://192.168.1.179:8000 (via .env.local)
```
**Test Flow**:
1. Go to `/login` → Enter `admin / <password>`
2. Dashboard → Should show pools (or empty if no ZFS)
3. **Check menu**: Snapshots + Datasets visible? (Only if ZFS available)
4. Click each page to verify it loads
---
## Test Scenario 2: Static Export (Faster, Production-like)
```bash
# On local machine
cd frontend
npm run build
npm run export # Creates ./out/ with static HTML
# Copy to test-container
scp -r out/* root@192.168.1.179:/opt/zmb-webui/backend/static/
# Or just test locally with nginx
python3 -m http.server 3000 --directory out/
# Visit http://localhost:3000
```
---
## Test Checklist All Pages
### Login Page
- [ ] Username/password input visible
- [ ] Login button works
- [ ] After login → redirects to Dashboard
- [ ] Token saved in localStorage
### Dashboard
- [ ] Header loads with logo
- [ ] Pool cards visible (if ZFS on container)
- [ ] Capacity bar shows
- [ ] Auto-refresh every 30s (check network tab)
- [ ] Health badge color correct (ONLINE green, DEGRADED yellow, etc.)
### Menu Visibility (ZFS-Conditional)
```
✅ Always visible:
- Dashboard
- Files
- Identities
❓ Conditional (only if ZFS available on container):
- Snapshots
- Datasets
```
- [ ] Check browser console for `/api/status` call
- [ ] Verify `zfs_available: true/false` response
### Snapshots Page
- [ ] Page loads (if ZFS available)
- [ ] Table shows header: Name, Dataset, Created, Used
- [ ] Refresh button works
- [ ] Delete button triggers dialog
### Datasets Page
- [ ] Tab navigation works (Datasets ↔ Shares)
- [ ] Datasets tab: List visible, Create button clickable
- [ ] Shares tab: Samba + NFS subtabs work
- [ ] Create dialogs open/close properly
### Files Page
- [ ] Loads and shows current directory
- [ ] Breadcrumb navigation works
- [ ] Can navigate up and into directories
- [ ] Upload button works (try small file)
- [ ] Create Folder dialog works
- [ ] View toggle (List ↔ Grid) works
- [ ] Search box works
- [ ] File selection and multi-select works
- [ ] Delete dialog confirms action
### Identities Page
- [ ] Users tab shows Linux users table
- [ ] Samba subtab shows or empty message
- [ ] Groups tab lists groups
- [ ] Login History shows recent logins
- [ ] Create User dialog fields present
- [ ] Create Group dialog present
---
## API Endpoint Tests (curl)
```bash
# Get token
TOKEN=$(curl -s -X POST http://192.168.1.179:8000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"<password>"}' | jq -r '.access_token')
echo "Token: $TOKEN"
# Check ZFS availability
curl -s http://192.168.1.179:8000/api/status | jq .
# List pools (should work even on container with no ZFS)
curl -s http://192.168.1.179:8000/api/pools \
-H "Authorization: Bearer $TOKEN" | jq .
# List users
curl -s http://192.168.1.179:8000/api/identities/users \
-H "Authorization: Bearer $TOKEN" | jq .
# List datasets (may fail if no ZFS)
curl -s http://192.168.1.179:8000/api/datasets \
-H "Authorization: Bearer $TOKEN" | jq .
# List shares
curl -s http://192.168.1.179:8000/api/shares/samba \
-H "Authorization: Bearer $TOKEN" | jq .
```
---
## Common Issues & Debugging
### "Cannot GET /" or 404
- Backend might not be serving static files
- Check: `ls -la /opt/zmb-webui/backend/static/`
- If empty, need to do `npm run export` and `scp`
### CORS errors in browser console
- Backend allow_origins set to `["*"]` — should work
- Check backend logs: `journalctl -u zmb-webui-backend -f`
### API call fails with 401
- Token expired or invalid
- Logout (clear localStorage) → Login again
- Check token in localStorage: `localStorage.getItem('access_token')`
### Snapshots/Datasets menu hidden
- `/api/status` returned `zfs_available: false`
- This is expected on container without ZFS
- Test on actual Pi if need to test ZFS features
### Files not uploading
- Check file size (< some limit?)
- Check `/tank/share` exists and is writable
- Check backend logs for upload errors
---
## Success Criteria
- [ ] All pages load without errors
- [ ] Navigation menu works
- [ ] Login/logout works
- [ ] ZFS-conditional menu works (menu items hide/show correctly)
- [ ] File manager can browse and upload
- [ ] No console errors (check F12)
- [ ] No 401/403 errors
- [ ] All dialogs open/close properly
---
## After Testing
If all ✅:
```bash
# Build final static export
cd frontend
npm run build
npm run export
# Deploy to Pi
scp -r out/* root@10.66.120.3:/opt/zmb-webui/backend/static/
```
If issues ❌:
- Document error messages
- Check browser console (F12 → Console tab)
- Run curl tests to isolate backend vs frontend
- Check backend logs on container