Skip to content

Commit

Permalink
main: sort hostgroups by number and name
Browse files Browse the repository at this point in the history
to avoid flickering if some groups have the same number
  • Loading branch information
sni committed Mar 23, 2023
1 parent 2fed8a1 commit 6033033
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Thruk/Controller/main.pm
Expand Up @@ -167,7 +167,7 @@ sub index {
}
}
my $top5_hg = [];
my @hashkeys_hg = sort { $hostgroups->{$b} <=> $hostgroups->{$a} } keys %{$hostgroups};
my @hashkeys_hg = sort { $hostgroups->{$b} <=> $hostgroups->{$a} || $a cmp $b } keys %{$hostgroups};
splice(@hashkeys_hg, 5) if scalar(@hashkeys_hg) > 5;
for my $key (@hashkeys_hg) {
push(@{$top5_hg}, { 'name' => $key, 'value' => $hostgroups->{$key} } )
Expand Down

0 comments on commit 6033033

Please sign in to comment.