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

fix(explore): Allow only saved metrics and columns #27539

Conversation

justinpark
Copy link
Member

SUMMARY

Airbnb had previously overridden an option to disable ad-hoc metrics with commit #17202.
However, with the D&D option now enabled, users can accidentally drop an ad-hoc metric, thus gaining access to the previously disabled (tab) option.
To address this, the commit includes a condition to check whether the item being dropped is among the saved metrics, preventing such cases.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

before--adhoc-metric-drop.mov

After:

after--adhoc-metric-drop.mov

TESTING INSTRUCTIONS

Set a dataset extra with `{ "disallow_adhoc_metrics": true }'
Create a chart with the dataset and then try to drop a column to "Metric" which should be blocked

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

col => col.column_name === (item.value as ColumnMeta).column_name,
);
const columnName = (item.value as ColumnMeta).column_name;
return availableColumnSet.has(columnName);
Copy link
Member Author

Choose a reason for hiding this comment

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

@kgabryje I made a change from #27209 to improve the array iteration check by utilizing a hashset, which offers better performance and optimization.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense, thank you!

},
);
expect(
await screen.findByText('Drop columns/metrics here or click'),
).toBeInTheDocument();
});

test('cannot drop a column that is not part of the simple column selection', () => {
Copy link
Member Author

@justinpark justinpark Mar 15, 2024

Choose a reason for hiding this comment

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

@kgabryje I also added the spec for your case (#27209). Please let me know if you have any issues.

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.79%. Comparing base (735b895) to head (18e1b76).
Report is 17 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #27539      +/-   ##
==========================================
+ Coverage   69.73%   69.79%   +0.06%     
==========================================
  Files        1909     1909              
  Lines       74692    74722      +30     
  Branches     8325     8334       +9     
==========================================
+ Hits        52086    52152      +66     
+ Misses      20556    20517      -39     
- Partials     2050     2053       +3     
Flag Coverage Δ
javascript 57.35% <100.00%> (+0.12%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@john-bodley john-bodley merged commit 1c155e8 into apache:master Mar 18, 2024
28 of 29 checks passed
@justinpark justinpark added the v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch label Mar 18, 2024
deepak-kumar-007 pushed a commit to deepak-kumar-007/superset-forked that referenced this pull request Mar 18, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
EandrewJones pushed a commit to UMD-ARLIS/superset that referenced this pull request Apr 5, 2024
@mistercrunch mistercrunch added 🍒 4.0.0 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Apr 17, 2024
qleroy pushed a commit to qleroy/superset that referenced this pull request Apr 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/L v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch 🍒 4.0.0 🍒 4.0.1 🍒 4.0.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants