1f6217d347
Portal: - Replace is_admin boolean with role column (admin/advanced/standard) - Settings UI: 3-tier portal role select + per-app role dropdowns - /portal-return endpoint: re-establishes session from JWT for sub-app back-links - /api/internal/nv-users: internal endpoint for NetworkView user sync - portal/migrate_roles.py: one-time DB migration script - Role badges (admin/advanced/standard) in topbar and settings table DigiServer: - Add editor and viewer roles (portal advanced->editor, standard->viewer) - PlaylistPermission model: grant viewer users edit access to specific playlists - app/utils/access.py: shared editor_required, admin_required, can_edit_playlist helpers - Content routes: editor_required on create/delete, per-playlist permission check on mutations - Admin: playlist_permissions route + template to manage viewer playlist grants - Base template: hide Admin nav for viewers, Portal button (⬡) returns to portal - content_list_new: hide create/delete for viewers; Manage vs View button per permission - manage_playlist_content: view-only mode when user lacks edit permission NetworkView: - backend/src/middleware/rbac.js: requireRole + requireWriteAccess helpers - site_permissions table: one site per advanced user - All mutating routes guarded (admin=all, advanced=assigned site, viewer=read-only) - Portal SSO auto-upsert: user row synced from X-Auth-Role on every request - GET /api/users: merges portal users list with local NV data (all 4 portal users visible) - GET/PUT /api/users/:id/site-permission: assign site to advanced user - Settings Users tab: role badges, site dropdown for advanced, (portal only) indicator - Sidebar: ⬡ Portal button between Settings and Logout - Frontend build: VITE_API_BASE=/networkview/api now set in start-dev.sh IT Assets / Server Monitor: - portal_sso.py updated: map advanced->editor/viewer, standard->readonly - AdminUser model: add editor role + is_editor property
NetworkView
A powerful, dark-themed network & homelab documentation application. Document sites, server rooms, racks and every device inside them — with a visual rack diagram, Markdown notes, port/connection tracking and full-text search.
Features
- Visual Rack Diagram — graphical U-by-U rack view with color-coded device types. Click any empty slot to add a device there.
- Hierarchical Structure — Sites → Rooms → Racks → Components
- 10 Component Types — Server, Switch, Router, Firewall, Patch Panel, UPS, PDU, KVM, Storage, Other
- Port Documentation — document each port on a device (RJ45, SFP, SFP+, LC, SC, etc.) with labels and patch-through connections
- Markdown Notes — every entity has a full Markdown editor with live split-pane preview (GFM: tables, checkboxes, code blocks)
- Auto-save Notes — notes save automatically as you type (1.5s debounce)
- Full-text Search — sidebar search across all sites, rooms, racks and components (name, model, IP, serial)
- Dark Theme — GitHub-style dark UI optimised for long documentation sessions
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | React 18 + TypeScript + Vite |
| Backend | Express.js (Node 20) |
| Database | SQLite via better-sqlite3 (single file, zero config) |
| Markdown | react-markdown + remark-gfm |
Getting Started
Prerequisites
- Node.js 20+
- npm 10+
Install & Run (Development)
# From the project root
npm install
# Start both backend (port 3001) and frontend (port 5173) with hot-reload
npm run dev
Open http://localhost:5173 in your browser.
Production Build
npm run build # builds frontend into frontend/dist/
npm start # serves API + built frontend on port 3001
Project Structure
NetworkView/
├── backend/
│ └── src/
│ ├── index.js # Express server + search endpoint
│ ├── db.js # SQLite init + schema
│ └── routes/
│ ├── sites.js
│ ├── rooms.js
│ ├── racks.js
│ └── components.js # includes ports sub-resource
├── frontend/
│ └── src/
│ ├── App.tsx # Router
│ ├── api.ts # Fetch wrapper for all endpoints
│ ├── types.ts # TypeScript types + component metadata
│ ├── components/
│ │ ├── Sidebar.tsx # Tree navigation + search
│ │ ├── RackVisual.tsx # Graphical rack diagram
│ │ ├── MarkdownEditor.tsx
│ │ └── AddItemModal.tsx
│ └── pages/
│ ├── HomePage.tsx
│ ├── SitePage.tsx
│ ├── RoomPage.tsx
│ ├── RackPage.tsx
│ └── ComponentPage.tsx
└── data/
└── networkview.db # Created automatically on first run
Data Model
Site
└── Room(s)
└── Rack(s)
└── Component(s)
└── Port(s)
Every level has its own page with Markdown notes.
API Reference
| Method | Path | Description |
|---|---|---|
| GET | /api/sites |
List all sites |
| POST | /api/sites |
Create site |
| GET/PUT/DELETE | /api/sites/:id |
Site CRUD |
| GET | /api/rooms?siteId= |
Rooms in a site |
| POST | /api/rooms |
Create room |
| GET/PUT/DELETE | /api/rooms/:id |
Room CRUD |
| GET | /api/racks?roomId= |
Racks in a room |
| POST | /api/racks |
Create rack |
| GET/PUT/DELETE | /api/racks/:id |
Rack CRUD |
| GET | /api/components?rackId= |
Components in rack |
| POST | /api/components |
Create component |
| GET/PUT/DELETE | /api/components/:id |
Component CRUD |
| GET | /api/components/:id/ports |
Ports on component |
| POST | /api/components/:id/ports |
Add port |
| PUT/DELETE | /api/components/:id/ports/:portId |
Port CRUD |
| GET | /api/search?q= |
Full-text search |