From 51b9b48aab9dce5137563bba5894424bcc792014 Mon Sep 17 00:00:00 2001 From: Hunter Trujillo Date: Fri, 30 Jun 2017 17:34:07 -0600 Subject: [PATCH] Fix for Hostpage. --- ui/src/hosts/containers/HostPage.js | 10 +++++++--- ui/src/shared/components/LayoutRenderer.js | 12 +++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ui/src/hosts/containers/HostPage.js b/ui/src/hosts/containers/HostPage.js index 3d474bd94d..17769b0205 100644 --- a/ui/src/hosts/containers/HostPage.js +++ b/ui/src/hosts/containers/HostPage.js @@ -98,9 +98,13 @@ export const HostPage = React.createClass({ this.setState({layouts: filteredLayouts, hosts: filteredHosts}) // eslint-disable-line react/no-did-mount-set-state }, - handleChooseTimeRange({lower}) { - const timeRange = timeRanges.find(range => range.lower === lower) - this.setState({timeRange}) + handleChooseTimeRange({lower, upper}) { + if (upper) { + this.setState({timeRange: {lower, upper}}) + } else { + const timeRange = timeRanges.find(range => range.lower === lower) + this.setState({timeRange}) + } }, synchronizer(dygraph) { diff --git a/ui/src/shared/components/LayoutRenderer.js b/ui/src/shared/components/LayoutRenderer.js index c3af31d29d..7e0aef58b7 100644 --- a/ui/src/shared/components/LayoutRenderer.js +++ b/ui/src/shared/components/LayoutRenderer.js @@ -42,13 +42,19 @@ class LayoutRenderer extends Component { } buildQueryForOldQuerySchema(q) { - const {timeRange: {lower}, host} = this.props - const {defaultGroupBy} = timeRanges.find(range => range.lower === lower) + const {timeRange: {lower, upper}, host} = this.props + const {defaultGroupBy} = timeRanges.find( + range => range.lower === lower + ) || {defaultGroupBy: '5m'} const {wheres, groupbys} = q let text = q.text - text += ` where time > ${lower}` + if (upper) { + text += ` where time > '${lower}' AND time < '${upper}'` + } else { + text += ` where time > ${lower}` + } if (host) { text += ` and \"host\" = '${host}'`