summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/app/map/groups
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-25 14:53:54 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-25 14:53:54 +0200
commitaa9b32f8cd1467e9718959f400f6777e5d71737d (patch)
treeb88bbede15108c6855d7f94ded4c7054df186a72 /opendc-web/opendc-web-ui/src/components/app/map/groups
parenteb0e0a3bc557c05a70eead388797ab850ea87366 (diff)
parentb7a71e5b4aa77b41ef41deec2ace42b67a5a13a7 (diff)
merge: Integrate v2.1 progress into public repository
This pull request integrates the changes planned for the v2.1 release of OpenDC into the public Github repository in order to sync the progress of both repositories.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/app/map/groups')
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/groups/GridGroup.js34
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/groups/RackGroup.js25
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/groups/RoomGroup.js48
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/groups/TileGroup.js35
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/groups/TopologyGroup.js44
-rw-r--r--opendc-web/opendc-web-ui/src/components/app/map/groups/WallGroup.js22
6 files changed, 0 insertions, 208 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/groups/GridGroup.js b/opendc-web/opendc-web-ui/src/components/app/map/groups/GridGroup.js
deleted file mode 100644
index ebc00244..00000000
--- a/opendc-web/opendc-web-ui/src/components/app/map/groups/GridGroup.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import React from 'react'
-import { Group, Line } from 'react-konva'
-import { GRID_COLOR } from '../../../../util/colors'
-import { GRID_LINE_WIDTH_IN_PIXELS, MAP_SIZE, MAP_SIZE_IN_PIXELS, TILE_SIZE_IN_PIXELS } from '../MapConstants'
-
-const MAP_COORDINATE_ENTRIES = Array.from(new Array(MAP_SIZE), (x, i) => i)
-const HORIZONTAL_POINT_PAIRS = MAP_COORDINATE_ENTRIES.map((index) => [
- 0,
- index * TILE_SIZE_IN_PIXELS,
- MAP_SIZE_IN_PIXELS,
- index * TILE_SIZE_IN_PIXELS,
-])
-const VERTICAL_POINT_PAIRS = MAP_COORDINATE_ENTRIES.map((index) => [
- index * TILE_SIZE_IN_PIXELS,
- 0,
- index * TILE_SIZE_IN_PIXELS,
- MAP_SIZE_IN_PIXELS,
-])
-
-const GridGroup = () => (
- <Group>
- {HORIZONTAL_POINT_PAIRS.concat(VERTICAL_POINT_PAIRS).map((points, index) => (
- <Line
- key={index}
- points={points}
- stroke={GRID_COLOR}
- strokeWidth={GRID_LINE_WIDTH_IN_PIXELS}
- listening={false}
- />
- ))}
- </Group>
-)
-
-export default GridGroup
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/groups/RackGroup.js b/opendc-web/opendc-web-ui/src/components/app/map/groups/RackGroup.js
deleted file mode 100644
index eb6dc24a..00000000
--- a/opendc-web/opendc-web-ui/src/components/app/map/groups/RackGroup.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react'
-import { Group } from 'react-konva'
-import RackEnergyFillContainer from '../../../../containers/app/map/RackEnergyFillContainer'
-import RackSpaceFillContainer from '../../../../containers/app/map/RackSpaceFillContainer'
-import Shapes from '../../../../shapes/index'
-import { RACK_BACKGROUND_COLOR } from '../../../../util/colors'
-import TileObject from '../elements/TileObject'
-
-const RackGroup = ({ tile }) => {
- return (
- <Group>
- <TileObject positionX={tile.positionX} positionY={tile.positionY} color={RACK_BACKGROUND_COLOR} />
- <Group>
- <RackSpaceFillContainer tileId={tile._id} positionX={tile.positionX} positionY={tile.positionY} />
- <RackEnergyFillContainer tileId={tile._id} positionX={tile.positionX} positionY={tile.positionY} />
- </Group>
- </Group>
- )
-}
-
-RackGroup.propTypes = {
- tile: Shapes.Tile,
-}
-
-export default RackGroup
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/groups/RoomGroup.js b/opendc-web/opendc-web-ui/src/components/app/map/groups/RoomGroup.js
deleted file mode 100644
index 1fd54687..00000000
--- a/opendc-web/opendc-web-ui/src/components/app/map/groups/RoomGroup.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import React from 'react'
-import { Group } from 'react-konva'
-import GrayContainer from '../../../../containers/app/map/GrayContainer'
-import TileContainer from '../../../../containers/app/map/TileContainer'
-import WallContainer from '../../../../containers/app/map/WallContainer'
-import Shapes from '../../../../shapes/index'
-
-const RoomGroup = ({ room, interactionLevel, currentRoomInConstruction, onClick }) => {
- if (currentRoomInConstruction === room._id) {
- return (
- <Group onClick={onClick}>
- {room.tileIds.map((tileId) => (
- <TileContainer key={tileId} tileId={tileId} newTile={true} />
- ))}
- </Group>
- )
- }
-
- return (
- <Group onClick={onClick}>
- {(() => {
- if (
- (interactionLevel.mode === 'RACK' || interactionLevel.mode === 'MACHINE') &&
- interactionLevel.roomId === room._id
- ) {
- return [
- room.tileIds
- .filter((tileId) => tileId !== interactionLevel.tileId)
- .map((tileId) => <TileContainer key={tileId} tileId={tileId} />),
- <GrayContainer key={-1} />,
- room.tileIds
- .filter((tileId) => tileId === interactionLevel.tileId)
- .map((tileId) => <TileContainer key={tileId} tileId={tileId} />),
- ]
- } else {
- return room.tileIds.map((tileId) => <TileContainer key={tileId} tileId={tileId} />)
- }
- })()}
- <WallContainer roomId={room._id} />
- </Group>
- )
-}
-
-RoomGroup.propTypes = {
- room: Shapes.Room,
-}
-
-export default RoomGroup
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/groups/TileGroup.js b/opendc-web/opendc-web-ui/src/components/app/map/groups/TileGroup.js
deleted file mode 100644
index 1e106823..00000000
--- a/opendc-web/opendc-web-ui/src/components/app/map/groups/TileGroup.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import PropTypes from 'prop-types'
-import React from 'react'
-import { Group } from 'react-konva'
-import RackContainer from '../../../../containers/app/map/RackContainer'
-import Shapes from '../../../../shapes/index'
-import { ROOM_DEFAULT_COLOR, ROOM_IN_CONSTRUCTION_COLOR } from '../../../../util/colors'
-import RoomTile from '../elements/RoomTile'
-
-const TileGroup = ({ tile, newTile, roomLoad, onClick }) => {
- let tileObject
- if (tile.rackId) {
- tileObject = <RackContainer tile={tile} />
- } else {
- tileObject = null
- }
-
- let color = ROOM_DEFAULT_COLOR
- if (newTile) {
- color = ROOM_IN_CONSTRUCTION_COLOR
- }
-
- return (
- <Group onClick={() => onClick(tile)}>
- <RoomTile tile={tile} color={color} />
- {tileObject}
- </Group>
- )
-}
-
-TileGroup.propTypes = {
- tile: Shapes.Tile,
- newTile: PropTypes.bool,
-}
-
-export default TileGroup
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/groups/TopologyGroup.js b/opendc-web/opendc-web-ui/src/components/app/map/groups/TopologyGroup.js
deleted file mode 100644
index 6096fc8b..00000000
--- a/opendc-web/opendc-web-ui/src/components/app/map/groups/TopologyGroup.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import React from 'react'
-import { Group } from 'react-konva'
-import GrayContainer from '../../../../containers/app/map/GrayContainer'
-import RoomContainer from '../../../../containers/app/map/RoomContainer'
-import Shapes from '../../../../shapes/index'
-
-const TopologyGroup = ({ topology, interactionLevel }) => {
- if (!topology) {
- return <Group />
- }
-
- if (interactionLevel.mode === 'BUILDING') {
- return (
- <Group>
- {topology.roomIds.map((roomId) => (
- <RoomContainer key={roomId} roomId={roomId} />
- ))}
- </Group>
- )
- }
-
- return (
- <Group>
- {topology.roomIds
- .filter((roomId) => roomId !== interactionLevel.roomId)
- .map((roomId) => (
- <RoomContainer key={roomId} roomId={roomId} />
- ))}
- {interactionLevel.mode === 'ROOM' ? <GrayContainer /> : null}
- {topology.roomIds
- .filter((roomId) => roomId === interactionLevel.roomId)
- .map((roomId) => (
- <RoomContainer key={roomId} roomId={roomId} />
- ))}
- </Group>
- )
-}
-
-TopologyGroup.propTypes = {
- topology: Shapes.Topology,
- interactionLevel: Shapes.InteractionLevel,
-}
-
-export default TopologyGroup
diff --git a/opendc-web/opendc-web-ui/src/components/app/map/groups/WallGroup.js b/opendc-web/opendc-web-ui/src/components/app/map/groups/WallGroup.js
deleted file mode 100644
index 7b0f5ca0..00000000
--- a/opendc-web/opendc-web-ui/src/components/app/map/groups/WallGroup.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import PropTypes from 'prop-types'
-import React from 'react'
-import { Group } from 'react-konva'
-import Shapes from '../../../../shapes/index'
-import { deriveWallLocations } from '../../../../util/tile-calculations'
-import WallSegment from '../elements/WallSegment'
-
-const WallGroup = ({ tiles }) => {
- return (
- <Group>
- {deriveWallLocations(tiles).map((wallSegment, index) => (
- <WallSegment key={index} wallSegment={wallSegment} />
- ))}
- </Group>
- )
-}
-
-WallGroup.propTypes = {
- tiles: PropTypes.arrayOf(Shapes.Tile).isRequired,
-}
-
-export default WallGroup