From a08deff7909b68a89662f8b93845918bdc613732 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 7 Sep 2017 17:22:24 +0200 Subject: Finish rack mode machine list rendering --- .../sidebars/topology/rack/EmptySlotComponent.js | 14 +++--- .../sidebars/topology/rack/MachineComponent.js | 54 ++++++++++++++++------ .../sidebars/topology/rack/MachineListComponent.js | 7 +-- .../topology/rack/MachineListComponent.sass | 2 + .../sidebars/topology/rack/RackSidebarComponent.js | 7 ++- .../topology/rack/RackSidebarComponent.sass | 8 ++++ 6 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 src/components/sidebars/topology/rack/MachineListComponent.sass create mode 100644 src/components/sidebars/topology/rack/RackSidebarComponent.sass (limited to 'src/components/sidebars/topology') diff --git a/src/components/sidebars/topology/rack/EmptySlotComponent.js b/src/components/sidebars/topology/rack/EmptySlotComponent.js index 5234ee63..1ca13b67 100644 --- a/src/components/sidebars/topology/rack/EmptySlotComponent.js +++ b/src/components/sidebars/topology/rack/EmptySlotComponent.js @@ -2,13 +2,13 @@ import React from "react"; import FontAwesome from "react-fontawesome"; const EmptySlotComponent = ({position, onAdd}) => ( -
  • - - {position} - - Add machine -
  • ); diff --git a/src/components/sidebars/topology/rack/MachineComponent.js b/src/components/sidebars/topology/rack/MachineComponent.js index e328951e..56e723bc 100644 --- a/src/components/sidebars/topology/rack/MachineComponent.js +++ b/src/components/sidebars/topology/rack/MachineComponent.js @@ -1,23 +1,49 @@ import React from "react"; import Shapes from "../../../../shapes"; +const UnitIcon = ({id, type}) => ( +
    + {"Machine +
    +); + const MachineComponent = ({position, machine, onClick}) => ( -
  • - +
  • + {position} - - {machine.cpuIds.length} CPUs - - - {machine.gpuIds.length} GPUs - - - {machine.memoryIds.length} Memories - - - {machine.storageIds.length} Storages - +
    + {machine.cpuIds.length > 0 ? + : + undefined + } + {machine.gpuIds.length > 0 ? + : + undefined + } + {machine.memoryIds.length > 0 ? + : + undefined + } + {machine.storageIds.length > 0 ? + : + undefined + } + {machine.cpuIds.length + machine.gpuIds.length + machine.memoryIds.length + machine.storageIds.length === 0 ? + + Machine with no units + : + undefined + } +
  • ); diff --git a/src/components/sidebars/topology/rack/MachineListComponent.js b/src/components/sidebars/topology/rack/MachineListComponent.js index d8a31ddc..41522e36 100644 --- a/src/components/sidebars/topology/rack/MachineListComponent.js +++ b/src/components/sidebars/topology/rack/MachineListComponent.js @@ -1,15 +1,16 @@ import React from "react"; import EmptySlotContainer from "../../../../containers/sidebars/topology/rack/EmptySlotContainer"; import MachineContainer from "../../../../containers/sidebars/topology/rack/MachineContainer"; +import "./MachineListComponent.css"; const MachineListComponent = ({machineIds}) => { return ( -