- Vite + React frontend with dark-themed dashboard, slot grid per enclosure, and SMART detail overlay - ZFS pool membership via zpool status -P - Multi-stage Dockerfile (Node build + Python runtime) - Updated docker-compose with network_mode host and healthcheck
25 lines
730 B
Python
25 lines
730 B
Python
from fastapi import APIRouter, HTTPException
|
|
|
|
from models.schemas import DriveDetail
|
|
from services.smart import get_smart_data
|
|
from services.zfs import get_zfs_pool_map
|
|
|
|
router = APIRouter(prefix="/api/drives", tags=["drives"])
|
|
|
|
|
|
@router.get("/{device}", response_model=DriveDetail)
|
|
async def get_drive_detail(device: str):
|
|
"""Get SMART detail for a specific block device."""
|
|
try:
|
|
data = await get_smart_data(device)
|
|
except ValueError as e:
|
|
raise HTTPException(status_code=400, detail=str(e))
|
|
|
|
if "error" in data:
|
|
raise HTTPException(status_code=502, detail=data["error"])
|
|
|
|
pool_map = await get_zfs_pool_map()
|
|
data["zfs_pool"] = pool_map.get(device)
|
|
|
|
return DriveDetail(**data)
|