-
Notifications
You must be signed in to change notification settings - Fork 19
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
Ticket #2756: Edit member access page - [ZA] #3216
Conversation
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
@@ -16,7 +18,28 @@ class UserPortfolioRoleChoices(models.TextChoices): | |||
|
|||
@classmethod | |||
def get_user_portfolio_role_label(cls, user_portfolio_role): |
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.
Unrelated bug I found in some weird data edge cases. Doesn't hurt to include
return f"Unknown ({user_portfolio_role})" | ||
|
||
@classmethod | ||
def get_role_description(cls, user_portfolio_role): |
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 usually don't like encoding large strings in python like this, but all things considered this seemed like the best spot for this sort of thing as opposed to a squirrelled away html file
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.
Fair.
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
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.
Looking through the code...
Overall, nice work! I know we talked through some of the changes in person, but I added a few comments anyways to indicate I am good with alot of the refactoring.
Just a few requests to add code comments.
src/registrar/admin.py
Outdated
@@ -4004,6 +4004,10 @@ def changelist_view(self, request, extra_context=None): | |||
if extra_context is None: | |||
extra_context = {} | |||
extra_context["dns_prototype_flag"] = flag_is_active_for_user(request.user, "dns_prototype_flag") | |||
# Normally you have to first enable the org feature then navigate to an org before you see these. | |||
# Lets just auto-populate it on page load to make development easier. |
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.
Agreed
populatePermissionDetails('new-member-basic-permissions'); | ||
if (selectedAccess && selectedAccess.value === 'organization_admin') { | ||
populatePermissionDetails('member-admin-permissions'); | ||
accessText = "Admin" |
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 like this separation of data and display text
@@ -44,5 +36,7 @@ initMembersTable(); | |||
initMemberDomainsTable(); | |||
initEditMemberDomainsTable(); | |||
|
|||
initPortfolioMemberPageToggle(); | |||
// Init the portfolio new member page | |||
initPortfolioMemberPageRadio(); |
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 feel like we should start bundling inits()
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.
Yes, I agree. On a few of the other tickets we have worked on recently, we have consolidated inits to one init per page in the main.js.
@@ -38,21 +38,21 @@ export function hookupYesNoListener(radioButtonName, elementIdToShowIfYes, eleme | |||
**/ | |||
export function hookupRadioTogglerListener(radioButtonName, valueToElementMap) { | |||
// Get the radio buttons | |||
let radioButtons = document.querySelectorAll('input[name="'+radioButtonName+'"]'); | |||
let radioButtons = document.querySelectorAll(`input[name="${radioButtonName}"]`); |
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.
Nice cleanup
src/registrar/forms/portfolio.py
Outdated
return cleaned_data | ||
|
||
def map_cleaned_data_to_instance(self, cleaned_data, instance): |
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.
(Change Request): Can you add more comments here to explain this architecture? I know we went over it, but it can be hard to know at first glance what is going on if you are looking at it for the first time.
@@ -110,7 +110,7 @@ def _get_portfolio_permissions(self): | |||
return self.get_portfolio_permissions(self.roles, self.additional_permissions) | |||
|
|||
@classmethod | |||
def get_portfolio_permissions(cls, roles, additional_permissions): | |||
def get_portfolio_permissions(cls, roles, additional_permissions, get_list=True): |
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.
(Change Request): Add comment to quickly describe the usage of get_list
{% endfor %} | ||
</div> | ||
{% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %} | ||
{% input_with_errors form.role %} |
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.
Definitely cleaner!
return f"Unknown ({user_portfolio_role})" | ||
|
||
@classmethod | ||
def get_role_description(cls, user_portfolio_role): |
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.
Fair.
<h2>Admin access permissions</h2> | ||
<p>Member permissions available for admin-level acccess.</p> | ||
|
||
<h3 class="summary-item__title | ||
text-primary-dark | ||
margin-bottom-0">Organization domain requests</h3> | ||
{% with group_classes="usa-form-editable usa-form-editable--no-border padding-top-0" %} | ||
{% input_with_errors form.admin_org_domain_request_permissions %} | ||
{% input_with_errors form.domain_request_permission_admin %} |
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 like this name better, too
if form.is_valid(): | ||
# Check if user is removing their own admin or edit role |
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.
Good check
@dave-kennedy-ecs, @rachidatecs -- looks like this refactor causes a conflict in the logic for e-mail sending behavior (the ticket you guys are working on). Let Zander and I know if you'd like to huddle on this. I think fundamentally it is just deciding where we want this logic to be and coordinating that part of the code. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
{% block messages %} | ||
{% include "includes/form_messages.html" %} | ||
{% endblock %} |
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.
Fixes a bug where messages display twice on this page due to base views implementing this
🥳 Successfully deployed to developer sandbox za. |
1 similar comment
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
1 similar comment
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
1 similar comment
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
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
🥳 Successfully deployed to developer sandbox za. |
Ticket
Resolves #2765
Changes
Context for reviewers
Setup
To test this PR, enable the organization_feature and organization_members flag. On members, click edit on a member.
Code Review Verification Steps
As the original developer, I have
Satisfied acceptance criteria and met development standards
Ensured code standards are met (Original Developer)
Validated user-facing changes (if applicable)
As a code reviewer, I have
Reviewed, tested, and left feedback about the changes
Validated user-facing changes as a developer
Note: Multiple code reviewers can share the checklists above, a second reviewer should not make a duplicate checklist. All checks should be checked before approving, even those labeled N/A.
As a designer reviewer, I have
Verified that the changes match the design intention
Validated user-facing changes as a designer
References
Screenshots