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

Ticket #2520: Admin portfolio view #2581

Merged
merged 26 commits into from
Aug 16, 2024
Merged

Conversation

zandercymatics
Copy link
Contributor

@zandercymatics zandercymatics commented Aug 13, 2024

Ticket

Resolves #2520

Changes

  • Adds custom fields to the admin portfolio view
  • Changes the admin portfolio view to match the design
  • Removes help_text on some portfolio properties that do not match the figma / adds verbose_names
  • Added a federal type field as this did not exist before

Context for reviewers

This PR excludes the domain members and domain groups sections, as that will be implemented later. I've included functions that can be used to easily include those.

One difference from the view and this is that the federal type (executive, etc) is readonly for analysts only, but not for superusers as you can't actually add data to that field otherwise. This can be changed to be readonly for everyone, though. cc: @abroddrick - is this OK?

Setup

  1. Create a portfolio or use an existing one (example data exists on getgov-za)
  2. Add this portfolio record to suborganizations, domain requests, and domain information objects

Code Review Verification Steps

As the original developer, I have

Satisfied acceptance criteria and met development standards

  • Met the acceptance criteria, or will meet them in a subsequent PR
  • Created/modified automated tests
  • Added at least 2 developers as PR reviewers (only 1 will need to approve)
  • Messaged on Slack or in standup to notify the team that a PR is ready for review
  • Changes to “how we do things” are documented in READMEs and or onboarding guide
  • If any model was updated to modify/add/delete columns, makemigrations was ran and the associated migrations file has been commited.

Ensured code standards are met (Original Developer)

  • All new functions and methods are commented using plain language
  • Did dependency updates in Pipfile also get changed in requirements.txt?
  • Interactions with external systems are wrapped in try/except
  • Error handling exists for unusual or missing values

Validated user-facing changes (if applicable)

  • New pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • Add at least 1 designer as PR reviewer

As a code reviewer, I have

Reviewed, tested, and left feedback about the changes

  • Pulled this branch locally and tested it
  • Reviewed this code and left comments
  • Checked that all code is adequately covered by tests
  • Made it clear which comments need to be addressed before this work is merged
  • If any model was updated to modify/add/delete columns, makemigrations was ran and the associated migrations file has been commited.

Ensured code standards are met (Code reviewer)

  • All new functions and methods are commented using plain language
  • Interactions with external systems are wrapped in try/except
  • Error handling exists for unusual or missing values
  • (Rarely needed) Did dependency updates in Pipfile also get changed in requirements.txt?

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)

    • Chrome
    • Microsoft Edge
    • FireFox
    • Safari
  • (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

  • Checked that the design translated visually
  • Checked behavior
  • Checked different states (empty, one, some, error)
  • Checked for landmarks, page heading structure, and links
  • Tried to break the intended flow

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)

    • Chrome
    • Microsoft Edge
    • FireFox
    • Safari
  • (Rarely needed) Tested as both an analyst and applicant user

Screenshots

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Comment on lines +12 to 14
</br>
{% endif %}
</br>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a bug with our existing detail list

Comment on lines -4 to -12
{% block after_related_objects %}
<div class="module aligned padding-3">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@CocoByte I had to remove this to match the mockup, sadly! Was this section of code going to be used elsewhere as well? I don't want to throw all of this away unless I have to

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 this is copied over from user_change_form. I don't like that we're doing the same thing in 2 different ways now, should probably bring this up to Alysia and design.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nah its separate. This code added the following design below:
image

I do agree though that there is an inconsistency though. @abroddrick the design on this miro does conflict with the design on this older ticket, is this what we want?

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 don't like that we're doing the same thing in 2 different ways now

@rachidatecs Can you elaborate more on what you mean here? Just want to make sure I am interpreting you correctly

Copy link
Contributor

Choose a reason for hiding this comment

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

Same desire for elaboration. But I will say our goals with portfolio is very different than the goal for having domains/requests show on a User.

Copy link
Contributor

Choose a reason for hiding this comment

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

We're using that deleted markup to display related info on user, we're currently using a collapsible fieldset on portfolio (which I understand will change again) - that's it.

