diff --git a/Netdisco/Changes b/Netdisco/Changes index 10d6735b..922d0d54 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -4,6 +4,7 @@ * Display clean version of creation stamp on port log * Make sure only to check for admins in deploy script + * Allow Port Control users to see Port Config Log report [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod b/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod index e7ab0848..36cf5572 100644 --- a/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod +++ b/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod @@ -178,6 +178,16 @@ any query parameters which might customize the report search. See the L module for a simple example of how to implement the handler. +An additional feature allows you to create Reports which do not appear in the +Navbar menu. This is useful if the page is only linked directly from another +(for example Port Log). To enable this feature add the C key: + + register_report({ + tag => 'newfeature', + label => 'My New Feature', + hidden => true, + }); + =head1 CSV Response Most pages in Netdisco are a table with data. It's possible to have the @@ -224,7 +234,7 @@ want arbitrary links supported. An additional feature allows you to create Admin Tasks which do not appear in the Navbar menu. This is useful if the page is only linked directly from -another (for example Port Log). To enable this feature add the C key: +another. To enable this feature add the C key: register_admin_task({ tag => 'newfeature', diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/PortLog.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortLog.pm similarity index 77% rename from Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/PortLog.pm rename to Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortLog.pm index cc88d0ee..73ca2700 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/PortLog.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Report/PortLog.pm @@ -1,4 +1,4 @@ -package App::Netdisco::Web::Plugin::AdminTask::PortLog; +package App::Netdisco::Web::Plugin::Report::PortLog; use Dancer ':syntax'; use Dancer::Plugin::Ajax; @@ -7,13 +7,14 @@ use Dancer::Plugin::Auth::Extensible; use App::Netdisco::Web::Plugin; -register_admin_task({ +register_report({ tag => 'portlog', label => 'Port Control Log', + category => 'Port', # not used hidden => true, }); -ajax '/ajax/content/admin/portlog' => require_role admin => sub { +ajax '/ajax/content/report/portlog' => require_role port_control => sub { my $device = param('q'); my $port = param('f'); send_error('Bad Request', 400) unless $device and $port; @@ -31,7 +32,7 @@ ajax '/ajax/content/admin/portlog' => require_role admin => sub { })->with_times; content_type('text/html'); - template 'ajax/admintask/portlog.tt', { + template 'ajax/report/portlog.tt', { results => $set, }, { layout => undef }; }; diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index d55b5f14..7f3d2303 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -53,7 +53,7 @@ web_plugins: - Report::SsidInventory - Report::VlanInventory - Report::SubnetUtilization - - AdminTask::PortLog + - Report::PortLog - AdminTask::JobQueue - AdminTask::Topology - AdminTask::PollerPerformance diff --git a/Netdisco/share/views/admintask.tt b/Netdisco/share/views/admintask.tt index d6eb0ae9..23d8faaa 100644 --- a/Netdisco/share/views/admintask.tt +++ b/Netdisco/share/views/admintask.tt @@ -40,12 +40,6 @@ - [% ELSIF task.tag == 'portlog' %] - - [% params.q %] - - - [% params.f %] - [% ELSIF task.provides_csv %] diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index e3854d7c..6c9534c4 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -67,7 +67,7 @@ data-animation="" data-title="Click to Enable"> [% END %] + href="[% uri_for('/report/portlog') %]?q=[% device.ip | uri %]&f=[% row.port | uri %]"> @@ -342,7 +342,7 @@ role="dialog" aria-hidden="true">