feat(networks): add name field to networks

- Migration 0007: ALTER TABLE networks ADD COLUMN name TEXT NOT NULL DEFAULT ''
- Network model, repository, and API updated to include name
- Networks page: name input in the add form, Name column as first column in table
- Delete modal now shows "Name (CIDR)" for clarity
- Hosts page: network dropdowns now show network name instead of CIDR
- Seeds updated with names (LAN, DMZ, Corporate, VPN)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-16 01:38:40 +02:00
parent e17b8ee722
commit d9ee121fbb
9 changed files with 55 additions and 78 deletions

View File

@@ -6,12 +6,11 @@
-- Load with: cargo run --features ssr --bin seed
-- ── Networks ──────────────────────────────────────────────────────────────────
-- INSERT OR IGNORE relies on the UNIQUE constraint on cidr.
INSERT OR IGNORE INTO networks (cidr) VALUES ('192.168.1.0/24');
INSERT OR IGNORE INTO networks (cidr) VALUES ('192.168.10.0/24');
INSERT OR IGNORE INTO networks (cidr) VALUES ('10.0.0.0/8');
INSERT OR IGNORE INTO networks (cidr) VALUES ('172.16.0.0/16');
INSERT OR IGNORE INTO networks (name, cidr) VALUES ('LAN', '192.168.1.0/24');
INSERT OR IGNORE INTO networks (name, cidr) VALUES ('DMZ', '192.168.10.0/24');
INSERT OR IGNORE INTO networks (name, cidr) VALUES ('Corporate', '10.0.0.0/8');
INSERT OR IGNORE INTO networks (name, cidr) VALUES ('VPN', '172.16.0.0/16');
-- ── Hosts ─────────────────────────────────────────────────────────────────────
-- Hosts have no UNIQUE constraint, so we guard each insert with WHERE NOT EXISTS.