import { css } from '@emotion/css'; import React, { useMemo, useEffect } from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import { PanelPlugin, GrafanaTheme2, FeatureState } from '@grafana/data'; import { Stack } from '@grafana/experimental'; import { config } from '@grafana/runtime'; import { Drawer, Tab, TabsBar, CodeEditor, useStyles2, Field, HorizontalGroup, InlineSwitch, Button, Spinner, Alert, FeatureBadge, Select, ClipboardButton, Icon, } from '@grafana/ui'; import { contextSrv } from 'app/core/services/context_srv'; import { PanelModel } from 'app/features/dashboard/state'; 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, iframeLoading, options, showMessage, snapshotSize, markdownText, snapshotText, randomize, panelTitle, snapshotUpdate, } = service.useState(); useEffect(() => { service.buildDebugDashboard(); }, [service, plugin, randomize]); useEffect(() => { // Listen for messages from loaded iframe return service.subscribeToIframeLoadingMessage(); }, [service]); if (!plugin) { return null; } const tabs = [ { label: 'Snapshot', value: SnapshotTab.Support }, { label: 'Data', value: SnapshotTab.Data }, ]; 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. } tabs={ {tabs.map((t, index) => ( service.onCurrentTabChange(t.value!)} /> ))} } > {loading && } {error && {error.message}} {currentTab === SnapshotTab.Data && (