Device operating system added to inventory links and search sidebar
This commit is contained in:
@@ -168,6 +168,10 @@ a description of the vendor operating system).
|
||||
|
||||
Will match exactly the C<model> field.
|
||||
|
||||
=item os
|
||||
|
||||
Will match exactly the C<os> field, which is the operating sytem.
|
||||
|
||||
=item os_ver
|
||||
|
||||
Will match exactly the C<os_ver> field, which is the operating sytem software version.
|
||||
@@ -236,6 +240,8 @@ sub search_by_field {
|
||||
|
||||
($p->{model} ? ('me.model' =>
|
||||
{ '-in' => $p->{model} }) : ()),
|
||||
($p->{os} ? ('me.os' =>
|
||||
{ '-in' => $p->{os} }) : ()),
|
||||
($p->{os_ver} ? ('me.os_ver' =>
|
||||
{ '-in' => $p->{os_ver} }) : ()),
|
||||
($p->{vendor} ? ('me.vendor' =>
|
||||
|
||||
@@ -14,7 +14,7 @@ register_search_tab(
|
||||
# device with various properties or a default match-all
|
||||
get '/ajax/content/search/device' => require_login sub {
|
||||
my $has_opt = List::MoreUtils::any { param($_) }
|
||||
qw/name location dns ip description model os_ver vendor layers/;
|
||||
qw/name location dns ip description model os os_ver vendor layers/;
|
||||
my $rs;
|
||||
|
||||
if ($has_opt) {
|
||||
|
||||
@@ -56,7 +56,7 @@ hook 'before_template' => sub {
|
||||
or index(request->path, uri_for('/ajax/content/search')->path) == 0);
|
||||
|
||||
# used in the device search sidebar template to set selected items
|
||||
foreach my $opt (qw/model vendor os_ver/) {
|
||||
foreach my $opt (qw/model vendor os os_ver/) {
|
||||
my $p = (ref [] eq ref param($opt) ? param($opt)
|
||||
: (param($opt) ? [param($opt)] : []));
|
||||
$tokens->{"${opt}_lkp"} = { map { $_ => 1 } @$p };
|
||||
@@ -114,12 +114,14 @@ get '/search' => require_login sub {
|
||||
|
||||
# used in the device search sidebar to populate select inputs
|
||||
my $model_list = [ $s->resultset('Device')->get_distinct_col('model') ];
|
||||
my $os_list = [ $s->resultset('Device')->get_distinct_col('os') ];
|
||||
my $os_ver_list = [ $s->resultset('Device')->get_distinct_col('os_ver') ];
|
||||
my $vendor_list = [ $s->resultset('Device')->get_distinct_col('vendor') ];
|
||||
|
||||
template 'search', {
|
||||
search => params->{'tab'},
|
||||
model_list => $model_list,
|
||||
os_list => $os_list,
|
||||
os_ver_list => $os_ver_list,
|
||||
vendor_list => $vendor_list,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user