influxdata / influxdata/influxdb

Cannot export dashboard JSON from UI

Open
#24,136 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__
In the UI, I am unable to export dashboards that contain graphs that use 'stepAfter' or 'stepBefore' interpolation. To reproduce:

1. Create a new dashboard.
2. Add a new cell to the dashboard of type "Graph"
3. Add a dummy query to the graph, just to show some data (the data here doesn't matter). Here's a simple query that you can use:
```
import "array"
array.from(rows: [{_time: 2020-01-01T00:00:00Z, _value: "foo"},{_time: 2020-01-02T00:00:00Z, _value: "bar"}])
```
4. Set the interpolation to 'stepAfter' or 'stepBefore'
5. Save the cell, and return to the main dashboard screen to see all of your dashboards.
6. Find the new dashboard, and click on the gear icon, then click "Download template"

__Expected behavior:__
The actual template JSON should be downloaded.

__Actual behavior:__
A json file is downloaded with the following content:
```json
{ "code": "unprocessable entity", "message": "kind=Dashboard field=root[0].spec.charts[0].geom reason=\"type provided is not supported: \\\"stepAfter\\\"\"" }
```

If you change the interpolation to "Linear", then the actual template JSON is downloaded.

I think it may have to do with the list of valid geometry types found [here](https://github.com/influxdata/influxdb/blob/f74c69c5e4a9c865c204949f3bb85cf58c56c7b6/pkger/parser_models.go#L1011-L1017). This list does not contain 'stepAfter' or 'stepBefore'.

__Environment info:__

* System info: Linux 5.15.0-1025-raspi aarch64
* InfluxDB version: InfluxDB v2.6.1 (git: 9dcf880fe0) build_date: 2022-12-29T15:52:06Z

__Config:__
Default config.

__Logs:__
```
Mar 13 00:19:31 ubuntu influxd-systemd-start.sh[831]: ts=2023-03-13T06:19:31.711848Z lvl=error msg="failed to export template" log_id=0gWjFJoW000 service=pkger error="kind=Dashboard field=root[0].spec.charts[0].geom reason=\"type provided is not supported: \\\"stepBefore\\\"\"" took=8.760ms
Mar 13 00:19:31 ubuntu influxd-systemd-start.sh[831]: ts=2023-03-13T06:19:31.712037Z lvl=error msg="api error encountered" log_id=0gWjFJoW000 handler=templates error="kind=Dashboard field=root[0].spec.charts[0].geom reason=\"type provided is not supported: \\\"stepBefore\\\"\""
```

Contributor guide

Open the contributing guide

Research direction

Start at pkger/parser_models.go and the UI's Download template flow, using the listed reproduction steps with stepAfter and stepBefore. Done means the dashboard template downloads as actual JSON for both interpolations instead of the shown unsupported-type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, react
Domain
backend, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.