-
Notifications
You must be signed in to change notification settings - Fork 18
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
#2763: Expanded row functionality - [DK] #2945
base: main
Are you sure you want to change the base?
Conversation
…rtfolio_members_json response
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
1 similar comment
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
🥳 Successfully deployed to developer sandbox dk. |
roles=[UserPortfolioRoleChoices.ORGANIZATION_ADMIN], | ||
additional_permissions=[ | ||
UserPortfolioPermissionChoices.VIEW_MEMBERS, | ||
UserPortfolioPermissionChoices.EDIT_MEMBERS, | ||
], | ||
) | ||
UserPortfolioPermission.objects.create( | ||
user=cls.user2, | ||
portfolio=cls.portfolio, | ||
user=self.user2, |
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.
compliment: love the switch to being consistent here!
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.
spanElement.textContent = 'Close'; | ||
useElement.setAttribute('xlink:href', '/public/img/sprite.svg#expand_less'); | ||
buttonParentRow.classList.add('hide-td-borders'); | ||
toggleButton.setAttribute('aria-label', 'Close additional information'); |
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 attention to screenreaders
let toggleButtons = document.querySelectorAll('.usa-button--show-more-button'); | ||
toggleButtons.forEach((toggleButton) => { | ||
|
||
let dataFor = toggleButton.dataset.for; |
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.
(nitpick / optional) could use a small comment explaining dataFor
@@ -1873,6 +1873,88 @@ class MembersTable extends LoadTableBase { | |||
constructor() { | |||
super('.members__table', '.members__table-wrapper', '#members__search-field', '#members__search-field-submit', '.members__reset-search', '.members__reset-filters', '.members__no-data', '.members__no-search-results'); | |||
} | |||
|
|||
initShowMoreButtons() { |
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.
Missing a function comment for initShowMoreButtons
try { | ||
if (!isNaN(parsedDate.getTime())) { // Check if the date is valid | ||
last_active_display = parsedDate.toLocaleDateString('en-US', options); | ||
last_active_sort_value = parsedDate.getTime(); // sort as numeric value, seconds since 1970 |
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.
(Q) Why are we sorting as a numeric value rather than on date? Totally fine with it, but doesn't USWDS have support for sorting dates?
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 have to sort dates as well as string values, namely 'Invalid date' and 'Invited'. Assigned each of these a numeric value (0 and 1) and sorted dates according to time since epoch
} else { | ||
throw new Error(invalid_date); // Throw an error to catch in catch block | ||
} |
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.
(Optional) This seems a bit "roundabout", though I do like that you are handling NAN. This might be a good use case for an early return block
} | ||
domainsHTML += "</ul>"; | ||
if (num_domains >= 6) { | ||
domainsHTML += "<p><a href='#'>View assigned domains</a></p>"; |
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.
(Blocking) shouldn't this do a redirect?
if (member_permissions.includes(UserPortfolioPermissionChoices.VIEW_ALL_DOMAINS)) { | ||
permissionsHTML += "<p class='margin-top-1 p--blockquote'><strong class='text-base-dark'>Domains:</strong> Can view all organization domains. Can manage domains they are assigned to and edit information about the domain (including DNS settings).</p>"; | ||
} else if (member_permissions.includes(UserPortfolioPermissionChoices.VIEW_MANAGED_DOMAINS)) { | ||
permissionsHTML += "<p class='margin-top-1 p--blockquote'><strong class='text-base-dark'>Domains:</strong> Can manage domains they are assigned to and edit information about the domain (including DNS settings).</p>"; | ||
} | ||
if (member_permissions.includes(UserPortfolioPermissionChoices.EDIT_REQUESTS)) { | ||
permissionsHTML += "<p class='margin-top-1 p--blockquote'><strong class='text-base-dark'>Domain requests:</strong> Can view all organization domain requests. Can create domain requests and modify their own requests.</p>"; | ||
} else if (member_permissions.includes(UserPortfolioPermissionChoices.VIEW_ALL_REQUESTS)) { | ||
permissionsHTML += "<p class='margin-top-1 p--blockquote'><strong class='text-base-dark'>Domain requests (view-only):</strong> Can view all organization domain requests. Can't create or modify any domain requests.</p>"; | ||
} | ||
if (member_permissions.includes(UserPortfolioPermissionChoices.EDIT_MEMBERS)) { | ||
permissionsHTML += "<p class='margin-top-1 p--blockquote'><strong class='text-base-dark'>Members:</strong> Can manage members including inviting new members, removing current members, and assigning domains to members."; | ||
} else if (member_permissions.includes(UserPortfolioPermissionChoices.VIEW_MEMBERS)) { | ||
permissionsHTML += "<p class='margin-top-1 p--blockquote'><strong class='text-base-dark'>Members (view-only):</strong> Can view all organizational members. Can't manage any members."; |
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.
(nitpick / optional) I anticipate that this list might grow in the future. Would you be able to separate this permissionshtml area out into a helper function just so we keep these two areas clean?
@classmethod | ||
def to_dict(cls): | ||
return {key: value.value for key, value in cls.__members__.items()} |
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.
Not needed - you can use pythons built in .__dict__
attribute for dictionary conversion
actual_additional_permissions = { | ||
permission for member in data["members"] for permission in member["permissions"] | ||
} | ||
self.assertTrue(expected_additional_permissions.issubset(actual_additional_permissions)) |
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.
(Q) Why issubset?
member_display=F("email"), | ||
# Use ArrayRemove to return an empty list when no domain invitations are found |
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.
What would return without it?
Ticket
Resolves #2763
Changes
Context for reviewers
Setup
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
Ensured code standards are met (Code reviewer)
Validated user-facing changes as a developer
New pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
Checked keyboard navigability
Meets all designs and user flows provided by design/product
Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
Tested with multiple browsers, the suggestion is to use ones that the developer didn't (check off which ones were used)
(Rarely needed) Tested as both an analyst and applicant user
Note: Multiple code reviewers can share the checklists above, a second reviewers should not make a duplicate checklist
As a designer reviewer, I have
Verified that the changes match the design intention
Validated user-facing changes as a designer
Checked keyboard navigability
Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
Tested with multiple browsers (check off which ones were used)
(Rarely needed) Tested as both an analyst and applicant user
Screenshots