Conversation
…e for Express routes test(admin): add comprehensive tests for authentication, admin routes, cache stats, file filtering, and logs export functionality
There was a problem hiding this comment.
Pull request overview
This PR merges test changes from the main branch, introducing a comprehensive notification system, real-time connection monitoring, improved file management with preview capabilities, enhanced logging with advanced filtering, and complete CI/CD infrastructure.
Key Changes:
- Replaced react-hot-toast with a custom notification system featuring activity tracking and toast notifications
- Added real-time connection status monitoring with polling capabilities
- Implemented file preview modal, grid/list view toggle, and enhanced upload queue management with progress tracking
- Enhanced logs page with filters (action type, status), statistics cards, export functionality, and user agent parsing
- Added complete CI/CD pipeline with GitHub Actions including lint, test, build, security scanning, and deployment workflows
Reviewed changes
Copilot reviewed 18 out of 63 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/migrate.sh | New database migration script with up/down/status/reset commands |
| cdn-dashboard/src/lib/realtime.tsx | Real-time connection monitoring with polling and event simulation |
| cdn-dashboard/src/lib/notifications.ts | Custom notification and activity feed state management using Zustand |
| cdn-dashboard/src/lib/api.ts | Added upload progress callback and client-side CSV/JSON export utilities |
| cdn-dashboard/src/components/system-stats.tsx | System health monitoring components with animated stats |
| cdn-dashboard/src/components/sidebar.tsx | Integrated activity dropdown in sidebar navigation |
| cdn-dashboard/src/components/providers.tsx | Replaced Toaster with NotificationToast component |
| cdn-dashboard/src/components/notifications.tsx | Complete notification UI with toast, activity panel, and dropdown components |
| cdn-dashboard/src/app/login/page.tsx | Updated to use new notification system |
| cdn-dashboard/src/app/dashboard/users/page.tsx | Updated toast import |
| cdn-dashboard/src/app/dashboard/tokens/page.tsx | Updated to use new notification and activity systems |
| cdn-dashboard/src/app/dashboard/page.tsx | Added real-time connection status and refresh functionality |
| cdn-dashboard/src/app/dashboard/logs/page.tsx | Major enhancement with filters, stats, exports, and user agent parsing |
| cdn-dashboard/src/app/dashboard/files/page.tsx | Complete overhaul with preview, grid view, enhanced upload queue, and exports |
| cdn-dashboard/src/app/dashboard/api-keys/page.tsx | Updated toast import |
| README.md | Comprehensive documentation update with new features and architecture |
| IMPROVEMENTS_COMPLETED.md | Documentation of all 8 phases of improvements |
| .github/workflows/ci.yml | Complete CI/CD pipeline configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| maxNotifications: 5, | ||
|
|
||
| addNotification: (notification) => { | ||
| const id = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| const id = `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; | |
| const id = `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`; |
| maxActivities: 50, | ||
|
|
||
| addActivity: (activity) => { | ||
| const id = `activity-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; |
There was a problem hiding this comment.
The substr method is deprecated. Use substring or slice instead.
| const id = `activity-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; | |
| const id = `activity-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`; |
| className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300" | ||
| onError={(e) => { | ||
| (e.target as HTMLImageElement).style.display = 'none'; | ||
| (e.target as HTMLImageElement).parentElement!.innerHTML = `<div class="scale-150">${getFileIcon(mimeType)}</div>`; |
There was a problem hiding this comment.
Setting innerHTML can expose the application to XSS attacks. Use DOM manipulation methods like createElement and appendChild instead.
| (e.target as HTMLImageElement).style.display = 'none'; | ||
| (e.target as HTMLImageElement).parentElement!.innerHTML = '<p class="text-zinc-500 p-8">Impossible de charger la prévisualisation</p>'; |
There was a problem hiding this comment.
Setting innerHTML can expose the application to XSS attacks. Use DOM manipulation methods like createElement and appendChild instead.
| (e.target as HTMLImageElement).style.display = 'none'; | |
| (e.target as HTMLImageElement).parentElement!.innerHTML = '<p class="text-zinc-500 p-8">Impossible de charger la prévisualisation</p>'; | |
| const img = e.target as HTMLImageElement; | |
| img.style.display = 'none'; | |
| const parent = img.parentElement!; | |
| // Remove all children | |
| while (parent.firstChild) { | |
| parent.removeChild(parent.firstChild); | |
| } | |
| // Create and append the error message | |
| const p = document.createElement('p'); | |
| p.className = 'text-zinc-500 p-8'; | |
| p.textContent = 'Impossible de charger la prévisualisation'; | |
| parent.appendChild(p); |
| API_KEY: test-api-key | ||
|
|
||
| - name: Upload coverage | ||
| uses: codecov/codecov-action@v4 |
There was a problem hiding this comment.
Using @v4 without specifying a full SHA or tag makes the workflow vulnerable to supply chain attacks. Pin to a specific commit SHA or use a full version tag.
| uses: codecov/codecov-action@v4 | |
| uses: codecov/codecov-action@v4.4.1 |
| output: 'trivy-results.sarif' | ||
|
|
||
| - name: Upload Trivy scan results | ||
| uses: github/codeql-action/upload-sarif@v2 |
There was a problem hiding this comment.
Using @v2 without specifying a full SHA or tag makes the workflow vulnerable to supply chain attacks. Pin to a specific commit SHA or use a full version tag.
| uses: github/codeql-action/upload-sarif@v2 | |
| uses: github/codeql-action/upload-sarif@v2.22.7 |
test