Only show sidebar if multiple results

Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com>
Co-authored-by: Chris Henn <chris.henn@influxdata.com>
pull/10616/head
Christopher Henn 2018-05-31 11:16:11 -07:00 committed by Andrew Watkins
parent 9b4654c76f
commit aa30ccf61a
1 changed files with 6 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class TimeMachineVis extends PureComponent<Props, State> {
}
public componentDidUpdate(__, prevState) {
if (prevState.selectedResultID === null) {
if (!this.selectedResult) {
this.setState({selectedResultID: this.initialResultID})
}
}
@ -33,7 +33,7 @@ class TimeMachineVis extends PureComponent<Props, State> {
public render() {
return (
<div className="time-machine-visualization" style={this.style}>
{this.hasResults && (
{this.showSidebar && (
<TableSidebar
data={this.props.data}
selectedResultID={this.state.selectedResultID}
@ -64,6 +64,10 @@ class TimeMachineVis extends PureComponent<Props, State> {
}
}
private get showSidebar(): boolean {
return this.props.data.length > 1
}
private get hasResults(): boolean {
return !!this.props.data.length
}