sahbig
April 29, 2020, 1:49am
1
Hi
I want to develop a custom interactive map plugin because our point data is huge.
In order to optimize queries we want to load the visible part of the map view only and aggregated by zoom level.
Is there a way the panel plugin can propagate variables to the data source ?
Hello @sahbig
I think you may utilize render() or componentDidUpdate() methods of panel.
Not sure how to propagate variables to the data source. It may be helpful:
let value = this.data.request.targets[0].datasource // <- this holds your datasource name
let ds = getDataSourceSrv().loadDatasource(value)
So you will have datasource instance and can query it then.
// "name": "telegraf_cpu_mean_usage_user_cpu_cpu_total_host_macbook4823_5m",
// "offset": "10s",
// "span": 100,
// "type": "donut"
// }
const source = this.data.request.targets[0];
const fields = [source];
const loudml = this.ds.loudml;
this.getDatasource(source.datasource).then(result => {
this.datasource = result;
window.console.log("getDatasource", this.datasource);
// TODO: find a way to pass all this.datasource connection params to Loud ML server
// This will allow to auto create bucket to store ML Model training results
// this.ds.loudml.createAndGetBucket(
// this.datasource.database,
// source.policy,
// source.measurement,
Hope this will help you,
V.