Move the identification of variables (in a flux query), to use the flux-lsp AST utils.
- Dominant language
- TypeScript
- Stars
- 117
- Forks
- 51
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 4
Description
## Proposal:
Remove the requirement of the UI to handle the flux AST, in order to determine use of variables. Replace with a findVar() function from the flux-lsp library.
## Current behavior:
* Manual handling of AST in `parseASTIM`.
* Current uses:
* this includes dashboards, and the old DataExplorer.
* will be directly calling `parseASTIM`
* https://github.com/influxdata/ui/blob/239570afea9735229e4d43ceb82a6d608e056591/src/variables/utils/astim.ts#L21
* this includes notebooks & new DataExplorer (as well as ^^), which indirectly calls `parseASTIM`
* everything uses `buildUsedVarsOption`
* https://github.com/influxdata/ui/blob/master/src/variables/utils/buildVarsOption.ts#L13
* which uses `filterUnusedVarsBasedOnQuery`
* https://github.com/influxdata/ui/blob/master/src/shared/utils/filterUnusedVars.ts#L53
* which uses `parseASTIM`
## Desired behavior:
- [ ] Have findVar be exposed in the flux-lsp.
* findVar contract:
1. take flux query string
2. with language awareness (AST), return the expected properties on the extern `v`.
* current findVar returns the recordType definition (with types), but may instead return only a list of properties (no type information handled by UI).
- [ ] Have UI utilize this method for all existence checking of variables.
* parseASTIM
* any existence check for use of windowPeriod
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.