Skip to content

Commit

Permalink
Merge pull request #528 from pyrra-dev/requests-graph-colors
Browse files Browse the repository at this point in the history
Match labels as lower case for colors
  • Loading branch information
metalmatze authored Nov 19, 2022
2 parents 7bd9bb0 + 3e828a1 commit 68d9851
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ui/src/components/graphs/RequestsGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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++
}
Expand All @@ -191,15 +192,15 @@ 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]
picked.blues++
}
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]
Expand Down

0 comments on commit 68d9851

Please sign in to comment.