summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/sidebars/topology/rack/MachineListComponent.js
blob: d55215573ae323ad5dfeef960fa9a2ac070933ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React from "react";
import EmptySlotContainer from "../../../../../containers/app/sidebars/topology/rack/EmptySlotContainer";
import MachineContainer from "../../../../../containers/app/sidebars/topology/rack/MachineContainer";
import "./MachineListComponent.css";

const MachineListComponent = ({ machineIds }) => {
  return (
    <ul className="list-group machine-list">
      {machineIds.map((machineId, index) => {
        if (machineId === null) {
          return <EmptySlotContainer key={index} position={index + 1} />;
        } else {
          return (
            <MachineContainer
              key={index}
              position={index + 1}
              machineId={machineId}
            />
          );
        }
      })}
    </ul>
  );
};

export default MachineListComponent;