make eslint happy
This commit is contained in:
parent
ecb65c9171
commit
3e143435e6
14 changed files with 120 additions and 103 deletions
44
lib/map.js
44
lib/map.js
|
|
@ -10,7 +10,7 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) {
|
|||
m.setStyle(iconFunc(d))
|
||||
}
|
||||
|
||||
m.on('click', router.node(d))
|
||||
m.on("click", router.node(d))
|
||||
m.bindLabel(d.nodeinfo.hostname)
|
||||
|
||||
dict[d.nodeinfo.node_id] = m
|
||||
|
|
@ -38,7 +38,7 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) {
|
|||
}
|
||||
|
||||
line.bindLabel(d.source.node.nodeinfo.hostname + " – " + d.target.node.nodeinfo.hostname + "<br><strong>" + showDistance(d) + " / " + showTq(d) + "</strong>")
|
||||
line.on('click', router.link(d))
|
||||
line.on("click", router.link(d))
|
||||
|
||||
dict[linkId(d)] = line
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) {
|
|||
var self = this
|
||||
|
||||
var el = document.createElement("div")
|
||||
el.classList.add("map")
|
||||
el.classList.add("map")
|
||||
self.div = el
|
||||
|
||||
var map = L.map(el, options)
|
||||
|
|
@ -88,17 +88,17 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) {
|
|||
var nodesOffline = subtract(nodes.filter(offline), lostnodes)
|
||||
|
||||
var markersOnline = nodesOnline.filter(has_location)
|
||||
.map(mkMarker(nodeDict, function (d) { return iconOnline }, router))
|
||||
.map(mkMarker(nodeDict, function () { return iconOnline }, router))
|
||||
|
||||
var markersOffline = nodesOffline.filter(has_location)
|
||||
.map(mkMarker(nodeDict, function (d) { return iconOffline }, router))
|
||||
.map(mkMarker(nodeDict, function () { return iconOffline }, router))
|
||||
|
||||
var markersNew = newnodes.filter(has_location)
|
||||
.map(mkMarker(nodeDict, function (d) { return iconNew }, router))
|
||||
.map(mkMarker(nodeDict, function () { return iconNew }, router))
|
||||
|
||||
var markersLost = lostnodes.filter(has_location)
|
||||
.map(mkMarker(nodeDict, function (d) {
|
||||
if (d.lastseen.isAfter(moment(now).subtract(3, 'days')))
|
||||
if (d.lastseen.isAfter(moment(now).subtract(3, "days")))
|
||||
return iconAlert
|
||||
|
||||
return iconLost
|
||||
|
|
@ -110,6 +110,20 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) {
|
|||
groupLost = L.featureGroup(markersLost).addTo(map)
|
||||
}
|
||||
|
||||
function resetMarkerStyles(nodes, links) {
|
||||
Object.keys(nodes).forEach( function (d) {
|
||||
nodes[d].resetStyle()
|
||||
})
|
||||
|
||||
Object.keys(links).forEach( function (d) {
|
||||
links[d].resetStyle()
|
||||
})
|
||||
}
|
||||
|
||||
function setView(bounds) {
|
||||
map.fitBounds(bounds, {paddingTopLeft: [sidebar.getWidth(), 0]})
|
||||
}
|
||||
|
||||
function resetView() {
|
||||
resetMarkerStyles(nodeDict, linkDict)
|
||||
|
||||
|
|
@ -127,24 +141,10 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) {
|
|||
setView(bounds)
|
||||
}
|
||||
|
||||
function setView(bounds) {
|
||||
map.fitBounds(bounds, {paddingTopLeft: [sidebar.getWidth(), 0]})
|
||||
}
|
||||
|
||||
function resetMarkerStyles(nodes, links) {
|
||||
Object.keys(nodes).forEach( function (d) {
|
||||
nodes[d].resetStyle()
|
||||
})
|
||||
|
||||
Object.keys(links).forEach( function (d) {
|
||||
links[d].resetStyle()
|
||||
})
|
||||
}
|
||||
|
||||
function goto(dict, id) {
|
||||
var m = dict[id]
|
||||
if (m === undefined)
|
||||
return
|
||||
return undefined
|
||||
|
||||
var bounds
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue