Fix #710: overwrite invalid EntityMIB parents
Check the obtained EntityMIB tree for invalid parents, and reassign these modules to the root of the tree so they don't end up invisible
This commit is contained in:
@@ -17,9 +17,22 @@ ajax '/ajax/content/device/modules' => require_login sub {
|
|||||||
->search_for_device($q) or send_error('Bad device', 400);
|
->search_for_device($q) or send_error('Bad device', 400);
|
||||||
my @set = $device->modules->search({}, {order_by => { -asc => [qw/parent class pos index/] }});
|
my @set = $device->modules->search({}, {order_by => { -asc => [qw/parent class pos index/] }});
|
||||||
|
|
||||||
|
|
||||||
# sort modules (empty set would be a 'no records' msg)
|
# sort modules (empty set would be a 'no records' msg)
|
||||||
my $results = &App::Netdisco::Util::Web::sort_modules( \@set );
|
my $results = &App::Netdisco::Util::Web::sort_modules( \@set );
|
||||||
return unless scalar %$results;
|
return unless scalar %$results;
|
||||||
|
use Data::Dumper;
|
||||||
|
#print STDERR "-----------\n"; print STDERR Dumper($results);
|
||||||
|
|
||||||
|
print STDERR "-----------\n";
|
||||||
|
print STDERR Dumper($results->{root}) ."\n";
|
||||||
|
print STDERR "-----------\n";
|
||||||
|
my $id = 1;
|
||||||
|
print STDERR Dumper($results->{$id}{module}->name) ."\n";
|
||||||
|
print STDERR Dumper($results->{$id}{module}->index) ."\n";
|
||||||
|
print STDERR Dumper($results->{$id}{module}->parent) ."\n";
|
||||||
|
print STDERR Dumper($results->{$id}->{children}) ."\n";
|
||||||
|
print STDERR "-----------\n";
|
||||||
|
|
||||||
content_type('text/html');
|
content_type('text/html');
|
||||||
template 'ajax/device/modules.tt', {
|
template 'ajax/device/modules.tt', {
|
||||||
|
|||||||
Reference in New Issue
Block a user