import React from "react";
import Shapes from "../../../../../shapes";
import { convertLoadToSimulationColor } from "../../../../../util/simulation-load";
const UnitIcon = ({ id, type }) => (
);
const MachineComponent = ({
position,
machine,
inSimulation,
machineLoad,
onClick
}) => {
let color = "white";
if (inSimulation && machineLoad >= 0) {
color = convertLoadToSimulationColor(machineLoad);
}
const hasNoUnits =
machine.cpuIds.length +
machine.gpuIds.length +
machine.memoryIds.length +
machine.storageIds.length ===
0;
return (
{position}
{machine.cpuIds.length > 0 ? (
) : (
undefined
)}
{machine.gpuIds.length > 0 ? (
) : (
undefined
)}
{machine.memoryIds.length > 0 ? (
) : (
undefined
)}
{machine.storageIds.length > 0 ? (
) : (
undefined
)}
{hasNoUnits ? (
Machine with no units
) : (
undefined
)}
);
};
MachineComponent.propTypes = {
machine: Shapes.Machine
};
export default MachineComponent;