Skip to content

Commit

Permalink
allow rounding with round option both time filters: $from and $to
Browse files Browse the repository at this point in the history
  • Loading branch information
r.khavronenko committed Dec 13, 2017
1 parent 7cf5cf3 commit 7ca293a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.2.6 (2017-12-13)

# Fixes
* allow rounding with `round` option both time filters: $from and $to


# 1.2.5 (2017-12-05)

# Fixes
Expand Down
2 changes: 1 addition & 1 deletion dist/sql_query.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sql_query.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/sql_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export default class SqlQuery {
scanner = new Scanner(query),
dateTimeType = this.target.dateTimeType ? this.target.dateTimeType : 'DATETIME',
from = SqlQuery.convertTimestamp(SqlQuery.round(this.options.range.from, this.target.round)),
to = SqlQuery.convertTimestamp(this.options.range.to),
to = SqlQuery.convertTimestamp(SqlQuery.round(this.options.range.to, this.target.round)),
timeSeries = SqlQuery.getTimeSeries(dateTimeType),
timeFilter = SqlQuery.getTimeFilter(this.options.rangeRaw.to === 'now', dateTimeType),
i = this.templateSrv.replace(this.target.interval, options.scopedVars) || options.interval,
interval = SqlQuery.convertInterval(i, this.target.intervalFactor || 1);

try {
var ast = scanner.toAST();
let ast = scanner.toAST();
if (ast.hasOwnProperty('$columns') && !_.isEmpty(ast['$columns'])) {
query = SqlQuery.columns(query);
} else if (ast.hasOwnProperty('$rateColumns') && !_.isEmpty(ast['$rateColumns'])) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vertamedia-clickhouse",
"version": "1.2.5",
"version": "1.2.6",
"description": "ClickHouse datasource for Grafana",
"scripts": {
"build": "grunt",
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"url": "https://github.com/Vertamedia/clickhouse-grafana"
}
],
"version": "1.2.5"
"version": "1.2.6"
}
}
4 changes: 2 additions & 2 deletions src/sql_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export default class SqlQuery {
scanner = new Scanner(query),
dateTimeType = this.target.dateTimeType ? this.target.dateTimeType : 'DATETIME',
from = SqlQuery.convertTimestamp(SqlQuery.round(this.options.range.from, this.target.round)),
to = SqlQuery.convertTimestamp(this.options.range.to),
to = SqlQuery.convertTimestamp(SqlQuery.round(this.options.range.to, this.target.round)),
timeSeries = SqlQuery.getTimeSeries(dateTimeType),
timeFilter = SqlQuery.getTimeFilter(this.options.rangeRaw.to === 'now', dateTimeType),
i = this.templateSrv.replace(this.target.interval, options.scopedVars) || options.interval,
interval = SqlQuery.convertInterval(i, this.target.intervalFactor || 1);

try {
var ast = scanner.toAST();
let ast = scanner.toAST();
if (ast.hasOwnProperty('$columns') && !_.isEmpty(ast['$columns'])) {
query = SqlQuery.columns(query);
} else if (ast.hasOwnProperty('$rateColumns') && !_.isEmpty(ast['$rateColumns'])) {
Expand Down

0 comments on commit 7ca293a

Please sign in to comment.