From 801e76f9ae24d576956c8de3cc9675f54c487cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Mon, 16 Jul 2018 19:21:49 +0200 Subject: [PATCH] refactor(ui): move settings keys in the API response to a namespace --- ui/src/Components/Labels/BaseLabel/index.js | 2 +- ui/src/Stores/AlertStore.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/src/Components/Labels/BaseLabel/index.js b/ui/src/Components/Labels/BaseLabel/index.js index d7fdc1aa3..40ecdfc14 100644 --- a/ui/src/Components/Labels/BaseLabel/index.js +++ b/ui/src/Components/Labels/BaseLabel/index.js @@ -24,7 +24,7 @@ class BaseLabel extends Component { isStaticColorLabel(name) { const { alertStore } = this.props; - return alertStore.staticColorLabels.values.includes(name); + return alertStore.settings.values.staticColorLabels.includes(name); } getColorClass(name, value) { diff --git a/ui/src/Stores/AlertStore.js b/ui/src/Stores/AlertStore.js index abceeadfe..32d55788d 100644 --- a/ui/src/Stores/AlertStore.js +++ b/ui/src/Stores/AlertStore.js @@ -117,13 +117,13 @@ class AlertStore { { name: "API response info" } ); - staticColorLabels = observable( + settings = observable( { - values: [] + values: { staticColorLabels: [] } }, {}, { - name: "List of labels with static color" + name: "Global settings" } ); @@ -247,8 +247,9 @@ class AlertStore { } } - if (!equal(this.staticColorLabels, result.staticColorLabels)) { - this.staticColorLabels.values = result.staticColorLabels; + // settings exported via API + if (!equal(this.settings, result.settings)) { + this.settings.values = result.settings; } this.status.setIdle();