Skip to content

Commit

Permalink
Details panel table header looks up label in all rows
Browse files Browse the repository at this point in the history
Fixes #891
  • Loading branch information
davkal committed Feb 1, 2016
1 parent 0075589 commit e9872c1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions client/app/scripts/components/node-details/node-details-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,16 @@ export default class NodeDetailsTable extends React.Component {
if (this.props.nodes && this.props.nodes.length > 0) {
let headers = [{id: 'label', label: this.props.label}];
// gather header labels from metrics and metadata
const firstValues = this.getValuesForNode(this.props.nodes[0]);
headers = headers.concat(this.props.columns.map(column => ({id: column, label: firstValues[column].label})));
const nodeValues = this.props.nodes.map(this.getValuesForNode);
headers = headers.concat(this.props.columns.map(column => {
// look for a node that has the column label
const valuesWithField = nodeValues.find(values => values[column] !== undefined);
if (valuesWithField) {
return {id: column, label: valuesWithField[column].label};
}
// fall back on column id as label
return {id: column, label: column};
}));
const defaultSortBy = this.getDefaultSortBy();

return (
Expand Down

0 comments on commit e9872c1

Please sign in to comment.