From c0edb03bb4bd9380be4b0272ef7b056aaa9e5554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 30 Aug 2018 20:03:22 +0100 Subject: [PATCH] Revert "fix(ui): remove dead code" This reverts commit e795cbf3e9f758f694c33013547dec1c510e4d38. This code updates filters, so it's needed, it's just the final check that's not. --- ui/src/Stores/AlertStore.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/ui/src/Stores/AlertStore.js b/ui/src/Stores/AlertStore.js index 6d0a4c6e0..9166d85db 100644 --- a/ui/src/Stores/AlertStore.js +++ b/ui/src/Stores/AlertStore.js @@ -238,6 +238,32 @@ class AlertStore { return; } + for (const filter of result.filters) { + const storedIndex = this.filters.values.findIndex( + f => f.raw === filter.text + ); + if (storedIndex >= 0) { + this.filters.values[storedIndex] = Object.assign( + this.filters.values[storedIndex], + { + applied: true, + isValid: filter.isValid, + hits: filter.hits, + name: filter.name, + matcher: filter.matcher, + value: filter.value + } + ); + } else { + console.warn( + `Got response with filter ${ + filter.text + } which isn't one of applied filters, ignoring` + ); + return; + } + } + let updates = {}; // update data dicts if they changed for (const key of [