-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
fix: show Import button only if has perms #16763
fix: show Import button only if has perms #16763
Conversation
buttonStyle: 'link', | ||
onClick: openChartImportModal, | ||
}); | ||
|
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.
Note line 580 above. I moved this to inside the if (canCreate)
block. Similar for other changes.
4cbc7b1
to
a8dceb1
Compare
a8dceb1
to
b4466e3
Compare
@@ -190,7 +190,7 @@ describe('RTL', () => { | |||
}); | |||
|
|||
it('renders an "Import Chart" tooltip under import button', async () => { | |||
const importButton = screen.getByTestId('import-button'); | |||
const importButton = await screen.findByTestId('import-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.
We now need to wait til the permissions are fetched in useEffect()
.
Codecov Report
@@ Coverage Diff @@
## master #16763 +/- ##
==========================================
- Coverage 76.76% 76.67% -0.09%
==========================================
Files 1007 1005 -2
Lines 54186 54138 -48
Branches 7464 7446 -18
==========================================
- Hits 41595 41511 -84
- Misses 12351 12383 +32
- Partials 240 244 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
* fix: show Import button only if has perms * Fix tests
* fix: show Import button only if has perms * Fix tests
SUMMARY
Only show the "Import" button if the user has the permission to create the object.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
I created a gamma user and removed the
Can write on dashboard
permission. Before this PR they see the import button:After:
TESTING INSTRUCTIONS
Create a gamma user and remove the
Can write dashboard
permission. Import button should not show up.ADDITIONAL INFORMATION