refactor(webhooks): Integrate webhooks panel into status card
All checks were successful
All checks were successful
- Moved webhooks-section to be inline with status-panel in HTML - Updated toggleStatusPanel() to show/hide webhooks section for admin users - Updated closeStatusPanel() to also hide webhooks section - Removed webhooks visibility from showDashboard() - now tied to status panel - Updated CSS to make webhooks section styling consistent with status panel: - Same border, border-radius, margin, box-shadow - Updated webhook-stats to use status-card styling (background, border) - Webhooks metrics now display inline with status panel for admin users
This commit is contained in:
@@ -302,9 +302,7 @@ function showDashboard() {
|
||||
sp.style.display = 'none';
|
||||
sp.innerHTML = '';
|
||||
document.getElementById('admin-controls').style.display = isAdmin ? 'flex' : 'none';
|
||||
// Show webhooks section for admin users
|
||||
const webhooksSection = document.getElementById('webhooks-section');
|
||||
if (webhooksSection) webhooksSection.style.display = isAdmin ? '' : 'none';
|
||||
// Note: webhooks-section visibility is controlled by toggleStatusPanel()
|
||||
// Initialise days input from saved value
|
||||
const daysInput = document.getElementById('history-days');
|
||||
if (daysInput) daysInput.value = historyDays;
|
||||
@@ -772,12 +770,19 @@ const STATUS_REFRESH_MS = 5000;
|
||||
|
||||
async function toggleStatusPanel() {
|
||||
const panel = document.getElementById('status-panel');
|
||||
const webhooksSection = document.getElementById('webhooks-section');
|
||||
if (panel.style.display !== 'none') {
|
||||
panel.style.display = 'none';
|
||||
if (webhooksSection) webhooksSection.style.display = 'none';
|
||||
if (statusRefreshHandle) { clearInterval(statusRefreshHandle); statusRefreshHandle = null; }
|
||||
return;
|
||||
}
|
||||
panel.style.display = 'block';
|
||||
// Show webhooks section for admin users
|
||||
if (webhooksSection && isAdmin) {
|
||||
webhooksSection.style.display = '';
|
||||
await fetchWebhookStatus();
|
||||
}
|
||||
await refreshStatusPanel();
|
||||
if (statusRefreshHandle) clearInterval(statusRefreshHandle);
|
||||
statusRefreshHandle = setInterval(refreshStatusPanel, STATUS_REFRESH_MS);
|
||||
@@ -785,6 +790,8 @@ async function toggleStatusPanel() {
|
||||
|
||||
function closeStatusPanel() {
|
||||
document.getElementById('status-panel').style.display = 'none';
|
||||
const webhooksSection = document.getElementById('webhooks-section');
|
||||
if (webhooksSection) webhooksSection.style.display = 'none';
|
||||
if (statusRefreshHandle) { clearInterval(statusRefreshHandle); statusRefreshHandle = null; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user