blob: 4816ca2324230c0b7d5b46264324a6375e4dcae1 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import React from 'react'
import jQuery from '../../../../../util/jquery'
class UnitComponent extends React.Component {
componentDidMount() {
jQuery('.unit-info-popover').popover({
trigger: 'focus',
})
}
render() {
let unitInfo
if (this.props.unitType === 'cpu' || this.props.unitType === 'gpu') {
unitInfo =
'<strong>Clockrate:</strong> <code>' +
this.props.unit.clockRateMhz +
' MHz</code><br/>' +
'<strong>Num. Cores:</strong> <code>' +
this.props.unit.numberOfCores +
'</code><br/>' +
'<strong>Energy Cons.:</strong> <code>' +
this.props.unit.energyConsumptionW +
' W</code>'
} else if (this.props.unitType === 'memory' || this.props.unitType === 'storage') {
unitInfo =
'<strong>Speed:</strong> <code>' +
this.props.unit.speedMbPerS +
' Mb/s</code><br/>' +
'<strong>Size:</strong> <code>' +
this.props.unit.sizeMb +
' MB</code><br/>' +
'<strong>Energy Cons.:</strong> <code> ' +
this.props.unit.energyConsumptionW +
' W</code>'
}
return (
<li className="d-flex list-group-item justify-content-between align-items-center">
<span style={{ maxWidth: '60%' }}>{this.props.unit.name}</span>
<span>
<span
tabIndex="0"
className="unit-info-popover btn btn-outline-info mr-1 fa fa-info-circle"
role="button"
data-toggle="popover"
data-trigger="focus"
title="Unit information"
data-content={unitInfo}
data-html="true"
/>
<span className="btn btn-outline-danger fa fa-trash" onClick={this.props.onDelete} />
</span>
</li>
)
}
}
export default UnitComponent
|