Skip to content
This repository was archived by the owner on Dec 11, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Install from [grafana.net](https://grafana.net/plugins/doitintl-bigquery-datasou
Use the [grafana-cli](http://docs.grafana.org/plugins/installation/#installing-plugins-manually)

```bash
grafana-cli --pluginUrl https://github.com/doitintl/bigquery-grafana/archive/1.0.7.zip plugins install doitintl-bigquery-datasource
grafana-cli --pluginUrl https://github.com/doitintl/bigquery-grafana/archive/1.0.8.zip plugins install doitintl-bigquery-datasource
```

## Copy files
Expand All @@ -25,7 +25,7 @@ Add the below to your values.yaml
## Pass the plugins you want installed as a list.
##
plugins:
- https://github.com/doitintl/bigquery-grafana/archive/1.0.7.zip;doit-bigquery-datasource
- https://github.com/doitintl/bigquery-grafana/archive/1.0.8.zip;doit-bigquery-datasource
...
```

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Code Climate](https://codeclimate.com/github/doitintl/bigquery-grafana/badges/gpa.svg)](https://codeclimate.com/github/doitintl/bigquery-grafana/coverage)
[![Issue Count](https://codeclimate.com/github/doitintl/bigquery-grafana/badges/issue_count.svg)](https://codeclimate.com/github/doitintl/bigquery-grafana)
[![CodeCpv](https://codecov.io/gh/doitintl/bigquery-grafana/branch/master/graph/badge.svg)](https://codecov.io/gh/doitintl/bigquery-grafana/)
[![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)
## Status: Production Ready
# BigQuery DataSource for Grafana

Expand Down
16 changes: 12 additions & 4 deletions dist/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -58753,15 +58753,16 @@ function () {
return res;
};

BigQueryQuery.formatDateToString = function (date, separator, addtime) {
BigQueryQuery.formatDateToString = function (inputDate, separator, addtime) {
if (separator === void 0) {
separator = "";
}

if (addtime === void 0) {
addtime = false;
} // 01, 02, 03, ... 29, 30, 31
}

var date = new Date(inputDate); // 01, 02, 03, ... 29, 30, 31

var DD = (date.getDate() < 10 ? "0" : "") + date.getDate(); // 01, 02, 03, ... 10, 11, 12

Expand Down Expand Up @@ -59387,7 +59388,7 @@ function () {

BigQueryQuery.prototype._calcAutoInterval = function (options) {
var seconds = (this.templateSrv.timeRange.to._d - this.templateSrv.timeRange.from._d) / 1000;
return Math.round(seconds / options.maxDataPoints) + "s";
return Math.ceil(seconds / options.maxDataPoints) + "s";
};

BigQueryQuery.prototype._getDateRangePart = function (part) {
Expand Down Expand Up @@ -60342,7 +60343,14 @@ function () {
var limit = q.match(/[^]+(\bLIMIT\b)/gi);

if (limit == null) {
q += " LIMIT " + options.maxDataPoints;
var limitStatement = " LIMIT " + options.maxDataPoints;
var limitPosition = q.match(/\$__limitPosition/g);

if (limitPosition !== null) {
q = q.replace(/\$__limitPosition/g, limitStatement);
} else {
q += limitStatement;
}
}

return q;
Expand Down
2 changes: 1 addition & 1 deletion dist/module.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"build:prod": "webpack --config webpack.config.prod.js",
"build:dev": "webpack --mode development",
"build:watch": "webpack --mode development --watch",
"test": "jest --config jest.config.js && codecov",
"test:codecov": "jest --config jest.config.js && codecov",
"test": "jest --config jest.config.js",
"test:watch": "jest --config jest.config.js --watch"
},
"author": "DoiT International",
Expand Down Expand Up @@ -38,7 +39,7 @@
"copy-webpack-plugin": "^5.1.1",
"googleapis": "^49.0.0",
"grafana-sdk-mocks": "github:grafana/grafana-sdk-mocks",
"jest": "^25.4.0",
"jest": "^26.0.1",
"ng-annotate-webpack-plugin": "^0.3.0",
"plugin-typescript": "^8.0.0",
"prettier": "^1.16.4",
Expand Down
3 changes: 2 additions & 1 deletion src/bigquery_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default class BigQueryQuery {
return res;
}

public static formatDateToString(date, separator = "", addtime = false) {
public static formatDateToString(inputDate, separator = "", addtime = false) {
const date = new Date(inputDate);
// 01, 02, 03, ... 29, 30, 31
const DD = (date.getDate() < 10 ? "0" : "") + date.getDate();
// 01, 02, 03, ... 10, 11, 12
Expand Down
6 changes: 3 additions & 3 deletions src/datasource.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { validate } from "@babel/types";
import { sheets } from "googleapis/build/src/apis/sheets";
// import { validate } from "@babel/types";
// import { sheets } from "googleapis/build/src/apis/sheets";
import _ from "lodash";
import { countBy, size } from "lodash-es";
// import { countBy, size } from "lodash-es";
import moment from "moment";
import BigQueryQuery from "./bigquery_query";
import ResponseParser, { IResultFormat } from "./response_parser";
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{"name": "GitHub", "url": "https://github.com/doitintl/bigquery-grafana"},
{"name": "MIT License", "url": "https://github.com/doitintl/bigquery-grafana/blob/master/LICENSE.md"}
],
"version": "1.0.7"
"version": "1.0.8"
},
"routes": [
{
Expand Down
2 changes: 1 addition & 1 deletion src/response_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default class ResponseParser {
const r = [];
each(ser, v => {
for (let i = 0; i < v.length; i++) {
const val = ResponseParser._convertValues(v[i].v, columns[i].type);
const val = v[i].v ? ResponseParser._convertValues(v[i].v, columns[i].type) : "";
r.push(val);
}
});
Expand Down