-
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
Feature: Update the Query Owner #6801
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6801 +/- ##
==========================================
- Coverage 63.43% 63.37% -0.06%
==========================================
Files 163 163
Lines 13200 13213 +13
Branches 1822 1825 +3
==========================================
+ Hits 8373 8374 +1
- Misses 4530 4540 +10
- Partials 297 299 +2
|
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 @jredblue, thanks so much for submitting this. On the face of it, it looks pretty well organized and thought out. I'm not feeling confident enough in my knowledge of the redash source to give it a definitive 👍 , but I thought I'd give some preliminary feedback on some things that seem missing.
First, we'd absolutely want some tests for the backend endpoint logic here:
redash/tests/handlers/test_queries.py
Line 77 in 593a828
class TestQueryResourcePost(BaseTestCase): |
Also ideally (maybe required?) we'd need a cypress test for the frontend, might be able to base it off of something existing:
describe("Create Query", () => { |
You may have seen this already, but there's some docs on testing changes here: https://github.com/getredash/redash/wiki/Testing-your-changes
if "data_source_id" in query_def: | ||
data_source = models.DataSource.get_by_id_and_org(query_def["data_source_id"], self.current_org) | ||
require_access(data_source, new_user, not_view_only) | ||
else: |
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.
As the codecov warnings imply, this new functionality really needs a test.
Hmmm, the frontend lint test is failing. @jredblue Are you ok to investigate that and fix whatever is wrong with it? The wiki docs might be useful, depending on how you've setup your development environment:
😄 |
Hey guys thanks for getting back to me! I’ll start working on the backend
logic and frontend tests, as well as investigating the lint failures. I’ll
provide an update after that, appreciate the info!
|
[author.id] | ||
); | ||
|
||
// useEffect(() => { |
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.
Should this be in here? 😄
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.
Oh good catch, I commented this out when working on this as I wasn't sure what exactly it was there for. I modeled this index file after the PermissionsEditorDialog index file, in which the loadOwner function is akin to loadUsersWithPermission function. It used the same useEffect statement, so I could add this back.
Do you know why this code block was necessary for the PermissionsEditorDialog component by chance?
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.
Do you know why this code block was necessary for the PermissionsEditorDialog component by chance?
Unfortunately no. At least "not yet" as I still need to get around to learning React properly. Am more of a backend guy than frontend dev at this stage. 😉
Someone else might know though. 😄
What type of PR is this?
Description
How is this tested?
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
Shows the process for updating the owner of a query. The previous owner will get added to the editor permission list after the update is complete.
Redash_Update_Query_Owner.mp4
Shows the permissions restriction that requires the new query owner to have access to the query's data source.
Redash_Query_Owner_Update_2.mp4