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.

1.9 KB
Raw Blame
import { Component, For, Show } from 'solid-js';
import { InfoCardFrame } from '@/components/shared/InfoCardFrame';
import { HostNetworkInterface } from '@/types/api';

interface NetworkInterfacesCardProps {
  interfaces?: HostNetworkInterface[];
}

export const NetworkInterfacesCard: Component<NetworkInterfacesCardProps> = (props) => {
  if (!props.interfaces || props.interfaces.length === 0) return null;

  return (
    <InfoCardFrame>
      <div class="text-[11px] font-medium uppercase tracking-wide text-base-content mb-2">
        Network
      </div>
      <div class="max-h-[140px] overflow-y-auto custom-scrollbar space-y-2">
        <For each={props.interfaces}>
          {(iface) => (
            <div class="rounded-sm border border-dashed border-border p-2 overflow-hidden">
              <div class="flex items-center gap-2 text-[11px] font-medium text-base-content min-w-0">
                <span class="truncate min-w-0">{iface.name}</span>
                <Show when={iface.mac}>
                  <span
                    class="text-[9px] text-muted font-normal truncate shrink-0 max-w-[100px]"
                    title={iface.mac}
                  >
                    {iface.mac}
                  </span>
                </Show>
              </div>
              <Show when={iface.addresses && iface.addresses.length > 0}>
                <div class="flex flex-wrap gap-1 mt-1">
                  <For each={iface.addresses}>
                    {(ip) => (
                      <span
                        class="inline-block rounded-sm bg-blue-100 px-1.5 py-0.5 text-[10px] text-blue-700 dark:bg-blue-900/25 dark:text-blue-200 max-w-full truncate"
                        title={ip}
                      >
                        {ip}
                      </span>
                    )}
                  </For>
                </div>
              </Show>
            </div>
          )}
        </For>
      </div>
    </InfoCardFrame>
  );
};