-
Notifications
You must be signed in to change notification settings - Fork 63
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
Allow to use front or rear image of device #478
Comments
No bad idea at all. We have to talk about that feature request though.
As a very quick proof-of-concept I added a single line to the code that prefers a device type image over a role image: --- a/netbox_topology_views/views.py
+++ b/netbox_topology_views/views.py
@@ -230,6 +230,7 @@ def create_node(
node["shape"] = "image"
node["href"] = device.get_absolute_url()
node["image"] = get_image_for_entity(device)
+ if device.device_type.front_image: node["image"] = device.device_type.front_image.url |
I'd say draw an invisible box and resize the image (while preserving the aspect ratio) until it fits in the box. Another way to go about this might be to show the front and rear image in the tooltip instead |
So you would resize it in a way that it's the same size as the icons?
Okay, but which one would you prefer? |
How much effort would it be to make a POC of both? I think ma mix of both: front image in place of the icons, rear image in the tooltip. Or maybe a button to switch between the two. Do you know the UniFi network application? They have device images implemented in their topology. Let me know if you need some screenshots of that. |
Not a big deal. Here's what it could look like: Front image in place of the icons and both (front and rear) in the tooltip. Personally I don't see any benefit from rear images in the topology view at all. So I'd suggest to just use front images.
Yes, I'm familiar with it. |
One last note: If you display a few more nodes, it might look like this: You can see that there are 2 different pictures, one for patch panels and one for switches. This is hard to see at first sight (and this topology hasn't got very much nodes btw). But since assume to make this feature an option, that doesn't seem to be a big problem. I think the real benefit comes into play when non-racked devices with different shapes are shown. |
Looks good, although i think there should be a way to limit the size of the images. Basically you could have an invisible square around the image and have an option to specify the maximum size. That would mean that the longer dimension (length or height) of the image would be affected. |
I already limited the size in the code (just compare to the screenshot in my first post). We can make it even smaller of cause, but what's the benefit if you're not able to identify the device type anymore? Just for the record: NetBox itself limits the size. I used images of different size and NetBox made them equal in width. Which size (width) would you suggest compared to the current images in the screenshot? Feel free to post some images or links to images. I can use them and show a concrete example. |
I think this is good as a default, but you should make the configurable in the settings. Some people might like it smaller or bigger. |
I think you're right. Unfortunately I am not able to set the icons to a certain size in the topology view. The engine (vis.network) seems to resize objects itself. When I played around with some images of different sizes, some images has been resized while others hasn't. I don't see any algorithm here. This is a screenshot of some devices with the following dimensions: The dimensions of SW008 doesn't fit the other images at all. I also tried with a full HD picture which where displayed bigger than all other images together. I'm afraid it leads to a very bad user experience if images with different dimensions are used. It's not a problem to give the images a certain size for the tooltip because that's HTML and each image can be modified with CSS. |
Closing this because it's not possible to define an image size. |
NetBox version
v3.7.5
Topology Views version
v3.9.0
Feature type
New functionality
Proposed functionality
I would like the topology view to automatically pull the front or rear image of each device (if it exists) and default to the icons if none is available.
Use case
I think this would make it easier to understand at first glance.
External dependencies
No response
The text was updated successfully, but these errors were encountered: