From 3e828a14bc411c7067b1d6320ea8d42ba069473f Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Sat, 19 Nov 2022 14:21:50 +0100 Subject: [PATCH] Match labels as lower case for colors --- ui/src/components/graphs/RequestsGraph.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/src/components/graphs/RequestsGraph.tsx b/ui/src/components/graphs/RequestsGraph.tsx index 67dafe7b3..c62a29734 100644 --- a/ui/src/components/graphs/RequestsGraph.tsx +++ b/ui/src/components/graphs/RequestsGraph.tsx @@ -176,12 +176,13 @@ const RequestsGraph = ({ } const labelColor = (picked: {[color: string]: number}, label: string): string => { + label = label.toLowerCase() let color = '' if (label === '{}') { color = greens[picked.greens % greens.length] picked.greens++ } - if (label.match(/"(2\d{2}|2\w{2}|OK|NOERROR)"/) != null) { + if (label.match(/"(2\d{2}|2\w{2}|ok|noerror|hit)"/) != null) { color = greens[picked.greens % greens.length] picked.greens++ } @@ -191,7 +192,7 @@ const labelColor = (picked: {[color: string]: number}, label: string): string => } if ( label.match( - /"(4\d{2}|4\w{2}|Canceled|InvalidArgument|NotFound|AlreadyExists|PermissionDenied|Unauthenticated|ResourceExhausted|FailedPrecondition|Aborted|OutOfRange|NXDOMAIN|REFUSED)"/, + /"(4\d{2}|4\w{2}|canceled|invalidargument|notfound|alreadyexists|permissiondenied|unauthenticated|resourceexhausted|failedprecondition|aborted|outofrange|nxdomain|refused)"/, ) != null ) { color = blues[picked.blues % blues.length] @@ -199,7 +200,7 @@ const labelColor = (picked: {[color: string]: number}, label: string): string => } if ( label.match( - /"(5\d{2}|5\w{2}|Unknown|DeadlineExceeded|Unimplemented|Internal|Unavailable|DataLoss|SERVFAIL)"/, + /"(5\d{2}|5\w{2}|unknown|deadlineexceeded|unimplemented|internal|unavailable|dataloss|servfail|miss)"/, ) != null ) { color = reds[picked.reds % reds.length]