13 KiB
Epic 10 - Mission Control Admin Frontend Development Log
Project Overview
Date: 2026-03-23
Phase: 1 & 2 Implementation
Status: In Development
Target: Complete Admin Dashboard with RBAC and Launchpad
Architectural Decisions
1. Technology Stack Selection
- Framework: Nuxt 3 (SSR/SPA hybrid) - Chosen for its file-based routing, SEO capabilities, and Vue 3 integration
- UI Library: Vuetify 3 - Material Design implementation that provides consistent components and theming
- State Management: Pinia - Vue 3's official state management, lightweight and TypeScript friendly
- TypeScript: Strict mode enabled for type safety and better developer experience
- Build Tool: Vite (via Nuxt) - Fast builds and hot module replacement
2. Project Structure
frontend/admin/
├── components/ # Reusable Vue components
├── composables/ # Vue composables (useRBAC, etc.)
├── middleware/ # Nuxt middleware (auth.global.ts)
├── pages/ # File-based routes
├── stores/ # Pinia stores (auth.ts, tiles.ts)
├── app.vue # Root component
├── nuxt.config.ts # Nuxt configuration
├── tsconfig.json # TypeScript configuration
└── Dockerfile # Containerization
3. Authentication & RBAC Architecture
JWT Token Structure
Tokens from backend FastAPI /login endpoint must include:
{
"sub": "user@email.com",
"role": "admin",
"rank": 7,
"scope_level": "region",
"region_code": "HU-BU",
"scope_id": 123,
"exp": 1700000000,
"iat": 1700000000
}
Pinia Auth Store Features
- Token parsing and validation with
jwt-decode - Automatic token refresh detection
- Role-based permission generation
- Geographical scope validation
- LocalStorage persistence for session continuity
RBAC Implementation
- Role Hierarchy: Superadmin (10) > Admin (7) > Moderator (5) > Salesperson (3)
- Scope Levels: Global > Country > Region > City > District
- Permission System: Dynamic permission generation based on role and rank
- Tile Visibility: Tiles filtered by role, rank, and scope level
4. Middleware Strategy
- Global Auth Middleware: Runs on every route change
- Public Routes:
/login,/forgot-password,/reset-password - Role Validation: Route meta validation with
requiredRole,minRank,requiredPermission - Scope Validation: Geographical scope checking with
requiredScopeIdandrequiredRegionCode - Automatic Header Injection: Adds auth and scope headers to all API requests
5. Launchpad Tile System
Tile Definition
Each tile includes:
- Unique ID and display title
- Required roles and minimum rank
- Required permissions
- Applicable scope levels
- Icon and color mapping
Dynamic Filtering
- Tiles filtered in real-time based on user's RBAC attributes
- Empty state when no tiles accessible
- Visual indicators for access level (role badges, rank chips)
User Customization
- Per-user tile preferences stored in localStorage
- Position persistence for drag-and-drop reordering
- Visibility toggles for personalized dashboards
- Size customization (small, medium, large)
6. Component Design
TileCard Component
- Responsive card with hover effects
- Role and scope level badges
- Color-coded by tile type
- Click-to-navigate functionality
- Consistent sizing and spacing
Dashboard Layout
- App bar with user menu and role indicators
- Navigation drawer for main sections
- Welcome header with user context
- Grid-based tile layout
- Quick stats section for at-a-glance metrics
- Footer with system status
7. Docker Configuration
Multi-stage Build
- Builder Stage: Node 20 with full dev dependencies
- Runner Stage: Optimized production image with non-root user
Port Configuration
- Internal: 3000 (Nuxt default)
- External: 8502 (mapped in docker-compose.yml)
- API Proxy:
NUXT_PUBLIC_API_BASE_URL=http://sf_api:8000
Volume Strategy
- Development: Hot-reload with mounted source code
- Production: Built assets only for smaller image size
8. API Integration Strategy
Headers Injection
All authenticated requests automatically include:
Authorization: Bearer <token>X-Scope-Id: <scope_id>X-Region-Code: <region_code>X-Scope-Level: <scope_level>
Error Handling
- Token expiration detection and auto-logout
- Permission denied redirects to
/unauthorized - Network error handling with user feedback
9. Security Considerations
Client-side Security
- No sensitive data in client-side code
- Token storage in localStorage with expiration checks
- Role validation on both client and server
- XSS protection through Vue's template system
Geographical Isolation
- Scope validation before data display
- Region-based data filtering at API level
- Visual indicators for current scope context
10. Performance Optimizations
Code Splitting
- Route-based code splitting via Nuxt
- Component lazy loading where appropriate
- Vendor chunk optimization
Asset Optimization
- Vuetify tree-shaking in production
- CSS purging for unused styles
- Image optimization pipeline
Caching Strategy
- LocalStorage for user preferences
- Token validation caching
- Tile configuration caching per session
Implementation Status
✅ Completed Phase 1
- Project initialization with Nuxt 3 + Vuetify 3
- Docker configuration and docker-compose integration
- Pinia auth store with JWT parsing
- Global authentication middleware
- RBAC composable with role/scope validation
- Basic dashboard layout
✅ Completed Phase 2
- Launchpad tile system with dynamic filtering
- TileCard component with role-based styling
- User preference store for tile customization
- Geographical scope integration
- Complete dashboard with stats and navigation
🔄 Pending for Phase 3
- Geographical map integration (Leaflet/Vue3-leaflet)
- Individual tile pages (AI Logs, Finance, Users, etc.)
- User management interface
- Real-time data updates
- Comprehensive testing suite
Known Issues & TODOs
Immediate TODOs
- Install dependencies (
npm installin container) - Create login page component
- Implement API service with axios interceptors
- Add error boundary components
- Create unauthorized/404 pages
Technical Debt
- TypeScript strict mode configuration needs refinement
- Vuetify theme customization for brand colors
- Internationalization (i18n) setup
- E2E testing with Cypress
- Performance benchmarking
Deployment Notes
Environment Variables
NUXT_PUBLIC_API_BASE_URL=http://localhost:8000
NODE_ENV=production
NUXT_HOST=0.0.0.0
NUXT_PORT=3000
Build Commands
# Development
npm run dev
# Production build
npm run build
npm run preview
# Docker build
docker build -t sf-admin-frontend .
Health Checks
/api/healthendpoint for container health checks- Docker HEALTHCHECK directive in Dockerfile
- Log aggregation for monitoring
Ticket #113: RBAC Implementation & Role Management System
Date: 2026-03-23 Status: In Progress Assigned: Fast Coder Gitea Issue: #113
Task Breakdown
Task 1: User Management Interface (RBAC Admin)
- Create
/userspage accessible only by Superadmin and Admin ranks - Build Vuetify Data Table with columns: Email, Current Role, Scope Level, Status
- Create "Edit Role" dialog for changing UserRole and scope_level
- Implement API composable with mock service (fallback when backend endpoints not available)
Task 2: Live "Gold Vehicle" AI Logs Tile (Launchpad)
- Create "AI Logs Monitor" tile component for Launchpad
- Implement polling mechanism (3-second intervals) using Vue's onMounted and setInterval
- Fetch data from
/api/v1/vehicles/recent-activitywith mock fallback - Display real-time log entries with visual feedback
Task 3: Connect Existing API
- Create API client for GET
/api/v1/admin/health-monitor - Display metrics on System Health tile: total_assets, total_organizations, critical_alerts_24h
- Ensure proper error handling and loading states
Implementation Plan
Component Structure
frontend/admin/
├── pages/users.vue # User management page
├── components/UserDataTable.vue # Vuetify data table component
├── components/EditRoleDialog.vue # Role editing dialog
├── components/AiLogsTile.vue # AI Logs tile for Launchpad
├── composables/useUserManagement.ts # User management API composable
├── composables/useAiLogs.ts # AI logs polling composable
├── composables/useHealthMonitor.ts # Health monitor API composable
└── stores/users.ts # Pinia store for user data
API Integration Strategy
- Mock Services: Implement fallback mock data for development/testing
- Real API: Switch to real endpoints when backend is ready
- Error Handling: Graceful degradation with user notifications
- Type Safety: Full TypeScript interfaces for all API responses
RBAC Protection
- Route-level protection via middleware
- Component-level guards using
useRBACcomposable - Visual indicators for unauthorized access attempts
Progress Tracking
- Ticket #113 set to "In Progress" via Gitea manager
- User Management page created
- Vuetify Data Table implemented
- Edit Role dialog completed
- API composables with mock services
- AI Logs Tile component
- Polling mechanism implemented
- Health monitor API integration
- System Health tile updated
- Comprehensive testing
- Ticket closure with technical summary
Epic 10 - Ticket 2: Launchpad UI & Modular Tile System (#114)
Date: 2026-03-23 Status: In Progress Goal: Upgrade the static Launchpad into a dynamic, drag-and-drop Grid system where users can rearrange their authorized tiles.
Task Breakdown
Task 1: Drag-and-Drop Grid Implementation
- Install vuedraggable (or equivalent Vue 3 compatible drag-and-drop grid system)
- Refactor the Launchpad (Dashboard.vue) to use a draggable grid layout for the tiles
- Ensure the grid is responsive (e.g., 1 column on mobile, multiple on desktop)
Task 2: Modular Tile Component Framework
- Create a base TileWrapper.vue component that handles the drag handle (icon), title bar, and RBAC visibility checks
- Wrap the existing AiLogsTile and SystemHealthTile inside this new wrapper
Task 3: Layout Persistence & "Reset to Default"
- Update the Pinia store (usePreferencesStore) to handle layout state
- Maintain a defaultLayout array (hardcoded standard order) and a userLayout array
- Persist the userLayout to localStorage so the custom layout survives page reloads
- Add a "Restore Default Layout" (Alapértelmezett elrendezés) UI button on the Launchpad that resets userLayout back to defaultLayout
Implementation Plan
Component Structure Updates
frontend/admin/
├── components/TileWrapper.vue # Base tile wrapper with drag handle
├── components/AiLogsTile.vue # Updated to use wrapper
├── components/SystemHealthTile.vue # Updated to use wrapper
├── stores/preferences.ts # New store for layout preferences
└── pages/dashboard.vue # Updated with draggable grid
Technical Specifications
- Drag & Drop Library:
vuedraggable@next(Vue 3 compatible) - Grid System: CSS Grid with responsive breakpoints
- State Persistence: localStorage with fallback to default
- RBAC Integration: Tile visibility controlled via
useRBACcomposable - Default Layout: Hardcoded array of tile IDs in order of appearance
Progress Tracking
- Ticket #114 set to "In Progress" via Gitea manager
- TODO lista létrehozása development_log.md fájlban
- vuedraggable csomag telepítése (v4.1.0 for Vue 3)
- Dashboard.vue átalakítása draggable grid-re (Draggable component integration)
- TileWrapper.vue alapkomponens létrehozása (with drag handle, RBAC badges, visibility toggle)
- Meglévő tile-ok becsomagolása TileWrapper-be (TileCard wrapped in TileWrapper)
- Pinia store frissítése layout kezeléshez (added defaultLayout and isLayoutModified computed properties)
- Layout persistencia localStorage-ban (existing loadPreferences/savePreferences enhanced)
- "Restore Default Layout" gomb implementálása (button with conditional display based on isLayoutModified)
- Tesztelés és finomhangolás
- Gitea Ticket #114 lezárása (Ticket closed with technical summary)
Conclusion
The Epic 10 Admin Frontend Phase 1 & 2 implementation establishes a solid foundation for the Mission Control dashboard. The architecture supports the core requirements of geographical RBAC isolation, modular launchpad tiles, and role-based access control. The system is ready for integration with the backend FastAPI services and can be extended with additional tiles and features as specified in the epic specification.