-
Notifications
You must be signed in to change notification settings - Fork 69
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
(User roles) Create useNavigation hook and extract scopes to constants #7741
Conversation
Strings are vulnerable to typos so constants are safer
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
f5ce962
to
fa5cd7a
Compare
6ca9679
to
29a8563
Compare
Used scope constants in authorization
@@ -672,7 +600,7 @@ const NavigationView = (props: IFullProps) => { | |||
} | |||
/> | |||
)} | |||
{hasPerformance && userDetails && ( | |||
{userDetails && hasAccess(WORKQUEUE_TABS.report) && ( |
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.
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 is in the original PR too, i think.
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.
Yeah, even on develop there are 2 navigation items that point to performance. The 2nd one just has an id of report and a different icon but both call the props.goToPerformanceViewAction
@@ -89,6 +89,87 @@ export const scopes = [ | |||
] as const |
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.
@Zangetsu101 Shouldn't we remove constants from /client/src/utils/gateway.ts
since this is a file that is auto generated? Otherwise, the auto generation would be hampered more.
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 is still being auto generated no? 😅
Create
useNavigation
hook to extract scope logic away from the Navigation component.Changed scope list to constants in the commons package so they can be referenced anywhere in the app by name rather than a magic string.
fixed issue: #7433