From eee6598c953b50730366ad1d60467e6be94e8e66 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Wed, 24 Jul 2013 00:00:19 +0100 Subject: [PATCH] release 2.010002 --- Netdisco/Changes | 20 +++++++++++- Netdisco/MANIFEST | 2 ++ Netdisco/META.yml | 2 +- Netdisco/bin/netdisco-web-fg | 6 ++++ Netdisco/lib/App/Netdisco.pm | 2 +- Netdisco/lib/App/Netdisco/Core/Discover.pm | 3 +- Netdisco/lib/App/Netdisco/DB.pm | 2 +- .../App-Netdisco-DB-21-22-PostgreSQL.sql | 5 +++ .../App-Netdisco-DB-22-23-PostgreSQL.sql | 5 +++ .../Netdisco/Web/Plugin/AdminTask/Topology.pm | 9 ++++-- .../share/views/ajax/admintask/jobqueue.tt | 6 ++-- .../views/ajax/admintask/pseudodevice.tt | 32 ++++++++----------- .../share/views/ajax/admintask/topology.tt | 24 ++++++-------- Netdisco/share/views/ajax/device/ports.tt | 4 ++- Netdisco/share/views/js/admintask.js | 13 +++++--- Netdisco/share/views/js/device.js | 4 +-- 16 files changed, 88 insertions(+), 51 deletions(-) create mode 100644 Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-21-22-PostgreSQL.sql create mode 100644 Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-22-23-PostgreSQL.sql diff --git a/Netdisco/Changes b/Netdisco/Changes index aaab50b6..2d54a8cd 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,4 +1,22 @@ -2.009000_001 - +2.010002 - 2013-07-23 + + [ENHANCEMENTS] + + * Nullify unused schema changes + + [BUG FIXES] + + * Fix FF bug with forms embedded in tables + * Fix bugs in topo update code + +2.010001_003 - 2013-06-20 + + [BUG FIXES] + + * Pass event param to all js functions which require it + * Handle UTF-8 data in the device port remote_id + +2.010000 - 2013-06-16 [NEW FEATURES] diff --git a/Netdisco/MANIFEST b/Netdisco/MANIFEST index 26c7c076..fd20ace8 100644 --- a/Netdisco/MANIFEST +++ b/Netdisco/MANIFEST @@ -96,6 +96,8 @@ lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-19-20-PostgreSQL.sql lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-2-3-PostgreSQL.sql lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-2-PostgreSQL.sql lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-20-21-PostgreSQL.sql +lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-21-22-PostgreSQL.sql +lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-22-23-PostgreSQL.sql lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-3-4-PostgreSQL.sql lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-4-5-PostgreSQL.sql lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-5-6-PostgreSQL.sql diff --git a/Netdisco/META.yml b/Netdisco/META.yml index 3cacbd08..98fc99ec 100644 --- a/Netdisco/META.yml +++ b/Netdisco/META.yml @@ -60,4 +60,4 @@ resources: homepage: http://netdisco.org/ license: http://opensource.org/licenses/bsd-license.php repository: git://git.code.sf.net/p/netdisco/netdisco-ng -version: 2.010000 +version: 2.010002 diff --git a/Netdisco/bin/netdisco-web-fg b/Netdisco/bin/netdisco-web-fg index 81dca43e..fed7e417 100755 --- a/Netdisco/bin/netdisco-web-fg +++ b/Netdisco/bin/netdisco-web-fg @@ -3,6 +3,12 @@ use strict; use warnings FATAL => 'all'; +BEGIN { + if ($ENV{_} and $ENV{_} =~ m/netdisco-web-fg$/) { + die "You probably want: '~/bin/localenv starman $0 --workers=1 --disable-keepalive'\n"; + } +} + use FindBin; FindBin::again(); use Path::Class 'dir'; diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index 68a47ec6..4590027a 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -7,7 +7,7 @@ use 5.010_000; use File::ShareDir 'dist_dir'; use Path::Class; -our $VERSION = '2.010000'; +our $VERSION = '2.010002'; BEGIN { if (not ($ENV{DANCER_APPDIR} || '') diff --git a/Netdisco/lib/App/Netdisco/Core/Discover.pm b/Netdisco/lib/App/Netdisco/Core/Discover.pm index fc80922d..cd17a897 100644 --- a/Netdisco/lib/App/Netdisco/Core/Discover.pm +++ b/Netdisco/lib/App/Netdisco/Core/Discover.pm @@ -6,6 +6,7 @@ use Dancer::Plugin::DBIC 'schema'; use App::Netdisco::Util::Device qw/get_device is_discoverable/; use App::Netdisco::Util::DNS ':all'; use NetAddr::IP::Lite ':lower'; +use Encode; use Try::Tiny; use base 'Exporter'; @@ -611,7 +612,7 @@ sub store_neighbors { my $remote_ipad = NetAddr::IP::Lite->new($remote_ip); my $remote_port = undef; my $remote_type = $c_platform->{$entry}; - my $remote_id = $c_id->{$entry}; + my $remote_id = Encode::decode('UTF-8', $c_id->{$entry}); next unless $remote_ip; diff --git a/Netdisco/lib/App/Netdisco/DB.pm b/Netdisco/lib/App/Netdisco/DB.pm index ee928630..b40ebbab 100644 --- a/Netdisco/lib/App/Netdisco/DB.pm +++ b/Netdisco/lib/App/Netdisco/DB.pm @@ -8,7 +8,7 @@ use base 'DBIx::Class::Schema'; __PACKAGE__->load_namespaces; -our $VERSION = 21; # schema version used for upgrades, keep as integer +our $VERSION = 23; # schema version used for upgrades, keep as integer use Path::Class; use File::Basename; diff --git a/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-21-22-PostgreSQL.sql b/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-21-22-PostgreSQL.sql new file mode 100644 index 00000000..c29fbd5a --- /dev/null +++ b/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-21-22-PostgreSQL.sql @@ -0,0 +1,5 @@ +BEGIN; + +-- ALTER TABLE device_port ALTER COLUMN remote_id TYPE bytea USING remote_id::bytea; + +COMMIT; diff --git a/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-22-23-PostgreSQL.sql b/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-22-23-PostgreSQL.sql new file mode 100644 index 00000000..8eaf1718 --- /dev/null +++ b/Netdisco/lib/App/Netdisco/DB/schema_versions/App-Netdisco-DB-22-23-PostgreSQL.sql @@ -0,0 +1,5 @@ +BEGIN; + +-- ALTER TABLE device_port ALTER COLUMN remote_id TYPE text USING remote_id::text; + +COMMIT; diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm index f0ac8b78..75533869 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/AdminTask/Topology.pm @@ -5,6 +5,9 @@ use Dancer::Plugin::Ajax; use Dancer::Plugin::DBIC; use App::Netdisco::Web::Plugin; +use App::Netdisco::Util::Device 'get_device'; + +use Try::Tiny; use NetAddr::IP::Lite ':lower'; register_admin_task({ @@ -50,7 +53,8 @@ ajax '/ajax/control/admin/topology/add' => sub { return unless ($left->in_storage and $right->in_storage); $left->ports - ->single({port => param('port1')}, {for => 'update'}) + ->search({port => param('port1')}, {for => 'update'}) + ->single() ->update({ remote_ip => param('dev2'), remote_port => param('port2'), @@ -61,7 +65,8 @@ ajax '/ajax/control/admin/topology/add' => sub { }); $right->ports - ->single({port => param('port2')}, {for => 'update'}) + ->search({port => param('port2')}, {for => 'update'}) + ->single() ->update({ remote_ip => param('dev1'), remote_port => param('port1'), diff --git a/Netdisco/share/views/ajax/admintask/jobqueue.tt b/Netdisco/share/views/ajax/admintask/jobqueue.tt index bdc8f6d5..479d5793 100644 --- a/Netdisco/share/views/ajax/admintask/jobqueue.tt +++ b/Netdisco/share/views/ajax/admintask/jobqueue.tt @@ -40,10 +40,8 @@ [% row.started_stamp | html_entity %] [% row.finished_stamp | html_entity %] -
- - -
+ + [% END %] diff --git a/Netdisco/share/views/ajax/admintask/pseudodevice.tt b/Netdisco/share/views/ajax/admintask/pseudodevice.tt index 60b4f69c..4ed632d2 100644 --- a/Netdisco/share/views/ajax/admintask/pseudodevice.tt +++ b/Netdisco/share/views/ajax/admintask/pseudodevice.tt @@ -9,33 +9,29 @@ -
- - - + + + - + -
[% WHILE (row = results.next) %] -
[% row.dns | html_entity %] [% row.ip | html_entity %] - - - - -
-
- - - - -
+ + + + + + + + + + [% END %] diff --git a/Netdisco/share/views/ajax/admintask/topology.tt b/Netdisco/share/views/ajax/admintask/topology.tt index a8e52084..d05275ea 100644 --- a/Netdisco/share/views/ajax/admintask/topology.tt +++ b/Netdisco/share/views/ajax/admintask/topology.tt @@ -10,39 +10,36 @@ -
- +
- +
- +
- +
- + -
[% WHILE (row = results.next) %] -
[% row.dev1 | html_entity %] [% row.port1 | html_entity %] @@ -50,12 +47,11 @@ href="[% uri_for('/device') %]?q=[% row.dev2 | uri %]">[% row.dev2 | html_entity %] [% row.port2 | html_entity %] - - - - - -
+ + + + + [% END %] diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index 691e7f7d..5cb6c418 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -210,7 +210,9 @@ [% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip | html_entity %] - ([% row.remote_port | html_entity %]) + ([% row.remote_port | html_entity %] + [% ' id: '_ row.remote_id IF row.remote_id %] + [% ' type: '_ row.remote_type IF row.remote_type %]) [% ELSIF row.remote_ip AND row.remote_port %] N diff --git a/Netdisco/share/views/js/admintask.js b/Netdisco/share/views/js/admintask.js index 4d4eadcf..813a3d2c 100644 --- a/Netdisco/share/views/js/admintask.js +++ b/Netdisco/share/views/js/admintask.js @@ -80,7 +80,7 @@ }); // job control refresh icon should reload the page - $('#nd_countdown-refresh').click(function() { + $('#nd_countdown-refresh').click(function(event) { event.preventDefault(); for (var i = 0; i < nd_timers.length; i++) { clearTimeout(nd_timers[i]); @@ -89,7 +89,7 @@ }); // job control pause/play icon switcheroo - $('#nd_countdown-control').click(function() { + $('#nd_countdown-control').click(function(event) { event.preventDefault(); var icon = $('#nd_countdown-control-icon'); icon.toggleClass('icon-pause icon-play text-error text-success'); @@ -107,7 +107,7 @@ // activity for admin task tables // dynamically bind to all forms in the table - $(target).on('submit', 'form', function() { + $(target).on('click', '.nd_adminbutton', function(event) { // stop form from submitting normally event.preventDefault(); @@ -116,13 +116,16 @@ clearTimeout(nd_timers[i]); } + // what purpose - add/update/del + var mode = $(this).attr('name') + // submit the query and put results into the tab pane $.ajax({ type: 'POST' ,async: true ,dataType: 'html' - ,url: uri_base + '/ajax/control/admin/' + tab + '/' + $(this).attr('name') - ,data: $(this).serializeArray() + ,url: uri_base + '/ajax/control/admin/' + tab + '/' + mode + ,data: $(this).closest('tr').find('input[data-form="' + mode + '"]').serializeArray() ,beforeSend: function() { $(target).html( '
Request submitted...
' diff --git a/Netdisco/share/views/js/device.js b/Netdisco/share/views/js/device.js index 7c353e3c..ff10a979 100644 --- a/Netdisco/share/views/js/device.js +++ b/Netdisco/share/views/js/device.js @@ -62,7 +62,7 @@ // clickable device port names can simply resubmit AJAX rather than // fetch the whole page again. - $('#ports_pane').on('click', '.nd_this-port-only', function() { + $('#ports_pane').on('click', '.nd_this-port-only', function(event) { event.preventDefault(); // link is real so prevent page submit var port = $(this).text(); @@ -120,7 +120,7 @@ }); // activity for contenteditable control - $('.tab-content').on('keydown', '[contenteditable=true]', function() { + $('.tab-content').on('keydown', '[contenteditable=true]', function(event) { var esc = event.which == 27, nl = event.which == 13;