diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/index.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/index.js index 809d433bd..dd141e368 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/index.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Alert/index.js @@ -50,6 +50,7 @@ const Alert = observer( key={a.name} name={a.name} value={a.value} + visible={a.visible} afterUpdate={afterUpdate} /> ))} diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js index 2742cef7e..70eae7ec5 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.js @@ -1,7 +1,7 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; -import { observable, action, toJS } from "mobx"; +import { observable, action } from "mobx"; import { observer, inject } from "mobx-react"; import Linkify from "react-linkify"; @@ -20,6 +20,7 @@ const RenderNonLinkAnnotation = inject("alertStore")( alertStore: PropTypes.object.isRequired, name: PropTypes.string.isRequired, value: PropTypes.string.isRequired, + visible: PropTypes.bool.isRequired, afterUpdate: PropTypes.func.isRequired }; @@ -45,7 +46,7 @@ const RenderNonLinkAnnotation = inject("alertStore")( constructor(props) { super(props); - this.toggle.visible = this.isVisible(); + this.toggle.visible = props.visible; } componentDidUpdate() { @@ -54,34 +55,6 @@ const RenderNonLinkAnnotation = inject("alertStore")( afterUpdate(); } - // determinate if this annotation should be hidden by default or not - isVisible() { - const { alertStore, name } = this.props; - - const annotationsHidden = toJS( - alertStore.settings.values.annotationsHidden - ); - const isInHidden = - annotationsHidden !== null && annotationsHidden.indexOf(name) >= 0; - - const annotationsVisible = toJS( - alertStore.settings.values.annotationsVisible - ); - const isInVisible = - annotationsVisible !== null && annotationsVisible.indexOf(name) >= 0; - - if (isInVisible) return true; - - if ( - toJS(alertStore.settings.values.annotationsDefaultHidden) === true || - isInHidden === true - ) { - return false; - } - - return true; - } - render() { const { name, value } = this.props; diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.js index 8fa48fef5..9ba34c336 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/index.js @@ -28,6 +28,7 @@ const GroupFooter = observer( key={a.name} name={a.name} value={a.value} + visible={a.visible} afterUpdate={afterUpdate} /> ))}