Fix Order of tables change unexpectedly in Top Routes Web UI

Fixes #2420.

Sorts the data returned from a Top Routes query before rendering the tables in the web UI. Previously we rendered the data tables without sorting, leading to inadvertent flipping of table order if the API returned data in a different order.

Signed-off-by: Gaurav Kumar <gaurav.kumar9825@gmail.com>
This commit is contained in:
Gaurav Kumar 2019-03-19 03:30:05 +05:30 committed by Carol A. Scott
parent d0bdd4ffb4
commit 277e644f5a
1 changed files with 2 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import TopRoutesTable from './TopRoutesTable.jsx';
import Typography from '@material-ui/core/Typography';
import _get from 'lodash/get';
import _isEmpty from 'lodash/isEmpty';
import _sortBy from 'lodash/sortBy';
import { apiErrorPropType } from './util/ApiHelpers.jsx';
import { processTopRoutesResults } from './util/MetricUtils.jsx';
import withREST from './util/withREST.jsx';
@ -44,6 +45,7 @@ class TopRoutesBase extends React.Component {
render() {
const {data, loading} = this.props;
let results = _get(data, '[0].ok.routes', []);
results = _sortBy(results, o => o.resource);
let metricsByResource = results.map(r => {
return {