Skip to content

Commit

Permalink
Grafana 7: Exporter panel doesn't see datasource CorpGlory#40
Browse files Browse the repository at this point in the history
Fixed code style
  • Loading branch information
sblrok committed Sep 22, 2020
1 parent c16b69f commit 9455606
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class Ctrl extends PanelCtrl {
}
}

// TODO: specify return type here
private async _getDefaultDatasource() {
const datasources = await this.backendSrv.get(`/api/datasources`);

Expand Down Expand Up @@ -181,11 +182,11 @@ class Ctrl extends PanelCtrl {
private async _getGrafanaAPIInfo() {
this._user = await this._getCurrentUser();
for(let panel of this.panels) {
if (panel.type === 'corpglory-data-exporter-panel') {
if(panel.type === 'corpglory-data-exporter-panel' || panel.datasource === undefined) {
continue;
}

if (!panel.datasource) {
if(panel.datasource === null) {
const datasource = await this._getDefaultDatasource();
panel.datasource = datasource?.name;

Expand Down

0 comments on commit 9455606

Please sign in to comment.