mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
Use document.querySelectorAll()
Co-authored-by: kkthxbye <400797+kkthxbye-code@users.noreply.github.com>
This commit is contained in:
parent
b31e25cfab
commit
922e3e27fa
@ -4,36 +4,19 @@ import { apiPatch, hasError } from './util';
|
||||
|
||||
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');
|
||||
gridLockButton.classList.add('invisible');
|
||||
document.querySelectorAll(".grid-stack-item-button, #unlock_dashboard, #lock_dashboard").forEach(el => el.classList.toggle('invisible'));
|
||||
}
|
||||
}
|
||||
|
||||
function unlockDashboard(): 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.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');
|
||||
gridLockButton.classList.remove('invisible');
|
||||
document.querySelectorAll(".grid-stack-item-button, #unlock_dashboard, #lock_dashboard").forEach(el => el.classList.toggle('invisible'));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user