-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grafana 7: Exporter panel doesn't see datasource #40 #43
Grafana 7: Exporter panel doesn't see datasource #40 #43
Conversation
@@ -122,6 +122,12 @@ class Ctrl extends PanelCtrl { | |||
} | |||
} | |||
|
|||
private async _getDefaultDatasource() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's specify return type here
src/module.ts
Outdated
let datasource = await this._getDatasourceByName(datasourceName); | ||
this._datasourceTypes[panel.id] = datasource.type; | ||
|
||
if (!panel.datasource) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's be specific here, e.g.: panel.datasource === undefined
or panel.datasouce === null
src/module.ts
Outdated
@@ -175,12 +181,19 @@ class Ctrl extends PanelCtrl { | |||
private async _getGrafanaAPIInfo() { | |||
this._user = await this._getCurrentUser(); | |||
for(let panel of this.panels) { | |||
let datasourceName = panel.datasource; | |||
if(!datasourceName) { | |||
if (panel.type === 'corpglory-data-exporter-panel') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (panel.type === 'corpglory-data-exporter-panel') { | |
if(panel.type === 'corpglory-data-exporter-panel') { |
we don't add space before brackets in our codestyle
src/module.ts
Outdated
let datasource = await this._getDatasourceByName(datasourceName); | ||
this._datasourceTypes[panel.id] = datasource.type; | ||
|
||
if (!panel.datasource) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!panel.datasource) { | |
if(!panel.datasource) { |
we don't add space before brackets in our codestyle
Fixed code style
will be recreated |
This PR fixes #40
Probem:
We don`t see default datasource in the exporter panel
Solution:
Send an additional request to get all datasources and find one with the
isDefault = true
Changes:
Added
_getDefaultDatasource
functonChangaed
_getGrafanaAPIInfo
function