-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Poll for results in parameterized embeds #3752
Conversation
result (as opposed to fetching the query result by ID)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment & the UI need to show load status (similar to what we do with dashboard widgets).
@@ -9,5 +9,8 @@ | |||
<i class="zmdi zmdi-settings"></i> | |||
</button> | |||
<parameter-value-input param="param"></parameter-value-input> | |||
<button class="m-l-5 btn btn-primary" ng-if="onRefresh" ng-click="onRefresh()" title="Refresh Dataset"> | |||
<span class="zmdi zmdi-play"></span> | |||
</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this just executes query refresh, why not put it outside the parameters component?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter directive's containing div is a block, so putting it outside would cause the button to drop below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 not ideal, but it's temporary, so YOLO... maybe add a comment for @gabrieldutra to remove this once he's done with #3737 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙄
hey, @gabrieldutra! remove this once you're done with #3737!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Redirect to default parameter values when parameters are missing in embedded visualizations * Revert "Redirect to default parameter values when parameters are missing in" This reverts commit 43c6550. * load all data after page is loaded * return no data only when parameters are missing * data binding no longer required * show an error on embeds that fail to load * data binding no longer required * present full-page error when dealing with unsafe queries
Three things that immediately stood out:
|
|
1. This preloads the query before rendering the page, so we can benefit from using default parameters & make the logic in component simpler. 2. Use a single way to load results, to make sure we do polling when try to load the query results for the first time.
|
||
document.querySelector('body').classList.add('headless'); | ||
|
||
this.refreshQueryResults(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if (this.query.is_safe) { | ||
this.refreshQueryResults(); | ||
} else { | ||
this.error = "Can't embed queries with text parameters."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd avoid being too specific on what are unsafe queries here, as the definition is subject to change soon and this message will likely be left unattended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it will change so soon... and until we have documentation about what are safe parameters, it's better to have a meaningful message.
YOLO 😎 |
* add an endpoint for fetching job using a query's api_key * when unauthenticated, use api_key to get job, and fetch the latest query result (as opposed to fetching the query result by ID) * add 'refresh dataset' button to parameters directive * fix scope error introduced by earlier commit * show timer when refreshing results * Show input for missing parameters in embedded visualizations (getredash#3741) * Redirect to default parameter values when parameters are missing in embedded visualizations * Revert "Redirect to default parameter values when parameters are missing in" This reverts commit 43c6550. * load all data after page is loaded * return no data only when parameters are missing * data binding no longer required * show an error on embeds that fail to load * data binding no longer required * present full-page error when dealing with unsafe queries * don't render the execute button for each parameter * show 'missing parameter value' error * Don't reload the whole page when parameter value changes. * Set API key and load config before rendering. * Add Query#hasParameters method. * Don't show download controls for parameterized queries (they won't work). * Use getUrl to construct a correct query link. * WIP: have a single way to load results 1. This preloads the query before rendering the page, so we can benefit from using default parameters & make the logic in component simpler. 2. Use a single way to load results, to make sure we do polling when try to load the query results for the first time. * Show persistent errors and finish loading logic. * Check if query is safe and show message otherwise. * Fix test for unsafe parameters embed. * wait for query results to return before taking snapshot
What type of PR is this? (check all applicable)
Description
Turns out that parameters in parameterized embeds did not poll for query results. This PR fixes this by allowing polling of job status by api_key, followed by fetching of the latest cached query result.
Related Tickets & Documents
Fixes the second part of #3719
Mobile & Desktop Screenshots/Recordings (if there are UI changes)