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:
parent
27a3fc3276
commit
62ba4c9722
|
@ -28,25 +28,26 @@ export default Component.extend({
|
||||||
];
|
];
|
||||||
}),
|
}),
|
||||||
distances: computed('tomography', function() {
|
distances: computed('tomography', function() {
|
||||||
const tomography = this.get('tomography');
|
const tomography = get(this, 'tomography');
|
||||||
let distances = tomography.distances || [];
|
let distances = get(tomography, 'distances') || [];
|
||||||
distances.forEach((d, i) => {
|
distances.forEach((d, i) => {
|
||||||
if (d.distance > get(this, 'max')) {
|
if (d.distance > get(this, 'max')) {
|
||||||
set(this, 'max', d.distance);
|
set(this, 'max', d.distance);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (tomography.n > 360) {
|
let n = get(distances, 'length');
|
||||||
let n = distances.length;
|
if (n > 360) {
|
||||||
// We have more nodes than we want to show, take a random sampling to keep
|
// We have more nodes than we want to show, take a random sampling to keep
|
||||||
// the number around 360.
|
// the number around 360.
|
||||||
const sampling = 360 / tomography.n;
|
const sampling = 360 / n;
|
||||||
distances = distances.filter(function(_, i) {
|
distances = distances.filter(function(_, i) {
|
||||||
return i == 0 || i == n - 1 || Math.random() < sampling;
|
return i == 0 || i == n - 1 || Math.random() < sampling;
|
||||||
});
|
});
|
||||||
|
n = get(distances, 'length');
|
||||||
}
|
}
|
||||||
return distances.map((d, i) => {
|
return distances.map((d, i) => {
|
||||||
return {
|
return {
|
||||||
rotate: i * 360 / distances.length,
|
rotate: (i * 360) / n,
|
||||||
y2: -insetSize * (d.distance / get(this, 'max')),
|
y2: -insetSize * (d.distance / get(this, 'max')),
|
||||||
node: d.node,
|
node: d.node,
|
||||||
distance: d.distance,
|
distance: d.distance,
|
||||||
|
|
|
@ -44,7 +44,6 @@ export default function(distance) {
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
distances: distances,
|
distances: distances,
|
||||||
n: distances.length,
|
|
||||||
min: parseInt(min * 100) / 100,
|
min: parseInt(min * 100) / 100,
|
||||||
median: parseInt(median * 100) / 100,
|
median: parseInt(median * 100) / 100,
|
||||||
max: parseInt(max * 100) / 100,
|
max: parseInt(max * 100) / 100,
|
||||||
|
|
|
@ -74,4 +74,10 @@ Feature: dc / nodes / show: Show node
|
||||||
Then the url should be /dc1/nodes/node-0
|
Then the url should be /dc1/nodes/node-0
|
||||||
And the url "/v1/internal/ui/node/node-0" responds with a 404 status
|
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]"
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue