Fix quoting around timeStamps. Affects server code.

pull/1681/head
Hunter Trujillo 2017-07-10 15:33:48 -06:00
parent eac7452be1
commit 6f572c7504
3 changed files with 9 additions and 7 deletions

View File

@ -170,7 +170,7 @@ func (t BasicTemplateVar) String() string {
switch t.Values[0].Type {
case "tagKey", "fieldKey", "measurement", "database":
return `"` + t.Values[0].Value + `"`
case "tagValue":
case "tagValue", "timeStamp":
return `'` + t.Values[0].Value + `'`
case "csv", "constant":
return t.Values[0].Value

View File

@ -248,6 +248,7 @@ class DashboardPage extends Component {
const {
source,
timeRange,
timeRange: {lower, upper},
showTemplateControlBar,
dashboards,
autoRefresh,
@ -259,16 +260,17 @@ class DashboardPage extends Component {
params: {sourceID},
} = this.props
const {lower, upper} = quoteIfTimestamp(timeRange)
const lowerType = lower && lower.includes('Z') ? 'timeStamp' : 'constant'
const upperType = upper && upper.includes('Z') ? 'timeStamp' : 'constant'
const dashboardTime = {
id: 'dashtime',
tempVar: ':dashboardTime:',
type: 'constant',
type: lowerType,
values: [
{
value: lower,
type: 'constant',
type: lowerType,
selected: true,
},
],
@ -277,11 +279,11 @@ class DashboardPage extends Component {
const upperDashboardTime = {
id: 'upperdashtime',
tempVar: ':upperDashboardTime:',
type: 'constant',
type: upperType,
values: [
{
value: upper || 'now()',
type: 'constant',
type: upperType,
selected: true,
},
],

View File

@ -19,7 +19,7 @@ export const quoteIfTimestamp = ({lower, upper}) => {
export default function buildInfluxQLQuery(timeBounds, config) {
const {groupBy, tags, areTagsAccepted} = config
const {upper, lower} = timeBounds
const {upper, lower} = quoteIfTimestamp(timeBounds)
const select = _buildSelect(config)
if (select === null) {