Files
homelable/backend/app/schemas/nodes.py
T
Pouzor 38c5bcb606 feat: configurable bottom handles, scanner rewrite, UI polish
## New features
- Configurable bottom connection points per node (1–4 handles)
- Fit view on load
- LiveView improvements
- Node modal: inline Type/Icon picker, default icon in trigger
- Remove redundant Save button from ScanConfigModal

## Scanner fixes
- Phase 1: replace nmap ARP sweep with concurrent asyncio ping sweep
  (50 parallel pings, 1s timeout). Zero false positives, works in any
  Docker network mode. Supplements with /proc/net/arp for ICMP-blocked devices.
- Phase 2: explicit -sS (root) / -sT (non-root) scan type; bump
  host-timeout to 60s; gather(return_exceptions=True) so one failing
  host doesn't abort the batch
- Fix 404 on missing device in hide/ignore
- Validate CIDR ranges to prevent nmap injection
- Thread-safe cancel set, pre-fetch canvas/hidden IPs (no N+1 queries)
- Logging: attach StreamHandler to root logger so app.* logs are visible

## Tests
- 21 backend scanner tests (ping sweep, ARP cache, Phase 2 tolerance)
- Full NodeModal coverage (53 tests)
- LiveView, store, edge label tests
2026-04-04 23:15:47 +02:00

75 lines
1.9 KiB
Python

from datetime import datetime
from typing import Any
from pydantic import BaseModel
class NodeBase(BaseModel):
type: str
label: str
hostname: str | None = None
ip: str | None = None
mac: str | None = None
os: str | None = None
status: str = "unknown"
check_method: str | None = None
check_target: str | None = None
services: list[Any] = []
notes: str | None = None
pos_x: float = 0
pos_y: float = 0
parent_id: str | None = None
container_mode: bool = False
custom_colors: dict[str, Any] | None = None
custom_icon: str | None = None
cpu_count: int | None = None
cpu_model: str | None = None
ram_gb: float | None = None
disk_gb: float | None = None
show_hardware: bool = False
width: float | None = None
height: float | None = None
bottom_handles: int = 1
class NodeCreate(NodeBase):
pass
class NodeUpdate(BaseModel):
type: str | None = None
label: str | None = None
hostname: str | None = None
ip: str | None = None
mac: str | None = None
os: str | None = None
status: str | None = None
check_method: str | None = None
check_target: str | None = None
services: list[Any] | None = None
notes: str | None = None
pos_x: float | None = None
pos_y: float | None = None
parent_id: str | None = None
container_mode: bool | None = None
custom_colors: dict[str, Any] | None = None
custom_icon: str | None = None
cpu_count: int | None = None
cpu_model: str | None = None
ram_gb: float | None = None
disk_gb: float | None = None
show_hardware: bool | None = None
width: float | None = None
height: float | None = None
bottom_handles: int | None = None
class NodeResponse(NodeBase):
id: str
last_seen: datetime | None = None
response_time_ms: int | None = None
created_at: datetime
updated_at: datetime
model_config = {"from_attributes": True}