-
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 #2484: Dynamic portfolio fields #2548
Conversation
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
src/registrar/templates/django/admin/portfolio_change_form.html
Outdated
Show resolved
Hide resolved
Co-authored-by: Matt-Spence <[email protected]>
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
@Matt-Spence Those changes are ready! |
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 changes
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.
Will run code and finalize review next.
|
||
|
||
@login_required | ||
@staff_member_required |
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 seems redundant with the superuser and analyst checks you're doing below. That's not a bad thing, but I'm wondering why you bothered with the decorator?
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 decorator redirects you to the admin login page and basically does the default django checks for admin perms. Tiny QOL thing, otherwise you do get blocked but you can technically still """access""" the endpoint
"""Save override for custom properties""" | ||
|
||
# The urbanization field is only intended for the state_territory puerto rico | ||
if self.state_territory != self.StateTerritoryChoices.PUERTO_RICO and self.urbanization: |
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 needs a unit test
|
||
let emailWasSent = document.getElementById("action-needed-email-sent"); | ||
if (!emailWasSent) { |
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.
Line 534 should be handling this and !actionNeededEmail || !actionNeededReasonDropdown cases
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 added these because this script was failing on the portfolio page, causing script execution to stop (on textContent because the query returned none). That said I can simplify these checks to just check on if action-needed-emails-data exists or not before trying to do .textContent
} | ||
|
||
// $ symbolically denotes that this is using jQuery | ||
let $federalAgency = django.jQuery("#id_federal_agency"); |
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 use django.JQuery instead of getElement or querySelector?
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.
Ah, its because everywhere else in the app federal agency is a select2 (autocomplete field). The portfolio page is still undergoing some work - so its likely that this will be added to that as well. Doing it this way gives us out of the box support so we don't have to alter this script when we do.
For context: you can't do .value on Select2 objects. You can only manipulate them through jQuery, its a quirk of that particular library. Went down that rabbit hole a few tickets ago
🥳 Successfully deployed to developer sandbox meoward. |
🥳 Successfully deployed to developer sandbox meoward. |
@rachidatecs Got your changes in. Pushing them up to litterbox now |
🥳 Successfully deployed to developer sandbox meoward. |
What does that mean? "Otherwise, if "Non-Federal Agency" is selected, type federal will be deselected." |
@rachidatecs Basically, the organization_type field will be set to federal automatically UNLESS its Non-Federal Agency. If it is, it'll set the field to None (assuming it isn't another value like County or something) |
🥳 Successfully deployed to developer sandbox meoward. |
Ticket
Resolves #2484
Changes
load_senior_official_table
script for this to work, as no data exists otherwise - or create dummy federal agenciesContext for reviewers
This PR attaches some javascript logic to the Portfolio page.
It does the following:
Note:
As noted, this ticket automatically populates the senior_official and organization_type fields based off of the current federal_agency selection.
Due to the nature of the data, senior_official required an admin-only API that returns the field id based off of the federal agency name. This is accessible to analysts and superusers, though do note that the portfolio page isn't yet visible to analysts yet (as that comes down the road).
Setup
load_senior_officials_table
script. Instructions here.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