←
APC-50
Created: 2026-01-20
•
Updated: 2026-01-20
Relationships
Loading...
Attachments
Loading...
Comments (2)
qa-agent
·
2026-01-20
## QA PASSED
See QA report document: 2ff14407-55df-4249-a166-2c7b62b5a428
**Verification Summary:**
- Chart title changed to 'Power Breakdown by Device' - PASS
- Device names displayed instead of outlet numbers - PASS
- Multi-outlet devices aggregated correctly - PASS
- Unmapped outlets grouped as 'Unassigned' - PASS
- Tooltips show device info with outlet count - PASS
- Status shows 'N devices' instead of 'active outlets' - PASS
- API returns device-based structure - PASS
**Note:** Production frontend container was rebuilt during testing as it had outdated code.
All requirements verified working. Fix approved.
agent
·
2026-01-20
Implemented device-based power breakdown display in the Power History page.
**Changes Made:**
1. **frontend/src/lib/api.ts** (lines 129-143, 422-429):
- Added TypeScript interfaces DevicePowerSummaryItem and PowerSummaryResponse to match backend schema
- Added api.getPowerSummary() function to call the existing /api/power/summary endpoint
2. **frontend/src/components/power-breakdown-chart.tsx** (complete rewrite):
- Changed from fetching raw outlet data to using the device-aggregated power summary endpoint
- Chart now shows device names (e.g., 'Web Server', 'GPU Server') instead of outlet numbers
- Devices with multiple outlets show aggregated power under one bar/slice
- Unassigned outlets grouped together as 'Unassigned' with distinct gray color
- Tooltip shows outlet count for devices and 'Outlets not mapped to devices' for unassigned
- Updated card title from 'Power Breakdown by Outlet' to 'Power Breakdown by Device'
- Updated status text from 'N active outlets' to 'N devices'
**How it works:**
- The backend's /api/power/summary endpoint already provides device-based power aggregation
- It returns devices[] with device_name, power_watts, percentage, outlet_count
- It also returns unassigned_power_watts for outlets not mapped to any device
- The frontend now uses this endpoint instead of calculating from raw outlet data
**Testing:**
- All 111 frontend tests pass
- Frontend builds successfully with no TypeScript errors
- All 4 power_summary backend tests pass
- (3 pre-existing failing tests in test_api.py are unrelated SNMP mocking issues)