DataExplorer/Dashboard/Notebooks: handling of variables when using innerExpr
- Dominant language
- TypeScript
- Stars
- 117
- Forks
- 51
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 4
Description
The UI is responsible for injecting extern variables, if and only if, variables are not already defined in the flux query itself. We have this capability, but it breaks down for complex inner expressions.
## Test cases (examples):
TEST CASE --> use v.timeRangeStop as an inner expression
EXPECT: inject v.windowPeriod
v.windowPeriod= exprSubTree, divided by DESIRED_POINTS_PER_GRAPH. use rounding function.
IN PROD, NOTEBOOKS: fails in UI --> UI sends a empty string as the query.
IN PROD, NON-NOTEBOOKS: error @8:21-8:22: record is missing label windowPeriod
```
import "influxdata/influxdb/sample"
import "date"
import "experimental"
sample.data(set: "airSensor")
|> range(start: -12h, stop: "-${2 * 3 * 4 * 5}m")
|> yield(name: "${v.windowPeriod}")
```
TEST CASE --> use v.timeRangeStart as pre-bound Identifier, to an innerExpr
EXPECT: inject v.timeRangeStop and v.windowPeriod
IN PROD, NOTEBOOKS: fails in UI --> UI sends a empty string as the query.
IN PROD, NON-NOTEBOOKS: error @8:21-8:22: record is missing label windowPeriod
```
import "influxdata/influxdb/sample"
import "date"
import "experimental"
truncated = date.truncate(t:v.timeRangeStop,unit:1m)
splitPoint = experimental.subDuration(d: 10m, from: truncated)
sample.data(set: "airSensor")
|> range(start: -12h, stop: splitPoint)
|> yield(name: "${v.windowPeriod}")
```
## Challenge:
The UI code is limited to only walk ASTs. Not sure we can handle these inner complex expressions without evaluation.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.