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

Modified view-agency component & css for updated interface #326

Merged
merged 17 commits into from Oct 27, 2020

Conversation

deveshchatuphale7
Copy link
Contributor

Related Issue

Fixes #212

Checklist:

  • I have read the contributor's guide.
  • I linked an issue in the previous section
  • I have commented on the linked issue
  • I was assigned the linked issue (not required)
  • I have tested the change to the best of my ability against the sandbox or a local build.

Optional items:

  • My change adds new text and requires a change to translations.
  • My change requires a change to the documentation.
  • I have submitted a PR to the documentation repo.
  • I was not able to test... (explain below, e.g. you did not have permissions to test a specific feature)
  • This change depends O-FISH Realm repository changes (explain below)
  • Optional: Add any explanations here
    Modified view-agency component as well as css file to incorporate design requirements

  • Optional: Add any relevant screenshots here

@Sheeri Sheeri self-requested a review October 20, 2020 01:59
</Fragment>
)}
</Fragment>
)}
</div>
<NavLink to={EDIT_AGENCIES_PAGE.replace(":id", agency._id)}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line is giving me an error when I run npm start locally on this branch:

Failed to compile.

./src/components/agencies/view-agency/view-agency.component.js
Line 109:58: 'agency' is not defined no-undef

Copy link
Collaborator

@Sheeri Sheeri left a comment

Choose a reason for hiding this comment

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

I cannot get this to build....see inline comment.

Copy link
Collaborator

@Sheeri Sheeri left a comment

Choose a reason for hiding this comment

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

Hi, it still won't build - you can see that on this PR page:
Screen Shot 2020-10-22 at 1 28 00 PM

and if you click through to "Details" you can see:

./src/components/agencies/view-agency/view-agency.component.js
Line 257:41: 'agencyInfo' is not defined no-undef

Copy link
Collaborator

@Sheeri Sheeri left a comment

Choose a reason for hiding this comment

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

Hi @deveshchatuphale7 - Can you see the "checks" section of #326 ? I can't review the code until it builds and gets a green checkmark there. It looks like you fixed the first issue, but now there's another issue.

@deveshchatuphale7
Copy link
Contributor Author

Hi @deveshchatuphale7 - Can you see the "checks" section of #326 ? I can't review the code until it builds and gets a green checkmark there. It looks like you fixed the first issue, but now there's another issue.

Thanks for informing. Hopefully my latest commit will fix the issue. But I am curious why I was not getting any issue while generating build locally

@Sheeri
Copy link
Collaborator

Sheeri commented Oct 23, 2020

Hi there! The build on the website builds the current code with your changes. You probably did not do a "git pull" before your testing and PR submission, so you had older code - the files you didn't change. Github tests the current code plus your changes because there could be issues and it wants to find them first.

Copy link
Collaborator

@Sheeri Sheeri left a comment

Choose a reason for hiding this comment

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

Hi! It built, but I'm not seeing the problem resolved.

I logged in as an Agency Administrator, then went to the Agencies page. Then clicked on my agency, and here's the page I got:

Screen Shot 2020-10-23 at 2 08 01 PM

It still shows 0 officers, when there should at least be 1 officer (me!).

I did this against the sandbox; is that what you used?

@deveshchatuphale7
Copy link
Contributor Author

Hi! It built, but I'm not seeing the problem resolved.

I logged in as an Agency Administrator, then went to the Agencies page. Then clicked on my agency, and here's the page I got:

Screen Shot 2020-10-23 at 2 08 01 PM

It still shows 0 officers, when there should at least be 1 officer (me!).

I did this against the sandbox; is that what you used?

Yes, Actually also for my login I got officers array with key officers under agencyAdditionalInfo object was empty. Hence dashboard is showing zero officers.

image

Did I miss any step here, could you point me in right direction ?

@Sheeri
Copy link
Collaborator

Sheeri commented Oct 23, 2020

Ah! I see. You correctly printed out agencyAdditionalInfo.

The problem is that agencyAdditionalInfo object is wrong - how is it populated? is it looking in the wrong place for officers?

You might be able to find some clues by looking at src/components/agencies/agencies.component.js - I can see there's a function in there called getAgenciesWithOfficers, which is how that page gets a list of officers, which it then uses to display.

Copy link
Collaborator

@Sheeri Sheeri left a comment

Choose a reason for hiding this comment

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

Hi @deveshchatuphale7 - this is a great start! I'm getting a count and a list of users, but it's not getting them from the right place. I added some inline comments and suggestions.

I'm also not sure if search is supposed to work? Right now it doesn't - if I type something into the search bar and hit "return" nothing happens. It's totally OK if search doesn't work, but it looks like the code intends it to be working, perhaps it is supposed to highlight a search term.

I'm happy to keep the scope of this to just the count and list of officers, and we can make a different ticket for search to work. (but then we should remove the code related to search functionality - though it's OK to keep the UI code in there - it looks great!)

loading: false,
});

boardingService.getBoardingsWithFacet(50,0,null,{"agency":data.name}).then((userData)=>{
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I'm reading this properly, this gets a list of officers by getting the boarding records for the agency, and finding all the distinct reportingOfficer email addresses.

But we want to see officers, even if they have not submitted any boarding records.

This should use the "searchFacetByUsers" function, which takes in a limit, offset, query, and filter, and returns an array of users (using limit and offset to only return what's needed on the page), a total count of users, and any highlighting needed.

You can see that function at https://github.com/WildAid/o-fish-realm/blob/main/WildAidDemo/functions/searchFacetByUsers/source.js

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 tried using getUsers from users.service which calls searchFacetByUsers function. With agency name as filter I received empty array in response & without any filters I received list of users, In my case I received user details of me & another user I created. So what parameters would be helpful to get officer details ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, you don't need a filter, there are permissions in place to make sure you only see what you're allowed to see. (as an agency admin, you can only see users in your agency)

You say you get the user details for you and the other user you created, which sounds like you have the right link there. What additional details do you need?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I think response from getUsers will suffice the requirement. but one doubt I have is, on agencies page for agency name deveshchatuphale7 respective officer name in the list is Emex Geefy.But, I didn't receive any info about that user in the response of getUsers without any filters & searchQuery.
So just wanted to know if I am receiving a correct response or I have to pass any additional filters or searchQuery ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

To debug, loop through every part of the returned user object, and print it, to see where the issue is. Perhaps there is a different field you should be using? (that's what I'd do, I don't know where the problem is here).

Copy link
Collaborator

@Sheeri Sheeri left a comment

Choose a reason for hiding this comment

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

This looks fantastic!

@Sheeri Sheeri merged commit f7d6d74 into WildAid:main Oct 27, 2020
@Sheeri
Copy link
Collaborator

Sheeri commented Oct 27, 2020

Congratulations! 🎉 🙌 🎆 ㊗️

This PR is great and has been merged into the code. Thanks so much for contributing! If you'd like, you can request to work on another issue. We really appreciate your effort!

To claim your O-FISH badge, head on over to the MongoDB Community forums, login, and reply - making sure to link to this PR.

@deveshchatuphale7
Copy link
Contributor Author

Congratulations! 🎉 🙌 🎆 ㊗️

This PR is great and has been merged into the code. Thanks so much for contributing! If you'd like, you can request to work on another issue. We really appreciate your effort!

To claim your O-FISH badge, head on over to the MongoDB Community forums, login, and reply - making sure to link to this PR.

Sure!

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.

Officers in the Agency Admin Interface
2 participants