diff --git a/.betterer.results b/.betterer.results index de47bc4ad4d..d3dd7869b62 100644 --- a/.betterer.results +++ b/.betterer.results @@ -3705,9 +3705,6 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "public/app/features/dashboard/components/DebugWizard/randomizer.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"] - ], "public/app/features/dashboard/components/Inspector/PanelInspectActions.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], @@ -3859,6 +3856,9 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], + "public/app/features/dashboard/components/SupportSnapshot/randomizer.ts:5381": [ + [0, 0, 0, "Do not use any type assertions.", "0"] + ], "public/app/features/dashboard/components/TransformationsEditor/TransformationEditor.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] diff --git a/public/app/features/dashboard/components/Inspector/PanelInspector.tsx b/public/app/features/dashboard/components/Inspector/PanelInspector.tsx index 5931af493ba..778c9ddf36a 100644 --- a/public/app/features/dashboard/components/Inspector/PanelInspector.tsx +++ b/public/app/features/dashboard/components/Inspector/PanelInspector.tsx @@ -10,8 +10,8 @@ import { getPanelStateForModel } from 'app/features/panel/state/selectors'; import { StoreState } from 'app/types'; import { GetDataOptions } from '../../../query/state/PanelQueryRunner'; -import { DebugWizard } from '../DebugWizard/DebugWizard'; import { usePanelLatestData } from '../PanelEditor/usePanelLatestData'; +import { SupportSnapshot } from '../SupportSnapshot/SupportSnapshot'; import { InspectContent } from './InspectContent'; import { useDatasourceMetadata, useInspectTabs } from './hooks'; @@ -50,8 +50,8 @@ const PanelInspectorUnconnected = ({ panel, dashboard, plugin }: Props) => { return null; } - if (defaultTab === InspectTab.Debug) { - return ; + if (defaultTab === InspectTab.Support) { + return ; } return ( diff --git a/public/app/features/dashboard/components/DebugWizard/DebugWizard.tsx b/public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.tsx similarity index 87% rename from public/app/features/dashboard/components/DebugWizard/DebugWizard.tsx rename to public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.tsx index 82c0ec33838..6297ee681dc 100644 --- a/public/app/features/dashboard/components/DebugWizard/DebugWizard.tsx +++ b/public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.tsx @@ -58,15 +58,15 @@ const options: Array> = [ value: ShowMessge.GithubComment, }, { - label: 'Panel debug snapshot', - description: 'Dashboard to help debug any visualization issues', + label: 'Panel support snapshot', + description: 'Dashboard JSON used to help troubleshoot visualization issues', value: ShowMessge.PanelSnapshot, }, ]; -export const DebugWizard = ({ panel, plugin, onClose }: Props) => { +export function SupportSnapshot({ panel, plugin, onClose }: Props) { const styles = useStyles2(getStyles); - const [currentTab, setCurrentTab] = useState(InspectTab.Debug); + const [currentTab, setCurrentTab] = useState(InspectTab.Support); const [showMessage, setShowMessge] = useState(ShowMessge.GithubComment); const [snapshotText, setDashboardText] = useState('...'); const [rand, setRand] = useState({}); @@ -109,13 +109,22 @@ export const DebugWizard = ({ panel, plugin, onClose }: Props) => { }; const doCopyMarkdown = () => { + const maxLen = Math.pow(1024, 2) * 1.5; // 1.5MB + if (markdownText.length > maxLen) { + appEvents.emit(AppEvents.alertError, [ + `Snapshot is too large`, + 'Consider downloading and attaching the file instead', + ]); + return; + } + copyToClipboard(markdownText); appEvents.emit(AppEvents.alertSuccess, [`Message copied`]); }; const tabs = [ - { label: 'Snapshot', value: InspectTab.Debug }, - { label: 'Code', value: InspectTab.JSON }, + { label: 'Support', value: InspectTab.Support }, + { label: 'Data', value: InspectTab.JSON }, ]; let activeTab = currentTab; if (!tabs.find((item) => item.value === currentTab)) { @@ -129,7 +138,7 @@ export const DebugWizard = ({ panel, plugin, onClose }: Props) => { return ( { subtitle={

- +

} @@ -149,7 +158,7 @@ export const DebugWizard = ({ panel, plugin, onClose }: Props) => { key={`${t.value}-${index}`} label={t.label} active={t.value === activeTab} - onChangeTab={() => setCurrentTab(t.value || InspectTab.Debug)} + onChangeTab={() => setCurrentTab(t.value || InspectTab.Support)} /> ); })} @@ -226,15 +235,15 @@ export const DebugWizard = ({ panel, plugin, onClose }: Props) => { )} <> - )} diff --git a/public/app/features/inspector/types.ts b/public/app/features/inspector/types.ts index 161921dbbe9..e246bf031b7 100644 --- a/public/app/features/inspector/types.ts +++ b/public/app/features/inspector/types.ts @@ -6,5 +6,5 @@ export enum InspectTab { JSON = 'json', Query = 'query', Actions = 'actions', // ALPHA! - Debug = 'debug', // get info required for support+debugging + Support = 'support', // get info required for support+debugging }