Merge pull request #4031 from influxdata/log-viewer/default-source
If no current source for log viewer, use defaultpull/4037/head
commit
1ace31eb2d
|
@ -698,7 +698,7 @@ export const populateNamespacesAsync = (
|
||||||
|
|
||||||
if (namespaces && namespaces.length > 0) {
|
if (namespaces && namespaces.length > 0) {
|
||||||
dispatch(setNamespaces(namespaces))
|
dispatch(setNamespaces(namespaces))
|
||||||
if (source) {
|
if (source && source.telegraf) {
|
||||||
const defaultNamespace = namespaces.find(
|
const defaultNamespace = namespaces.find(
|
||||||
namespace => namespace.database === source.telegraf
|
namespace => namespace.database === source.telegraf
|
||||||
)
|
)
|
||||||
|
|
|
@ -146,7 +146,12 @@ class LogsPage extends Component<Props, State> {
|
||||||
|
|
||||||
public componentDidUpdate() {
|
public componentDidUpdate() {
|
||||||
if (!this.props.currentSource && this.props.sources.length > 0) {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue