Add a sum line to the dashboard's process load counts

This commit is contained in:
Halla Moore 2016-07-14 18:01:52 -07:00
parent 45f132b746
commit 6e2ae25519
2 changed files with 32 additions and 23 deletions

View file

@ -239,6 +239,12 @@ pre {
font-size: 12px;
}
.sum-accounts {
border-top: solid black 1px;
margin-top: 5px;
padding-top: 5px;
}
.account-filter {
padding-left: 5px;
}

View file

@ -1,30 +1,33 @@
const React = window.React;
class ProcessLoads extends React.Component {
render() {
let entries;
if (this.props.counts == null || Object.keys(this.props.counts).length === 0) {
entries = "No Data"
function ProcessLoads(props) {
let entries;
let sumElem;
if (props.counts == null || Object.keys(props.counts).length === 0) {
entries = "No Data";
sumElem = "";
} else {
entries = [];
let sum = 0;
for (const processName of Object.keys(props.counts)) {
const count = props.counts[processName];
sum += count;
entries.push(
<div className="load-count">
<b>{processName}</b>: {count} accounts
</div>
);
}
else {
entries = [];
for (const processName of Object.keys(this.props.counts).sort()) {
entries.push(
<div className="load-count">
<b>{processName}</b>: {this.props.counts[processName]} accounts
</div>
);
}
}
return (
<div className="process-loads">
<div className="section">Process Loads </div>
{entries}
</div>
)
sumElem = <div className="sum-accounts">Total Accounts: {sum} </div>
}
return (
<div className="process-loads">
<div className="section">Process Loads </div>
{entries}
{sumElem}
</div>
)
}
ProcessLoads.propTypes = {