import React, { useState, useEffect } from "react"; import { useSelector, useDispatch } from "react-redux"; import { Card, CardHeader, CardTitle, Button } from "reactstrap"; import DataTable from "react-data-table-component"; import { ChevronDown, RefreshCw, Server, Monitor } from "react-feather"; import { useTranslation } from "react-i18next"; import { useSnackbar } from "notistack"; import { getDataCenters } from "../redux/actions/dataCenter"; import SpinnerComponent from "../@core/components/spinner/Fallback-spinner"; const DataCenter = () => { const { t } = useTranslation(); const { enqueueSnackbar } = useSnackbar(); const dispatch = useDispatch(); // Redux state const dataCenterStore = useSelector((state) => state.dataCenter); const [refreshInterval, setRefreshInterval] = useState(null); const getAllPhysicalMachines = (dataCenter) => { // Physical machines are directly in the dataCenter object, not in projects const pms = dataCenter.physicalMachines || []; return pms; }; // Table columns following your pattern const initialColumns = [ { name: "External ID", selector: (row) => row.externalId, sortable: true, minWidth: "100px", }, { name: "Data Centers", selector: (row) => row.dataCenter, sortable: true, minWidth: "200px", }, // Projects - Based on API response, this field might not exist or be structured differently // { // name: "Projects", // selector: (row) => row.projects?.length || 0, // sortable: true, // minWidth: "200px", // cell: (row) => ( //
No physical machines
)} {physicalMachines.map((pm) => (| Name | Status | Power (W) | Configuration | Host |
|---|---|---|---|---|
| {vm.vmName || vm.vm_name} |
{vm.state}
|
{vm.power ? ( {vm.power.toFixed(2)} ) : ( - )} |
CPU
{vm.config?.cpu ||
(vm.confg && vm.confg[1]) ||
"-"}
RAM
{vm.config?.ram ||
(vm.confg && vm.confg[2]) ||
"-"}{" "}
GB
Disk
{vm.config?.disk ||
(vm.confg && vm.confg[3]) ||
"-"}{" "}
GB
|
|
No virtual machines found
No data centers found