From bd21797557ee2dbdbeb2cafd2d631adf7b7afc45 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 7 Aug 2022 23:10:12 +0100 Subject: [PATCH] more helpful message when no snapshot --- lib/App/Netdisco/Web/Plugin/Device/SNMP.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm b/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm index c15a4f10..7a3fdea4 100644 --- a/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm +++ b/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm @@ -123,6 +123,13 @@ sub _get_snmp_data { my ($ip, $base, $recurse) = @_; my @parts = grep {length} split m/\./, $base; + return [{ + text => 'No data for this device. You can request a snapshot in the Details tab.', + children => \0, + state => { disabled => \1 }, + icon => 'icon-search', + }] unless schema('netdisco')->resultset('DeviceSnapshot')->find($ip); + my %meta = map { ('.'. join '.', @{$_->{oid_parts}}) => $_ } schema('netdisco')->resultset('Virtual::FilteredSNMPObject') ->search({}, { bind => [