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

[Publisher][Superagencies] Add dropdown for child agencies #1314

Merged
merged 14 commits into from Apr 29, 2024

Conversation

nasaownsky
Copy link
Collaborator

Description of the change

New PR with fixed superagency id getting method and dropdown added to Explore Data page.

Type of change

All pull requests must have at least one of the following labels applied (otherwise the PR will fail):

Label Description
Type: Bug non-breaking change that fixes an issue
Type: Feature non-breaking change that adds functionality
Type: Breaking Change fix or feature that would cause existing functionality to not work as expected
Type: Non-breaking refactor change addresses some tech debt item or prepares for a later change, but does not change functionality
Type: Configuration Change adjusts configuration to achieve some end related to functionality, development, performance, or security
Type: Dependency Upgrade upgrades a project dependency - these changes are not included in release notes

Related issues

closes #1275
closes #1276

Checklists

Development

This box MUST be checked by the submitter prior to merging:

  • Double- and triple-checked that there is no Personally Identifiable Information (PII) being mistakenly added in this pull request

These boxes should be checked by the submitter prior to merging:

  • Tests have been written to cover the code changed/added as part of this pull request

Code review

These boxes should be checked by reviewers prior to merging:

  • This pull request has a descriptive title and information useful to a reviewer
  • This pull request has been moved out of a Draft state, has no "Work In Progress" label, and has assigned reviewers
  • Potential security implications or infrastructural changes have been considered, if relevant

@nasaownsky
Copy link
Collaborator Author

Hi @mxosman! Sorry for this issue, it was totally on my end!

New getting method for superagency id should work as expected. I've also added dropdown in Explore Data page in this PR.
Could you please test it with multiple superagencies to verify that this working properly?

Copy link
Contributor

@mxosman mxosman left a comment

Choose a reason for hiding this comment

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

Thank you for the quick fix @nasaownsky! This was totally my bad too for not testing with multiple agencies! Left some comments, but overall, this is working properly for me!

this.childAgencies = [];
}
loadChildAgencies(superagencyId: string) {
this.getChildAgencies(superagencyId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that it's just calling this one function - we can lose this extra function (loadChildAgencies) and just use getChildAgencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

One small request - in getChildAgencies, if the BE sends a non-200 status, can we add a toast message before throwing an error w/ the same message as the error?

publisher/src/components/Menu/Menu.tsx Show resolved Hide resolved
@nasaownsky
Copy link
Collaborator Author

@mxosman please check my fixes!

Copy link
Contributor

@mxosman mxosman left a comment

Choose a reason for hiding this comment

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

So close with this one @nasaownsky! A couple of things and I think this will be ready to go soon:

  1. There are now two dropdowns in the Explore Data page - the responsive one is appearing in the normal view.
Screenshot 2024-04-26 at 7 39 23 AM
  1. If you remove yourself from the superagency via the admin panel, and go to one of its child agencies, the dropdowns hide, which is expected -- but you always get an error toast that there was an issue getting a list of child agencies. Since there maybe a chance that a user will not have access to the superagency but just the child agencies, can we only run getChildAgencies function if the user has access to the superagency? Let me know if I'm not making sense!
Screenshot 2024-04-26 at 7 46 37 AM

@nasaownsky
Copy link
Collaborator Author

@mxosman Oh, great catches, thank you!

Copy link
Contributor

@mxosman mxosman left a comment

Choose a reason for hiding this comment

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

Looks good to me @nasaownsky - thank you so much! Left one suggested change, but feel free to merge after.

@@ -38,8 +38,9 @@ export const ChildAgenciesDropdown: React.FC<{
const isSuperagency = userStore.isAgencySuperagency(agencyId);
const superagencyId = currentAgency?.super_agency_id ?? agencyId;
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry - suggested change here to make this a bit more accurate:

  const superagencyId = isSuperagency
    ? agencyId
    : currentAgency?.super_agency_id;

@nasaownsky nasaownsky merged commit 4788cf6 into main Apr 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants