Files
headlamp-sealed-secrets-plugin/src/components/ControllerStatus.tsx
T
DevContainer User af95c3795c chore: move source to repo root and standardize config
Phase 1 — Structural overhaul:
- Move all source from headlamp-sealed-secrets/ subdirectory to repo root
- Delete 23 AI-generated docs, 8 pre-built tarballs, release snapshots dir
- Remove all working-directory refs from CI/release workflows
- Update install-plugin.sh and typedoc.json paths

Phase 2 — Config standardization:
- Create .eslintrc.js and .prettierrc.js (standard Headlamp configs)
- Remove inline eslintConfig/prettier from package.json (drop jsx-a11y, prettier extends)
- Rewrite tsconfig.json (package name extend, add compilerOptions.types)
- Create vitest.config.mts and vitest.setup.ts (standard from polaris)
- Replace headlamp-plugin CLI scripts with direct tool invocation
- Rewrite .gitignore with standard baseline

Phase 3 — MCP & Claude settings:
- Create .mcp.json with github/kubernetes/flux/playwright servers
- Create .claude/settings.local.json
- Remove 7 specialized agents, keep 3 meta-orchestration agents

Phase 4 — Documentation:
- Rewrite CLAUDE.md (remove subdirectory refs, standard format)
- Add ArtifactHub badge, Architecture section, standardized install methods to README.md
- Create CONTRIBUTING.md and SECURITY.md
- Fix pre-existing test bugs in validators.test.ts (isValidNamespace returns boolean,
  not ValidationResult; error message string mismatches)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 21:31:12 +00:00

85 lines
2.4 KiB
TypeScript

/**
* Controller Status Indicator
*
* Displays the health status of the sealed-secrets controller,
* including reachability, response time, and version information.
*/
import { Icon } from '@iconify/react';
import { Box, Chip, Tooltip, Typography } from '@mui/material';
import React from 'react';
import { useControllerHealth } from '../hooks/useControllerHealth';
import { ControllerHealthSkeleton } from './LoadingSkeletons';
interface ControllerStatusProps {
/** Whether to auto-refresh the status */
autoRefresh?: boolean;
/** Refresh interval in milliseconds (default: 30000 = 30s) */
refreshIntervalMs?: number;
/** Show detailed info (latency, version) */
showDetails?: boolean;
}
/**
* Controller status indicator component
*/
export function ControllerStatus({
autoRefresh = false,
refreshIntervalMs = 30000,
showDetails = true,
}: ControllerStatusProps) {
const { health: status, loading } = useControllerHealth(autoRefresh, refreshIntervalMs);
// Show skeleton while loading
if (loading || !status) {
return <ControllerHealthSkeleton />;
}
// Build status message and icon
let statusColor: 'success' | 'error' | 'warning' = 'error';
let statusIcon = 'mdi:alert-circle';
let statusLabel = 'Unreachable';
let tooltipText = status.error || 'Controller is unreachable';
if (status.healthy) {
statusColor = 'success';
statusIcon = 'mdi:check-circle';
statusLabel = 'Healthy';
tooltipText = `Controller is healthy${status.version ? ` (${status.version})` : ''}`;
} else if (status.reachable) {
statusColor = 'warning';
statusIcon = 'mdi:alert';
statusLabel = 'Unhealthy';
tooltipText = status.error || 'Controller responded but is not healthy';
}
return (
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Tooltip title={tooltipText}>
<Chip
icon={<Icon icon={statusIcon} />}
label={statusLabel}
color={statusColor}
size="small"
variant="outlined"
/>
</Tooltip>
{showDetails && status.healthy && (
<>
{status.latencyMs !== undefined && (
<Typography variant="caption" color="text.secondary">
{status.latencyMs}ms
</Typography>
)}
{status.version && (
<Typography variant="caption" color="text.secondary">
v{status.version}
</Typography>
)}
</>
)}
</Box>
);
}