From 240d2ea02d1b908824f5089fb0d4282833a5c615 Mon Sep 17 00:00:00 2001 From: JayCG Date: Sun, 1 Apr 2018 01:49:33 +0100 Subject: [PATCH 1/3] Added Status const & text search Signed-off-by: JayCG --- src/components/QueryLog.js | 41 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/components/QueryLog.js b/src/components/QueryLog.js index bcfedc2..b10895c 100644 --- a/src/components/QueryLog.js +++ b/src/components/QueryLog.js @@ -17,7 +17,7 @@ export default class QueryLog extends Component { updateHandler = null; state = { history: [], - loading: true + loading: true, }; constructor(props) { @@ -71,6 +71,14 @@ export default class QueryLog extends Component { } } +const status = { + "1": "Blocked", + "2": "Allowed (forwarded)", + "3": "Allowed (cached)", + "4": "Blocked (wildcard)", + "5": "Blocked (blacklist)" +}; + const columns = [ { Header: "Time", @@ -104,26 +112,17 @@ const columns = [ className: "horizontal-scroll" }, { - Header: "Status", - id: "status", - accessor: r => r[4], - width: 140, - Cell: row => { - switch(row.value) { - case 1: - return "Blocked"; - case 2: - return "Allowed (forwarded)"; - case 3: - return "Allowed (cached)"; - case 4: - return "Blocked (wildcard)"; - case 5: - return "Blocked (blacklist)"; - default: - return "Unknown"; - } - } + Header: "Status", + id: "status", + accessor: r => r[4], + width: 140, + Cell: row => status[row.value], + filterMethod: (filter, row) => + status[row[filter.id]] + .toLowerCase() + .includes( + filter.value.toLowerCase() + ) }, { Header: "Action", From e14d0df4a027098ce00a735d4765c062f56d3f94 Mon Sep 17 00:00:00 2001 From: JayCG Date: Sun, 1 Apr 2018 01:59:05 +0100 Subject: [PATCH 2/3] Fixing typo comma Signed-off-by: JayCG --- src/components/QueryLog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/QueryLog.js b/src/components/QueryLog.js index b10895c..0250f7d 100644 --- a/src/components/QueryLog.js +++ b/src/components/QueryLog.js @@ -17,7 +17,7 @@ export default class QueryLog extends Component { updateHandler = null; state = { history: [], - loading: true, + loading: true }; constructor(props) { From 07bae9093f551498f1a11c8b39730f88f6d49af3 Mon Sep 17 00:00:00 2001 From: JayCG Date: Tue, 10 Apr 2018 18:28:53 +0100 Subject: [PATCH 3/3] Fixed indentation Signed-off-by: JayCG --- src/components/QueryLog.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/QueryLog.js b/src/components/QueryLog.js index 0250f7d..6f1f966 100644 --- a/src/components/QueryLog.js +++ b/src/components/QueryLog.js @@ -112,17 +112,17 @@ const columns = [ className: "horizontal-scroll" }, { - Header: "Status", - id: "status", - accessor: r => r[4], - width: 140, - Cell: row => status[row.value], - filterMethod: (filter, row) => - status[row[filter.id]] - .toLowerCase() - .includes( - filter.value.toLowerCase() - ) + Header: "Status", + id: "status", + accessor: r => r[4], + width: 140, + Cell: row => status[row.value], + filterMethod: (filter, row) => + status[row[filter.id]] + .toLowerCase() + .includes( + filter.value.toLowerCase() + ) }, { Header: "Action",