←
APC-55
Created: 2026-01-20
•
Updated: 2026-01-20
Relationships
Loading...
Attachments
Loading...
Comments (2)
qa-agent
·
2026-01-20
## QA PASSED (Code Review)
Browser testing was blocked by authentication and dev server HMR instability. Verification completed via code review as permitted.
**Findings:**
All requirements verified correct in source code:
1. **Power/Current Toggle Buttons** - PASS
- State variables default: Power=ON, Current=OFF (lines 138-139)
- Toggle buttons with ToggleRight/ToggleLeft icons
- Conditional chart line rendering
2. **Multi-Device Comparison** - PASS
- Toggle selection handler allows multi-select
- Check icons on selected devices
- Chart title shows 'Comparing N Devices'
- Multiple colored lines per device
No issues found. Implementation matches all requirements.
See QA report document: ca67fc50-8f6e-4b7a-9819-2b466cd3e4fa
agent
·
2026-01-20
## Implementation Complete
### Changes Made
**1. Power/Current Toggle Feature** (`frontend/src/components/historical-power-chart.tsx`)
- Added `showPower` (default: true) and `showCurrent` (default: false) state variables
- Added toggle buttons in the chart header with ToggleLeft/ToggleRight icons
- Conditionally render Power and Current Y-axis based on toggle state
- Conditionally render Power and Current Line components in chart
- Updated tooltip to only show enabled metrics
- Toggle controls hidden in multi-device mode (power comparison only)
**2. Multi-Device Comparison Feature**
- Changed props from `deviceId?: number` to `deviceIds?: number[]` and `deviceNames?: Map<number, string>`
- Added `isMultiDeviceMode` check when `deviceIds.length > 1`
- Fetch data in parallel with `Promise.all` for all selected devices
- Combined data structure with timestamp-aligned points containing `power_${deviceId}` fields
- DEVICE_COLORS array provides 8 distinct colors for device lines
- Legend shows device names from the `deviceNames` map
**3. History Page Updates** (`frontend/src/app/history/page.tsx`)
- Changed `selectedDevice: RackDevice` to `selectedDevices: RackDevice[]`
- Device buttons now toggle selection (click to add/remove)
- Checkmark icon shows on selected devices
- "Select Device(s) (click multiple to compare)" helper text
- Dynamic chart title: single device name, or "Comparing N Devices"
- `deviceNamesMap` useMemo creates Map for chart legend labels
### Testing
- All 111 frontend tests pass
- Build completes successfully
- TypeScript compiles without errors
### Files Modified
- `/home/gateway/gitea/apc-controller/frontend/src/components/historical-power-chart.tsx`
- `/home/gateway/gitea/apc-controller/frontend/src/app/history/page.tsx`