Make sure hopglass does not break when server reports nodes without hostname. (#58)
This commit is contained in:
parent
46de672dc9
commit
bf2e858c24
|
@ -21,7 +21,11 @@ define(["sorttable", "virtual-dom", "numeral"], function (SortTable, V, numeral)
|
|||
|
||||
var headings = [{ name: "Knoten",
|
||||
sort: function (a, b) {
|
||||
return a.nodeinfo.hostname.localeCompare(b.nodeinfo.hostname)
|
||||
var aname = typeof a.nodeinfo.hostname === "string" ? a.nodeinfo.hostname : a.nodeinfo.node_id
|
||||
var bname = typeof b.nodeinfo.hostname === "string" ? b.nodeinfo.hostname : b.nodeinfo.node_id
|
||||
if (typeof aname === "string" && typeof bname === "string")
|
||||
return aname.localeCompare(bname)
|
||||
return typeof aname === "string" ? 1 : typeof bname === "string" ? -1 : 0
|
||||
},
|
||||
reverse: false
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue