Hi Folks,
So my plugin is borrowing heavily from simple-json-datasource, although my datasource.js is different because I’m using websocket and rxJS.
However query_ctrl.js and partials/query.editor.html are identical except for the class name. Everything goes as expected until onChangeInternal() gets called in my sub-class of QueryCtrl, then everything stops. In simple-json-datasource the query() method on the datasource class gets called after onChangeInternal().
Workflow is:
- User opens graph data panel
- User selects Edit
- User selects new metric from drop-down to display in graph.
Here’s the constructor and query method on my datasource:
export class ABBDatasource {
constructor(instanceSettings, $http, backendSrv, templateSrv) {
this.type = instanceSettings.type;
this.url = 'hard coded string containing url for now';
this.name = instanceSettings.name;
this.instanceSettings = instanceSettings;
this.$http = $http;
this.backendSrv = backendSrv;
this.templateSrv = templateSrv;
this.headers = {'Content-Type': 'applications/json'};
this.streamHandlers = {};
}
query(options) {
console.log('query. Options passed in', options);
var handler = this.streamHandlers[options.panelId];
if (handler) {
return Promise.resolve(handler);
}
this.streamHandlers[options.panelId] = handler = new StreamHandler(options, this);
handler.start();
return Promise.resolve(handler);
}
This is grafana 4.4.1 running on windows 2012.
How do I get the QueryCtrl to refresh from the datasource? As in how do I get ABBDatasource.query() to execute after the datapanel is refreshed?