There are some documentation sections that are outdated.
Example: Add support for variables. At the end of the page it mentions using setVariableQueryEditor for configuring plugin's query editor for variables. But actually it's deprecated (you get deprecation message when you start using it and it mentions the new way) and there is a new way of adding variables, which is not documented. Once you go to the code to understand this new method - it's also not clear, methods / properties are not documented, comments are not clear. So you need to check some examples and play around with it until you get something you want.
There is a slack thread I started a while ago, it has some more info.
The metricFindQuery function returns an array of MetricFindValue which has a single property, text:
async metricFindQuery(query: MyVariableQuery, options?: any) {
// Retrieve DataQueryResponse based on query.
const response = await this.fetchMetricNames(query.namespace, query.rawQuery);
// Convert query results to a MetricFindValue[]
const values = response.data.map(frame => ({ text: frame.name }));
return values;
}
But in reality MetricFindValue has not only text, it also has value and expandable :
interface MetricFindValue {
text: string;
value?: string | number;
expandable?: boolean;
}
Example: Add support for variables. At the end of the page it mentions using setVariableQueryEditor for configuring plugin's query editor for variables. But actually it's deprecated (you get deprecation message when you start using it and it mentions the new way) and there is a new way of adding variables, which is not documented. Once you go to the code to understand this new method - it's also not clear, methods / properties are not documented, comments are not clear. So you need to check some examples and play around with it until you get something you want.
There is a slack thread I started a while ago, it has some more info.
The metricFindQuery function returns an array of MetricFindValue which has a single property, text: async metricFindQuery(query: MyVariableQuery, options?: any) { // Retrieve DataQueryResponse based on query. const response = await this.fetchMetricNames(query.namespace, query.rawQuery);
// Convert query results to a MetricFindValue[] const values = response.data.map(frame => ({ text: frame.name }));
return values; }
But in reality MetricFindValue has not only text, it also has value and expandable : interface MetricFindValue { text: string; value?: string | number; expandable?: boolean; }
Reported by Andriy Urbanas