Skip to content

Show room/location aliases in search results#3851

Merged
johannaengland merged 2 commits intoUninett:masterfrom
johannaengland:polish/show-aliases-in-search
Mar 19, 2026
Merged

Show room/location aliases in search results#3851
johannaengland merged 2 commits intoUninett:masterfrom
johannaengland:polish/show-aliases-in-search

Conversation

@johannaengland
Copy link
Copy Markdown
Contributor

@johannaengland johannaengland commented Mar 16, 2026

Scope and purpose

Follow up to #3832. Now after searching for a room by its alias one also is shown the aliases of a room/location.

I have factored out the controversial string representation change and will make a new PR for that where we can discuss that separately.

How to manually test:

  1. Add an alias to a room, another to a location.
  2. Search for the alias of the room in the room search /search/room/. See that that the aliases are shown.
  3. Search for the alias of the location in the location search /search/location/. See that the aliases are shown.

Screenshots:
Before:
image

After:
image

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Added/changed documentation
  • Linted/formatted the code with ruff, easiest by using pre-commit
  • Wrote the commit message so that the first line continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • Based this pull request on the correct upstream branch: For a patch/bugfix affecting the latest stable version, it should be based on that version's branch (<major>.<minor>.x). For a new feature or other additions, it should be based on master.
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If it's not obvious from a linked issue, described how to interact with NAV in order for a reviewer to observe the effects of this change first-hand (commands, URLs, UI interactions)
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this adds a new Python source code file: Added the boilerplate header to that file

@johannaengland johannaengland requested review from a team and lunkwill42 March 16, 2026 11:14
@johannaengland johannaengland self-assigned this Mar 16, 2026
@johannaengland johannaengland requested a review from Simrayz March 16, 2026 11:16
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.73%. Comparing base (1a33285) to head (b468e5c).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3851   +/-   ##
=======================================
  Coverage   63.73%   63.73%           
=======================================
  Files         624      624           
  Lines       46139    46145    +6     
  Branches       43       43           
=======================================
+ Hits        29408    29412    +4     
- Misses      16721    16723    +2     
  Partials       10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@Simrayz Simrayz left a comment

Choose a reason for hiding this comment

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

First off, the search result template changes are clean and a dedicated "Aliases" column is a good approach.

However, changing the __str__ method directly like this has a larger "blast radius" than expected. In addition to the search results, aliases are now shown in tools like ipdevinfo, device history, seed db location tree and netmap.

Another example, if rooms and locations are rendered in a dropdown, showing aliases could make the dropdown options quite long and unwieldy, especially if there are multiple aliases with fairly long names, i.e.
MyRoom: Some description that could have been longer (alias1, this room is important and has a long alias, another long alias from external system, alias4)

  • Suggestion 1: Maybe use a variant of aliases_string in the templates instead, and leave __str__ intact?
  • Suggestion 2: Maybe change the format when including aliases to this? It is additive and uses square brackets to separate the extra "meta info"
    <roomid>: <description> (<alias1>, <alias2>) to <roomid> (<room description>) [<alias1>, <alias2>]

@johannaengland johannaengland force-pushed the polish/show-aliases-in-search branch from 95ece71 to 1698b0e Compare March 18, 2026 15:32
@johannaengland johannaengland requested a review from Simrayz March 18, 2026 15:33
@johannaengland johannaengland force-pushed the polish/show-aliases-in-search branch from 1698b0e to 54ce149 Compare March 18, 2026 15:36
@johannaengland
Copy link
Copy Markdown
Contributor Author

I have factored out the string representation change and will create a new PR for that so that we can discuss everything there and so that #3855 is not blocked by that discussion.

Copy link
Copy Markdown
Contributor

@Simrayz Simrayz left a comment

Choose a reason for hiding this comment

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

Good to go ✈️

@johannaengland johannaengland force-pushed the polish/show-aliases-in-search branch from 54ce149 to b468e5c Compare March 19, 2026 11:44
@sonarqubecloud
Copy link
Copy Markdown

@johannaengland johannaengland merged commit cc3c158 into Uninett:master Mar 19, 2026
16 checks passed
@johannaengland johannaengland deleted the polish/show-aliases-in-search branch March 19, 2026 11:56
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.

2 participants