From aa30ccf61abc55f969b78f5b98e22fc9012801c6 Mon Sep 17 00:00:00 2001 From: Christopher Henn Date: Thu, 31 May 2018 11:16:11 -0700 Subject: [PATCH] Only show sidebar if multiple results Co-authored-by: Andrew Watkins Co-authored-by: Chris Henn --- ui/src/ifql/components/TimeMachineVis.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/src/ifql/components/TimeMachineVis.tsx b/ui/src/ifql/components/TimeMachineVis.tsx index f05d0385ad..594afeb690 100644 --- a/ui/src/ifql/components/TimeMachineVis.tsx +++ b/ui/src/ifql/components/TimeMachineVis.tsx @@ -25,7 +25,7 @@ class TimeMachineVis extends PureComponent { } public componentDidUpdate(__, prevState) { - if (prevState.selectedResultID === null) { + if (!this.selectedResult) { this.setState({selectedResultID: this.initialResultID}) } } @@ -33,7 +33,7 @@ class TimeMachineVis extends PureComponent { public render() { return (
- {this.hasResults && ( + {this.showSidebar && ( { } } + private get showSidebar(): boolean { + return this.props.data.length > 1 + } + private get hasResults(): boolean { return !!this.props.data.length }