-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Display device names in front of device front/rear images #6880
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
Conversation
|
This is a proof-of-concept PR. It doesn't quite work correctly, because if you have images and then turn them off (which is presumably done via CSS), the text colour may be wrong for the new background: So it may be necessary to force the text colour to white via CSS only if the image is being shown, rather than forcing the text colour to white in Python as I did here. It's also a matter for discussion as to whether the text-over-image color needs to be selectable (per image). |
|
Maybe it would be a better solution to display the names beside of the rack? In our particular case we save devices names as fqdn, which sometimes lead into cut off hostnames in rack view. |
I think that should be a different feature request, since the fqdn's will overrun the rack width whether or not you use front/rear images. |
|
You'd still have the same issue on lighter-colored images though. How about adding an outline effect to the text using CSS? Edit: Something like this might work. |
|
The outline is ugly with small text. The top one has And this is adding (This was editing the SVG directly in-situ). It might be possible to put an opaque background behind the text, but apparently that would require drawing another rectangle: That thread also suggests a solution using a second text element to make a "splodge" behind: Change the first text stroke to Change second text fill to Change the first stroke to Adding That's not too bad, although it still looks a bit "art shop". You'd definitely only want to use it when the images are visible. EDIT: it might work if the stroke colour matches the background colour (of the rectangle which is visible when the image is hidden) |
|
This PR now implements separate toggles for Images and Labels: You still cannot get exactly the same behaviour as before, which was mixed:
However I prefer it this way, as the images-without-labels view is now uncluttered: Are you OK with this? Otherwise, it would be possible to get the old behaviour, by not adding the CSS class to labels if there's no image. But then you wouldn't be able to get the uncluttered view. At that point it probably makes sense to change to a 4-way dropdown: images and labels, images or labels, images only, labels only. |
|
Closing this out as I now have a version for Netbox 3. No point implementing this twice. |
|
New PR is #6960 |














Fixes: #6879
Display device names in white text in front of device front/rear background images