Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions frontend/src/scenes/trends/ActionFilter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { Component } from 'react'
import { CloseButton, selectStyle, Card } from '../../lib/utils'
import { CloseButton } from '../../lib/utils'
import { Dropdown } from '../../lib/components/Dropdown'
import { ActionSelectBox } from './ActionSelectBox'
import { Link } from 'react-router-dom'

export class ActionFilter extends Component {
constructor(props) {
Expand Down Expand Up @@ -104,7 +105,7 @@ export class ActionFilter extends Component {
render() {
let { actions } = this.props
let { actionFilters } = this.state
return actions ? (
return actions && actions.length > 0 ? (
<div>
{actionFilters &&
actionFilters.map((action_filter, index) => {
Expand Down Expand Up @@ -133,6 +134,11 @@ export class ActionFilter extends Component {
Add action
</button>
</div>
) : null
) : (
<div>
You don't have any actions defined yet.{' '}
<Link to="/action">Click here to define an action.</Link>
</div>
)
}
}
2 changes: 1 addition & 1 deletion frontend/src/scenes/trends/ActionsGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ActionsGraph extends Component {
}
fetchActions() {
api.get('api/action').then(actions => {
if (!this.state.filters.actions)
if (!this.state.filters.actions && actions.results.length > 0)
this.setFilters({
actions: [
{ id: actions.results[actions.results.length - 1].id },
Expand Down