From 9f1ceca25534aca90f40305526d54ce437ab23ee Mon Sep 17 00:00:00 2001 From: Shruti78 Date: Wed, 12 Feb 2025 02:32:47 +0530 Subject: [PATCH] redesign the website's heading Signed-off-by: Shruti78 --- frontend/src/components/Dashboard.jsx | 153 ++++++-------------------- 1 file changed, 35 insertions(+), 118 deletions(-) diff --git a/frontend/src/components/Dashboard.jsx b/frontend/src/components/Dashboard.jsx index da07028..668f8ba 100644 --- a/frontend/src/components/Dashboard.jsx +++ b/frontend/src/components/Dashboard.jsx @@ -9,17 +9,12 @@ import { CircularProgress, } from "@mui/material"; import RefreshIcon from "@mui/icons-material/Refresh"; - import StatCard from "./Charts/StatCard"; import JobStatusPieChart from "./Charts/JobStatusPieChart"; import QueueResourcesBarChart from "./Charts/QueueResourcesBarChart"; const Dashboard = () => { - const [dashboardData, setDashboardData] = useState({ - jobs: [], - queues: [], - pods: [], - }); + const [dashboardData, setDashboardData] = useState({ jobs: [], queues: [], pods: [] }); const [isLoading, setIsLoading] = useState(true); const [refreshing, setRefreshing] = useState(false); const [error, setError] = useState(null); @@ -50,7 +45,6 @@ const Dashboard = () => { pods: podsData.items || [], }); } catch (error) { - console.error("Error fetching dashboard data:", error); setError(error.message); } finally { setRefreshing(false); @@ -58,136 +52,61 @@ const Dashboard = () => { } }; - const handleRefresh = () => { - fetchAllData(); - }; - useEffect(() => { fetchAllData(); }, []); return ( - + {error && ( - + {error} )} - - Volcano Dashboard + + + Volcano Dashboard + - - + + - + - q.status?.state === "Open") - ?.length || 0 - } - /> + q.status?.state === "Open")?.length || 0} /> - p.status?.phase === "Running") - ?.length || 0 - } - /> + p.status?.phase === "Running")?.length || 0} /> - + - + - - {isLoading ? ( - - - - ) : ( - - - - )} + + {isLoading ? : } - - - {isLoading ? ( - - - - ) : ( - - - - )} + + {isLoading ? : } @@ -195,19 +114,17 @@ const Dashboard = () => { ); }; +const LoadingIndicator = () => ( + + + +); + const calculateSuccessRate = (jobs) => { if (!jobs || jobs.length === 0) return 0; - const completed = jobs.filter( - (job) => job.status?.succeeded || job.status?.state?.phase === "Completed" - ).length; - const finished = jobs.filter( - (job) => - job.status?.succeeded || - job.status?.failed || - job.status?.state?.phase === "Completed" || - job.status?.state?.phase === "Failed" - ).length; + const completed = jobs.filter(job => job.status?.succeeded || job.status?.state?.phase === "Completed").length; + const finished = jobs.filter(job => job.status?.succeeded || job.status?.failed || job.status?.state?.phase === "Completed" || job.status?.state?.phase === "Failed").length; return finished === 0 ? 0 : Math.round((completed / finished) * 100); }; -export default Dashboard; +export default Dashboard; \ No newline at end of file