Skip to content

Commit

Permalink
don't sort null
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-deboer committed Oct 11, 2017
1 parent 2b3dd6d commit c5c081e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions pkg/ui/src/components/dashboard/NamespaceBarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,19 @@ class NamespaceBarChart extends React.PureComponent {
}
}

items[this.state.selectBy].sort((a,b)=> {
let aSelected = (a.name in this.props.selectedNamespaces)
let bSelected = (b.name in this.props.selectedNamespaces)
if (aSelected && !bSelected) {
return -1
} else if (!aSelected && bSelected) {
return 1
} else {
return a.name.localeCompare(b.name)
}
})
if (items[this.state.selectBy]) {
items[this.state.selectBy].sort((a,b)=> {
let aSelected = (a.name in this.props.selectedNamespaces)
let bSelected = (b.name in this.props.selectedNamespaces)
if (aSelected && !bSelected) {
return -1
} else if (!aSelected && bSelected) {
return 1
} else {
return a.name.localeCompare(b.name)
}
})
}

return (
<div style={{...styles.wrapper, ...props.style}} className="row namespace-panel">
Expand Down

0 comments on commit c5c081e

Please sign in to comment.