Make the org unit selector with +Ancestors and +Descendants a re-usable component

Bug #1830432 reported by Jane Sandberg
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Low
Unassigned

Bug Description

The OU Selectors in the Angular Admin screens have really handy options to include Ancestors and/or Descendants. There are probably other screens where we will want to use that functionality, so it would be great to have them available in a more re-usable way -- perhaps as their own component, perhaps as some additional options for eg-org-select.

(Selfish aside: it would be handy for me to have for https://bugs.launchpad.net/evergreen/+bug/1816475)

Revision history for this message
Jane Sandberg (sandbergja) wrote :

It would also be great to be able to use only descendants, and to be able to set these checkboxes to default to true as needed.

Changed in evergreen:
status: New → Confirmed
Changed in evergreen:
importance: Undecided → Low
assignee: nobody → Jane Sandberg (sandbej)
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Here is a branch that does this: user/sandbergja/lp1830432_reusable_org_family_select

Here is a link: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/sandbergja/lp1830432_reusable_org_family_select

Please let me know if:
1) there is a better name for this than eg-org-family-select
2) my sandbox example is too negative
3) you have other feedback/questions. :-D

Changed in evergreen:
assignee: Jane Sandberg (sandbej) → nobody
tags: added: pullrequest
Bill Erickson (berick)
Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
Revision history for this message
Bill Erickson (berick) wrote :

Code reviewed and tested. Does what it says. And +1 for building with ControlValueAccessor by default.

I pushed a sign-off branch here, which also resolves a minor merge conflict and removes the redundant FormsModule import.

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1830432-org-family-select

Note however the unit tests are failing for me. Boils down to:

'null is not an object (evaluating 'includeAncestors.nativeElement')'

For reasons that are not obvious to me (the code looks right), lines like this are returning null:

includeAncestors = fixture.debugElement.query(By.css('#family-test-include-ancestors'));

Hoping others can confirm.

Changed in evergreen:
assignee: Bill Erickson (berick) → nobody
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Thanks for taking a look, Bill. I think I found the issue: the tests weren't getting a selected Org unit ID to work with in NgOnInit, so everything after that was unhappy. I pushed a fix to user/sandbergja/lp1830432-org-family-select-fix-unit-tests, along with a simplification of the test data

Revision history for this message
Bill Erickson (berick) wrote :

Thanks, Jane. Tests are working now. Here's another branch with sign-off for your commit. It also adds a new commit to unique-ify the org ID list. (It rarely matters, but may as well). I also tweaked the sandbox example language to address your question about potential negativity. (I guess if you have to ask...).

I have no other suggestions or concerns on the component in general. +1 for merging from me.

Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
Revision history for this message
Bill Erickson (berick) wrote :
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Thanks for your help, Bill! And for the less negative sandbox example. :-)

Signoff and small registerOnTouched fix here: user/sandbergja/lp1830432-org-family-select-2

Revision history for this message
Bill Erickson (berick) wrote :

And, lo, another branch springs forth.

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1830432-org-family-select-3

1. Sign-off for Jane's most recent commit.

2. I have a slight preference for the original horizontal layout of the org selector plus checkboxes, so I have pushed another commit to implement that style of layout. If I'm alone in that, I'm fine leaving this last commit off.

Changed in evergreen:
assignee: Bill Erickson (berick) → nobody
milestone: none → 3.4-beta1
Revision history for this message
Jane Sandberg (sandbergja) wrote :

I like the horizontal layout. Works well for me.

Signoff branch at: user/sandbergja/lp1830432-org-family-select-3

Here's a link: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/sandbergja/lp1830432-org-family-select-3

tags: added: signedoff
Bill Erickson (berick)
Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
Revision history for this message
Bill Erickson (berick) wrote :

Thanks, Jane. Merged to master.

I may leave it un-back-ported to 3.3 for now until there's a desire to use it there.

Changed in evergreen:
status: Confirmed → Fix Committed
assignee: Bill Erickson (berick) → nobody
Revision history for this message
Jane Sandberg (sandbergja) wrote :

Thanks, Bill! Merging just to master makes sense.

Galen Charlton (gmc)
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.