From 8838215a50e5ca25286dcdd38f36aa6a6c1cbac9 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 9 Jan 2012 11:13:43 +0000 Subject: [PATCH] skip login in dev env, set ports tab on device links --- Netdisco/lib/Netdisco/Web.pm | 10 +++++++--- Netdisco/views/ajax/search/node_by_ip.tt | 2 +- Netdisco/views/ajax/search/node_by_mac.tt | 4 ++-- Netdisco/views/ajax/search/port.tt | 2 +- Netdisco/views/ajax/search/vlan.tt | 12 ++++++------ Netdisco/views/inc/device/ports.tt | 2 +- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Netdisco/lib/Netdisco/Web.pm b/Netdisco/lib/Netdisco/Web.pm index f65a45d0..cbf7300f 100644 --- a/Netdisco/lib/Netdisco/Web.pm +++ b/Netdisco/lib/Netdisco/Web.pm @@ -13,9 +13,13 @@ use List::MoreUtils (); hook 'before' => sub { if (! session('user') && request->path !~ m{^/login}) { - session(user => 'oliver'); # XXX - #var(requested_path => request->path); - #request->path_info('/'); + if (setting('environment') eq 'development') { + session(user => 'developer'); + } + else { + var(requested_path => request->path); + request->path_info('/'); + } } # make hash lookups of query lists diff --git a/Netdisco/views/ajax/search/node_by_ip.tt b/Netdisco/views/ajax/search/node_by_ip.tt index 8d4cb7a7..8c2b1c27 100644 --- a/Netdisco/views/ajax/search/node_by_ip.tt +++ b/Netdisco/views/ajax/search/node_by_ip.tt @@ -38,7 +38,7 @@   [% END %] Switch Port - [% node.switch %] [ [% node.port %] ] + [% node.switch %] [ [% node.port %] ] [% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %] [% ' a' IF NOT node.active %] diff --git a/Netdisco/views/ajax/search/node_by_mac.tt b/Netdisco/views/ajax/search/node_by_mac.tt index 818d381a..1df74fda 100644 --- a/Netdisco/views/ajax/search/node_by_mac.tt +++ b/Netdisco/views/ajax/search/node_by_mac.tt @@ -53,7 +53,7 @@   [% END %] Switch Port - [% node.switch %] [ [% node.port %] ] + [% node.switch %] [ [% node.port %] ] [% ' (' _ node.device.dns.remove(settings.domain_suffix) _ ')' IF node.device.dns %] [% ' a' IF NOT node.active %] @@ -70,7 +70,7 @@   [% END %] Switch Port - [% port.ip %] [ [% port.port %] ] + [% port.ip %] [ [% port.port %] ] [% ' (' _ port.device.dns.remove(settings.domain_suffix) _ ')' IF port.device.dns %] [% IF params.stamps %] diff --git a/Netdisco/views/ajax/search/port.tt b/Netdisco/views/ajax/search/port.tt index c505feef..7c80c8f6 100644 --- a/Netdisco/views/ajax/search/port.tt +++ b/Netdisco/views/ajax/search/port.tt @@ -11,7 +11,7 @@ [% WHILE (row = results.next) %] [% row.name %] - [% row.ip %] [ [% row.port %] ] + [% row.ip %] [ [% row.port %] ] [% ' (' _ row.device.dns.remove(settings.domain_suffix) _ ')' IF row.device.dns %] [% row.descr %] diff --git a/Netdisco/views/ajax/search/vlan.tt b/Netdisco/views/ajax/search/vlan.tt index 0a57eea3..581883ee 100644 --- a/Netdisco/views/ajax/search/vlan.tt +++ b/Netdisco/views/ajax/search/vlan.tt @@ -13,17 +13,17 @@ [% WHILE (row = results.next) %] [% row.vlan.vlan %] + href="/device?tab=ports&ip=[% row.ip %]&vlan=[% row.vlan.vlan %]">[% row.vlan.vlan %] [% row.dns %] + href="/device?tab=ports&ip=[% row.ip %]&vlan=[% row.vlan.vlan %]">[% row.dns %] [% row.vlan.description %] + href="/device?tab=ports&ip=[% row.ip %]&vlan=[% row.vlan.vlan %]">[% row.vlan.description %] [% row.model %] + href="/device?tab=ports&ip=[% row.ip %]&vlan=[% row.vlan.vlan %]">[% row.model %] [% row.os %] + href="/device?tab=ports&ip=[% row.ip %]&vlan=[% row.vlan.vlan %]">[% row.os %] [% row.vendor %] + href="/device?tab=ports&ip=[% row.ip %]&vlan=[% row.vlan.vlan %]">[% row.vendor %] [% END %] diff --git a/Netdisco/views/inc/device/ports.tt b/Netdisco/views/inc/device/ports.tt index 20e3e509..7ea7793c 100644 --- a/Netdisco/views/inc/device/ports.tt +++ b/Netdisco/views/inc/device/ports.tt @@ -1,5 +1,5 @@ -
+