larxius commited on
Commit
2f8096f
·
verified ·
1 Parent(s): 5f10ca5

Update frontend/src/pages/OrganizationPage.jsx

Browse files
frontend/src/pages/OrganizationPage.jsx CHANGED
@@ -1,4 +1,4 @@
1
- import { useState, useEffect, useCallback } from 'react';
2
  import { useAuth } from '../components/AuthContext';
3
  import { Shield, Activity, Users, Globe, Lock, ShieldAlert, ArrowLeft, BarChart3, PieChart as PieChartIcon } from 'lucide-react';
4
  import { useNavigate } from 'react-router-dom';
@@ -88,7 +88,7 @@ export const OrganizationPage = () => {
88
  const completedScans = filteredScans.filter(s => s.status === 'completed' && s.security_score !== null);
89
  const score = completedScans.length > 0
90
  ? Math.round(completedScans.reduce((sum, s) => sum + s.security_score, 0) / completedScans.length)
91
- : 100;
92
 
93
  const totalVulnerabilities = filteredScans.reduce((sum, s) => {
94
  const vc = s.vulnerabilities_count;
@@ -203,7 +203,7 @@ export const OrganizationPage = () => {
203
  {/* Top Metrics Grid */}
204
  <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-md mb-xl">
205
  {[
206
- { title: 'SECURITY SCORE', value: `${score}/100`, icon: Shield, color: score > 80 ? 'text-green-500' : score > 50 ? 'text-orange-500' : 'text-error', bg: score > 80 ? 'bg-green-500/10 border-green-500/20' : score > 50 ? 'bg-orange-500/10 border-orange-500/20' : 'bg-error/10 border-error/20' },
207
  { title: 'ACTIVE ASSETS', value: activeAssets.toString(), icon: Globe, color: 'text-blue-500', bg: 'bg-blue-500/10 border-blue-500/20' },
208
  { title: 'TOTAL SCANS', value: filteredScans.length.toString(), icon: Activity, color: 'text-purple-500', bg: 'bg-purple-500/10 border-purple-500/20' },
209
  { title: 'OPEN RISKS', value: totalVulnerabilities.toString(), icon: ShieldAlert, color: totalVulnerabilities > 0 ? 'text-orange-500' : 'text-green-500', bg: totalVulnerabilities > 0 ? 'bg-orange-500/10 border-orange-500/20' : 'bg-green-500/10 border-green-500/20' }
 
1
+ import { useState, useEffect, useCallback } from 'react';
2
  import { useAuth } from '../components/AuthContext';
3
  import { Shield, Activity, Users, Globe, Lock, ShieldAlert, ArrowLeft, BarChart3, PieChart as PieChartIcon } from 'lucide-react';
4
  import { useNavigate } from 'react-router-dom';
 
88
  const completedScans = filteredScans.filter(s => s.status === 'completed' && s.security_score !== null);
89
  const score = completedScans.length > 0
90
  ? Math.round(completedScans.reduce((sum, s) => sum + s.security_score, 0) / completedScans.length)
91
+ : null;
92
 
93
  const totalVulnerabilities = filteredScans.reduce((sum, s) => {
94
  const vc = s.vulnerabilities_count;
 
203
  {/* Top Metrics Grid */}
204
  <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-md mb-xl">
205
  {[
206
+ { title: 'SECURITY SCORE', value: score !== null ? `${score}/100` : 'N/A', icon: Shield, color: score === null ? 'text-slate-400' : score > 80 ? 'text-green-500' : score > 50 ? 'text-orange-500' : 'text-error', bg: score === null ? 'bg-slate-500/10 border-slate-500/20' : score > 80 ? 'bg-green-500/10 border-green-500/20' : score > 50 ? 'bg-orange-500/10 border-orange-500/20' : 'bg-error/10 border-error/20' },
207
  { title: 'ACTIVE ASSETS', value: activeAssets.toString(), icon: Globe, color: 'text-blue-500', bg: 'bg-blue-500/10 border-blue-500/20' },
208
  { title: 'TOTAL SCANS', value: filteredScans.length.toString(), icon: Activity, color: 'text-purple-500', bg: 'bg-purple-500/10 border-purple-500/20' },
209
  { title: 'OPEN RISKS', value: totalVulnerabilities.toString(), icon: ShieldAlert, color: totalVulnerabilities > 0 ? 'text-orange-500' : 'text-green-500', bg: totalVulnerabilities > 0 ? 'bg-orange-500/10 border-orange-500/20' : 'bg-green-500/10 border-green-500/20' }