Bug fixes, and AuthN delegation.
Squashed commit of the following: commit 25bc026dc5e0177cd3aa81c11cdace091eb68f36 Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Jun 17 08:16:56 2013 +0100 bump version for new release commit d4042f6e8db42c7a85df4dcf9690fec72ad2db69 Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 18:27:52 2013 +0100 Job Queue page play/pause/refresh controls commit b6c9152516d7800409b7a73c5d0cdce6dd405492 Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 17:50:06 2013 +0100 limit size of job queue table commit ac9e5feb8b774071fcf4423dd862dced74dee9e6 Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 17:47:55 2013 +0100 update bugs link commit 9c0fb0e9aedc6297f4462c3cf88343f6d0df40b6 Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 17:41:29 2013 +0100 update MANIFEST commit 7aaa2fff91ed2b1839bdbb79081d90ad3e144f47 Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 17:40:35 2013 +0100 Fix Plack middleware config for Expiry commit 313e2cf014cf0da7cf85074e390ad394b28bf42d Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 17:23:00 2013 +0100 Support for delegated authentication with REMOTE_USER and X-REMOTE_USER commit 85e21f2bf296c4a5ca6b5afb5091694e56e3031f Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 14:24:08 2013 +0100 Add tooltip showing the job queue item logged status message commit 9b14f53ebed51eb46ea278807cfe8a2fbd28743c Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 13:43:26 2013 +0100 Increase default frequency of job queue polling to 2 seconds commit 6ba46818d8ab2100c652c8eb8e98bc6f5a54e273 Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 12:57:43 2013 +0100 workaround for https://github.com/PerlDancer/Dancer/issues/935 commit c7a2d8a9d45716959bedbbb8db4cdd82a5950642 Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Jun 16 11:54:18 2013 +0100 Fix hyperlinks when running behind reverse proxy on custom path commit 0620efa404bc25cb0a9ada5aa6f1b092d5c4d482 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Jun 15 18:31:19 2013 +0100 update deploy docs commit 857b1c7aa0fe832f8948349eda5211eb38ba3099 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Jun 15 18:16:50 2013 +0100 add note about compiler dependency commit 02a2ad6b2c52db9fbc1e24bc8888f658dc7084ad Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Jun 15 17:44:29 2013 +0100 sort vlans, macs, ips in device port view commit 097bad77310728a98b261a2cfca4de7ab50be94b Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Jun 15 16:32:20 2013 +0100 hint when calling web in fg without starman commit 6425d89ddb2b56129c610482134482d8f9455d40 Author: Oliver Gorwits <oliver@cpan.org> Date: Sat Jun 15 15:53:26 2013 +0100 macwalk and arpwalk refactored commit d527b9d05addc82fb38c84f6fea1aa5818fc68d5 Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 22:27:34 2013 +0100 implement is_macsuckable and is_arpnipable commit 7af10ed313e25f5d99a22b53ba438225c2259069 Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 22:17:39 2013 +0100 version bump commit 8ace3bf8fa48cf3e14bdf86fad5a4862aad50a4b Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 22:14:05 2013 +0100 tidy up user menu commit e6eef605c248471dbfe7ec62cd04d73d653523ca Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 22:02:52 2013 +0100 Add discoverall, macwalk, arpwalk items to the Admin Tasks menu commit 2631fabd1eccd8a3971e4762eebe57f406623bee Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 21:21:50 2013 +0100 remove length() which only became sane in 5.12 commit a7b7169070a58685cacde26a3b6d462e74be9928 Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Jun 13 19:07:56 2013 +0100 Use DBIx::Class new collapsed query support when we can commit 77cddab8ba7033ccb1ecae257bafa4eef8f99f47 Author: Oliver Gorwits <oliver@cpan.org> Date: Wed Jun 12 17:26:47 2013 +0100 Database config simplified to only four essential settings commit 6ed0802bf2ab0fd898ce6945451b8ca6566ae551 Author: Oliver Gorwits <oliver@cpan.org> Date: Wed Jun 12 13:03:20 2013 +0100 Ask to set up guest user for Admin/Port Control rights in deploy script
This commit is contained in:
		| @@ -19,7 +19,6 @@ logger_format: '[%P] %L @%D> %m' | ||||
