summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-server/src/main/webui/components/topologies/sidebar/room/RackConstructionContainer.js
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-web/opendc-web-server/src/main/webui/components/topologies/sidebar/room/RackConstructionContainer.js')
-rw-r--r--opendc-web/opendc-web-server/src/main/webui/components/topologies/sidebar/room/RackConstructionContainer.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/opendc-web/opendc-web-server/src/main/webui/components/topologies/sidebar/room/RackConstructionContainer.js b/opendc-web/opendc-web-server/src/main/webui/components/topologies/sidebar/room/RackConstructionContainer.js
index e04287a5..70f1b8e6 100644
--- a/opendc-web/opendc-web-server/src/main/webui/components/topologies/sidebar/room/RackConstructionContainer.js
+++ b/opendc-web/opendc-web-server/src/main/webui/components/topologies/sidebar/room/RackConstructionContainer.js
@@ -22,21 +22,28 @@
import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
+import { useRouter } from 'next/router'
import { startRackConstruction, stopRackConstruction } from '../../../../redux/actions/topology/room'
+import { useRackPrefabs } from '../../../../data/rack-prefabs'
import RackConstructionComponent from './RackConstructionComponent'
function RackConstructionContainer(props) {
+ const router = useRouter()
+ const { project: projectId } = router.query
+ const { data: prefabs = [] } = useRackPrefabs(projectId)
+
const isRackConstructionMode = useSelector((state) => state.construction.inRackConstructionMode)
const isEditingRoom = useSelector((state) => state.construction.currentRoomInConstruction !== '-1')
const dispatch = useDispatch()
- const onStart = () => dispatch(startRackConstruction())
+ const onStart = (rackPrefab) => dispatch(startRackConstruction(rackPrefab))
const onStop = () => dispatch(stopRackConstruction())
return (
<RackConstructionComponent
{...props}
inRackConstructionMode={isRackConstructionMode}
isEditingRoom={isEditingRoom}
+ prefabs={prefabs}
onStart={onStart}
onStop={onStop}
/>