Skip to content

Conversation

@mruettgers
Copy link

This PR adds a new helper "nodeName" to allow a centralized handling of extra long or empty hostnames.
Long node names will be trimmed to avoid layout issues, empty node names will be replaced with the node id in square brackets.

…xtra-long node names.

Handle empty hostnames

Removed some debug output
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be the Unicode character "…" instead of three single "."?

@jplitza
Copy link
Member

jplitza commented Oct 7, 2015

I support the idea, both content-wise (shortening node names) and implementation-wise (introducing a single helper function that does the job). However, my knowledge of the codebase is too scarce to decide whether the implementation is done properly.

@lost-tty
Copy link

lost-tty commented Oct 7, 2015

I wouldn't call it "trim". That usually implies cutting excess whitespace from strings. "shorten" might be better suited.

I'd also create two functions, e.g. shortenNodename and prettyNodename and chain them when a shorter name is required (e.g shortenNodename(prettyNodename(d))).

@lost-tty
Copy link

lost-tty commented Oct 7, 2015

Actually, call it truncate as we don't actually do any magic to retain a meaningful hostname. Also, use "…" instead of "...".

@lost-tty
Copy link

lost-tty commented Oct 7, 2015

Also make sure, that truncateNodename("𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡", 3) + "foo" actually returns "𝟘𝟙𝟚foo" and not just "𝟘𝟙" with some garbage at the end.

@lost-tty
Copy link

lost-tty commented Oct 7, 2015

On the other hand, why don't we use CSS?

Set this on a table cell:

text-overflow: ellipse;
overflow: hidden;
white-space: nowrap;
max-width: 0;

@mruettgers
Copy link
Author

I like the CSS based solution for truncating.
But this does not solve issues caused by missing hostnames wherever they are expected to be available as string objects.
So we need both, the CSS based solution and a central function for formatting the node name.
I'll have a look on this later.

MPW1412 pushed a commit to FreiFunkMuenster/meshviewer that referenced this pull request Jan 8, 2016
added OS switch for the coords …

(new) fix for plumpudding/meshviewer/ffnord#6

restore backwards compatibility

resolve builderror

fixed typo
jplitza added a commit that referenced this pull request Jan 8, 2016
This implements part of #6 with CSS to shorten extremely long node names
with ellipsis.
rubo77 pushed a commit to rubo77/meshviewer that referenced this pull request Apr 20, 2019
This implements part of ffnord#6 with CSS to shorten extremely long node names
with ellipsis.
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.

3 participants