change timescaledb to checkbox instead of select
This commit is contained in:
@@ -131,7 +131,7 @@ func (m *postgresMacroEngine) evaluateMacro(name string, args []string) (string,
|
||||
}
|
||||
}
|
||||
|
||||
if m.query.DataSource.JsonData.Get("timescaledb").MustString("auto") == "enabled" {
|
||||
if m.query.DataSource.JsonData.Get("timescaledb").MustBool() {
|
||||
return fmt.Sprintf("time_bucket('%vs',%s) AS time", interval.Seconds(), args[0]), nil
|
||||
} else {
|
||||
return fmt.Sprintf("floor(extract(epoch from %s)/%v)*%v AS time", args[0], interval.Seconds(), interval.Seconds()), nil
|
||||
|
||||
@@ -17,7 +17,7 @@ func TestMacroEngine(t *testing.T) {
|
||||
engine := newPostgresMacroEngine()
|
||||
query := &tsdb.Query{DataSource: &models.DataSource{JsonData: simplejson.New()}}
|
||||
queryTS := &tsdb.Query{DataSource: &models.DataSource{JsonData: simplejson.New()}}
|
||||
queryTS.DataSource.JsonData.Set("timescaledb", "enabled")
|
||||
queryTS.DataSource.JsonData.Set("timescaledb", true)
|
||||
|
||||
Convey("Given a time range between 2018-04-12 00:00 and 2018-04-12 00:05", func() {
|
||||
from := time.Date(2018, 4, 12, 18, 0, 0, 0, time.UTC)
|
||||
|
||||
Reference in New Issue
Block a user