From 1178c6eea02e8fb07536a8196a4a7dbfeb95826b Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Thu, 4 Aug 2022 23:04:59 +0100 Subject: [PATCH] do not open branch if there is no data, even when only one child --- lib/App/Netdisco/Web/Plugin/Device/SNMP.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm b/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm index dbdc5567..7bd1f53e 100644 --- a/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm +++ b/lib/App/Netdisco/Web/Plugin/Device/SNMP.pm @@ -149,7 +149,8 @@ sub _get_snmp_data { children => ($meta{$_}->{num_children} ? \1 : \0), # and set the display to open to show the single child - state => { opened => (($meta{$_}->{num_children} == 1) ? \1 : \0 ) }, + # but only if there is data below + state => { opened => (($meta{$_}->{browser} and $meta{$_}->{num_children} == 1) ? \1 : \0 ) }, }} sort {$meta{$a}->{oid_parts}->[-1] <=> $meta{$b}->{oid_parts}->[-1]} keys %meta;