Admin Dashboard
Relevant source files
The following files were used as context for generating this wiki page:
The Admin Dashboard serves as the central executive control panel for the ElmecV2 system. It provides administrators with a high-level overview of system health, user activity, and service performance through real-time metrics and interactive visualizations.
Sources: components/AdminDashboard.tsx:165-168, README.md:14-17
System Overview and Architecture
The dashboard is implemented as a specialized React functional component designed for users with the admin role. It integrates with the system's global authentication context to enforce access control. If a non-admin user attempts to access this module, the system triggers an "Access Denied" state.
Sources: components/AdminDashboard.tsx:43-51, components/AdminDashboard.tsx:149-160
Access Control Flow
The following diagram illustrates the permission verification logic executed when the Admin Dashboard component mounts.
The logic ensures that sensitive executive data is restricted to authorized personnel only.
Sources: components/AdminDashboard.tsx:149-160, VALIDACION-COMPLETA.md:46-49
Data Structures and Metrics
The dashboard tracks several key performance indicators (KPIs) and operational metrics encapsulated in the DashboardStats interface.
Dashboard Statistics
| Metric | Description | Data Type |
|---|---|---|
totalUsers | Cumulative count of registered users | number |
activeUsers | Count of users active within the selected period | number |
totalRequests | Total number of service requests created | number |
pendingRequests | Requests awaiting initial response or assignment | number |
resolvedRequests | Successfully completed requests | number |
totalMessages | Total chat volume across all rooms | number |
avgResponseTime | Mean time to respond to user requests (in hours) | number |
satisfactionRate | Customer satisfaction score (0.0 to 5.0) | number |
Sources: components/AdminDashboard.tsx:28-37, DEMO-READY.md:27-30
Period Selection
The interface supports temporal filtering, allowing administrators to view data trends across different timeframes:
- 24h: Last 24 hours
- 7d: Last 7 days (default)
- 30d: Last 30 days
- 90d: Last 90 days
Sources: components/AdminDashboard.tsx:173-193
Visual Components
Statistics Grid
The dashboard utilizes StatCard components to display high-level counts. These cards include visual trend indicators (positive or negative percentage changes) and icon representations for Users, Requests, Messages, and Response Time.
Sources: components/AdminDashboard.tsx:84-118, components/AdminDashboard.tsx:196-228
Request Distribution Chart
The system visualizes request status distribution using a customized bar chart component. This logic calculates the ratio of resolved, in-progress, and pending requests.
The chart displays "Resueltas" (Resolved), "En proceso" (In progress), and "Pendientes" (Pending) statuses.
Sources: components/AdminDashboard.tsx:71-79, components/AdminDashboard.tsx:120-147
Administrative Actions
The dashboard provides "Quick Actions" to facilitate rapid navigation to management modules.
| Action | Icon | Destination/Purpose |
|---|---|---|
| Manage Users | Users | User account and permission administration |
| View Requests | FileText | Comprehensive list of all system requests |
| Reports | BarChart3 | Detailed analytical report generation |
Sources: components/AdminDashboard.tsx:273-288, README.md:15-17
Summary
The Admin Dashboard is a critical module for ElmecV2, consolidating disparate data points from the Request, Chat, and User modules into a single actionable interface. By providing real-time visibility into satisfaction rates and response times, it enables data-driven decision-making for the industrial support environment.