refactor(ui): move settings keys in the API response to a namespace

This commit is contained in:
Łukasz Mierzwa
2018-07-16 19:21:49 +02:00
parent 2ee239a74c
commit 801e76f9ae
2 changed files with 7 additions and 6 deletions

View File

@@ -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) {

View File

@@ -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();