Fix partial name match on Node search
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
* Fix NetBIOS report with search on blank domain
|
* Fix NetBIOS report with search on blank domain
|
||||||
* Fix database MAC lookup when MAC not returned by nbtstat
|
* Fix database MAC lookup when MAC not returned by nbtstat
|
||||||
|
* Fix partial name match on Node search
|
||||||
|
|
||||||
2.024000 - 2014-02-22
|
2.024000 - 2014-02-22
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ ajax '/ajax/content/search/node' => require_login sub {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my $set;
|
my $set;
|
||||||
|
|
||||||
my $name = $node;
|
my $name = $node;
|
||||||
|
|
||||||
if (param('partial')) {
|
if (param('partial')) {
|
||||||
@@ -97,18 +96,18 @@ ajax '/ajax/content/search/node' => require_login sub {
|
|||||||
->search_by_ip({ip => $ip, @active, @times});
|
->search_by_ip({ip => $ip, @active, @times});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if ($name !~ m/%/ and setting('domain_suffix')) {
|
if ($name !~ m/%/ and setting('domain_suffix')) {
|
||||||
$name .= setting('domain_suffix')
|
$name .= setting('domain_suffix')
|
||||||
if index($name, setting('domain_suffix')) == -1;
|
if index($name, setting('domain_suffix')) == -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$set = schema('netdisco')->resultset('NodeIp')
|
$set = schema('netdisco')->resultset('NodeIp')
|
||||||
->search_by_dns({dns => $node, @active, @times});
|
->search_by_dns({dns => $name, @active, @times});
|
||||||
|
|
||||||
# if the user selects Vendor search opt, then
|
# if the user selects Vendor search opt, then
|
||||||
# we'll try the OUI company name as a fallback
|
# we'll try the OUI company name as a fallback
|
||||||
|
|
||||||
if (not $set->has_rows and param('show_vendor')) {
|
if (not $set->has_rows and param('show_vendor')) {
|
||||||
$node = param('q');
|
|
||||||
$set = schema('netdisco')->resultset('NodeIp')
|
$set = schema('netdisco')->resultset('NodeIp')
|
||||||
->with_times
|
->with_times
|
||||||
->search(
|
->search(
|
||||||
@@ -117,8 +116,9 @@ ajax '/ajax/content/search/node' => require_login sub {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return unless $set and $set->has_rows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return unless $set and $set->has_rows;
|
||||||
$set = $set->search_rs({}, { order_by => 'me.mac' });
|
$set = $set->search_rs({}, { order_by => 'me.mac' });
|
||||||
|
|
||||||
template 'ajax/search/node_by_ip.tt', {
|
template 'ajax/search/node_by_ip.tt', {
|
||||||
|
|||||||
Reference in New Issue
Block a user