Merge branch 'master' of ssh://git.code.sf.net/p/netdisco/netdisco-ng
This commit is contained in:
@@ -32,7 +32,7 @@ requires 'Plack' => 1.0023;
|
||||
requires 'Plack::Middleware::Expires' => 0.03;
|
||||
requires 'Role::Tiny' => 1.002005;
|
||||
requires 'Socket6' => 0.23;
|
||||
requires 'Starman' => 0.3008;
|
||||
requires 'Starman' => 0.4008;
|
||||
requires 'SNMP::Info' => 3.05;
|
||||
requires 'SQL::Translator' => 0.11016;
|
||||
requires 'Template' => 2.24;
|
||||
|
||||
@@ -36,10 +36,15 @@ ajax '/ajax/content/device/ports' => require_login sub {
|
||||
$f =~ s/\*/%/g;
|
||||
$f =~ s/\?/_/g;
|
||||
# set wilcards at param boundaries
|
||||
if ($f !~ m/[%_]/) {
|
||||
$f =~ s/^\%*/%/;
|
||||
$f =~ s/\%*$/%/;
|
||||
}
|
||||
# enable ILIKE op
|
||||
$f = { '-ilike' => $f };
|
||||
$f = { (param('invert') ? '-not_ilike' : '-ilike') => $f };
|
||||
}
|
||||
elsif (param('invert')) {
|
||||
$f = { '!=' => $f };
|
||||
}
|
||||
|
||||
if ($set->search({'me.port' => $f})->count) {
|
||||
|
||||
@@ -9,6 +9,7 @@ body {
|
||||
/* magnifying glass icon for search box */
|
||||
.nd_navbar-icon {
|
||||
vertical-align: sub;
|
||||
margin-top: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -205,7 +206,7 @@ td > form.nd_inline-form {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#nd_csv-download:hover {
|
||||
#nd_csv-download:hover, #nd_sidebar-reset-link:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -398,15 +399,15 @@ td > form.nd_inline-form {
|
||||
|
||||
/* fixup for prepended checkbox in sidebar */
|
||||
.nd_searchcheckbox {
|
||||
width: 123px;
|
||||
width: 121px;
|
||||
padding-left: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* fixup for prepended partial port name checkbox in sidebar */
|
||||
.nd_port-partial-checkbox {
|
||||
width: 136px;
|
||||
padding: 0px 0px 0px 11px !important;
|
||||
width: 84px;
|
||||
padding: 0px 0px 0px 5px !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@@ -420,6 +421,27 @@ td > form.nd_inline-form {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
|
||||
/* fixup for prepended invert port name checkbox in sidebar */
|
||||
.nd_port-invert-checkbox {
|
||||
width: 30px;
|
||||
padding: 0px 0px 0px 5px !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.nd_port-invert-label {
|
||||
padding: 0px !important;
|
||||
/* for some reason only .add-on:first-child gets these */
|
||||
-webkit-border-radius: 4px 0 0 4px !important;
|
||||
-moz-border-radius: 4px 0 0 4px !important;
|
||||
border-radius: 4px 0 0 4px !important;
|
||||
}
|
||||
|
||||
.nd_port-invert {
|
||||
margin-left: 5px !important;
|
||||
margin-top: -5px;
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
|
||||
/* fixup for prepended checkbox in sidebar */
|
||||
.nd_sidebar .input-prepend {
|
||||
margin-left: -2px;
|
||||
@@ -434,7 +456,7 @@ td > form.nd_inline-form {
|
||||
/* placement of form field in sidebar */
|
||||
.nd_side-input {
|
||||
margin-left: -3px;
|
||||
width: 152px;
|
||||
width: 151px;
|
||||
}
|
||||
|
||||
/* placement of form field in sidebar */
|
||||
|
||||
@@ -39,7 +39,7 @@ function do_search (event, tab) {
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (response === "") {
|
||||
if (response == "") {
|
||||
$(target).html(
|
||||
'<div class="span2 alert alert-info">No matching records.</div>'
|
||||
);
|
||||
@@ -111,32 +111,41 @@ if (window.History && window.History.enabled) {
|
||||
|
||||
// if any field in Search Options has content, highlight in green
|
||||
function device_form_state(e) {
|
||||
if (e.prop('value') != "") {
|
||||
e.parent(".clearfix").addClass('success');
|
||||
var with_val = $.grep(form_inputs,
|
||||
function(n,i) {return($(n).prop('value') != "")}).length;
|
||||
var with_text = $.grep(form_inputs.not('select'),
|
||||
function(n,i) {return($(n).val() != "")}).length;
|
||||
|
||||
if (e.parents('#device_form').length) {
|
||||
$('#nq').css('text-decoration', 'line-through');
|
||||
|
||||
if (e.attr('type') == 'text') {
|
||||
$('.nd_field-copy-icon').hide();
|
||||
}
|
||||
}
|
||||
|
||||
var id = '#' + e.attr('name') + '_clear_btn';
|
||||
$(id).show();
|
||||
}
|
||||
else {
|
||||
if (e.prop('value') == "") {
|
||||
e.parent(".clearfix").removeClass('success');
|
||||
var id = '#' + e.attr('name') + '_clear_btn';
|
||||
$(id).hide();
|
||||
|
||||
var num_empty = $.grep(form_inputs,
|
||||
function(n,i) {return($(n).val() != "")}).length;
|
||||
if (num_empty === 3) {
|
||||
// if form has no field val, clear strikethough
|
||||
if (with_val == 0) {
|
||||
$('#nq').css('text-decoration', 'none');
|
||||
}
|
||||
|
||||
// for text inputs only, extra formatting
|
||||
if (with_text == 0) {
|
||||
$('.nd_field-copy-icon').show();
|
||||
}
|
||||
}
|
||||
else {
|
||||
e.parent(".clearfix").addClass('success');
|
||||
var id = '#' + e.attr('name') + '_clear_btn';
|
||||
$(id).show();
|
||||
|
||||
// if form still has any field val, set strikethough
|
||||
if (e.parents('form[action="/search"]').length > 0 && with_val != 0) {
|
||||
$('#nq').css('text-decoration', 'line-through');
|
||||
}
|
||||
|
||||
// if we're text, hide copy icon when we get a val
|
||||
if (e.attr('type') == 'text') {
|
||||
$('.nd_field-copy-icon').hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
[% 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-refresh" href="#"><i class="text-success icon-refresh icon-spin"></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>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
href="[% device_ports %]&q=[% params.q | uri %]&f=[% row.port | uri %]">[% row.port | html_entity %]</a></td>
|
||||
<td>[% row.device_port.name | html_entity %]</td>
|
||||
<td><a class="nd_linkcell"
|
||||
href="[% search_device %]&ip=[% row.subnet | uri %]">[% row.subnet | html_entity %]</a></td>
|
||||
href="[% search_device %]&q=[% row.subnet | uri %]&ip=[% row.subnet | uri %]">[% row.subnet | html_entity %]</a></td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
[% ELSE %]
|
||||
<td>
|
||||
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
|
||||
href="[% search_device %]&location=[% d.location | uri %]">[% d.location | html_entity %]</a>
|
||||
href="[% search_device %]&q=[% d.location | uri %]&location=[% d.location | uri %]">[% d.location | html_entity %]</a>
|
||||
</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
@@ -42,10 +42,10 @@
|
||||
<td>Vendor / Model</td>
|
||||
<td>
|
||||
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
|
||||
href="[% search_device %]&vendor=[% d.vendor | uri %]">[% d.vendor | html_entity %]</a>
|
||||
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 %]&model=[% d.model | uri %]">[% d.model | html_entity %]</a>
|
||||
href="[% search_device %]&q=[% d.model | uri %]&model=[% d.model | uri %]">[% d.model | html_entity %]</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -53,7 +53,7 @@
|
||||
<td>[% d.os | html_entity %] /
|
||||
<a rel="tooltip" data-placement="top" data-offset="5"
|
||||
data-title="Find Similar Devices"
|
||||
href="[% search_device %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver | html_entity %]</a>
|
||||
href="[% search_device %]&q=[% d.os_ver | uri %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver | html_entity %]</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<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' %]
|
||||
[% 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>
|
||||
@@ -210,6 +210,7 @@
|
||||
<td>
|
||||
[% IF params.c_neighbors AND (row.remote_ip OR row.is_uplink) %]
|
||||
[% IF row.neighbor %]
|
||||
<i class="icon-link"></i>
|
||||
<a href="[% uri_for('/device',
|
||||
self_options) %]&q=[% row.neighbor.dns || row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
|
||||
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip | html_entity %]
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
<tr>
|
||||
<th>
|
||||
<a class="nd_linkcell"
|
||||
href="[% search_device %]&vendor=[% platform.vendor | uri %]">
|
||||
href="[% search_device %]&q=[% platform.vendor | uri %]&vendor=[% platform.vendor | uri %]">
|
||||
[% platform.vendor | html_entity %]</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="nd_linkcell"
|
||||
href="[% search_device %]&model=[% platform.model | uri %]">
|
||||
href="[% search_device %]&q=[% platform.model | uri %]&model=[% platform.model | uri %]">
|
||||
[% platform.model | html_entity %]</a>
|
||||
</th>
|
||||
<th>[% platform.get_column('count') | html_entity %]</th>
|
||||
@@ -48,7 +48,7 @@
|
||||
<th>[% release.os | html_entity %]</th>
|
||||
<th>
|
||||
<a class="nd_linkcell"
|
||||
href="[% search_device %]&os_ver=[% release.os_ver | uri %]">
|
||||
href="[% search_device %]&q=[% release.os_ver | uri %]&os_ver=[% release.os_ver | uri %]">
|
||||
[% release.os_ver | html_entity %]</a>
|
||||
</th>
|
||||
<th>[% release.get_column('count') | html_entity %]</th>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
// browser
|
||||
function update_page_title (tab) {
|
||||
var pgtitle = 'Netdisco';
|
||||
if ($('#nd_device-name').text().length) {
|
||||
var pgtitle = $('#nd_device-name').text() +' - '+ $('#'+ tab + '_link').text();
|
||||
if ($.trim($('#nd_device-name').text()).length) {
|
||||
pgtitle = $.trim($('#nd_device-name').text()) +' - '+ $('#'+ tab + '_link').text();
|
||||
}
|
||||
return pgtitle;
|
||||
}
|
||||
@@ -44,14 +44,14 @@
|
||||
}
|
||||
|
||||
// each sidebar search form has a hidden copy of the main navbar search
|
||||
// query. when the tab query takes place, copy the navbar locally, then
|
||||
// replicate to all other tabs.
|
||||
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() );
|
||||
});
|
||||
@@ -63,9 +63,9 @@
|
||||
[% FOREACH tab IN settings._search_tabs %]
|
||||
$('[% "#${tab.tag}_form" %]').submit(function (event) {
|
||||
var pgtitle = update_page_title('[% tab.tag %]');
|
||||
update_csv_download_link('search', '[% tab.tag %]', '[% tab.provides_csv %]');
|
||||
update_browser_history('[% tab.tag %]', pgtitle);
|
||||
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 %]
|
||||
@@ -76,9 +76,9 @@
|
||||
[% FOREACH tab IN settings._device_tabs %]
|
||||
$('[% "#${tab.tag}_form" %]').submit(function (event) {
|
||||
var pgtitle = update_page_title('[% tab.tag %]');
|
||||
update_csv_download_link('device', '[% tab.tag %]', '[% tab.provides_csv %]');
|
||||
update_browser_history('[% tab.tag %]', pgtitle);
|
||||
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
|
||||
@@ -93,7 +93,9 @@
|
||||
|
||||
// form reset icon on ports tab
|
||||
$('#nd_sidebar-reset-link').attr('href', '/device?tab=ports&reset=on&' +
|
||||
$('#ports_form').find('input[name="q"],input[name="f"],input[name="partial"]').serialize())
|
||||
$('#ports_form')
|
||||
.find('input[name="q"],input[name="f"],input[name="partial"],input[name="invert"]')
|
||||
.serialize())
|
||||
[% END %]
|
||||
|
||||
do_search(event, '[% tab.tag %]');
|
||||
|
||||
@@ -88,7 +88,8 @@
|
||||
<input placeholder="Find Anything" class="search-query span3"
|
||||
id="nq" name="q" type="text" autocomplete="off"/>
|
||||
<span style="font-size: 24px;">
|
||||
<i id="navsearchgo" class="icon-search nd_navbar-icon"></i>
|
||||
<i id="navsearchgo" class="icon-search nd_navbar-icon"
|
||||
rel="tooltip" data-placement="bottom" data-offset="5" data-title="New Search" data-container="body"></i>
|
||||
</span>
|
||||
</form>
|
||||
[% IF user_has_role('admin') %]
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
<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">
|
||||
@@ -29,12 +36,13 @@
|
||||
<li><i class="icon-li icon-arrow-down text-success"></i> Port Free</li>
|
||||
<li><i class="icon-li icon-remove"></i> Admin Disabled</li>
|
||||
<li><i class="icon-li icon-fullscreen text-info"></i> Blocking</li>
|
||||
<li><i class="icon-li icon-link"></i> Neighbor Device</li>
|
||||
<li><i class="icon-li icon-unlink text-error"></i> Neighbor Inacessible</li>
|
||||
<li><i class="icon-li icon-phone"></i> IP Phone</li>
|
||||
<li><i class="icon-li icon-signal"></i> Wireless Client</li>
|
||||
<li><i class="icon-li icon-book"></i> Archived Data</li>
|
||||
[% IF user_has_role('port_control') %]
|
||||
<li><i class="icon-li icon-refresh"></i> Click "Update View"</li>
|
||||
<li><i class="icon-li icon-refresh icon-spin"></i> Click "Update View"</li>
|
||||
[% END %]
|
||||
</ul>
|
||||
</div>
|
||||
@@ -124,4 +132,5 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">Update View</button>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">
|
||||
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Update View</button>
|
||||
|
||||
@@ -77,4 +77,5 @@
|
||||
<span class="nd_searchcheckbox uneditable-input">Match All Options</span>
|
||||
</label>
|
||||
</div>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">Search Again</button>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">
|
||||
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Search Devices</button>
|
||||
|
||||
@@ -46,4 +46,5 @@
|
||||
[% END %]
|
||||
</select>
|
||||
</div>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">Search Again</button>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">
|
||||
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Search Nodes</button>
|
||||
|
||||
@@ -10,4 +10,5 @@
|
||||
<span class="nd_searchcheckbox uneditable-input">Partial Name</span>
|
||||
</label>
|
||||
</div>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">Search Again</button>
|
||||
<button id="[% tab.id %]_submit" type="submit" class="btn btn-info">
|
||||
<i class="icon-search icon-large pull-left nd_navbar-icon"></i> Search Ports</button>
|
||||
|
||||
Reference in New Issue
Block a user