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.

641 B
Raw Blame
import type { DashboardtypesPanelSpecDTO } from 'api/generated/services/sigNoz.schemas';
import { isStaticPanelKind } from 'pages/DashboardPage/DashboardContainer/Panels/capabilities';

/**
 * The markdown body of a static (query-less) panel, or null for query kinds.
 * One localized cast: the plugin-spec union can't be narrowed by a dynamic kind.
 */
export function getTextPanelBody(
	spec: DashboardtypesPanelSpecDTO | undefined,
): string | null {
	if (!spec?.plugin || !isStaticPanelKind(spec.plugin.kind)) {
		return null;
	}
	const { text } = spec.plugin.spec as { text?: string };
	return typeof text === 'string' ? text : null;
}