import { lazy, Suspense } from 'react'; import { DataSourcePlugin, DashboardLoadedEvent, type QueryEditorProps } from '@grafana/data'; import { getAppEvents } from '@grafana/runtime'; import { LoadingPlaceholder } from '@grafana/ui'; import type { ConfigEditorProps } from './configuration/ConfigEditor'; import { TempoDatasource } from './datasource'; import { onDashboardLoadedHandler } from './tracking'; import type { TempoQuery } from './types'; // Lazy load the QueryField and ConfigEditor components to reduce the size of the initial bundle const TempoQueryFieldLazy = lazy(() => import('./QueryField')); const ConfigEditorLazy = lazy(() => import('./configuration/ConfigEditor')); const CheatSheetLazy = lazy(() => import('./CheatSheet')); function TempoQueryField(props: QueryEditorProps) { return ( }> ); } function ConfigEditor(props: ConfigEditorProps) { return ( }> ); } function CheatSheet() { return ( ); } export const plugin = new DataSourcePlugin(TempoDatasource) .setQueryEditor(TempoQueryField) .setConfigEditor(ConfigEditor) .setQueryEditorHelp(CheatSheet); // Subscribe to on dashboard loaded event so that we can track plugin adoption getAppEvents().subscribe>(DashboardLoadedEvent, onDashboardLoadedHandler);