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.6 KB
Raw Blame
import { For, Show } from 'solid-js';
import type { DiskListProps } from './diskListModel';
import { useDiskListState } from './useDiskListState';

export function DiskList(props: DiskListProps) {
  const { diskPresentation, diskStatusTooltip, hasDisks } = useDiskListState(props);

  return (
    <Show
      when={hasDisks()}
      fallback={
        <span class="text-slate-400 text-sm" title={diskStatusTooltip()}>
          -
        </span>
      }
    >
      <div class="flex flex-col gap-1.5">
        <Show when={props.diskStatusReason}>
          <p class="text-xs text-muted">{diskStatusTooltip()}</p>
        </Show>
        <For each={diskPresentation()}>
          {(disk) => {
            return (
              <div class="rounded-sm border border-border bg-surface-hover px-1.5 py-1 text-[10px] leading-tight shadow-xs">
                <div class="truncate text-base-content" title={disk.labelTitle}>
                  {disk.label}
                </div>
                <div class="mt-0.5 text-[9px] text-muted">{disk.usageText}</div>
                <div class="relative mt-1 h-1.5 w-full overflow-hidden rounded-sm bg-surface-hover">
                  <div
                    class={`absolute inset-y-0 left-0 ${disk.progressClass}`}
                    style={{ width: disk.progressWidth }}
                  />
                </div>
                <div class="mt-0.5 flex items-center justify-between text-[9px] font-medium text-muted">
                  <span>{disk.usagePercentLabel}</span>
                  <span>{disk.typeLabel}</span>
                </div>
              </div>
            );
          }}
        </For>
      </div>
    </Show>
  );
}