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(explore): Replace overlay with alert banner when chart controls change #19696

Merged
merged 11 commits into from
Apr 19, 2022

Conversation

kgabryje
Copy link
Member

@kgabryje kgabryje commented Apr 13, 2022

SUMMARY

Before, when user made some changes to controls, we displayed an overlay with "Run query" button. This PR removes that overlay and introduces an alert banner that tells the user that some controls have changed and that they should click "Update chart" button. Thanks to that, the user can still view their chart while doing changes to controls.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2022-04-13.at.18.50.32.mov

TESTING INSTRUCTIONS

  1. Create a chart
  2. Do some changes in controls and verify that an alert banner showed up.
  3. After clicking "Update chart" the banner should disappear.
  4. When banner is visible, the chart should still respond to events that trigger rerendering, such as changing the width of browser window.

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

CC @kasiazjc

@@ -0,0 +1,127 @@
/**
Copy link
Member Author

Choose a reason for hiding this comment

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

This is ControlPanelAlert, just renamed. No need to review this file

@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #19696 (112c4d8) into master (594523e) will increase coverage by 0.01%.
The diff coverage is 61.90%.

@@            Coverage Diff             @@
##           master   #19696      +/-   ##
==========================================
+ Coverage   66.49%   66.51%   +0.01%     
==========================================
  Files        1689     1690       +1     
  Lines       64614    64616       +2     
  Branches     6650     6656       +6     
==========================================
+ Hits        42966    42978      +12     
+ Misses      19947    19937      -10     
  Partials     1701     1701              
Flag Coverage Δ
javascript 51.19% <61.90%> (+0.03%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/components/Chart/Chart.jsx 52.54% <0.00%> (+2.54%) ⬆️
.../src/explore/components/ControlPanelsContainer.tsx 79.80% <ø> (ø)
.../explore/components/ExploreViewContainer/index.jsx 52.29% <10.00%> (-0.61%) ⬇️
...t-frontend/src/explore/components/ExploreAlert.tsx 58.33% <58.33%> (ø)
.../src/utils/getChartRequiredFieldsMissingMessage.ts 66.66% <66.66%> (ø)
...et-frontend/src/components/Chart/ChartRenderer.jsx 54.23% <100.00%> (+1.60%) ⬆️
...ntend/src/explore/components/ExploreChartPanel.jsx 71.66% <100.00%> (+3.14%) ⬆️
...rc/explore/controlUtils/getFormDataFromControls.ts 100.00% <100.00%> (ø)

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 594523e...112c4d8. Read the comment docs.

@kgabryje kgabryje added the need:qa-review Requires QA review label Apr 14, 2022
@kgabryje
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@kgabryje Ephemeral environment spinning up at http://54.200.67.72:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@jinghua-qa
Copy link
Member

tested PR locally, did not find major issue, LGTM

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM! A few minor comments, but overall I think this is a great improvement! Also, thanks for the cleanup, this change again leaves the codebase slightly more readable and performant 👍

Comment on lines 120 to 125
? t(
'Drag and drop values into highlighted field(s) in the control panel. Then run the query by clicking on the "Create chart" button.',
)
: t(
'Select values in highlighted field(s) in the control panel. Then run the query by clicking on the "Create chart" button.',
);
Copy link
Member

Choose a reason for hiding this comment

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

Not something you're changing here, but to get rid of a ternary, I wonder if we couldn't get away with just one message here. As the current default supports both dragging and dropping and clicking on the ghost button, the "Select values in highlighted field(s) in the control panel" message could IMO be an ok message for both DnD and non-DnD scenarios.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good 👍

queriesResponse = [],
isDeactivatedViz = false,
width,
} = this.props;

const isLoading = chartStatus === 'loading';
const isFaded = refreshOverlayVisible && !errorMessage;
const isFaded = chartIsStale && !errorMessage;
Copy link
Member

Choose a reason for hiding this comment

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

As we're no longer fading, this variable should probably be renamed

Comment on lines 132 to 137
? t(
'Drag and drop values into highlighted field(s) in the control panel. Then run the query by clicking on the "Update chart" button.',
)
: t(
'Select values in highlighted field(s) in the control panel. Then run the query by clicking on the "Update chart" button.',
);
Copy link
Member

Choose a reason for hiding this comment

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

As this is identical to the text in src/components/Chart/Chart.tsx, we should perhaps consider placing these strings in a constants.ts to ensure they stay the same (otherwise someone might only update one but not the other).

Copy link
Member Author

Choose a reason for hiding this comment

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

Not exactly identical - the other one says "Create chart", this one "Update chart". Though we should probably make it more generic, like move to a function with argument isCreating or isUpdating

@kgabryje kgabryje merged commit 6f4480a into apache:master Apr 19, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
…change (apache#19696)

* Rename explore alert

* Rename refreshOverlayVisible to chartIsStale

* Implement banners

* Add tests

* Add clickable text to empty state

* Fix viz type switching

* styling changes

* Fixes after rebasing

* Code review fixes

* Fix bug

* Fix redundant refreshing
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 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 need:qa-review Requires QA review size/XL 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants