influxdata / influxdata/influxdb
Feature request [2.0]: Query + Map dashboard variable type
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
**Proposal:**
Create a dashboard variable type that uses columns in query results to create variable key-value mappings. It could expect specific column labels (`key` and `value`) or allow users to select which columns to use as keys and values in the UI.
**Use case:**
This would allow users to dynamically generate map variables from query results.
**Example:**
The example below would map bucket names to bucketIDs. Bucket IDs are static, but users can change bucket names. Using this to populate a `bucket` variable would make the list of buckets human-readable, but populate dashboard queries with the bucketID. Bucket names could be changed without breaking anything as long as queries use `from()`'s `bucketID` parameter.
```js
buckets()
|> map(fn: (r) => ({ key: r.name, value: r.id }))
```
Contributor guide
Research direction
Start by reviewing the dashboard variable UI and the query-result handling described in the proposal. Resolve whether mappings use fixed `key` and `value` columns or user-selected columns, then verify that query results provide human-readable labels while dashboard queries use the underlying values.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100