Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

1.6 KB
Raw Blame
import { Check, Copy } from '@signozhq/icons';
import { Badge } from '@signozhq/ui/badge';
import { Button } from '@signozhq/ui/button';
import { Callout } from '@signozhq/ui/callout';
import type { ServiceaccounttypesGettableFactorAPIKeyWithKeyDTO } from 'api/generated/services/sigNoz.schemas';

export interface KeyCreatedPhaseProps {
	createdKey: ServiceaccounttypesGettableFactorAPIKeyWithKeyDTO;
	hasCopied: boolean;
	expiryLabel: string;
	onCopy: () => void;
}

function KeyCreatedPhase({
	createdKey,
	hasCopied,
	expiryLabel,
	onCopy,
}: KeyCreatedPhaseProps): JSX.Element {
	return (
		<div className="add-key-modal__form">
			<div className="add-key-modal__field">
				<span className="add-key-modal__label">Key</span>
				<div className="add-key-modal__key-display">
					<span className="add-key-modal__key-text" data-testid="created-key-value">
						{createdKey.key}
					</span>
					<Button
						size="md"
						variant="link"
						color="secondary"
						onClick={onCopy}
						icon
						aria-label={hasCopied ? 'Copied' : 'Copy key'}
					>
						{hasCopied ? <Check size={12} /> : <Copy size={12} />}
					</Button>
				</div>
			</div>

			<div className="add-key-modal__expiry-meta">
				<span className="add-key-modal__expiry-label">Expiration</span>
				<Badge textTransform="none" variant="solid" color="secondary">
					{expiryLabel}
				</Badge>
			</div>

			<div className="add-key-modal__callout-wrapper">
				<Callout
					type="info"
					showIcon
					title="Store the key securely. This is the only time it will be displayed."
				/>
			</div>
		</div>
	);
}

export default KeyCreatedPhase;