|  | ||||
| domain_suffix: '' | ||||
| no_auth: false | ||||
| port: 5000 | ||||
| path: '/' | ||||
| behind_proxy: false | ||||
| web_plugins: | ||||
| @@ -88,7 +87,7 @@ no_port_control: false | ||||
| workers: | ||||
|   interactives: 2 | ||||
|   pollers: 2 | ||||
|   sleep_time: 5 | ||||
|   sleep_time: 2 | ||||
|  | ||||
| #housekeeping: | ||||
| #  discoverall: | ||||
|   | ||||
| @@ -8,17 +8,11 @@ | ||||
| # ESSENTIAL SETTINGS | ||||
| # ------------------ | ||||
|  | ||||
| plugins: | ||||
|   DBIC: | ||||
|     # alter dsn/user/pass for your local Netdisco DB | ||||
|     netdisco: | ||||
|       schema_class: 'App::Netdisco::DB' | ||||
|       dsn: 'dbi:Pg:dbname=netdisco;host=localhost' | ||||
|       user: 'changeme' | ||||
|       pass: 'changeme' | ||||
|       options: | ||||
|         RaiseError: 1 | ||||
|         AutoCommit: 1 | ||||
| database: | ||||
|   name: 'netdisco' | ||||
|   host: 'localhost' | ||||
|   user: 'changeme' | ||||
|   pass: 'changeme' | ||||
|  | ||||
| # -------------------- | ||||
| # RECOMMENDED SETTINGS | ||||
|   | ||||
| @@ -35,6 +35,41 @@ body { | ||||
|   overflow-x: hidden; | ||||
| } | ||||
|  | ||||
| /* fake looks for form submit buttons embedded in bootstrap dropdowns */ | ||||
| .nd_btn-link { | ||||
|   display: block; | ||||
|   padding: 2px 20px; | ||||
|   clear: both; | ||||
|   font-weight: normal; | ||||
|   line-height: 18px; | ||||
|   color: #333333; | ||||
|   white-space: nowrap; | ||||
|   text-decoration: none; | ||||
|   margin-top: 0px !important; | ||||
|   width: 100%; | ||||
|   text-align: left; | ||||
|   margin-left: -1px; | ||||
| } | ||||
|  | ||||
| .nd_btn-link:hover, .nd_btn-link:focus { | ||||
|   text-decoration: none; | ||||
|   color: #ffffff; | ||||
|   background-color: #0081c2; | ||||
|   background-repeat: repeat-x; | ||||
|   text-shadow: none; | ||||
| } | ||||
|  | ||||
| /* to be added to qtip-bootstrap class */ | ||||
| .nd_qtip-unconstrained { | ||||
|   min-width: none; | ||||
|   max-width: none; | ||||
| } | ||||
|  | ||||
| .qtip-content { | ||||
|   padding-bottom: 0px; | ||||
|   line-height: 8px; | ||||
| } | ||||
|  | ||||
| /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ | ||||
| /* styles to adjust the hero box used for homepage + login */ | ||||
|  | ||||
| @@ -140,6 +175,11 @@ td > form.nd_inline-form { | ||||
|   color: #6D5720; | ||||
| } | ||||
|  | ||||
| /* for the job control admin page play/pause links */ | ||||
| #nd_countdown-refresh:hover, #nd_countdown-control:hover { | ||||
|   text-decoration: none; | ||||
| } | ||||
|  | ||||
| /* when there's only one tab (report, task etc) change the text color */ | ||||
| .nd_single-tab { | ||||
|   color: rgb(187,112,0) !important; | ||||
|   | ||||
| @@ -173,7 +173,7 @@ $(document).ready(function() { | ||||
|   // activate typeahead on the main search box, for device names only | ||||
|   $('#nq').typeahead({ | ||||
|     source: function (query, process) { | ||||
|       return $.get('/ajax/data/devicename/typeahead', { query: query }, function (data) { | ||||
|       return $.get( uri_base + '/ajax/data/devicename/typeahead', { query: query }, function (data) { | ||||
|         return process(data); | ||||
|       }); | ||||
|     } | ||||
|   | ||||
| @@ -29,7 +29,12 @@ | ||||
|       <li class="active"><a id="[% task.tag %]_link" class="nd_single-tab" | ||||
|         href="#[% task.tag %]_pane">[% task.label %]</a></li> | ||||
|       [% IF task.tag == 'jobqueue' %] | ||||
|       <span id="nd_device-name"></span> | ||||
|       <span id="nd_device-name"> | ||||
|         <a id="nd_countdown-refresh" href="#"><i class="text-success icon-refresh"></i></a> | ||||
|         <a id="nd_countdown-control" href="#"> | ||||
|           <i id="nd_countdown-control-icon" class="text-error icon-pause"></i></a> | ||||
|         <span id="nd_countdown"></span> | ||||
|       </span> | ||||
|       [% END %] | ||||
|     </ul> | ||||
|     <div class="tab-content"> | ||||
|   | ||||
| @@ -16,9 +16,10 @@ | ||||
|   </tbody> | ||||
|     [% WHILE (row = results.next) %] | ||||
|     <tr | ||||
|       [% ' class="success"' IF row.status == 'done' %] | ||||
|       [% ' class="error"'   IF row.status == 'error' %] | ||||
|       [% ' class="info"'    IF row.status.search('^queued-') %] | ||||
|       [% ' class="nd_jobqueueitem success"' IF row.status == 'done' %] | ||||
|       [% ' class="nd_jobqueueitem error"'   IF row.status == 'error' %] | ||||
|       [% ' class="nd_jobqueueitem info"'    IF row.status.search('^queued-') %] | ||||
|       data-content="<pre>[% row.log | html_entity %]</pre>" | ||||
|     > | ||||
|       <td class="nd_center-cell">[% row.entered_stamp | html_entity %]</td> | ||||
|       <td class="nd_center-cell"> | ||||
|   | ||||
| @@ -142,9 +142,11 @@ | ||||
|       <td> | ||||
|         [% IF row.tagged_vlans_count %] | ||||
|         [% SET output = '' %] | ||||
|         [% FOREACH vlan IN row.tagged_vlans %] | ||||
|         [% SET vlanlist = [] %] | ||||
|         [% FOREACH vlan IN row.tagged_vlans %][% vlanlist.push(vlan.vlan) %][% END %] | ||||
|         [% FOREACH vlan IN vlanlist.nsort %] | ||||
|           [% SET output = output _ | ||||
|             '<a href="' _ uri_for('/search') _ '?tab=vlan&q=' _ vlan.vlan _ '">' _ vlan.vlan _ '</a>' %] | ||||
|             '<a href="' _ uri_for('/search') _ '?tab=vlan&q=' _ vlan _ '">' _ vlan _ '</a>' %] | ||||
|           [% SET output = output _ ', ' IF NOT loop.last %] | ||||
|         [% END %] | ||||
|         [% IF row.tagged_vlans_count > 10 %] [%# TODO make this a settable variable %] | ||||
|   | ||||
| @@ -23,7 +23,7 @@ | ||||
|       <div class="alert fade in"> | ||||
|         <a class="close" data-dismiss="alert">×</a> | ||||
|         Sorry, page not found. | ||||
|           <a href="http://sourceforge.net/tracker/?group_id=80033&atid=558508" target="_blank">Report a Bug?</a> | ||||
|           <a href="http://sourceforge.net/p/netdisco/bugs/" target="_blank">Report a Bug?</a> | ||||
|       </div> | ||||
|       [% END %] | ||||
|       <div class="hero-unit"> | ||||
|   | ||||
| @@ -11,12 +11,14 @@ | ||||
|   function inner_view_processing(tab) { | ||||
|  | ||||
|     // reload this table every 5 seconds | ||||
|     if (tab == 'jobqueue') { | ||||
|         $('#nd_device-name').text('5'); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_device-name').text('4') }, 1000 )); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_device-name').text('3') }, 2000 )); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_device-name').text('2') }, 3000 )); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_device-name').text('1') }, 4000 )); | ||||
|     if (tab == 'jobqueue' | ||||
|         && $('#nd_countdown-control-icon').hasClass('icon-pause')) { | ||||
|  | ||||
|         $('#nd_countdown').text('5'); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_countdown').text('4') }, 1000 )); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_countdown').text('3') }, 2000 )); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_countdown').text('2') }, 3000 )); | ||||
|         nd_timers.push(setTimeout(function() { $('#nd_countdown').text('1') }, 4000 )); | ||||
|         nd_timers.push(setTimeout(function() { | ||||
|           // clear any running timers | ||||
|           for (var i = 0; i < nd_timers.length; i++) { | ||||
| @@ -29,7 +31,7 @@ | ||||
|  | ||||
|     // activate typeahead on the topo boxes | ||||
|     $('.nd_topo_dev').autocomplete({ | ||||
|       source: '/ajax/data/deviceip/typeahead' | ||||
|       source: uri_base + '/ajax/data/deviceip/typeahead' | ||||
|       ,delay: 150 | ||||
|       ,minLength: 0 | ||||
|     }); | ||||
| @@ -38,7 +40,7 @@ | ||||
|     $('.nd_topo_port.nd_topo_dev1').autocomplete({ | ||||
|       source: function (request, response)  { | ||||
|         var query = $('.nd_topo_dev1').serialize(); | ||||
|         return $.get('/ajax/data/port/typeahead', query, function (data) { | ||||
|         return $.get( uri_base + '/ajax/data/port/typeahead', query, function (data) { | ||||
|           return response(data); | ||||
|         }); | ||||
|       } | ||||
| @@ -49,7 +51,7 @@ | ||||
|     $('.nd_topo_port.nd_topo_dev2').autocomplete({ | ||||
|       source: function (request, response)  { | ||||
|         var query = $('.nd_topo_dev2').serialize(); | ||||
|         return $.get('/ajax/data/port/typeahead', query, function (data) { | ||||
|         return $.get( uri_base + '/ajax/data/port/typeahead', query, function (data) { | ||||
|           return response(data); | ||||
|         }); | ||||
|       } | ||||
| @@ -77,6 +79,31 @@ | ||||
|       $(this).siblings('.nd_topo_port').autocomplete('search'); | ||||
|     }); | ||||
|  | ||||
|     // job control refresh icon should reload the page | ||||
|     $('#nd_countdown-refresh').click(function() { | ||||
|       event.preventDefault(); | ||||
|       for (var i = 0; i < nd_timers.length; i++) { | ||||
|           clearTimeout(nd_timers[i]); | ||||
|       } | ||||
|       $('#' + tab + '_form').trigger('submit'); | ||||
|     }); | ||||
|  | ||||
|     // job control pause/play icon switcheroo | ||||
|     $('#nd_countdown-control').click(function() { | ||||
|       event.preventDefault(); | ||||
|       var icon = $('#nd_countdown-control-icon'); | ||||
|       icon.toggleClass('icon-pause icon-play text-error text-success'); | ||||
|  | ||||
|       if (icon.hasClass('icon-play')) { | ||||
|         for (var i = 0; i < nd_timers.length; i++) { | ||||
|             clearTimeout(nd_timers[i]); | ||||
|         } | ||||
|         $('#nd_countdown').text('0'); | ||||
|       } | ||||
|       else { | ||||
|         $('#' + tab + '_form').trigger('submit'); | ||||
|       } | ||||
|     }); | ||||
|  | ||||
|     // activity for admin task tables | ||||
|     // dynamically bind to all forms in the table | ||||
| @@ -101,15 +128,38 @@ | ||||
|             '<div class="span2 alert">Request submitted...</div>' | ||||
|           ); | ||||
|         } | ||||
|         ,success: function(content) { | ||||
|         ,success: function() { | ||||
|           $('#' + tab + '_form').trigger('submit'); | ||||
|         } | ||||
|         // skip any error reporting for now | ||||
|         // TODO: fix sanity_ok in Netdisco Web | ||||
|         ,error: function() { | ||||
|           $(target).html( | ||||
|             '<div class="span5 alert alert-error">' + | ||||
|             'Request failed! Please contact your site administrator.</div>' | ||||
|           ); | ||||
|           $('#' + tab + '_form').trigger('submit'); | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|     // bind qtip2 to show the event log output | ||||
|     $(target).on('mouseover', '.nd_jobqueueitem', function(event) { | ||||
|       $(this).qtip({ | ||||
|         overwrite: false, | ||||
|         content: { | ||||
|           attr: 'data-content' | ||||
|         }, | ||||
|         show: { | ||||
|           event: event.type, | ||||
|           ready: true, | ||||
|           delay: 100 | ||||
|         }, | ||||
|         position: { | ||||
|           my: 'top center', | ||||
|           at: 'bottom center', | ||||
|           target: false | ||||
|         }, | ||||
|         style: { | ||||
|           classes: 'qtip-cluetip qtip-rounded nd_qtip-unconstrained' | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|   }); | ||||
|   | ||||
| @@ -48,14 +48,6 @@ | ||||
| </head> | ||||
|  | ||||
| <body> | ||||
| [% | ||||
|   user_dd = [ | ||||
|     { "title" = "Settings", "link" = "/settings" }, | ||||
|     { "title" = "Help", "link" = "/help" }, | ||||
|     { "title" = "Log Out", "link" = "/logout" } | ||||
|   ] | ||||
| %] | ||||
|  | ||||
| <div class="navbar navbar-inverse navbar-fixed-top"> | ||||
|   <div class="navbar-inner"> | ||||
|     <div class="container"> | ||||
| @@ -99,6 +91,22 @@ | ||||
|         <li class="dropdown[% ' active' IF vars.nav == 'admin' %]"> | ||||
|           <a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin Tasks <b class="caret"></b></a> | ||||
|           <ul class="dropdown-menu"> | ||||
|           <li> | ||||
|             <form method="post" class="nd_inline-form" action="[% uri_for('/admin/discoverall') %]"> | ||||
|               <button type="submit" class="btn btn-link nd_btn-link">Discover All</button> | ||||
|             </form> | ||||
|           </li> | ||||
|           <li> | ||||
|             <form method="post" class="nd_inline-form" action="[% uri_for('/admin/arpwalk') %]"> | ||||
|               <button type="submit" class="btn btn-link nd_btn-link">Arpnip All</button> | ||||
|             </form> | ||||
|           </li> | ||||
|           <li> | ||||
|             <form method="post" class="nd_inline-form" action="[% uri_for('/admin/macwalk') %]"> | ||||
|               <button type="submit" class="btn btn-link nd_btn-link">Macsuck All</button> | ||||
|             </form> | ||||
|           </li> | ||||
|           [% '<li class="divider"></li>' IF settings._admin_tasks.keys.size %] | ||||
|           [% FOREACH ai IN settings._admin_tasks.keys.sort %] | ||||
|             <li><a href="[% uri_for('/admin/' _ ai) %]">[% settings._admin_tasks.$ai.label | html_entity %]</a></li> | ||||
|           [% END %] | ||||
| @@ -117,12 +125,14 @@ | ||||
|           [% ELSE %] | ||||
|             <i class="icon-user"></i> | ||||
|           [% END %] | ||||
|           [% IF NOT settings.no_auth %] | ||||
|             [% session.user | html_entity %] <b class="caret"></b></a> | ||||
|           <ul class="dropdown-menu"> | ||||
|             [% FOREACH item IN user_dd %] | ||||
|             <li><a href="[% uri_for(item.link) %]">[% item.title | html_entity %]</a></li> | ||||
|             [% END %] | ||||
|           </ul> | ||||
|             <ul class="dropdown-menu"> | ||||
|               <li><a href="[% uri_for('/logout') %]">Log Out</a></li> | ||||
|             </ul> | ||||
|           [% ELSE %] | ||||
|             [% session.user | html_entity %]</a> | ||||
|           [% END %] | ||||
|         </li> <!-- /dropdown --> | ||||
|       </ul> | ||||
|       [% END %] | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| $(document).ready(function() { | ||||
|  | ||||
|   // bind qtip2 even to all future .observium buttons | ||||
|   // bind qtip2 event to all future .nd_observium buttons | ||||
|   $('#ports_pane').on('mouseover', '.nd_observium', function(event) { | ||||
|     $(this).qtip({ | ||||
|       overwrite: false, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user