diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-02 18:39:28 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:21 +0200 |
| commit | f119fc78dda4d1e828dde04f378a63a93e3a0a7e (patch) | |
| tree | bea1eace5d47f21a7ccb835c6a6079bc92e48710 /frontend/src/components/app/map | |
| parent | 7f27a6370a0af25e1bf6ff8f46360c6c26c21e0b (diff) | |
Add current progress on frontend port
Diffstat (limited to 'frontend/src/components/app/map')
| -rw-r--r-- | frontend/src/components/app/map/LoadingScreen.js | 2 | ||||
| -rw-r--r-- | frontend/src/components/app/map/groups/RackGroup.js | 4 | ||||
| -rw-r--r-- | frontend/src/components/app/map/groups/RoomGroup.js | 6 | ||||
| -rw-r--r-- | frontend/src/components/app/map/groups/TileGroup.js | 10 | ||||
| -rw-r--r-- | frontend/src/components/app/map/groups/TopologyGroup.js (renamed from frontend/src/components/app/map/groups/DatacenterGroup.js) | 16 | ||||
| -rw-r--r-- | frontend/src/components/app/map/layers/MapLayerComponent.js | 4 |
6 files changed, 20 insertions, 22 deletions
diff --git a/frontend/src/components/app/map/LoadingScreen.js b/frontend/src/components/app/map/LoadingScreen.js index ca159982..1fd470fc 100644 --- a/frontend/src/components/app/map/LoadingScreen.js +++ b/frontend/src/components/app/map/LoadingScreen.js @@ -4,7 +4,7 @@ import FontAwesome from 'react-fontawesome' const LoadingScreen = () => ( <div className="display-4"> <FontAwesome name="refresh" className="mr-4" spin/> - Loading your datacenter... + Loading your topology... </div> ) diff --git a/frontend/src/components/app/map/groups/RackGroup.js b/frontend/src/components/app/map/groups/RackGroup.js index 708dcf69..6de939a9 100644 --- a/frontend/src/components/app/map/groups/RackGroup.js +++ b/frontend/src/components/app/map/groups/RackGroup.js @@ -22,12 +22,12 @@ const RackGroup = ({ tile, inSimulation, rackLoad }) => { /> <Group opacity={inSimulation ? 0.3 : 1}> <RackSpaceFillContainer - tileId={tile.id} + tileId={tile._id} positionX={tile.positionX} positionY={tile.positionY} /> <RackEnergyFillContainer - tileId={tile.id} + tileId={tile._id} positionX={tile.positionX} positionY={tile.positionY} /> diff --git a/frontend/src/components/app/map/groups/RoomGroup.js b/frontend/src/components/app/map/groups/RoomGroup.js index 230e3c9b..4e3c7410 100644 --- a/frontend/src/components/app/map/groups/RoomGroup.js +++ b/frontend/src/components/app/map/groups/RoomGroup.js @@ -11,7 +11,7 @@ const RoomGroup = ({ currentRoomInConstruction, onClick, }) => { - if (currentRoomInConstruction === room.id) { + if (currentRoomInConstruction === room._id) { return ( <Group onClick={onClick}> {room.tileIds.map(tileId => ( @@ -27,7 +27,7 @@ const RoomGroup = ({ if ( (interactionLevel.mode === 'RACK' || interactionLevel.mode === 'MACHINE') && - interactionLevel.roomId === room.id + interactionLevel.roomId === room._id ) { return [ room.tileIds @@ -44,7 +44,7 @@ const RoomGroup = ({ )) } })()} - <WallContainer roomId={room.id}/> + <WallContainer roomId={room._id}/> </Group> ) } diff --git a/frontend/src/components/app/map/groups/TileGroup.js b/frontend/src/components/app/map/groups/TileGroup.js index 49e2e52b..54f4ae17 100644 --- a/frontend/src/components/app/map/groups/TileGroup.js +++ b/frontend/src/components/app/map/groups/TileGroup.js @@ -9,12 +9,10 @@ import RoomTile from '../elements/RoomTile' const TileGroup = ({ tile, newTile, inSimulation, roomLoad, onClick }) => { let tileObject - switch (tile.objectType) { - case 'RACK': - tileObject = <RackContainer tile={tile}/> - break - default: - tileObject = null + if (tile.rackId) { + tileObject = <RackContainer tile={tile}/> + } else { + tileObject = null } let color = ROOM_DEFAULT_COLOR diff --git a/frontend/src/components/app/map/groups/DatacenterGroup.js b/frontend/src/components/app/map/groups/TopologyGroup.js index 3d3b9702..a40a1d41 100644 --- a/frontend/src/components/app/map/groups/DatacenterGroup.js +++ b/frontend/src/components/app/map/groups/TopologyGroup.js @@ -4,15 +4,15 @@ import GrayContainer from '../../../../containers/app/map/GrayContainer' import RoomContainer from '../../../../containers/app/map/RoomContainer' import Shapes from '../../../../shapes/index' -const DatacenterGroup = ({ datacenter, interactionLevel }) => { - if (!datacenter) { +const TopologyGroup = ({ topology, interactionLevel }) => { + if (!topology) { return <Group/> } if (interactionLevel.mode === 'BUILDING') { return ( <Group> - {datacenter.roomIds.map(roomId => ( + {topology.roomIds.map(roomId => ( <RoomContainer key={roomId} roomId={roomId}/> ))} </Group> @@ -21,20 +21,20 @@ const DatacenterGroup = ({ datacenter, interactionLevel }) => { return ( <Group> - {datacenter.roomIds + {topology.roomIds .filter(roomId => roomId !== interactionLevel.roomId) .map(roomId => <RoomContainer key={roomId} roomId={roomId}/>)} {interactionLevel.mode === 'ROOM' ? <GrayContainer/> : null} - {datacenter.roomIds + {topology.roomIds .filter(roomId => roomId === interactionLevel.roomId) .map(roomId => <RoomContainer key={roomId} roomId={roomId}/>)} </Group> ) } -DatacenterGroup.propTypes = { - datacenter: Shapes.Datacenter, +TopologyGroup.propTypes = { + topology: Shapes.Topology, interactionLevel: Shapes.InteractionLevel, } -export default DatacenterGroup +export default TopologyGroup diff --git a/frontend/src/components/app/map/layers/MapLayerComponent.js b/frontend/src/components/app/map/layers/MapLayerComponent.js index 1a31f2b9..940057f9 100644 --- a/frontend/src/components/app/map/layers/MapLayerComponent.js +++ b/frontend/src/components/app/map/layers/MapLayerComponent.js @@ -1,6 +1,6 @@ import React from 'react' import { Group, Layer } from 'react-konva' -import DatacenterContainer from '../../../../containers/app/map/DatacenterContainer' +import TopologyContainer from '../../../../containers/app/map/TopologyContainer' import Backdrop from '../elements/Backdrop' import GridGroup from '../groups/GridGroup' @@ -13,7 +13,7 @@ const MapLayerComponent = ({ mapPosition, mapScale }) => ( scaleY={mapScale} > <Backdrop/> - <DatacenterContainer/> + <TopologyContainer/> <GridGroup/> </Group> </Layer> |
