From 028dd78291fb7f630d42b22759b86a1b018380c5 Mon Sep 17 00:00:00 2001
From: Arun Swaminathan <arunswaminathan94@gmail.com>
Date: Mon, 15 Oct 2018 22:43:22 -0400
Subject: #3312 Change colors according to HTTP status code

---
 web/src/js/components/FlowTable/FlowColumns.jsx | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

(limited to 'web/src/js/components/FlowTable/FlowColumns.jsx')

diff --git a/web/src/js/components/FlowTable/FlowColumns.jsx b/web/src/js/components/FlowTable/FlowColumns.jsx
index e60ed487..d16bdad2 100644
--- a/web/src/js/components/FlowTable/FlowColumns.jsx
+++ b/web/src/js/components/FlowTable/FlowColumns.jsx
@@ -90,8 +90,26 @@ MethodColumn.headerClass = 'col-method'
 MethodColumn.headerName = 'Method'
 
 export function StatusColumn({ flow }) {
+    let color = 'darkred';
+
+    if (100 <= flow.response.status_code && flow.response.status_code < 200) {
+        color = 'green'
+    }
+    else if (200 <= flow.response.status_code && flow.response.status_code < 300) {
+        color = 'darkgreen'
+    }
+    else if (300 <= flow.response.status_code && flow.response.status_code < 400) {
+        color = 'lightblue'
+    }
+    else if (400 <= flow.response.status_code && flow.response.status_code < 500) {
+        color = 'lightred'
+    }
+    else if (500 <= flow.response.status_code && flow.response.status_code < 600) {
+        color = 'lightred'
+    }
+
     return (
-        <td className="col-status">{flow.response && flow.response.status_code}</td>
+        <td className="col-status" style={{color: color}}>{flow.response && flow.response.status_code}</td>
     )
 }
 
-- 
cgit v1.2.3


From c1184176e763461267b16643445a815b047e902f Mon Sep 17 00:00:00 2001
From: Arun Swaminathan <arunswaminathan94@gmail.com>
Date: Sat, 20 Oct 2018 04:04:55 -0400
Subject: Check for null flow response when changing color

---
 web/src/js/components/FlowTable/FlowColumns.jsx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'web/src/js/components/FlowTable/FlowColumns.jsx')

diff --git a/web/src/js/components/FlowTable/FlowColumns.jsx b/web/src/js/components/FlowTable/FlowColumns.jsx
index d16bdad2..07b54a32 100644
--- a/web/src/js/components/FlowTable/FlowColumns.jsx
+++ b/web/src/js/components/FlowTable/FlowColumns.jsx
@@ -92,19 +92,19 @@ MethodColumn.headerName = 'Method'
 export function StatusColumn({ flow }) {
     let color = 'darkred';
 
-    if (100 <= flow.response.status_code && flow.response.status_code < 200) {
+    if (flow.response !== null && 100 <= flow.response.status_code && flow.response.status_code < 200) {
         color = 'green'
     }
-    else if (200 <= flow.response.status_code && flow.response.status_code < 300) {
+    else if (flow.response !== null && 200 <= flow.response.status_code && flow.response.status_code < 300) {
         color = 'darkgreen'
     }
-    else if (300 <= flow.response.status_code && flow.response.status_code < 400) {
+    else if (flow.response !== null && 300 <= flow.response.status_code && flow.response.status_code < 400) {
         color = 'lightblue'
     }
-    else if (400 <= flow.response.status_code && flow.response.status_code < 500) {
+    else if (flow.response !== null && 400 <= flow.response.status_code && flow.response.status_code < 500) {
         color = 'lightred'
     }
-    else if (500 <= flow.response.status_code && flow.response.status_code < 600) {
+    else if (flow.response !== null && 500 <= flow.response.status_code && flow.response.status_code < 600) {
         color = 'lightred'
     }
 
-- 
cgit v1.2.3

