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

Add option to shorten a display name #33

Merged
merged 5 commits into from
Mar 1, 2024

Conversation

garethj2
Copy link
Contributor

We need some support for shortened display names.

This differs from the relative display names that exist in Haxall. In our use case, we may not have the parent when we have a shortened display name.

So how to handle it? Firstly we need to understand that display names can be processed in different ways (dis, disMacro, name etc). A long display name normally incorporates refs to other records. This uses disMacro. For example, if there was a disMacro tag on a point with $equipRef $navName, the result may include the display names for all the parents of the record and the point itself.

An easy to deal with this is by skipping any Ref values when processing the disMacro. Therefore the result is really $equipRef.

I admit this isn't a perfect solution. I'd argue the relative display names in Haxall are worse since you always need to know the parent. This is a pain when you want to render short display names from a list and not a tree control.

@gretadj2
Copy link

An easy to deal with this is by skipping any Ref values when processing the disMacro. Therefore the result is really $equipRef.

Just to double check if I understood correctly, did you mean that "the result is really $navName", right?

I agree the solution is not perfect, because if for example the user decides to add some separation characters in the disMacro, you could end up with a strange result: $siteRef / $floorRef / $navName => / / a navName

But at the same time I know it's a complex topic, because different contexts often lead to different display names. For example, we had a few customers that wanted to use the disKey functionality only on some points, so we had to check the tags in the Dict to understand which one to prioritize.
So I think this may be an additional tool that could help, even if it's not a panacea.

@kianj2
Copy link

kianj2 commented Feb 29, 2024

Interesting point on the separation characters @gretadj2. It makes me wonder what that perfect solution could be later on down the road

@garethj2
Copy link
Contributor Author

garethj2 commented Mar 1, 2024

I've taken everyone's feedback on board and have redesigned the approach here.

@gretadj2 I think your comments regarding how customers use separators is really important. I think @EliteScientist has raised some good ideas with me too.

I've simplified the approach here. Now if a display name is shortened, it moves the precedence of resolving the disMacro further down the list. I've also added support for finding navName (again fairly low on precedence). There is no more overly clever processing of the display name. It's a slightly more advanced version of using either navName for the short name if you think about it.

Let me know what you think. I originally created this PR to kick around a few ideas and see what works best for people.

@gretadj2
Copy link

gretadj2 commented Mar 1, 2024

👍 I like it, thanks @garethj2 !

Copy link

@kianj2 kianj2 left a comment

Choose a reason for hiding this comment

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

I think the changes are good! I left some super minor comments based on the changes. Thanks Gareth

@garethj2 garethj2 merged commit d4a4ddc into master Mar 1, 2024
1 check passed
@garethj2 garethj2 deleted the feature/STK-2316-short-display-names branch March 1, 2024 19:18
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.

4 participants