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>
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
/**
|
||||
* Version Warning Component
|
||||
*
|
||||
* Displays warnings about API version compatibility and issues.
|
||||
*/
|
||||
|
||||
import { Alert, Box, Button, Link } from '@mui/material';
|
||||
import React from 'react';
|
||||
import { SealedSecret } from '../lib/SealedSecretCRD';
|
||||
|
||||
export interface VersionWarningProps {
|
||||
/** Whether to auto-detect version on mount */
|
||||
autoDetect?: boolean;
|
||||
/** Whether to show detailed version information */
|
||||
showDetails?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component that detects and displays API version information
|
||||
*
|
||||
* Shows warnings if:
|
||||
* - CRD is not installed
|
||||
* - Version detection fails
|
||||
* - Using non-default version (informational)
|
||||
*/
|
||||
export function VersionWarning({ autoDetect = true, showDetails = false }: VersionWarningProps) {
|
||||
const [loading, setLoading] = React.useState(true);
|
||||
const [detectedVersion, setDetectedVersion] = React.useState<string | null>(null);
|
||||
const [error, setError] = React.useState<string | null>(null);
|
||||
|
||||
const detectVersion = React.useCallback(async () => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const result = await SealedSecret.detectApiVersion();
|
||||
|
||||
if (result.ok) {
|
||||
setDetectedVersion(result.value);
|
||||
setError(null);
|
||||
} else if (result.ok === false) {
|
||||
setDetectedVersion(null);
|
||||
// Ensure error is always a string
|
||||
const errorMessage = typeof result.error === 'string'
|
||||
? result.error
|
||||
: String(result.error);
|
||||
setError(errorMessage);
|
||||
}
|
||||
} catch (e) {
|
||||
// Catch any unexpected errors
|
||||
setDetectedVersion(null);
|
||||
setError(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (autoDetect) {
|
||||
detectVersion();
|
||||
}
|
||||
}, [autoDetect, detectVersion]);
|
||||
|
||||
// Don't show anything while loading
|
||||
if (loading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Show error if detection failed
|
||||
if (error) {
|
||||
return (
|
||||
<Box mb={2}>
|
||||
<Alert severity="error" action={
|
||||
<Button color="inherit" size="small" onClick={detectVersion}>
|
||||
Retry
|
||||
</Button>
|
||||
}>
|
||||
<strong>API Version Detection Failed</strong>
|
||||
<br />
|
||||
{String(error)}
|
||||
{String(error).includes('not found') && (
|
||||
<>
|
||||
<br />
|
||||
<br />
|
||||
Install Sealed Secrets with:{' '}
|
||||
<code style={{ fontSize: '0.875em' }}>
|
||||
kubectl apply -f https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.24.0/controller.yaml
|
||||
</code>
|
||||
<br />
|
||||
Or visit:{' '}
|
||||
<Link
|
||||
href="https://github.com/bitnami-labs/sealed-secrets"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
color="inherit"
|
||||
>
|
||||
github.com/bitnami-labs/sealed-secrets
|
||||
</Link>
|
||||
</>
|
||||
)}
|
||||
</Alert>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
// Show informational message if using non-default version
|
||||
if (detectedVersion && detectedVersion !== SealedSecret.DEFAULT_VERSION) {
|
||||
return (
|
||||
<Box mb={2}>
|
||||
<Alert severity="info">
|
||||
<strong>API Version Detected</strong>
|
||||
<br />
|
||||
Using API version: <code>{detectedVersion}</code>
|
||||
{showDetails && (
|
||||
<>
|
||||
<br />
|
||||
Default version: <code>{SealedSecret.DEFAULT_VERSION}</code>
|
||||
</>
|
||||
)}
|
||||
</Alert>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
// Show success if explicitly showing details
|
||||
if (showDetails && detectedVersion) {
|
||||
return (
|
||||
<Box mb={2}>
|
||||
<Alert severity="success">
|
||||
<strong>API Version Detected</strong>
|
||||
<br />
|
||||
Using API version: <code>{detectedVersion}</code>
|
||||
</Alert>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
// Default: show nothing (version detected successfully)
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user