Skip to content
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

feat: update IDs when importing dashboards #11991

Merged
merged 2 commits into from
Dec 12, 2020

Conversation

betodealmeida
Copy link
Member

SUMMARY

Dashboards reference charts by their IDs in their JSON attributes (position_json and json_metadata). When importing a dashboard we need to update the IDs to the new ones, since imported charts will probably have different IDs.

In this PR we use the chart UUID to update references to charts inside the metadata of dashboards.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TEST PLAN

Updated unit test showing the chart ID is updated across all attributes.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@codecov-io
Copy link

codecov-io commented Dec 10, 2020

Codecov Report

Merging #11991 (9932132) into master (6963087) will decrease coverage by 7.18%.
The diff coverage is 96.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11991      +/-   ##
==========================================
- Coverage   67.72%   60.54%   -7.19%     
==========================================
  Files         951      906      -45     
  Lines       46603    44699    -1904     
  Branches     4558     4051     -507     
==========================================
- Hits        31563    27064    -4499     
- Misses      14927    17635    +2708     
+ Partials      113        0     -113     
Flag Coverage Δ
cypress 53.20% <ø> (-0.02%) ⬇️
javascript ?
python 64.51% <96.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/dashboards/commands/importers/v1/utils.py 91.66% <95.65%> (+3.66%) ⬆️
...erset/dashboards/commands/importers/v1/__init__.py 100.00% <100.00%> (ø)
...uperset-frontend/src/dashboard/util/dnd-reorder.js 0.00% <0.00%> (-100.00%) ⬇️
...rset-frontend/src/dashboard/util/getEmptyLayout.js 0.00% <0.00%> (-100.00%) ⬇️
...dashboard/components/resizable/ResizableHandle.jsx 0.00% <0.00%> (-100.00%) ⬇️
.../src/dashboard/util/getFilterScopeFromNodesTree.js 0.00% <0.00%> (-93.48%) ⬇️
...set-frontend/src/views/CRUD/alert/ExecutionLog.tsx 11.76% <0.00%> (-88.24%) ⬇️
...src/dashboard/components/gridComponents/Header.jsx 10.52% <0.00%> (-86.85%) ⬇️
...rc/dashboard/components/gridComponents/Divider.jsx 13.33% <0.00%> (-86.67%) ⬇️
...ontend/src/dashboard/util/getDashboardFilterKey.ts 14.28% <0.00%> (-85.72%) ⬇️
... and 340 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6963087...9932132. Read the comment docs.

@betodealmeida betodealmeida force-pushed the update_ids_on_dash_import branch from df2c7c8 to 0261f87 Compare December 12, 2020 00:33
@betodealmeida betodealmeida force-pushed the update_ids_on_dash_import branch from 0261f87 to 59f5bc0 Compare December 12, 2020 00:41
]

if "filter_scopes" in metadata:
# in filter_scopes the key is a chart ID as a string; we nede to udpate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit typos

@betodealmeida betodealmeida merged commit 45703a1 into apache:master Dec 12, 2020
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants