mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-23 21:31:00 +02:00
GUI -- Fixed turbulent behavior of incoming nodes with no fixed position.
Change-Id: Ic73c0c8b91bd5ab07faec84ffcd0b67d2e357b29
This commit is contained in:
parent
ba5621e3a5
commit
ac9e24f3b3
@ -24,14 +24,33 @@
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* NODES */
|
/* NODES */
|
||||||
|
|
||||||
#topo svg .node.device {
|
#topo svg .node {
|
||||||
stroke: none;
|
|
||||||
stroke-width: 1.5px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#topo svg .node.selected rect,
|
||||||
|
#topo svg .node.selected circle {
|
||||||
|
filter: url(#blue-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for debugging */
|
||||||
|
#topo svg .node circle.debug {
|
||||||
|
fill: white;
|
||||||
|
stroke: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#topo svg .node text {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Device Nodes */
|
||||||
|
|
||||||
|
#topo svg .node.device {
|
||||||
|
}
|
||||||
|
|
||||||
#topo svg .node.device rect {
|
#topo svg .node.device rect {
|
||||||
stroke-width: 1.5px;
|
stroke-width: 1.5px;
|
||||||
}
|
}
|
||||||
@ -54,31 +73,28 @@
|
|||||||
fill: #03c;
|
fill: #03c;
|
||||||
}
|
}
|
||||||
|
|
||||||
#topo svg .node.host {
|
|
||||||
fill: #846;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* note: device is offline without the 'online' class */
|
/* note: device is offline without the 'online' class */
|
||||||
#topo svg .node.device text {
|
#topo svg .node.device text {
|
||||||
fill: #aaa;
|
fill: #aaa;
|
||||||
font: 10pt sans-serif;
|
font: 10pt sans-serif;
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#topo svg .node.device.online text {
|
#topo svg .node.device.online text {
|
||||||
fill: white;
|
fill: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Host Nodes */
|
||||||
|
|
||||||
|
#topo svg .node.host {
|
||||||
|
fill: #846;
|
||||||
|
}
|
||||||
|
|
||||||
#topo svg .node.host text {
|
#topo svg .node.host text {
|
||||||
fill: #846;
|
fill: #846;
|
||||||
font: 9pt sans-serif;
|
font: 9pt sans-serif;
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#topo svg .node.selected rect,
|
|
||||||
#topo svg .node.selected circle {
|
|
||||||
filter: url(#blue-glow);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* LINKS */
|
/* LINKS */
|
||||||
|
|
||||||
@ -91,20 +107,13 @@
|
|||||||
stroke-width: 6px;
|
stroke-width: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for debugging */
|
|
||||||
#topo svg .node circle.debug {
|
|
||||||
fill: white;
|
|
||||||
stroke: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Fly-in details pane */
|
||||||
/* detail topo-detail pane */
|
|
||||||
|
|
||||||
#topo-detail {
|
#topo-detail {
|
||||||
/* gets base CSS from .fpanel in floatPanel.css */
|
/* gets base CSS from .fpanel in floatPanel.css */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#topo-detail h2 {
|
#topo-detail h2 {
|
||||||
margin: 8px 4px;
|
margin: 8px 4px;
|
||||||
color: black;
|
color: black;
|
||||||
@ -128,7 +137,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#topo-detail td.value {
|
#topo-detail td.value {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#topo-detail hr {
|
#topo-detail hr {
|
||||||
|
@ -127,7 +127,8 @@
|
|||||||
P: togglePorts,
|
P: togglePorts,
|
||||||
U: unpin,
|
U: unpin,
|
||||||
|
|
||||||
X: requestPath
|
Z: requestPath,
|
||||||
|
X: cancelMonitor
|
||||||
};
|
};
|
||||||
|
|
||||||
// state variables
|
// state variables
|
||||||
@ -518,6 +519,13 @@
|
|||||||
sendMessage('requestPath', payload);
|
sendMessage('requestPath', payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cancelMonitor() {
|
||||||
|
var payload = {
|
||||||
|
id: "need_the_intent_id" // FIXME: where are we storing this?
|
||||||
|
};
|
||||||
|
sendMessage('cancelMonitor', payload);
|
||||||
|
}
|
||||||
|
|
||||||
// request details for the selected element
|
// request details for the selected element
|
||||||
function requestDetails() {
|
function requestDetails() {
|
||||||
var data = getSel(0).obj,
|
var data = getSel(0).obj,
|
||||||
@ -701,18 +709,57 @@
|
|||||||
|
|
||||||
function positionNode(node) {
|
function positionNode(node) {
|
||||||
var meta = node.metaUi,
|
var meta = node.metaUi,
|
||||||
x = 0,
|
x = meta && meta.x,
|
||||||
y = 0;
|
y = meta && meta.y,
|
||||||
|
xy;
|
||||||
|
|
||||||
if (meta) {
|
// If we have [x,y] already, use that...
|
||||||
x = meta.x;
|
|
||||||
y = meta.y;
|
|
||||||
}
|
|
||||||
if (x && y) {
|
if (x && y) {
|
||||||
node.fixed = true;
|
node.fixed = true;
|
||||||
|
node.x = x;
|
||||||
|
node.y = y;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
node.x = x || network.view.width() / 2;
|
|
||||||
node.y = y || network.view.height() / 2;
|
// Note: Placing incoming unpinned nodes at exactly the same point
|
||||||
|
// (center of the view) causes them to explode outwards when
|
||||||
|
// the force layout kicks in. So, we spread them out a bit
|
||||||
|
// initially, to provide a more serene layout convergence.
|
||||||
|
// Additionally, if the node is a host, we place it near
|
||||||
|
// the device it is connected to.
|
||||||
|
|
||||||
|
function spread(s) {
|
||||||
|
return Math.floor((Math.random() * s) - s/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function randDim(dim) {
|
||||||
|
return dim / 2 + spread(dim * 0.7071);
|
||||||
|
}
|
||||||
|
|
||||||
|
function rand() {
|
||||||
|
return {
|
||||||
|
x: randDim(network.view.width()),
|
||||||
|
y: randDim(network.view.height())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function near(node) {
|
||||||
|
var min = 12,
|
||||||
|
dx = spread(12),
|
||||||
|
dy = spread(12);
|
||||||
|
return {
|
||||||
|
x: node.x + min + dx,
|
||||||
|
y: node.y + min + dy
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDevice(cp) {
|
||||||
|
var d = network.lookup[cp.device];
|
||||||
|
return d || rand();
|
||||||
|
}
|
||||||
|
|
||||||
|
xy = (node.class === 'host') ? near(getDevice(node.cp)) : rand();
|
||||||
|
$.extend(node, xy);
|
||||||
}
|
}
|
||||||
|
|
||||||
function iconUrl(d) {
|
function iconUrl(d) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user