From de1c50d2bf13e99929deadad259eaf915c1d62ca Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 6 Jul 2018 09:54:18 +0800 Subject: [PATCH] Sorts api results in the UI --- zipkin-ui/js/component_data/dependency.js | 2 +- zipkin-ui/js/component_data/serviceNames.js | 2 +- zipkin-ui/js/component_data/spanNames.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zipkin-ui/js/component_data/dependency.js b/zipkin-ui/js/component_data/dependency.js index 7491f54d0c0..7f14aef946b 100644 --- a/zipkin-ui/js/component_data/dependency.js +++ b/zipkin-ui/js/component_data/dependency.js @@ -15,7 +15,7 @@ export default component(function dependency() { type: 'GET', dataType: 'json', success: links => { - this.links = links; + this.links = links.sort((a, b) => a.parent - b.parent || a.child - b.child); this.buildServiceData(links); this.trigger('dependencyDataReceived', links); }, diff --git a/zipkin-ui/js/component_data/serviceNames.js b/zipkin-ui/js/component_data/serviceNames.js index d313da69fd4..c02767cee3a 100644 --- a/zipkin-ui/js/component_data/serviceNames.js +++ b/zipkin-ui/js/component_data/serviceNames.js @@ -8,7 +8,7 @@ export default component(function serviceNames() { type: 'GET', dataType: 'json' }).done(names => { - this.trigger('dataServiceNames', {names, lastServiceName}); + this.trigger('dataServiceNames', {names: names.sort(), lastServiceName}); }).fail(e => { this.trigger('uiServerError', getError('cannot load service names', e)); }); diff --git a/zipkin-ui/js/component_data/spanNames.js b/zipkin-ui/js/component_data/spanNames.js index 2c70b56092a..8d9e554bb10 100644 --- a/zipkin-ui/js/component_data/spanNames.js +++ b/zipkin-ui/js/component_data/spanNames.js @@ -12,7 +12,7 @@ export default component(function spanNames() { type: 'GET', dataType: 'json' }).done(spans => { - this.trigger('dataSpanNames', {spans}); + this.trigger('dataSpanNames', {spans: spans.sort()}); }).fail(e => { this.trigger('uiServerError', getError('cannot load span names', e)); });