diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.js index 54338edc4..eadb02bdd 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.js @@ -4,6 +4,8 @@ import PropTypes from "prop-types"; import { action, observable } from "mobx"; import { observer } from "mobx-react"; +import hash from "object-hash"; + import { Manager, Reference, Popper } from "react-popper"; import onClickOutside from "react-onclickoutside"; @@ -42,6 +44,19 @@ const MenuContent = onClickOutside( > Silence this alert +
Alert source links:
+ {alert.alertmanager.map(am => ( + + {am.name} + + ))} ); } @@ -84,12 +99,16 @@ const AlertMenu = observer( render() { const { group, alert, silenceFormStore } = this.props; + const uniqueClass = `components-grid-alert-${group.id}-${hash( + alert.labels + )}`; + return ( {({ ref }) => ( )} diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.test.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.test.js index fe1d72076..963e67be6 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.test.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/AlertMenu.test.js @@ -74,4 +74,10 @@ describe("", () => { 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"); + }); }); diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/__snapshots__/index.test.js.snap b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/__snapshots__/index.test.js.snap index cb879ad25..22eb955a9 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/__snapshots__/index.test.js.snap +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/__snapshots__/index.test.js.snap @@ -42,7 +42,7 @@ exports[` matches snapshot with showAlertmanagers=false showReceiver=fa hidden -