Skip to content
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

feat: Add manage segment overrides permission in UI #2936

Merged
merged 4 commits into from
Nov 14, 2023

Conversation

novakzaballa
Copy link
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

  • Add Permission MANAGE_SEGMENT_OVERRIDES in UI
  • Add the "manage_segment_overrides_env_role" flag

How did you test this code?

  • Grant or remove the MANAGE_SEGMENT_OVERRIDES permission will enable or disable the ability to edit segment overrides in the Edit Feature modal and Edit Segment modal.

Copy link

vercel bot commented Nov 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 8:05pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 8:05pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 8:05pm

@github-actions github-actions bot added the front-end Issue related to the React Front End Dashboard label Nov 7, 2023
@novakzaballa novakzaballa linked an issue Nov 7, 2023 that may be closed by this pull request
4 tasks
Copy link
Contributor

github-actions bot commented Nov 7, 2023

Uffizzi Preview deployment-40221 was deleted.

@novakzaballa novakzaballa requested review from a team and gagantrivedi November 7, 2023 18:27
@gagantrivedi gagantrivedi self-assigned this Nov 13, 2023
@gagantrivedi
Copy link
Member

vercel is not working for me to review this. Maybe @kyle-ssg is a better person to review this?

Comment on lines +567 to +571
<Permission
level='project'
permission={'MANAGE_SEGMENTS'}
id={this.props.projectId}
>
Copy link
Contributor

@zachaysan zachaysan Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this permission be MANAGE_SEGMENT_OVERRIDES?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was following the advice you left in this comment. #1676 (comment)

In addition to the above, please also hide the Create Feature-Specific Segment button if the user is missing the project permission MANAGE_SEGMENTS since they will not be able to create a segment if that permission is missing.

I thought it made sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, this button creates a Feature-Specific segment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, of course. Thanks for double checking Novak!

@novakzaballa
Copy link
Contributor Author

Using this branch feat/add_permission_for_manage_segments_overrides for local development.

Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code overall looks good, but I have a couple of small comments / questions.

Comment on lines 618 to 621
if (this.state.selectedSegment) {
this.props.setShowCreateSegment(false)
} else {
this.props.setShowCreateSegment(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the if-else statement here and stick to just one if statement, since both branches of the if-else statement call the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this is not my code, it is a change in the format, but we can optimize it. Done.

Copy link
Contributor

@zachaysan zachaysan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall!

Merged via the queue into main with commit 88c43cd Nov 14, 2023
18 checks passed
@novakzaballa novakzaballa deleted the feat/add-manage-segment-overrides-permission-in-ui branch November 14, 2023 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Manage segment overrides" environment permission
3 participants