diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 390f4ac..eb154bb 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -42,9 +42,10 @@ import ErrorIcon from '@mui/icons-material/Error'; import AutoFixHighIcon from '@mui/icons-material/AutoFixHigh'; import HandymanIcon from '@mui/icons-material/Handyman'; import EditIcon from '@mui/icons-material/Edit'; -import { monitoringService, MonitoringStatus } from '../services/monitoringService'; +import { monitoringService } from '../services/monitoringService'; import DebugConsole from '../components/DebugConsole'; import MonitoringSystem from './MonitoringSystem'; +import { Weights, AlertState, MonitoringStatus } from '../types/monitoring'; // Professional, consistent card style (no animation) const StyledCard = styled(Paper)(({ theme }) => ({ @@ -890,10 +891,19 @@ const Home = () => { const config = { migration: { script_time_unit: migrationTime, - estimation_method: estimationMethod, - model_type: migrationModel, - migration_method: migrationMethod === 'mathematical' ? 'migration_advices_la' : 'migration_advices_llm', - operation_mode: migrationMode, + virtual_machine_estimation: { + estimation_method: estimationMethod, + model_type: migrationModel + }, + migration_advices: { + migration_method: migrationMethod === 'mathematical' ? 'migration_advices_la' : 'migration_advices_llm', + migration_weights: { + power: weights.energy.toString(), + balance: weights.balance.toString(), + overload: weights.overload.toString(), + allocation: weights.allocation.toString() + } + }, block_list: blockList }, environmental: { diff --git a/src/pages/MonitoringSystem.tsx b/src/pages/MonitoringSystem.tsx index 5173127..57261a8 100644 --- a/src/pages/MonitoringSystem.tsx +++ b/src/pages/MonitoringSystem.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useCallback } from 'react'; +import { useState, useEffect } from 'react'; import { Box, Paper, @@ -11,19 +11,8 @@ import { CircularProgress, Tooltip, Collapse, - Grid, - useTheme, - styled, - Chip, - FormControl, - InputLabel, - Select, - MenuItem, - FormControlLabel, Alert, Snackbar, - Tabs, - Tab, } from '@mui/material'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ChevronRightIcon from '@mui/icons-material/ChevronRight'; @@ -34,8 +23,6 @@ import ComputerIcon from '@mui/icons-material/Computer'; import MemoryIcon from '@mui/icons-material/Memory'; import RefreshIcon from '@mui/icons-material/Refresh'; import SaveIcon from '@mui/icons-material/Save'; -import SpeedIcon from '@mui/icons-material/Speed'; -import { stressService } from '../services/stressService'; // Define the structure of our tree nodes interface TreeNode { @@ -93,27 +80,6 @@ const areAllChildrenSelected = (node: TreeNode, selectedNodes: string[]): boolea }); }; -// Add new styled components for stress testing -const StressTestingCard = styled(Paper)(({ theme }) => ({ - padding: theme.spacing(3), - borderRadius: theme.spacing(2), - backgroundColor: theme.palette.background.paper, - marginBottom: theme.spacing(3), -})); - -const StressLevelChip = styled(Chip)<{ level: 'low' | 'medium' | 'high' }>(({ theme, level }) => ({ - borderRadius: theme.spacing(1), - fontWeight: 500, - backgroundColor: - level === 'low' ? theme.palette.success.light : - level === 'medium' ? theme.palette.warning.light : - theme.palette.error.light, - color: - level === 'low' ? theme.palette.success.dark : - level === 'medium' ? theme.palette.warning.dark : - theme.palette.error.dark, -})); - interface MonitoringSystemProps { onSave?: (unselectedVMs: string[], selectedVMs: string[]) => void; isDialog?: boolean; @@ -132,8 +98,6 @@ const MonitoringSystem: React.FC = ({ const [loading, setLoading] = useState(false); const [treeData, setTreeData] = useState([]); const [isViewMode, setIsViewMode] = useState(false); - const [selectedVMs, setSelectedVMs] = useState(initialSelectedVMs); - const [activeTab, setActiveTab] = useState(0); const [alert, setAlert] = useState<{ open: boolean; message: string; severity: 'success' | 'error' | 'info' }>({ open: false, message: '', diff --git a/src/pages/Test.tsx b/src/pages/Test.tsx index 52cbfa2..4c805aa 100644 --- a/src/pages/Test.tsx +++ b/src/pages/Test.tsx @@ -26,12 +26,6 @@ import SpeedIcon from '@mui/icons-material/Speed'; import ComputerIcon from '@mui/icons-material/Computer'; import { stressService } from '../services/stressService'; -const StyledPaper = styled(Paper)(({ theme }) => ({ - padding: theme.spacing(3), - borderRadius: theme.spacing(2), - height: '100%', -})); - const PageTitle = styled(Typography)(({ theme }) => ({ display: 'flex', alignItems: 'center', diff --git a/src/types/monitoring.ts b/src/types/monitoring.ts new file mode 100644 index 0000000..5cb446e --- /dev/null +++ b/src/types/monitoring.ts @@ -0,0 +1,47 @@ +export interface Weights { + energy: number; + balance: number; + overload: number; + allocation: number; +} + +export interface AlertState { + open: boolean; + message: string; + severity: 'error' | 'warning' | 'info' | 'success'; +} + +export interface MonitoringStatus { + statuses: { + migration: { + is_running: boolean; + }; + environmental: { + is_running: boolean; + }; + preventive: { + is_running: boolean; + }; + }; +} + +export interface MonitoringConfig { + migration: { + script_time_unit: string; + estimation_method: 'direct' | 'indirect'; + model_type: string; + migration_method: string; + operation_mode: 'auto' | 'semiauto'; + block_list: string[]; + }; + environmental: { + number_of_steps: string; + script_time_unit: string; + model_type: string; + }; + preventive: { + number_of_steps: string; + script_time_unit: string; + model_type: string; + }; +} \ No newline at end of file