diff --git a/Netdisco/Changes b/Netdisco/Changes index d783d6a9..3d681fdf 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,4 +1,8 @@ -2.031008 - 2015-02-18 +2.031008 - 2015-02-22 + + [ENHANCEMENTS] + + * Device operating system added to inventory links and search sidebar [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm index b39a8e2c..662cae9a 100644 --- a/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm +++ b/Netdisco/lib/App/Netdisco/DB/ResultSet/Device.pm @@ -168,6 +168,10 @@ a description of the vendor operating system). Will match exactly the C field. +=item os + +Will match exactly the C field, which is the operating sytem. + =item os_ver Will match exactly the C 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' => diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm index ec78f7ea..3cc0fc51 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm @@ -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) { diff --git a/Netdisco/lib/App/Netdisco/Web/Search.pm b/Netdisco/lib/App/Netdisco/Web/Search.pm index 316a88e5..72c78010 100644 --- a/Netdisco/lib/App/Netdisco/Web/Search.pm +++ b/Netdisco/lib/App/Netdisco/Web/Search.pm @@ -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, }; diff --git a/Netdisco/share/views/inventory.tt b/Netdisco/share/views/inventory.tt index 323f917e..ce379b94 100644 --- a/Netdisco/share/views/inventory.tt +++ b/Netdisco/share/views/inventory.tt @@ -49,7 +49,13 @@ [% FOREACH release IN releases.all %] [% NEXT UNLESS (release.os OR release.os_ver) %] - [% release.os || 'unknown' | html_entity %] + + [% IF release.os %] + + [% release.os | html_entity %] + [% ELSE %]unknown[% END %] + [% IF release.os_ver %] +
+ +