Files
netdisco/share/views/ajax/search/port.tt
nick n 6a36baa961 add a new tab to device -> vlans (#483)
* first steps for vlan tab

* export sort_vlans, use strict/warnings

* update manifest, get worker closer to functioning

* remove ie 9 script & extra ./th

* make it work

* cleanup

* readd internet explorer code

* start for csv output

* move things to debug logging instead of info

* use message which was discussed

* fix for address table sorting

* link os

* final touches thx to ollyg

* fetch origin/master

* VLAN is the preferred style for user interface usage

* does a missing libexpat-dev make travis builds complain?

* Revert "does a missing libexpat-dev make travis builds complain?"

This reverts commit 0cebc66f42708ff0f946213aab4bcbcc1b1b1379.
2019-01-14 21:57:37 +00:00

77 lines
2.2 KiB
Plaintext

<table id="ps-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Status</th>
<th>Name</th>
<th>Port</th>
<th>VLAN</th>
<th>Speed</th>
<th>Last Change</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#ps-data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columnDefs": [
{ "sortable": false, "targets": 0 },
{ "searchable": false, "targets": 0 },
{ "type": 'portsort', "targets": [ 'portsort' ] }
],
"order": [[ 1, 'asc' ]],
"columns": [{
"data": 'up',
"className": "nd_center-cell nd_devport-icon",
"render": function(data, type, row, meta) {
if (row.up_admin != "up") {
return'<i class="icon-remove"></i>';
}
else if (row.up_admin == "up" && (row.up != "up" && row.up != "dormant")) {
return '<i class="icon-arrow-down text-error"></i>';
}
else {
return '<i class="icon-angle-up text-success"></i>';
}
}
}, {
"data": 'name',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'ip',
"className": "nd_nowrap nd_center-cell",
"render": function(data, type, row, meta) {
var ddns = '';
if (row.device.dns || row.device.name) {
ddns = '<br>(' + he.encode(row.device.dns || row.device.name) + ')';
}
return '<a href="[% device_ports %]&q=' + encodeURIComponent(data)
+ '&f=' + encodeURIComponent(row.port) + '">' + he.encode(data)
+ ' [' + he.encode(row.port) + ']</a>' + ddns;
}
}, {
"data": 'port_vlans.vlan',
"render": function(data, type, row, meta) {
return data || '';
}
}, {
"data": 'speed',
"render": function(data, type, row, meta) {
return data || '';
}
}, {
"data": 'lastchange_stamp',
"render": function(data, type, row, meta) {
return data || '';
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});</script>