Move column title and name into column definition to support plug-ins
This commit is contained in:
@@ -1,23 +1,5 @@
|
|||||||
[% SET user_can_port_control = user_has_role('port_control') %]
|
[% SET user_can_port_control = user_has_role('port_control') %]
|
||||||
<table id="dp-data-table" class="table table-bordered table-striped" width="100%" cellspacing="0">
|
<table id="dp-data-table" class="table table-bordered table-striped" width="100%" cellspacing="0">
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
[% FOREACH item IN vars.port_columns %]
|
|
||||||
[% NEXT IF item.name == 'c_admin' %]
|
|
||||||
[% NEXT IF item.name == 'c_nodes' AND params.c_nodes AND params.c_neighbors %]
|
|
||||||
[% NEXT IF item.name == 'c_neighbors' AND params.c_nodes AND !params.c_neighbors %]
|
|
||||||
[% NEXT IF item.name == 'c_nodes' AND !params.c_nodes AND params.c_neighbors %]
|
|
||||||
[% SET th_class = '' %]
|
|
||||||
[% IF (user_can_port_control AND params.c_admin AND (item.name == 'c_port' OR item.name == 'c_name')) %]
|
|
||||||
[% th_class = ' class="nd_nudge-for-icon"' %]
|
|
||||||
[% END %]
|
|
||||||
<th[% th_class %]>
|
|
||||||
[% item.label | html_entity %]
|
|
||||||
</th>
|
|
||||||
[% END %]
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -39,6 +21,8 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
|
"title": '',
|
||||||
|
"name": 'icon',
|
||||||
"data": "up",
|
"data": "up",
|
||||||
"searchable": false,
|
"searchable": false,
|
||||||
"sortable": false,
|
"sortable": false,
|
||||||
@@ -67,6 +51,8 @@ $(document).ready(function() {
|
|||||||
return cell_str;
|
return cell_str;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Port',
|
||||||
|
"name": 'c_port',
|
||||||
"data": 'port',
|
"data": 'port',
|
||||||
"type": 'portsort',
|
"type": 'portsort',
|
||||||
[% IF user_can_port_control AND params.c_admin %]
|
[% IF user_can_port_control AND params.c_admin %]
|
||||||
@@ -110,6 +96,8 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Description',
|
||||||
|
"name": 'c_descr',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"type": 'portsort',
|
"type": 'portsort',
|
||||||
"className": 'nd_port-display',
|
"className": 'nd_port-display',
|
||||||
@@ -118,12 +106,16 @@ $(document).ready(function() {
|
|||||||
return type === 'display' ? he.encode(data || '') : data;
|
return type === 'display' ? he.encode(data || '') : data;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Type',
|
||||||
|
"name": 'c_type',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "type",
|
"data": "type",
|
||||||
"render": function(data, type, row, meta) {
|
"render": function(data, type, row, meta) {
|
||||||
return type === 'display' ? he.encode(data || '') : data;
|
return type === 'display' ? he.encode(data || '') : data;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Duplex',
|
||||||
|
"name": 'c_duplex',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "duplex",
|
"data": "duplex",
|
||||||
"render": function(data, type, row, meta) {
|
"render": function(data, type, row, meta) {
|
||||||
@@ -138,9 +130,13 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Last Change',
|
||||||
|
"name": 'c_lastchange',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "lastchange_stamp",
|
"data": "lastchange_stamp",
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Name',
|
||||||
|
"name": 'c_name',
|
||||||
"data": "name",
|
"data": "name",
|
||||||
"type": 'portsort',
|
"type": 'portsort',
|
||||||
[% IF user_can_port_control AND params.c_admin %]
|
[% IF user_can_port_control AND params.c_admin %]
|
||||||
@@ -169,22 +165,30 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
[% END %]
|
[% END %]
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Speed',
|
||||||
|
"name": 'c_speed',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "speed",
|
"data": "speed",
|
||||||
"render": function(data, type, row, meta) {
|
"render": function(data, type, row, meta) {
|
||||||
return type === 'display' ? he.encode(data || '') : data;
|
return type === 'display' ? he.encode(data || '') : data;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Port MAC',
|
||||||
|
"name": 'c_mac',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "mac",
|
"data": "mac",
|
||||||
"render": function(data, type, row, meta) {
|
"render": function(data, type, row, meta) {
|
||||||
return type === 'display' ? he.encode(data || '') : data;
|
return type === 'display' ? he.encode(data || '') : data;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'MTU',
|
||||||
|
"name": 'c_mtu',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
/* mtu is an integer, no need to encode */
|
/* mtu is an integer, no need to encode */
|
||||||
"data": "mtu"
|
"data": "mtu"
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Native VLAN',
|
||||||
|
"name": 'c_pvid',
|
||||||
"data": "native_vlan",
|
"data": "native_vlan",
|
||||||
[% IF user_can_port_control AND params.c_admin %]
|
[% IF user_can_port_control AND params.c_admin %]
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
@@ -220,6 +224,8 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
[% END %]
|
[% END %]
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'VLAN Membership',
|
||||||
|
"name": 'c_vmember',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"type": 'natural',
|
"type": 'natural',
|
||||||
"data": null,
|
"data": null,
|
||||||
@@ -249,6 +255,8 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'PoE',
|
||||||
|
"name": 'c_power',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "power_admin",
|
"data": "power_admin",
|
||||||
"defaultContent": "",
|
"defaultContent": "",
|
||||||
@@ -303,6 +311,8 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'SSID',
|
||||||
|
"name": 'c_ssid',
|
||||||
"data": "null",
|
"data": "null",
|
||||||
"defaultContent": "",
|
"defaultContent": "",
|
||||||
"render": function ( data, type, row, meta ) {
|
"render": function ( data, type, row, meta ) {
|
||||||
@@ -319,6 +329,13 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
[% IF params.c_nodes %]
|
||||||
|
"title": 'Connected Devices and Nodes',
|
||||||
|
"name": 'c_nodes',
|
||||||
|
[% ELSE %]
|
||||||
|
"title": 'Connected Devices',
|
||||||
|
"name": 'c_neighbors',
|
||||||
|
[% END %]
|
||||||
"data": "null",
|
"data": "null",
|
||||||
"defaultContent": "",
|
"defaultContent": "",
|
||||||
"render": function ( data, type, row, meta ) {
|
"render": function ( data, type, row, meta ) {
|
||||||
@@ -503,12 +520,16 @@ $(document).ready(function() {
|
|||||||
return cell_str;
|
return cell_str;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Spanning Tree',
|
||||||
|
"name": 'c_stp',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "stp",
|
"data": "stp",
|
||||||
"render": function(data, type, row, meta) {
|
"render": function(data, type, row, meta) {
|
||||||
return type === 'display' ? he.encode(data || '') : data;
|
return type === 'display' ? he.encode(data || '') : data;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
"title": 'Status',
|
||||||
|
"name": 'c_up',
|
||||||
"visible": false,
|
"visible": false,
|
||||||
"data": "up",
|
"data": "up",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user