Transformations: Remove content.ts from bundle (#111579)
* refactor: replace getLinkToDocs with fallback * chore: cleanup
This commit is contained in:
+3
-3
@@ -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' }} />
|
||||
|
||||
@@ -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.`;
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user