summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/sidebars
diff options
context:
space:
mode:
authorjc0b <j@jc0b.computer>2020-07-22 16:28:47 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:21 +0200
commitd7469b9ebb01cf36a78cc98aab31fa8f307c4f65 (patch)
treed0535fa0cfe95001302fbd2b0d046d51caab6ffd /frontend/src/components/app/sidebars
parent67b6ec800df8e023efadb60ae5f7919030b19789 (diff)
parent9e7cb3bd367607b32e102c3a87b68b33c53dec46 (diff)
Merge branch 'master' onto working copy
Diffstat (limited to 'frontend/src/components/app/sidebars')
-rw-r--r--frontend/src/components/app/sidebars/Sidebar.js17
-rw-r--r--frontend/src/components/app/sidebars/Sidebar.sass2
-rw-r--r--frontend/src/components/app/sidebars/elements/LoadChartComponent.js84
-rw-r--r--frontend/src/components/app/sidebars/project/PortfolioListComponent.js17
-rw-r--r--frontend/src/components/app/sidebars/project/ProjectSidebarComponent.js14
-rw-r--r--frontend/src/components/app/sidebars/project/ScenarioListComponent.js20
-rw-r--r--frontend/src/components/app/sidebars/project/TopologyListComponent.js13
-rw-r--r--frontend/src/components/app/sidebars/topology/NameComponent.js2
-rw-r--r--frontend/src/components/app/sidebars/topology/TopologySidebarComponent.js8
-rw-r--r--frontend/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js5
-rw-r--r--frontend/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js13
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js2
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js2
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js4
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js8
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js13
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/UnitComponent.js14
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js7
-rw-r--r--frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js37
-rw-r--r--frontend/src/components/app/sidebars/topology/rack/BackToRoomComponent.js2
-rw-r--r--frontend/src/components/app/sidebars/topology/rack/DeleteRackComponent.js2
-rw-r--r--frontend/src/components/app/sidebars/topology/rack/EmptySlotComponent.js6
-rw-r--r--frontend/src/components/app/sidebars/topology/rack/MachineComponent.js44
-rw-r--r--frontend/src/components/app/sidebars/topology/rack/MachineListComponent.js10
-rw-r--r--frontend/src/components/app/sidebars/topology/rack/RackNameComponent.js4
-rw-r--r--frontend/src/components/app/sidebars/topology/rack/RackSidebarComponent.js8
-rw-r--r--frontend/src/components/app/sidebars/topology/room/BackToBuildingComponent.js2
-rw-r--r--frontend/src/components/app/sidebars/topology/room/DeleteRoomComponent.js2
-rw-r--r--frontend/src/components/app/sidebars/topology/room/EditRoomComponent.js11
-rw-r--r--frontend/src/components/app/sidebars/topology/room/RackConstructionComponent.js11
-rw-r--r--frontend/src/components/app/sidebars/topology/room/RoomNameComponent.js4
-rw-r--r--frontend/src/components/app/sidebars/topology/room/RoomSidebarComponent.js10
32 files changed, 119 insertions, 279 deletions
diff --git a/frontend/src/components/app/sidebars/Sidebar.js b/frontend/src/components/app/sidebars/Sidebar.js
index a47a67c0..e1760d5e 100644
--- a/frontend/src/components/app/sidebars/Sidebar.js
+++ b/frontend/src/components/app/sidebars/Sidebar.js
@@ -10,7 +10,7 @@ class Sidebar extends React.Component {
}
static defaultProps = {
- collapsible: true
+ collapsible: true,
}
state = {
@@ -25,17 +25,10 @@ class Sidebar extends React.Component {
})}
onClick={() => this.setState({ collapsed: !this.state.collapsed })}
>
- {(this.state.collapsed && this.props.isRight) ||
- (!this.state.collapsed && !this.props.isRight) ? (
- <span
- className="fa fa-angle-left"
- title={this.props.isRight ? 'Expand' : 'Collapse'}
- />
+ {(this.state.collapsed && this.props.isRight) || (!this.state.collapsed && !this.props.isRight) ? (
+ <span className="fa fa-angle-left" title={this.props.isRight ? 'Expand' : 'Collapse'} />
) : (
- <span
- className="fa fa-angle-right"
- title={this.props.isRight ? 'Collapse' : 'Expand'}
- />
+ <span className="fa fa-angle-right" title={this.props.isRight ? 'Collapse' : 'Expand'} />
)}
</div>
)
@@ -48,7 +41,7 @@ class Sidebar extends React.Component {
className={classNames('sidebar p-3 h-100', {
'sidebar-right': this.props.isRight,
})}
- onWheel={e => e.stopPropagation()}
+ onWheel={(e) => e.stopPropagation()}
>
{this.props.children}
{this.props.collapsible && collapseButton}
diff --git a/frontend/src/components/app/sidebars/Sidebar.sass b/frontend/src/components/app/sidebars/Sidebar.sass
index 02e8940d..b8e15716 100644
--- a/frontend/src/components/app/sidebars/Sidebar.sass
+++ b/frontend/src/components/app/sidebars/Sidebar.sass
@@ -27,7 +27,7 @@
position: absolute
top: 0
left: 0
- width: 350px
+ width: $side-bar-width
z-index: 100
background: white
diff --git a/frontend/src/components/app/sidebars/elements/LoadChartComponent.js b/frontend/src/components/app/sidebars/elements/LoadChartComponent.js
deleted file mode 100644
index ae52891a..00000000
--- a/frontend/src/components/app/sidebars/elements/LoadChartComponent.js
+++ /dev/null
@@ -1,84 +0,0 @@
-import React from 'react'
-import ReactDOM from 'react-dom/server'
-import SvgSaver from 'svgsaver'
-import { VictoryAxis, VictoryChart, VictoryLabel, VictoryLine, VictoryScatter } from 'victory'
-import { convertSecondsToFormattedTime } from '../../../../util/date-time'
-
-const LoadChartComponent = ({ data, currentTick }) => {
- const onExport = () => {
- const div = document.createElement('div')
- div.innerHTML = ReactDOM.renderToString(
- <VictoryChartComponent
- data={data}
- currentTick={currentTick}
- showCurrentTick={false}
- />,
- )
- div.firstChild.style =
- 'font-family: Roboto, Arial, sans-serif; font-size: 10pt;'
- const svgSaver = new SvgSaver()
- svgSaver.asSvg(
- div.firstChild,
- 'opendc-chart-export-' + Date.now() + '.svg',
- )
- }
-
- return (
- <div className="mt-1" style={{ position: 'relative' }}>
- <strong>Load over time</strong>
- <VictoryChartComponent
- data={data}
- currentTick={currentTick}
- showCurrentTick={true}
- />
- <ExportChartComponent onExport={onExport}/>
- </div>
- )
-}
-
-const VictoryChartComponent = ({ data, currentTick, showCurrentTick }) => (
- <VictoryChart
- height={250}
- padding={{ top: 10, bottom: 50, left: 50, right: 50 }}
- >
- <VictoryAxis
- tickFormat={tick => convertSecondsToFormattedTime(tick)}
- fixLabelOverlap={true}
- label="Simulated Time"
- />
- <VictoryAxis dependentAxis label="Load"/>
- <VictoryLine data={data}/>
- <VictoryScatter data={data}/>
- {showCurrentTick ? (
- <VictoryLine
- labelComponent={
- <VictoryLabel renderInPortal angle={90} dy={-5} dx={60}/>
- }
- data={[{ x: currentTick + 1, y: 0 }, { x: currentTick + 1, y: 1 }]}
- labels={point =>
- point.y === 1
- ? 'Current tick : ' + convertSecondsToFormattedTime(currentTick)
- : ''}
- style={{
- data: { stroke: '#00A6D6', strokeWidth: 4 },
- labels: { fill: '#00A6D6' },
- }}
- />
- ) : (
- undefined
- )}
- </VictoryChart>
-)
-
-const ExportChartComponent = ({ onExport }) => (
- <button
- className="btn btn-success btn-circle btn-sm"
- title="Export Chart to PNG Image"
- onClick={onExport}
- style={{ position: 'absolute', top: 0, right: 0 }}
- >
- <span className="fa fa-camera"/>
- </button>
-)
-
-export default LoadChartComponent
diff --git a/frontend/src/components/app/sidebars/project/PortfolioListComponent.js b/frontend/src/components/app/sidebars/project/PortfolioListComponent.js
index a31f11cf..b000b9e2 100644
--- a/frontend/src/components/app/sidebars/project/PortfolioListComponent.js
+++ b/frontend/src/components/app/sidebars/project/PortfolioListComponent.js
@@ -24,8 +24,11 @@ class PortfolioListComponent extends React.Component {
<div className="pb-3">
<h2>
Portfolios
- <button className="btn btn-outline-primary float-right" onClick={this.props.onNewPortfolio.bind(this)}>
- <FontAwesome name="plus"/>
+ <button
+ className="btn btn-outline-primary float-right"
+ onClick={this.props.onNewPortfolio.bind(this)}
+ >
+ <FontAwesome name="plus" />
</button>
</h2>
@@ -33,10 +36,14 @@ class PortfolioListComponent extends React.Component {
<div key={portfolio._id}>
<div className="row mb-1">
<div
- className={'col-8 align-self-center ' + (portfolio._id === this.props.currentPortfolioId ? 'font-weight-bold' : '')}>
+ className={
+ 'col-7 align-self-center ' +
+ (portfolio._id === this.props.currentPortfolioId ? 'font-weight-bold' : '')
+ }
+ >
{portfolio.name}
</div>
- <div className="col-4 text-right">
+ <div className="col-5 text-right">
<Link
className="btn btn-outline-primary mr-1 fa fa-play"
to={`/projects/${this.props.currentProjectId}/portfolios/${portfolio._id}`}
@@ -48,7 +55,7 @@ class PortfolioListComponent extends React.Component {
/>
</div>
</div>
- <ScenarioListContainer portfolioId={portfolio._id}/>
+ <ScenarioListContainer portfolioId={portfolio._id} />
</div>
))}
</div>
diff --git a/frontend/src/components/app/sidebars/project/ProjectSidebarComponent.js b/frontend/src/components/app/sidebars/project/ProjectSidebarComponent.js
index b21b012b..4789315e 100644
--- a/frontend/src/components/app/sidebars/project/ProjectSidebarComponent.js
+++ b/frontend/src/components/app/sidebars/project/ProjectSidebarComponent.js
@@ -3,11 +3,13 @@ import Sidebar from '../Sidebar'
import TopologyListContainer from '../../../../containers/app/sidebars/project/TopologyListContainer'
import PortfolioListContainer from '../../../../containers/app/sidebars/project/PortfolioListContainer'
-const ProjectSidebarComponent = ({collapsible}) => (
- <Sidebar isRight={false} collapsible={collapsible}>
- <TopologyListContainer/>
- <PortfolioListContainer/>
- </Sidebar>
- )
+const ProjectSidebarComponent = ({ collapsible }) => (
+ <Sidebar isRight={false} collapsible={collapsible}>
+ <div className="h-100 overflow-auto container-fluid">
+ <TopologyListContainer />
+ <PortfolioListContainer />
+ </div>
+ </Sidebar>
+)
export default ProjectSidebarComponent
diff --git a/frontend/src/components/app/sidebars/project/ScenarioListComponent.js b/frontend/src/components/app/sidebars/project/ScenarioListComponent.js
index 9d2e261e..e775a663 100644
--- a/frontend/src/components/app/sidebars/project/ScenarioListComponent.js
+++ b/frontend/src/components/app/sidebars/project/ScenarioListComponent.js
@@ -24,25 +24,33 @@ class ScenarioListComponent extends React.Component {
<>
{this.props.scenarios.map((scenario, idx) => (
<div key={scenario._id} className="row mb-1">
- <div className={'col-8 pl-5 align-self-center ' + (scenario._id === this.props.currentScenarioId ? 'font-weight-bold' : '')}>
+ <div
+ className={
+ 'col-7 pl-5 align-self-center ' +
+ (scenario._id === this.props.currentScenarioId ? 'font-weight-bold' : '')
+ }
+ >
{scenario.name}
</div>
- <div className="col-4 text-right">
+ <div className="col-5 text-right">
<Link
- className="btn btn-outline-primary mr-1 fa fa-play"
+ className="btn btn-outline-primary mr-1 fa fa-play disabled"
to={`/projects/${this.props.currentProjectId}/portfolios/${scenario.portfolioId}/scenarios/${scenario._id}`}
onClick={() => this.props.onChooseScenario(scenario.portfolioId, scenario._id)}
/>
<span
className={'btn btn-outline-danger fa fa-trash ' + (idx === 0 ? 'disabled' : '')}
- onClick={() => idx !== 0 ? this.onDelete(scenario._id) : undefined}
+ onClick={() => (idx !== 0 ? this.onDelete(scenario._id) : undefined)}
/>
</div>
</div>
))}
<div className="pl-4 mb-2">
- <div className="btn btn-outline-primary" onClick={() => this.props.onNewScenario(this.props.portfolioId)}>
- <FontAwesome name="plus" className="mr-1"/>
+ <div
+ className="btn btn-outline-primary"
+ onClick={() => this.props.onNewScenario(this.props.portfolioId)}
+ >
+ <FontAwesome name="plus" className="mr-1" />
New scenario
</div>
</div>
diff --git a/frontend/src/components/app/sidebars/project/TopologyListComponent.js b/frontend/src/components/app/sidebars/project/TopologyListComponent.js
index b8b41200..2f42f7e4 100644
--- a/frontend/src/components/app/sidebars/project/TopologyListComponent.js
+++ b/frontend/src/components/app/sidebars/project/TopologyListComponent.js
@@ -26,23 +26,28 @@ class TopologyListComponent extends React.Component {
<h2>
Topologies
<button className="btn btn-outline-primary float-right" onClick={this.props.onNewTopology}>
- <FontAwesome name="plus"/>
+ <FontAwesome name="plus" />
</button>
</h2>
{this.props.topologies.map((topology, idx) => (
<div key={topology._id} className="row mb-1">
- <div className={'col-8 align-self-center ' + (topology._id === this.props.currentTopologyId ? 'font-weight-bold' : '')}>
+ <div
+ className={
+ 'col-7 align-self-center ' +
+ (topology._id === this.props.currentTopologyId ? 'font-weight-bold' : '')
+ }
+ >
{topology.name}
</div>
- <div className="col-4 text-right">
+ <div className="col-5 text-right">
<span
className="btn btn-outline-primary mr-1 fa fa-play"
onClick={() => this.onChoose(topology._id)}
/>
<span
className={'btn btn-outline-danger fa fa-trash ' + (idx === 0 ? 'disabled' : '')}
- onClick={() => idx !== 0 ? this.onDelete(topology._id) : undefined}
+ onClick={() => (idx !== 0 ? this.onDelete(topology._id) : undefined)}
/>
</div>
</div>
diff --git a/frontend/src/components/app/sidebars/topology/NameComponent.js b/frontend/src/components/app/sidebars/topology/NameComponent.js
index 1f3051d5..5fb0dc55 100644
--- a/frontend/src/components/app/sidebars/topology/NameComponent.js
+++ b/frontend/src/components/app/sidebars/topology/NameComponent.js
@@ -5,7 +5,7 @@ const NameComponent = ({ name, onEdit }) => (
<h2>
{name}
<button className="btn btn-outline-secondary float-right" onClick={onEdit}>
- <FontAwesome name="pencil"/>
+ <FontAwesome name="pencil" />
</button>
</h2>
)
diff --git a/frontend/src/components/app/sidebars/topology/TopologySidebarComponent.js b/frontend/src/components/app/sidebars/topology/TopologySidebarComponent.js
index b1def94b..f5eee36b 100644
--- a/frontend/src/components/app/sidebars/topology/TopologySidebarComponent.js
+++ b/frontend/src/components/app/sidebars/topology/TopologySidebarComponent.js
@@ -10,16 +10,16 @@ const TopologySidebarComponent = ({ interactionLevel }) => {
switch (interactionLevel.mode) {
case 'BUILDING':
- sidebarContent = <BuildingSidebarContainer/>
+ sidebarContent = <BuildingSidebarContainer />
break
case 'ROOM':
- sidebarContent = <RoomSidebarContainer/>
+ sidebarContent = <RoomSidebarContainer />
break
case 'RACK':
- sidebarContent = <RackSidebarContainer/>
+ sidebarContent = <RackSidebarContainer />
break
case 'MACHINE':
- sidebarContent = <MachineSidebarContainer/>
+ sidebarContent = <MachineSidebarContainer />
break
default:
sidebarContent = 'Missing Content'
diff --git a/frontend/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js b/frontend/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js
index 4cc87798..eea62f84 100644
--- a/frontend/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js
+++ b/frontend/src/components/app/sidebars/topology/building/BuildingSidebarComponent.js
@@ -1,12 +1,11 @@
import React from 'react'
-import NewRoomConstructionContainer
- from '../../../../../containers/app/sidebars/topology/building/NewRoomConstructionContainer'
+import NewRoomConstructionContainer from '../../../../../containers/app/sidebars/topology/building/NewRoomConstructionContainer'
const BuildingSidebarComponent = () => {
return (
<div>
<h2>Building</h2>
- <NewRoomConstructionContainer/>
+ <NewRoomConstructionContainer />
</div>
)
}
diff --git a/frontend/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js b/frontend/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js
index 75b00c54..fd552c1e 100644
--- a/frontend/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js
+++ b/frontend/src/components/app/sidebars/topology/building/NewRoomConstructionComponent.js
@@ -1,15 +1,10 @@
import React from 'react'
-const NewRoomConstructionComponent = ({
- onStart,
- onFinish,
- onCancel,
- currentRoomInConstruction,
- }) => {
+const NewRoomConstructionComponent = ({ onStart, onFinish, onCancel, currentRoomInConstruction }) => {
if (currentRoomInConstruction === '-1') {
return (
<div className="btn btn-outline-primary btn-block" onClick={onStart}>
- <span className="fa fa-plus mr-2"/>
+ <span className="fa fa-plus mr-2" />
Construct a new room
</div>
)
@@ -17,11 +12,11 @@ const NewRoomConstructionComponent = ({
return (
<div>
<div className="btn btn-primary btn-block" onClick={onFinish}>
- <span className="fa fa-check mr-2"/>
+ <span className="fa fa-check mr-2" />
Finalize new room
</div>
<div className="btn btn-default btn-block" onClick={onCancel}>
- <span className="fa fa-times mr-2"/>
+ <span className="fa fa-times mr-2" />
Cancel construction
</div>
</div>
diff --git a/frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js b/frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js
index d7ce24bc..70d522b2 100644
--- a/frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/BackToRackComponent.js
@@ -2,7 +2,7 @@ import React from 'react'
const BackToRackComponent = ({ onClick }) => (
<div className="btn btn-secondary btn-block" onClick={onClick}>
- <span className="fa fa-angle-left mr-2"/>
+ <span className="fa fa-angle-left mr-2" />
Back to rack
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js b/frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js
index b9aa6251..37820316 100644
--- a/frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/DeleteMachineComponent.js
@@ -2,7 +2,7 @@ import React from 'react'
const DeleteMachineComponent = ({ onClick }) => (
<div className="btn btn-outline-danger btn-block" onClick={onClick}>
- <span className="fa fa-trash mr-2"/>
+ <span className="fa fa-trash mr-2" />
Delete this machine
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js b/frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js
index 70be6968..992383c4 100644
--- a/frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/MachineNameComponent.js
@@ -1,7 +1,5 @@
import React from 'react'
-const MachineNameComponent = ({ position }) => (
- <h2>Machine at slot {position}</h2>
-)
+const MachineNameComponent = ({ position }) => <h2>Machine at slot {position}</h2>
export default MachineNameComponent
diff --git a/frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js b/frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js
index d78c20eb..02e7b8d4 100644
--- a/frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/MachineSidebarComponent.js
@@ -7,10 +7,10 @@ import UnitTabsContainer from '../../../../../containers/app/sidebars/topology/m
const MachineSidebarComponent = ({ machineId }) => {
return (
<div>
- <MachineNameContainer/>
- <BackToRackContainer/>
- <DeleteMachineContainer/>
- <UnitTabsContainer/>
+ <MachineNameContainer />
+ <BackToRackContainer />
+ <DeleteMachineContainer />
+ <UnitTabsContainer />
</div>
)
}
diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js
index 98238de7..d5ecbce3 100644
--- a/frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/UnitAddComponent.js
@@ -11,11 +11,8 @@ class UnitAddComponent extends React.Component {
return (
<div className="form-inline">
<div className="form-group w-100">
- <select
- className="form-control w-75 mr-1"
- ref={unitSelect => (this.unitSelect = unitSelect)}
- >
- {this.props.units.map(unit => (
+ <select className="form-control w-75 mr-1" ref={(unitSelect) => (this.unitSelect = unitSelect)}>
+ {this.props.units.map((unit) => (
<option value={unit._id} key={unit._id}>
{unit.name}
</option>
@@ -24,11 +21,9 @@ class UnitAddComponent extends React.Component {
<button
type="submit"
className="btn btn-outline-primary"
- onClick={() =>
- this.props.onAdd(this.unitSelect.value)
- }
+ onClick={() => this.props.onAdd(this.unitSelect.value)}
>
- <span className="fa fa-plus mr-2"/>
+ <span className="fa fa-plus mr-2" />
Add
</button>
</div>
diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitComponent.js
index 3953347a..4816ca23 100644
--- a/frontend/src/components/app/sidebars/topology/machine/UnitComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/UnitComponent.js
@@ -21,10 +21,7 @@ class UnitComponent extends React.Component {
'<strong>Energy Cons.:</strong> <code>' +
this.props.unit.energyConsumptionW +
' W</code>'
- } else if (
- this.props.unitType === 'memory' ||
- this.props.unitType === 'storage'
- ) {
+ } else if (this.props.unitType === 'memory' || this.props.unitType === 'storage') {
unitInfo =
'<strong>Speed:</strong> <code>' +
this.props.unit.speedMbPerS +
@@ -39,9 +36,7 @@ class UnitComponent extends React.Component {
return (
<li className="d-flex list-group-item justify-content-between align-items-center">
- <span style={{ maxWidth: '60%' }}>
- {this.props.unit.name}
- </span>
+ <span style={{ maxWidth: '60%' }}>{this.props.unit.name}</span>
<span>
<span
tabIndex="0"
@@ -53,10 +48,7 @@ class UnitComponent extends React.Component {
data-content={unitInfo}
data-html="true"
/>
- <span
- className="btn btn-outline-danger fa fa-trash"
- onClick={this.props.onDelete}
- />
+ <span className="btn btn-outline-danger fa fa-trash" onClick={this.props.onDelete} />
</span>
</li>
)
diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js
index fcd3e03b..2ade0f6a 100644
--- a/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js
@@ -5,12 +5,7 @@ const UnitListComponent = ({ unitType, unitIds }) => (
<ul className="list-group mt-1">
{unitIds.length !== 0 ? (
unitIds.map((unitId, index) => (
- <UnitContainer
- unitType={unitType}
- unitId={unitId}
- index={index}
- key={index}
- />
+ <UnitContainer unitType={unitType} unitId={unitId} index={index} key={index} />
))
) : (
<div className="alert alert-info">
diff --git a/frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js b/frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js
index c774036f..15c89ed5 100644
--- a/frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js
+++ b/frontend/src/components/app/sidebars/topology/machine/UnitTabsComponent.js
@@ -6,12 +6,7 @@ const UnitTabsComponent = () => (
<div>
<ul className="nav nav-tabs mt-2 mb-1" role="tablist">
<li className="nav-item">
- <a
- className="nav-link active"
- data-toggle="tab"
- href="#cpu-units"
- role="tab"
- >
+ <a className="nav-link active" data-toggle="tab" href="#cpu-units" role="tab">
CPU
</a>
</li>
@@ -21,42 +16,32 @@ const UnitTabsComponent = () => (
</a>
</li>
<li className="nav-item">
- <a
- className="nav-link"
- data-toggle="tab"
- href="#memory-units"
- role="tab"
- >
+ <a className="nav-link" data-toggle="tab" href="#memory-units" role="tab">
Memory
</a>
</li>
<li className="nav-item">
- <a
- className="nav-link"
- data-toggle="tab"
- href="#storage-units"
- role="tab"
- >
+ <a className="nav-link" data-toggle="tab" href="#storage-units" role="tab">
Storage
</a>
</li>
</ul>
<div className="tab-content">
<div className="tab-pane active" id="cpu-units" role="tabpanel">
- <UnitAddContainer unitType="cpu"/>
- <UnitListContainer unitType="cpu"/>
+ <UnitAddContainer unitType="cpu" />
+ <UnitListContainer unitType="cpu" />
</div>
<div className="tab-pane" id="gpu-units" role="tabpanel">
- <UnitAddContainer unitType="gpu"/>
- <UnitListContainer unitType="gpu"/>
+ <UnitAddContainer unitType="gpu" />
+ <UnitListContainer unitType="gpu" />
</div>
<div className="tab-pane" id="memory-units" role="tabpanel">
- <UnitAddContainer unitType="memory"/>
- <UnitListContainer unitType="memory"/>
+ <UnitAddContainer unitType="memory" />
+ <UnitListContainer unitType="memory" />
</div>
<div className="tab-pane" id="storage-units" role="tabpanel">
- <UnitAddContainer unitType="storage"/>
- <UnitListContainer unitType="storage"/>
+ <UnitAddContainer unitType="storage" />
+ <UnitListContainer unitType="storage" />
</div>
</div>
</div>
diff --git a/frontend/src/components/app/sidebars/topology/rack/BackToRoomComponent.js b/frontend/src/components/app/sidebars/topology/rack/BackToRoomComponent.js
index 345674d1..c14775bf 100644
--- a/frontend/src/components/app/sidebars/topology/rack/BackToRoomComponent.js
+++ b/frontend/src/components/app/sidebars/topology/rack/BackToRoomComponent.js
@@ -2,7 +2,7 @@ import React from 'react'
const BackToRoomComponent = ({ onClick }) => (
<div className="btn btn-secondary btn-block mb-2" onClick={onClick}>
- <span className="fa fa-angle-left mr-2"/>
+ <span className="fa fa-angle-left mr-2" />
Back to room
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/rack/DeleteRackComponent.js b/frontend/src/components/app/sidebars/topology/rack/DeleteRackComponent.js
index b1672764..23b0daac 100644
--- a/frontend/src/components/app/sidebars/topology/rack/DeleteRackComponent.js
+++ b/frontend/src/components/app/sidebars/topology/rack/DeleteRackComponent.js
@@ -2,7 +2,7 @@ import React from 'react'
const DeleteRackComponent = ({ onClick }) => (
<div className="btn btn-outline-danger btn-block" onClick={onClick}>
- <span className="fa fa-trash mr-2"/>
+ <span className="fa fa-trash mr-2" />
Delete this rack
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/rack/EmptySlotComponent.js b/frontend/src/components/app/sidebars/topology/rack/EmptySlotComponent.js
index 03b44aa6..d7e30f1d 100644
--- a/frontend/src/components/app/sidebars/topology/rack/EmptySlotComponent.js
+++ b/frontend/src/components/app/sidebars/topology/rack/EmptySlotComponent.js
@@ -2,11 +2,9 @@ import React from 'react'
const EmptySlotComponent = ({ position, onAdd }) => (
<li className="list-group-item d-flex justify-content-between align-items-center">
- <span className="badge badge-default badge-info mr-1 disabled">
- {position}
- </span>
+ <span className="badge badge-default badge-info mr-1 disabled">{position}</span>
<button className="btn btn-outline-primary" onClick={onAdd}>
- <span className="fa fa-plus mr-2"/>
+ <span className="fa fa-plus mr-2" />
Add machine
</button>
</li>
diff --git a/frontend/src/components/app/sidebars/topology/rack/MachineComponent.js b/frontend/src/components/app/sidebars/topology/rack/MachineComponent.js
index cec3c912..caa3dc04 100644
--- a/frontend/src/components/app/sidebars/topology/rack/MachineComponent.js
+++ b/frontend/src/components/app/sidebars/topology/rack/MachineComponent.js
@@ -12,17 +12,9 @@ const UnitIcon = ({ id, type }) => (
</div>
)
-const MachineComponent = ({
- position,
- machine,
- onClick,
- }) => {
+const MachineComponent = ({ position, machine, onClick }) => {
const hasNoUnits =
- machine.cpuIds.length +
- machine.gpuIds.length +
- machine.memoryIds.length +
- machine.storageIds.length ===
- 0
+ machine.cpuIds.length + machine.gpuIds.length + machine.memoryIds.length + machine.storageIds.length === 0
return (
<li
@@ -32,33 +24,13 @@ const MachineComponent = ({
>
<span className="badge badge-default badge-info mr-1">{position}</span>
<div className="d-inline-flex">
- {machine.cpuIds.length > 0 ? (
- <UnitIcon id="cpu" type="CPU"/>
- ) : (
- undefined
- )}
- {machine.gpuIds.length > 0 ? (
- <UnitIcon id="gpu" type="GPU"/>
- ) : (
- undefined
- )}
- {machine.memoryIds.length > 0 ? (
- <UnitIcon id="memory" type="memory"/>
- ) : (
- undefined
- )}
- {machine.storageIds.length > 0 ? (
- <UnitIcon id="storage" type="storage"/>
- ) : (
- undefined
- )}
+ {machine.cpuIds.length > 0 ? <UnitIcon id="cpu" type="CPU" /> : undefined}
+ {machine.gpuIds.length > 0 ? <UnitIcon id="gpu" type="GPU" /> : undefined}
+ {machine.memoryIds.length > 0 ? <UnitIcon id="memory" type="memory" /> : undefined}
+ {machine.storageIds.length > 0 ? <UnitIcon id="storage" type="storage" /> : undefined}
{hasNoUnits ? (
- <span className="badge badge-default badge-warning">
- Machine with no units
- </span>
- ) : (
- undefined
- )}
+ <span className="badge badge-default badge-warning">Machine with no units</span>
+ ) : undefined}
</div>
</li>
)
diff --git a/frontend/src/components/app/sidebars/topology/rack/MachineListComponent.js b/frontend/src/components/app/sidebars/topology/rack/MachineListComponent.js
index a381771c..aa7a4f8f 100644
--- a/frontend/src/components/app/sidebars/topology/rack/MachineListComponent.js
+++ b/frontend/src/components/app/sidebars/topology/rack/MachineListComponent.js
@@ -8,15 +8,9 @@ const MachineListComponent = ({ machineIds }) => {
<ul className="list-group machine-list">
{machineIds.map((machineId, index) => {
if (machineId === null) {
- return <EmptySlotContainer key={index} position={index + 1}/>
+ return <EmptySlotContainer key={index} position={index + 1} />
} else {
- return (
- <MachineContainer
- key={index}
- position={index + 1}
- machineId={machineId}
- />
- )
+ return <MachineContainer key={index} position={index + 1} machineId={machineId} />
}
})}
</ul>
diff --git a/frontend/src/components/app/sidebars/topology/rack/RackNameComponent.js b/frontend/src/components/app/sidebars/topology/rack/RackNameComponent.js
index 1888b69d..b701909a 100644
--- a/frontend/src/components/app/sidebars/topology/rack/RackNameComponent.js
+++ b/frontend/src/components/app/sidebars/topology/rack/RackNameComponent.js
@@ -1,8 +1,6 @@
import React from 'react'
import NameComponent from '../NameComponent'
-const RackNameComponent = ({ rackName, onEdit }) => (
- <NameComponent name={rackName} onEdit={onEdit}/>
-)
+const RackNameComponent = ({ rackName, onEdit }) => <NameComponent name={rackName} onEdit={onEdit} />
export default RackNameComponent
diff --git a/frontend/src/components/app/sidebars/topology/rack/RackSidebarComponent.js b/frontend/src/components/app/sidebars/topology/rack/RackSidebarComponent.js
index 23e8e743..c04e46d8 100644
--- a/frontend/src/components/app/sidebars/topology/rack/RackSidebarComponent.js
+++ b/frontend/src/components/app/sidebars/topology/rack/RackSidebarComponent.js
@@ -9,12 +9,12 @@ const RackSidebarComponent = () => {
return (
<div className="rack-sidebar-container flex-column">
<div className="rack-sidebar-header-container">
- <RackNameContainer/>
- <BackToRoomContainer/>
- <DeleteRackContainer/>
+ <RackNameContainer />
+ <BackToRoomContainer />
+ <DeleteRackContainer />
</div>
<div className="machine-list-container mt-2">
- <MachineListContainer/>
+ <MachineListContainer />
</div>
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/room/BackToBuildingComponent.js b/frontend/src/components/app/sidebars/topology/room/BackToBuildingComponent.js
index 7bd8c2f8..64c0a1f6 100644
--- a/frontend/src/components/app/sidebars/topology/room/BackToBuildingComponent.js
+++ b/frontend/src/components/app/sidebars/topology/room/BackToBuildingComponent.js
@@ -2,7 +2,7 @@ import React from 'react'
const BackToBuildingComponent = ({ onClick }) => (
<div className="btn btn-secondary btn-block mb-2" onClick={onClick}>
- <span className="fa fa-angle-left mr-2"/>
+ <span className="fa fa-angle-left mr-2" />
Back to building
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/room/DeleteRoomComponent.js b/frontend/src/components/app/sidebars/topology/room/DeleteRoomComponent.js
index 2be752b5..78417359 100644
--- a/frontend/src/components/app/sidebars/topology/room/DeleteRoomComponent.js
+++ b/frontend/src/components/app/sidebars/topology/room/DeleteRoomComponent.js
@@ -2,7 +2,7 @@ import React from 'react'
const DeleteRoomComponent = ({ onClick }) => (
<div className="btn btn-outline-danger btn-block" onClick={onClick}>
- <span className="fa fa-trash mr-2"/>
+ <span className="fa fa-trash mr-2" />
Delete this room
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/room/EditRoomComponent.js b/frontend/src/components/app/sidebars/topology/room/EditRoomComponent.js
index 672a191f..857a646f 100644
--- a/frontend/src/components/app/sidebars/topology/room/EditRoomComponent.js
+++ b/frontend/src/components/app/sidebars/topology/room/EditRoomComponent.js
@@ -1,15 +1,10 @@
import classNames from 'classnames'
import React from 'react'
-const EditRoomComponent = ({
- onEdit,
- onFinish,
- isEditing,
- isInRackConstructionMode,
- }) =>
+const EditRoomComponent = ({ onEdit, onFinish, isEditing, isInRackConstructionMode }) =>
isEditing ? (
<div className="btn btn-info btn-block" onClick={onFinish}>
- <span className="fa fa-check mr-2"/>
+ <span className="fa fa-check mr-2" />
Finish editing room
</div>
) : (
@@ -19,7 +14,7 @@ const EditRoomComponent = ({
})}
onClick={() => (isInRackConstructionMode ? undefined : onEdit())}
>
- <span className="fa fa-pencil mr-2"/>
+ <span className="fa fa-pencil mr-2" />
Edit the tiles of this room
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/room/RackConstructionComponent.js b/frontend/src/components/app/sidebars/topology/room/RackConstructionComponent.js
index 42b7357b..44566f61 100644
--- a/frontend/src/components/app/sidebars/topology/room/RackConstructionComponent.js
+++ b/frontend/src/components/app/sidebars/topology/room/RackConstructionComponent.js
@@ -1,16 +1,11 @@
import classNames from 'classnames'
import React from 'react'
-const RackConstructionComponent = ({
- onStart,
- onStop,
- inRackConstructionMode,
- isEditingRoom,
- }) => {
+const RackConstructionComponent = ({ onStart, onStop, inRackConstructionMode, isEditingRoom }) => {
if (inRackConstructionMode) {
return (
<div className="btn btn-primary btn-block" onClick={onStop}>
- <span className="fa fa-times mr-2"/>
+ <span className="fa fa-times mr-2" />
Stop rack construction
</div>
)
@@ -23,7 +18,7 @@ const RackConstructionComponent = ({
})}
onClick={() => (isEditingRoom ? undefined : onStart())}
>
- <span className="fa fa-plus mr-2"/>
+ <span className="fa fa-plus mr-2" />
Start rack construction
</div>
)
diff --git a/frontend/src/components/app/sidebars/topology/room/RoomNameComponent.js b/frontend/src/components/app/sidebars/topology/room/RoomNameComponent.js
index 409d2eef..d637828e 100644
--- a/frontend/src/components/app/sidebars/topology/room/RoomNameComponent.js
+++ b/frontend/src/components/app/sidebars/topology/room/RoomNameComponent.js
@@ -1,8 +1,6 @@
import React from 'react'
import NameComponent from '../NameComponent'
-const RoomNameComponent = ({ roomName, onEdit }) => (
- <NameComponent name={roomName} onEdit={onEdit}/>
-)
+const RoomNameComponent = ({ roomName, onEdit }) => <NameComponent name={roomName} onEdit={onEdit} />
export default RoomNameComponent
diff --git a/frontend/src/components/app/sidebars/topology/room/RoomSidebarComponent.js b/frontend/src/components/app/sidebars/topology/room/RoomSidebarComponent.js
index a23ac381..1bc6533e 100644
--- a/frontend/src/components/app/sidebars/topology/room/RoomSidebarComponent.js
+++ b/frontend/src/components/app/sidebars/topology/room/RoomSidebarComponent.js
@@ -8,11 +8,11 @@ import RoomNameContainer from '../../../../../containers/app/sidebars/topology/r
const RoomSidebarComponent = () => {
return (
<div>
- <RoomNameContainer/>
- <BackToBuildingContainer/>
- <RackConstructionContainer/>
- <EditRoomContainer/>
- <DeleteRoomContainer/>
+ <RoomNameContainer />
+ <BackToBuildingContainer />
+ <RackConstructionContainer />
+ <EditRoomContainer />
+ <DeleteRoomContainer />
</div>
)
}