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.

3.1 KB
Raw Blame
import { Component, Show } from 'solid-js';
import type { NodeModalProps } from '@/components/Settings/nodeModalModel';
import type { NodeModalState } from '@/components/Settings/useNodeModalState';
import { SectionHeader } from '@/components/shared/SectionHeader';
import { controlClass, formField, formHelpText, labelClass } from '@/components/shared/Form';
import {
  getNodeEndpointHelp,
  getNodeEndpointPlaceholder,
  getNodeGuestUrlPlaceholder,
} from '@/utils/nodeModalPresentation';

interface NodeModalBasicInfoSectionProps {
  modalProps: NodeModalProps;
  state: NodeModalState;
}

export const NodeModalBasicInfoSection: Component<NodeModalBasicInfoSectionProps> = (props) => {
  const { modalProps, state } = props;

  return (
    <div>
      <SectionHeader
        title="Basic information"
        size="sm"
        class="mb-4"
        titleClass="text-base-content"
      />
      <div class="grid grid-cols-1 gap-4 md:grid-cols-2">
        <div class={formField}>
          <label for="node-endpoint-url" class={labelClass('flex items-center gap-1')}>
            Endpoint URL <span class="text-red-500">*</span>
          </label>
          <input
            id="node-endpoint-url"
            type="text"
            value={state.formData().host}
            onInput={(event) => state.updateField('host', event.currentTarget.value)}
            placeholder={getNodeEndpointPlaceholder(modalProps.nodeType)}
            required
            class={controlClass()}
          />
          <Show when={getNodeEndpointHelp(modalProps.nodeType)}>
            {(help) => <p class={formHelpText}>{help()}</p>}
          </Show>
        </div>

        <div class={formField}>
          <label for="node-name" class={labelClass('flex items-center gap-1')}>
            Node Name <span class="text-slate-500 text-xs font-normal">(Optional)</span>
          </label>
          <input
            id="node-name"
            type="text"
            value={state.formData().name}
            onInput={(event) => state.updateField('name', event.currentTarget.value)}
            placeholder="Defaults to the host name"
            class={controlClass()}
          />
          <p class={formHelpText}>
            Pulse shows this name across its monitoring views. If you leave it empty, Pulse names it
            after the host.
          </p>
        </div>

        <div class={formField}>
          <label for="node-guest-url" class={labelClass('flex items-center gap-1')}>
            Guest URL <span class="text-slate-500 text-xs font-normal">(Optional)</span>
          </label>
          <input
            id="node-guest-url"
            type="text"
            value={state.formData().guestURL}
            onInput={(event) => state.updateField('guestURL', event.currentTarget.value)}
            placeholder={getNodeGuestUrlPlaceholder(modalProps.nodeType)}
            class={controlClass()}
          />
          <p class={formHelpText}>
            Optional guest-accessible URL for navigation. If specified, this URL will be used when
            opening the web UI instead of the Endpoint URL.
          </p>
        </div>
      </div>
    </div>
  );
};