Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Withdraw completed audit verification feedback with its page

pulse-triage[bot]802f618c9796
diff --git a/frontend-modern/src/components/Settings/AuditLogPanel.tsx b/frontend-modern/src/components/Settings/AuditLogPanel.tsx
index c196b7eaab..b5f70761c8 100644
--- a/frontend-modern/src/components/Settings/AuditLogPanel.tsx
+++ b/frontend-modern/src/components/Settings/AuditLogPanel.tsx
@@ -88,6 +88,7 @@ export default function AuditLogPanel(props: AuditLogPanelProps) {
verification,
verificationFilter,
verificationSummary,
+ verificationNotice,
verifyAll,
verifyAllLabel,
verifyCanceled,
@@ -331,6 +332,14 @@ export default function AuditLogPanel(props: AuditLogPanelProps) {
</InlineNotice>
</Show>
+ <Show when={verificationNotice()}>
+ {(notice) => (
+ <InlineNotice tone={notice().tone} role="status" aria-live="polite">
+ {notice().message}
+ </InlineNotice>
+ )}
+ </Show>
+
<Show when={error()}>
<div
role="alert"
diff --git a/frontend-modern/src/components/Settings/__tests__/AuditLogReaderLifetime.test.tsx b/frontend-modern/src/components/Settings/__tests__/AuditLogReaderLifetime.test.tsx
index 267041ac9e..1907729e00 100644
--- a/frontend-modern/src/components/Settings/__tests__/AuditLogReaderLifetime.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/AuditLogReaderLifetime.test.tsx
@@ -465,4 +465,30 @@ describe('Audit log reader lifetime', () => {
cleanup();
}
});
+ it('keeps completed batch feedback in the current panel and withdraws it on reader change', async () => {
+ let denyRead = false;
+ vi.mocked(apiFetch).mockImplementation(async (url) =>
+ String(url).includes('/verify')
+ ? verified()
+ : denyRead
+ ? json({ error: 'private-denial' }, 403)
+ : list(['a', 'b']),
+ );
+ const { result, cleanup } = mount();
+ try {
+ await waitFor(() => expect(result.events()).toHaveLength(2));
+ result.verifyAll();
+ await waitFor(() => expect(result.verificationNotice()?.message).toContain('Verified 2'));
+ expect(showSuccess).not.toHaveBeenCalled();
+ expect(showWarning).not.toHaveBeenCalled();
+ denyRead = true;
+ setOrgID('org-b');
+ eventBus.emit('org_switched', 'org-b');
+ expect(result.verificationNotice()).toBeNull();
+ await waitFor(() => expect(result.error()).toContain('access could not be confirmed'));
+ expect(result.verificationNotice()).toBeNull();
+ } finally {
+ cleanup();
+ }
+ });
});
diff --git a/frontend-modern/src/components/Settings/useAuditLogPanelState.ts b/frontend-modern/src/components/Settings/useAuditLogPanelState.ts
index a3ce827dbf..fd24334727 100644
--- a/frontend-modern/src/components/Settings/useAuditLogPanelState.ts
+++ b/frontend-modern/src/components/Settings/useAuditLogPanelState.ts
@@ -18,7 +18,7 @@ import {
} from '@/utils/localStorage';
import { apiErrorFromResponse, apiFetch, getOrgID } from '@/utils/apiClient';
import { eventBus } from '@/stores/events';
-import { showSuccess, showToast, showWarning } from '@/utils/toast';
+import { showSuccess } from '@/utils/toast';
import { hasFeature, runtimeCapabilitiesLoaded } from '@/stores/license';
import { getUpgradeActionDestination } from '@/stores/licenseCommercial';
import { presentationPolicyHidesUpgradePrompts } from '@/stores/sessionPresentationPolicy';
@@ -156,6 +156,10 @@ export const useAuditLogPanelState = (props: AuditLogPanelProps = {}) => {
0,
);
const [verification, setVerification] = createSignal<Record<string, VerificationState>>({});
+ const [verificationNotice, setVerificationNotice] = createSignal<{
+ tone: 'success' | 'warning';
+ message: string;
+ } | null>(null);
const [verifying, setVerifying] = createSignal<Record<string, boolean>>({});
const [verifyingAll, setVerifyingAll] = createSignal(false);
const [verifyAllTotal, setVerifyAllTotal] = createSignal(0);
@@ -244,6 +248,7 @@ export const useAuditLogPanelState = (props: AuditLogPanelProps = {}) => {
setVerifyControllers({});
setVerifying({});
setVerifyingAll(false);
+ setVerificationNotice(null);
if (clearResults) {
setVerification({});
setVerifyAllTotal(0);
@@ -410,6 +415,7 @@ export const useAuditLogPanelState = (props: AuditLogPanelProps = {}) => {
verifyControllers()[event.id] === controller &&
isCurrentEvent(event);
batch(() => {
+ setVerificationNotice(null);
setVerifying((prev) => ({ ...prev, [event.id]: true }));
setVerifyControllers((prev) => ({ ...prev, [event.id]: controller }));
});
@@ -533,14 +539,10 @@ export const useAuditLogPanelState = (props: AuditLogPanelProps = {}) => {
}
}
- if (failed > 0 || errors > 0) {
- showWarning(
- 'Signature verification completed',
- `Verified ${verified}, failed ${failed}, errors ${errors}, unavailable ${unavailable}.`,
- );
- } else {
- showSuccess('Signature verification completed', `Verified ${verified} events.`);
- }
+ setVerificationNotice({
+ tone: failed > 0 || errors > 0 ? 'warning' : 'success',
+ message: `Signature verification completed. Verified ${verified}, failed ${failed}, errors ${errors}, unavailable ${unavailable}.`,
+ });
}
};
@@ -719,7 +721,6 @@ export const useAuditLogPanelState = (props: AuditLogPanelProps = {}) => {
stopVerification();
setVerifyCanceled(true);
});
- showToast('info', 'Signature verification canceled');
};
const goToFirstPage = () => goToOffset(0);
@@ -904,6 +905,7 @@ export const useAuditLogPanelState = (props: AuditLogPanelProps = {}) => {
verification,
verificationFilter,
verificationSummary,
+ verificationNotice,
verifyAll,
verifyAllDone,
verifyAllLabel,