jixuan1989 opened a new pull request, #109:
URL: https://github.com/apache/iotdb-extras/pull/109
## Summary
When a multi-value Grafana template variable is used in `prefixPath` (e.g.
`root.application.${device}`), the plugin now expands it into multiple valid
IoTDB paths instead of producing an invalid concatenated path like
`root.application.device1,device2`.
This enables the common "global variable filter" dashboard pattern where a
single multi-select dropdown controls all panels simultaneously.
## Changes
- **`connectors/grafana-plugin/src/datasource.ts`**: Modified
`applyTemplateVariables` to detect multi-value variables in `prefixPath` and
expand them into separate paths using the `pipe` format.
- **`connectors/grafana-plugin/src/datasource.test.ts`**: Added unit tests
covering literal paths, single-value variables, multi-value expansion, mixed
paths, and backward compatibility.
- **`connectors/grafana-plugin/README.md`**: Documented the multi-value
variable expansion feature in the template variables section.
## Backward Compatibility
Fully backward-compatible:
- Paths without variables pass through unchanged
- Single-value variables produce the same result as before
- Only multi-value variables with multiple selected values trigger the new
expansion logic
## Testing
```
npx jest --testPathPattern='datasource.test' --no-coverage
PASS src/datasource.test.ts (8 tests passed)
```
Closes #108
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]