Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
meshviewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infrastruktur
meshviewer
Commits
7b57a224
Commit
7b57a224
authored
Apr 2, 2015
by
Nils Schneider
Browse files
Options
Downloads
Patches
Plain Diff
make meshstats, simplenodelist setData idempotent
parent
389291e5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
app.js
+1
-0
1 addition, 0 deletions
app.js
bower.json
+2
-1
2 additions, 1 deletion
bower.json
lib/meshstats.js
+11
-7
11 additions, 7 deletions
lib/meshstats.js
lib/simplenodelist.js
+46
-44
46 additions, 44 deletions
lib/simplenodelist.js
with
60 additions
and
52 deletions
app.js
+
1
−
0
View file @
7b57a224
...
...
@@ -10,6 +10,7 @@ require.config({
"
d3
"
:
"
../bower_components/d3/d3.min
"
,
"
numeral
"
:
"
../bower_components/numeraljs/min/numeral.min
"
,
"
numeral-intl
"
:
"
../bower_components/numeraljs/min/languages.min
"
,
"
virtual-dom
"
:
"
../bower_components/virtual-dom/dist/virtual-dom
"
,
"
helper
"
:
"
../helper
"
},
shim
:
{
...
...
This diff is collapsed.
Click to expand it.
bower.json
+
2
−
1
View file @
7b57a224
...
...
@@ -21,7 +21,8 @@
"r.js"
:
"~2.1.16"
,
"d3"
:
"~3.5.5"
,
"numeraljs"
:
"~1.5.3"
,
"roboto-fontface"
:
"~0.3.0"
"roboto-fontface"
:
"~0.3.0"
,
"virtual-dom"
:
"~2.0.1"
},
"authors"
:
[
"Nils Schneider <nils@nilsschneider.net>"
...
...
This diff is collapsed.
Click to expand it.
lib/meshstats.js
+
11
−
7
View file @
7b57a224
define
(
function
()
{
return
function
()
{
var
self
=
this
var
p
var
stats
,
timestam
p
self
.
setData
=
function
(
d
)
{
var
totalNodes
=
sum
(
d
.
nodes
.
all
.
filter
(
online
).
map
(
one
))
...
...
@@ -12,12 +12,11 @@ define(function () {
return
d
.
flags
.
gateway
}).
map
(
one
))
p
.
textContent
=
totalNodes
+
"
Knoten (online),
"
+
stats
.
textContent
=
totalNodes
+
"
Knoten (online),
"
+
totalClients
+
"
Clients,
"
+
totalGateways
+
"
Gateways
"
p
.
appendChild
(
document
.
createElement
(
"
br
"
))
p
.
appendChild
(
document
.
createTextNode
(
"
Diese Daten sind von
"
+
d
.
timestamp
.
format
(
"
LLLL
"
)
+
"
.
"
))
timestamp
.
textContent
=
"
Diese Daten sind von
"
+
d
.
timestamp
.
format
(
"
LLLL
"
)
+
"
.
"
}
self
.
render
=
function
(
el
)
{
...
...
@@ -25,8 +24,13 @@ define(function () {
h2
.
textContent
=
"
Übersicht
"
el
.
appendChild
(
h2
)
p
=
document
.
createElement
(
"
p
"
)
var
p
=
document
.
createElement
(
"
p
"
)
el
.
appendChild
(
p
)
stats
=
document
.
createTextNode
(
""
)
p
.
appendChild
(
stats
)
p
.
appendChild
(
document
.
createElement
(
"
br
"
))
timestamp
=
document
.
createTextNode
(
""
)
p
.
appendChild
(
timestamp
)
}
return
self
...
...
This diff is collapsed.
Click to expand it.
lib/simplenodelist.js
+
46
−
44
View file @
7b57a224
define
([
"
moment
"
],
function
(
moment
)
{
define
([
"
moment
"
,
"
virtual-dom
"
],
function
(
moment
,
V
)
{
return
function
(
config
,
nodes
,
field
,
router
,
title
)
{
var
self
=
this
var
el
var
el
,
tbody
self
.
render
=
function
(
d
)
{
el
=
document
.
createElement
(
"
div
"
)
...
...
@@ -11,52 +11,54 @@ define(["moment"], function (moment) {
self
.
setData
=
function
(
data
)
{
var
list
=
data
.
nodes
[
nodes
]
if
(
list
.
length
===
0
)
if
(
list
.
length
===
0
)
{
while
(
el
.
firstChild
)
el
.
removeChild
(
el
.
firstChild
)
tbody
=
null
return
}
if
(
!
tbody
)
{
var
h2
=
document
.
createElement
(
"
h2
"
)
h2
.
textContent
=
title
el
.
appendChild
(
h2
)
var
table
=
document
.
createElement
(
"
table
"
)
el
.
appendChild
(
table
)
var
tbody
=
document
.
createElement
(
"
tbody
"
)
list
.
forEach
(
function
(
d
)
{
var
time
=
moment
(
d
[
field
]).
fromNow
()
var
row
=
document
.
createElement
(
"
tr
"
)
var
td1
=
document
.
createElement
(
"
td
"
)
var
a
=
document
.
createElement
(
"
a
"
)
a
.
classList
.
add
(
"
hostname
"
)
a
.
classList
.
add
(
d
.
flags
.
online
?
"
online
"
:
"
offline
"
)
a
.
textContent
=
d
.
nodeinfo
.
hostname
a
.
href
=
"
#
"
a
.
onclick
=
router
.
node
(
d
)
td1
.
appendChild
(
a
)
if
(
has_location
(
d
))
{
var
span
=
document
.
createElement
(
"
span
"
)
span
.
classList
.
add
(
"
icon
"
)
span
.
classList
.
add
(
"
ion-location
"
)
td1
.
appendChild
(
span
)
tbody
=
document
.
createElement
(
"
tbody
"
)
tbody
.
last
=
V
.
h
(
"
tbody
"
)
table
.
appendChild
(
tbody
)
}
if
(
"
owner
"
in
d
.
nodeinfo
&&
config
.
showContact
)
{
var
contact
=
d
.
nodeinfo
.
owner
.
contact
td1
.
appendChild
(
document
.
createTextNode
(
"
–
"
+
contact
+
""
))
}
var
items
=
list
.
map
(
function
(
d
)
{
var
time
=
moment
(
d
[
field
]).
from
(
data
.
now
)
var
td1Content
=
[]
var
td2
=
document
.
createElement
(
"
td
"
)
td2
.
textContent
=
time
var
aClass
=
[
"
hostname
"
,
d
.
flags
.
online
?
"
online
"
:
"
offline
"
]
row
.
appendChild
(
td1
)
row
.
appendChild
(
td2
)
tbody
.
appendChild
(
row
)
td1Content
.
push
(
V
.
h
(
"
a
"
,
{
className
:
aClass
.
join
(
"
"
),
onclick
:
router
.
node
(
d
),
href
:
"
#
"
},
d
.
nodeinfo
.
hostname
))
if
(
has_location
(
d
))
td1Content
.
push
(
V
.
h
(
"
span
"
,
{
className
:
"
icon ion-location
"
}))
if
(
"
owner
"
in
d
.
nodeinfo
&&
config
.
showContact
)
td1Content
.
push
(
"
-
"
+
d
.
nodeinfo
.
owner
.
contact
)
var
td1
=
V
.
h
(
"
td
"
,
td1Content
)
var
td2
=
V
.
h
(
"
td
"
,
time
)
return
V
.
h
(
"
tr
"
,
[
td1
,
td2
])
})
table
.
appendChild
(
tbody
)
el
.
appendChild
(
table
)
var
tbodyNew
=
V
.
h
(
"
tbody
"
,
items
)
tbody
=
V
.
patch
(
tbody
,
V
.
diff
(
tbody
.
last
,
tbodyNew
))
tbody
.
last
=
tbodyNew
}
return
self
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment