chore(ui): update UI to consume cluster list as a dict

This commit is contained in:
Łukasz Mierzwa
2018-11-30 23:22:16 +00:00
parent 8b5862d44b
commit ffa446e8f6
4 changed files with 7 additions and 7 deletions

View File

@@ -69,7 +69,7 @@ beforeEach(() => {
clusterMembers: ["default"]
}
],
clusters: [["default"]]
clusters: { default: ["default"] }
};
alertStore.data.silences = {
default: {

View File

@@ -102,7 +102,7 @@ const AlertGrid = observer(
key={id}
group={alertStore.data.groups[id]}
showAlertmanagers={
alertStore.data.upstreams.clusters.length > 1
Object.keys(alertStore.data.upstreams.clusters).length > 1
}
afterUpdate={this.masonryRepack}
settingsStore={settingsStore}

View File

@@ -59,7 +59,7 @@ const MockGroupList = count => {
alertStore.data.upstreams = {
counters: { total: 0, healthy: 1, failed: 0 },
instances: [{ name: "am", uri: "http://am", error: "" }],
clusters: [["am"]]
clusters: { am: ["am"] }
};
alertStore.data.groups = groups;
};

View File

@@ -37,7 +37,7 @@ describe("<Grid />", () => {
alertStore.data.upstreams = {
counters: { total: 1, healthy: 0, failed: 1 },
instances: [{ name: "am1", uri: "http://am1", error: "error" }],
clusters: [["am1"]]
clusters: { am1: ["am1"] }
};
const tree = ShallowGrid();
expect(tree.text()).toBe("<FatalError />");
@@ -47,7 +47,7 @@ describe("<Grid />", () => {
alertStore.data.upstreams = {
counters: { total: 1, healthy: 0, failed: 1 },
instances: [{ name: "am1", uri: "http://am1", error: "" }],
clusters: [["am1"]]
clusters: { am1: ["am1"] }
};
const tree = ShallowGrid();
expect(tree.text()).toBe("<AlertGrid />");
@@ -61,7 +61,7 @@ describe("<Grid />", () => {
{ name: "am2", uri: "file:///mock", error: "" },
{ name: "am3", uri: "http://am1", error: "error 2" }
],
clusters: [["am1"], ["am2"], ["am3"]]
clusters: { am1: ["am1"], am2: ["am2"], am3: ["am3"] }
};
const tree = ShallowGrid();
expect(tree.text()).toBe("<UpstreamError /><UpstreamError /><AlertGrid />");
@@ -72,7 +72,7 @@ describe("<Grid />", () => {
alertStore.data.upstreams = {
counters: { total: 0, healthy: 0, failed: 1 },
instances: [{ name: "am", uri: "http://am1", error: "error" }],
clusters: [["am"]]
clusters: { am1: ["am1"] }
};
const tree = ShallowGrid();
expect(tree.text()).toBe("<FatalError />");