From dbd8c0573df6ad2282faf7ab232bc092944e4dc2 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Wed, 29 Jun 2016 10:06:03 -0400 Subject: [PATCH] Ticket 47538 - repl-monitor.pl legend not properly sorted Description: Custom color codes/lowmarks were not properly sorted and led to the HTML legend being out of order. Also, made the "unknown" lag time color code consistent. https://fedorahosted.org/389/ticket/47538 Reviewed by: ? --- ldap/admin/src/scripts/repl-monitor.pl.in | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/ldap/admin/src/scripts/repl-monitor.pl.in b/ldap/admin/src/scripts/repl-monitor.pl.in index 248cf8b..aa7ab1e 100755 --- a/ldap/admin/src/scripts/repl-monitor.pl.in +++ b/ldap/admin/src/scripts/repl-monitor.pl.in @@ -364,7 +364,7 @@ sub read_cfg_file $allcolors {5} = "#ffffcc"; #cream yellow $allcolors {60} = "#ffcccc"; #pale pink } - @colorkeys = sort (keys (%allcolors)); + @colorkeys = sort ({ $a <=> $b } keys (%allcolors)); return 0; } @@ -968,18 +968,10 @@ sub cacl_time_lag $supplier_csn_str = &to_string_csn ($s_maxcsn); $csn_str = &to_string_csn ($c_maxcsn); - if ((!$s_maxcsn || $s_maxcsn eq "Unavailable") && - (!$c_maxcsn || $c_maxcsn eq "Unavailable")) { + if (!$s_maxcsn || $s_maxcsn eq "Unavailable" || + !$c_maxcsn || $c_maxcsn eq "Unavailable") { $lag_str = "?:??:??"; - $markcolor = "white"; # Both unknown - } - elsif ($s_maxcsn && (!$c_maxcsn || $c_maxcsn eq "Unavailable")) { - $lag_str = "- ?:??:??"; - $markcolor = &get_color (36000); # assume consumer has big latency - } - elsif ((!$s_maxcsn || $s_maxcsn eq "Unavailable") && $c_maxcsn) { - $lag_str = "+ ?:??:??"; - $markcolor = &get_color (1); # consumer is ahead of supplier + $markcolor = "white"; # True status unknown } elsif ($s_maxcsn le $c_maxcsn) { $lag_str = "0:00:00"; @@ -1232,7 +1224,7 @@ sub get_color $lag_minute /= 60; my ($color) = $allcolors { $colorkeys[0] }; - foreach ( sort keys %allcolors) { + foreach ( sort { $a <=> $b } keys %allcolors) { if ($lag_minute >= $_){ $color = $allcolors {$_}; } -- 2.4.11