Fix anomaly banner BU reassignment detail display
- Backend: /anomaly/latest now returns the most recent SIGNIFICANT anomaly instead of the absolute latest (non-significant ones are useless to the banner which skips them anyway) - Frontend: expand BU detail time window from 60 minutes to 25 hours before the anomaly timestamp to capture changes from the full sync cycle (syncs run once per 24h)
This commit is contained in:
@@ -1384,10 +1384,13 @@ function createIvantiFindingsRouter(db, requireAuth) {
|
||||
*/
|
||||
router.get('/anomaly/latest', async (req, res) => {
|
||||
try {
|
||||
// Return the most recent SIGNIFICANT anomaly — the banner only displays
|
||||
// significant events, so returning a non-significant row is useless.
|
||||
const { rows } = await pool.query(
|
||||
`SELECT id, sync_timestamp, open_count_delta, closed_count_delta,
|
||||
newly_archived_count, returned_count, classification_json, return_classification_json, is_significant
|
||||
FROM ivanti_sync_anomaly_log
|
||||
WHERE is_significant = true
|
||||
ORDER BY sync_timestamp DESC LIMIT 1`
|
||||
);
|
||||
const row = rows[0];
|
||||
|
||||
@@ -248,13 +248,13 @@ export default function AnomalyBanner() {
|
||||
setBuExpanded(true);
|
||||
try {
|
||||
// Fetch BU change records relevant to this anomaly.
|
||||
// Use a generous 60-minute window before sync_timestamp since the drift
|
||||
// checker runs well before the anomaly summary is recorded.
|
||||
// Use a 25-hour window before sync_timestamp to capture changes from
|
||||
// the previous sync cycle (syncs run once per 24h).
|
||||
const since = anomaly?.sync_timestamp || '';
|
||||
let url;
|
||||
if (since) {
|
||||
const sinceDate = new Date(since);
|
||||
sinceDate.setMinutes(sinceDate.getMinutes() - 60);
|
||||
sinceDate.setHours(sinceDate.getHours() - 25);
|
||||
url = `${API_BASE}/ivanti/findings/bu-changes?since=${encodeURIComponent(sinceDate.toISOString())}`;
|
||||
} else {
|
||||
url = `${API_BASE}/ivanti/findings/bu-changes?limit=50`;
|
||||
|
||||
Reference in New Issue
Block a user