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

Fixing explore actions & slice controller interactions #1292

Merged
merged 2 commits into from
Oct 7, 2016

Conversation

mistercrunch
Copy link
Member

@mistercrunch mistercrunch commented Oct 7, 2016

The idea here is controllerInterface, a common interface for slices to interact with their context, or controller (explore, dashboard or standalone implement this interface).

For instance, when a slice is done loading, it calls it's controller done method, which will trigger different things depending on the context.

This allows for moving logic specific to dashboards & explore back into those objects, away from the Slice object itself.

@mistercrunch mistercrunch force-pushed the bkp_fix_exploreactions branch from bfbc4e1 to 9ecf187 Compare October 7, 2016 16:58
$(document).ready(function () {
const data = $('.slice').data('slice');

initExploreView();

slice = px.Slice(data);
slice = px.Slice(data, exploreController);

$('.slice').data('slice', slice);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we write the slice back to the DOM? Later, slice.data or slice.viewSqlLQuery will change and the representation in the DOM is outdated. Moreover, it is used nowhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, I'm removing it and making sure things still work. We're re-writing the explore view to react so I don't want to go too far in the refactoring, but that's an easy win.

flts = dashboard.effectiveExtraFilters(sliceId);
flts = encodeURIComponent(JSON.stringify(flts));
}
if (controller.type === 'dashboard') {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. origJsonEndpoint with the params for the chart is only used in the dashboard to be able to remove the extra_filters. Hence, I would save it in the dashboard.
  2. The form input with the params for the chart is only used in explore.
  3. In the default case, e.g. standalone, the query params are from the slide itself.
    Thus, I would put the query string generation in the controller interface in use the default case when it is not implemented.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would you please describe the interface with a few comments. e.g. describe the case when each function is called.

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for the review, I know there's much more refactoring to do here to move all the logic in the right places, I want to merge this quickly-ish to fix the bug and we can see how much more refactoring we want to do here in the future but most likely not much knowing that we're re-writing the whole explore view...

@mistercrunch mistercrunch merged commit 3384e75 into apache:master Oct 7, 2016
@mistercrunch mistercrunch deleted the bkp_fix_exploreactions branch October 7, 2016 21:06
@ascott
Copy link

ascott commented Oct 7, 2016

thanks for this fix! 🎉

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.12.0 labels Feb 19, 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.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants