static/hosts.js
changeset 29 38265b7d8f62
parent 28 9940bc6c0a34
child 30 841d856293a1
--- a/static/hosts.js	Wed Oct 24 20:00:12 2012 +0300
+++ b/static/hosts.js	Wed Oct 24 20:27:39 2012 +0300
@@ -53,17 +53,22 @@
     var animate = false; // true;
 
     function render_host (host) {
-        return html("tr", {id: host.id}, [
+        var columns = [
             html("td", {}, 
                 html("a", { href: params.host.replace('0', host.id) }, "#" )
             ),
-            html("td", {}, host.ip),
-            html("td", {}, host.mac),
-            html("td", {}, host.name),
-            html("td", {}, host.gw),
-            html("td", {}, host.seen),
-            html("td", { 'class': host.state_class }, host.state),
-        ]);
+        ];
+
+        $.each(params.columns, function (i, name) {
+            column = html("td", { class: name }, host[name]);
+
+            if (name == 'state')
+                column.addClass(host['state_class']);
+
+            columns.push(column);
+        });
+
+        return html("tr", {id: host.id}, columns);
     }
 
     function refresh () {