fix(ui): reset silenceID to null when creating silence from group

This commit is contained in:
Łukasz Mierzwa
2018-10-07 10:29:11 +01:00
parent 440122b23e
commit 89bcafda3c
2 changed files with 10 additions and 0 deletions

View File

@@ -148,6 +148,9 @@ class SilenceFormStore {
}
this.matchers = matchers;
// ensure that silenceID is nulled, since it's used to edit silences
// and this is used to silence groups
this.silenceID = null;
},
fillFormFromSilence(alertmanager, silence) {

View File

@@ -187,6 +187,13 @@ describe("SilenceFormStore.data", () => {
);
});
it("fillMatchersFromGroup() resets silenceID if set", () => {
store.data.silenceID = "12345";
const group = MockGroup();
store.data.fillMatchersFromGroup(group, [group.alerts[0]]);
expect(store.data.silenceID).toBeNull();
});
it("fillFormFromSilence() sets silenceID", () => {
const alertmanager = MockAlertmanager();
const silence = MockSilence();