Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new archive/reset feature is currently unauthenticated and destructive, and some UI actions (e.g., “Block IP”) are non-functional without backend integration.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR merges a large set of UI updates that shift multiple SecureNet UI pages from mock/static data to backend-driven “realtime” data (REST + WebSocket), and adds an admin “archive/reset” capability backed by a new FastAPI endpoint.
Changes:
- Replace mock data across alerts/logs/reports/dashboards with fetches to
localhost:8000endpoints and periodic refresh intervals. - Add realtime monitoring UX (WebSocket packet stream, live protocol breakdowns, dynamic status/health panels).
- Introduce an admin archive/reset flow in the UI and backend (
POST /api/v1/admin/archive) to clear active tables and log an audit event.
File summaries
| File | Description |
|---|---|
| securenet-ui/src/styles/global.css | Adds global top margin override for multiple header variants. |
| securenet-ui/src/pages/SIEMExport.jsx | Fetches SIEM connectors from backend instead of mock data. |
| securenet-ui/src/pages/Reports.jsx | Removes mock report history and adds weekly archive/reset action. |
| securenet-ui/src/pages/EnterpriseDashboard.jsx | Fetches /health and renders component-by-component system status. |
| securenet-ui/src/pages/EnhancedAdminPanel.jsx | Removes fallback demo org/users; uses empty lists on failure. |
| securenet-ui/src/pages/Dashboard.jsx | Computes health percentage from /health and adds telemetry polling for admin stats/activity. |
| securenet-ui/src/pages/AuditLogs.jsx | Removes mock fallback audit logs and uses empty state on failure. |
| securenet-ui/src/pages/Alerts.jsx | Switches to backend alerts, adds threat-type filtering, loading/empty states, confidence display. |
| securenet-ui/src/layouts/DashboardLayout.css | Adjusts layout padding to increase top spacing. |
| securenet-ui/src/hooks/useRealtimeAlerts.js | Loosens empty-list handling so hook can represent “no alerts” correctly. |
| securenet-ui/src/components/simulation/AdminSimulation.jsx | Major UI refresh for simulation center (KPIs, templates, config modal, charts). |
| securenet-ui/src/components/settings/UserView.jsx | Major UX overhaul: sidebar sections + reusable toggle/select rows. |
| securenet-ui/src/components/security/ThreatIntelligence.jsx | Redesigns threat intelligence card with risk-based styling and “AI insight”. |
| securenet-ui/src/components/profile/UserOnlyProfile.jsx | Switches profile data to localStorage/backend stats/logs and refreshes UI. |
| securenet-ui/src/components/profile/AdminProfile.jsx | Makes profile/metrics more dynamic (auth context/local users/Supabase profiles), refreshes UI. |
| securenet-ui/src/components/network/UserView.jsx | Adds WebSocket live packet feed + periodic status polling, replaces mock traffic. |
| securenet-ui/src/components/network/AdminView.jsx | Adds WebSocket live packet feed + monitoring start/stop calls, derives IP/protocol data from realtime alerts. |
| securenet-ui/src/components/integrations/AdminIntegrations.jsx | UI refresh and derives integration KPIs from state via useMemo. |
| securenet-ui/src/components/dashboard/Topbar.jsx | Uses demo-user fallback for menu label, updates displayed role formatting. |
| securenet-ui/src/components/common/AdminBanner.jsx | Removes the admin banner entirely. |
| securenet-ui/src/components/analysis/UserView.jsx | Replaces simulated analysis with backend stats + realtime alerts aggregation. |
| securenet-ui/src/components/analysis/UserAIInsights.jsx | Replaces simulated AI insights with backend stats + realtime alert trends and recommendations. |
| securenet-ui/src/components/analysis/AdminView.jsx | Replaces simulated admin attack analysis with realtime aggregations from alerts + stats polling. |
| securenet-ui/src/components/analysis/AdminAIInsights.jsx | Replaces simulated admin AI insights with backend stats + realtime trends/recommendations. |
| backend/main.py | Adds POST /api/v1/admin/archive endpoint to delete active tables and append an audit log entry. |
Review details
Suppressed comments (1)
securenet-ui/src/pages/Alerts.jsx:302
- The AI confidence rendering uses a truthy check (
alert.confidence ? ... : ...), so a legitimate0confidence will display asN/A. Use a null/undefined check instead.
<span>AI Confidence:</span>
<strong style={{ color: '#34d399' }}>
{alert.confidence ? `${(alert.confidence * 100).toFixed(1)}%` : 'N/A'}
</strong>
- Files reviewed: 27/30 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+513
to
+515
| async def archive_and_clear_data(request: Request) -> JSONResponse: | ||
| """Archive current data (simulate weekly report generation) and clear active dashboards.""" | ||
| try: |
Comment on lines
+160
to
163
| <div className="user-name">{user?.name || user?.user_metadata?.name || 'Authorized User'}</div> | ||
| <div className={`user-role ${user?.role || user?.user_metadata?.role || 'user'}`}> | ||
| {(user?.role || user?.user_metadata?.role || 'USER').toUpperCase()} | ||
| </div> |
Comment on lines
103
to
105
| const handleBlockIP = (ip) => { | ||
| setAllIPs(prev => | ||
| prev.map(item => | ||
| item.ip === ip ? { ...item, status: 'blocked', monitoring: false } : item | ||
| ) | ||
| ); | ||
| toast.success(`IP ${ip} blocked`); | ||
| }; |
| destinationIP: item.destination_ip || item.destinationIP || 'Unknown', | ||
| protocol: item.protocol || 'TCP', | ||
| description: item.description || 'Flow anomaly intercepted by SecureNet engine', | ||
| confidence: item.confidence || null, |
Comment on lines
+111
to
+112
| const response = await fetch('http://localhost:8000/api/v1/admin/archive', { method: 'POST' }); | ||
| const data = await response.json(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.