Access data source settings from Query Editor

Hey there,

I’m currently working on the development of a backend data source plugin. On the frontend, I’d need to access the data source settings from my query editor but cannot find how to do it. Information about the data source plugin can be accessed via the component props, but the plugin settings don’t seem to be exposed (jsonData, apiKey, host, etc.).

Thanks for your help!

I believe the query is your jsonData in this case. I can’t seem to find the data source settings either. I’ll dig around and get back on this.

I think you need to expose the settings yourself:

export class DataSource extends DataSourceWithBackend<MyDataQuery, MyOptions> {
  options: MyOptions;

  constructor(instanceSettings: DataSourceInstanceSettings<MyOptions>) {
    super(instanceSettings);
    this.options = instanceSettings.jsonData;
  }
}

so then you can access them in the query editor:

export default class QueryEditor extends PureComponent<Props, State> {
  componentDidMount() {
    console.log(this.props.datasource.options);
  }
}
1 Like

@mickaelvieira Is there any way to update jsonData from the datasouce? I need to update my jsonData with a value coming inside query response. Thanks.

2 Likes

Same problem for me did anyone have an answer now ?