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

Commit 20b49df

Browse files
authored
Merge pull request #56 from doitintl/issue-51-take-3
Fixes #51
2 parents 1fb8a89 + 1043f72 commit 20b49df

File tree

4 files changed

+40
-16
lines changed

4 files changed

+40
-16
lines changed

dist/module.js

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34079,7 +34079,6 @@ function () {
3407934079
key: "gce",
3408034080
value: "GCE Default Service Account"
3408134081
}];
34082-
console.log("current", this.current);
3408334082
}
3408434083

3408534084
BigQueryConfigCtrl.prototype.onUpload = function (json) {
@@ -34237,11 +34236,36 @@ function () {
3423734236
this.url = instanceSettings.url;
3423834237
this.interval = (instanceSettings.jsonData || {}).timeInterval || "1m";
3423934238
this.authenticationType = instanceSettings.jsonData.authenticationType || "jwt";
34240-
var prj = "";
34241-
this.getDefaultProject().then(function (res) {
34242-
prj = res;
34243-
_this.projectName = instanceSettings.jsonData.defaultProject || prj;
34244-
});
34239+
34240+
(function () {
34241+
return tslib_1.__awaiter(_this, void 0, void 0, function () {
34242+
var _a, _b;
34243+
34244+
return tslib_1.__generator(this, function (_c) {
34245+
switch (_c.label) {
34246+
case 0:
34247+
_a = this;
34248+
_b = instanceSettings.jsonData.defaultProject;
34249+
if (_b) return [3
34250+
/*break*/
34251+
, 2];
34252+
return [4
34253+
/*yield*/
34254+
, this.getDefaultProject()];
34255+
34256+
case 1:
34257+
_b = _c.sent();
34258+
_c.label = 2;
34259+
34260+
case 2:
34261+
_a.projectName = _b;
34262+
return [2
34263+
/*return*/
34264+
];
34265+
}
34266+
});
34267+
});
34268+
})();
3424534269
}
3424634270

3424734271
BigQueryDatasource.formatBigqueryError = function (error) {
@@ -34500,7 +34524,7 @@ function () {
3450034524
this.projectName = data[0].value;
3450134525
return [2
3450234526
/*return*/
34503-
, this.projectName];
34527+
, data[0].value];
3450434528

3450534529
case 2:
3450634530
return [2

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/config_ctrl.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export class BigQueryConfigCtrl {
2525
{ key: this.defaultAuthenticationType, value: "Google JWT File" },
2626
{ key: "gce", value: "GCE Default Service Account" }
2727
];
28-
console.log("current", this.current)
2928
}
3029

3130
public onUpload(json) {

src/datasource.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ export class BigQueryDatasource {
6969
this.interval = (instanceSettings.jsonData || {}).timeInterval || "1m";
7070
this.authenticationType =
7171
instanceSettings.jsonData.authenticationType || "jwt";
72-
let prj = "";
73-
this.getDefaultProject().then(res => {
74-
prj = res;
75-
this.projectName = instanceSettings.jsonData.defaultProject || prj;
76-
});
72+
(async () => {
73+
this.projectName =
74+
instanceSettings.jsonData.defaultProject ||
75+
(await this.getDefaultProject());
76+
})();
7777
}
7878

7979
public async query(options) {
@@ -179,13 +179,14 @@ export class BigQueryDatasource {
179179
return ResponseParser.parseTableFields(data, filter);
180180
}
181181

182-
public async getDefaultProject() {
182+
183+
public async getDefaultProject(){
183184
try {
184185
if (this.authenticationType === "gce" || !this.projectName) {
185186
let data;
186187
data = await this.getProjects();
187188
this.projectName = data[0].value;
188-
return this.projectName;
189+
return data[0].value;
189190
} else {
190191
return this.projectName;
191192
}

0 commit comments

Comments
 (0)