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

[dashboard] clean up usage for old filter immune metadata #9146

Merged

Conversation

graceguo-supercat
Copy link

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

After migration/convert old filter immune attribute in #9109 and #9145, dashboard front-end doesn't have to handle backward compatibility issue with old metadata. This PR is to clean up the usage for filter_immune_slices and filter_immune_slice_fields everywhere.

TEST PLAN

CI and manual tests.

ADDITIONAL INFORMATION

REVIEWERS

@john-bodley @serenajiang @etr2460 @mistercrunch

@codecov-io
Copy link

Codecov Report

Merging #9146 into master will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #9146      +/-   ##
=========================================
+ Coverage   59.06%   59.1%   +0.03%     
=========================================
  Files         372     372              
  Lines       11922   11915       -7     
  Branches     2919    2917       -2     
=========================================
  Hits         7042    7042              
+ Misses       4698    4693       -5     
+ Partials      182     180       -2
Impacted Files Coverage Δ
...frontend/src/dashboard/reducers/getInitialState.js 0% <ø> (ø) ⬆️

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 f95a867...a7d0070. Read the comment docs.

if "filter_scopes" in data:
md.pop("filter_immune_slices", None)
md.pop("filter_immune_slice_fields", None)
md["filter_scopes"] = json.loads(data.get("filter_scopes", "{}"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
md["filter_scopes"] = json.loads(data.get("filter_scopes", "{}"))
md["filter_scopes"] = json.loads(data["filter_scopes"])

not yours, but might as well clean this up

Copy link
Author

Choose a reason for hiding this comment

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

there might be many dashboards holding NULL value in data.get('filter_scopes').

Copy link
Contributor

Choose a reason for hiding this comment

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

Since, this is inside the if statement if "filter_scopes" in data:, we don't need to use .get because we know the key is there. For the case you mentioned, I think this should be:

md["filter_scopes"] = json.loads(data["filter_scopes"] or "{}")

For explanation,

data = {"filter_scopes": None}
print(data.get("filter_scopes", "{}")) # prints None

Copy link
Author

Choose a reason for hiding this comment

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

you are right! added fix. thank you!

@graceguo-supercat graceguo-supercat merged commit c1750af into apache:master Feb 19, 2020
@graceguo-supercat graceguo-supercat deleted the gg-SimplifyDashboardInit branch June 11, 2020 23:20
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.36.0 labels Feb 28, 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/S 🚢 0.36.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants