-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Project-based permissioning TopNavigation
#6027
Conversation
@mariusandra I want to add Do you perhaps have clue what's wrong? |
TopNavigation
TopNavigation
I think if you manually mount |
Thanks! ❤️ Mounting However there's still a different type of issue: In Jest we have a way of mocking the |
We currently don't. My undocumented plan was to extend this widget: ... and turn it into a practical network request recording/playback tool. Basically it would have 2-4 modes: 1) live (connect somewhere like now), 2) live, but recording every It should be quite easy to extend it to support this, but I haven't found the time yet. |
Here's a HN comment by somebody else who has actually done just that, but no code to share. And here's one that's also interesting from this thread. However, I think there's also a bug here. Normally we shouldn't load |
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.
lgtm! only thing is that the component doesn't seem to be rendering correctly on Storybook
@@ -251,6 +282,10 @@ export function TopNavigation(): JSX.Element { | |||
} | |||
) | |||
} | |||
style={{ | |||
cursor: isProjectCreationForbidden ? 'default' : undefined, | |||
color: isProjectCreationForbidden ? 'var(--text-muted)' : undefined, |
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.
color: isProjectCreationForbidden ? 'var(--text-muted)' : undefined, | |
color: isProjectCreationForbidden ? 'var(--text-muted)' : 'var(--primary)', |
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.
Would prefer not to, to keep consistency between "Create new project" and "Create new organization"
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 don't think we need consistency among these, they're in different places, plus adding a project is probably a lot more frequent than an org. I'm also wondering if the create org should also be primary color.
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.
Alrighty, made both primary
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
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.
<Layout> | ||
<MainNavigation /> | ||
<Layout> | ||
<TopNavigation /> |
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.
That's because of the issue discussed in #6027 (comment)
This looks like it could somehow help, but I've no idea how to make use of it:
function ProjectRow({ team }: { team: TeamBasicType }): JSX.Element { | ||
const { currentTeam } = useValues(teamLogic) | ||
const { updateCurrentTeam } = useActions(userLogic) | ||
const { push } = router.actions |
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.
Nit: This could also be a useActions(router)
for consistency. Makes no real difference, as push
is an action and router
is always mounted, but still nit nit nit.
Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
* Fix Access Control restriction tooltip * Add `TeamMemberAccessPermission` and use it in viewsets * Add `ErrorProjectUnavailable` scene * Ignore mypy * Update MainNavigation.tsx * Update explicit_team_member.py * Fix frontend detection of unavailable project * Fix some tests and edge cases * Fix basic permissions * Add more tests * Simplify `ExplicitTeamMemberViewSet` permissions * Improve restrictions and add moar tests * Update frontend * Fix a couple of things * Fix import * Fix some edge cases * Fix typing errors * Use hedgehog instead of moth Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com> * Address feedback * Add proper permissioning to dashboard views * Update ee/api/test/test_dashboard.py Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com> Co-authored-by: Paolo D'Amico <paolodamico@users.noreply.github.com>
Changes
This adjusts
TopNavigation
UI for #5976 like this:Project switcher with an allowed project and a restricted project (restricted only if project-based permissioning is available and enabled)
Change extracted from #5976 for clarity.
Resolves #4263 when merged with #6068.