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 refresh frequency #7248

Merged
merged 2 commits into from
Apr 9, 2019
Merged

Fix refresh frequency #7248

merged 2 commits into from
Apr 9, 2019

Conversation

betodealmeida
Copy link
Member

SUMMARY

Setting the refresh frequency is not working properly:

  1. It doesn't get saved, since it's not sent in the payload to /superset/save_dash/;
  2. Changing it won't trigger the hasUnsavedChanges, so the user might not save the change.

I added the refresh frequency to the payload, and made it so that modifying the refresh frequency sets hasUnsavedChanges to true, prompting the user to save the dash.

Note that in order to do the latter I changed the dropdown to only show the option when the user is in edit mode. This can be changed, but I'm worried that users will not know the difference between setting the frequency without entering edit mode (it's not saved, and only applies to the current browser tab) vs. changing it in edit mode (it is saved and applies to all dashboards). Thoughts on this?

TEST PLAN

Created new dashboard, changed the refresh frequency. Value is present in the payload, saved in the DB. On next load, the initial value is correctly read from the DB.

ADDITIONAL INFORMATION
[ ] Has associated issue:
[X] Changes UI
[ ] Requires DB Migration. Confirm DB Migration upgrade and downgrade tested.
[ ] Introduces new feature or API
[ ] Removes existing feature or API
[X] Fixes bug
[ ] Refactors code
[ ] Adds test(s)
REVIEWERS

@xtinec @mistercrunch

@betodealmeida betodealmeida added !deprecated-label:bug Deprecated label - Use #bug instead .dashboard lyft Related to Lyft and removed review labels Apr 9, 2019
@codecov-io
Copy link

Codecov Report

Merging #7248 into lyftga will increase coverage by <.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           lyftga    #7248      +/-   ##
==========================================
+ Coverage   64.53%   64.54%   +<.01%     
==========================================
  Files         425      425              
  Lines       20861    20863       +2     
  Branches     2280     2282       +2     
==========================================
+ Hits        13463    13465       +2     
  Misses       7272     7272              
  Partials      126      126
Impacted Files Coverage Δ
...uperset/assets/src/dashboard/components/Header.jsx 42.2% <ø> (ø) ⬆️
...et/assets/src/dashboard/reducers/dashboardState.js 85.52% <0%> (ø) ⬆️
...src/dashboard/components/HeaderActionsDropdown.jsx 68.88% <100%> (+1.44%) ⬆️

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 23ef41f...f53b24c. Read the comment docs.

@@ -105,9 +105,9 @@ describe('HeaderActionsDropdown', () => {
expect(wrapper.find(MenuItem)).toHaveLength(2);
});

it('should render the RefreshIntervalModal', () => {
it('should not render the RefreshIntervalModal', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add tests that assert it renders this in editMode?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have them already, actually. I didn't have to change them. See https://github.com/apache/incubator-superset/pull/7248/files#diff-c130332fd863f354e0dd6e8e6097f72fR142

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

This looks good to me except it seems like we should probably have tests that assert the option to update renders in editMode?

@betodealmeida
Copy link
Member Author

Thanks, @williaster!

@betodealmeida betodealmeida merged commit 7c80cf5 into apache:lyftga Apr 9, 2019
@graceguo-supercat
Copy link

graceguo-supercat commented Apr 10, 2019

@betodealmeida this PR makes auto-refresh interval only available to dashboard owner:
Screen Shot 2019-04-10 at 11 49 22 AM

For Superset dashboard, only owner can enable edit mode. check dash_edit_perm.
As dashboard viewer (not owner), he used be able to adjust auto-refresh interval at his visit. Just like dashboard filter, any user can apply filter to see different results, but won't affect the original dashboard setting. After this PR, viewer can't have auto-refresh interval anymore.

I think we need to keep auto refresh interval choice available for all dashboard viewer.

@betodealmeida
Copy link
Member Author

@graceguo-supercat good point. I'll bring back the other option, I just think we need to improve the wording. We should differentiate between setting a refresh on the dashboard the user is currently seeing, versus saving it with the dashboard metadata.

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.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 !deprecated-label:bug Deprecated label - Use #bug instead lyft Related to Lyft 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants