first suggest a snapshot, then loadmibs

This commit is contained in:
Oliver Gorwits
2022-08-08 17:23:50 +01:00
parent 5265e0403d
commit 5d5e36b5fd

View File

@@ -36,13 +36,6 @@ ajax '/ajax/data/device/:ip/snmptree/:base' => require_login sub {
content_type 'application/json';
return to_json [{
text => 'No MIB data. Please run `~/bin/netdisco-do loadmibs`.',
children => \0,
state => { disabled => \1 },
icon => 'icon-search',
}] unless schema('netdisco')->resultset('SNMPObject')->count();
return to_json [{
text => 'No data for this device. You can request a snapshot in the Details tab.',
children => \0,
@@ -50,6 +43,13 @@ ajax '/ajax/data/device/:ip/snmptree/:base' => require_login sub {
icon => 'icon-search',
}] unless schema('netdisco')->resultset('DeviceSnapshot')->find($device->ip);
return to_json [{
text => 'No MIB data. Please run `~/bin/netdisco-do loadmibs`.',
children => \0,
state => { disabled => \1 },
icon => 'icon-search',
}] unless schema('netdisco')->resultset('SNMPObject')->count();
my $items = _get_snmp_data($device->ip, $base);
to_json $items;
};