-
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
#2402: Design Review for Analyst Portfolio View - [ZA] - MIGRATION #2842
Conversation
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
1 similar comment
🥳 Successfully deployed to developer sandbox za. |
@Katherine-Osos All those changes should be in! |
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
get_all_action_needed_reason_emails, | ||
get_action_needed_reason_default_email, | ||
get_field_links_as_list, | ||
) | ||
from registrar.models import Contact, Domain, DomainRequest, DraftDomain, User, Website, SeniorOfficial |
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 is great cleanup here~
return get_field_links_as_list(queryset, "portfolio", msg_for_none="No portfolios.") | ||
|
||
portfolios.short_description = "Portfolios" # type: ignore | ||
|
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 does '#type: ignore' mean?
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.
Its for ignoring type checking with our linter. Its just a bit overzealous here so we've been doing that on these particular functions
@@ -3052,7 +3039,7 @@ class PortfolioAdmin(ListHeaderAdmin): | |||
("Senior official", {"fields": ["senior_official"]}), | |||
] | |||
|
|||
list_display = ("organization_name", "federal_agency", "creator") | |||
list_display = ("organization_name", "organization_type", "federal_type", "creator") | |||
search_fields = ["organization_name"] | |||
search_help_text = "Search by organization name." | |||
readonly_fields = [ |
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.
on the changes description, it says that help text is Search by portfolio 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.
Ah sorry - this is correct! I just forgot to fix that in the ticket. We eventually renamed it to this. Great eye!
} | ||
}) | ||
.catch(error => console.error("Error fetching senior official: ", error)); | ||
|
||
} | ||
|
||
function updateSeniorOfficialDropdown(dropdown, seniorOfficialId, seniorOfficialName) { | ||
if (!seniorOfficialId || !seniorOfficialName || !seniorOfficialName.trim()){ | ||
// Clear the field if the SO doesn't exist |
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 might be a nitpick. Would !seniorOfficialName
and !seniorOfficialName.trim()
both pass if seniorOfficialName
was invalid?
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.
If the senior official name contains a space, I think it would evaluate to true. Its basically catching that particular edge case.
I'd have to look again but I think the compiler knows how to optimize this such that if !seniorOfficialName, then it'll just enter the loop without computing the rest. It works this way in python as you can do if something and something.field and something.field.another_field
and it doesn't error out
@zandercymatics On the Domain Request and Domains pages … I changed my mind about the “Portfolio” helper text. Let’s remove that completely; it seems unnecessary (but keep the helper text for “Suborganization.”) Other than that, this looks great! I'll approve once that helper text is removed! |
🥳 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
@Katherine-Osos Removed! Can you take another look? |
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.
Woot woot! Looks great, @zandercymatics!
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
1 similar comment
🥳 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.
Good stuff
let seniorOfficialLink = `<a href=/admin/registrar/seniorofficial/${seniorOfficialId}/change/>${seniorOfficialName}</a>` | ||
readonlySeniorOfficial.innerHTML = seniorOfficialName ? seniorOfficialLink : "-"; |
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 seniorOfficialId isn't user-supplied data is it? I'm a bit fuzzy on what the api call above will return, so I just want to check what the data.id that's being used here actually is. We need to be careful when supplying data in href's that will be passed into an innerHTML object like it is below, as it creates a possible vector for cross-site-scripting attacks. I don't think it's an issue here but want to double check.
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 seniorOfficialId isn't user-supplied data is it
Nope, this is the PK of the senior official field. I believe it gets pulled from the model. Since only superusers / analysts can access this field (and since it pulls from a table they already have access to) I figured this approach would be OK.
I'm a bit fuzzy on what the api call above will return
Check out the get_senior_official_from_federal_agency_json
function. It basically just returns a json representation of the senior official object which they would normally have access to on the senior official table
🥳 Successfully deployed to developer sandbox za. |
🥳 Successfully deployed to developer sandbox za. |
Ticket
Resolves #2402
Changes
All of the following changes are in django admin.
Portfolio table:
On the portfolio page:
On the UserPortfolioPermission page:
On the federal agencies field:
On the suborganization page:
On the User page:
On the Domain information / Domain request pages:
Context for reviewers
This PR addresses changes related to the design review of the analyst portfolio view. So - essentially milestone features that touch on /admin. You will need to test the changes detailed above.
Setup
Visit and test the following pages in django admin as an analyst:
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