5cb88e8d06
* Revert "Use resolved data if gateway was already resolved (#78)" This reverts commit44bb8e9d3d
. * Revert "proportions: lookup gateway name" This reverts commit94662cb3dc
. * Revert "infobox/node: change mac used to lookup nodes" This reverts commit2ca2604403
. * Revert "infobox/node: resolve nexthop and gateway from data" This reverts commit9e7049c9e3
. * Resolve nexthop full chain if possible requires hopglass/hopglass-server#79 * Correctly handle sidecase when nodes on route report inconsistent gateway
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Node, Location) {
|
|
return function (config, sidebar, router) {
|
|
var self = this
|
|
var el
|
|
|
|
function destroy() {
|
|
if (el && el.parentNode) {
|
|
el.parentNode.removeChild(el)
|
|
el = undefined
|
|
sidebar.reveal()
|
|
}
|
|
}
|
|
|
|
function create() {
|
|
destroy()
|
|
sidebar.ensureVisible()
|
|
sidebar.hide()
|
|
|
|
el = document.createElement("div")
|
|
sidebar.container.insertBefore(el, sidebar.container.firstChild)
|
|
|
|
el.scrollIntoView(false)
|
|
el.classList.add("infobox")
|
|
el.destroy = destroy
|
|
|
|
var closeButton = document.createElement("button")
|
|
closeButton.classList.add("close")
|
|
closeButton.onclick = router.reset
|
|
el.appendChild(closeButton)
|
|
}
|
|
|
|
self.resetView = destroy
|
|
|
|
self.gotoNode = function (d) {
|
|
create()
|
|
new Node(config, el, router, d)
|
|
}
|
|
|
|
self.gotoLink = function (d) {
|
|
create()
|
|
new Link(config, el, router, d)
|
|
}
|
|
|
|
self.gotoLocation = function (d) {
|
|
create()
|
|
new Location(config, el, router, d)
|
|
}
|
|
|
|
return self
|
|
}
|
|
})
|