Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.

Commit e7aa77e

Browse files
authored
Merge pull request #78 from doitintl/issue-77
datasource should be able to handle spaces between parameters in macros
2 parents e556c05 + 50065f4 commit e7aa77e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

dist/module.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51296,7 +51296,7 @@ function () {
5129651296
var res = alias ? q.match(/(.*\$__timeGroupAlias\(([\w._]+,)).*?(?=\))/g) : q.match(/(.*\$__timeGroup\(([\w_.]+,)).*?(?=\))/g);
5129751297

5129851298
if (res) {
51299-
res = res[0].substr(1 + res[0].lastIndexOf(","));
51299+
res = res[0].substr(1 + res[0].lastIndexOf(",")).trim();
5130051300
}
5130151301

5130251302
return res;
@@ -51712,9 +51712,9 @@ function () {
5171251712
var intervalStr = BigQueryQuery._getIntervalStr(interval, this.target.timeColumn);
5171351713

5171451714
if (alias) {
51715-
return q.replace(/\$__timeGroupAlias\(([\w_.]+,+[\w_]+\))/g, intervalStr);
51715+
return q.replace(/\$__timeGroupAlias\(([\w_.]+,+[a-zA-Z0-9_ ]+\))/g, intervalStr);
5171651716
} else {
51717-
return q.replace(/\$__timeGroup\(([\w_.]+,+[\w_]+\))/g, intervalStr);
51717+
return q.replace(/\$__timeGroup\(([\w_.]+,+[a-zA-Z0-9_ ]+\))/g, intervalStr);
5171851718
}
5171951719
};
5172051720

dist/module.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bigquery_query.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class BigQueryQuery {
3030
? q.match(/(.*\$__timeGroupAlias\(([\w._]+,)).*?(?=\))/g)
3131
: q.match(/(.*\$__timeGroup\(([\w_.]+,)).*?(?=\))/g);
3232
if (res) {
33-
res = res[0].substr(1 + res[0].lastIndexOf(","));
33+
res = res[0].substr(1 + res[0].lastIndexOf(",")).trim();
3434
}
3535
return res;
3636
}
@@ -520,9 +520,15 @@ export default class BigQueryQuery {
520520
this.target.timeColumn
521521
);
522522
if (alias) {
523-
return q.replace(/\$__timeGroupAlias\(([\w_.]+,+[\w_]+\))/g, intervalStr);
523+
return q.replace(
524+
/\$__timeGroupAlias\(([\w_.]+,+[a-zA-Z0-9_ ]+\))/g,
525+
intervalStr
526+
);
524527
} else {
525-
return q.replace(/\$__timeGroup\(([\w_.]+,+[\w_]+\))/g, intervalStr);
528+
return q.replace(
529+
/\$__timeGroup\(([\w_.]+,+[a-zA-Z0-9_ ]+\))/g,
530+
intervalStr
531+
);
526532
}
527533
}
528534
}

0 commit comments

Comments
 (0)