Prevent rendering of empty UL tag

pull/2252/head
Alex P 2017-09-25 17:07:00 -07:00 committed by deniz kusefoglu
parent 6d7307cdd4
commit 5bec42cc03
1 changed files with 21 additions and 16 deletions

View File

@ -56,6 +56,7 @@ class RuleMessage extends Component {
render() {
const {rule, actions, enabledAlerts} = this.props
const {endpointsOnThisAlert} = this.state
const defaultAlertEndpoints = DEFAULT_ALERTS.map(text => {
return {text, kind: text, ruleID: rule.id}
})
@ -75,22 +76,26 @@ class RuleMessage extends Component {
<div className="rule-section--body">
<div className="rule-section--row rule-section--row-first rule-section--border-bottom">
<p>Send this Alert to:</p>
<ul className="nav nav-tablist nav-tablist-sm nav-tablist-malachite">
{this.state.endpointsOnThisAlert
.filter(alert => _.get(RULE_ALERT_OPTIONS, alert.kind, false)) // / TODO this looks like a problem
.map(alert =>
<li
key={uuid.v4()}
className={classnames({
active: alert.text === selectedAlertNodeName,
})}
onClick={this.handleChooseAlert(alert)}
>
{alert.text}
<div className="nav-tab--delete" />
</li>
)}
</ul>
{endpointsOnThisAlert.length
? <ul className="nav nav-tablist nav-tablist-sm nav-tablist-malachite">
{endpointsOnThisAlert
.filter(alert =>
_.get(RULE_ALERT_OPTIONS, alert.kind, false)
) // / TODO this looks like a problem
.map(alert =>
<li
key={uuid.v4()}
className={classnames({
active: alert.text === selectedAlertNodeName,
})}
onClick={this.handleChooseAlert(alert)}
>
{alert.text}
<div className="nav-tab--delete" />
</li>
)}
</ul>
: null}
<Dropdown
items={alerts}
menuClass="dropdown-malachite"