import React from 'react'; import { useAsync } from 'react-use'; import { renderMarkdown } from '@grafana/data'; import { getBackendSrv } from '@grafana/runtime'; import { LoadingPlaceholder } from '@grafana/ui'; interface Props { pluginId: string; } export function PluginHelp({ pluginId }: Props) { const { value, loading, error } = useAsync(async () => { return getBackendSrv().get(`/api/plugins/${pluginId}/markdown/query_help`); }, []); const renderedMarkdown = renderMarkdown(value); if (loading) { return ; } if (error) { return

An error occurred when loading help.

; } if (value === '') { return

No query help could be found.

; } return
; }