mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-22 08:16:25 -06:00
Clicking links for reparenting now works, too.
This commit is contained in:
parent
f004f1ad8a
commit
6609f397eb
@ -4,6 +4,16 @@ import {isRedacted} from "./helpers/redact";
|
|||||||
|
|
||||||
var allNodes = [];
|
var allNodes = [];
|
||||||
let rootId = 0;
|
let rootId = 0;
|
||||||
|
let lastRtt = {};
|
||||||
|
|
||||||
|
function idOfNode(name) {
|
||||||
|
for (let i=0; i<allNodes.length; i++) {
|
||||||
|
if (allNodes[i][1].name === name) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
class AllTreeSankey extends DashboardGraph {
|
class AllTreeSankey extends DashboardGraph {
|
||||||
constructor(id) {
|
constructor(id) {
|
||||||
@ -11,6 +21,7 @@ class AllTreeSankey extends DashboardGraph {
|
|||||||
this.option = {
|
this.option = {
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
|
nodeAlign: 'left',
|
||||||
type: 'sankey',
|
type: 'sankey',
|
||||||
data: [],
|
data: [],
|
||||||
links: []
|
links: []
|
||||||
@ -24,12 +35,9 @@ class AllTreeSankey extends DashboardGraph {
|
|||||||
let name = params.name;
|
let name = params.name;
|
||||||
// If it contains a >, it's a link
|
// If it contains a >, it's a link
|
||||||
if (name.indexOf(" > ") === -1) {
|
if (name.indexOf(" > ") === -1) {
|
||||||
for (let i=0; i<allNodes.length; i++) {
|
rootId = idOfNode(name);
|
||||||
if (allNodes[i][1].name === name) {
|
} else {
|
||||||
rootId = i;
|
rootId = idOfNode(params.data.source);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#btnRoot").click(() => { rootId = 0; });
|
$("#btnRoot").click(() => { rootId = 0; });
|
||||||
@ -43,8 +51,6 @@ class AllTreeSankey extends DashboardGraph {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastRtt = {};
|
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
$.get("/local-api/networkTree", (data) => {
|
$.get("/local-api/networkTree", (data) => {
|
||||||
allNodes = data;
|
allNodes = data;
|
||||||
@ -55,13 +61,15 @@ function start() {
|
|||||||
let nodes = [];
|
let nodes = [];
|
||||||
let links = [];
|
let links = [];
|
||||||
|
|
||||||
|
let startDepth = data[rootId][1].parents.length - 1;
|
||||||
|
|
||||||
for (let i=0; i<data.length; i++) {
|
for (let i=0; i<data.length; i++) {
|
||||||
let depth = data[i][1].parents.length;
|
let depth = data[i][1].parents.length - startDepth;
|
||||||
if (depth > maxDepth) {
|
if (depth > maxDepth) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// If data[i][1].parents does not contain rootId, skip
|
// If data[i][1].parents does not contain rootId, skip
|
||||||
if (!data[i][1].parents.includes(rootId)) {
|
if (rootId !== 0 && !data[i][1].parents.includes(rootId)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let name = data[i][1].name;
|
let name = data[i][1].name;
|
||||||
|
Loading…
Reference in New Issue
Block a user