Aman-Mittal opened a new pull request, #391:
URL: https://github.com/apache/fineract-backoffice-ui/pull/391

   Closes #330.
   
   Typing "Offices" or "Chart of Accounts" into the global search now returns 
the page itself, alongside the entity results, permission-filtered against the 
navigation tree the sidebar already builds. Both surfaces are covered: the 
header dropdown and `/search`.
   
   ## Credit
   
   The first commit is @Iyamokuma's from #331, cherry-picked onto current 
`main` and re-signed. They are still its author — only the committer and the 
signature changed. The design is theirs: flatten the already-filtered nav tree 
into leaf routes, carry the parent section label for context, and match on the 
translated label. That is the right shape and I did not change it.
   
   The second commit is mine and does four things it needed before it could 
land.
   
   ## What the follow-up commit fixes
   
   **Two would have failed CI on #331 as it stands:**
   
   - `NavigationConfigService` now injects `I18N`, which broke **all 36 
existing specs for that service** — the TestBed has no `TranslateService` 
provider. They now get `provideFakeAdapters()`, whose I18n fake echoes the key, 
which is enough to exercise a label match.
   - `flattenNavRoutes` emitted `icon: undefined` for a leaf without an icon, 
which failed **the two specs the same commit added**. The key is omitted now 
rather than present-and-empty.
   
   **Two are behavioural:**
   
   - Matching folded the section name into the same haystack as the page name, 
so `searchRoutes('organization')` matched *every leaf beneath Organization*. 
With the header's limit of 8 that fills the dropdown with siblings and pushes 
the real entity hits off the bottom. Pages named for the query now come first, 
section-only matches after. Partitioned rather than sorted — `toSorted` is not 
in this project's TS lib target, and the ordering has exactly two tiers.
   - The nav testid embedded the raw route, slashes and all. Slugged, so a spec 
can select on it.
   
   ## Tests
   
   `e2e/global-search-nav-shortcuts.spec.ts` covers the three things a unit 
test of `searchRoutes` cannot see:
   
   - a shortcut appears for a page entity search cannot return — which is the 
premise of #330
   - selecting it lands on that page
   - a page the user has no permission for is **absent**. That one is a 
disclosure if it ever regresses: the label alone tells an operator the screen 
exists, and clicking it can only end at `/forbidden`.
   
   Plus two unit cases on the ranking rule and the limit.
   
   ## Verified
   
   `lint`, `format:check`, `i18n:check`, `typecheck:e2e` clean, and 1154/1154 
unit tests pass. Rebased onto `main` after #390 merged, so the `SAVINGSACCOUNT` 
destination here is the corrected `/products/savings-accounts/view/:id`.
   
   ## Known limitation
   
   Labels are resolved when the query runs, so a language switch does not 
re-translate results already on screen. In the header they are transient and 
the next keystroke re-resolves them; on `/search` they persist until the next 
search. Left as-is rather than widened into a reactive-translation change 
inside someone else's commit.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to