Comment on lines +4 to +5
{% block field_sets %}
{% for fieldset in adminform %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Left a placeholder here as the direct follow-on ticket is going to use this view. It doesn't make sense to remove then add this again

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@rachidatecs rachidatecs self-assigned this Aug 14, 2024
related_name="user",
related_name="portfolio_users",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed for the upcoming additions of portfolio members

Copy link

🥳 Successfully deployed to developer sandbox za.

@zandercymatics zandercymatics changed the title (Draft) Ticket #2520: Admin portfolio view (on getgov-bob) Ticket #2520: Admin portfolio view Aug 14, 2024
Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@allly-b
Copy link
Contributor

allly-b commented Aug 14, 2024

@zandercymatics no one should change the federal branch by changing it on a portfolio, that changes it for every portfolio in that agency. I wouldn't even want superusers to do that while on this page. They should go to the federal agency page, OR change the federal agency

@allly-b
Copy link
Contributor

allly-b commented Aug 14, 2024

@zandercymatics we don't need all this info under creator:
Verified by Login.gov
Approved domains: 1
Active requests: 4
Rejected requests: 1

The creator will always be a CISA/Fed employee or our System. All that other info should be empty for most cases

@allly-b
Copy link
Contributor

allly-b commented Aug 14, 2024

Hey for the show hide on domains, we should have the show/hide under the "domains:" and then another under "requests" not have it all together. Also above the show hide, but below the title can you show the total number of domains and then show the total number of requests above the show hide on domain requests?

Nevermind on the above, I just found an old note that we want to change this view to be a link to a filtered view of the domains table and the domain request table respectively. Ignore that for this ticket and don't worry about making any more changes for the domains/domain requests sections.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

1 similar comment
Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@zandercymatics
Copy link
Contributor Author

@rachidatecs / @abroddrick Got those changes in

src/registrar/admin.py Outdated Show resolved Hide resolved
Copy link

🥳 Successfully deployed to developer sandbox za.

@@ -159,3 +159,13 @@ def and_filter(value, arg):
Usage: {{ value|and:arg }}
"""
return bool(value and arg)


@register.filter(name="has_contact_info")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment by Alysia

@zandercymatics
Copy link
Contributor Author

zandercymatics commented Aug 16, 2024

Addressed!


created_on.short_description = "Created on" # type: ignore

def portfolio_type(self, obj: models.Portfolio):
Copy link
Contributor

Choose a reason for hiding this comment

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

Blocking question: I don't understand the difference / inter-relationships between portfolio type, organization type, federal type, federal agency

Copy link
Contributor Author

@zandercymatics zandercymatics Aug 16, 2024

Choose a reason for hiding this comment

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

I do think we need to clamp down on these concepts at some point. I've listed descriptions of each. This may be information you already know, though, but hopefully it helps to have it written out like this? Lmk if you wanted something different.

Basically, portfolio_type and federal_type are needed to fulfill the AC and design of this

portfolio_type

  • Combination of Portfolio.organization_type (Federal, city) and Portfolio.federal_agency.federal_type (Executive, legislative)
  • The FederalAgency table now contains all definitions for all federal_agency values
  • Note: The AC specifically prohibits making
    portfolio_type a DB field and notes that this should be a property. Personally, I think just representing it at the admin.py level though would make sense but that depends on @abroddrick

organization type

  • This is the same as generic_org_type. Basically, it can be Federal, City, Tribal, etc

federal_type

  • This is self.federal_agency.federal_type (executive, legislative)
  • Only describes org types of Federal, basically.
  • Note: As mentioned by Alysia, this should only be changeable from the FederalAgency table. Do you think this should be a db field anyway (w/ custom save logic)? Right now its just a property

federal_agency

  • This is the FederalAgency model. See screenshots

image
image

@@ -847,3 +847,8 @@ div.dja__model-description{
}
}
}

ul.add-list-reset {
Copy link
Contributor

Choose a reason for hiding this comment

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

May not be needed, look at add-list-reset: https://designsystem.digital.gov/utilities/list-reset/

@zandercymatics zandercymatics changed the title (on getgov-bob) Ticket #2520: Admin portfolio view - [migrations] Ticket #2520: Admin portfolio view Aug 16, 2024
@zandercymatics zandercymatics merged commit 4f7414f into main Aug 16, 2024
12 checks passed
@zandercymatics zandercymatics deleted the za/2520-admin-portfolio-view branch August 16, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Django-admin Portfolio view matches mockup
3 participants