add macwalk and arpnip buttons to device details
This commit is contained in:
@@ -4,6 +4,8 @@ use Dancer ':syntax';
|
|||||||
use Dancer::Plugin::Ajax;
|
use Dancer::Plugin::Ajax;
|
||||||
use Dancer::Plugin::DBIC;
|
use Dancer::Plugin::DBIC;
|
||||||
|
|
||||||
|
use Try::Tiny;
|
||||||
|
|
||||||
sub add_job {
|
sub add_job {
|
||||||
my ($jobtype, $device) = @_;
|
my ($jobtype, $device) = @_;
|
||||||
|
|
||||||
@@ -13,6 +15,8 @@ sub add_job {
|
|||||||
and $device->addr ne '0.0.0.0';
|
and $device->addr ne '0.0.0.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
# job might already be in the queue, so this could die
|
||||||
schema('netdisco')->resultset('Admin')->create({
|
schema('netdisco')->resultset('Admin')->create({
|
||||||
($device ? (device => $device->addr) : ()),
|
($device ? (device => $device->addr) : ()),
|
||||||
action => $jobtype,
|
action => $jobtype,
|
||||||
@@ -21,6 +25,7 @@ sub add_job {
|
|||||||
userip => request->remote_address,
|
userip => request->remote_address,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# we have a separate list for jobs needing a device to avoid queueing
|
# we have a separate list for jobs needing a device to avoid queueing
|
||||||
# such a job when there's no device param (it could still be duff, tho).
|
# such a job when there's no device param (it could still be duff, tho).
|
||||||
|
|||||||
@@ -99,7 +99,15 @@
|
|||||||
<td>
|
<td>
|
||||||
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/discover') %]">
|
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/discover') %]">
|
||||||
<input type="hidden" value="[% d.ip %]" name="device" type="text"/>
|
<input type="hidden" value="[% d.ip %]" name="device" type="text"/>
|
||||||
<button type="submit" class="btn btn-info btn-small">Rediscover</button>
|
<button type="submit" class="btn btn-info btn-small">Discover</button>
|
||||||
|
</form>
|
||||||
|
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/arpnip') %]">
|
||||||
|
<input type="hidden" value="[% d.ip %]" name="device" type="text"/>
|
||||||
|
<button type="submit" class="btn btn-info btn-small">Arpnip</button>
|
||||||
|
</form>
|
||||||
|
<form method="post" class="nd_inline-form" action="[% uri_for('/admin/macsuck') %]">
|
||||||
|
<input type="hidden" value="[% d.ip %]" name="device" type="text"/>
|
||||||
|
<button type="submit" class="btn btn-info btn-small">Macsuck</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user