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.

954 B
Raw Blame
export function getAlertHistoryResourceTypeBadgeClass(resourceType?: string | null): string {
  const normalized = (resourceType ?? '').trim().toLowerCase();

  if (normalized === 'vm' || normalized === 'node') {
    return 'text-xs px-1 py-0.5 rounded-sm bg-blue-100 dark:bg-blue-900/25 text-blue-700 dark:text-blue-300';
  }

  // 'system-container' is the unified-model name the v6 alert engine stamps
  // for LXC guests (guest_snapshot.go resourceType()).
  if (
    normalized === 'container' ||
    normalized === 'ct' ||
    normalized === 'lxc' ||
    normalized === 'system-container'
  ) {
    return 'text-xs px-1 py-0.5 rounded-sm bg-green-100 dark:bg-green-900/25 text-green-700 dark:text-green-300';
  }

  if (normalized === 'storage') {
    return 'text-xs px-1 py-0.5 rounded-sm bg-orange-100 dark:bg-orange-900 text-orange-700 dark:text-orange-300';
  }

  return 'text-xs px-1 py-0.5 rounded-sm bg-surface-hover text-base-content';
}