plugin-tools icon indicating copy to clipboard operation
plugin-tools copied to clipboard

Outdated info in 'Add support for variables' topic

Open josmperez opened this issue 1 year ago • 4 comments

Reported by Andriy Urbanas:

  1. 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.

  1. Incorrect docs. For example on the same page about adding support for variables, there is this:

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; }

josmperez avatar Mar 15 '24 18:03 josmperez