Merge pull request #4031 from influxdata/log-viewer/default-source

If no current source for log viewer, use default
pull/4037/head
Brandon Farmer 2018-07-26 13:23:17 -07:00 committed by GitHub
commit 1ace31eb2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -698,7 +698,7 @@ export const populateNamespacesAsync = (
if (namespaces && namespaces.length > 0) {
dispatch(setNamespaces(namespaces))
if (source) {
if (source && source.telegraf) {
const defaultNamespace = namespaces.find(
namespace => namespace.database === source.telegraf
)

View File

@ -146,7 +146,12 @@ class LogsPage extends Component<Props, State> {
public componentDidUpdate() {
if (!this.props.currentSource && this.props.sources.length > 0) {
this.props.getSource(this.props.sources[0].id)
const source =
this.props.sources.find(src => {
return src.default
}) || this.props.sources[0]
this.props.getSource(source.id)
}
}