-
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
don't autoexecute query on changing datasource #2652
Conversation
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 think it's a good idea, but my only concern is that if we leave previous results it might be confusing.
Maybe we should remove previous results when switching data sources?
That makes sense to me Arik. I'm assuming you mean just hide the display of the results from the UI. There is already a |
No, actually the important thing is to clear the reference to the last result ( |
@arikfr That's already happening here: https://github.com/getredash/redash/blob/master/client/app/pages/queries/view.js#L305 |
@arikfr Do I need to do anything else before this can be merged? |
@alison985 Let's wait till Arik is back for this to merge. |
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 think this should be written with a boolean state that describes if the datasource has changed, as a $scope.dataSourceChanged
.
Additionally, I think we'll need to set $scope.dataSourceChanged
when the query is executed manually to reset the result/viz div.
client/app/pages/queries/view.js
Outdated
@@ -120,6 +120,7 @@ function QueryViewCtrl( | |||
Notifications.getPermissions(); | |||
}; | |||
|
|||
$scope.dataSourceHasNotChanged = true; |
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.
Let's turn around the logic and call this dataSourceChanged
with a default of false
so we don't have to deal with a double negative 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.
@jezdez Updated.
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.
@alison985 Thank you! 😃
@jezdez Ready for Review. |
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.
Minor issue with inline styles, LGTM otherwise.
client/app/pages/queries/query.html
Outdated
@@ -217,7 +217,9 @@ <h3> | |||
<!-- End of Query Execution Status --> | |||
|
|||
<!-- tabs and data --> | |||
<div ng-if="showDataset" class="flex-fill p-relative"> | |||
<div ng-if="showDataset && dataSourceChanged" class="flex-fill p-relative"> | |||
<div class="d-flex flex-column p-absolute" style="left: 0; top: 0; right: 0; bottom: 0;"> |
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.
This opens a new div
without closing it, and also uses inline styles. Is this needed or just for debugging purposes?
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.
These lines actually look like the result of a bad merge as they serve no purpose. I've removed them. The in-line styles below were there before me.
client/app/pages/queries/query.html
Outdated
@@ -217,7 +217,7 @@ <h3> | |||
<!-- End of Query Execution Status --> | |||
|
|||
<!-- tabs and data --> | |||
<div ng-if="showDataset" class="flex-fill p-relative"> | |||
<div ng-if="showDataset && dataSourceChanged" class="flex-fill p-relative"> |
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.
So... it will show the data set if the data source was changed?
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.
Docker Hub issue made build fail. When Docker Hub is back up the build should be rerun. |
+1 This could be especially dangerous when developing a mutation query on a test database. If the schemas are similar enough, it could successfully and unintentionally auto-execute while switching over to a prod data source. |
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 I understand it correctly, dataSourceChanged
is needed only in view. But in view mode, you can't change the data source...
Hi, (This is a template message, but I mean every word of it. Also you're welcome to reply) Thank you for making this contribution. While we couldn't bring it to completion and merge, it's still very much appreciated. 🙇 In the past year the Redash code base gone under massive updates: on the backend we moved to Python 3 & RQ instead of Celery and on the frontend we replaced Angular with React. It's very likely this makes this PR irrelevant without significant changes. :-( I'm closing this PR now. But if you're still interested in making it happen, let me know and I will reopen. Thanks. |
@arikfr I'm a bit confused by your last review comment, you're right that changing the source is only possible in edit mode, but I still see a request happening against the server when the source is changed there, and I believe the query is actually executed. I'd appreciate if you'd double-check this on your side so we can close this. Here's a screen recording of the current master executing the query when changing a data source (if it's the same type of data source): https://dsc.cloud/a46d84/RhVthKiRVrg1Od79fBzY |
I just tried it out on https://redash-preview.netlify.com/ and couldn't reproduce it. And looking at your video again I can see that it's definitely not the latest master. Maybe you didn't rebuild the assets? |
Lemme check again, thanks! |
You right, @arikfr, that was it :) Sorry for the noise! |
fixes #2651
This is a port of a Mozilla feature upstream.