blob: a0435eab24aee79976a0221250cb3c95945cda8d (
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
59
60
61
62
|
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.manufacturer
+ " " + this.props.unit.family
+ " " + this.props.unit.model
+ " " + this.props.unit.generation
}
</span>
<span>
<a
tabIndex="0"
className="unit-info-popover btn btn-outline-info mr-1"
role="button"
data-toggle="popover"
data-trigger="focus"
title="Unit information"
data-content={unitInfo}
data-html="true"
>
<span className="fa fa-info-circle"/>
</a>
{this.props.inSimulation ?
undefined :
<span className="btn btn-outline-danger" onClick={this.props.onDelete}>
<span className="fa fa-trash"/>
</span>
}
</span>
</li>
);
}
}
export default UnitComponent;
|