relocate repo files so ND2 is the only code

This commit is contained in:
Oliver Gorwits
2017-04-14 23:08:55 +01:00
parent 9a016ea6ba
commit d23b32500f
469 changed files with 0 additions and 6920 deletions

58
share/views/admintask.tt Normal file
View File

@@ -0,0 +1,58 @@
<i class="nd_sidebar-toggle icon-wrench icon-large" id="nd_sidebar-toggle-img-out"
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
<div class="container-fluid">
<div class="nd_sidebar nd_sidebar-pinned">
<div class="well">
<i class="nd_sidebar-toggle icon-signout" id="nd_sidebar-toggle-img-in"
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar" data-container="body"></i>
<i class="nd_sidebar-pin icon-pushpin nd_sidebar-pin-clicked"
rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar" data-container="body"></i>
<div class="tab-content">
<div id="[% task.tag %]_search" class="tab-pane active">
<form id="[% task.tag %]_form" class="nd_sidebar-form form-stacked"
method="get" action="[% uri_for('/admin') %]">
[% TRY %]
<script type="text/javascript">has_sidebar["[% task.tag %]"] = 1;</script>
[% INCLUDE "sidebar/admintask/${task.tag}.tt" %]
[% CATCH %]
<script type="text/javascript">has_sidebar["[% task.tag %]"] = 0;</script>
[% END %]
</form>
</div> <!-- /tab-pane -->
</div> <!-- /tab-content -->
</div>
</div>
<div class="content">
<ul id="nd_search-results" class="nav nav-tabs">
<li class="active"><a id="[% task.tag %]_link" class="nd_single-tab"
href="#[% task.tag %]_pane">[% task.label %]</a></li>
[% IF task.tag == 'jobqueue' %]
<span id="nd_device-name">
<a class="nd_adminbutton" name="delall" href="#"><i class="icon-trash text-error"></i></a>
<a id="nd_countdown-refresh" href="#"><i class="text-success icon-refresh"></i></a>
<a id="nd_countdown-control" href="#">
<i id="nd_countdown-control-icon" class="text-success icon-play"></i></a>
<span id="nd_countdown"></span>
</span>
[% ELSIF task.tag == 'userlog' %]
<span id="nd_device-name">
<a class="nd_adminbutton" name="delall" href="#"><i class="icon-trash text-error"></i></a>
</span>
[% ELSIF task.provides_csv %]
<span id="nd_device-name">
<a id="nd_csv-download" href="#" download="netdisco.csv">
<i id="nd_csv-download-icon" class="text-info icon-file-text-alt icon-large"
rel="tooltip" data-placement="left" data-offset="5" data-title="Download as CSV"></i></a>
</span>
[% END %]
</ul>
<div class="tab-content">
<div class="tab-pane active" id="[% task.tag %]_pane"></div>
</div>
</div>
<script type="text/javascript">
[%+ INCLUDE 'js/admintask.js' -%]
</script>

View File

@@ -0,0 +1,59 @@
[% IF NOT results.size %]
<div class="span2 alert alert-info">The job queue is empty.</div>
[% ELSE %]
<table class="table table-bordered table-condensed table-hover nd_floatinghead">
<thead>
<tr>
<th class="nd_center-cell">Entered</th>
<th class="nd_center-cell">Action</th>
<th class="nd_center-cell">Status</th>
<th class="nd_center-cell">Device</th>
<th class="nd_center-cell">Port</th>
<th class="nd_center-cell">Param</th>
<th class="nd_center-cell">User</th>
<th class="nd_center-cell">Started</th>
<th class="nd_center-cell">Finished</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr
[% ' class="nd_jobqueueitem success"' IF row.status == 'done' %]
[% ' class="nd_jobqueueitem error"' IF row.status == 'error' %]
[% ' class="nd_jobqueueitem info"' IF row.status.search('^queued-') %]
data-content="<pre>[% row.log | html_entity %]</pre>"
>
<td class="nd_center-cell">[% row.entered_stamp | html_entity %]</td>
<td class="nd_center-cell">
[% FOREACH word IN row.action.split('_') %]
[% word.ucfirst | html_entity %]&nbsp;
[% END %]
</td>
[% IF row.status.search('^queued-') %]
<td class="nd_center-cell">Running on &quot;[% row.status.remove('^queued-') | html_entity %]&quot;</td>
[% ELSE %]
<td class="nd_center-cell">[% row.status.ucfirst | html_entity %]</td>
[% END %]
<td class="nd_center-cell">
[% IF row.action == 'discover' AND row.status == 'error' %]
<a href="[% uri_for('/') %]?device=[% row.device | uri %]">[% row.device | html_entity %]</a>
[% ELSE %]
<a href="[% uri_for('/device') %]?q=[% row.device | uri %]">[% row.device | html_entity %]</a>
[% END %]
</td>
<td class="nd_center-cell">[% row.port | html_entity %]</td>
<td class="nd_center-cell">[% row.subaction | html_entity %]</td>
<td class="nd_center-cell">[% row.username | html_entity %]</td>
<td class="nd_center-cell">[% row.started_stamp | html_entity %]</td>
<td class="nd_center-cell">[% row.finished_stamp | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="del" name="job" type="hidden" value="[% row.job | html_entity %]">
<button class="btn nd_adminbutton" name="del" type="submit"><i class="icon-trash text-error"></i></button>
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]

View File

