fix bugs with Pseudo and Duplicate Device delete (causing web crash)

This commit is contained in:
Oliver Gorwits
2017-07-12 06:59:53 +01:00
parent 650086f97e
commit 070d595ef2
6 changed files with 10 additions and 17 deletions

View File

@@ -1,3 +1,9 @@
2.036007 - 2017-07-12
[BUG FIXES]
* fix bugs with Pseudo and Duplicate Device delete (causing web crash)
2.036006 - 2017-07-09
[ENHANCEMENTS]

View File

@@ -44,7 +44,7 @@ foreach my $action (@{ setting('job_prio')->{high} },
};
}
ajax '/ajax/control/admin/delete' => require_role admin => sub {
ajax qr{/ajax/control/admin/(?:\w+/)?delete} => require_role admin => sub {
send_error('Missing device', 400) unless param('device');
my $device = NetAddr::IP->new(param('device'));

View File

@@ -12,12 +12,6 @@ register_admin_task({
label => 'Duplicate Devices',
});
ajax '/ajax/control/admin/duplicatedevices/delete' => require_role admin => sub {
my $ip = NetAddr::IP::Lite->new(param('ip'));
send_error('Bad Request', 400) unless ($ip and $ip->addr ne '0.0.0.0');
forward '/ajax/control/admin/delete', { device => param('ip') };
};
ajax '/ajax/content/admin/duplicatedevices' => require_role admin => sub {
my @set = schema('netdisco')->resultset('Device')->search({
serial => { '-in' => schema('netdisco')->resultset('Device')->search({

View File

@@ -54,11 +54,6 @@ ajax '/ajax/control/admin/pseudodevice/add' => require_role admin => sub {
});
};
ajax '/ajax/control/admin/pseudodevice/del' => require_role admin => sub {
send_error('Bad Request', 400) unless _sanity_ok();
forward '/ajax/control/admin/delete', { device => param('ip') };
};
ajax '/ajax/control/admin/pseudodevice/update' => require_role admin => sub {
send_error('Bad Request', 400) unless _sanity_ok();

View File

@@ -56,7 +56,7 @@
<input id="nd_devdel-archive" type="checkbox" data-form="delete" name="archive">
<h4 class="nd_unbolden">Archive Nodes</h4>
</label>
<input type="hidden" data-form="delete" value="[% row.ip | html_entity %]" name="ip"/>
<input type="hidden" data-form="delete" value="[% row.ip | html_entity %]" name="device"/>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>

View File

@@ -45,13 +45,11 @@
<p class="text-info">
Pseudo-device &quot;[% row.dns | html_entity %] / [% row.ip | html_entity %]&quot; will be deleted.</p>
</blockquote>
<input data-form="del" name="dns" type="hidden" value="[% row.dns | html_entity %]">
<input data-form="del" name="ip" type="hidden" value="[% row.ip | html_entity %]">
<input data-form="del" name="ports" type="hidden" value="[% row.port_count | html_entity %]">
<input data-form="delete" name="device" type="hidden" value="[% row.ip | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
<button class="btn btn-danger nd_adminbutton" name="delete" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>