-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add default position to dash export #12007
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12007 +/- ##
==========================================
+ Coverage 63.59% 63.64% +0.04%
==========================================
Files 939 943 +4
Lines 45580 45702 +122
Branches 4371 4388 +17
==========================================
+ Hits 28988 29087 +99
- Misses 16416 16438 +22
- Partials 176 177 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
"id": chart_hash, | ||
"meta": { | ||
"chartId": chart.id, | ||
"height": 50, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd make height and width constants at the top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, let me do that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
SUMMARY
The layout of dashboards is stored in the
position_json
attribute, containing the position and ID of charts. When a dashboard layout hasn't been modified the attribute is empty, and the relationship between which charts are contained in a given dashboard exists only in thedashboard_slices
table and is not exported.With this PR, if
position_json
is empty we add a default position to the attribute, so that the relationship between dashboards and charts is present in the export bundle. This doesn't change the layout, but allows us to extract the relationship when importing the dashboard together with the charts.One alternative to this PR would be explicitly listing the UUIDs of charts when we export a dashboard, eg:
But since most dashboards will have the
position_json
attribute set, it seems more efficient to populate it when it's empty.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
Exported dash, verified the YAML file, and imported again, ensuring that layout was not altered.
ADDITIONAL INFORMATION