fix: restore rack and reorder width views
This commit is contained in:
@@ -11,6 +11,10 @@
|
||||
console.error('NetBox Utilities could not read the Reorder Rack width data.', error);
|
||||
return;
|
||||
}
|
||||
if (data.status && data.status !== 'ready') {
|
||||
console.warn('NetBox Utilities is leaving Reorder Rack in its native layout.', data.status);
|
||||
return;
|
||||
}
|
||||
|
||||
const columns = Number.parseInt(data.columns, 10) || 12;
|
||||
const gridElements = {
|
||||
|
||||
@@ -4,13 +4,22 @@
|
||||
const placementSource = document.getElementById('netbox-utilities-topology-rack-width-data');
|
||||
if (!placementSource) return;
|
||||
|
||||
let placementData;
|
||||
let payload;
|
||||
try {
|
||||
placementData = JSON.parse(placementSource.textContent);
|
||||
payload = JSON.parse(placementSource.textContent);
|
||||
} catch (error) {
|
||||
console.error('NetBox Utilities could not read the Topology Views rack widths.', error);
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(payload) && payload?.status && payload.status !== 'ready') {
|
||||
console.warn('NetBox Utilities is leaving Topology Views in its native layout.', payload.status);
|
||||
return;
|
||||
}
|
||||
const placementData = Array.isArray(payload) ? payload : payload?.devices;
|
||||
if (!Array.isArray(placementData)) {
|
||||
console.error('NetBox Utilities received invalid Topology Views rack width data.');
|
||||
return;
|
||||
}
|
||||
|
||||
const normalizePath = value => {
|
||||
try {
|
||||
@@ -59,6 +68,7 @@
|
||||
&& typeof device.dataset.deviceColor === 'string'
|
||||
));
|
||||
});
|
||||
if (!rackCards.length && !placementData.length) return;
|
||||
if (!liveViewCompatible) {
|
||||
console.warn('NetBox Utilities left Topology Views unchanged because its rack DOM is not compatible.');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user