mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
Properly hide dashboard buttons
This commit is contained in:
parent
16e2283d19
commit
3c7ad61f8b
@ -4,16 +4,28 @@ import { apiPatch, hasError } from './util';
|
|||||||
|
|
||||||
function lockDashboard(): void {
|
function lockDashboard(): void {
|
||||||
const dashboard = document.getElementById('dashboard') as any;
|
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) {
|
if (dashboard) {
|
||||||
dashboard.gridstack.disable();
|
dashboard.gridstack.disable();
|
||||||
}
|
}
|
||||||
|
if (gridUnlockButton && gridLockButton) {
|
||||||
|
gridUnlockButton.classList.remove('invisible');
|
||||||
|
gridLockButton.classList.add('invisible');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function unlockDashboard(): void {
|
function unlockDashboard(): void {
|
||||||
const dashboard = document.getElementById('dashboard') as any;
|
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) {
|
if (dashboard) {
|
||||||
dashboard.gridstack.enable();
|
dashboard.gridstack.enable();
|
||||||
}
|
}
|
||||||
|
if (gridUnlockButton && gridLockButton) {
|
||||||
|
gridUnlockButton.classList.add('invisible');
|
||||||
|
gridLockButton.classList.remove('invisible');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveDashboardLayout(
|
async function saveDashboardLayout(
|
||||||
|
@ -41,7 +41,11 @@
|
|||||||
<div class="collapse multi-collapse">
|
<div class="collapse multi-collapse">
|
||||||
<div class="d-flex px-3">
|
<div class="d-flex px-3">
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
<button type="button" id="lock_dashboard" class="btn btn-light btn-sm" data-bs-toggle="collapse" data-bs-target=".multi-collapse">
|
<button type="button"
|
||||||
|
id="lock_dashboard"
|
||||||
|
class="btn btn-light btn-sm invisible"
|
||||||
|
data-bs-toggle="collapse"
|
||||||
|
data-bs-target=".multi-collapse">
|
||||||
<i class="mdi mdi-lock-outline"></i> Lock Dashboard
|
<i class="mdi mdi-lock-outline"></i> Lock Dashboard
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user