diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin.pm b/Netdisco/lib/App/Netdisco/Web/Plugin.pm index 99249f12..04d4638d 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin.pm @@ -52,7 +52,7 @@ sub _register_tab { my ($nav, $config) = @_; my $stash = setting("${nav}_tabs"); - if (!length $config->{id} + if (!length $config->{tag} or !length $config->{label}) { error "bad config to register_${nav}_item"; @@ -60,7 +60,7 @@ sub _register_tab { } foreach my $item (@{ $stash }) { - if ($item->{id} eq $config->{id}) { + if ($item->{tag} eq $config->{tag}) { $item = $config; return; } diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Addresses.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Addresses.pm index e3a10cf8..ad55025b 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Addresses.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Addresses.pm @@ -6,7 +6,7 @@ use Dancer::Plugin::DBIC; use App::Netdisco::Web::Plugin; -register_device_tab({ id => 'addresses', label => 'Addresses' }); +register_device_tab({ tag => 'addresses', label => 'Addresses' }); # device interface addresses ajax '/ajax/content/device/addresses' => sub { diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Details.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Details.pm index f9959274..6e6d30a4 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Details.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Details.pm @@ -6,7 +6,7 @@ use Dancer::Plugin::DBIC; use App::Netdisco::Web::Plugin; -register_device_tab({ id => 'details', label => 'Details' }); +register_device_tab({ tag => 'details', label => 'Details' }); # device details table ajax '/ajax/content/device/details' => sub { diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Modules.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Modules.pm index 4a9850d3..47341216 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Modules.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Modules.pm @@ -5,7 +5,7 @@ use Dancer::Plugin::Ajax; use App::Netdisco::Web::Plugin; -register_device_tab({ id => 'modules', label => 'Modules' }); +register_device_tab({ tag => 'modules', label => 'Modules' }); ajax '/ajax/content/device/:thing' => sub { return "

Hello, this is where the ". param('thing') ." content goes.

"; diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm index ea1d0d22..106919e8 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm @@ -6,7 +6,7 @@ use Dancer::Plugin::DBIC; use App::Netdisco::Web::Plugin; -register_device_tab({ id => 'netmap', label => 'Neighbors' }); +register_device_tab({ tag => 'netmap', label => 'Neighbors' }); ajax '/ajax/content/device/netmap' => sub { content_type('text/html'); diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index b04b6275..a083be99 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -7,7 +7,7 @@ use Dancer::Plugin::DBIC; use App::Netdisco::Util::Web (); # for sort_port use App::Netdisco::Web::Plugin; -register_device_tab({ id => 'ports', label => 'Ports' }); +register_device_tab({ tag => 'ports', label => 'Ports' }); # device ports with a description (er, name) matching ajax '/ajax/content/device/ports' => sub { diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm index dfdbb7b8..47cfdae4 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Device.pm @@ -8,7 +8,7 @@ use List::MoreUtils (); use App::Netdisco::Web::Plugin; -register_search_tab({id => 'device', label => 'Device'}); +register_search_tab({ tag => 'device', label => 'Device' }); # device with various properties or a default match-all ajax '/ajax/content/search/device' => sub { diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm index 08fa3e30..beaec028 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Node.pm @@ -9,7 +9,7 @@ use Net::MAC (); use App::Netdisco::Web::Plugin; -register_search_tab({ id => 'node', label => 'Node' }); +register_search_tab({ tag => 'node', label => 'Node' }); # nodes matching the param as an IP or DNS hostname or MAC ajax '/ajax/content/search/node' => sub { diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm index bdabb865..047ce6ce 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/Port.pm @@ -6,7 +6,7 @@ use Dancer::Plugin::DBIC; use App::Netdisco::Web::Plugin; -register_search_tab({ id => 'port', label => 'Port' }); +register_search_tab({ tag => 'port', label => 'Port' }); # device ports with a description (er, name) matching ajax '/ajax/content/search/port' => sub { diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm index c8f689bb..46b8ba44 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Search/VLAN.pm @@ -6,7 +6,7 @@ use Dancer::Plugin::DBIC; use App::Netdisco::Web::Plugin; -register_search_tab({ id => 'vlan', label => 'VLAN' }); +register_search_tab({ tag => 'vlan', label => 'VLAN' }); # devices carrying vlan xxx ajax '/ajax/content/search/vlan' => sub { diff --git a/Netdisco/share/views/device.tt b/Netdisco/share/views/device.tt index 18584a61..1ccb6f10 100644 --- a/Netdisco/share/views/device.tt +++ b/Netdisco/share/views/device.tt @@ -20,18 +20,18 @@ rel="tooltip" data-placement="left" data-offset="5" data-title="Unpin Sidebar">
[% FOREACH tab IN settings.device_tabs %] - @@ -43,13 +43,13 @@
[% FOREACH tab IN settings.device_tabs %] -
+
[% END %]
diff --git a/Netdisco/share/views/js/common.js b/Netdisco/share/views/js/common.js index 362f0cf0..b2080087 100644 --- a/Netdisco/share/views/js/common.js +++ b/Netdisco/share/views/js/common.js @@ -1,10 +1,10 @@ $(document).ready(function() { // search hook for each tab [% FOREACH tab IN settings.search_tabs %] - $('[% "#${tab.id}_form" %]').submit(function(event){ do_search(event, '[% tab.id %]'); }); + $('[% "#${tab.tag}_form" %]').submit(function(event){ do_search(event, '[% tab.tag %]'); }); [% END %] [% FOREACH tab IN settings.device_tabs %] - $('[% "#${tab.id}_form" %]').submit(function(event){ do_search(event, '[% tab.id %]'); }); + $('[% "#${tab.tag}_form" %]').submit(function(event){ do_search(event, '[% tab.tag %]'); }); [% END %] // on page load, load the content for the active tab diff --git a/Netdisco/share/views/search.tt b/Netdisco/share/views/search.tt index e98039a3..bb02d812 100644 --- a/Netdisco/share/views/search.tt +++ b/Netdisco/share/views/search.tt @@ -9,16 +9,16 @@ rel="tooltip" data-placement="left" data-offset="5" data-title="Pin Sidebar">
[% FOREACH tab IN settings.search_tabs %] -