diff --git a/netbox/project-static/src/dashboard.ts b/netbox/project-static/src/dashboard.ts index 84337b848..be96e701a 100644 --- a/netbox/project-static/src/dashboard.ts +++ b/netbox/project-static/src/dashboard.ts @@ -6,8 +6,13 @@ function lockDashboard(): void { const dashboard = document.getElementById('dashboard') as any; const gridUnlockButton = document.getElementById('unlock_dashboard') as HTMLButtonElement; const gridLockButton = document.getElementById('lock_dashboard') as HTMLButtonElement; + if (dashboard) { dashboard.gridstack.disable(); + // Hide the grid stack items buttons + Array.from(document.getElementsByClassName("grid-stack-item-button")).forEach(function (element) { + element.classList.add('invisible'); + }); } if (gridUnlockButton && gridLockButton) { gridUnlockButton.classList.remove('invisible'); @@ -21,6 +26,10 @@ function unlockDashboard(): void { const gridLockButton = document.getElementById('lock_dashboard') as HTMLButtonElement; if (dashboard) { dashboard.gridstack.enable(); + // Show the grid stack items buttons + Array.from(document.getElementsByClassName("grid-stack-item-button")).forEach(function (element) { + element.classList.remove('invisible'); + }); } if (gridUnlockButton && gridLockButton) { gridUnlockButton.classList.add('invisible'); diff --git a/netbox/templates/extras/dashboard/widget.html b/netbox/templates/extras/dashboard/widget.html index 1559363d3..c8ea47dd3 100644 --- a/netbox/templates/extras/dashboard/widget.html +++ b/netbox/templates/extras/dashboard/widget.html @@ -10,7 +10,7 @@ >