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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
import { Component, For, Show } from 'solid-js';
import type { ProbeCandidate } from '@/api/connections';
import { Button } from '@/components/shared/Button';
import { CalloutCard } from '@/components/shared/CalloutCard';
import { formControl, formField, formHelpText, formLabel } from '@/components/shared/Form';
import { formatConnectionErrorMessage } from '@/utils/connectionErrorPresentation';
import { getInfrastructureAgentHostProfileSupportText } from '@/utils/infrastructureOnboardingPresentation';
import type { CompletedProbePhase, ConnectionEditorState } from './useConnectionEditor';
import { CONNECTION_TYPE_LABELS } from './useConnectionEditor';
export interface AddressProbeStepProps {
state: ConnectionEditorState;
onSelectCandidate: (candidate: ProbeCandidate) => void;
onInstallAgent?: () => void;
onChooseSourceTypeInstead?: () => void;
onProbeSubmitted?: () => void;
onProbeResolved?: (outcome: CompletedProbePhase) => void;
}
export const AddressProbeStep: Component<AddressProbeStepProps> = (props) => {
const handleSubmit = async (event: SubmitEvent) => {
event.preventDefault();
if (props.state.address().trim().length === 0) {
return;
}
props.onProbeSubmitted?.();
const outcome = await props.state.runProbe();
props.onProbeResolved?.(outcome);
};
return (
<form class="space-y-4" onSubmit={handleSubmit}>
<div class={formField}>
<label class={formLabel} for="connection-address">
API endpoint
</label>
<input
id="connection-address"
type="text"
class={formControl}
placeholder="vcenter.lab.local, truenas.lan, https://pve.lab:8006"
value={props.state.address()}
onInput={(event) => props.state.setAddress(event.currentTarget.value)}
autocomplete="off"
spellcheck={false}
disabled={props.state.phase() === 'probing'}
/>
<p class={formHelpText}>
Paste a hostname, IP, or URL for a supported API-backed platform. Pulse validates the
match and asks for credentials next.
</p>
</div>
<div class="flex items-center gap-2">
<Button
type="submit"
variant="primary"
size="settingsAction"
disabled={props.state.phase() === 'probing' || props.state.address().trim().length === 0}
>
{props.state.phase() === 'probing' ? 'Probing…' : 'Probe API endpoint'}
</Button>
</div>
<Show when={props.state.phase() === 'error' && props.state.errorMessage().length > 0}>
<CalloutCard
role="alert"
tone="danger"
scale="compact"
padding="sm"
description={
formatConnectionErrorMessage(props.state.errorMessage()) ?? props.state.errorMessage()
}
/>
</Show>
<Show when={props.state.phase() === 'no-match'}>
<CalloutCard
tone="warning"
scale="compact"
padding="sm"
title="No supported API-backed platform detected at that address."
description={
<>
<Show when={props.onChooseSourceTypeInstead}>
<button
type="button"
onClick={props.onChooseSourceTypeInstead}
class="font-semibold underline underline-offset-2"
>
Choose a source type instead
</button>
<span>. </span>
</Show>
If this is one of the supported {getInfrastructureAgentHostProfileSupportText()},{' '}
<Show
when={props.onInstallAgent}
fallback={<span class="font-medium">install Pulse Agent instead</span>}
>
<button
type="button"
onClick={props.onInstallAgent}
class="font-semibold underline underline-offset-2"
>
install Pulse Agent instead
</button>
</Show>
.
</>
}
/>
</Show>
<Show when={props.state.phase() === 'detected' && props.state.candidates().length > 0}>
<div class="space-y-2">
<div class="flex items-baseline justify-between">
<div class="text-sm font-semibold text-base-content">Detected</div>
<Show when={props.state.probedMs() > 0}>
<div class="text-xs text-muted">Probed in {props.state.probedMs()} ms</div>
</Show>
</div>
<ul class="divide-y divide-border rounded-md border border-border">
<For each={props.state.candidates()}>
{(candidate) => {
const hintEntries = Object.entries(candidate.hints ?? {});
return (
<li>
<button
type="button"
class="flex w-full flex-col items-start gap-1 px-3 py-2.5 text-left transition-colors hover:bg-surface-hover"
onClick={() => props.onSelectCandidate(candidate)}
>
<div class="text-sm font-medium text-base-content">
{CONNECTION_TYPE_LABELS[candidate.type] ?? candidate.type}
</div>
<div class="text-xs text-muted">{candidate.host}</div>
<Show when={hintEntries.length > 0}>
<div class="mt-0.5 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] text-muted">
<For each={hintEntries}>
{([key, value]) => (
<span>
<span class="font-medium">{key}:</span> {value}
</span>
)}
</For>
</div>
</Show>
</button>
</li>
);
}}
</For>
</ul>
</div>
</Show>
</form>
);
};