mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
Output proper percentage of online hosts (#1071)
This commit is contained in:
parent
bc9273622c
commit
eb82856ae4
@ -21,10 +21,13 @@ class TargetDetails extends Component {
|
||||
handleBackToResults: noop,
|
||||
};
|
||||
|
||||
onlineHosts = (labelBaseClass, online) => {
|
||||
onlineHosts = (labelBaseClass, count, online) => {
|
||||
const offline = count - online;
|
||||
const percentOnline = ((count - offline) / count) * 100;
|
||||
|
||||
if (online > 0) {
|
||||
return (
|
||||
<span className={`${labelBaseClass}__hosts-online`}> ({online}% ONLINE)</span>
|
||||
<span className={`${labelBaseClass}__hosts-online`}> ({percentOnline}% ONLINE)</span>
|
||||
);
|
||||
}
|
||||
|
||||
@ -128,7 +131,7 @@ class TargetDetails extends Component {
|
||||
|
||||
<p className={`${labelBaseClass}__hosts`}>
|
||||
<span className={`${labelBaseClass}__hosts-count`}><strong>{count}</strong>HOSTS</span>
|
||||
{ onlineHosts(labelBaseClass, online) }
|
||||
{ onlineHosts(labelBaseClass, count, online) }
|
||||
</p>
|
||||
|
||||
<p className={`${labelBaseClass}__description`}>{description || 'No Description'}</p>
|
||||
|
Loading…
Reference in New Issue
Block a user