diff --git a/client/app/scripts/components/node-details/node-details-health-overflow.js b/client/app/scripts/components/node-details/node-details-health-overflow.js
index 32624d631e..45e2c3c4ec 100644
--- a/client/app/scripts/components/node-details/node-details-health-overflow.js
+++ b/client/app/scripts/components/node-details/node-details-health-overflow.js
@@ -7,11 +7,8 @@ export default class NodeDetailsHealthOverflow extends React.Component {
const items = this.props.items.slice(0, 4);
return (
-
+
{items.map(item =>
)}
-
- Show more
-
);
}
diff --git a/client/app/scripts/components/node-details/node-details-health.js b/client/app/scripts/components/node-details/node-details-health.js
index cb7cf1d4db..d389a653af 100644
--- a/client/app/scripts/components/node-details/node-details-health.js
+++ b/client/app/scripts/components/node-details/node-details-health.js
@@ -1,5 +1,6 @@
import React from 'react';
+import ShowMore from '../show-more';
import NodeDetailsHealthOverflow from './node-details-health-overflow';
import NodeDetailsHealthItem from './node-details-health-item';
@@ -13,8 +14,7 @@ export default class NodeDetailsHealth extends React.Component {
this.handleClickMore = this.handleClickMore.bind(this);
}
- handleClickMore(ev) {
- ev.preventDefault();
+ handleClickMore() {
const expanded = !this.state.expanded;
this.setState({expanded});
}
@@ -25,17 +25,20 @@ export default class NodeDetailsHealth extends React.Component {
const primeMetrics = metrics.slice(0, primeCutoff);
const overflowMetrics = metrics.slice(primeCutoff);
const showOverflow = overflowMetrics.length > 0 && !this.state.expanded;
- const showLess = this.state.expanded;
const flexWrap = showOverflow || !this.state.expanded ? 'nowrap' : 'wrap';
const justifyContent = showOverflow || !this.state.expanded ? 'space-around' : 'flex-start';
+ const notShown = overflowMetrics.length;
return (
- {primeMetrics.map(item => {
- return
;
- })}
- {showOverflow &&
}
- {showLess &&
show less
}
+
+ {primeMetrics.map(item => {
+ return ;
+ })}
+ {showOverflow && }
+
+
this.handleClickMore()} collection={this.props.metrics}
+ expanded={this.state.expanded} notShown={notShown} hideNumber />
);
}
diff --git a/client/app/scripts/components/node-details/node-details-info.js b/client/app/scripts/components/node-details/node-details-info.js
index 6df895cded..cf85a58d2f 100644
--- a/client/app/scripts/components/node-details/node-details-info.js
+++ b/client/app/scripts/components/node-details/node-details-info.js
@@ -1,5 +1,7 @@
import React from 'react';
+import ShowMore from '../show-more';
+
export default class NodeDetailsInfo extends React.Component {
constructor(props, context) {
@@ -10,8 +12,7 @@ export default class NodeDetailsInfo extends React.Component {
this.handleClickMore = this.handleClickMore.bind(this);
}
- handleClickMore(ev) {
- ev.preventDefault();
+ handleClickMore() {
const expanded = !this.state.expanded;
this.setState({expanded});
}
@@ -19,11 +20,9 @@ export default class NodeDetailsInfo extends React.Component {
render() {
let rows = (this.props.rows || []);
const prime = rows.filter(row => row.prime);
- let expandText = 'Show less';
- let showExpand = this.state.expanded;
+ let notShown = 0;
if (!this.state.expanded && prime.length < rows.length) {
- expandText = 'Show more';
- showExpand = true;
+ notShown = rows.length - prime.length;
rows = prime;
}
return (
@@ -40,7 +39,8 @@ export default class NodeDetailsInfo extends React.Component {
);
})}
- {showExpand &&