ui: Fixes RTT display, by ensuring use of ember proxies in tomography (#5666)

Previously the tomography wasn't using ember `get` so proxy updates
(specifically here whilst receiving a blocking update) wasn't working.

This adds `get` here until we update to newer `get`less ember and also
refactors slightly removing `n` and using `distance.length` instead

Skipped tests are adding here to nag us to come back here at some point.
This commit is contained in:
John Cowen 2019-04-17 09:21:31 +01:00 committed by John Cowen
parent 27a3fc3276
commit 62ba4c9722
3 changed files with 13 additions and 7 deletions

View File

@ -28,25 +28,26 @@ export default Component.extend({
];
}),
distances: computed('tomography', function() {
const tomography = this.get('tomography');
let distances = tomography.distances || [];
const tomography = get(this, 'tomography');
let distances = get(tomography, 'distances') || [];
distances.forEach((d, i) => {
if (d.distance > get(this, 'max')) {
set(this, 'max', d.distance);
}
});
if (tomography.n > 360) {
let n = distances.length;
let n = get(distances, 'length');
if (n > 360) {
// We have more nodes than we want to show, take a random sampling to keep
// the number around 360.
const sampling = 360 / tomography.n;
const sampling = 360 / n;
distances = distances.filter(function(_, i) {
return i == 0 || i == n - 1 || Math.random() < sampling;
});
n = get(distances, 'length');
}
return distances.map((d, i) => {
return {
rotate: i * 360 / distances.length,
rotate: (i * 360) / n,
y2: -insetSize * (d.distance / get(this, 'max')),
node: d.node,
distance: d.distance,

View File

@ -44,7 +44,6 @@ export default function(distance) {
}
return {
distances: distances,
n: distances.length,
min: parseInt(min * 100) / 100,
median: parseInt(median * 100) / 100,
max: parseInt(max * 100) / 100,

View File

@ -74,4 +74,10 @@ Feature: dc / nodes / show: Show node
Then the url should be /dc1/nodes/node-0
And the url "/v1/internal/ui/node/node-0" responds with a 404 status
And pause until I see the text "no longer exists" in "[data-notification]"
@ignore
Scenario: The RTT for the node is displayed properly
Then ok
@ignore
Scenario: The RTT for the node displays properly whilst blocking
Then ok