Set time marker when user clicks bar in histogram

Co-authored-by: Alex Paxton <thealexpaxton@gmail.com>
Co-authored-by: Daniel Campbell <metalwhirlwind@gmail.com>
pull/3897/head
Alex P 2018-07-11 19:16:18 -07:00
parent 1215cb53cd
commit 0b08684d30
1 changed files with 14 additions and 0 deletions

View File

@ -250,6 +250,7 @@ class LogsPage extends PureComponent<Props, State> {
width={width}
height={height}
colorScale={colorForSeverity}
onBarClick={this.handleBarClick}
/>
)}
</AutoSizer>
@ -316,6 +317,19 @@ class LogsPage extends PureComponent<Props, State> {
this.props.executeQueriesAsync()
}
private handleBarClick = (group: BarGroup): void => {
const {data} = group
if (!data.length) {
return
}
const unixTimestamp = data[0].time
const timeOption = moment(unixTimestamp).toISOString()
this.handleSetTimeMarker({timeOption})
}
private handleSetTimeBounds = async () => {
const {seconds, windowOption, timeOption} = this.props.timeRange
let lower = `now() - ${windowOption}`