@@ -0,0 +1,88 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Date Added</th>
<th class="nd_center-cell">MAC Address</th>
<th class="nd_center-cell">Enabled</th>
<th class="nd_center-cell">Reason</th>
<th class="nd_center-cell">Email</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell"></td>
<td class="nd_center-cell"><input data-form="add" name="mac" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="active" type="checkbox" checked></td>
<td class="nd_center-cell"><input data-form="add" name="why" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="cc" type="email"></td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% WHILE (row = results.next) %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell">[% row.date | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="update" name="mac" type="text" value="[% row.mac | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="active" type="checkbox" [% 'checked="checked"' IF row.active %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="why" type="text" value="[% row.why | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="cc" type="email" value="[% row.cc | html_entity %]">
</td>
<td class="nd_center-cell">
<button class="btn nd_adminbutton" name="update" type="submit"><i class="icon-save text-warning"></i></button>
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">Monitor for &quot;[% row.mac | html_entity %]&quot; will be removed.</p>
</blockquote>
<input data-form="del" name="mac" type="hidden" value="[% row.mac | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [
{
"targets": [ 0, 2, 5 ],
"searchable": false
},
{
"targets": [ 0, 2, 5 ],
"orderable": false
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,105 @@
[% IF orphans.size > 0 %]
<div class="accordion" id="accordion-orphans">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-orphan" href="#collapse-orphan">
<i class="icon-chevron-up"></i> &nbsp;
Orphaned Devices
</a>
</div>
<div id="collapse-orphan" class="accordion-body collapse">
<div class="accordion-inner">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Device</th>
<th>Location</th>
<th>Contact</th>
<th>Vendor</th>
<th>Model</th>
</tr>
</thead>
<tbody>
[% FOREACH row IN orphans %]
<tr>
<td><a href="[% uri_for('/device') %]?q=[% row.ip | uri %]">
[% row.dns || row.name || row.ip | html_entity %]</a></td>
<td>
[% IF row.location %]
<a href="[% search_device %]&q=[% row.location | uri %]&location=[% row.location | uri %]">
[% row.location | html_entity %]</a>
[% ELSE %]
[Not Set]
[% END %]
</td>
<td>[% row.contact | html_entity %]</td>
<td>[% row.vendor | html_entity %]</td>
<td>[% row.model | html_entity %]</td>
</tr>
[%END%]
</tbody>
</table>
</div>
</div>
</div>
</div>
[% END %]
[%# The largest graph is considered the main network, all others are
considered orphaned, so we need two to generate div %]
[% IF graphs.size > 1 %]
<div class="accordion" id="accordion-networks">
[% count = 0 %]
[% FOREACH network IN graphs %]
[% count = count + 1 %]
[%# The largest is not an orphan, so skip %]
[% NEXT IF count == 1 %]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-[% count %]" href="#collapse-[% count %]">
<i class="icon-chevron-up"></i> &nbsp;
Orphaned Network: [% count - 1 | html_entity %] Size: [% network.size | html_entity %] Devices
</a>
</div>
<div id="collapse-[% count %]" class="accordion-body collapse">
<div class="accordion-inner">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Device</th>
<th>Location</th>
<th>Contact</th>
<th>Vendor</th>
<th>Model</th>
</tr>
</thead>
<tbody>
[% FOREACH row IN network %]
<tr>
<td><a href="[% uri_for('/device') %]?tab=netmap&q=[% row.ip | uri %]">
[% row.dns || row.name || row.ip | html_entity %]</a></td>
<td>
[% IF row.location %]
<a href="[% search_device %]&q=[% row.location | uri %]&location=[% row.location | uri %]">
[% row.location | html_entity %]</a>
[% ELSE %]
[Not Set]
[% END %]
</td>
<td>[% row.contact | html_entity %]</td>
<td>[% row.vendor | html_entity %]</td>
<td>[% row.model | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
</div>
[% END %]
</div>
[% END %]
<script>
$('.accordion').on('show hide', function (n) {
$(n.target).siblings('.accordion-heading').find('.accordion-toggle i').toggleClass('icon-chevron-up icon-chevron-down');
});
</script>

View File

@@ -0,0 +1,51 @@
[% USE CSV -%]
[% CSV.dump(['Orphaned Devices']) %]
[% CSV.dump([ 'Device' 'IP' 'Device Location' 'Contact' ' Vendor'
'Model' ]) %]
[% FOREACH row IN orphans %]
[% mydlist = [] %]
[% mydevice = row.dns || row.name %]
[% mydlist.push(mydevice) %]
[% mydlist.push(row.ip) %]
[% mydlist.push(row.location) %]
[% mydlist.push(row.contact) %]
[% mydlist.push(row.vendor) %]
[% mydlist.push(row.model) %]
[% CSV.dump(mydlist) %]
[% END %]
[% IF graphs.size > 1 %]
[% count = 0 %]
[% FOREACH network IN graphs %]
[% count = count + 1 %]
[%# The largest is not an orphan, so skip %]
[% NEXT IF count == 1 %]
[% CSV.dump([' ']) %]
[% ntwk_header = [] %]
[% ntwk_header.push('Orphaned Network') %]
[% ntwk_header.push(count - 1) %]
[% CSV.dump(ntwk_header) %]
[% CSV.dump([ 'Device' 'IP' 'Device Location' 'Contact' ' Vendor'
'Model' ]) %]
[% FOREACH row IN network %]
[% mydlist = [] %]
[% mydevice = row.dns || row.name %]
[% mydlist.push(mydevice) %]
[% mydlist.push(row.ip) %]
[% mydlist.push(row.location) %]
[% mydlist.push(row.contact) %]
[% mydlist.push(row.vendor) %]
[% mydlist.push(row.model) %]
[% CSV.dump(mydlist) %]
[% END %]
[% END %]
[% END %]

View File

@@ -0,0 +1,55 @@
[% IF results.count == 0 %]
<div class="span3 alert alert-info">The aren't enough jobs to report.</div>
[% ELSE %]
<table id="app-data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Action</th>
<th class="nd_center-cell">Number of Devices</th>
<th class="nd_center-cell">Queued At</th>
<th class="nd_center-cell">Started</th>
<th class="nd_center-cell">Finished</th>
<th class="nd_center-cell">Time Elapsed</th>
</tr>
</thead>
</tbody>
[% WHILE (row = results.next) %]
<tr
[% IF NOT mac AND row.action == 'macsuck' %]
class="info"
[% SET mac = 1 %]
[% ELSIF NOT arp AND row.action == 'arpnip' %]
class="info"
[% SET arp = 1 %]
[% ELSIF NOT dis AND row.action == 'discover' %]
class="info"
[% SET dis = 1 %]
[% ELSIF NOT nbt AND row.action == 'nbtstat' %]
class="info"
[% SET nbt = 1 %]
[% END %]
>
<td class="nd_center-cell">[% row.action.ucfirst | html_entity %]</td>
<td class="nd_center-cell">[% row.number | html_entity %]</td>
<td class="nd_center-cell">[% row.entered_stamp | html_entity %]</td>
<td class="nd_center-cell">[% row.start | html_entity %]</td>
<td class="nd_center-cell">[% row.end | html_entity %]</td>
<td class="nd_center-cell">[% row.elapsed | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<script>
$(document).ready(function() {
$('#app-data-table').dataTable({
"paging": false,
"searching": false,
"info": false,
"order": [[ 2, 'desc' ], [ 5, 'desc' ]],
"pageLength": 50
} );
} );
</script>

View File

@@ -0,0 +1,75 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Device Name</th>
<th class="nd_center-cell">Device IP</th>
<th class="nd_center-cell">Number of Ports</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell"><input data-form="add" name="dns" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="ip" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="ports" type="number"></td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% WHILE (row = results.next) %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell"><a class="nd_linkcell"
href="[% uri_for('/device') %]?q=[% row.ip | uri %]">[% row.dns | html_entity %]</a></td>
<td class="nd_center-cell">[% row.ip | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="update" name="ports" type="number" value="[% row.port_count | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="dns" type="hidden" value="[% row.dns | html_entity %]">
<input data-form="update" name="ip" type="hidden" value="[% row.ip | html_entity %]">
<button class="btn nd_adminbutton" name="update" type="submit"><i class="icon-save text-warning"></i></button>
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">
Pseudo-device &quot;[% row.dns | html_entity %] / [% row.ip | html_entity %]&quot; will be deleted.</p>
</blockquote>
<input data-form="del" name="dns" type="hidden" value="[% row.dns | html_entity %]">
<input data-form="del" name="ip" type="hidden" value="[% row.ip | html_entity %]">
<input data-form="del" name="ports" type="hidden" value="[% row.port_count | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [ {
"targets": [ 2, 3 ],
"orderable": false,
"searchable": false
} ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,39 @@
[% IF results.count == 0 %]
<div class="span3 alert alert-info">The aren't enough jobs to report.</div>
[% ELSE %]
<table id="asd-data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Action</th>
<th class="nd_center-cell">Device</th>
<th class="nd_center-cell">Started</th>
<th class="nd_center-cell">Finished</th>
<th class="nd_center-cell">Time Elapsed</th>
</tr>
</thead>
</tbody>
[% WHILE (row = results.next) %]
<tr>
<td class="nd_center-cell">[% row.action.ucfirst | html_entity %]</td>
<td class="nd_center-cell"><a class="nd_linkcell"
href="[% uri_for('/device') %]?q=[% row.device | uri %]">[% row.device | html_entity %]</a></td>
<td class="nd_center-cell">[% row.started | html_entity %]</td>
<td class="nd_center-cell">[% row.finished | html_entity %]</td>
<td class="nd_center-cell">[% row.elapsed | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<script>
$(document).ready(function() {
$('#asd-data-table').dataTable({
"paging": false,
"searching": false,
"info": false,
"order": [[ 4, 'desc' ], [ 0, 'asc' ], [ 1, 'asc' ] ],
"pageLength": 12
});
} );
</script>

View File

@@ -0,0 +1,101 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Left Device</th>
<th class="nd_center-cell">Left Port</th>
<th class="nd_center-cell">Right Device</th>
<th class="nd_center-cell">Right Port</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_dev nd_topo_dev1" name="dev1" type="text">
<span class="add-on nd_topo_dev_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_port nd_topo_dev1" name="port1" type="text">
<span class="add-on nd_topo_port_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_dev nd_topo_dev2" name="dev2" type="text">
<span class="add-on nd_topo_dev_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_port nd_topo_dev2" name="port2" type="text">
<span class="add-on nd_topo_port_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% WHILE (row = results.next) %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell"><a class="nd_linkcell" href="[% uri_for('/device') %]?q=[% row.device1.ip | uri %]">
[% (row.device1.dns || row.device1.name || row.device1.ip) | html_entity %]</a>
</td>
<td class="nd_center-cell">[% row.port1 | html_entity %]</td>
<td class="nd_center-cell"><a class="nd_linkcell" href="[% uri_for('/device') %]?q=[% row.device2.ip | uri %]">
[% (row.device2.dns || row.device2.name || row.device2.ip) | html_entity %]</a></td>
<td class="nd_center-cell">[% row.port2 | html_entity %]</td>
<td class="nd_center-cell">
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">The link between these two ports will be removed:</p>
<p>&nbsp;</p>
<ul>
<li><p class="text-info">[% (row.device1.dns || row.device1.name || row.device1.ip) | html_entity %],&nbsp;
[% row.port1 | html_entity %]</p></li>
<li><p class="text-info">[% (row.device2.dns || row.device2.name || row.device2.ip) | html_entity %],&nbsp;
[% row.port2 | html_entity %]</p></li>
</ul>
</blockquote>
<input data-form="del" name="dev1" type="hidden" value="[% row.dev1 | html_entity %]">
<input data-form="del" name="port1" type="hidden" value="[% row.port1 | html_entity %]">
<input data-form="del" name="dev2" type="hidden" value="[% row.dev2 | html_entity %]">
<input data-form="del" name="port2" type="hidden" value="[% row.port2 | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [ {
"targets": [ 4 ],
"orderable": false,
"searchable": false
} ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,42 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Observing Device</th>
<th>Undiscovered Neighbor</th>
<th class="nd_center-cell">Last Discovery Attempt</th>
<th class="nd_center-cell">Last Discovery Log</th>
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr>
<td><a href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.port | uri %]">
[% row.dns || row.name || row.ip | html_entity %] ( [% row.port | html_entity %] ) </a></td>
<td>
[% IF row.remote_ip %]
<a href="[% search_node %]&q=[% row.remote_ip | uri %]">
[% row.remote_ip | html_entity %]
</a> ([% row.remote_port | html_entity %])
[% '<br />' IF row.remote_id or row.remote_type %]
[% ' id: '_ row.remote_id IF row.remote_id %]
[% ' type: '_ row.remote_type IF row.remote_type %]
[% ELSE %]
Known Device's MAC Address seen on this Port during Macsuck
[% END %]
</td>
<td class="nd_center-cell">[% row.finished | html_entity %]</td>
<td class="nd_center-cell">[% row.log | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"order": [[ 2, 'desc' ], [ 1, 'asc' ] ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,18 @@
[% USE CSV -%]
[% CSV.dump([ 'Observing Device' 'Device Port'
'Remote IP' 'Remote Port' 'Remote ID' 'Remote Type'
'Last Discovery Attempt' 'Discovery Log']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.dns || row.name || row.ip) %]
[% mylist.push(row.port) %]
[% mylist.push(row.remote_ip) %]
[% mylist.push(row.remote_port) %]
[% mylist.push(row.remote_id) %]
[% mylist.push(row.remote_type) %]
[% mylist.push(row.finished) %]
[% mylist.push(row.log) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,61 @@
[% IF results.count == 0 %]
<div class="span2 alert alert-info">The user activity log is empty.</div>
[% ELSE %]
<table id="aul-data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Creation</th>
<th class="nd_center-cell">User</th>
<th class="nd_center-cell">User IP</th>
<th class="nd_center-cell">Event</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</table>
[% END %]
<script>
$(document).ready(function() {
$('#aul-data-table').dataTable( {
"serverSide": true,
"order": [[ 0, "desc" ]],
"ajax": "[% uri_for('/ajax/control/admin/userlog/data') %]",
"columns": [{
"data": 'creation',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return moment(data).format('YYYY-MM-DD HH:mm');
}
}, {
"data": 'username',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'userip',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'event',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'entry',
"className": "nd_center-cell",
"searchable": false,
"orderable": false,
"render": function(data, type, row, meta) {
return '<input data-form="del" name="entry" type="hidden" value="' + encodeURIComponent(data) +
'"><button class="btn nd_adminbutton" name="del" type="submit"><i class="icon-trash text-error"></i></button>';
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,106 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Full Name</th>
<th class="nd_center-cell">Username</th>
<th class="nd_center-cell">Password</th>
<th class="nd_center-cell">LDAP Auth</th>
<th class="nd_center-cell">Port Control</th>
<th class="nd_center-cell">Administrator</th>
<th class="nd_center-cell">Created</th>
<th class="nd_center-cell">Last Login</th>
<th class="nd_center-cell">Note</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell"><input data-form="add" name="fullname" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="username" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="password" type="password"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="ldap"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="port_control"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="admin"></td>
<td class="nd_center-cell"></td>
<td class="nd_center-cell"></td>
<td class="nd_center-cell"><input data-form="add" name="note" type="text"></td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% FOREACH row IN results %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell">
<input data-form="update" name="fullname" type="text" value="[% row.fullname | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="username" type="text" value="[% row.username | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="password" type="password" value="********">
</td>
<td class="nd_center-cell">
<input data-form="update" name="ldap" type="checkbox" [% 'checked="checked"' IF row.ldap %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="port_control" type="checkbox" [% 'checked="checked"' IF row.port_control %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="admin" type="checkbox" [% 'checked="checked"' IF row.admin %]>
</td>
<td class="nd_center-cell">[% row.created | html_entity %]</td>
<td class="nd_center-cell">[% row.last_seen | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="update" name="note" type="text" value="[% row.note | html_entity %]">
</td>
<td class="nd_center-cell">
<button class="btn nd_adminbutton" name="update" type="submit"><i class="icon-save text-warning"></i></button>
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">User &quot;[% row.username | html_entity %]&quot; will be deleted.</p>
</blockquote>
<input data-form="del" name="username" type="hidden" value="[% row.username | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [
{
"targets": [ 2, 3, 4, 5, 6, 7, 8, 9 ],
"searchable": false
},
{
"targets": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
"orderable": false
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,18 @@
[% USE CSV -%]
[% CSV.dump([ 'Full Name' 'Username'
'LDAP Auth' 'Port Control' 'Administrator' 'Created'
'Last Login' 'Note']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.fullname) %]
[% mylist.push(row.username) %]
[% mylist.push(row.ldap) %]
[% mylist.push(row.port_control) %]
[% mylist.push(row.admin) %]
[% mylist.push(row.created) %]
[% mylist.push(row.last_seen) %]
[% mylist.push(row.note) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,24 @@
"processing": true
,"stateSave": true
,"pageLength": [% settings.table_pagesize %]
,"lengthMenu": [% table_showrecordsmenu %]
,"dom": '<"top"l<"nd_datatables-pager"p>f>rit<"bottom"><"clear">'
,"language": {
"search": '_INPUT_'
,"searchPlaceholder": 'Filter records...'
,"lengthMenu": "Show _MENU_ records."
,"info": "&nbsp;Showing _START_ to _END_ of _TOTAL_"
,"infoFiltered": "(filtered from _MAX_ total)"
,"infoEmpty": "&nbsp;No matching entries"
}
,"stateSaveParams": function (settings, data) {
// make sure filter is never saved
data.search.search = "";
// make sure paging position is not saved
data.start = 0;
[% IF is_custom_report %]
// disable sorting for custom reports
data.order = "";
[% END %]
}

View File

@@ -0,0 +1,52 @@
<table id="da-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Address</th>
<th>DNS</th>
<th class="nd_center-cell">Interface</th>
<th>Description</th>
<th>Prefix</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#da-data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'alias',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'dns',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>' :
data;
}
}, {
"data": 'name',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'subnet',
"render": function(data, type, row, meta) {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '&ip=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,11 @@
[% USE CSV -%]
[% CSV.dump([ 'Address' 'DNS' 'Interface' 'Description' 'Prefix' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% FOREACH col IN [ row.alias row.dns row.port row.device_port.name row.subnet ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,199 @@
[% SET user_can_port_control = user_has_role('port_control') %]
<table class="table table-condensed table-striped">
</tbody>
<tr>
<td>System Name</td>
<td>[% d.name %]</td>
</tr>
<tr>
<td>Location
[% IF user_can_port_control %]
<i class="icon-edit nd_edit-icon nd_device-details-edit"></i>
[% END %]
</td>
[% IF user_can_port_control %]
<td class="nd_editable-cell" contenteditable="true"
data-field="location" data-for-device="[% d.ip %]">
[% d.location | html_entity %]
</td>
[% ELSE %]
<td>
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device %]&q=[% d.location | uri %]&location=[% d.location | uri %]">[% d.location | html_entity %]</a>
</td>
[% END %]
</tr>
<tr>
<td>Contact
[% IF user_can_port_control %]
<i class="icon-edit nd_edit-icon nd_device-details-edit"></i>
[% END %]
</td>
[% IF user_can_port_control %]
<td class="nd_editable-cell" contenteditable="true"
data-field="contact" data-for-device="[% d.ip | html_entity %]">
[% d.contact | html_entity %]
</td>
[% ELSE %]
<td>[% d.contact | html_entity %]</td>
[% END %]
</tr>
<tr>
<td>Vendor / Model</td>
<td>
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device %]&q=[% d.vendor | uri %]&vendor=[% d.vendor | uri %]">[% d.vendor | html_entity %]</a>
/
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device %]&q=[% d.model | uri %]&model=[% d.model | uri %]">[% d.model | html_entity %]</a>
</td>
</tr>
<tr>
<td>OS / Version</td>
<td>[% d.os | html_entity %] /
<a rel="tooltip" data-placement="top" data-offset="5"
data-title="Find Similar Devices"
href="[% search_device %]&q=[% d.os_ver | uri %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver | html_entity %]</a>
</td>
</tr>
<tr>
<td>Serial Number</td>
<td>[% d.serial | html_entity %]</td>
</tr>
<tr>
<td>Description</td>
<td>[% d.description | html_entity | html_line_break %]</td>
</tr>
[% IF settings._extra_device_details.size %]
[% FOREACH config IN settings._extra_device_details %]
<tr>
<td>
[% config.label %]
</td>
<td>
[% TRY %]
[% INCLUDE "plugin/${config.name}/device_details.tt" %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]
</td>
</tr>
[% END %]
[% END %]
<tr>
<td>Administration</td>
<td>
<a href="ssh://[% d.ip | uri %]" target="_blank">
<span class="label label-info"><i class="icon-keyboard"></i> SSH</span></a>
<a href="telnet://[% d.ip | uri %]" target="_blank">
<span class="label label-info"><i class="icon-keyboard"></i> Telnet</span></a>
<a href="https://[% d.ip | uri %]/" target="_blank">
<span class="label label-info"><i class="icon-external-link"></i> Web</span></a>
</td>
</tr>
<tr>
<td>SNMP Class</td>
<td><a target="_blank" href="https://metacpan.org/pod/[% d.snmp_class | uri %]">[% d.snmp_class | html_entity %]</td>
</tr>
<tr>
<td>Uptime</td>
<td>[% d.uptime_age | html_entity %]</td>
</tr>
<tr>
<td>Layers</td>
<td>
[% d.layers.substr(7,1) ? '<span class="badge badge-success">1</span>' : '<span class="badge">&nbsp;</span>' %]
[% d.layers.substr(6,1) ? '<span class="badge badge-success">2</span>' : '<span class="badge">&nbsp;</span>' %]
[% d.layers.substr(5,1) ? '<span class="badge badge-success">3</span>' : '<span class="badge">&nbsp;</span>' %]
[% d.layers.substr(4,1) ? '<span class="badge badge-success">4</span>' : '<span class="badge">&nbsp;</span>' %]
[% d.layers.substr(3,1) ? '<span class="badge badge-success">5</span>' : '<span class="badge">&nbsp;</span>' %]
[% d.layers.substr(2,1) ? '<span class="badge badge-success">6</span>' : '<span class="badge">&nbsp;</span>' %]
[% d.layers.substr(1,1) ? '<span class="badge badge-success">7</span>' : '<span class="badge">&nbsp;</span>' %]
</td>
</tr>
<tr>
<td>Last Discover</td>
<td>[% d.last_discover_stamp | html_entity %]</td>
</tr>
<tr>
<td>Last Arpnip</td>
<td>[% d.last_arpnip_stamp | html_entity %]</td>
</tr>
<tr>
<td>Last Macsuck</td>
<td>[% d.last_macsuck_stamp | html_entity %]</td>
</tr>
<tr>
<td>Hardware Status</td>
<td>Fan: [% d.fan | html_entity %]
<br/>PS1 [[% d.ps1_type | html_entity %]]: [% d.ps1_status | html_entity %]
<br/>PS2 [[% d.ps2_type | html_entity %]]: [% d.ps2_status | html_entity %]</td>
</tr>
[% IF p.size %]
<tr>
<td>PoE Status</td>
<td>
[% FOREACH m IN p %]
[% UNLESS m.module == 1 %]
<br/>
[% END %]
Module [% m.module %]: [% m.status | html_entity %], [% m.poe_capable_ports %] power-capable ports, [% m.poe_powered_ports %] powered ([% m.poe_disabled_ports %] admin disabled, [% m.poe_errored_ports %] errors), [% m.poe_power_committed %]/[% m.power %] watts committed.
[% END %]
</td>
</tr>
[% END %]
<tr>
<td>MAC Address</td>
<td>[% d.mac | html_entity %]</td>
</tr>
<tr>
<td>VTP Domain</td>
<td>[% d.vtp_domain | html_entity %]</td>
</tr>
[% IF user_has_role('admin') %]
<tr data-for-device="[% d.ip %]">
<td>Admin Tasks</td>
<td>
<input type="hidden" data-form="discover" value="[% d.ip %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="discover">Discover</button>
<input type="hidden" data-form="arpnip" value="[% d.ip %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="arpnip">Arpnip</button>
<input type="hidden" data-form="macsuck" value="[% d.ip %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="macsuck">Macsuck</button>
<input type="hidden" data-form="nbtstat" value="[% d.ip %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="nbtstat">NBTstat</button>
<button class="btn btn-danger btn-small pull-right"
data-toggle="modal" data-target="#nd_devdel" type="button">Delete</button>
<div id="nd_devdel" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label">Confirm Delete: [% d.dns || d.ip | html_entity %]</h3>
</div>
<div class="modal-body">
<blockquote>
<ul>
<li><p>This action is immediate and not reversible</p></li>
<li><p>All associated Nodes may be removed from the database</p></li>
</ul>
</blockquote>
<textarea id="nd_devdel-log" class="input-block-level" rows="2" data-form="delete"
placeholder="Enter a log message" name="log"></textarea>
<label class="checkbox">
<input id="nd_devdel-archive" type="checkbox" data-form="delete" name="archive">
<h4 class="nd_unbolden">Archive Nodes</h4>
</label>
<input type="hidden" data-form="delete" value="[% d.ip %]" name="device"/>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="delete" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>

View File

@@ -0,0 +1,60 @@
[% BLOCK recurse -%]
[% INCLUDE print_line item=item %]
[% IF nodes.$item.children.defined -%]
<ul>
[% FOREACH kidtype IN nodes.$item.children.keys -%]
[%- FOREACH kid IN nodes.$item.children.$kidtype -%]
[%- IF kid -%]
[% INCLUDE recurse item=kid %]
[%- END -%]
[%- END -%]
[%- END -%]
</ul>
[% END -%]
</li>
[%- END -%]
[% BLOCK print_line -%]
<li>
[% IF nodes.$item.children.defined -%]
<span><i class="icon-minus-sign text-info"></i>&nbsp;
[%- ELSE -%]
<span><i class="icon-leaf"></i>&nbsp;
[%- END -%]
<a href="[% uri_for('/report/moduleinventory') %]?description=[% nodes.$item.module.description | uri %]">[% nodes.$item.module.description -%]</a>
[%- IF nodes.$item.module.name -%]
<a href="[% uri_for('/report/moduleinventory') %]?name=[% nodes.$item.module.name | uri %]">([% nodes.$item.module.name %])</a>
[%- END -%]
[%- IF nodes.$item.module.fw_ver -%]
fw: [% nodes.$item.module.fw_ver %]
[%- END -%]
[%- IF nodes.$item.module.hw_ver -%]
hw: [% nodes.$item.module.hw_ver %]
[%- END -%]
[%- IF nodes.$item.module.sw_ver -%]
sw: [% nodes.$item.module.sw_ver %]
[%- END -%]
[%- IF nodes.$item.module.serial -%]
<a href="[% uri_for('/report/moduleinventory') %]?serial=[% nodes.$item.module.serial | uri %]">[serial: [% nodes.$item.module.serial %]]</a>
[%- END -%]
[%- IF nodes.$item.module.type -%]
/ <a href="[% uri_for('/report/moduleinventory') %]?type=[% nodes.$item.module.type | uri %]">[% nodes.$item.module.type %]</a>
[%- END -%]
[%- IF nodes.$item.module.model -%]
/ <a href="[% uri_for('/report/moduleinventory') %]?model=[% nodes.$item.module.model | uri %]">[% nodes.$item.module.model %]</a>
[%- END -%]
[%- IF nodes.$item.module.fru -%]
<b>[FRU]</b>
[%- END -%]
</span>
[%- END -%]
<div class="tree">
<ul>
[% FOREACH module IN nodes.root %]
[% INCLUDE recurse item=module %]
[%- END -%]
</ul>
</div>
<script type="text/javascript">
[%+ INCLUDE 'js/bootstrap-tree.js' -%]
</script>

View File

@@ -0,0 +1,187 @@
<script>
var winHeight = window.innerHeight;
var winWidth = window.innerWidth;
// links in the initial tree drawing use this generator
var treeLink = d3.svg.diagonal.radial()
.projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });
// actual device neighbor links use this generator
var neighLink = d3.svg.diagonal.radial();
// store x,y for all circles on the map
var loc = {};
// store actual links between all nodes
var neighbors_data = {};
// main SVG background, with support for pan/zoom
var svg = d3.select("#netmap_pane").append("svg")
.attr("width", winWidth - 50)
.attr("height", winHeight - 100)
.attr("pointer-events", "all")
.append('g')
.call(d3.behavior.zoom().on("zoom", redraw))
.append("g")
.attr("transform", "translate(" + winHeight / 2 + "," + winHeight / 2 + ")");
// this is the image background
// XXX there must be a way to discover the radial tree's size?
svg.append('rect')
.attr("x", (0 - (winHeight * 2)))
.attr('width', "400%")
.attr("y", (0 - (winHeight * 2)))
.attr('height', "400%")
.attr('fill', 'white');
// handle pan and zoom
function redraw() {
svg.attr("transform",
"translate(" + d3.event.translate + ")"
+ "scale(" + d3.event.scale + ")"
+ "translate(" + (winHeight / 2) + "," + (winHeight / 2) + ")");
}
// save the x,y of an element into the loc dictionary
function recordLocation(d,i) {
var rect = this.getBoundingClientRect();
loc[d.name] = {
'x': (rect.left + ((rect.right - rect.left) / 2))
,'y': (rect.top + ((rect.bottom - rect.top) / 2))
};
}
// convert a device name to a valid CSS class name
function to_class(name) { return 'nd_' + name.replace(/\./g, "_") }
// handler for clicking on a circle - redirect to that device's netmap
function circleClick(d) {
window.location = '[% uri_for('/device') %]?tab=netmap'
+ '&q=' + d.fullname
+ '&depth=[% params.depth | uri %]'
+ '&vlan=[% params.vlan | uri %]';
}
// handler for mouseover on a circle - show that device's real neighbors
function circleOver(d) {
$('.link').hide();
$('path.' + to_class(d.name)).show();
$(this).css('cursor', 'pointer');
$.each(neighbors_data[d.name], function(idx, target) {
if (! (target in loc)) { return true }
$('circle.' + to_class(target)).css('fill', '#e96cfa');
});
}
// handler for mouseout on a circle - hide real neighbours and show treeLinks
function circleOut(d) {
$.each(neighbors_data[d.name], function(idx, target) {
if (! (target in loc)) { return true }
$('circle.' + to_class(target)).css('fill', '#fff');
});
$(this).css('cursor', 'auto');
$('path.' + to_class(d.name)).hide();
$('.link').show();
}
// load all device connections into neighbors_data dictionary
$.getJSON('[% uri_for('/ajax/data/device/alldevicelinks') %]', function(data) {
neighbors_data = data;
// draw the tree
d3.json("[% uri_for('/ajax/data/device/netmap') %]?"
+ '&q=[% params.q | uri %]'
+ '&depth=[% params.depth | uri %]'
+ '&vlan=[% params.vlan | uri %]', function(error, root) {
var tree = d3.layout.tree()
// magic number "8" for scaling (network depth). seems to make things look right for me.
.size([360, (winHeight / 8 * (root['scale'] || 0))])
.separation(function(a, b) { return (a.parent == b.parent ? 1 : 2) / a.depth; });
var nodes = tree.nodes(root),
links = tree.links(nodes);
var link = svg.selectAll(".link")
.data(links)
.enter().append("path")
.attr("class", "link")
.attr("d", treeLink);
var node = svg.selectAll(".node")
.data(nodes)
.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; });
// begin to draw...
d3.select("#nd_waiting").remove();
node.append("circle")
.attr("r", 4.5)
// circle has class name of its device, so we can show/hide it
.attr("class", function(d) { return to_class(d.name) })
// store the x,y of every circle we've just drawn
.each(recordLocation)
// handlers for mouse interaction with the circles
.on("click", circleClick)
.on("mouseover", circleOver)
.on("mouseout", circleOut);
node.append("text")
.attr("dy", ".31em")
.attr("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
.attr("transform", function(d) { return d.x < 180 ? "translate(8)" : "rotate(180)translate(-8)"; })
.text(function(d) { return d.name; });
// reorient text on the root node
svg.select(".node")
.attr("transform", function(d) {
return d.x < 180 ? "rotate(0)translate(0)" : "rotate(180)translate(0)"; });
// key (name) of the root node in our locations store
var rootname = svg.select(".node").data()[0].name;
// reformatted neighbors_data for the real neighbor links
var neighbors = [];
// need to build neighbors array only after we have built loc dictionary,
// after drawing the circles and storing their x,y
$.each(neighbors_data, function(key, val) {
if (! (key in loc)) { return true }
$.each(val, function(idx, name) {
if (! (name in loc)) { return true }
neighbors.push({
'source': {
'name': key
,'x': loc[key]['x']
,'y': loc[key]['y']
}
,'target': {
'name': name
,'x': loc[name]['x']
,'y': loc[name]['y']
}
});
});
});
// insert Netdisco neighbor links below circles but above tree links
svg.selectAll(".neighbor")
.data(neighbors)
.enter().insert("path", ".node")
// add class name of source device, so we can show/hide the link
// (also "neighbor" class)
.attr("class", function(d) { return ("neighbor " + to_class( d.source.name )) })
.attr("d", neighLink)
.attr("transform", "translate(-" + loc[rootname]['x'] + ",-" + loc[rootname]['y'] + ")");
});
}); // jquery getJSON for all connections
// vim: ft=javascript
</script>
<div id="nd_waiting" class="span2 alert"><i class="icon-spinner icon-spin"></i> Waiting for results...</div>

View File

@@ -0,0 +1,427 @@
[% 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">
<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 UNLESS params.${item.name} %]
[% SET th_class = '' %]
[% IF (item.name == 'c_port' OR item.name == 'c_descr' OR item.name == 'c_name') %]
[% th_class = ' class="portsort"' %]
[% END %]
<th[% th_class %]>
[% item.label | html_entity %]
</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH row IN results %]
<tr>
<td class="nd_center-cell nd_devport-icon">
[% IF row.up_admin != 'up' %]
<i class="icon-remove"></i>
[% ELSIF row.up == 'up' AND row.stp == 'blocking' AND row.vlan_count < 2 %]
<i class="icon-fullscreen text-info"></i>
[% ELSIF row.has_column_loaded('is_free') AND row.is_free %]
<i class="icon-arrow-down text-success"></i>
[% ELSIF row.up_admin == 'up' AND (row.up != 'up' AND row.up != 'dormant') %]
<i class="icon-arrow-down text-error"></i>
[% ELSE %]
<i class="icon-angle-up text-success"></i>
[% END %]
[% IF row.slave_of %]<br/>
[% IF row.get_column('agg_master_up_admin') != 'up' %]
<small><i class="icon-group muted"></i></small>
[% ELSIF row.get_column('agg_master_up') == 'up' %]
<small><i class="icon-group text-success"></i></small>
[% ELSE %]
<small><i class="icon-group text-error"></i></small>
[% END %]
[% END %]
</td>
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'left' AND params.${config.name} %]
<td>
[% TRY %]
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]
</td>
[% END %]
[% IF params.c_port %]
[% IF user_can_port_control AND params.c_admin %]
[% IF row.up_admin == 'up' %]
<td nowrap class="nd_editable-cell" data-action="down"
data-order="[% row.port | html_entity %]" data-filter="[% row.port | html_entity %]"
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
[% ELSE %]
<td nowrap class="nd_editable-cell" data-action="up"
data-order="[% row.port | html_entity %]" data-filter="[% row.port | html_entity %]"
data-field="c_port" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
[% END %]
[% ELSE %]
<td nowrap data-order="[% row.port | html_entity %]" data-filter="[% row.port | html_entity %]">
[% END %]
<a class="nd_log-icon"
href="[% uri_for('/report/portlog') %]?q=[% device.ip | uri %]&f=[% row.port | uri %]">
<i class="icon-file-text-alt"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="View Port Log"></i>
</a>
[% IF user_can_port_control AND params.c_admin %]
[% IF row.up_admin == 'up' %]
<span class="nd_hand-icon">
<i class="icon-bullseye" data-action="bounce"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Bounce Port"></i>
<i class="icon-hand-down"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Disable Port"></i>
</span>
[% ELSE %]
<span class="nd_hand-icon">
<i class="icon-bullseye" data-action="bounce" style="display: none"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Bounce Port"></i>
<i class="icon-hand-up"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Enable Port"></i>
</span>
[% END %]
[% END %]
<a class="nd_this-port-only nd_port-only-first" href="[% uri_for('/device',
self_options) %]&q=[% params.q | uri %]&f=[% row.port | uri %]&prefer=port">
[% IF row.is_master %]
<small><i class="icon-group muted"></i></small>&nbsp;
[% END %]
[% row.port | html_entity %]</a>
[% IF row.slave_of %]<br/>
<a class="nd_this-port-only" href="[% uri_for('/device',
self_options) %]&q=[% params.q | uri %]&f=[% row.slave_of | uri %]&prefer=port">
[% row.slave_of | html_entity %]</a>
[% END %]
</td>
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'mid' AND params.${config.name} %]
<td>
[% TRY %]
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]
</td>
[% END %]
[% IF params.c_descr %]
<td nowrap>[% row.descr | html_entity %]</td>
[% END %]
[% IF params.c_comment %]
<td nowrap>[% row.last_comment | html_entity %]</td>
[% END %]
[% IF params.c_type %]
<td>[% row.type | html_entity %]</td>
[% END %]
[% IF params.c_duplex %]
<td>
[% IF row.up == 'up' AND row.duplex %]
[% (row.duplex_admin.ucfirst || 'Auto') | html_entity %] / [% row.duplex.ucfirst | html_entity %]
[% END %]
</td>
[% END %]
[% IF params.c_lastchange %]
<td>[% row.lastchange_stamp | html_entity %]</td>
[% END %]
[% IF params.c_name %]
[% IF user_can_port_control AND params.c_admin %]
<td nowrap class="nd_editable-cell" contenteditable="true"
data-field="c_name" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
[% ELSE %]
<td nowrap class="nd_editable-cell">
[% END %]
<div class="nd_editable-cell-content">
[% row.name | html_entity %]
</div>
</td>
[% END %]
[% IF params.c_speed %]
<td>[% row.speed | html_entity %]</td>
[% END %]
[% IF params.c_mac %]
<td>[% row.mac | html_entity %]</td>
[% END %]
[% IF params.c_mtu %]
<td>[% row.mtu | html_entity %]</td>
[% END %]
[% IF params.c_pvid %]
[% IF user_can_port_control AND params.c_admin %]
<td class="nd_editable-cell" contenteditable="true" data-default="[% row.vlan | html_entity %]"
data-field="c_pvid" data-for-device="[% device.ip | html_entity %]" data-for-port="[% row.port | html_entity %]">
<i class="icon-edit nd_edit-icon"></i>
<div class="nd_editable-cell-content">
[% IF row.vlan %][% row.vlan | html_entity %][% END %]
</div>
</td>
[% ELSE %]
<td>
<a class="nd_linkcell"
href="[% uri_for('/search') %]?tab=vlan&q=[% row.vlan | uri %]">
[% row.vlan | html_entity %]</a>
</td>
[% END %]
[% END %]
[% IF params.c_vmember %]
<td>
[% IF vmember_ok %]
[% IF row.vlan_count %]
[% SET output = '' %]
[% SET vlanlist = [] %]
[% FOREACH vlan IN row.all_port_vlans %][% vlanlist.push(vlan.get_column('vlan')) %][% END %]
[% FOREACH vlan IN vlanlist.nsort %]
[% SET output = output _
'<a href="' _ uri_for('/search') _ '?tab=vlan&q=' _ vlan _ '">' _ vlan _ '</a>' %]
[% SET output = output _ ', ' IF NOT loop.last %]
[% END %]
[% IF row.vlan_count > 10 %] [%# TODO make this a settable variable %]
[% SET output = '<div class="nd_vlan-total">(' _ row.vlan_count
_ ')</div><span class="nd_linkcell nd_collapse-vlans">
<div class="nd_arrow-up-down-left icon-chevron-up icon-large"></div>Show VLANs</span>
<div class="nd_collapsing nd_collapse-pre-hidden">' _ output %]
[% SET output = output _ '</div>' %]
[% END %]
[% output %]
[% END %]
[% ELSE %]
<i class="icon-asterisk"></i> (too many to list)
[% END %]
</td>
[% END %]
[% IF params.c_power %]
[% IF row.power %]
[% IF row.power.admin == 'true' %]
[% IF user_can_port_control AND params.c_admin %]
<td nowrap data-action="false"
data-field="c_power" data-for-device="[% device.ip | html_entity %]"
data-for-port="[% row.port | html_entity %]">
<i class="icon-off nd_power-icon nd_power-on"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Disable Power"></i>
[% ELSE %]
<td nowrap>
<i class="icon-off nd_power-on"></i>
[% END %]
<span>
[% IF row.power.power > 0 %]
[% row.power.power | html_entity %]&nbsp;mW
[% ELSE %]
([% row.power.status | html_entity %])
[% END %]
</span>
[% ELSE %]
[% IF user_can_port_control AND params.c_admin %]
<td nowrap data-action="true"
data-field="c_power" data-for-device="[% device.ip | html_entity %]"
data-for-port="[% row.port | html_entity %]">
<i class="icon-off nd_power-icon"
rel="tooltip" data-placement="top" data-offset="3"
data-animation="" data-title="Enable Power"></i>
[% ELSE %]
<td>
<i class="icon-off"></i>
[% END %]
[% END %]
</td>
[% ELSE %]
<td></td>
[% END %]
[% END %]
[% IF params.c_ssid %]
<td>[% row.ssid.ssid | html_entity %]</td>
[% END %]
[% IF params.c_nodes OR params.c_neighbors %]
<td>
[% IF params.c_neighbors AND (row.remote_ip OR row.is_uplink) %]
[% IF row.neighbor %]
<i class="icon-link[% ' text-warning' IF row.manual_topo %]"></i>
[% IF row.remote_type AND row.remote_type.match('(?i)ip.phone') %]
<i class="icon-phone"></i>&nbsp;
[% ELSIF row.remote_type AND row.remote_type.match('^AP:\s') %]
<i class="icon-signal"></i>&nbsp;
[% END %]
<a href="[% uri_for('/device', self_options) %]&q=[% row.neighbor.ip | uri %]">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip | html_entity %]</a>
[% IF row.remote_port %]
-
<a href="[% uri_for('/device', self_options) %]&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]&prefer=port">
[% row.remote_port | html_entity %]</a>
[% END %]
<br/>
[% IF params.neigh_id and (row.remote_id or row.remote_type) %]
([% 'id: '_ row.remote_id IF row.remote_id %]
[% ' type: '_ row.remote_type IF row.remote_type %])<br/>
[% END %]
[% ELSIF row.remote_ip %]
<i class="icon-unlink text-error"></i>&nbsp;
[% IF row.remote_type AND row.remote_type.match('(?i)ip.phone') %]
<i class="icon-phone"></i>&nbsp;
[% ELSIF row.remote_type AND row.remote_type.match('^AP:\s') %]
<i class="icon-signal"></i>&nbsp;
[% END %]
<a href="[% search_node %]&q=[% row.remote_ip | uri %]">
[% row.remote_ip | html_entity %]
[% ' - ' IF row.remote_port %][% row.remote_port | html_entity %]</a><br/>
[% IF params.neigh_id and (row.remote_id or row.remote_type) %]
([% 'id: '_ row.remote_id IF row.remote_id %]
[% ' type: '_ row.remote_type IF row.remote_type %])<br/>
[% END %]
[% ELSE %]
<i class="icon-unlink text-error"></i>&nbsp; (possible uplink)
[% END %]
[% END %]
[% IF params.c_nodes %]
[% FOREACH node IN row.$nodes %]
[% '<br/>' IF (row.remote_ip OR row.is_uplink) OR NOT loop.first %]
[% '<i class="icon-book"></i>&nbsp; ' IF NOT node.active %]
[% IF row.remote_type AND row.remote_type.match('(?i)ip.phone') %]
<i class="icon-phone"></i>&nbsp;
[% ELSIF node.wireless.defined
OR (row.remote_type AND row.remote_type.match('^AP:\s')) %]
<i class="icon-signal"></i>&nbsp;
[% END %]
<a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
[% node.net_mac.$mac_format_call | html_entity %]</a>
[% IF (node.vlan > 0) && (node.vlan != row.vlan) %]
(on vlan [% node.vlan | html_entity %])
[% END %]
[% IF params.n_ssid AND node.wireless.defined %]
(SSID:
[% FOREACH wlan IN node.wireless %]
<a href="[%+ uri_for('/report/portssid') %]?ssid=[% wlan.ssid | uri %]">[% wlan.ssid | html_entity %]</a>
[% END %]
)
[% END %]
[% IF params.n_vendor AND node.oui.defined %]
(Vendor:
[% FOREACH oui IN node.oui %]
<a href="[%+ uri_for('/report/nodevendor') %]?vendor=[% oui.abbrev | uri %]">[% oui.abbrev | html_entity %]</a>
[% END %]
)
[% END %]
[% ' (' _ node.time_last_age _ ')' IF params.n_age %]
[% IF params.n_ip4 %]
[% FOREACH ip IN node.ip4s %]
<br/>&nbsp; [% '<i class="icon-book"></i>&nbsp; ' IF NOT ip.active %]
[% SET dns = ip.dns %]
[% IF dns %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip | html_entity %])</a>
[% ELSE %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% ip.ip | html_entity %]</a>
[% END %]
[% END %]
[% END %]
[% IF params.n_ip6 %]
[% FOREACH ip IN node.ip6s %]
<br/>&nbsp; [% '<i class="icon-book"></i>&nbsp; ' IF NOT ip.active %]
[% SET dns = ip.dns %]
[% IF dns %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip | html_entity %])</a>
[% ELSE %]
<a href="[% search_node %]&q=[% ip.ip | uri %]">[% ip.ip | html_entity %]</a>
[% END %]
[% END %]
[% END %]
[% IF params.n_netbios %]
[% FOREACH nbt IN node.netbios %]
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\\<a href="[% uri_for('/report/netbios') %]?domain=[% nbt.domain | uri %]" title="Nodes in this Domain">[% nbt.domain | html_entity %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[% nbt.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
[% END %]
[% END %]
[% END %]
[% END %]
</td>
[% END %]
[% IF params.c_stp %]
<td>[% row.stp | html_entity %]</td>
[% END %]
[% IF params.c_up %]
<td>
[% row.up_admin.ucfirst | html_entity %] / [% row.up.ucfirst | html_entity %]
</td>
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'right' AND params.${config.name} %]
<td>
[% TRY %]
[% INCLUDE "plugin/${config.name}/device_port_column.tt" %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
[% IF user_can_port_control %]
<div id="nd_portlog" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-hidden="true">
<div class="modal-body">
<blockquote>
<ul><li><p>Please provide a reason for changing the Port Configuration</p></li></ul>
</blockquote>
<select id="nd_portlog-reason" class="input-block-level" name="reason">
[% FOREACH pair IN settings.port_control_reasons.pairs %]
<option[% ' selected="selected"' IF pair.key == 'other' %] value="[% pair.key | html_entity %]">
[% pair.value | html_entity %]</option>
[% END %]
</select>
<textarea id="nd_portlog-log" class="input-block-level" rows="2" name="log"
placeholder="Enter a log message"></textarea>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button id="nd_portlog-submit" class="btn btn-info" data-dismiss="modal">Continue</button>
</div>
</div>
[% END %]
<script>
$(document).ready(function() {
$('#dp-data-table').dataTable({
"columnDefs": [
{ "sortable": false, "targets": 0 },
{ "searchable": false, "targets": 0 },
{ "type": 'portsort', "targets": [ 'portsort' ] }
],
"order": [[ 1, 'asc' ]],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,228 @@
[% USE CSV -%]
[% SET headers = [] %]
[% SET c_nodes_pos = -1 %]
[% FOREACH item IN vars.port_columns %]
[% NEXT IF item.name == 'c_admin' %]
[% NEXT UNLESS params.${item.name} %]
[% IF item.name == 'c_nodes' %]
[% SET c_nodes_pos = headers.size %]
[% headers.push('Node MAC') %]
[% headers.push('Archived Node') %]
[% headers.push('Age Stamp') IF params.n_age %]
[% headers.push('Node IP') IF params.n_ip4 OR params.n_ip6 %]
[% headers.push('Node DNS') IF params.n_ip4 OR params.n_ip6 %]
[% headers.push('Archived IP') IF params.n_ip4 OR params.n_ip6 %]
[% ELSIF item.name == 'c_duplex' %]
[% headers.push('Duplex Setting') %]
[% headers.push('Duplex') %]
[% ELSIF item.name == 'c_power' %]
[% headers.push('PoE Status') %]
[% headers.push('PoE Power (mW)') %]
[% ELSIF item.name == 'c_neighbors' %]
[% headers.push('Neighbor IP') %]
[% headers.push('Neighbor DNS') %]
[% ELSIF item.name == 'c_up' %]
[% headers.push('Port Setting') %]
[% headers.push('Port Status') %]
[% ELSE %]
[% headers.push(item.label) %]
[% END %]
[% END %]
[% CSV.dump(headers) %]
[% FOREACH row IN results %]
[% SET myport = [] %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'left' AND params.${config.name} %]
[% TRY %]
[% PROCESS "plugin/${config.name}/device_port_column_csv.tt" %]
[% CATCH %]
[% myport.push('') %]
[% END %]
[% END %]
[% IF params.c_port %]
[% myport.push(row.port) %]
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'mid' AND params.${config.name} %]
[% TRY %]
[% PROCESS "plugin/${config.name}/device_port_column_csv.tt" %]
[% CATCH %]
[% myport.push('') %]
[% END %]
[% END %]
[% IF params.c_descr %]
[% myport.push(row.descr) %]
[% END %]
[% IF params.c_comment %]
[% myport.push(row.last_comment) %]
[% END %]
[% IF params.c_type %]
[% myport.push(row.type) %]
[% END %]
[% IF params.c_duplex %]
[% IF row.up == 'up' AND row.duplex %]
[% myport.push( row.duplex_admin.ucfirst || 'Auto' ) %]
[% myport.push( row.duplex.ucfirst ) %]
[% ELSE %]
[% myport.push('') %]
[% myport.push('') %]
[% END %]
[% END %]
[% IF params.c_lastchange %]
[% myport.push(row.lastchange_stamp) %]
[% END %]
[% IF params.c_name %]
[% myport.push(row.name) %]
[% END %]
[% IF params.c_speed %]
[% myport.push(row.speed) %]
[% END %]
[% IF params.c_mac %]
[% myport.push(row.mac) %]
[% END %]
[% IF params.c_mtu %]
[% myport.push(row.mtu) %]
[% END %]
[% IF params.c_pvid %]
[% myport.push(row.vlan) %]
[% END %]
[% IF params.c_vmember %]
[% IF row.vlan_count %]
[% SET output = '' %]
[% SET vlanlist = [] %]
[% FOREACH vlan IN row.all_port_vlans %][% vlanlist.push(vlan.get_column('vlan')) %][% END %]
[% FOREACH vlan IN vlanlist.nsort %]
[% SET output = output _ ',' IF NOT loop.first %]
[% SET output = output _ vlan %]
[% END %]
[% myport.push(output) %]
[% ELSE %]
[% myport.push('') %]
[% END %]
[% END %]
[% IF params.c_power %]
[% IF row.power AND row.power.admin == 'true' %]
[% myport.push( row.power.status ) %]
[% myport.push( row.power.power || '0' ) %]
[% ELSE %]
[% myport.push('') %]
[% myport.push('') %]
[% END %]
[% END %]
[% IF params.c_nodes %]
[% myport.push('') %]
[% myport.push('') %]
[% myport.push('') IF params.n_age %]
[% myport.push('') IF params.n_ip4 OR params.n_ip6 %]
[% myport.push('') IF params.n_ip4 OR params.n_ip6 %]
[% myport.push('') IF params.n_ip4 OR params.n_ip6 %]
[% END %]
[% IF params.c_neighbors %]
[% IF (row.remote_ip OR row.is_uplink) %]
[% IF row.neighbor %]
[% myport.push( row.neighbor.ip ) %]
[% myport.push( row.neighbor.dns.remove(settings.domain_suffix) ) %]
[% ELSIF row.remote_ip AND row.remote_port %]
[% myport.push( row.remote_ip ) %]
[% myport.push('') %]
[% ELSE %]
[% myport.push('(possible uplink)') %]
[% myport.push('') %]
[% END %]
[% ELSE %]
[% myport.push('') %]
[% myport.push('') %]
[% END %]
[% END %]
[% IF params.c_stp %]
[% myport.push(row.stp) %]
[% END %]
[% IF params.c_up %]
[% myport.push( row.up_admin.ucfirst ) %]
[% myport.push( row.up.ucfirst ) %]
[% END %]
[% FOREACH config IN settings._extra_device_port_cols %]
[% NEXT UNLESS config.position == 'right' AND params.${config.name} %]
[% TRY %]
[% PROCESS "plugin/${config.name}/device_port_column_csv.tt" %]
[% CATCH %]
[% myport.push('') %]
[% END %]
[% END %]
[% SET has_nodes = 0 %]
[% IF params.c_nodes %]
[% FOREACH node IN row.$nodes %]
[% SET has_nodes = 1 %]
[% SET mynode = [] %]
[% CALL mynode.push(node.net_mac.$mac_format_call) %]
[% CALL mynode.push((node.active ? 'No' : 'Yes')) %]
[% CALL mynode.push(node.time_last_age) IF params.n_age %]
[% IF params.n_ip4 OR params.n_ip6 %]
[% mynode.push('') %]
[% mynode.push('') %]
[% mynode.push('') %]
[% SET has_ips = 0 %]
[% IF params.n_ip4 %]
[% FOREACH ip IN node.ip4s %]
[% SET has_ips = 1 %]
[% CALL mynode.splice(-3, 1, ip.ip) %]
[% CALL mynode.splice(-2, 1, ip.dns) %]
[% CALL mynode.splice(-1, 1, (ip.active ? 'No' : 'Yes')) %]
[% CALL myport.splice(c_nodes_pos, mynode.size, mynode) %]
[% CSV.dump(myport) %]
[% END %]
[% END %]
[% IF params.n_ip6 %]
[% FOREACH ip IN node.ip6s %]
[% SET has_ips = 1 %]
[% CALL mynode.splice(-3, 1, ip.ip) %]
[% CALL mynode.splice(-2, 1, ip.dns) %]
[% CALL mynode.splice(-1, 1, (ip.active ? 'No' : 'Yes')) %]
[% CALL myport.splice(c_nodes_pos, mynode.size, mynode) %]
[% CSV.dump(myport) %]
[% END %]
[% END %]
[% CSV.dump(myport) IF NOT has_ips %]
[% ELSE %]
[% CALL myport.splice(c_nodes_pos, mynode.size, mynode) %]
[% CSV.dump(myport) %]
[% END %]
[% END %]
[% END %]
[% CSV.dump(myport) IF NOT has_nodes %]
[% END %]

View File

@@ -0,0 +1,30 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Channel</th>
<th>Count</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"order": [[ 1, "desc" ]],
"data": [% results %],
"columns": [
{
"data": 'channel'
}, {
"data": 'ch_count',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,10 @@
[% USE CSV -%]
[% CSV.dump([ 'Channel' 'Count' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.channel) %]
[% mylist.push(row.ch_count) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,63 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th>Model</th>
<th>Location</th>
<th>Port</th>
<th>SSID</th>
<th>Node Count</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"order": [[ 5, "desc" ]],
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% uri_for('/device') %]?tab=details&q=' + encodeURIComponent(row.ip) + '">'
+ he.encode(row.dns || row.name || row.ip) + '</a>' :
data;
}
}, {
"data": 'model',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'location',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'ssid',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'mac_count',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,14 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Model' 'Location' 'Port' 'SSID' 'Node Count' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.dns || row.name || row.ip) %]
[% mylist.push(row.model) %]
[% mylist.push(row.location) %]
[% mylist.push(row.port) %]
[% mylist.push(row.ssid) %]
[% mylist.push(row.mac_count) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,115 @@
<table id="data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th>IP</th>
<th>DNS</th>
<th>Device</th>
<th>Port</th>
<th>Name</th>
<th>Description</th>
<th class="nd_center-cell">Channel</th>
<th class="nd_center-cell">Tx Power (mW/dBm)</th>
</tr>
</thead>
</table>
<style>
tr.group,
tr.group:hover {
background-color: #ddd !important;
}
</style>
<script>
function groupString(d) {
"use strict";
var s = '';
s = s + 'Device: ';
s = s + '<a href="[% uri_for('/device') %]?tab=details&q=' + encodeURIComponent(d.ip) + '">';
s = s + he.encode(d.dns || d.device_name || d.ip);
if (d.dns || d.device_name) {
s = s + ' (' + he.encode(d.ip) + ') ';
}
s = s + '</a> Model: ' + he.encode(d.model || '');
s = s + he.encode(d.location ? ' Location: ' + d.location : '');
return s;
}
$(document).ready(function() {
var table = $('#data-table').DataTable({
"serverSide": true,
"ajax": "[% uri_for('/ajax/content/report/apradiochannelpower/data') %]",
"order": [[ 0, 'asc' ]],
"columns": [
{
// Grouping column
"data": 'ip',
"visible": false
}, {
// Included for filtering
"data": 'dns',
"visible": false
}, {
// Included for filtering
"data": 'device_name',
"visible": false
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'port_name',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'descr',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'channel',
"className": "nd_center-cell"
}, {
"data": 'power',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return (row.power2 ? data + ' / ' + row.power2 : '');
}
}
],
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(0, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
var row_data = api.row( i ).data();
$(rows).eq( i ).before(
'<tr class="group"><td colspan="5">' + groupString(row_data) + '</td></tr>'
);
last = group;
}
} );
},
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
// Order by the grouping
$('#data-table tbody').on( 'click', 'tr.group', function () {
var currentOrder = table.order()[0];
if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) {
table.order( [ 0, 'desc' ] ).draw();
}
else {
table.order( [ 0, 'asc' ] ).draw();
}
} );
} );
</script>

View File

@@ -0,0 +1,15 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Model' 'Device Location' 'Port' ' Port Name'
'Port Description' 'Channel' 'Tx Power mW' 'Tx Power dBm' ]) %]
[% FOREACH row IN results %]
[% mydlist = [] %]
[% mydevice = row.dns || row.device_name || row.ip %]
[% mydlist.push(mydevice) %]
[% FOREACH col IN [ row.model row.location row.port row.name row.descr
row.channel row.power row.power2 ] %]
[% mydlist.push(col) %]
[% END %]
[% CSV.dump(mydlist) %]
[%END%]

View File

@@ -0,0 +1,41 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Device</th>
<th class="nd_center-cell">Address</th>
<th class="nd_center-cell">Contact</th>
<th class="nd_center-cell">Location</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [{
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '">' + he.encode(row.dns || row.name || row.ip) + '</a>';
}
}, {
"data": 'alias',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'contact',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'location',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Address' 'Contact' 'Location' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.dns || row.name || row.ip) %]
[% mylist.push(row.alias) %]
[% mylist.push(row.contact) %]
[% mylist.push(row.location) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,56 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Location</th>
<th class="nd_center-cell">Device</th>
<th class="nd_center-cell">System Name</th>
<th class="nd_center-cell">Vendor</th>
<th class="nd_center-cell">Model</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"order": [[ 0, "asc" ], [2, "asc"], [ 3, "asc" ], [4, "asc"]],
"data": [% results %],
"columns": [
{
"data": 'location',
"render": function(data, type, row, meta) {
if (data) {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '&location=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';
} else {
return '[Not Set]';
}
}
}, {
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/device') %]?q=' + encodeURIComponent(data) + '">' + he.encode(row.dns || row.ip) + '</a>';
}
}, {
"data": 'name',
"render": function(data, type, row, meta) {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'vendor',
"render": function(data, type, row, meta) {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'model',
"render": function(data, type, row, meta) {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '&model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Location' 'Device' 'System Name' 'Vendor' 'Model' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.dns || row.ip %]
[% FOREACH col IN [ row.location device row.name row.vendor row.model ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,49 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>DNS</th>
<th>IP Address</th>
<th>Contact</th>
<th>Location</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '">' + he.encode(row.name || row.ip) + '</a>';
}
}, {
"data": 'dns',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'ip',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'contact',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'location',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,13 @@
[% USE CSV -%]
[% CSV.dump([ 'Name' 'DNS' 'IP Address' 'Contact' 'Location' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.name) %]
[% mylist.push(row.dns) %]
[% mylist.push(row.ip) %]
[% mylist.push(row.contact) %]
[% mylist.push(row.location) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,180 @@
<table id="data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th>IP</th>
<th>DNS</th>
<th>Name</th>
<th>Model</th>
<th>Location</th>
<th>PoE<br>Module</th>
<th class="nd_center-cell">Supply</th>
<th class="nd_center-cell">Power<br>(W)</th>
<th class="nd_center-cell">Capable<br>Ports</th>
<th class="nd_center-cell">Powered<br>Ports</th>
<th class="nd_center-cell">Disabled<br>Ports</th>
<th class="nd_center-cell">Errored<br>Ports</th>
<th class="nd_center-cell">Committed<br>(W)</th>
<th class="nd_center-cell">Delivering<br>(W)</th>
</tr>
</thead>
<tbody>
[% FOREACH row IN results %]
<tr>
<td>[% row.ip %]</td>
<td>[% row.dns %]</td>
<td>[% row.name %]</td>
<td>[% row.model %]</td>
<td>[% row.location %]</td>
<td>[% row.module %]</td>
<td class="nd_center-cell">[% row.power %]</td>
<td class="nd_center-cell">[% row.status %]</td>
<td class="nd_center-cell">[% row.poe_capable_ports %]</td>
<td class="nd_center-cell">[% row.poe_powered_ports %]</td>
<td class="nd_center-cell">[% row.poe_disabled_ports %]</td>
<td class="nd_center-cell">[% row.poe_errored_ports %]</td>
<td class="nd_center-cell">[% row.poe_power_committed %]</td>
<td class="nd_center-cell">[% row.poe_power_delivering %]</td>
</tr>
[% END %]
</tbody>
</table>
<style>
tr.group,
tr.group:hover {
background-color: #ddd !important;
}
</style>
<script>
function groupString(d) {
"use strict";
var s = '';
s = s + 'Device: ';
s = s + '<a href="[% uri_for('/device') %]?tab=details&q=' + encodeURIComponent(d.ip) + '">';
s = s + he.encode(d.dns || d.name || d.ip);
if (d.dns || d.name) {
s = s + ' (' + he.encode(d.ip) + ') ';
}
s = s + '</a> Model: ' + he.encode(d.model || '');
s = s + he.encode(d.location ? ' Location: ' + d.location : '');
return s;
}
$(document).ready(function() {
var table = $('#data-table').DataTable({
"serverSide": true,
"ajax": "[% uri_for('/ajax/content/report/devicepoestatus/data') %]",
"order": [[ 0, 'asc' ]],
"columns": [
{
// Grouping column
"data": 'ip',
"visible": false
}, {
// Included for filtering
"data": 'dns',
"visible": false
}, {
// Included for filtering
"data": 'name',
"visible": false
}, {
// Included for filtering
"data": 'model',
"visible": false
}, {
// Included for filtering
"data": 'location',
"visible": false
}, {
"data": 'module',
"searchable": false
}, {
"data": 'status',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'power',
"className": "nd_center-cell",
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'poe_capable_ports',
"className": "nd_center-cell",
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'poe_powered_ports',
"className": "nd_center-cell",
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'poe_disabled_ports',
"className": "nd_center-cell",
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'poe_errored_ports',
"className": "nd_center-cell",
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'poe_power_committed',
"className": "nd_center-cell",
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'poe_power_delivering',
"className": "nd_center-cell",
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(0, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
var row_data = api.row( i ).data();
$(rows).eq( i ).before(
'<tr class="group"><td colspan="9">' + groupString(row_data) + '</td></tr>'
);
last = group;
}
} );
},
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
// Order by the grouping
$('#data-table tbody').on( 'click', 'tr.group', function () {
var currentOrder = table.order()[0];
if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) {
table.order( [ 0, 'desc' ] ).draw();
}
else {
table.order( [ 0, 'asc' ] ).draw();
}
} );
} );
</script>

View File

@@ -0,0 +1,19 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Model' 'Device Location' 'PoE Module' 'Power (W)'
'Supply' 'Capable Ports' 'Powered Ports' 'Disabled Ports'
'Errored Ports' 'Committed (W)' 'Delivering (W)' ]) %]
[% FOREACH row IN results %]
[% mydlist = [] %]
[% mydevice = row.dns || row.name || row.ip %]
[% mydlist.push(mydevice) %]
[% FOREACH col IN [ row.model row.location row.module row.power row.status
row.poe_capable_ports row.poe_powered_ports
row.poe_disabled_ports row.poe_errored_ports
row.poe_power_committed row.poe_power_delivering
] %]
[% mydlist.push(col) %]
[% END %]
[% CSV.dump(mydlist) %]
[%END%]

View File

@@ -0,0 +1,61 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Left Device</th>
<th>Port</th>
<th>Duplex</th>
<th>Right Device</th>
<th>Port</th>
<th>Duplex</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'left_ip',
"render": function(data, type, row, meta) {
return he.encode(row.left_dns || row.left_ip);
}
}, {
"data": 'left_port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.left_dns || row.left_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'left_duplex',
"render": function(data, type, row, meta) {
return he.encode(capitalizeFirstLetter(data || ''));
}
}, {
"data": 'right_ip',
"render": function(data, type, row, meta) {
return he.encode(row.right_dns || row.right_ip);
}
}, {
"data": 'right_port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.right_dns || row.right_ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'right_duplex',
"render": function(data, type, row, meta) {
return he.encode(capitalizeFirstLetter(data || ''));
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,13 @@
[% USE CSV -%]
[% CSV.dump([ 'Left Device' 'Port' 'Duplex' 'Right Device' 'Port' 'Duplex' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device_left = row.left_dns || row.left_ip %]
[% device_right = row.right_dns || row.right_ip %]
[% FOREACH col IN [ device_left row.left_port row.left_duplex.ucfirst device_right row.right_port row.right_duplex.ucfirst ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,27 @@
<table id="rg-data-table" class="table table-bordered table-condensed table-striped" width="100%" cellspacing="0">
<thead>
<tr>
[% FOREACH hdr IN headings %]
<th>[% hdr | html_entity %]</th>
[% END %]
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr>
[% FOREACH col IN columns %]
<td>[% row.item(col) | html_entity %]</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#rg-data-table').dataTable({
"order": [],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,11 @@
[% USE CSV %]
[% CSV.dump(headings) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% FOREACH col IN columns %]
[% mylist.push(row.item(col)) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,48 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th>Port</th>
<th>Description</th>
<th>Duplex</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return he.encode(row.device.dns || row.device.name || row.ip);
}
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_duplex=on">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'name',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'duplex',
"searchable": false,
"orderable": false,
"render": function(data, type, row, meta) {
return he.encode(capitalizeFirstLetter(data));
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Port' 'Description' 'Duplex' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = rrow.device.dns || row.device.name || row.ip %]
[% FOREACH col IN [ device row.port row.name row.duplex.ucfirst ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,71 @@
<table id="nsbi-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th>Model</th>
<th>Operating System Version</th>
<th>Count</th>
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr>
<td>
<a href="[% search_device %]&q=[% row.model | uri %]&vendor=[% row.vendor | uri %]&model=[% row.model | uri %]">
[% row.vendor.ucfirst | html_entity %]&nbsp;[% row.model | html_entity %]</a>
[% IF row.os %] running &quot;[% row.os | html_entity %]&quot;[% END %]
</td>
<td>
<a class="nd_linkcell"
href="[% search_device %]&q=[% row.os_ver | uri %]&vendor=[% row.vendor | uri %]&model=[% row.model | uri %]&os=[% row.os | uri %]&os_ver=[% row.os_ver | uri %]&matchall=on">
[% row.os_ver | html_entity %]</a>
</td>
<td>[% row.os_ver_count | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
<style>
tr.group,
tr.group:hover {
background-color: #ddd !important;
}
</style>
<script>
$(document).ready(function() {
var table = $('#nsbi-data-table').DataTable({
"columnDefs": [
{ "visible": false, "targets": 0 }
],
sort: false,
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(0, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
'<tr class="group"><td colspan="2">'+group+'</td></tr>'
);
last = group;
}
} );
},
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
// Order by the grouping
$('#nsbi-data-table tbody').on( 'click', 'tr.group', function () {
var currentOrder = table.order()[0];
if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) {
table.order( [ 0, 'desc' ] ).draw();
}
else {
table.order( [ 0, 'asc' ] ).draw();
}
} );
} );
</script>

View File

@@ -0,0 +1,67 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Node</th>
<th>MAC Address</th>
<th class="nd_center-cell">DNS</th>
<th>Last Used</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
var cell_str = he.encode(data);
if (type == 'display') {
if (row.time_last && row.node) {
cell_str = '<a href="[% search_node %]&q=' + encodeURIComponent(data)
+ (row.active ? '' : '&archived=on') + '">' + he.encode(data)
+ (row.active ? '' : '&nbsp;<i class="icon-book text-warning"></i>&nbsp;') + '</a>';
}
else if (row.time_last) {
cell_str = '<a href="[% search_device %]&q=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';
}
}
return cell_str;
}
}, {
"data": 'mac',
"render": function(data, type, row, meta) {
var cell_str = he.encode(data || '');
if (type == 'display' && data && row.time_last) {
cell_str = '<a href="[% search_node %]&q=' + encodeURIComponent(data)
+ (row.active ? '' : '&archived=on') + '">' + he.encode(data)
+ (row.active ? '' : '&nbsp;<i class="icon-book text-warning"></i>&nbsp;') + '</a>';
}
return cell_str;
}
}, {
"data": 'dns',
"className": "nd_nowrap nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'age',
"render": function(data, type, row, meta) {
if (type == 'display') {
return he.encode(data || 'Never');
}
else {
// so that sorting works correctly on this column
return row.time_last;
}
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV %]
[% CSV.dump([ 'Node' 'MAC Address' 'DNS' 'Last Used' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.ip) %]
[% mylist.push(row.mac) %]
[% mylist.push(row.dns) %]
[% mylist.push(row.time_last) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,111 @@
[% USE url %]
[% IF opt %]
<table id="data-table" class="table table-striped table-bordered" 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" width="100%" cellspacing="0">
<thead>
<tr>
<th>Class</th>
<th>Count</th>
</tr>
</thead>
</table>
[% END %]
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
[% IF opt %]
"serverSide": true,
"searching": false,
"order": [[ 0, "desc" ]],
"ajax": "[% uri_for('/ajax/content/report/moduleinventory/data') %]?[% url(params('query').hash) %]",
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/device') %]?tab=modules&q=' + encodeURIComponent(data) + '">' + he.encode(row.device.dns || row.device.name || row.ip) + '</a>';
}
}, {
"data": 'description',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/moduleinventory') %]?description=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'name',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/moduleinventory') %]?name=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'class',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/moduleinventory') %]?class=' + encodeURIComponent(data) + '">' + he.encode(capitalizeFirstLetter(data + '')) + '</a>';
}
}, {
"data": 'type',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/moduleinventory') %]?type=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'model',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/moduleinventory') %]?model=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'serial',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/moduleinventory') %]?serial=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'hw_ver',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'sw_ver',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'fw_ver',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
[% ELSE %]
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'class',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/moduleinventory') %]?class=' + encodeURIComponent(data) + '">' + he.encode(capitalizeFirstLetter(data + '')) + '</a>';
}
}, {
"data": 'count',
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
[% END %]
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,25 @@
[% USE CSV -%]
[% IF opt %]
[% CSV.dump(['Device' 'Description' 'Name' 'Class' 'Type' 'Model' 'Serial' 'HW Version' 'SW Version' 'FW Version']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.device.dns || row.device.name || row.ip %]
[% FOREACH col IN [ device row.description row.name row.class.ucfirst row.type row.model row.serial row.hw_ver row.sw_ver row.fw_ver ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% ELSE %]
[% CSV.dump(['Class' 'Count']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% FOREACH col IN [ row.class.ucfirst row.count ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% END %]

View File

@@ -0,0 +1,93 @@
[% USE url %]
[% IF opt %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Domain</th>
<th>Node</th>
<th>Name</th>
<th>User</th>
<th>First Seen</th>
<th>Last Seen</th>
</tr>
</thead>
</table>
[% ELSE %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Domain</th>
<th>Count</th>
</tr>
</thead>
</table>
[% END %]
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
[% IF opt %]
"serverSide": true,
"order": [[ 0, "desc" ]],
"ajax": "[% uri_for('/ajax/content/report/netbios/data') %]?[% url(params('query').hash) %]",
"columns": [
{
"data": 'domain',
"render": function(data, type, row, meta) {
return he.encode(data || '(Blank Domain)');
}
}, {
"data": 'mac',
"render": function(data, type, row, meta) {
return '<a href="[% search_node %]&q=' + encodeURIComponent(data) + '">' + he.encode(data.toUpperCase()) + '</a>';
}
}, {
"data": 'nbname',
"render": function(data, type, row, meta) {
var prefix = '';
if (row.domain) {
prefix = '\\\\' + row.domain + '\\';
}
return he.encode(prefix) + '<a href="[% search_node %]&q=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>';
}
}, {
"data": 'nbuser',
"render": function(data, type, row, meta) {
return he.encode(row.nbuser || '[No User]');
}
}, {
"data": 'time_first',
"render": function(data, type, row, meta) {
return moment(data).format('YYYY-MM-DD HH:mm');
}
}, {
"data": 'time_last',
"render": function(data, type, row, meta) {
return moment(data).format('YYYY-MM-DD HH:mm');
}
}
],
"order": [[0, "asc"], [5, "desc"]],
[% ELSE %]
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'domain',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/netbios') %]?domain=' + encodeURIComponent(data || 'blank') + '">' + he.encode(data || '(Blank Domain)') + '</a>';
}
}, {
"data": 'count',
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
"order": [[1, "desc"]],
[% END %]
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,27 @@
[% USE CSV -%]
[% USE date(format = '%Y-%m-%d %H:%M') %]
[% IF opt %]
[% CSV.dump(['Domain' 'Node' 'Name' 'User' 'First Seen' 'Last Seen']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.device.dns || row.device.name || row.device.ip %]
[% FOREACH col IN [ row.domain row.mac.upper row.nbname row.nbuser date.format(row.time_first) date.format(row.time_last) ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% ELSE %]
[% CSV.dump(['Domain' 'Count']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% domain = row.domain || '(Blank Domain)' %]
[% FOREACH col IN [ domain row.count ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% END %]

View File

@@ -0,0 +1,47 @@
[% USE Number.Format %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>MAC</th>
<th>Vendor</th>
<th>Location</th>
<th>IPs</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"order": [[ 3, "desc" ]],
"data": [% results %],
"columns": [
{
"data": 'mac',
"render": function(data, type, row, meta) {
return '<a href="[% search_node %]&q=' + encodeURIComponent(data) + '">' + he.encode(data.toUpperCase()) + '</a>';
}
}, {
"data": 'vendor',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'port',
"render": function(data, type, row, meta) {
return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.switch) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(row.dns || row.name || row.switch) + '(' + he.encode(data) + ')</a>';
}
}, {
"data": 'ip_count',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,13 @@
[% USE CSV -%]
[% CSV.dump([ 'MAC' 'Vendor' 'Switch' 'Port' 'IPs' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.mac.upper) %]
[% mylist.push(row.vendor) %]
[% mylist.push(row.dns || row.name || row.switch) %]
[% mylist.push(row.port) %]
[% mylist.push(row.ip_count) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,58 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th>Port</th>
<th>Remote ID</th>
<th>Remote IP</th>
<th>Remote Port</th>
<th>Remote Type</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return he.encode(row.dns || row.name || data);
}
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&c_nodes=on&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'remote_id',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'remote_ip',
"render": function(data, type, row, meta) {
return '<a href="[% search_node %]&q=' + encodeURIComponent(data || '') + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'remote_port',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'remote_type',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Port' 'Remote ID' 'Remote IP' 'Remote Port' 'Remote Type']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.dns || row.name || row.ip %]
[% FOREACH col IN [ device row.port row.remote_id row.remote_ip row.remote_port row.remote_type ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,88 @@
[% USE url %]
[% IF opt %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>MAC</th>
<th>Vendor</th>
<th>Device (Port)</th>
<th>Device DNS</th>
<th>Device Name</th>
<th>Device IP</th>
</tr>
</thead>
</table>
[% ELSE %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Vendor</th>
<th class="nd_center-cell">Count</th>
</tr>
</thead>
</table>
[% END %]
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
[% IF opt %]
"serverSide": true,
"order": [[ 0, "desc" ]],
"ajax": "[% uri_for('/ajax/content/report/nodevendor/data') %]?[% url(params('query').hash) %]",
"columns": [
{
"data": 'mac',
"render": function(data, type, row, meta) {
var icon = '&nbsp;&nbsp;<i class="icon-book text-warning"></i> ';
if (row.active) {
icon = '';
}
return '<a href="[% search_node %]&q=' + encodeURIComponent(data) + '">' + he.encode(data.toUpperCase()) + icon + '</a>';
}
}, {
"data": 'oui.abbrev',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/nodevendor') %]?vendor=' + encodeURIComponent(data || 'blank') + '">' + he.encode(data ||'(Unknown Vendor)') + '</a>';
}
}, {
"data": 'port',
"render": function(data, type, row, meta) {
return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.switch) + '&f=' + encodeURIComponent(data) + '&c_nodes=on&n_ssid=on">' + he.encode(row.device.dns || row.device.name || row.switch) + '(' + he.encode(data) + ')</a>';
}
}, {
// Included for filtering
"data": 'device.dns',
"visible": false
}, {
// Included for filtering
"data": 'device.name',
"visible": false
}, {
// Included for filtering
"data": 'switch',
"visible": false
}
],
[% ELSE %]
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'vendor',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/nodevendor') %]?vendor=' + encodeURIComponent(data || 'blank') + '">' + he.encode(data ||'(Unknown Vendor)') + '</a>';
}
}, {
"data": 'count',
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
"order": [[1, "desc"]],
[% END %]
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,26 @@
[% USE CSV -%]
[% IF opt %]
[% CSV.dump(['MAC' 'Vendor' 'Company' 'Device' 'Port']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.device.dns || row.device.name || row.switch %]
[% FOREACH col IN [ row.mac.upper row.oui.abbrev row.oui.company device row.port ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% ELSE %]
[% CSV.dump(['Vendor' 'Count']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% vendor = row.vendor || '(Unknown Vendor)' %]
[% FOREACH col IN [ vendor row.count ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% END %]

View File

@@ -0,0 +1,49 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th>Port</th>
<th>Port Description</th>
<th>Admin Status</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"order": [[ 0, "asc" ], [1, "asc"]],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return he.encode(row.dns || row.name || row.ip);
}
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'description',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'up_admin',
"orderable": false,
"searchable": false,
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
"data": [% results %],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Port' 'Port Description' 'Admin Status' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.dns || row.name || row.ip) %]
[% mylist.push(row.port) %]
[% mylist.push(row.description) %]
[% mylist.push(row.up_admin) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,50 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th>Port</th>
<th>Port Description</th>
<th>STP Status</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"order": [[ 0, "asc" ], [1, "asc"]],
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return he.encode(row.dns || row.name || row.ip);
}
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'description',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'stp',
"orderable": false,
"searchable": false,
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Port' 'Port Description' 'STP Status' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.dns || row.name || row.ip) %]
[% mylist.push(row.port) %]
[% mylist.push(row.description) %]
[% mylist.push(row.stp) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,49 @@
<table id="data-table" class="table table-bordered table-condensed table-striped" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Creation</th>
<th class="nd_center-cell">User</th>
<th class="nd_center-cell">User IP</th>
<th class="nd_center-cell">Action</th>
<th class="nd_center-cell">Reason</th>
<th class="nd_center-cell">Log</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell">-</td>
<td class="nd_center-cell">[% session.logged_in_user | html_entity %]</td>
<td class="nd_center-cell">-</td>
<td class="nd_center-cell">comment</td>
<td class="nd_center-cell">Other</td>
<td class="nd_center-cell"><input data-form="add" class="span4" name="log" type="text" placeholder="Add comment..."></td>
<input data-form="add" name="ip" type="hidden" value="[% params.q | html_entity %]">
<input data-form="add" name="port" type="hidden" value="[% params.f | html_entity %]">
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% WHILE (row = results.next) %]
<tr>
<td class="nd_center-cell">[% row.creation_stamp | html_entity %]</td>
<td class="nd_center-cell">[% row.username | html_entity %]</td>
<td class="nd_center-cell">[% row.userip | html_entity %]</td>
<td class="nd_center-cell">[% row.action | html_entity %]</td>
<td class="nd_center-cell">[% settings.port_control_reasons.item(row.reason) || row.reason | html_entity %]</td>
<td class="nd_center-cell">[% row.log || '-' | html_entity %]</td>
<td class="nd_center-cell"></td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
sort: false,
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,48 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th>Port</th>
<th>Port Description</th>
<th>Node Count</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"order": [[ 3, "desc" ]],
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return he.encode(row.dns || row.name || row.ip);
}
}, {
"data": 'port',
"type": 'portsort',
"render": function(data, type, row, meta) {
return type === 'display' ?
'<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '&c_nodes=on">' + he.encode(data) + '</a>' :
data;
}
}, {
"data": 'description',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'mac_count',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Port' 'Port Description' 'Node Count' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.dns || row.name || row.ip) %]
[% mylist.push(row.port) %]
[% mylist.push(row.description) %]
[% mylist.push(row.mac_count) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,87 @@
[% USE Number.Format %]
[% IF opt %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device (Port)</th>
<th>Broadcast</th>
<th>Model</th>
<th>SSID</th>
<th>Vendor</th>
</tr>
</thead>
</table>
[% ELSE %]
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">SSID</th>
<th class="nd_center-cell">Broadcast</th>
<th class="nd_center-cell">Count</th>
</tr>
</thead>
</table>
[% END %]
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
[% IF opt %]
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% device_ports %]&q=' + encodeURIComponent(data) + '&f=' + encodeURIComponent(row.port.port) + '&c_nodes=on&n_ssid=on">' + he.encode(row.device.dns || row.device.name || row.ip) + '(' + he.encode(row.port.port) + ')</a>';
}
}, {
"data": 'broadcast',
"render": function(data, type, row, meta) {
return (data ? 'Yes' : 'No');
}
}, {
"data": 'device.model',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'ssid',
"searchable": false,
"orderable": false,
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'device.vendor',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
[% ELSE %]
"columns": [
{
"data": 'ssid',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/report/portssid') %]?ssid=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'broadcast',
"render": function(data, type, row, meta) {
return (data ? 'Yes' : 'No');
}
}, {
"data": 'count',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
},
],
"order": [[ 2, "desc" ]],
[% END %]
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,26 @@
[% USE CSV -%]
[% IF opt %]
[% CSV.dump(['Device' 'Port' 'Name' 'Broadcast' 'Model' 'SSID' 'Vendor']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.device.dns || row.device.name || row.device.ip %]
[% broadcast = row.broadcast ? 'Yes' : 'No' %]
[% FOREACH col IN [ device row.port.port row.device.name broadcast row.device.model row.ssid row.device.vendor ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% ELSE %]
[% CSV.dump(['SSID' 'Count']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% FOREACH col IN [ row.ssid row.count ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]
[% END %]

View File

@@ -0,0 +1,54 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th class="nd_center-cell">Total Ports</th>
<th class="nd_center-cell">In Use</th>
<th class="nd_center-cell">Shutdown</th>
<th class="nd_center-cell">Free</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% device_ports %]&q=' + encodeURIComponent(data) + '">' + he.encode(row.dns || row.ip) + '</a>';
}
}, {
"data": 'port_count',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'ports_in_use',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'ports_shutdown',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'ports_free',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Device' 'Total Ports' 'In Use' 'Shutdown' 'Free' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.dns || row.ip %]
[% FOREACH col IN [ device row.port_count row.ports_in_use row.ports_shutdown row.ports_free ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,32 @@
[% USE Number.Format %]
<table id="data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Subnet</th>
<th class="nd_center-cell">Size</th>
<th class="nd_center-cell">Number of Active Nodes</th>
<th class="nd_center-cell">Percent Utilization</th>
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr>
<td class="nd_center-cell"><a href="[% uri_for('/report/ipinventory') %]?subnet=[% row.subnet | uri %]&daterange=[% params.daterange | uri %]&age_invert=[% params.age_invert | uri %]&limit=[% row.subnet_size | uri %]">
[% row.subnet | html_entity %]</a></td>
<td class="nd_center-cell">[% row.subnet_size | format_number %]</td>
<td class="nd_center-cell">[% row.active | format_number %]</td>
<td class="nd_center-cell">[% row.percent | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"order": [[ 3, 'desc' ]],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,14 @@
[% USE CSV %]
[% CSV.dump([ 'Subnet' 'Size' 'Number of Active Nodes' 'Percent Utilization' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.subnet) %]
[% mylist.push(row.subnet_size) %]
[% mylist.push(row.active) %]
[% mylist.push(row.percent) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,45 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>VLAN ID</th>
<th>VLAN Name</th>
<th>Device Count</th>
<th>Port Count</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [
{
"data": 'vlan',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/search') %]?tab=vlan&q=' + encodeURIComponent(data) + '">' + data + '</a>';
}
}, {
"data": 'description',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/search') %]?tab=vlan&q=' + encodeURIComponent(data) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'dcount',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}, {
"data": 'pcount',
"searchable": false,
"render": function(data, type, row, meta) {
return data.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});
</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'VLAN ID' 'VLAN Name' 'Device Count' 'Port Count' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.vlan) %]
[% mylist.push(row.description) %]
[% mylist.push(row.dcount) %]
[% mylist.push(row.pcount) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,71 @@
<table id="ds-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Device</th>
<th>Contact</th>
<th>Location</th>
<th>System Name</th>
<th>Model</th>
<th>OS Version</th>
<th>Management IP</th>
<th>Serial</th>
<th>Last Discovered</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#ds-data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [{
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% uri_for('/device') %]?q=' + encodeURIComponent(data) + '">' + he.encode(row.dns || row.name || row.ip) + '</a>';
}
}, {
"data": 'contact',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'location',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'name',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'model',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'os_ver',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'ip',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'serial',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'last_discover_stamp',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump(['Device','Contact','Location','System Name','Model','OS Version','Management IP','Serial']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.dns || row.ip %]
[% FOREACH col IN [ device row.contact row.location row.name row.model row.os_ver row.ip row.serial] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,216 @@
[% USE date(format = '%Y-%m-%d %H:%M') %]
[% USE Number.Format %]
<table id="nsbi-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th>MAC</th>
<th>Match</th>
<th class="nd_center-cell">Device or Node</th>
[% IF params.stamps %]
<th>First Seen</th>
<th>Last Seen</th>
[% END %]
</tr>
</thead>
</tbody>
[% WHILE (row = macs.next) %]
[% IF row.nbname %]
<tr>
<td>MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
[% row.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
[% row.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>NetBIOS</td>
<td class="nd_linkcell nd_center-cell">\\<a href="[% uri_for('/report/netbios') %]?domain=[% row.domain | uri %]" title="Devices in this Domain">[% row.domain | html_entity %]</a>\<a href="[% search_node %]&q=[% row.nbname | uri %]">[% row.nbname | html_entity %]</a>
<br>[% row.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
</td>
[% IF params.stamps %]
<td>[% row.time_first_stamp | html_entity %]</td>
<td>[% row.time_last_stamp | html_entity %]</td>
[% END %]
</tr>
[% ELSE %]
<tr>
<td>MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
[% row.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
[% row.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>IP &rarr; MAC</td>
<td class="nd_center-cell">
<a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
[% '&nbsp;<i class="icon-book text-warning"></i>&nbsp;' IF NOT row.active %]
[% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %]
</td>
[% IF params.stamps %]
<td>[% row.time_first_stamp | html_entity %]</td>
<td>[% row.time_last_stamp | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% FOREACH nbt IN row.netbios %]
<tr>
<td>MAC: <a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]">
[% nbt.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nbt.oui.abbrev | uri %]">
[% nbt.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>NetBIOS</td>
<td class="nd_linkcell nd_center-cell">\\<a href="[% uri_for('/report/netbios') %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html_entity %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
<br>[% nbt.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
</td>
[% IF params.stamps %]
<td>[% date.format(nbt.time_first) | html_entity %]</td>
<td>[% date.format(nbt.time_last) | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% FOREACH ni IN row.nodeips %]
<tr>
<td>MAC: <a href="[% search_node %]&q=[% ni.net_mac.$mac_format_call | uri %]">
[% ni.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% ni.oui.abbrev | uri %]">
[% ni.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>IP &rarr; MAC</td>
<td class="nd_center-cell">
<a href="[% search_node %]&q=[% ni.ip | uri %]">[% ni.ip | html_entity %]</a>
[% '&nbsp;<i class="icon-book text-warning"></i>&nbsp;' IF NOT ni.active %]
[% ' (' _ ni.dns.remove(settings.domain_suffix) _ ')' IF ni.dns %]
</td>
[% IF params.stamps %]
<td>[% date.format(ni.time_first) | html_entity %]</td>
<td>[% date.format(ni.time_last) | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% FOREACH node IN row.node_sightings(archive_filter) %]
<tr>
<td>MAC: <a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
[% node.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% node.oui.abbrev | uri %]">
[% node.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>Switch Port</td>
<td class="nd_center-cell">
<a class="nd_linkcell"
href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on&prefer=port">
[% node.switch | html_entity %] - [% node.port | html_entity %]
[% '&nbsp;<i class="icon-book text-warning"></i>' IF NOT node.active %]</a>
[% IF node.device.dns AND node.device_port AND node.device_port.name %]
([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %])
[% END %]
on vlan [% node.vlan %]
</td>
[% IF params.stamps %]
<td>[% node.time_first_stamp | html_entity %]</td>
<td>[% node.time_last_stamp | html_entity %]</td>
[% END %]
</tr>
[% FOREACH wlan IN node.wireless %]
<tr>
<td>MAC: <a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]">
[% wlan.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% wlan.oui.abbrev | uri %]">
[% wlan.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>Wireless Info</td>
<td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br>
MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br>
SigStr: [% wlan.sigstrength | html_entity %] SigQual: [% wlan.sigqual | html_entity %]<br>
Rx: [% wlan.rxpkt | format_number %] pkts, [% wlan.rxbyte | format_number %] bytes<br>
Tx: [% wlan.txpkt | format_number %] pkts, [% wlan.txbyte | format_number %] bytes<br>
</td>
[% IF params.stamps %]
<td> &nbsp; </td>
<td>[% date.format(wlan.time_last) | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% END %]
[% FOREACH nodeip IN row.ip_aliases(archive_filter) %]
<tr>
<td>MAC: <a href="[% search_node %]&q=[% nodeip.net_mac.$mac_format_call | uri %]">
[% nodeip.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nodeip.oui.abbrev | uri %]">
[% nodeip.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>MAC &rarr; IP</td>
<td class="nd_center-cell">
<a href="[% search_node %]&q=[% nodeip.ip | uri %]">[% nodeip.ip | html_entity %]</a>
[% '&nbsp;<i class="icon-book text-warning"></i>&nbsp;' IF NOT nodeip.active %]
[% ' (' _ nodeip.dns.remove(settings.domain_suffix) _ ')' IF nodeip.dns %]
</td>
[% IF params.stamps %]
<td>[% nodeip.time_first_stamp | html_entity %]</td>
<td>[% nodeip.time_last_stamp | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% END %]
</tbody>
</table>
<style>
tr.group,
tr.group:hover {
background-color: #ddd !important;
}
</style>
<script>
$(document).ready(function() {
var table = $('#nsbi-data-table').DataTable({
"columnDefs": [
{ "visible": false, "targets": 0 }
],
"order": [[ 0, 'asc' ]],
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(0, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
[% IF params.stamps %]
'<tr class="group"><td colspan="4">'+group+'</td></tr>'
[% ELSE %]
'<tr class="group"><td colspan="2">'+group+'</td></tr>'
[% END %]
);
last = group;
}
} );
},
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
// Order by the grouping
$('#nsbi-data-table tbody').on( 'click', 'tr.group', function () {
var currentOrder = table.order()[0];
if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) {
table.order( [ 0, 'desc' ] ).draw();
}
else {
table.order( [ 0, 'asc' ] ).draw();
}
} );
} );
</script>

View File

@@ -0,0 +1,176 @@
[% USE Number.Format %]
<table id="nsbm-data-table" class="table table-bordered table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th>MAC</th>
<th>Match</th>
<th class="nd_center-cell">Device or Node</th>
[% IF params.stamps %]
<th>First Seen</th>
<th>Last Seen</th>
[% END %]
</tr>
</thead>
</tbody>
[% WHILE (row = ips.next) %]
<tr>
<td>
MAC: <a href="[% search_node %]&q=[% row.net_mac.$mac_format_call | uri %]">
[% row.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% row.oui.abbrev | uri %]">
[% row.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>MAC &rarr; IP</td>
<td class="nd_center-cell"><a href="[% search_node %]&q=[% row.ip | uri %]">[% row.ip | html_entity %]</a>
[% '&nbsp;<i class="icon-book text-warning"></i>&nbsp;' IF NOT row.active %]
[% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %]
</td>
[% IF params.stamps %]
<td>[% row.time_first_stamp | html_entity %]</td>
<td>[% row.time_last_stamp | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% WHILE (node = sightings.next) %]
<tr>
<td>
MAC: <a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
[% node.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% node.oui.abbrev | uri %]">
[% node.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>Switch Port</td>
<td class="nd_center-cell">
<a href="[% device_ports %]&q=[% node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on&prefer=port">
[% node.switch | html_entity %] - [% node.port | html_entity %]</a>
[% '&nbsp;<i class="icon-book text-warning"></i>&nbsp;' IF NOT node.active %]
[% IF node.device.dns AND node.device_port AND node.device_port.name %]
([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %])
[% END %]
on vlan [% node.vlan %]
</td>
[% IF params.stamps %]
<td>[% node.time_first_stamp | html_entity %]</td>
<td>[% node.time_last_stamp | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% WHILE (port = ports.next) %]
<tr>
<td>
MAC: <a href="[% search_node %]&q=[% port.net_mac.$mac_format_call | uri %]">[% port.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% port.oui.abbrev | uri %]">
[% port.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>Switch Port</td>
<td class="nd_center-cell">
<a href="[% device_ports %]&q=[% port.ip | uri %]&f=[% port.port | uri %]&c_mac=on&c_nodes=on&c_neighbors=on">
[% port.ip | html_entity %] - [% port.descr | html_entity %]</a>
[% IF port.device.dns AND port.name %]
([% port.device.dns | html_entity %] - [% port.name | html_entity %])
[% END %]
</td>
[% IF params.stamps %]
<td>[% port.creation | html_entity %]</td>
<td>[% port.creation | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% WHILE (nbt = netbios.next) %]
<tr>
<td>
MAC: <a href="[% search_node %]&q=[% nbt.net_mac.$mac_format_call | uri %]">[% nbt.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% nbt.oui.abbrev | uri %]">
[% nbt.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>NetBIOS</td>
<td class="nd_center-cell">\\<a href="[% uri_for('/report/netbios') %]?domain=[% nbt.domain | uri %]" title="Devices in this Domain">[% nbt.domain | html_entity %]</a>\<a href="[% search_node %]&q=[% nbt.nbname | uri %]">[% nbt.nbname | html_entity %]</a>
<br>[% nbt.nbuser || '[No User]' | html_entity %]@<a href="[% search_node %]&q=[% nbt.ip | uri %]">[% nbt.ip | html_entity %]</a>
</td>
[% IF params.stamps %]
<td>[% nbt.time_first_stamp | html_entity %]</td>
<td>[% nbt.time_last_stamp | html_entity %]</td>
[% END %]
</tr>
[% END %]
[% WHILE (wlan = wireless.next) %]
<tr>
<td>
MAC: <a href="[% search_node %]&q=[% wlan.net_mac.$mac_format_call | uri %]">[% wlan.net_mac.$mac_format_call | html_entity %]</a>
[% IF params.show_vendor %]
( <a href="[% uri_for('/report/nodevendor') %]?vendor=[% wlan.oui.abbrev | uri %]">
[% wlan.oui.company | html_entity %]</a> )
[% END %]
</td>
<td>Wireless Info</td>
<td class="nd_center-cell">SSID: [% wlan.ssid | html_entity %]<br>
MaxRate: [% wlan.maxrate | html_entity %]Mbps TxRate: [% wlan.txrate | html_entity %]Mbps<br>
SigStr: [% wlan.sigstrength | html_entity %] SigQual: [% wlan.sigqual | html_entity %]<br>
Rx: [% wlan.rxpkt | format_number %] pkts, [% wlan.rxbyte | format_number %] bytes<br>
Tx: [% wlan.txpkt | format_number %] pkts, [% wlan.txbyte | format_number %] bytes<br>
</td>
[% IF params.stamps %]
<td> &nbsp; </td>
<td>[% wlan.get_column('time_last_stamp') | html_entity %]</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
<style>
tr.group,
tr.group:hover {
background-color: #ddd !important;
}
</style>
<script>
$(document).ready(function() {
var table = $('#nsbm-data-table').DataTable({
"columnDefs": [
{ "visible": false, "targets": 0 }
],
"order": [[ 0, 'asc' ]],
"drawCallback": function ( settings ) {
var api = this.api();
var rows = api.rows( {page:'current'} ).nodes();
var last=null;
api.column(0, {page:'current'} ).data().each( function ( group, i ) {
if ( last !== group ) {
$(rows).eq( i ).before(
[% IF params.stamps %]
'<tr class="group"><td colspan="4">'+group+'</td></tr>'
[% ELSE %]
'<tr class="group"><td colspan="2">'+group+'</td></tr>'
[% END %]
);
last = group;
}
} );
},
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
// Order by the grouping
$('#nsbm-data-table tbody').on( 'click', 'tr.group', function () {
var currentOrder = table.order()[0];
if ( currentOrder[0] === 0 && currentOrder[1] === 'asc' ) {
table.order( [ 0, 'desc' ] ).draw();
}
else {
table.order( [ 0, 'asc' ] ).draw();
}
} );
} );
</script>

View File

@@ -0,0 +1,48 @@
<table id="ps-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Port</th>
<th>Description</th>
<th>Vlan</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#ps-data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [{
"data": 'name',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'ip',
"render": function(data, type, row, meta) {
var ddns = '';
if (row.device.dns || row.device.name) {
ddns = ' (' + 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": 'descr',
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'port_vlans.vlan',
"render": function(data, type, row, meta) {
return data || '';
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Name' 'Port' 'Description' 'Vlan' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% myport = "$row.ip [ $row.port ] (" _ (row.device.dns || row.device.name) _ ")" IF (row.device.dns || row.device.name) %]
[% FOREACH col IN [ row.name myport row.descr row.port_vlans.vlan ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,53 @@
<table id="vs-data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Vlan</th>
<th>Device</th>
<th>Description</th>
<th>Model</th>
<th>OS</th>
<th>Vendor</th>
</tr>
</thead>
</table>
<script type="text/javascript">
$(document).ready(function() {
var table = $('#vs-data-table').dataTable({
"deferRender": true,
"data": [% results %],
"columns": [{
"data": 'vlans.vlan',
"render": function(data, type, row, meta) {
return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(data) + '">' + data + '</a>';
}
}, {
"data": 'ip',
"render": function(data, type, row, meta) {
return '<a href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(row.dns || row.ip) + '</a>';
}
}, {
"data": 'vlans.description',
"render": function(data, type, row, meta) {
return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'model',
"render": function(data, type, row, meta) {
return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'os',
"render": function(data, type, row, meta) {
return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
}
}, {
"data": 'vendor',
"render": function(data, type, row, meta) {
return '<a class="nd_linkcell nd_stealth-link" href="[% device_ports %]&q=' + encodeURIComponent(row.ip) + '&f=' + encodeURIComponent(row.vlans.vlan) + '">' + he.encode(data || '') + '</a>';
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
});
});</script>

View File

@@ -0,0 +1,12 @@
[% USE CSV -%]
[% CSV.dump([ 'Vlan' 'Device' 'Description' 'Model' 'OS' 'Vendor' ]) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% device = row.dns || row.ip %]
[% FOREACH col IN [ row.vlans.vlan device row.vlans.description row.model row.os row.vendor ] %]
[% mylist.push(col) %]
[% END %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,77 @@
[% USE Number.Format %]
<div class="row">
<div class="span5 offset1">
<h4>Built using Open Source</h4>
<table class="table table-condensed">
<thead>
<tr>
<th>Software</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<th><b><a href="http://netdisco.org">App::Netdisco</a></b></th>
<th>[% disco_ver | html_entity %]</th>
</tr>
<tr>
<th><a href="https://metacpan.org/module/netdisco-db-deploy">DB Schema</a></th>
<th>v[% schema_ver | html_entity %]</th>
</tr>
<tr>
<th><a href="http://perldancer.org/">Dancer</a></th>
<th>[% dancer_version | html_entity %]</th>
</tr>
<tr>
<th><a href="http://getbootstrap.com">Bootstrap</a></th>
<th>[%# Can't determine magically %] 2.3.1</th>
</tr>
<tr>
<th><a href="http://www.postgresql.org">PostgreSQL</a></th>
<th>
[% db_version| html_entity %].<br />
&nbsp;DBI [% dbi_ver | html_entity %],
DBD::Pg [% dbdpg_ver | html_entity %]
</th>
</tr>
<tr>
<th><a href="https://github.com/netdisco/snmp-info">SNMP::Info</a></th>
<th>[% snmpinfo_ver | html_entity %]</th>
</tr>
<tr>
<th><a href="http://www.perl.org">Perl</a></th>
<th>[% perl_version | html_entity %]</th>
</tr>
</tbody>
</table>
</div>
<div class="span4 offset1">
<h4>Statistics for this installation</h4>
<table class="table table-condensed">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>[% device_count | format_number %] devices with [% device_port_count | format_number %] interfaces
using [% device_count + device_ip_count | format_number %] IPs</th>
</tr>
<tr>
<th>[% device_links | format_number %] layer 2 links between devices</th>
</tr>
<tr>
<th>[% node_count | format_number %] nodes in [% node_table_count | format_number %] entries</th>
</tr>
<tr>
<th>[% ip_count | format_number %] IPs in [% ip_table_count | format_number %] entries</th>
</tr>
<tr>
<th>Statistics took [% process_time %] seconds to process.</th>
</tr>
<tr><th></th></tr>
</tbody>
</table>
</div>
</div>

57
share/views/device.tt Normal file
View File

@@ -0,0 +1,57 @@
<i class="nd_sidebar-toggle icon-wrench icon-large" id="nd_sidebar-toggle-img-out"
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
<div class="container-fluid">
<div class="nd_sidebar nd_sidebar-pinned">
<div class="well">
<i class="nd_sidebar-toggle icon-signout" id="nd_sidebar-toggle-img-in"
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar" data-container="body"></i>
<i class="nd_sidebar-pin icon-pushpin nd_sidebar-pin-clicked"
rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar" data-container="body"></i>
<a id="nd_sidebar-reset-link" href="#">
<i class="nd_sidebar-reset icon-undo"
rel="tooltip" data-placement="left" data-offset="5" data-title="Reset to Defaults" data-container="body"></i>
</a>
<div class="tab-content">
[% FOREACH tab IN settings._device_tabs %]
<div id="[% tab.tag %]_search" class="tab-pane [% 'active' IF params.tab == tab.tag %]">
<form id="[% tab.tag %]_form" class="nd_sidebar-form form-stacked"
method="get" action="[% uri_for('/device') %]">
<input name="tab" value="[% tab.tag %]" type="hidden"/>
[% TRY %]
<script type="text/javascript">has_sidebar["[% tab.tag %]"] = 1;</script>
[% INCLUDE "sidebar/device/${tab.tag}.tt" %]
[% CATCH %]
<!-- no "[% tab.tag %]" search options -->
<input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<input name="f" value="[% params.f | html_entity %]" type="hidden"/>
<script type="text/javascript">has_sidebar["[% tab.tag %]"] = 0;</script>
[% END %]
</form>
</div> <!-- /tab-pane -->
[% END %]
</div> <!-- /tab-content -->
</div>
</div>
<div class="content">
<ul id="nd_search-results" class="nav nav-tabs">
[% FOREACH tab IN settings._device_tabs %]
<li[% ' class="active"' IF params.tab == tab.tag %]><a id="[% tab.tag %]_link" href="#[% tab.tag %]_pane">[% tab.label %]</a></li>
[% END %]
<span id="nd_device-name">
[% display_name | html_entity %]
<a id="nd_csv-download" href="#" download="netdisco.csv">&nbsp;
<i id="nd_csv-download-icon" class="text-info icon-file-text-alt icon-large"
rel="tooltip" data-placement="left" data-offset="5" data-title="Download as CSV"></i></a>
</span>
</ul>
<div class="tab-content">
[% FOREACH tab IN settings._device_tabs %]
<div class="tab-pane[% ' active' IF params.tab == tab.tag %]" id="[% tab.tag %]_pane"></div>
[% END %]
</div>
</div>
<script type="text/javascript">
[%+ INCLUDE 'js/device.js' -%]
</script>

111
share/views/index.tt Normal file
View File

@@ -0,0 +1,111 @@
<div class="container">
<div class="row nd_hero-row">
<div class="span8 offset2">
[% IF params.login_failed %]
<div class="alert alert-error fade in">
<a class="close" data-dismiss="alert">×</a>
Incorrect username or password, please try again.
</div>
[% END %]
[% IF params.logout %]
<div class="alert fade in">
<a class="close" data-dismiss="alert">×</a>
You are now logged out.
</div>
[% END %]
[% IF params.nosuchdevice %]
<div class="alert fade in">
<a class="close" data-dismiss="alert">×</a>
Sorry, no such device is known.
</div>
[% END %]
[% IF vars.notfound %]
<div class="alert fade in">
<a class="close" data-dismiss="alert">×</a>
Sorry, page not found.&nbsp;
<a href="https://github.com/netdisco/netdisco/issues/new" target="_blank"><i class="icon-bug"></i>&nbsp;Report a Bug?</a>
</div>
[% END %]
[% IF settings.suggest_guest AND NOT session.logged_in_user %]
<div class="alert alert-info fade in">
<a class="close" data-dismiss="alert">×</a>
Guest access is available by entering username &quot;guest&quot; and password &quot;guest&quot;.
</div>
[% END %]
<div class="hero-unit">
<h2>Welcome to Netdisco</h2>
<small>Netdisco is an Open Source management tool designed for network administrators.</small>
[% IF NOT session.logged_in_user %]
<form class="nd_login-form" method="post" action="[% uri_for('/login') %]">
<div class="form-horizontal">
<input id='loginuser' placeholder="Username" class="span2" name="username" type="text" required="required"/>
<input placeholder="Password" class="span2" name="password" type="password" required="required"/>
<button type="submit" class="btn btn-info">Log In</button>
[% IF settings.login_logo %]
<img src="[% settings.login_logo %]" alt="Login Logo" />
[% END %]
</div>
[% IF params.return_url %]
<input type="hidden" name="return_url" value="[% params.return_url | html_entity %]"/>
[% END %]
</form>
[% ELSE %]
[% IF user_has_role('admin') %]
<form class="nd_login-form" method="post" action="[% uri_for('/admin/discover') %]">
<div class="form-horizontal">
<input placeholder="Device hostname or IP" class="span4" name="device" value="[% params.device %]" type="text"/>
<input type="hidden" name="extra" value="with-nodes"/>
<button type="submit" class="btn btn-info">Discover</button>
</div>
</form>
[% END %]
[% END %]
</div>
</div>
</div>
[% IF session.logged_in_user %]
<div class="accordion" id="accordion-statistics">
<div class="accordion-group">
<div class="accordion-heading nd_sysinfo-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-stats" href="#">
<i class="icon-chevron-up nd_chevron"></i> System Information
</a>
</div>
<div id="collapse-stats" class="accordion-body collapse">
<div class="accordion-inner">
<div id="nd_stats">
<div id="nd_stats_status" class="span2 offset4 alert">
<i class="icon-spinner icon-spin"></i> Compiling statistics...</div>
</div>
</div>
</div>
</div>
</div>
[% END %]
</div> <!-- /container -->
[% IF session.logged_in_user %]
<script type="text/javascript">
var stats_loaded = 0;
$('#nq').focus(); // set focus to navbar search
$('#loginuser').focus(); // set focus to login, if it's there
$('.collapse').on('show', function() {
$('.nd_chevron').toggleClass('icon-chevron-up icon-chevron-down');
if (! stats_loaded) {
$('#nd_stats').load("[% uri_for('/ajax/content/statistics') %]", function(r,s,x) {
if (s == "error") {
$('#nd_stats_status').addClass('alert-error')
.html('<i class="icon-warning-sign"></i> Failed to retrieve system information.');
}
});
stats_loaded = 1;
}
});
$('.collapse').on('hide', function() {
$('.nd_chevron').toggleClass('icon-chevron-up icon-chevron-down');
});
</script>
[% END %]

78
share/views/inventory.tt Normal file
View File

@@ -0,0 +1,78 @@
<div class="container">
[% IF models.count %]
<div class="row">
<div class="span6">
<h3 class="nd_inventory-table-head">By Platform</h3>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>Vendor</th>
<th>Model</th>
<th>Count</th>
</tr>
</thead>
<tbody>
[% FOREACH platform IN models.all %]
[% NEXT UNLESS platform.vendor OR platform.model %]
<tr>
<th>
[% IF platform.vendor %]
<a class="nd_linkcell"
href="[% search_device %]&q=[% platform.vendor | uri %]&vendor=[% platform.vendor | uri %]">
[% platform.vendor | html_entity %]</a>
[% ELSE %]unknown[% END %]
</th>
<th>
[% IF platform.model %]
<a class="nd_linkcell"
href="[% search_device %]&q=[% platform.model | uri %]&model=[% platform.model | uri %]">
[% platform.model | html_entity %]</a>
[% ELSE %]unknown[% END %]
</th>
<th>[% platform.get_column('count') | html_entity %]</th>
</tr>
[% END %]
</tbody>
</table>
</div>
<div class="span6">
<h3 class="nd_inventory-table-head">By Software Release</h3>
<table class="table table-condensed table-hover">
<thead>
<tr>
<th>OS</th>
<th>Version</th>
<th>Count</th>
</tr>
</thead>
<tbody>
[% FOREACH release IN releases.all %]
[% NEXT UNLESS (release.os OR release.os_ver) %]
<tr>
<th>
[% IF release.os %]
<a class="nd_linkcell"
href="[% search_device %]&q=[% release.os | uri %]&os=[% release.os | uri %]">
[% release.os | html_entity %]</a>
[% ELSE %]unknown[% END %]
</th>
<th>
[% IF release.os_ver %]
<a class="nd_linkcell"
href="[% search_device %]&q=[% release.os_ver | uri %]&os_ver=[% release.os_ver | uri %]">
[% release.os_ver | html_entity %]</a>
[% ELSE %]unknown[% END %]
</th>
<th>[% release.get_column('count') | html_entity %]</th>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
[% ELSE %]
<script type="text/javascript">
window.location = '[% uri_for("/") %]';
</script>
[% END %]
</div>

182
share/views/js/admintask.js Normal file
View File

@@ -0,0 +1,182 @@
// used by the tabbing interface to make sure the correct
// ajax content is loaded
var path = 'admin';
// keep track of timers so we can kill them
var nd_timers = new Array();
var timermax = [% settings.jobqueue_refresh || 5 | html_entity %];
var timercache = timermax - 1;
// this is called by do_search to support local code
// which might need to act on the newly inserted content
// but which cannot use jQuery delegation via .on()
function inner_view_processing(tab) {
// reload this table every 5 seconds
if (tab == 'jobqueue'
&& $('#nd_countdown-control-icon').hasClass('icon-play')) {
$('#nd_countdown').text(timermax);
// add new timers
for (var i = timercache; i > 0; i--) {
nd_timers.push(setTimeout(function() {
$('#nd_countdown').text(timercache);
timercache = timercache - 1;
}, ((timermax * 1000) - (i * 1000)) ));
}
nd_timers.push(setTimeout(function() {
// clear any running timers
for (var i = 0; i < nd_timers.length; i++) {
clearTimeout(nd_timers[i]);
}
// reset the timer cache
timercache = timermax - 1;
// reload the tab content in...
$('#' + tab + '_form').trigger('submit');
}, (timermax * 1000)));
}
// activate typeahead on the topo boxes
$('.nd_topo_dev').autocomplete({
source: uri_base + '/ajax/data/deviceip/typeahead'
,delay: 150
,minLength: 0
});
// activate typeahead on the topo boxes
$('.nd_topo_port.nd_topo_dev1').autocomplete({
source: function (request, response) {
var query = $('.nd_topo_dev1').serialize();
return $.get( uri_base + '/ajax/data/port/typeahead', query, function (data) {
return response(data);
});
}
,delay: 150
,minLength: 0
});
// activate typeahead on the topo boxes
$('.nd_topo_port.nd_topo_dev2').autocomplete({
source: function (request, response) {
var query = $('.nd_topo_dev2').serialize();
return $.get( uri_base + '/ajax/data/port/typeahead', query, function (data) {
return response(data);
});
}
,delay: 150
,minLength: 0
});
// activate modals
$('.nd_modal').modal({show: false});
}
// on load, establish global delegations for now and future
$(document).ready(function() {
var tab = '[% task.tag %]'
var target = '#' + tab + '_pane';
// get all devices on device input focus
$(target).on('focus', '.nd_topo_dev', function(e) {
$(this).autocomplete('search', '%') });
$(target).on('click', '.nd_topo_dev_caret', function(e) {
$(this).siblings('.nd_topo_dev').autocomplete('search', '%') });
// get all ports on port input focus
$(target).on('focus', '.nd_topo_port', function(e) {
$(this).autocomplete('search') });
$(target).on('click', '.nd_topo_port_caret', function(e) {
$(this).siblings('.nd_topo_port').val('');
$(this).siblings('.nd_topo_port').autocomplete('search');
});
// job control refresh icon should reload the page
$('#nd_countdown-refresh').click(function(event) {
event.preventDefault();
for (var i = 0; i < nd_timers.length; i++) {
clearTimeout(nd_timers[i]);
}
$('#' + tab + '_form').trigger('submit');
});
// job control pause/play icon switcheroo
$('#nd_countdown-control').click(function(event) {
event.preventDefault();
var icon = $('#nd_countdown-control-icon');
icon.toggleClass('icon-pause icon-play text-error text-success');
if (icon.hasClass('icon-pause')) {
for (var i = 0; i < nd_timers.length; i++) {
clearTimeout(nd_timers[i]);
}
$('#nd_countdown').text('0');
}
else {
$('#' + tab + '_form').trigger('submit');
}
});
// activity for admin task tables
// dynamically bind to all forms in the table
$('.content').on('click', '.nd_adminbutton', function(event) {
// stop form from submitting normally
event.preventDefault();
// clear any running timers
for (var i = 0; i < nd_timers.length; i++) {
clearTimeout(nd_timers[i]);
}
// what purpose - add/update/del
var mode = $(this).attr('name');
// submit the query and put results into the tab pane
$.ajax({
type: 'POST'
,async: true
,dataType: 'html'
,url: uri_base + '/ajax/control/admin/' + tab + '/' + mode
,data: $(this).closest('tr').find('input[data-form="' + mode + '"]').serializeArray()
,beforeSend: function() {
$(target).html(
'<div class="span2 alert">Request submitted...</div>'
);
}
,success: function() {
$('#' + tab + '_form').trigger('submit');
}
// skip any error reporting for now
// TODO: fix sanity_ok in Netdisco Web
,error: function() {
$('#' + tab + '_form').trigger('submit');
}
});
});
// bind qtip2 to show the event log output
$(target).on('mouseover', '.nd_jobqueueitem', function(event) {
$(this).qtip({
overwrite: false,
content: {
attr: 'data-content'
},
show: {
event: event.type,
ready: true,
delay: 100
},
position: {
my: 'top center',
at: 'bottom center',
target: false
},
style: {
classes: 'qtip-cluetip qtip-rounded nd_qtip-unconstrained'
}
});
});
});

15
share/views/js/bootstrap-tree.js vendored Normal file
View File

@@ -0,0 +1,15 @@
$(document).ready(function() {
$('.tree > ul').attr('role', 'tree').find('ul').attr('role', 'group');
$('.tree').find('li:has(ul)').addClass('parent_li').attr('role', 'treeitem').find(' > span').attr('title', 'Collapse this branch').on('click', function (e) {
var children = $(this).parent('li.parent_li').find(' > ul > li');
if (children.is(':visible')) {
children.hide('fast');
$(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign');
}
else {
children.show('fast');
$(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign');
}
e.stopPropagation();
});
});

149
share/views/js/common.js Normal file
View File

@@ -0,0 +1,149 @@
// csv download icon on any table page
// needs to be dynamically updated to use current search options
function update_csv_download_link (type, tab, show) {
var form = '#' + tab + '_form';
var query = $(form).serialize();
if (show.length) {
$('#nd_csv-download')
.attr('href', uri_base + '/ajax/content/' + type + '/' + tab + '?' + query)
.attr('download', 'netdisco-' + type + '-' + tab + '.csv')
.show();
}
else {
$('#nd_csv-download').hide();
}
}
// page title includes tab name and possibly device name
// this is nice for when you have multiple netdisco pages open in the
// browser
function update_page_title (tab) {
var pgtitle = 'Netdisco';
if ($.trim($('#nd_device-name').text()).length) {
pgtitle = $.trim($('#nd_device-name').text()) +' - '+ $('#'+ tab + '_link').text();
}
return pgtitle;
}
// update browser search history with the new query.
// support history add (push) or replace via push parameter
function update_browser_history (tab, pgtitle, push) {
var form = '#' + tab + '_form';
var query = $(form).serialize();
if (query.length) { query = '?' + query }
if (window.History && window.History.enabled) {
is_from_history_plugin = 1;
if (push.length) {
var target = uri_base + '/' + path + '/' + tab + query;
if (location.pathname == target) { return };
window.History.pushState(
{name: tab, fields: $(form).serializeArray()}, pgtitle, target
);
}
else {
var target = uri_base + '/' + path + query;
window.History.replaceState(
{name: tab, fields: $(form).serializeArray()}, pgtitle, target
);
}
is_from_history_plugin = 0;
}
}
// each sidebar search form has a hidden copy of the main navbar search
function copy_navbar_to_sidebar (tab) {
var form = '#' + tab + '_form';
// copy navbar value to currently active sidebar form
if ($('#nq').val()) {
$(form).find("input[name=q]").val( $('#nq').val() );
}
// then copy to all other inactive tab sidebars
$('form').find("input[name=q]").each( function() {
$(this).val( $(form).find("input[name=q]").val() );
});
}
$(document).ready(function() {
[% IF search %]
// search tabs
[% FOREACH tab IN settings._search_tabs %]
$('[% "#${tab.tag}_form" %]').submit(function (event) {
var pgtitle = update_page_title('[% tab.tag %]');
copy_navbar_to_sidebar('[% tab.tag %]');
update_browser_history('[% tab.tag %]', pgtitle, '');
update_csv_download_link('search', '[% tab.tag %]', '[% tab.provides_csv %]');
do_search(event, '[% tab.tag %]');
});
[% END %]
[% END %]
[% IF device %]
// device tabs
[% FOREACH tab IN settings._device_tabs %]
$('[% "#${tab.tag}_form" %]').submit(function (event) {
var pgtitle = update_page_title('[% tab.tag %]');
copy_navbar_to_sidebar('[% tab.tag %]');
update_browser_history('[% tab.tag %]', pgtitle, '');
update_csv_download_link('device', '[% tab.tag %]', '[% tab.provides_csv %]');
[% IF tab.tag == 'ports' %]
// to be fair I can't remember why we do this in JS and not from the app
// perhaps because selecting form fields to go in the cookie is easier?
var cookie = $('#ports_form').find('input,select')
.not('#nd_port-query,input[name="q"],input[name="tab"]')
.serializeArray();
$('#ports_form').find('input[type="checkbox"]').map(function() {
cookie.push({'name': 'columns', 'value': $(this).attr('name')});
});
$.cookie('nd_ports-form', $.param(cookie) ,{ expires: 365 });
// form reset icon on ports tab
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&' +
$('#ports_form')
.find('input[name="q"],input[name="f"],input[name="partial"],input[name="invert"]')
.serialize());
[% ELSIF tab.tag == 'netmap' %]
// form reset icon on netmap tab
$('#nd_sidebar-reset-link').attr('href', uri_base + '/device?tab=[% tab.tag %]&reset=on&' +
$('#netmap_form').find('input[name="q"]').serialize());
[% END %]
do_search(event, '[% tab.tag %]');
});
[% END %]
[% END %]
[% IF report %]
// for the report pages
$('[% "#${report.tag}_form" %]').submit(function (event) {
var pgtitle = update_page_title('[% report.tag %]');
update_browser_history('[% report.tag %]', pgtitle, '1');
update_csv_download_link('report', '[% report.tag %]', '1');
do_search(event, '[% report.tag %]');
});
[% END -%]
[% IF task %]
// for the admin pages
$('[% "#${task.tag}_form" %]').submit(function (event) {
update_page_title('[% task.tag %]');
update_csv_download_link('admin', '[% task.tag %]', '1');
do_search(event, '[% task.tag %]');
});
[% END %]
// on page load, load the content for the active tab
[% IF params.tab %]
[% IF params.tab == 'ipinventory' OR params.tab == 'subnets' %]
$('#[% params.tab %]_submit').click();
[% ELSE %]
$('#[% params.tab %]_form').trigger("submit");
[% END %]
[% END %]
});

135
share/views/js/device.js Normal file
View File

@@ -0,0 +1,135 @@
// used by the tabbing interface to make sure the correct
// ajax content is loaded
var path = 'device';
// fields in the Device Search Options form (Device tab)
var form_inputs = $("#ports_form .clearfix input").not('[type="checkbox"]')
.add("#ports_form .clearfix select");
// this is called by do_search to support local code
// which might need to act on the newly inserted content
// but which cannot use jQuery delegation via .on()
function inner_view_processing(tab) {
// LT wanted the page title to reflect what's on the page :)
document.title = $('#nd_device-name').text()
+' - '+ $('#'+ tab + '_link').text();
// used for contenteditable cells to find out whether the user has made
// changes, and only reset when they submit or cancel the change
var dirty = false;
// activate modals, tooltips and popovers
$('.nd_modal').modal({show: false});
$("[rel=tooltip]").tooltip({live: true});
$("[rel=popover]").popover({live: true});
}
// on load, establish global delegations for now and future
$(document).ready(function() {
var tab = '[% tab.tag %]'
var target = '#' + tab + '_pane';
var portfilter = $('#ports_form').find("input[name=f]");
// sidebar form fields should change colour and have trash/copy icon
form_inputs.each(function() {device_form_state($(this))});
form_inputs.change(function() {device_form_state($(this))});
// sidebar collapser events trigger change of up/down arrow
$('.collapse').on('show', function() {
$(this).siblings().find('.nd_arrow-up-down-right')
.toggleClass('icon-chevron-up icon-chevron-down');
});
$('.collapse').on('hide', function() {
$(this).siblings().find('.nd_arrow-up-down-right')
.toggleClass('icon-chevron-up icon-chevron-down');
});
// if the user edits the filter box, revert to automagical search
$('#ports_form').on('input', "input[name=f]", function() {
$('#nd_ports-form-prefer-field').attr('value', '');
});
// handler for trashcan icon in port filter box
$('.nd_field-clear-icon').click(function() {
portfilter.val('');
$('#nd_ports-form-prefer-field').attr('value', '');
$('#ports_form').trigger('submit');
device_form_state(portfilter); // will hide copy icons
});
// allow port filter to have a preference for port/name/vlan
$('#ports_form').on('click', '.nd_device-port-submit-prefer', function() {
event.preventDefault();
$('#nd_ports-form-prefer-field').attr('value', $(this).data('prefer'));
$(this).parents('form').submit();
});
// clickable device port names can simply resubmit AJAX rather than
// fetch the whole page again.
$('#ports_pane').on('click', '.nd_this-port-only', function(event) {
event.preventDefault(); // link is real so prevent page submit
var port = $(this).text();
port = $.trim(port);
portfilter.val(port);
$('.nd_field-clear-icon').show();
// make sure we're preferring a port filter
$('#nd_ports-form-prefer-field').attr('value', 'port');
$('#ports_form').trigger('submit');
device_form_state(portfilter); // will hide copy icons
});
// VLANs column list collapser trigger
// it's a bit of a faff because we can't easily use Bootstrap's collapser
$('#ports_pane').on('click', '.nd_collapse-vlans', function() {
$(this).siblings('.nd_collapsing').toggle();
if ($(this).find('.nd_arrow-up-down-left').hasClass('icon-chevron-up')) {
$(this).html('<div class="nd_arrow-up-down-left icon-chevron-down icon-large"></div>Hide VLANs');
}
else {
$(this).html('<div class="nd_arrow-up-down-left icon-chevron-up icon-large"></div>Show VLANs');
}
});
// activity for admin tasks in device details
$('#details_pane').on('click', '.nd_adminbutton', function(event) {
// stop form from submitting normally
event.preventDefault();
// what purpose - discover/macsuck/arpnip
var mode = $(this).attr('name');
var tr = $(this).closest('tr');
// submit the query
$.ajax({
type: 'POST'
,async: true
,dataType: 'html'
,url: uri_base + '/ajax/control/admin/' + mode
,data: tr.find('input[data-form="' + mode + '"],textarea[data-form="' + mode + '"]').serializeArray()
,success: function() {
if (mode != 'delete') {
toastr.info('Requested '+ mode +' for device '+ tr.data('for-device'));
}
else {
toastr.success('Deleted device '+ tr.data('for-device'));
}
}
// skip any error reporting for now
// TODO: fix sanity_ok in Netdisco Web
,error: function() {
toastr.error('Failed to '+ mode +' device '+ tr.data('for-device'));
}
});
});
// clear any values in the delete confirm dialog
$('#details_pane').on('hidden', '.nd_modal', function () {
$('#nd_devdel-log').val('');
$('#nd_devdel-archive').attr('checked', false);
});
});

86
share/views/js/report.js Normal file
View File

@@ -0,0 +1,86 @@
// used by the tabbing interface to make sure the correct
// ajax content is loaded
var path = 'report';
// colored input fields in the Report Options sidebar forms
var form_inputs = $(".nd_colored-input");
// this is called by do_search to support local code
// here, when tab changes need to strike/unstrike the navbar search
function inner_view_processing(tab) {
// activate modals, tooltips and popovers
$('.nd_modal').modal({show: false});
$("[rel=tooltip]").tooltip({live: true});
$("[rel=popover]").popover({live: true});
}
// on load, check initial Report Options form state,
// and on each change to the form fields
$(document).ready(function() {
var tab = '[% report.tag %]'
var target = '#' + tab + '_pane';
// sidebar form fields should change colour and have trash icon
form_inputs.each(function() {device_form_state($(this))});
form_inputs.change(function() {device_form_state($(this))});
// handler for bin icon in search forms
$('.nd_field-clear-icon').click(function() {
var name = $(this).data('btn-for');
var input = $('[name=' + name + ']');
input.val('');
device_form_state(input); // reset input field
});
$('#nd_ipinventory-subnet').on('input', function(event) {
if ($(this).val().indexOf(':') != -1) {
$('#never').attr('disabled', 'disabled');
}
else {
$('#never').removeAttr('disabled');
}
});
// activate typeahead on prefix/subnet box
$('#nd_ipinventory-subnet').autocomplete({
source: function (request, response) {
return $.get( uri_base + '/ajax/data/subnet/typeahead', request, function (data) {
return response(data);
});
}
,delay: 150
,minLength: 3
});
// dynamically bind to all forms in the table
$('.content').on('click', '.nd_adminbutton', function(event) {
// stop form from submitting normally
event.preventDefault();
// what purpose - add/update/del
var mode = $(this).attr('name');
// submit the query and put results into the tab pane
$.ajax({
type: 'POST'
,async: true
,dataType: 'html'
,url: uri_base + '/ajax/control/report/' + tab + '/' + mode
,data: $(this).closest('tr').find('input[data-form="' + mode + '"]').serializeArray()
,beforeSend: function() {
$(target).html(
'<div class="span2 alert">Request submitted...</div>'
);
}
,success: function() {
$('#' + tab + '_form').trigger('submit');
}
// skip any error reporting for now
// TODO: fix sanity_ok in Netdisco Web
,error: function() {
$('#' + tab + '_form').trigger('submit');
}
});
});
});

39
share/views/js/search.js Normal file
View File

@@ -0,0 +1,39 @@
// used by the tabbing interface to make sure the correct
// ajax content is loaded
var path = 'search';
// fields in the Device Search Options form (Device tab)
var form_inputs = $("#device_form .clearfix input").not('[type="checkbox"]')
.add("#device_form .clearfix select");
// this is called by do_search to support local code
// which might need to act on the newly inserted content
// but which cannot use jQuery delegation via .on()
function inner_view_processing(tab) {
}
// on load, establish global delegations for now and future
$(document).ready(function() {
var tab = '[% tab.tag %]'
var target = '#' + tab + '_pane';
// sidebar form fields should change colour and have bin/copy icon
form_inputs.each(function() {device_form_state($(this))});
form_inputs.change(function() {device_form_state($(this))});
// handler for copy icon in search option
$('.nd_field-copy-icon').click(function() {
var name = $(this).data('btn-for');
var input = $('#device_form [name=' + name + ']');
input.val( $('#nq').val() );
device_form_state(input); // will hide copy icons
});
// handler for bin icon in search option
$('.nd_field-clear-icon').click(function() {
var name = $(this).data('btn-for');
var input = $('#device_form [name=' + name + ']');
input.val('');
device_form_state(input); // will hide copy icons
});
});

194
share/views/layouts/main.tt Normal file
View File

@@ -0,0 +1,194 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=[% settings.charset | html_entity %]" />
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<title>Netdisco</title>
<!-- HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery-latest.min.js"></script>
<!-- <script type="text/javascript" src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script> -->
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery-ui.custom.min.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery-history.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery.cookie.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery-deserialize.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/bootstrap.min.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/underscore.min.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery.qtip.min.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/d3.min.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/toastr.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery.floatThead.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/daterangepicker.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/moment.min.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/dataTables.ip-address-detect.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/dataTables.ip-address-sort.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/he.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/natural.js"></script>
<script type="text/javascript" src="[% uri_base %]/javascripts/portsort.js"></script>
<script type="text/javascript">
var uri_base = '[% uri_base %]';
var nd_check_userlog = '[% settings.check_userlog %]';
</script>
<script type="text/javascript" src="[% uri_base %]/javascripts/netdisco.js"></script>
[% IF user_has_role('port_control') %]
<script type="text/javascript" src="[% uri_base %]/javascripts/netdisco_portcontrol.js"></script>
[% END %]
[% FOREACH add_js IN settings._additional_javascript %]
<script type="text/javascript" src="[% uri_base %]/plugin/[% add_js %]/[% add_js %].js"></script>
[% END %]
<link rel="stylesheet" href="[% uri_base %]/css/bootstrap.min.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/jquery.qtip.min.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/smoothness/jquery-ui.custom.min.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/font-awesome.min.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/toastr.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/netdisco.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/bootstrap-tree.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/daterangepicker-bs2.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/dataTables.bootstrap.css"/>
<link rel="stylesheet" href="[% uri_base %]/css/nd_print.css" media="print"/>
[% FOREACH add_css IN settings._additional_css %]
<link rel="stylesheet" href="[% uri_base %]/plugin/[% add_css %]/[% add_css %].css"/>
[% END %]
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="[% uri_for('/') %]">Netdisco</a>
[% IF session.logged_in_user %]
<ul class="nav">
[% FOREACH ni IN settings._navbar_items %]
<li[% ' class="active"' IF vars.nav == ni.tag %]>
<a href="[% uri_for(ni.path) %]">[% ni.label | html_entity %]</a>
</li>
[% END %]
[% IF settings._reports.size %]
<li class="dropdown[% ' active' IF vars.nav == 'reports' %]">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Reports <b class="caret"></b></a>
<ul class="dropdown-menu">
[% FOREACH category IN settings._report_order %]
[% IF settings._reports_menu.$category.size %]
<li class="dropdown-submenu">
<a href="#">[% category | html_entity %]</a>
<ul class="dropdown-menu">
[% FOREACH item IN settings._reports_menu.$category %]
[% NEXT IF settings._reports.$item.hidden %]
<li><a href="[% uri_for('/report/' _ item) %]">[% settings._reports.$item.label | html_entity %]</a></li>
[% END %]
</ul>
</li>
[% END %]
[% END %]
</ul>
</li> <!-- /dropdown -->
[% END %]
[% IF user_has_role('admin') %]
<li class="dropdown[% ' active' IF vars.nav == 'admin' %]">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/discoverall') %]">
<button type="submit" class="btn btn-link nd_btn-link">Discover All</button>
</form>
</li>
<li>
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/arpwalk') %]">
<button type="submit" class="btn btn-link nd_btn-link">Arpnip All</button>
</form>
</li>
<li>
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/macwalk') %]">
<button type="submit" class="btn btn-link nd_btn-link">Macsuck All</button>
</form>
</li>
<li>
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/nbtwalk') %]">
<button type="submit" class="btn btn-link nd_btn-link">NBTstat All</button>
</form>
</li>
<li>
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/expire') %]">
<button type="submit" class="btn btn-link nd_btn-link">Run Expire Job</button>
</form>
</li>
[% IF settings._admin_tasks.size %]
<li class="divider"></li>
[% FOREACH ai IN settings._admin_order %]
[% NEXT IF settings._admin_tasks.$ai.hidden %]
<li><a href="[% uri_for('/admin/' _ ai) %]">[% settings._admin_tasks.$ai.label | html_entity %]</a></li>
[% END %]
[% END %]
</ul>
</li> <!-- /dropdown -->
[% END %]
</ul>
<form class="navbar-search pull-left" method="get" action="[% uri_for('/search') %]">
<input placeholder="Find Anything" class="search-query span3"
id="nq" name="q" value="[% display_name %]" type="text" autocomplete="off"/>
<div class="btn-group nd_navbar-search-group">
<button class="btn btn-inverse nd_navbar-search-icon">
<span style="font-size: 18px;">
<i id="navsearchgo" class="icon-search"
rel="tooltip" data-placement="bottom" data-offset="5" data-title="New Search" data-container="body"></i>
</span>
</button>
<button class="btn btn-inverse dropdown-toggle nd_navbar-search-caret" data-toggle="dropdown">
<span class="caret" style="border-top-color: #999; border-bottom-color: #999"></span>
</button>
<ul class="dropdown-menu">
<li><a class="nd_navsearchgo-specific" href="" data-tab="device">Search Devices</a></li>
<li><a class="nd_navsearchgo-specific" href="" data-tab="node">Search Nodes</a></li>
<li><a class="nd_navsearchgo-specific" href="" data-tab="vlan">Search VLANs</a></li>
<li><a class="nd_navsearchgo-specific" href="" data-tab="port">Search Ports</a></li>
</ul>
</div>
</form>
<ul class="nav pull-right">
<li class="nd_navbar-text">Logged in as&nbsp;</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
[% IF user_has_role('admin') %]
<i class="icon-user text-error"></i>
[% ELSIF user_has_role('port_control') %]
<i class="icon-user text-warning"></i>
[% ELSE %]
<i class="icon-user"></i>
[% END %]&nbsp;
[% session.logged_in_user | html_entity %] <b class="caret"></b>
</a>
<ul class="dropdown-menu">
[% IF NOT user_has_role('ldap') %]
<li><a href="[% uri_for('/password') %]">Change Password</a></li>
[% END %]
[% IF NOT settings.no_auth %]
<li><a href="[% uri_for('/logout') %]">Log Out</a></li>
[% END %]
</ul>
</li> <!-- /dropdown -->
</ul>
[% END %]
</div>
</div>
</div>
[% content %]
<script type="text/javascript">
[%+ INCLUDE 'js/common.js' -%]
</script>
</body>
</html>

29
share/views/password.tt Normal file
View File

@@ -0,0 +1,29 @@
<div class="container">
<div class="row nd_hero-row">
<div class="span8 offset2">
[% IF vars.passchange_ok %]
<div class="alert alert-success fade in">
<a class="close" data-dismiss="alert">×</a>
Password successfully updated.
</div>
[% END %]
[% IF vars.passchange_failed %]
<div class="alert alert-error fade in">
<a class="close" data-dismiss="alert">×</a>
Incorrect current password, or new passwords did not match. Please try again.
</div>
[% END %]
<div class="hero-unit">
<h2>Change Password</h2>
<form class="nd_login-form" method="post" action="[% uri_for('/password') %]">
<div class="form-horizontal">
<input placeholder="Current Password" class="span2" name="old" type="password" required="required"/><br/>
<input placeholder="New Password" class="span2" name="new" type="password" required="required"/>
<input placeholder="Confirm New Password" class="span2" name="confirm" type="password" required="required"/>
<button type="submit" class="btn btn-info">Save</button>
</div>
</form>
</div>
</div>
</div>
</div> <!-- /container -->

5
share/views/plugin.tt Normal file
View File

@@ -0,0 +1,5 @@
[% TRY %]
[% INCLUDE $target %]
[% CATCH %]
<!-- dummy content required by Template Toolkit TRY -->
[% END %]

53
share/views/report.tt Normal file
View File

@@ -0,0 +1,53 @@
<i class="nd_sidebar-toggle icon-wrench icon-large" id="nd_sidebar-toggle-img-out"
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
<div class="container-fluid">
<div class="nd_sidebar nd_sidebar-pinned">
<div class="well">
<i class="nd_sidebar-toggle icon-signout" id="nd_sidebar-toggle-img-in"
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar" data-container="body"></i>
<i class="nd_sidebar-pin icon-pushpin nd_sidebar-pin-clicked"
rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar" data-container="body"></i>
<div class="tab-content">
<div id="[% report.tag %]_search" class="tab-pane active">
<form id="[% report.tag %]_form" class="nd_sidebar-form form-stacked"
method="get" action="[% uri_for('/report') %]">
[% TRY %]
<script type="text/javascript">has_sidebar["[% report.tag %]"] = 1;</script>
[% 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 -->
</div> <!-- /tab-content -->
</div>
</div>
<div class="content">
<ul id="nd_search-results" class="nav nav-tabs">
<li class="active"><a id="[% report.tag %]_link" class="nd_single-tab"
href="#[% report.tag %]_pane">[% report.label %]</a></li>
[% IF report.tag == 'portlog' %]
<span id="nd_device-name">
<a href="[% device_ports %]&q=[% params.q | uri %]">[% params.q %]</a>
-
<a href="[% device_ports %]&q=[% params.q | uri %]&f=[% params.f | uri %]">[% params.f %]</a>
</span>
[% ELSIF report.provides_csv %]
<span id="nd_device-name">
<a id="nd_csv-download" href="#" download="netdisco.csv">
<i id="nd_csv-download-icon" class="text-info icon-file-text-alt icon-large"
rel="tooltip" data-placement="left" data-offset="5" data-title="Download as CSV"></i></a>
</span>
[% END %]
</ul>
<div class="tab-content">
<div class="tab-pane active" id="[% report.tag %]_pane"></div>
</div>
</div>
<script type="text/javascript">
[%+ INCLUDE 'js/report.js' -%]
</script>

50
share/views/search.tt Normal file
View File

@@ -0,0 +1,50 @@
<i class="nd_sidebar-toggle icon-wrench icon-large" id="nd_sidebar-toggle-img-out"
rel="tooltip" data-placement="left" data-offset="5" data-title="Show Sidebar"></i>
<div class="container-fluid">
<div class="nd_sidebar">
<div class="well">
<i class="nd_sidebar-toggle icon-signout" id="nd_sidebar-toggle-img-in"
rel="tooltip" data-placement="left" data-offset="5" data-title="Hide Sidebar" data-container="body"></i>
<i class="nd_sidebar-pin icon-pushpin"
rel="tooltip" data-placement="left" data-offset="5" data-title="Pin Sidebar" data-container="body"></i>
<div class="tab-content">
[% FOREACH tab IN settings._search_tabs %]
<div id="[% tab.tag %]_search" class="tab-pane [% 'active' IF params.tab == tab.tag %]">
<form id="[% tab.tag %]_form" class="nd_sidebar-form form-stacked" method="get" action="[% uri_for('/search') %]">
<input name="tab" value="[% tab.tag %]" type="hidden"/>
[% TRY %]
<script type="text/javascript">has_sidebar["[% tab.tag %]"] = 1;</script>
[% INCLUDE "sidebar/search/${tab.tag}.tt" %]
[% CATCH %]
<!-- no "[% tab.tag %]" search options -->
<input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<script type="text/javascript">has_sidebar["[% tab.tag %]"] = 0;</script>
[% END %]
</form>
</div> <!-- /tab-pane -->
[% END %]
</div> <!-- /tab-content -->
</div>
</div>
<div class="content">
<ul id="nd_search-results" class="nav nav-tabs">
[% FOREACH tab IN settings._search_tabs %]
<li[% ' class="active"' IF params.tab == tab.tag %]><a id="[% tab.tag %]_link" href="#[% tab.tag %]_pane">[% tab.label %]</a></li>
[% END %]
<span id="nd_device-name">
<a id="nd_csv-download" href="#" download="netdisco.csv">
<i id="nd_csv-download-icon" class="text-info icon-file-text-alt icon-large"
rel="tooltip" data-placement="left" data-offset="5" data-title="Download as CSV"></i></a>
</span>
</ul>
<div class="tab-content">
[% FOREACH tab IN settings._search_tabs %]
<div class="tab-pane[% ' active' IF params.tab == tab.tag %]" id="[% tab.tag %]_pane"></div>
[% END %]
</div>
</div>
<script type="text/javascript">
[%+ INCLUDE 'js/search.js' -%]
</script>

View File

@@ -0,0 +1,24 @@
<span class="nd_sidebar-title"><em>Neighbor Map Controls</em></span>
<input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<div class="clearfix nd_netmap-sidebar">
<ul class="muted nd_netmap-sidebar-help">
<li>Click and drag to pan</li>
<li>Scroll to zoom</li>
<li>Hover shows neighbors</li>
<li>Click to center device</li>
</ul>
<em class="muted nd_sidebar-label">Draw to Depth:</em><br/>
<input id="nd_port-query" placeholder="" type="number"
name="depth" value="[% params.depth || 8 | html_entity %]" type="text"
rel="tooltip" data-placement="left" data-offset="5" data-title="Max Depth"/>
<em class="muted nd_sidebar-label">Filter by VLAN:</em><br/>
<input id="nd_port-query" placeholder="" type="number"
name="vlan" value="[% params.vlan | html_entity %]" type="text"
rel="tooltip" data-placement="left" data-offset="5" data-title="VLAN"/>
</div>
<button id="[% tab.tag %]_submit" type="submit" class="btn btn-info">
<i class="icon-pencil icon-large pull-left nd_navbar-icon"></i> Redraw Map</button>

View File

@@ -0,0 +1,158 @@
<input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<input id="nd_ports-form-prefer-field" name="prefer" value="[% params.prefer | html_entity %]" type="hidden"/>
<div class="clearfix">
<i class="nd_field-clear-icon icon-trash icon-large"
rel="tooltip" data-placement="bottom" data-offset="3" data-title="Show all Ports"
id="f_clear_btn" data-btn-for="port"></i>
<input id="nd_port-query" placeholder="Port, Name or VLAN"
name="f" value="[% params.f | html_entity %]" type="text"
rel="tooltip" data-placement="left" data-offset="5" data-title="Filter by Port, Name or VLAN"/>
<div class="clearfix input-prepend nd_port-partial">
<label class="add-on nd_port-partial-label">
<input type="checkbox" id="partial"
name="partial"[% ' checked="checked"' IF params.partial %]/>
</label>
<label class="nd_checkboxlabel" for="partial">
<span class="nd_port-partial-checkbox uneditable-input">Partial Match</span>
</label>
<label class="add-on nd_port-invert-label">
<input type="checkbox" id="invert"
name="invert"[% ' checked="checked"' IF params.invert %]/>
</label>
<label class="nd_checkboxlabel" for="invert">
<span class="nd_port-invert-checkbox uneditable-input">Not</span>
</label>
</div>
</div>
<div class="clearfix">
<span data-toggle="collapse" data-target="#nd_legend">
<label class="nd_collapser">Legend
<i class="nd_arrow-up-down-right icon-chevron-up icon-large"></i>
</label></span>
<div id="nd_legend" class="collapse">
<ul class="icons-ul"><!-- nd_inputs-list unstyled"> -->
<li><i class="icon-li icon-angle-up text-success"></i>&nbsp; Link Up</li>
<li><i class="icon-li icon-arrow-down text-error"></i>&nbsp; Link Down</li>
<li><i class="icon-li icon-arrow-down text-success"></i>&nbsp; Port Free</li>
<li><i class="icon-li icon-remove"></i>&nbsp; Admin Disabled</li>
<li><i class="icon-li icon-fullscreen text-info"></i>&nbsp; Blocking</li>
<li><i class="icon-li icon-link text-warning"></i>&nbsp; Manual Topology</li>
<li><i class="icon-li icon-link"></i>&nbsp; Neighbor Device</li>
<li><i class="icon-li icon-unlink text-error"></i>&nbsp; Neighbor Inacessible</li>
<li><i class="icon-li icon-phone"></i>&nbsp; IP Phone</li>
<li><i class="icon-li icon-signal"></i>&nbsp; Wireless Client</li>
<li><i class="icon-li icon-book"></i>&nbsp; Archived Data</li>
<li><i class="icon-li icon-group"></i>&nbsp; Link Aggregate</li>
[% IF user_has_role('port_control') %]
<li><i class="icon-li icon-refresh icon-spin"></i>&nbsp; Click "Update View"</li>
[% END %]
</ul>
</div>
</div>
<div class="clearfix">
<span data-toggle="collapse" data-target="#nd_columns">
<label class="nd_collapser">Display Columns
<i class="nd_arrow-up-down-right icon-chevron-down icon-large"></i>
</label></span>
<div id="nd_columns" class="collapse in">
<ul class="nd_inputs-list unstyled">
[% FOREACH item IN vars.port_columns %]
[% NEXT IF item.name == 'c_admin' AND NOT user_has_role('port_control') %]
<li>
<label class="checkbox">
<input type="checkbox" id="[% item.name | html_entity %]"
name="[% item.name | html_entity %]"[% ' checked="checked"' IF params.${item.name} %] />
[% IF item.name == 'c_admin' %]
<span class="label label-info">[% item.label | html_entity %]</span>
[% ELSE %]
[% item.label | html_entity %]
[% END %]
</label>
</li>
[% END %]
</ul>
</div>
</div>
<div class="clearfix">
<span data-toggle="collapse" data-target="#nd_portprops">
<label class="nd_collapser">Port Properties
<i class="nd_arrow-up-down-right icon-chevron-up icon-large"></i>
</label></span>
<div id="nd_portprops" class="collapse">
<ul class="nd_inputs-list unstyled">
<li>
<em class="muted">Mark as Free if Down for:</em><br/>
<select id="nd_days-select" name="age_num">
[% FOREACH count IN [1..32] %]
<option[% ' selected="selected"' IF params.age_num == count %]>[% count %]</option>
[% END %]
</select>
<select id="nd_age-select" name="age_unit">
[% FOREACH unit IN [ 'days', 'weeks', 'months', 'years' ] %]
<option[% ' selected="selected"' IF params.age_unit == unit %]>[% unit %]</option>
[% END %]
</select>
</li>
<li>
<em class="muted">Show Ports with Status:</em><br/>
<div class="clearfix">
<select id="nd_port-state-select" size="4" multiple="on" name="port_state"/>
<option selected="selected" value="up">Link Up</option>
<option selected="selected" value="free">Port Free</option>
<option selected="selected" value="down">Link Down</option>
<option selected="selected" value="shut">Admin Disabled</option>
</select>
</div>
</li>
<li>
<label class="checkbox">
<input type="checkbox" id="neigh_id"
name="neigh_id"[% ' checked="checked"' IF params.neigh_id %] />
Connected Device ID
</label>
</li>
</ul>
</div>
</div>
<div class="clearfix">
<span data-toggle="collapse" data-target="#nd_nodeprops">
<label class="nd_collapser">Node Properties
<i class="nd_arrow-up-down-right icon-chevron-up icon-large"></i>
</label></span>
<div id="nd_nodeprops" class="collapse">
<ul class="nd_inputs-list unstyled">
<li>
<em class="muted">MAC address format:</em><br/>
<select id="nd_mac-format" name="mac_format">
[% FOREACH format IN [ 'IEEE', 'Cisco', 'Microsoft', 'Sun' ] %]
<option[% ' selected="selected"' IF params.mac_format == format %]>[% format %]</option>
[% END %]
</select>
</li>
[% FOREACH item IN vars.connected_properties %]
<li>
<label class="checkbox">
<input type="checkbox" id="[% item.name | html_entity %]"
name="[% item.name | html_entity %]"[% ' checked="checked"' IF params.${item.name} %] />
[% item.label | html_entity %]
</label>
</li>
[% END %]
</ul>
</div>
</div>
<div class="btn-group">
<button id="[% tab.tag %]_submit" type="submit" class="btn btn-info nd_sidebar-btn-drop">
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Update View</button>
<button class="btn btn-info dropdown-toggle nd_sidebar-btn-drop-drop" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a class="nd_device-port-submit-prefer" href="" data-prefer="">Default Search</a></li>
<li><a class="nd_device-port-submit-prefer" href="" data-prefer="port">Filter by Port</a></li>
<li><a class="nd_device-port-submit-prefer" href="" data-prefer="name">Filter by Name</a></li>
<li><a class="nd_device-port-submit-prefer" href="" data-prefer="vlan">Filter by VLAN</a></li>
</ul>
</div>

View File

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

View File

@@ -0,0 +1,60 @@
<div class="clearfix">
<input id="nd_ipinventory-subnet" class="nd_sidebar-topinput nd_colored-input"
placeholder="CIDR Prefix/Subnet" required="required"
name="subnet" value="[% params.subnet | html_entity %]" type="text" autocomplete="off"
rel="tooltip" data-placement="left" data-offset="5" data-title="Prefix/Subnet in CIDR Format"/>
</div>
<fieldset>
<legend class="nd_sidebar-legend">
<label><em><strong>Date Range</strong></em></label>
</legend>
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="age_invert"
name="age_invert"[% ' checked="checked"' IF params.age_invert %]/>
</label>
<label class="nd_checkboxlabel" for="age_invert">
<span class="nd_searchcheckbox uneditable-input">Not within...</span>
</label>
</div>
<div class="clearfix">
<input class="nd_side-input" id="daterange" required="required"
type="text" name="daterange" value="[%
(params.exists('daterange') ? params.daterange : to_daterange('30 days')) | html_entity %]"/>
</div>
</fieldset>
<fieldset>
<legend class="nd_sidebar-legend">
<label><em><strong>Options</strong></em></label>
</legend>
<div class="clearfix">
<ul class="unstyled">
<li>
<em class="muted">Oldest records limit:</em><br/>
<select id="nd_mac-format" class="nd_side-select" name="limit">
[% FOREACH size IN [ '32', '64', '128', '256', '512', '1024', '2048', '4096', '8192' ] %]
<option[% ' selected="selected"' IF (params.limit == size OR (NOT params.limit AND size == 2048)) %]>
[% size %]</option>
[% END %]
</select>
</li>
</ul>
<div class="clearfix input-prepend"
rel="tooltip" data-placement="left" data-offset="5" data-title="Applies to IPv4 Only">
<label class="add-on">
<input type="checkbox" id="never"
name="never"[% ' checked="checked"' IF params.never %]/>
</label>
<label class="nd_checkboxlabel" for="never">
<span class="nd_searchcheckbox uneditable-input">List IP's Never Seen</span>
</label>
</div>
</div>
</fieldset>
<button id="[% report.tag %]_submit" type="submit" class="btn btn-info">
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Search IPs</button>

View File

@@ -0,0 +1,78 @@
<p class="nd_sidebar-title"><em>Module Search</em></p>
<div class="clearfix">
<i id="device_clear_btn" data-btn-for="device"
class="nd_field-clear-icon icon-trash icon-large"></i>
<input class="nd_side-input nd_colored-input" placeholder="Device"
type="text" name="device" value="[% params.dns | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Device IP, DNS, Description, Name, Location, Serial, or Contact"/>
</div>
<div class="clearfix">
<i id="description_clear_btn" data-btn-for="description"
class="nd_field-clear-icon icon-trash icon-large"></i>
<input class="nd_side-input nd_colored-input" placeholder="Module Description"
type="text" name="description" value="[% params.description | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Module Description"/>
</div>
<div class="clearfix">
<i id="name_clear_btn" data-btn-for="name"
class="nd_field-clear-icon icon-trash icon-large"></i>
<input class="nd_side-input nd_colored-input" placeholder="Module Name"
type="text" name="name" value="[% params.name | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Module Name"/>
</div>
<div class="clearfix">
<i id="type_clear_btn" data-btn-for="type"
class="nd_field-clear-icon icon-trash icon-large"></i>
<input class="nd_side-input nd_colored-input" placeholder="Module Type"
type="text" name="type" value="[% params.type | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Module Type"/>
</div>
<div class="clearfix">
<i id="model_clear_btn" data-btn-for="model"
class="nd_field-clear-icon icon-trash icon-large"></i>
<input class="nd_side-input nd_colored-input" placeholder="Module Model"
type="text" name="model" value="[% params.model | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Module Model"/>
</div>
<div class="clearfix">
<i id="serial_clear_btn" data-btn-for="serial"
class="nd_field-clear-icon icon-trash icon-large"></i>
<input class="nd_side-input nd_colored-input" placeholder="Module Serial"
type="text" name="serial" value="[% params.serial | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Module Serial"/>
</div>
<div class="clearfix">
<select class="nd_side-select nd_colored-input" size="[% class_list.size > 5 ? 5 : class_list.size %]"
multiple="on" name="class"
rel="tooltip" data-placement="left" data-offset="5" data-title="Module Class"/>
[% FOREACH opt IN class_list %]
<option[% ' selected="selected"' IF class_lkp.exists(opt) %]>[% opt | html_entity %]</option>
[% END %]
</select>
</div>
<fieldset>
<legend class="nd_sidebar-legend">
<label><em><strong>Options</strong></em></label>
</legend>
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="fruonly"
name="fruonly"[% ' checked="checked"' IF params.fruonly %]/>
</label>
<label class="nd_checkboxlabel" for="fruonly">
<span class="nd_searchcheckbox uneditable-input">FRU Only</span>
</label>
</div>
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="matchall"
name="matchall"[% ' checked="checked"' IF params.matchall %]/>
</label>
<label class="nd_checkboxlabel" for="matchall">
<span class="nd_searchcheckbox uneditable-input">Match All Options</span>
</label>
</div>
</fieldset>
<button id="[% tab.tag %]_submit" type="submit" class="btn btn-info">
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Search Modules</button>

View File

@@ -0,0 +1,19 @@
<p class="nd_sidebar-title"><em>NetBIOS Domain</em></p>
<div class="clearfix">
<select class="nd_side-select nd_colored-input" size="[% domain_list.size > 8 ? 8 : domain_list.size %]"
multiple="on" name="domain"
rel="tooltip" data-placement="left" data-offset="5" data-title="Domain"/>
[% FOREACH opt IN domain_list %]
[% UNLESS opt == '' %]
<option[% ' selected="selected"' IF domain_lkp.exists(opt) %]>[% opt | html_entity %]</option>
[% ELSE %]
<option value="blank"[% ' selected="selected"' IF domain_lkp.exists('blank') %]>[% '(Blank Domain)' | html_entity %]</option>
[% END %]
[% END %]
</select>
</div>
<button id="[% report.tag %]_submit" type="submit" class="btn btn-info">
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Search NetBIOS</button>

View File

@@ -0,0 +1,52 @@
<p class="nd_sidebar-title"><em>Node Search Options</em></p>
<input name="q" value="[% params.q | html_entity %]" type="hidden"/>
<div class="clearfix">
<input class="nd_side-input" placeholder="Remote ID (host name)"
type="text" name="remote_id" value="[% params.name | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Remote ID"/>
</div>
<div class="clearfix">
<input class="nd_side-input" placeholder="Remote Type (platform)"
type="text" name="remote_type" value="[% params.name | html_entity %]"
rel="tooltip" data-placement="left" data-offset="5" data-title="Remote Type"/>
</div>
<div class="clearfix">
<select class="nd_side-select nd_colored-input" size="[% type_list.size > 8 ? 8 : type_list.size %]"
multiple="on" name="remote_type"
rel="tooltip" data-placement="left" data-offset="5" data-title="Remote Type"/>
[% FOREACH opt IN type_list %]
<option[% ' selected="selected"' IF type_lkp.exists(opt) %]>[% opt | html_entity %]</option>
[% END %]
</select>
</div>
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="phones"
name="phones"[% ' checked="checked"' IF params.phones %]/>
</label>
<label class="nd_checkboxlabel" for="phones">
<span class="nd_searchcheckbox uneditable-input"><i class="icon-li icon-phone"></i>&nbsp; IP Phones</span>
</label>
</div>
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="aps"
name="aps"[% ' checked="checked"' IF params.aps %]/>
</label>
<label class="nd_checkboxlabel" for="aps">
<span class="nd_searchcheckbox uneditable-input"><i class="icon-li icon-signal"></i>&nbsp Wireless APs</span>
</label>
</div>
<div class="clearfix"><p></p></div>
<div class="clearfix input-prepend">
<label class="add-on">
<input type="checkbox" id="matchall"
name="matchall"[% ' checked="checked"' IF params.matchall %]/>
</label>
<label class="nd_checkboxlabel" for="matchall">
<span class="nd_searchcheckbox uneditable-input">Match All Options</span>
</label>
</div>
<button id="[% tab.tag %]_submit" type="submit" class="btn btn-info">
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Search Nodes</button>

Some files were not shown because too many files have changed in this diff Show More