summaryrefslogtreecommitdiff
path: root/frontend/src/components/app/sidebars/topology/machine/UnitListComponent.js
blob: da65da23a7830e7eb43d655866019e7f8fe3e3fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react'
import UnitContainer from '../../../../../containers/app/sidebars/topology/machine/UnitContainer'

const UnitListComponent = ({ unitType, unitIds, inSimulation }) => (
    <ul className="list-group mt-1">
        {unitIds.length !== 0 ? (
            unitIds.map((unitId, index) => (
                <UnitContainer
                    unitType={unitType}
                    unitId={unitId}
                    index={index}
                    key={index}
                />
            ))
        ) : (
            <div className="alert alert-info">
                {inSimulation ? (
                    <strong>No units of this type in this machine</strong>
                ) : (
                    <span>
                        <strong>No units...</strong> Add some with the menu above!
                    </span>
                )}
            </div>
        )}
    </ul>
)

export default UnitListComponent