Only query database for select lists when they will be used by the report
This commit is contained in:
		| @@ -8,14 +8,20 @@ get '/report/*' => require_login sub { | ||||
|     my ($tag) = splat; | ||||
|  | ||||
|     # used in the report search sidebar to populate select inputs | ||||
|     my $domain_list | ||||
|         = [ | ||||
|         schema('netdisco')->resultset('NodeNbt')->get_distinct_col('domain') | ||||
|         ]; | ||||
|     my $class_list = [ schema('netdisco')->resultset('DeviceModule') | ||||
|             ->get_distinct_col('class') ]; | ||||
|     my $ssid_list = [ schema('netdisco')->resultset('DevicePortSsid') | ||||
|             ->get_distinct_col('ssid') ]; | ||||
|     my ( $domain_list, $class_list, $ssid_list ); | ||||
|  | ||||
|     if ( $tag eq 'netbios' ) { | ||||
|         $domain_list = [ schema('netdisco')->resultset('NodeNbt') | ||||
|                 ->get_distinct_col('domain') ]; | ||||
|     } | ||||
|     elsif ( $tag eq 'moduleinventory' ) { | ||||
|         $class_list = [ schema('netdisco')->resultset('DeviceModule') | ||||
|                 ->get_distinct_col('class') ]; | ||||
|     } | ||||
|     elsif ( $tag eq 'portssid' ) { | ||||
|         $ssid_list = [ schema('netdisco')->resultset('DevicePortSsid') | ||||
|                 ->get_distinct_col('ssid') ]; | ||||
|     } | ||||
|  | ||||
|     # trick the ajax into working as if this were a tabbed page | ||||
|     params->{tab} = $tag; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user