Transformations: Remove `content.ts` from bundle (#111579)

* refactor: replace getLinkToDocs with fallback

* chore: cleanup
This commit is contained in:
Alex Spencer 2025-09-25 10:11:03 -07:00 committed by GitHub
parent e426b1d9d9
commit 1fad7e7a0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 15 deletions

View File

@ -1,8 +1,7 @@
import { TransformerRegistryItem } from '@grafana/data';
import { Drawer } from '@grafana/ui';
import { OperationRowHelp } from 'app/core/components/QueryOperationRow/OperationRowHelp';
import { getLinkToDocs } from '../../../transformers/docs/content';
import { FALLBACK_DOCS_LINK } from 'app/features/transformers/docs/constants';
interface TransformationEditorHelpDisplayProps {
isOpen: boolean;
@ -20,7 +19,8 @@ export const TransformationEditorHelpDisplay = ({
help,
} = transformer;
const helpContent = help ? help : getLinkToDocs();
const helpContent = help ? help : FALLBACK_DOCS_LINK;
const helpElement = (
<Drawer title={name} subtitle="Transformation help" onClose={() => onCloseClick(false)}>
<OperationRowHelp markdown={helpContent} styleOverrides={{ borderTop: '2px solid' }} />

View File

@ -0,0 +1 @@
export const FALLBACK_DOCS_LINK = `Go to the <a href="https://grafana.com/docs/grafana/latest/panels/transformations/?utm_source=grafana" target="_blank" rel="noreferrer">transformation documentation</a> for more general documentation.`;

View File

@ -1610,14 +1610,6 @@ ${buildImageContent(
},
};
export function getLinkToDocs(): string {
return `
Go to the <a href="https://grafana.com/docs/grafana/latest/panels/transformations/?utm_source=grafana" target="_blank" rel="noreferrer">
transformation documentation
</a> for more general documentation.
`;
}
function buildImageContent(source: string, imageRenderType: ImageRenderType, imageAltText: string) {
return imageRenderType === 'shortcodeFigure'
? // This will build a Hugo Shortcode "figure" image template, which shares the same default class and max-width.

View File

@ -1,4 +1,5 @@
import { transformationDocsContent, getLinkToDocs, ImageRenderType } from './content';
import { FALLBACK_DOCS_LINK } from './constants';
import { transformationDocsContent, ImageRenderType } from './content';
export function getTransformationContent(id: string): { name: string; helperDocs: string } {
if (id in transformationDocsContent) {
@ -23,7 +24,7 @@ export function getTransformationContent(id: string): { name: string; helperDocs
name,
helperDocs: `
${cleansedMarkdown}
${getLinkToDocs()}
${FALLBACK_DOCS_LINK}
${renderedLinks}
`,
};
@ -34,7 +35,7 @@ export function getTransformationContent(id: string): { name: string; helperDocs
name,
helperDocs: `
${cleansedMarkdown}
${getLinkToDocs()}
${FALLBACK_DOCS_LINK}
`,
};
}
@ -42,7 +43,7 @@ export function getTransformationContent(id: string): { name: string; helperDocs
// If the transformation has no documentation, return an external link to the online documentation.
return {
name: 'No documentation found',
helperDocs: getLinkToDocs(),
helperDocs: FALLBACK_DOCS_LINK,
};
}