import { css } from '@emotion/css'; import { useMemo, useEffect } from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import { PanelPlugin, GrafanaTheme2 } from '@grafana/data'; import { Trans, t } from '@grafana/i18n'; import { config } from '@grafana/runtime'; import { Drawer, Tab, TabsBar, CodeEditor, useStyles2, Field, InlineSwitch, Button, Spinner, Alert, Select, ClipboardButton, Stack, TextLink, } from '@grafana/ui'; import { contextSrv } from 'app/core/services/context_srv'; import { PanelModel } from 'app/features/dashboard/state/PanelModel'; import { AccessControlAction } from 'app/types'; import { ShowMessage, SnapshotTab, SupportSnapshotService } from './SupportSnapshotService'; interface Props { panel: PanelModel; plugin?: PanelPlugin | null; onClose: () => void; } export function HelpWizard({ panel, plugin, onClose }: Props) { const styles = useStyles2(getStyles); const service = useMemo(() => new SupportSnapshotService(panel), [panel]); const { currentTab, loading, error, options, showMessage, snapshotSize, markdownText, snapshotText, randomize, panelTitle, scene, } = service.useState(); useEffect(() => { service.buildDebugDashboard(); }, [service, plugin, randomize]); if (!plugin) { return null; } const tabs = [ { label: t('dashboard.help-wizard.tabs.label.snapshot', 'Snapshot'), value: SnapshotTab.Support }, { label: t('dashboard.help-wizard.tabs.label.data', 'Data'), value: SnapshotTab.Data }, ]; const hasSupportBundleAccess = config.supportBundlesEnabled && contextSrv.hasPermission(AccessControlAction.ActionSupportBundlesCreate); return ( Troubleshooting docs To request troubleshooting help, send a snapshot of this panel to Grafana Labs Technical Support. The snapshot contains query response data and panel settings. {hasSupportBundleAccess && ( You can also retrieve a support bundle containing information concerning your Grafana instance and configured datasources in the support bundles section. )} } tabs={ {tabs.map((t, index) => ( service.onCurrentTabChange(t.value!)} /> ))} } > {loading && } {error && {error.message}} {currentTab === SnapshotTab.Data && (