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.

519 B
Raw Blame
import type { Alert } from '@/types/api';

type AlertIdentity = Pick<Alert, 'id'>;

export const getCanonicalAlertId = (alert: Pick<Alert, 'id'>): string => alert.id;

export const getAlertIdentifiers = (alert: AlertIdentity): string[] => [getCanonicalAlertId(alert)];

export const matchesAlertIdentifier = (alert: AlertIdentity, candidate: string): boolean => {
  const trimmedCandidate = candidate.trim();
  if (!trimmedCandidate) {
    return false;
  }
  return getCanonicalAlertId(alert) === trimmedCandidate;
};