From 717a58a872cca7cc4e2e232688024393c059f6a8 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Mon, 17 Dec 2018 11:28:44 +0300 Subject: [PATCH] Fixed logs page crush on filter removing Closes #479 --- client/src/__locales/en.json | 3 ++- client/src/components/Logs/index.js | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index a9f9f75b..57aad1a6 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -125,5 +125,6 @@ "found_in_known_domain_db": "Found in the known domains database.", "category_label": "Category", "rule_label": "Rule", - "filter_label": "Filter" + "filter_label": "Filter", + "unknown_filter": "Unknown filter {{filterId}}" } \ No newline at end of file diff --git a/client/src/components/Logs/index.js b/client/src/components/Logs/index.js index 0daf8cac..6d1c9ac4 100644 --- a/client/src/components/Logs/index.js +++ b/client/src/components/Logs/index.js @@ -131,7 +131,14 @@ class Logs extends Component { } else { const filterItem = Object.keys(filters) .filter(key => filters[key].id === filterId); - filterName = filters[filterItem].name; + + if (typeof filterItem !== 'undefined' && typeof filters[filterItem] !== 'undefined') { + filterName = filters[filterItem].name; + } + + if (!filterName) { + filterName = t('unknown_filter', { filterId }); + } } }