mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-17 17:56:29 +00:00
Fixes #19916: restore Rack device representation behavior
The select list of 'Images and Label', 'Images Only', and 'Label Only' was broken during recent work while implementing #19823. This fixes the issue by placing the `rack_elevation` class attribute on the <div> element that contains the SVG after being loaded by HTMX. In addition, we needed to slightly modify the selectors in the frontend code that looked for the elements within the SVG to hide and/or show. Previously, it was looking inside of a contentDocument embedded in an <object> element. The simplified version just looks inside of the SVG containing div.
This commit is contained in:
parent
d571cb4867
commit
fa2d7f6516
2
netbox/project-static/dist/netbox.js
vendored
2
netbox/project-static/dist/netbox.js
vendored
File diff suppressed because one or more lines are too long
6
netbox/project-static/dist/netbox.js.map
vendored
6
netbox/project-static/dist/netbox.js.map
vendored
File diff suppressed because one or more lines are too long
@ -35,7 +35,7 @@ function showRackElements(
|
|||||||
selector: string,
|
selector: string,
|
||||||
elevation: HTMLObjectElement,
|
elevation: HTMLObjectElement,
|
||||||
): void {
|
): void {
|
||||||
const elements = elevation.contentDocument?.querySelectorAll(selector) ?? [];
|
const elements = elevation.querySelectorAll(selector) ?? [];
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
element.classList.remove('hidden');
|
element.classList.remove('hidden');
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ function hideRackElements(
|
|||||||
selector: string,
|
selector: string,
|
||||||
elevation: HTMLObjectElement,
|
elevation: HTMLObjectElement,
|
||||||
): void {
|
): void {
|
||||||
const elements = elevation.contentDocument?.querySelectorAll(selector) ?? [];
|
const elements = elevation.querySelectorAll(selector) ?? [];
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
element.classList.add('hidden');
|
element.classList.add('hidden');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<div style="margin-left: -30px">
|
<div style="margin-left: -30px" class="rack_elevation">
|
||||||
<div
|
<div
|
||||||
hx-get="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{ face }}&render=svg{% if extra_params %}&{{ extra_params }}{% endif %}"
|
hx-get="{% url 'dcim-api:rack-elevation' pk=object.pk %}?face={{ face }}&render=svg{% if extra_params %}&{{ extra_params }}{% endif %}"
|
||||||
hx-trigger="intersect"
|
hx-trigger="intersect"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user