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: Shows related dashboards in Explore #21685

Merged

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Oct 3, 2022

SUMMARY

Adds a new section to the "More" button in Explore that displays a list of dashboards in which the chart is included.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2022-10-03.at.9.56.43.AM.mov

TESTING INSTRUCTIONS

Check the video and the related tests for instructions.

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

@codecov
Copy link

codecov bot commented Oct 4, 2022

Codecov Report

Merging #21685 (52f92f1) into master (f1fbaf8) will increase coverage by 0.01%.
The diff coverage is 56.75%.

@@            Coverage Diff             @@
##           master   #21685      +/-   ##
==========================================
+ Coverage   66.82%   66.83%   +0.01%     
==========================================
  Files        1799     1800       +1     
  Lines       68884    68937      +53     
  Branches     7319     7335      +16     
==========================================
+ Hits        46031    46077      +46     
- Misses      20966    20967       +1     
- Partials     1887     1893       +6     
Flag Coverage Δ
hive 52.91% <ø> (+<0.01%) ⬆️
javascript 53.15% <56.75%> (+<0.01%) ⬆️
mysql 78.24% <ø> (?)
postgres 78.30% <ø> (-0.01%) ⬇️
presto 52.82% <ø> (+<0.01%) ⬆️
python 81.44% <ø> (+0.04%) ⬆️
sqlite 76.80% <ø> (-0.01%) ⬇️
unit 50.96% <ø> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/dashboard/actions/hydrate.js 1.78% <0.00%> (-0.14%) ⬇️
...rontend/src/dashboard/containers/DashboardPage.tsx 7.25% <0.00%> (-0.06%) ⬇️
...rc/explore/components/ExploreChartHeader/index.jsx 55.76% <0.00%> (-1.10%) ⬇️
...mponents/useExploreAdditionalActionsMenu/index.jsx 62.65% <50.00%> (-0.77%) ⬇️
...ExploreAdditionalActionsMenu/DashboardsSubMenu.tsx 83.33% <83.33%> (ø)
...frontend/src/SqlLab/components/SaveQuery/index.tsx 75.00% <0.00%> (-1.75%) ⬇️
superset-frontend/src/SqlLab/actions/sqlLab.js 62.66% <0.00%> (-0.33%) ⬇️
...tend/plugins/plugin-chart-table/src/TableChart.tsx 46.19% <0.00%> (-0.26%) ⬇️
superset/db_engine_specs/gsheets.py 75.91% <0.00%> (-0.21%) ⬇️
superset/queries/saved_queries/api.py 95.28% <0.00%> (ø)
... and 10 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kgabryje
Copy link
Member

kgabryje commented Oct 6, 2022

/testenv up FEATURE_CROSS_REFERENCES=true

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

Some non-blocking nits from looking at the code. I will manually test as well

Comment on lines +27 to +30
const dashboards = [];
for (let i = 1; i <= numberOfItems; i += 1) {
dashboards.push({ id: i, dashboard_title: `Dashboard ${i}` });
}
Copy link
Member

Choose a reason for hiding this comment

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

Just a shortcut if you like

Suggested change
const dashboards = [];
for (let i = 1; i <= numberOfItems; i += 1) {
dashboards.push({ id: i, dashboard_title: `Dashboard ${i}` });
}
const dashboards = Array.from({ length: numberOfItems }, (_, i) => ({ id: i+1, dashboard_title: `Dashboard ${i+1}`}));

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting! For this specific case though, after formatting, both options take 4 lines of code and your suggestion requires more knowledge about iterable objects with the length property. I think the original code is more developer friendly in this case. Nevertheless, I liked the suggested pattern and will use it in other cases.

return (
<>
{showSearch && (
<AntdInput
Copy link
Member

Choose a reason for hiding this comment

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

Should we move this to its own directory and enhance it like we did for all other Antd components? Definitely not a blocker for the PR though

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean by "enhance it"?

Copy link
Member

Choose a reason for hiding this comment

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

Just move it in its own components directory and wrap it with styled components. As I said, it's just a plus

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed the code to use our styled component from src/components/Input 👍🏼

superset-frontend/src/dashboard/actions/hydrate.js Outdated Show resolved Hide resolved
</>
)}
)}
{isFeatureEnabled(FeatureFlag.CROSS_REFERENCES) && (
Copy link
Member

Choose a reason for hiding this comment

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

this should be behind the slice && check too. If you create a new chart, slice is undefined before saving, so there's no point in showing "Dashboards added to" because it's always empty. If you do that, you can also make chartId required instead of optional in types of DashboardSubMenu

Copy link
Member Author

Choose a reason for hiding this comment

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

The design specification shows the "Dashboards added to" with a None item. I think this is intentional to present the user with the same experience when there's no dashboard associated whether is a new chart or a saved one.

Screen Shot 2022-10-06 at 1 43 13 PM

@kgabryje
Copy link
Member

kgabryje commented Oct 7, 2022

/testenv up FEATURE_CROSS_REFERENCES=true

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

LGMT!

@michael-s-molina michael-s-molina merged commit 200bed6 into apache:master Oct 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 7, 2022

Ephemeral environment shutdown and build artifacts deleted.

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants