98 lines
3.4 KiB
Plaintext
98 lines
3.4 KiB
Plaintext
[% IF opt %]
|
|
<table id="data-table" class="table table-striped table-bordered nd_floatinghead" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th>Device</th>
|
|
<th>Description</th>
|
|
<th>Name</th>
|
|
<th>Class</th>
|
|
<th>Type</th>
|
|
<th>Model</th>
|
|
<th>Serial</th>
|
|
<th>HW Version</th>
|
|
<th>SW Version</th>
|
|
<th>FW Version</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
[% ELSE %]
|
|
<table id="data-table" class="table table-striped table-bordered nd_floatinghead" width="100%" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th>Class</th>
|
|
<th>Count</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
[% END %]
|
|
|
|
<script type="text/javascript">
|
|
function capitaliseFirstLetter(string) {
|
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
var table = $('#data-table').dataTable({
|
|
"deferRender": true,
|
|
"data": [% results %],
|
|
"columns": [
|
|
[% IF opt %] {
|
|
data: 'ip',
|
|
render: function(data, type, row, meta) {
|
|
return '<a href="[% uri_for('/device') %]?tab=modules&q=' + data + '">' + (row.device.dns || row.device.name || row.ip) + '</a>';
|
|
}
|
|
}, {
|
|
data: 'description',
|
|
render: function(data, type, full, meta) {
|
|
return '<a href="[% uri_for('/report/moduleinventory') %]?description=' + data + '">' + data + '</a>';
|
|
}
|
|
}, {
|
|
data: 'name',
|
|
render: function(data, type, full, meta) {
|
|
return '<a href="[% uri_for('/report/moduleinventory') %]?name=' + data + '">' + data + '</a>';
|
|
}
|
|
}, {
|
|
data: 'class',
|
|
render: function(data, type, full, meta) {
|
|
return '<a href="[% uri_for('/report/moduleinventory') %]?class=' + data + '">' + capitaliseFirstLetter(data) + '</a>';
|
|
}
|
|
}, {
|
|
data: 'type',
|
|
render: function(data, type, full, meta) {
|
|
return '<a href="[% uri_for('/report/moduleinventory') %]?type=' + data + '">' + data + '</a>';
|
|
}
|
|
}, {
|
|
data: 'model',
|
|
render: function(data, type, full, meta) {
|
|
return '<a href="[% uri_for('/report/moduleinventory') %]?model=' + data + '">' + data + '</a>';
|
|
}
|
|
}, {
|
|
data: 'serial',
|
|
render: function(data, type, full, meta) {
|
|
return '<a href="[% uri_for('/report/moduleinventory') %]?serial=' + data + '">' + data + '</a>';
|
|
}
|
|
}, {
|
|
data: 'hw_ver'
|
|
}, {
|
|
data: 'sw_ver'
|
|
}, {
|
|
data: 'fw_ver'
|
|
}
|
|
[% ELSE %] {
|
|
data: 'class',
|
|
render: function(data, type, full, meta) {
|
|
return '<a href="[% uri_for('/report/moduleinventory') %]?class=' + data + '">' + capitaliseFirstLetter(data) + '</a>';
|
|
}
|
|
}, {
|
|
data: 'count',
|
|
render: function(data, type, full, meta) {
|
|
return data.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
}
|
|
}
|
|
[% END %]
|
|
]
|
|
});
|
|
|
|
});
|
|
</script>
|