feat(ui): add source links in the alert action menu

This commit is contained in:
Łukasz Mierzwa
2018-09-08 23:28:10 +01:00
parent 83c9c9c6d9
commit 7da2c66200
2 changed files with 19 additions and 0 deletions

View File

@@ -42,6 +42,19 @@ const MenuContent = onClickOutside(
>
<FontAwesomeIcon icon={faBellSlash} /> Silence this alert
</div>
<h6 className="dropdown-header">Alert source links:</h6>
{alert.alertmanager.map(am => (
<a
key={am.name}
className="dropdown-item"
href={am.source}
target="_blank"
rel="noopener noreferrer"
onClick={afterClick}
>
{am.name}
</a>
))}
</div>
);
}

View File

@@ -74,4 +74,10 @@ describe("<MenuContent />", () => {
button.simulate("click");
expect(silenceFormStore.toggle.visible).toBe(true);
});
it("source link points at alert source", () => {
const tree = MountedMenuContent(group);
const link = tree.find("a.dropdown-item[href='localhost/prometheus']");
expect(link.text()).toBe("default");
});
});