Merge branch 'master' into em-device-ports-json

This commit is contained in:
Oliver Gorwits
2014-10-11 12:03:36 +01:00
33 changed files with 434 additions and 284 deletions

View File

@@ -130,9 +130,10 @@ nbtstat_only: []
nbtstat_max_age: 7
nbtstat_interval: 0.02
nbtstat_timeout: 1
expire_devices: 0
expire_nodes: 0
expire_nodes_archive: 0
expire_devices: 60
expire_nodes: 90
expire_nodes_archive: 60
expire_jobs: 14
store_wireless_clients: true
store_modules: true
ignore_interfaces:

View File

@@ -24,45 +24,53 @@
* See: http://js-naturalsort.googlecode.com/svn/trunk/naturalSort.js
*/
function portSort (a, b) {
var re = /(^(-?\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,
var re = /(^0x[0-9a-f]+$|[0-9]+)/gi,
// string regex
sre = /(^[ ]*|[ ]*$)/g,
sre = /(^[ ]*|[ ]*$)/g,
// octal regex
ore = /^0/,
// convert all to strings and trim()
x = a.toString().replace(sre, '') || '',
y = b.toString().replace(sre, '') || '';
// hack for foundry "10GigabitEthernet" -> cisco-like "TenGigabitEthernet"
x = x.replace(/^10GigabitEthernet/, 'GigabitEthernet');
y = y.replace(/^10GigabitEthernet/, 'GigabitEthernet');
// chunk/tokenize
var xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0');
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
// handle numeric vs string comparison - number < string - (Kyle Adams)
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) return (isNaN(oFxNcL)) ? 1 : -1;
// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
else if (typeof oFxNcL !== typeof oFyNcL) {
oFxNcL += '';
oFyNcL += '';
}
if (oFxNcL < oFyNcL) return -1;
if (oFxNcL > oFyNcL) return 1;
}
return 0;
ore = /^0/,
// convert all to strings and trim()
x = a.toString().replace(sre, '') || '',
y = b.toString().replace(sre, '') || '';
// hack for foundry "10GigabitEthernet" -> cisco-like "TenGigabitEthernet"
x = x.replace(/^10GigabitEthernet/, 'GigabitEthernet');
y = y.replace(/^10GigabitEthernet/, 'GigabitEthernet');
// chunk/tokenize
var xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0');
for (var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
// handle numeric vs string comparison - number < string - (Kyle Adams)
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) {
return (isNaN(oFxNcL)) ? 1 : -1;
}
// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
else if (typeof oFxNcL !== typeof oFyNcL) {
oFxNcL += '';
oFyNcL += '';
}
if (oFxNcL < oFyNcL) { return -1; }
if (oFxNcL > oFyNcL) { return 1; }
}
return 0;
}
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"portsort-asc": function ( a, b ) {
return portSort(a,b);
},
"portsort-asc": function ( a, b ) {
return portSort(a,b);
},
"portsort-desc": function ( a, b ) {
return portSort(a,b) * -1;
}
"portsort-desc": function ( a, b ) {
return portSort(a,b) * -1;
}
} );
}());

View File

@@ -80,6 +80,17 @@
[% END %]
</tr>
[% END %]
<tr>
<td>Administration</td>
<td>
<a href="ssh://[% d.ip | html_entity %]" target="_blank">
<span class="label label-info"><i class="icon-keyboard"></i> SSH</span></a>
<a href="telnet://[% d.ip | html_entity %]" target="_blank">
<span class="label label-info"><i class="icon-keyboard"></i> Telnet</span></a>
<a href="https://[% d.ip | html_entity %]/" target="_blank">
<span class="label label-info"><i class="icon-external-link"></i> Web</span></a>
</td>
</tr>
<tr>
<td>Uptime</td>
<td>[% d.uptime_age | html_entity %]</td>

View File

@@ -48,7 +48,7 @@ $(document).ready(function() {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}
].
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});

View File

@@ -17,6 +17,7 @@
[% INCLUDE "sidebar/report/${report.tag}.tt" %]
[% CATCH %]
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 0;</script>
[% INCLUDE "sidebar/report/generic_report.tt" %]
[% END %]
</form>
</div> <!-- /tab-pane -->

View File

@@ -0,0 +1,4 @@
[% FOREACH k IN report.rconfig.bind_params %]
<input name="[% k %]" value="[% params.$k | html_entity %]" type="hidden"/>
[% END %]