From e052afde3d4f6334c71ff840edc0721012d73441 Mon Sep 17 00:00:00 2001 From: server Date: Sun, 3 Aug 2025 19:36:55 +0000 Subject: [PATCH] Fix typescript build issues --- .../Migration/ResourceDistributionChart.tsx | 10 +- src/components/Migration/SummaryStats.tsx | 4 +- src/pages/Maintenance.tsx | 2 +- src/pages/Migration.tsx | 308 +++++++++--------- 4 files changed, 164 insertions(+), 160 deletions(-) diff --git a/src/components/Migration/ResourceDistributionChart.tsx b/src/components/Migration/ResourceDistributionChart.tsx index c62b4c3..f04f401 100644 --- a/src/components/Migration/ResourceDistributionChart.tsx +++ b/src/components/Migration/ResourceDistributionChart.tsx @@ -9,6 +9,8 @@ import { PointElement, LineElement, BarElement, + BarController, + LineController, Title, Tooltip, Legend, @@ -22,6 +24,8 @@ ChartJS.register( PointElement, LineElement, BarElement, + BarController, + LineController, Title, Tooltip, Legend @@ -140,7 +144,7 @@ const ResourceDistributionChart: React.FC = ({ titleFont: { family: theme.typography.fontFamily, size: 13, - weight: '600' + weight: 600 }, bodyColor: theme.palette.text.secondary, bodyFont: { @@ -176,7 +180,7 @@ const ResourceDistributionChart: React.FC = ({ font: { family: theme.typography.fontFamily, size: 12, - weight: '500' + weight: 500 } }, beginAtZero: true, @@ -204,7 +208,7 @@ const ResourceDistributionChart: React.FC = ({ font: { family: theme.typography.fontFamily, size: 12, - weight: '500' + weight: 500 } }, beginAtZero: true, diff --git a/src/components/Migration/SummaryStats.tsx b/src/components/Migration/SummaryStats.tsx index af98552..b51d219 100644 --- a/src/components/Migration/SummaryStats.tsx +++ b/src/components/Migration/SummaryStats.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useCallback } from 'react'; +import React, {useCallback } from 'react'; import { Grid, Paper, Typography, Box, Divider } from '@mui/material'; import StorageIcon from '@mui/icons-material/Storage'; import ComputerIcon from '@mui/icons-material/Computer'; @@ -19,7 +19,7 @@ const SummaryStats: React.FC = () => { return jsonData; }, []); - const { data, pollingInterval } = useSmartPolling( + const { data } = useSmartPolling( fetchData, null, 5000, // min interval: 5 seconds diff --git a/src/pages/Maintenance.tsx b/src/pages/Maintenance.tsx index 0b6e079..a4358e9 100644 --- a/src/pages/Maintenance.tsx +++ b/src/pages/Maintenance.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { Box, Paper, Typography, Fade, useTheme, AppBar, Toolbar, Chip, Slider, FormControlLabel, Switch } from '@mui/material'; +import { Box, Paper, Typography, Fade, useTheme, AppBar, Toolbar, Chip, Slider} from '@mui/material'; import { Chart as ChartJS, CategoryScale, diff --git a/src/pages/Migration.tsx b/src/pages/Migration.tsx index 9fa653b..3f88a5d 100644 --- a/src/pages/Migration.tsx +++ b/src/pages/Migration.tsx @@ -25,7 +25,7 @@ import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew'; import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import TerminalIcon from '@mui/icons-material/Terminal'; import VisibilityIcon from '@mui/icons-material/Visibility'; -import LockIcon from '@mui/icons-material/Lock'; +//import LockIcon from '@mui/icons-material/Lock'; import SummaryStats from '../components/Migration/SummaryStats'; import ResourceDistributionChart from '../components/Migration/ResourceDistributionChart'; @@ -37,163 +37,163 @@ import { VMPlacementData } from '../components/Migration/types'; // Constants const API_BASE_URL = config.apiUrl; -const REFRESH_INTERVAL = 30000; // 30 seconds +//const REFRESH_INTERVAL = 30000; // 30 seconds -interface VMCardProps { - vm: { - name: string; - power: number; - status: 'blocked' | 'open'; - confg: { - cpu: number; - ram: number; - disk: number; - }; - }; - vmId: string; - isActive: boolean; - expandedVMs: Record; - toggleVMDetails: (vmId: string) => void; - theme: any; -} +// interface VMCardProps { +// vm: { +// name: string; +// power: number; +// status: 'blocked' | 'open'; +// confg: { +// cpu: number; +// ram: number; +// disk: number; +// }; +// }; +// vmId: string; +// isActive: boolean; +// expandedVMs: Record; +// toggleVMDetails: (vmId: string) => void; +// theme: any; +// } -const VMCard = ({ vm, vmId, isActive, expandedVMs, toggleVMDetails, theme }: VMCardProps) => ( - - - - - - {vm.name} - {vm.status === 'blocked' && ( - - )} - - - - - {vm.power.toFixed(2)}W - - { - e.stopPropagation(); - toggleVMDetails(vmId); - }} - > - - - - +// const VMCard = ({ vm, vmId, isActive, expandedVMs, toggleVMDetails, theme }: VMCardProps) => ( +// +// +// +// +// +// {vm.name} +// {vm.status === 'blocked' && ( +// +// )} +// +// +// +// +// {vm.power.toFixed(2)}W +// +// { +// e.stopPropagation(); +// toggleVMDetails(vmId); +// }} +// > +// +// +// +// - - - - - - Status - - - {vm.status === 'blocked' ? ( - <> - - Blocked - - ) : ( - 'Open' - )} - - - - - CPU Cores - - - {vm.confg.cpu} - - - - - RAM - - - {vm.confg.ram} GB - - - - - Disk Size - - - {vm.confg.disk} GB - - - - - Power - - - {vm.power.toFixed(2)}W - - - - - - -); +// +// +// +// +// +// Status +// +// +// {vm.status === 'blocked' ? ( +// <> +// +// Blocked +// +// ) : ( +// 'Open' +// )} +// +// +// +// +// CPU Cores +// +// +// {vm.confg.cpu} +// +// +// +// +// RAM +// +// +// {vm.confg.ram} GB +// +// +// +// +// Disk Size +// +// +// {vm.confg.disk} GB +// +// +// +// +// Power +// +// +// {vm.power.toFixed(2)}W +// +// +// +// +// +// +// ); const getMessageColor = (message: string, theme: any): string => { if (message.includes('Error') || message.includes('BadRequestException')) { @@ -489,7 +489,7 @@ const Migration = () => { { await fetchVmPlacementData(); }} />