-
[% FOREACH tab IN vars.tabs %]
- [% tab.label %] [% END %] -
-
-
[% d.ip %]
- [% IF d.dns %] -([% d.dns.remove(settings.domain_suffix) %])
- [% END %] -
diff --git a/Netdisco/bin/netdisco-web.pl b/Netdisco/bin/netdisco-web.pl index 114ae861..bdb63acf 100755 --- a/Netdisco/bin/netdisco-web.pl +++ b/Netdisco/bin/netdisco-web.pl @@ -1,4 +1,5 @@ #!/usr/bin/env perl + use Dancer; use Netdisco::Web; dance; diff --git a/Netdisco/lib/Netdisco/Web/Device.pm b/Netdisco/lib/Netdisco/Web/Device.pm index 6eed5c1d..b736fd0b 100644 --- a/Netdisco/lib/Netdisco/Web/Device.pm +++ b/Netdisco/lib/Netdisco/Web/Device.pm @@ -54,7 +54,7 @@ ajax '/ajax/content/device/:thing' => sub { # device interface addresses ajax '/ajax/content/device/addresses' => sub { - my $ip = param('ip'); + my $ip = param('q'); return unless $ip; my $set = schema('netdisco')->resultset('DeviceIp')->search({ip => $ip}, { order_by => 'alias' }); @@ -68,13 +68,13 @@ ajax '/ajax/content/device/addresses' => sub { # device ports with a description (er, name) matching ajax '/ajax/content/device/ports' => sub { - my $ip = param('ip'); + my $ip = param('q'); return unless $ip; my $set = schema('netdisco')->resultset('DevicePort')->by_ip($ip); # refine by ports if requested - my $q = param('q'); + my $q = param('f'); if ($q) { if ($q =~ m/^\d+$/) { $set = $set->by_vlan($q); @@ -107,7 +107,7 @@ ajax '/ajax/content/device/ports' => sub { # device details table ajax '/ajax/content/device/details' => sub { - my $ip = param('ip'); + my $ip = param('q'); return unless $ip; my $device = schema('netdisco')->resultset('Device')->find($ip); @@ -120,7 +120,7 @@ ajax '/ajax/content/device/details' => sub { }; get '/device' => sub { - my $ip = NetAddr::IP::Lite->new(param('ip')); + my $ip = NetAddr::IP::Lite->new(param('q')); if (! $ip) { redirect uri_for('/', {nosuchdevice => 1}); return; diff --git a/Netdisco/public/css/print.css b/Netdisco/public/css/nd_print.css similarity index 100% rename from Netdisco/public/css/print.css rename to Netdisco/public/css/nd_print.css diff --git a/Netdisco/public/css/style.css b/Netdisco/public/css/netdisco.css similarity index 70% rename from Netdisco/public/css/style.css rename to Netdisco/public/css/netdisco.css index b0e5d1a3..b5583a34 100644 --- a/Netdisco/public/css/style.css +++ b/Netdisco/public/css/netdisco.css @@ -1,28 +1,18 @@ +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* for the fixed navbar make sure content stops short of page top*/ + body { padding-top: 50px; } -/* the bootstrap style is only set for input so set for select too*/ -/* also make the green a little more visible */ -form .clearfix.success select { - border-color: green; -} -form .clearfix.success input { - border-color: green; -} - -/* make the sidebar less wide */ -.well { - margin-right: 15px; -} - -/* make the content start more to the left now the sidebar is narrower */ -.nd_content { - margin-left: 225px !important; +.navbar_icon { + vertical-align: middle; + cursor: pointer; } +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* various styles to adjust the hero box used for homepage + login */ + .nd_loginalert { margin-top: -40px; } @@ -40,67 +30,9 @@ form .clearfix.success input { margin-bottom: 0px; } -/* nudge content closer to the header labels in the sidebar */ -.inputs-list:first-child { - padding-top: 4px !important; -} +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* results table links */ -/* colour for device name and ip in sidebar */ -.device_label { - color: #660033; -} - -/* right hand side device label */ -.device_label_right { - float: right !important; - margin-bottom: -7px !important; - display: none; -} - -/* take a block element and force it inline */ -.inline { - display: inline !important; -} - -/* nudge content in the sidebar closer to the left */ -.nd_sidesearchform { - padding-left: 0px; - margin-bottom: 0px; - /* margin-top: 8px; */ -} - -/* fixups for prepended checkbox in sidebar */ -.nd_searchcheckbox { - width: 120px; - padding-left: 35px; - cursor: pointer; -} - -/* placement of the search/filter bookmark link icon */ -.nd_bookmark { - vertical-align: top; -} - -/* fixups for placing the Archived "A" inside the prepended checkbox */ -.nd_legendlabel { - float: right; - line-height: 1.2; - margin-top: 2px; - margin-right: 3px; -} - -/* somewhere between span1 and span2 is desirable */ -.nd_days_select { - width: 56px; - margin-left: -2px !important; -} - -/* search/filter button placement */ -.nd_search { - margin-top: 15px; -} - -/* results table links with no decoration */ .nd_stealthlink { text-decoration: none !important; color: #404040; @@ -113,6 +45,9 @@ form .clearfix.success input { height: 100%; } +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* many styles for the collapsing lists */ + /* mouse-over should be pointer to show JS collapser is clickable */ .nd_collapser { cursor: pointer; @@ -148,6 +83,11 @@ form .clearfix.success input { border-top: 8px solid #F89406; } +/* for the tagged vlans total when hiding the full list */ +.vlan_total { + float: right; +} + /* draw little up arrow to the right of a label for collapsed list */ .cell-arrow-up { float: left; @@ -168,48 +108,47 @@ form .clearfix.success input { border-top: 8px solid #F89406; } -/* nudge the port name/vlan filter over a little */ -.nd_port_query { - margin-left: -2px !important; -} +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* for table to center cell content */ -/* for ports table to center cell content */ .center_cell { text-align: center; } -/* for the tagged vlans total when hiding the full list */ -.vlan_total { +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* tabs */ + +#search_results { + margin-bottom: 10px; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* style customization for many items which appear in the sidebar */ + +/* fixups for prepended checkbox in sidebar */ +.nd_searchcheckbox { + width: 120px; + padding-left: 35px; + cursor: pointer; +} + +/* fixups for placing the Archived "A" inside the prepended checkbox */ +.nd_legendlabel { float: right; + line-height: 1.2; + margin-top: 2px; + margin-right: 3px; } -/* for placing the sidebar toggle icons */ -#sidebar_toggle_img_in { - margin-top: -10px; - margin-left: 164px; - cursor: pointer; +/* somewhere between span1 and span2 is desirable */ +.nd_days_select { + width: 56px; + margin-left: -2px !important; } -/* for placing the sidebar toggle icons */ -#sidebar_toggle_img_out { - position: fixed; - top: 60px; - left: 4px; - z-index: 1; - cursor: pointer; - display: none; -} - -/* pull the device label closer to the top of the sidebar -to reduce the useless gap */ -h3.device_label { - margin-top: -12px; -} - -/* make the sidebar fixed on the screen */ -.sidebar { - position: fixed !important; - margin-top: 50px; +/* nudge the port name/vlan filter over a little */ +.nd_port_query { + margin-left: -2px !important; } /* little sweep brush inside of port filter input field */ @@ -224,3 +163,63 @@ so that its tooltip takes prescedence over the field tooltip */ .field_clear_icon > img { padding: 6px; } + +/* change highlighting for form fields which are being used in a search */ +form .clearfix.success select { + background-color: #A9DBA9; +} +form .clearfix.success input { + background-color: #A9DBA9; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* sidebar collapser */ + +/* for placing the sidebar toggle icons */ +#sidebar_toggle_img_in { + float: left; + margin-top: -9px; + margin-left: -18px; + cursor: pointer; +} + +/* for placing the sidebar toggle icons */ +#sidebar_toggle_img_out { + position: fixed; + top: 60px; + right: 7px; + z-index: 1; + cursor: pointer; + display: none; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ +/* sidebar placement and sizing */ + +/* make the sidebar fixed on the screen */ +.container-fluid > .sidebar { + position: absolute; + right: 20px; + width: 200px; + left: auto; +} + +/* make the content start more to the left now the sidebar is narrower */ +.container-fluid > .content { + margin-right: 220px; + margin-left: 0px; +} + +/* nudge content in the sidebar closer to the left */ +.nd_sidesearchform { + padding-left: 0px; + margin-top: -9px; + margin-bottom: 0px; +} + +/* nudge content closer to the header labels in the sidebar */ +.inputs-list:first-child { + padding-top: 4px !important; +} + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ diff --git a/Netdisco/public/images/crystalclear_mag.png b/Netdisco/public/images/crystalclear_mag.png new file mode 100644 index 00000000..0773220b Binary files /dev/null and b/Netdisco/public/images/crystalclear_mag.png differ diff --git a/Netdisco/public/images/diagona_settings.png b/Netdisco/public/images/diagona_settings.png new file mode 100644 index 00000000..6587d5bc Binary files /dev/null and b/Netdisco/public/images/diagona_settings.png differ diff --git a/Netdisco/public/images/dusseldorf_settings.png b/Netdisco/public/images/dusseldorf_settings.png new file mode 100644 index 00000000..92692173 Binary files /dev/null and b/Netdisco/public/images/dusseldorf_settings.png differ diff --git a/Netdisco/public/javascripts/netdisco.js b/Netdisco/public/javascripts/netdisco.js index 25cc2a5d..c2819084 100644 --- a/Netdisco/public/javascripts/netdisco.js +++ b/Netdisco/public/javascripts/netdisco.js @@ -3,7 +3,6 @@ function do_search (event, tab) { var form = '#' + tab + '_form'; var target = '#' + tab + '_pane'; - var mark = '#' + tab + '_bookmark'; // stop form from submitting normally event.preventDefault(); @@ -13,6 +12,22 @@ function do_search (event, tab) { $(this).val( $(form).find("input[name=q]").val() ); }); + // hide or show sidebars depending on previous state, + // and whether the sidebar contains any content (detected by TT) + if (has_sidebar[tab] == 0) { + $('.sidebar, #sidebar_toggle_img_out').hide(); + $('.content').css('margin-right', '10px !important'); + } + else { + if (sidebar_hidden) { + $('#sidebar_toggle_img_out').show(); + } + else { + $('.content').css('margin-right', '220px !important'); + $('.sidebar').show(); + } + } + // get the form params var query = $(form).serialize(); @@ -48,14 +63,16 @@ function do_search (event, tab) { '
' ); } - // looks good, update the bookmark for this search - $(mark).attr('href', uri_base + '/' + path + '?' + query); inner_view_processing(); } ); } +// keep track of which tabs have a sidebar, for when switching tab +var has_sidebar = {}; +var sidebar_hidden = 0; + // the history.js plugin is great, but fires statechange at pushState // so we have these semaphpores to help avoid messing the History. @@ -107,6 +124,11 @@ $(document).ready(function() { // activate tooltips $("[rel=twipsy]").twipsy({live: true}); + // bind submission to the navbar go icon + $('#navsearchgo').click(function() { + $('#navsearchgo').parent('form').submit(); + }); + // fix green background on search checkboxes // https://github.com/twitter/bootstrap/issues/742 syncCheckBox = function() { @@ -120,21 +142,22 @@ $(document).ready(function() { $('.sidebar').toggle( function() { $('#sidebar_toggle_img_out').toggle(); - $('.nd_content').animate({'margin-left': '5px !important'}, 100); - $('.device_label_right').toggle(); + $('.content').animate({'margin-right': '10px !important'}, 50); } ); + sidebar_hidden = 1; } ); $('#sidebar_toggle_img_out').click( function() { $('#sidebar_toggle_img_out').toggle(); - $('.nd_content').animate({'margin-left': '225px !important'}, 200, + $('.content').animate({'margin-right': '220px !important'}, 100, function() { - $('.device_label_right').toggle(); $('.sidebar').toggle(200); + $(window).scrollTop(0); } ); + sidebar_hidden = 0; } ); @@ -145,22 +168,22 @@ $(document).ready(function() { var from_li = $('.tabs').find('> .active').first(); var to_li = $(this).parent('li') - from_li.removeClass('active'); - to_li.addClass('active'); + from_li.toggleClass('active'); + to_li.toggleClass('active'); - var from = from_li.find('a').attr('href'); - var to = $(this).attr('href'); + var from_id = from_li.find('a').attr('href'); + var to_id = $(this).attr('href'); - if (from == to) { + if (from_id == to_id) { return; } - $(from).toggleClass('active'); - $(to).toggleClass('active'); + $(from_id).toggleClass('active'); + $(to_id).toggleClass('active'); update_content( - from.replace(/^#/,"").replace(/_pane$/,""), - to.replace(/^#/,"").replace(/_pane$/,"") + from_id.replace(/^#/,"").replace(/_pane$/,""), + to_id.replace(/^#/,"").replace(/_pane$/,"") ); }); }); diff --git a/Netdisco/views/ajax/device/addresses.tt b/Netdisco/views/ajax/device/addresses.tt index 5d6e55d8..6bfbe499 100644 --- a/Netdisco/views/ajax/device/addresses.tt +++ b/Netdisco/views/ajax/device/addresses.tt @@ -14,7 +14,7 @@
+ src="[% uri_base %]/images/diagona_settings.png"
+ rel="twipsy" data-placement="left" data-offset="5" title="Show Options"/>