DHCP Lease Option display toggle
This commit is contained in:
parent
82c39d3d72
commit
d0be12a3e5
|
@ -1,5 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#::: Chris Miles - Utility script
|
||||
|
||||
use POSIX qw(strftime);
|
||||
|
||||
my $output_format = 'human';
|
|
@ -14,7 +14,7 @@
|
|||
<th>Hostname</th>
|
||||
<th>Start</th>
|
||||
<th>End</th>
|
||||
<th>Options</th>
|
||||
<th>Option Data</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -33,4 +33,17 @@
|
|||
"pageLength": 100,
|
||||
"aaSorting": []
|
||||
});
|
||||
</script>
|
||||
|
||||
$('.option_data').click(function(){
|
||||
var lease = $(this).attr("lease");
|
||||
if ( $("#" + lease).is(":visible") ) {
|
||||
$("#" + lease).hide();
|
||||
$(this).text('Show');
|
||||
} else if ( $("#" + lease).is(":hidden") ) {
|
||||
$("#" + lease).show();
|
||||
$(this).text('Hide');
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ router.get('/', function(req, res, next) {
|
|||
|
||||
table_data = '';
|
||||
|
||||
var count = 0;
|
||||
for (var key in dhcp_lease_data) {
|
||||
|
||||
table_row = '';
|
||||
|
@ -28,9 +29,18 @@ router.get('/', function(req, res, next) {
|
|||
table_row = table_row + '<td>' + (dhcp_lease_data[key].host ? dhcp_lease_data[key].host : '') + '</td>';
|
||||
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].start * 1000) + '</td>';
|
||||
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].end * 1000) + '</td>';
|
||||
table_row = table_row + '<td>' + </td>';
|
||||
table_row = table_row + '<td>' +
|
||||
'<button class="btn btn-default waves-effect option_data" lease="' + dhcp_lease_data[key].mac.split(":").join("") + '">Show</button>' +
|
||||
'<pre style="display:none;margin-top:10px" id="' + dhcp_lease_data[key].mac.split(":").join("") + '">' + JSON.stringify(dhcp_lease_data[key].options, null, 2) + '</pre>' +
|
||||
'</td>';
|
||||
|
||||
table_data = table_data + '<tr>' + table_row + '</tr>';
|
||||
|
||||
count++;
|
||||
|
||||
if(count > 30){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
table_data = template_render.set_template_variable(dhcp_leases, "table_data", table_data);
|
||||
|
|
Loading…
Reference in New Issue