Query backend plugin to populate dropdown menu in QueryEditor.tsx

Hello, I am trying to populate a dropdown menu in QueryEditor.tsx. To illustrate what I am trying to achieve please refer to the image below:


The screenshot shown is from an older version of the plugin that is not a backend plugin (changing so that I can make use of the user’s authorization token). My question is how do you query the backend in QueryEditor.tsx so that the returned dataframe can be used to populate the list?

Thanks!

1 Like

You can extend the Grafana REST API with data source-specific endpoints, using resource handlers. Your query editor can then make any request, whenever it likes. You can read more on how to add a resource handler in How to add a resource handler for your data source.

Thanks for the reply! I have tested the CallResource function out, but it does not appear that the user’s authorization token is passed in the same way that it is with QueryData (in the Authorization header). Therefore, I have no way to query my datasource for autocomplete suggestions. Do you know if there is a way around this?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.