Update IP Inventory to show MAC address and have working Last Used sort

This commit is contained in:
Oliver Gorwits
2014-12-24 18:23:13 +00:00
parent 692482caa7
commit cceae236d1
6 changed files with 41 additions and 28 deletions

View File

@@ -2,9 +2,9 @@
<thead>
<tr>
<th>Node</th>
<th>DNS</th>
<th>MAC Address</th>
<th class="nd_center-cell">DNS</th>
<th>Last Used</th>
<th>First Discovered</th>
</tr>
</thead>
</table>
@@ -31,20 +31,33 @@ $(document).ready(function() {
}
return cell_str;
}
}, {
"data": 'mac',
"render": function(data, type, row, meta) {
var cell_str = he.encode(data || '');
if (type == 'display' && data && row.time_last) {
cell_str = '<a href="[% search_node %]&q=' + encodeURIComponent(data)
+ (row.active ? '' : '&archived=on') + '">' + he.encode(data)
+ (row.active ? '' : '&nbsp;<i class="icon-book text-warning"></i>&nbsp;') + '</a>';
}
return cell_str;
}
}, {
"data": 'dns',
"className": "nd_nowrap nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'age',
"render": function(data, type, row, meta) {
return he.encode(data || 'Never');
}
}, {
"data": 'time_first',
"render": function(data, type, row, meta) {
return he.encode(data || 'Never');
if (type == 'display') {
return he.encode(data || 'Never');
}
else {
// so that sorting works correctly on this column
return row.time_last;
}
}
}
],

View File

@@ -33,22 +33,14 @@
<div class="clearfix">
<ul class="unstyled">
<li>
<em class="muted">Limit:</em><br/>
<em class="muted">Oldest records limit:</em><br/>
<select id="nd_mac-format" class="nd_side-select" name="limit">
[% FOREACH size IN [ '32', '64', '128', '256', '1024', '2048', '4096', '8192' ] %]
<option[% ' selected="selected"' IF (params.limit == size OR (NOT params.limit AND size == 256)) %]>
[% FOREACH size IN [ '32', '64', '128', '256', '512', '1024', '2048', '4096', '8192' ] %]
<option[% ' selected="selected"' IF (params.limit == size OR (NOT params.limit AND size == 2048)) %]>
[% size %]</option>
[% END %]
</select>
</li>
<li>
<em class="muted">Order By:</em><br/>
<select id="nd_mac-format" class="nd_side-select" name="order">
[% FOREACH item IN [ 'IP', 'Age' ] %]
<option[% ' selected="selected"' IF params.order == item %]>[% item %]</option>
[% END %]
</select>
</li>
</ul>
<div class="clearfix input-prepend"
rel="tooltip" data-placement="left" data-offset="5" data-title="Applies to IPv4 Only">