Control Center Bug Fixes - Summary
Issues Fixed
1. ✅ Duplicate "Documents" in Legend
- Problem: Chart legend showed "Documents" twice (green and red entries)
- Root Cause: Template had 4 legend items but only 3 datasets in the chart
- Fix: Removed duplicate red "Documents" legend item and updated column layout from
col-3tocol-4for proper spacing
2. ✅ JavaScript Error Causing Spinning Icon
- Problem:
Cannot read properties of undefined (reading 'date')error in tooltip callback - Root Cause: Tooltip callback was trying to access
activityData[dataIndex].datebutactivityDatais an object with{chats: {}, documents: {}, logins: {}}structure, not an array - Fix: Updated tooltip callback to use correct data structure:
// Before (incorrect) const date = new Date(activityData[dataIndex].date); // After (correct) const dateStr = sortedDates[dataIndex]; const date = new Date(dateStr);
3. ✅ Loading Spinner Never Disappearing
- Problem: Spinning icon stayed visible even after chart loaded
- Root Cause: JavaScript error prevented proper completion of chart rendering
- Fix:
- Fixed the tooltip callback error
- Added proper error handling with try-catch around chart creation
- Enhanced loading spinner hiding with debug logging
- Added fallback error handling to ensure spinner is always hidden
Files Modified
templates/control_center.html:
- Removed duplicate "Documents" legend item
- Updated column layout from
col-3tocol-4
static/js/control-center.js:
- Fixed tooltip callback to use correct data structure
- Added try-catch error handling around chart creation
- Enhanced loading spinner management
- Added debug logging for troubleshooting
Result
✅ Chart Legend: Now shows exactly 3 items (Chats, Documents, Logins) with proper spacing
✅ JavaScript Error: Fixed tooltip callback error that was breaking chart rendering
✅ Loading Spinner: Now properly disappears after chart loads or shows error message
✅ Error Handling: Added robust error handling to prevent future similar issues
✅ Data Sources: Still correctly using activity_logs for logins, conversations.last_updated for chats, documents.upload_date for documents
The Control Center activity trends chart should now display correctly without duplicate legend entries and the loading spinner will properly disappear once the chart is rendered!