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

[sqllab] Fixed js error when results are not available #1715

Merged
merged 5 commits into from
Dec 5, 2016

Conversation

vera-liu
Copy link
Contributor

@vera-liu vera-liu commented Nov 30, 2016

Issue:

Problem:

  • query results could be null in VisualizeModal, triggering js error
  • defaults were not shown in VisualizeModal for past queries

Solution:

Before:
bug

After:
screen shot 2016-12-01 at 9 55 01 am

@ascott @bkyryliuk @mistercrunch

<div className="VisualizeModal">
<Modal show={this.props.show} onHide={this.props.onHide}>
<Modal.Body>
No results available for this query
Copy link
Member

Choose a reason for hiding this comment

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

s/No results available for this query, please rerun

Copy link

Choose a reason for hiding this comment

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

it would be nice to have actionable feedback for the user here, but if there are no results for a query, re-running it won't likely return new results. i think we could save figuring out what actionable feedback we could show here for another PR.

Copy link

Choose a reason for hiding this comment

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

ah, i see what's happening now, i missed reading about how we flush the query results except for the latest query.

const q = Object.assign({}, state.queries[qe.latestQueryId], { results: null });
const newResults = Object.assign(
{}, state.queries[qe.latestQueryId].results, { data: [], query: null });
const q = Object.assign({}, state.queries[qe.latestQueryId], { results: newResults });
Copy link
Member

Choose a reason for hiding this comment

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

would be great to have the unit test for it, optional

@ascott
Copy link

ascott commented Dec 1, 2016

thanks for taking this on @vera-liu. i'm not sure showing this modal is the best solution. like bogdan suggested, we could add text to tell the user to re-run the query but i don't think this is a very good user experience.

comments on your other ideas:

  1. remove visualize button for all queries in query history except for latest query (users should run past queries in new editors to visualize them)

we could remove the visualize button from the query history list items altogether. if it's only present for the latest query, that seems confusing/looks like a bug if it's not displayed for the other queries. for the latest query, users will be able to use the visualize button in the results tab.

screenshot 2016-11-30 20 37 41

  1. rerun query when visualize modal is triggered (this might not work with large queries and async ones

this could be a good solution but would definitely be more time consuming to get it right. i think in this case we would want to show an icon/tooltip that says re-run query to visualize. once clicked we would switch back to the results tab, update the query in the editor, and automatically start running the query. we would want to do this so the user can see that the query is running. however we also have an icon/tooltip that says overwrite text in editor with this query which is essentially the same thing, minus auto-running the query.

i think the best solution here, balancing impact and effort, would be to remove the visualize icon from the query history list, and only have access to it from the results tab.

@vera-liu vera-liu force-pushed the vliu_visualize_modal_bug branch from 8af4f58 to 8c62da4 Compare December 1, 2016 17:40
@vera-liu
Copy link
Contributor Author

vera-liu commented Dec 1, 2016

Done:

  • After discussing, I decided to leave columns in results when flushing data out (only results.columns are used by VisualizeModal, and they are pretty lightweight, should be ok to keep them in store while flushing results.data)
  • I also move setState from componentWillMount to componentWillReceiveProps in VisualizeModal, as I found that componentWillMount is not called when switching from one query's modal to another, causing issue https://github.com/airbnb/superset/issues/1463

@mistercrunch mistercrunch changed the title Fixed js error when results are not available [sqllab] Fixed js error when results are not available Dec 1, 2016
@vera-liu vera-liu force-pushed the vliu_visualize_modal_bug branch from dbf3d8e to 1566f9f Compare December 1, 2016 19:44
@bkyryliuk
Copy link
Member

@vera-liu - LGTM, please test on staging

@vera-liu vera-liu merged commit eb0655c into apache:master Dec 5, 2016
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.15.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.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants