Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Simon Hunt
2015-10-22 16:12:48 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5674db9e41436e805682db2da7308ada5f2fe1a8
5674db9e
1 parent
69b36d5d
GUI Topo -- Badges - WIP.
Change-Id: I84a4d688f960f5162b9ae7c7c14ee4c118e2c707
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
16 deletions
web/gui/src/main/webapp/app/view/topo/topoD3.js
web/gui/src/main/webapp/app/view/topo/topoD3.js
View file @
5674db9
...
...
@@ -55,8 +55,22 @@
height
:
14
}
},
badgeConfig
=
{
radius
:
12
,
yoff
:
5
},
icfg
;
var
status
=
{
i
:
'badgeInfo'
,
w
:
'badgeWarn'
,
e
:
'badgeError'
};
function
badgeStatus
(
badge
)
{
return
status
[
badge
.
status
]
||
status
.
i
;
}
// internal state
var
deviceLabelIndex
=
0
,
hostLabelIndex
=
0
;
...
...
@@ -186,12 +200,14 @@
}
function
updateDevice
Label
(
d
)
{
function
updateDevice
Rendering
(
d
)
{
var
label
=
trimLabel
(
deviceLabel
(
d
)),
noLabel
=
!
label
,
node
=
d
.
el
,
dim
=
icfg
.
device
.
dim
,
box
,
dx
,
dy
;
box
,
dx
,
dy
,
bsel
,
bdg
=
d
.
badge
,
bcr
=
badgeConfig
.
radius
;
node
.
select
(
'text'
)
.
text
(
label
)
...
...
@@ -216,23 +232,31 @@
node
.
select
(
'g.deviceIcon'
)
.
transition
()
.
attr
(
'transform'
,
sus
.
translate
(
dx
,
dy
));
}
function
updateDeviceBadge
(
d
)
{
// TODO: Fix this WIP
var
node
=
d
.
el
,
bsel
;
if
(
d
.
badge
)
{
// handle badge, if defined
if
(
bdg
)
{
bsel
=
node
.
append
(
'g'
)
.
classed
(
'badge'
,
true
)
.
attr
(
'transform'
,
sus
.
translate
(
-
14
,
-
14
));
.
classed
(
badgeStatus
(
bdg
),
true
)
.
attr
(
'transform'
,
sus
.
translate
(
dx
+
dim
,
dy
));
bsel
.
append
(
'circle'
)
.
attr
(
'r'
,
14
);
.
attr
(
'r'
,
bcr
);
if
(
bdg
.
txt
)
{
bsel
.
append
(
'text'
)
.
attr
(
'transform'
,
sus
.
translate
(
-
5
,
3
))
.
text
(
'42'
);
.
attr
(
'dy'
,
badgeConfig
.
yoff
)
.
attr
(
'text-anchor'
,
'middle'
)
.
text
(
bdg
.
txt
);
}
else
if
(
bdg
.
gid
)
{
bsel
.
append
(
'use'
)
.
attr
({
width
:
bcr
*
2
,
height
:
bcr
*
2
,
'xlink:href'
:
'#'
+
bdg
.
gid
});
}
}
}
...
...
@@ -258,8 +282,7 @@
function
deviceExisting
(
d
)
{
var
node
=
d
.
el
;
node
.
classed
(
'online'
,
d
.
online
);
updateDeviceLabel
(
d
);
updateDeviceBadge
(
d
);
updateDeviceRendering
(
d
);
api
.
posNode
(
d
,
true
);
}
...
...
@@ -574,7 +597,7 @@
deviceLabel
:
deviceLabel
,
trimLabel
:
trimLabel
,
updateDeviceLabel
:
updateDevice
Label
,
updateDeviceLabel
:
updateDevice
Rendering
,
updateHostLabel
:
updateHostLabel
,
updateDeviceColors
:
updateDeviceColors
,
...
...
Please
register
or
login
to post a comment