basic filter support
This commit is contained in:
parent
aeae866998
commit
09bdb7d61a
8 changed files with 246 additions and 38 deletions
|
|
@ -1,7 +1,7 @@
|
|||
define(["chroma-js", "virtual-dom", "numeral-intl", "vercomp" ],
|
||||
function (Chroma, V, numeral, vercomp) {
|
||||
define(["chroma-js", "virtual-dom", "numeral-intl", "filters/genericnode", "vercomp" ],
|
||||
function (Chroma, V, numeral, Filter, vercomp) {
|
||||
|
||||
return function (config) {
|
||||
return function (config, filterManager) {
|
||||
var self = this
|
||||
var scale = Chroma.scale("YlGnBu").mode("lab")
|
||||
|
||||
|
|
@ -68,10 +68,18 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "vercomp" ],
|
|||
dict[v] = 1 + (v in dict ? dict[v] : 0)
|
||||
})
|
||||
|
||||
return Object.keys(dict).map(function (d) { return [d, dict[d]] })
|
||||
return Object.keys(dict).map(function (d) { return [d, dict[d], key, f] })
|
||||
}
|
||||
|
||||
function fillTable(table, data) {
|
||||
function addFilter(filter) {
|
||||
return function () {
|
||||
filterManager.addFilter(filter)
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function fillTable(name, table, data) {
|
||||
if (!table.last)
|
||||
table.last = V.h("table")
|
||||
|
||||
|
|
@ -86,7 +94,11 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "vercomp" ],
|
|||
var c1 = Chroma.contrast(scale(v), "white")
|
||||
var c2 = Chroma.contrast(scale(v), "black")
|
||||
|
||||
var th = V.h("th", d[0])
|
||||
var filter = new Filter(name, d[2], d[0], d[3])
|
||||
|
||||
var a = V.h("a", { href: "#", onclick: addFilter(filter) }, d[0])
|
||||
|
||||
var th = V.h("th", a)
|
||||
var td = V.h("td", V.h("span", {style: {
|
||||
width: Math.round(v * 100) + "%",
|
||||
backgroundColor: scale(v).hex(),
|
||||
|
|
@ -127,11 +139,11 @@ define(["chroma-js", "virtual-dom", "numeral-intl", "vercomp" ],
|
|||
return "(deaktiviert)"
|
||||
})
|
||||
|
||||
fillTable(statusTable, statusDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
fillTable(fwTable, fwDict.sort(function (a, b) { return vercomp(b[0], a[0]) }))
|
||||
fillTable(hwTable, hwDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
fillTable(geoTable, geoDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
fillTable(autoTable, autoDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
fillTable("Status", statusTable, statusDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
fillTable("Firmware", fwTable, fwDict.sort(function (a, b) { return vercomp(b[0], a[0]) }))
|
||||
fillTable("Hardware", hwTable, hwDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
fillTable("Koordinaten", geoTable, geoDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
fillTable("Autom. Updates", autoTable, autoDict.sort(function (a, b) { return b[1] - a[1] }))
|
||||
}
|
||||
|
||||
self.render = function (el) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue