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 464c2d83b..b86ba39b4 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 @@ -4,44 +4,58 @@ exports[` matches snapshot when inhibited 1`] = ` "
  • -
    - - +
    + - - - - help: - - - some long text - + + + + + help: + + + some long text + +
    -
    - - +
    + - - - hidden + + + + hidden +
    matches snapshot when inhibited 1`] = `
    @@ -92,7 +106,7 @@ exports[` matches snapshot when inhibited 1`] = `
    @@ -107,7 +121,7 @@ exports[` matches snapshot when inhibited 1`] = `
    @@ -148,44 +162,58 @@ exports[` matches snapshot with showAlertmanagers=false showReceiver=fa "
  • -
    - - +
    + - - - - help: - - - some long text - + + + + + help: + + + some long text + +
    -
    - - +
    + - - - hidden + + + + hidden +
    matches snapshot with showAlertmanagers=false showReceiver=fa
    @@ -228,7 +256,7 @@ exports[` matches snapshot with showAlertmanagers=false showReceiver=fa
    diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/__snapshots__/index.test.js.snap b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/__snapshots__/index.test.js.snap index f16c8350f..4f4798608 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/__snapshots__/index.test.js.snap +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/__snapshots__/index.test.js.snap @@ -28,49 +28,59 @@ exports[` matches snapshot 1`] = ` exports[` matches snapshot when visible=false 1`] = ` " -
    - - +
    + - - - foo + + + + foo +
    " `; exports[` matches snapshot when visible=true 1`] = ` " -
    - - +
    + - - - - foo: - - - some long text - + + + + + foo: + + + some long text + +
    " `; diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js index aa297d949..88fa805a9 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js @@ -12,6 +12,7 @@ import { faSearchPlus } from "@fortawesome/free-solid-svg-icons/faSearchPlus"; import { faSearchMinus } from "@fortawesome/free-solid-svg-icons/faSearchMinus"; import { AlertStore } from "Stores/AlertStore"; +import { TooltipWrapper } from "Components/TooltipWrapper"; import "./index.css"; @@ -36,8 +37,7 @@ const RenderNonLinkAnnotation = inject("alertStore")( this.visible = true; }, hide(e) { - // don't action link clicks inside Linkify - if (e.target.nodeName !== "A") this.visible = false; + this.visible = false; } }, { @@ -62,30 +62,41 @@ const RenderNonLinkAnnotation = inject("alertStore")( const { name, value } = this.props; const className = - "mr-1 mb-1 p-1 bg-light cursor-pointer d-inline-block rounded components-grid-annotation text-break"; + "mr-1 mb-1 p-1 bg-light d-inline-block rounded components-grid-annotation text-break"; if (!this.toggle.visible) { return ( -
    - - {name} -
    + +
    + + {name} +
    +
    ); } return ( -
    - - {name}: - - {value} - -
    + +
    + + {name}: + + {value} + +
    +
    ); } } diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js index cddd63457..098ad0fcb 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js @@ -98,27 +98,20 @@ describe("", () => { expect(link.text()).toBe("http://example.com"); }); - it("clicking on + icon hides the value", () => { + it("clicking on - icon hides the value", () => { const tree = MountedNonLinkAnnotation(true); expect(tree.html()).toMatch(/fa-search-minus/); expect(tree.html()).toMatch(/some long text/); - tree.find("div").simulate("click"); + tree.find(".fa-search-minus").simulate("click"); expect(tree.html()).toMatch(/fa-search-plus/); expect(tree.html()).not.toMatch(/some long text/); }); - it("clicking on a link inside annotation doesn't hide the value", () => { - const tree = MountedNonLinkAnnotationContainingLink(true); - expect(tree.html()).toMatch(/fa-search-minus/); - tree.find("a").simulate("click"); - expect(tree.html()).toMatch(/fa-search-minus/); - }); - - it("clicking on - icon shows the value", () => { + it("clicking on + icon shows the value", () => { const tree = MountedNonLinkAnnotation(false); expect(tree.html()).toMatch(/fa-search-plus/); expect(tree.html()).not.toMatch(/some long text/); - tree.find("div").simulate("click"); + tree.find(".components-grid-annotation").simulate("click"); expect(tree.html()).toMatch(/fa-search-minus/); expect(tree.html()).toMatch(/some long text/); }); diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap index eb12ad65a..f1b578125 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap @@ -4,50 +4,64 @@ exports[` matches snapshot 1`] = ` "