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

[Explore] highlighting run query when chart is stale on explore view #4459

Conversation

gabe-lyons
Copy link
Contributor

@gabe-lyons gabe-lyons commented Feb 21, 2018

This PR does two things:

  1. makes the Run Query grey by default- we don't want to highlight this button unless it would actually provide a new result.

  2. highlights the Run Query button when a change to the query powering the chart is made. Currently I determine a change is affecting the query if renderTrigger is falsey in the component's config.

open questions:

  1. I think whether we should trigger an instant refresh needs to be fleshed out a little bit more- for example moving a column from series to breakdowns doesn't affect the query but also doesn't trigger a rerender. Maybe we want to ditch the component level renderTrigger annotation and just look at the diff in the query (ignoring timestamp or something?) cc @graceguo-supercat @mistercrunch
  2. are there instances the chart should be updated that I'm not covering?

Before query change button is blank:
image

After query change button pops:
image

reviewers:
@graceguo-supercat
@michellethomas
@mistercrunch

@gabe-lyons
Copy link
Contributor Author

gabe-lyons commented Feb 21, 2018

For future work I want to make it more obvious that the chart should be refreshed by overlaying the chart with a refresh button.

@gabe-lyons gabe-lyons force-pushed the gabe_highlighting_run_query_when_chart_is_stale branch from dd167ff to 032d8c1 Compare February 21, 2018 19:54
@michellethomas
Copy link
Contributor

I like this idea, this generally looks good but Grace is more familiar with this part of the code and may know more if there are any edge cases we aren't thinking of.

return Object.keys(currentControls).some(key => (
currentControls[key].renderTrigger &&
typeof prevControls[key] !== 'undefined' &&
!areObjectsEqual(currentControls[key].value, prevControls[key].value)
));
}

hasQueryControlChanged(prevControls, currentControls) {
Copy link

@graceguo-supercat graceguo-supercat Feb 23, 2018

Choose a reason for hiding this comment

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

hasDisplayControlChange and hasQueryControlChange has very similar logic, can you consolidate this 2 functions? Notice both 2 functions called areObjectsEqual, which is a function that stringify 2 JS object and then find diff. Similar to JSON.parse, this function call is not cheap, so we need to use it with caution.

Also in componentWillReceiveProps we have a few logic block, it checks if viz_type changed, if data source changed, if control props changed, etc. The call to action creator, this.props.actions.ABCD, is not exit or return. This means every time a props changed, all of these logic will be checked. So if we do not consolidate 2 functions, the expensive compare function will be called twice every time there is a props change, no matter what kind of prop change.

@gabe-lyons gabe-lyons force-pushed the gabe_highlighting_run_query_when_chart_is_stale branch from 6c00401 to 584994c Compare February 24, 2018 00:10
@mistercrunch
Copy link
Member

@GabeLoins in the demo you showed you had an overlay on the chart itself and I don't see it in the code here. Were you further in your branch?

Unrelated to this PR: I was just thinking that this overaly (from memory it was centered, and the background opacity was ligther) could be used for the loading (spinner) animation as well.

@gabe-lyons
Copy link
Contributor Author

@graceguo-supercat addressed! Ready to merge.

@mistercrunch yeah, thats coming in PR #2

@mistercrunch mistercrunch merged commit 56f6515 into apache:master Feb 26, 2018
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 24, 2018
…pache#4459)

* highlighting run query when chart is stale on explore view

* refactoring control changed code
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
…pache#4459)

* highlighting run query when chart is stale on explore view

* refactoring control changed code
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.24.0 labels Feb 27, 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 🚢 0.24.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants