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.5 KB
Raw Blame
import { Component } from 'solid-js';
import SettingsPanel from '@/components/shared/SettingsPanel';
import { ButtonLink } from '@/components/shared/Button';
import { API_TOKEN_ACCESS_PANEL_DESCRIPTION } from '@/utils/apiTokenPresentation';
import { API_TOKEN_SCOPES_DOC_URL } from '@/utils/docsLinks';
import APITokenManager from './APITokenManager';

interface APIAccessPanelProps {
  currentTokenHint?: string;
  currentUser?: string;
  onTokensChanged: () => void;
  refreshing: boolean;
  canManage: boolean;
}

export const APIAccessPanel: Component<APIAccessPanelProps> = (props) => {
  return (
    <div class="space-y-3 sm:space-y-6">
      <SettingsPanel title="API Access" noPadding>
        <div class="space-y-2.5 p-2.5 sm:space-y-3 sm:p-6">
          <p class="text-xs leading-relaxed text-muted sm:text-sm">
            {API_TOKEN_ACCESS_PANEL_DESCRIPTION}
          </p>
          <ButtonLink
            href={API_TOKEN_SCOPES_DOC_URL}
            target="_blank"
            variant="info"
            size="settingsAction"
            class="w-fit gap-2 font-semibold"
          >
            View scope reference
          </ButtonLink>
        </div>
      </SettingsPanel>

      <div data-testid="api-access-token-section">
        <APITokenManager
          currentTokenHint={props.currentTokenHint}
          currentUser={props.currentUser}
          onTokensChanged={props.onTokensChanged}
          refreshing={props.refreshing}
          canManage={props.canManage}
        />
      </div>
    </div>
  );
};