feat: convert to api and rewrite ui

This commit is contained in:
2026-05-23 18:05:51 +00:00
parent e1dd5d1003
commit 31e417b9f5
112 changed files with 6585 additions and 8492 deletions
+22 -11
View File
@@ -17,6 +17,7 @@ This document lists breaking changes when upgrading from IPAM v1.x to v2.0.
| Help page | `/help` | Removed |
| Interactive API docs | `/api-docs` web page | Removed — see [API.md](API.md) |
| Custom field “searchable” flag | UI checkbox + DB column | Removed — was never wired to search |
| Device types | Device type CRUD, `device_type_id` on devices, rack placement filters | Removed — devices are untyped; use tags or custom fields instead |
### Dependencies removed
@@ -37,27 +38,33 @@ This document lists breaking changes when upgrading from IPAM v1.x to v2.0.
| GET | `/custom_fields/<entity_type>` | Duplicate of API; use `/api/v1/custom_fields/{entity_type}` |
| GET | `/api/device/<id>/ip_history` | Moved — see below |
| GET | `/api/ip/<ip>/history` | Moved — see below |
| GET/POST/PUT/DELETE | `/api/v1/device-types`, `/api/v2/device-types` | Device types removed |
---
## API changes
### v2 is API-only + Vue SPA
v2 removes **all Jinja/HTML routes**. The UI is a Vue 3 SPA served from `static/dist/`. All functionality goes through `/api/v2/*`.
| v1 | v2 |
|----|-----|
| `/api/v1/*` | **`/api/v2/*`** (v1 removed) |
| Session via HTML login forms | `POST /api/v2/auth/login` + session cookie |
| API key only on API routes | **Same routes** accept session cookie **or** API key |
| `{ "devices": [...] }` list responses | **`{ "items": [...] }`** for list endpoints (where normalized) |
### Version
`GET /api/v1/info` now reports `"api_version": "2.0"`.
`GET /api/v2/info` reports `"api_version": "2.0"`.
### IP history endpoints
| v1 (removed) | v2 replacement | Auth |
|--------------|----------------|------|
| `GET /api/device/<id>/ip_history` | `GET /api/v1/devices/<id>/ip_history` | API key (`X-API-Key` or `Authorization: Bearer`) |
| `GET /api/ip/<ip>/history` | `GET /api/v1/ips/<ip>/history` | API key |
The **subnet page UI** uses a session-authenticated web route instead of the old unversioned API paths:
- `GET /ip/<ip>/history` — requires login + `view_subnet` permission
Update any scripts that called the old `/api/device/...` or `/api/ip/...` paths to use the v1 API routes above with an API key.
| `GET /api/device/<id>/ip_history` | `GET /api/v2/devices/<id>/ip-history` | Session or API key |
| `GET /api/ip/<ip>/history` | `GET /api/v2/ips/<ip>/history` | Session or API key |
### Audit logging for API calls
@@ -74,14 +81,17 @@ On startup, v2 runs these migrations against existing databases:
1. **Drop `FeatureFlags` table** — feature flags removed
2. **Drop `CustomFieldDefinition.searchable` column** — if present
3. **Remove orphaned permission `view_help`** — help page removed
4. **Drop `Device.device_type_id` column and `DeviceType` table** — device types removed
5. **Remove device-type permissions**`view_device_types`, `add_device_type`, etc.
No data loss for core IPAM entities (subnets, IPs, devices, racks, tags, users, audit log).
No data loss for core IPAM entities (subnets, IPs, devices, racks, tags, users, audit log). Device type labels are not migrated; use tags or custom fields if you need classification.
---
## Permissions & sessions
- **`view_help`** permission is removed from the database on upgrade.
- **Device-type permissions** (`view_device_types`, `add_device_type`, etc.) are removed on upgrade.
- Feature-flag toggles no longer hide UI; use **roles and permissions** instead.
- Permissions are **cached in the session at login**. If an admin changes a user's role, that user must **log out and back in** for permission changes to take effect.
@@ -100,7 +110,8 @@ Docker images no longer need a `/backups` volume mount for in-app backup (remove
| v1 | v2 |
|----|----|
| `app.py` + `routes.py` + `cache.py` + `totp_utils.py` | Single `app.py` + `db.py` |
| `templates/api_docs.html`, `templates/backup.html`, `templates/help.html` | Deleted |
| `templates/`, legacy `static/js` | **Deleted** — replaced by `frontend/``static/dist/` |
| Server-rendered Tailwind | Vue 3 + Vite + Tailwind (auto light/dark, cyan accents) |
---