diff --git a/.betterer.results b/.betterer.results index 565ecb31ab2..b117af833c9 100644 --- a/.betterer.results +++ b/.betterer.results @@ -3679,6 +3679,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/HelpWizard/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"], @@ -3823,9 +3826,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/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/SupportSnapshot/SupportSnapshot.test.tsx b/public/app/features/dashboard/components/HelpWizard/HelpWizard.test.tsx similarity index 87% rename from public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.test.tsx rename to public/app/features/dashboard/components/HelpWizard/HelpWizard.test.tsx index 74cf9e5d54c..b47443f1c01 100644 --- a/public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.test.tsx +++ b/public/app/features/dashboard/components/HelpWizard/HelpWizard.test.tsx @@ -6,7 +6,7 @@ import { getPanelPlugin } from 'app/features/plugins/__mocks__/pluginMocks'; import { PanelModel } from '../../state/PanelModel'; -import { SupportSnapshot } from './SupportSnapshot'; +import { HelpWizard } from './HelpWizard'; function setup() { const panel = new PanelModel({}); @@ -26,7 +26,7 @@ function setup() { }); panel.getQueryRunner().resendLastResult(); - return render( {}} plugin={panel.plugin} />); + return render( {}} plugin={panel.plugin} />); } describe('SupportSnapshot', () => { it('Can render', async () => { diff --git a/public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.tsx b/public/app/features/dashboard/components/HelpWizard/HelpWizard.tsx similarity index 90% rename from public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.tsx rename to public/app/features/dashboard/components/HelpWizard/HelpWizard.tsx index f59cb1458a3..1698000c553 100644 --- a/public/app/features/dashboard/components/SupportSnapshot/SupportSnapshot.tsx +++ b/public/app/features/dashboard/components/HelpWizard/HelpWizard.tsx @@ -20,6 +20,7 @@ import { Select, ClipboardButton, Stack, + Icon, } from '@grafana/ui'; import { contextSrv } from 'app/core/services/context_srv'; import { PanelModel } from 'app/features/dashboard/state'; @@ -32,7 +33,7 @@ interface Props { onClose: () => void; } -export function SupportSnapshot({ panel, plugin, onClose }: Props) { +export function HelpWizard({ panel, plugin, onClose }: Props) { const styles = useStyles2(getStyles); const service = useMemo(() => new SupportSnapshotService(panel), [panel]); @@ -65,25 +66,33 @@ export function SupportSnapshot({ panel, plugin, onClose }: Props) { } const tabs = [ - { label: 'Support', value: SnapshotTab.Support }, + { label: 'Snapshot', value: SnapshotTab.Support }, { label: 'Data', value: SnapshotTab.Data }, ]; return ( - + - + + Troubleshooting docs + + - A support snapshot contains the query response data and raw panel settings. Include this snapshot in support - requests to help identify issues faster + To request troubleshooting help, send a snapshot of this panel to Grafana Labs Technical Support. The + snapshot contains query response data and panel settings. } diff --git a/public/app/features/dashboard/components/SupportSnapshot/SupportSnapshotService.test.ts b/public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.test.ts similarity index 100% rename from public/app/features/dashboard/components/SupportSnapshot/SupportSnapshotService.test.ts rename to public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.test.ts diff --git a/public/app/features/dashboard/components/SupportSnapshot/SupportSnapshotService.ts b/public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.ts similarity index 100% rename from public/app/features/dashboard/components/SupportSnapshot/SupportSnapshotService.ts rename to public/app/features/dashboard/components/HelpWizard/SupportSnapshotService.ts diff --git a/public/app/features/dashboard/components/SupportSnapshot/randomizer.test.ts b/public/app/features/dashboard/components/HelpWizard/randomizer.test.ts similarity index 100% rename from public/app/features/dashboard/components/SupportSnapshot/randomizer.test.ts rename to public/app/features/dashboard/components/HelpWizard/randomizer.test.ts diff --git a/public/app/features/dashboard/components/SupportSnapshot/randomizer.ts b/public/app/features/dashboard/components/HelpWizard/randomizer.ts similarity index 100% rename from public/app/features/dashboard/components/SupportSnapshot/randomizer.ts rename to public/app/features/dashboard/components/HelpWizard/randomizer.ts diff --git a/public/app/features/dashboard/components/SupportSnapshot/utils.ts b/public/app/features/dashboard/components/HelpWizard/utils.ts similarity index 100% rename from public/app/features/dashboard/components/SupportSnapshot/utils.ts rename to public/app/features/dashboard/components/HelpWizard/utils.ts diff --git a/public/app/features/dashboard/components/Inspector/PanelInspector.tsx b/public/app/features/dashboard/components/Inspector/PanelInspector.tsx index 778c9ddf36a..92b23720cfb 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 { HelpWizard } from '../HelpWizard/HelpWizard'; 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.Support) { - return ; + if (defaultTab === InspectTab.Help) { + return ; } return ( diff --git a/public/app/features/dashboard/utils/getPanelMenu.ts b/public/app/features/dashboard/utils/getPanelMenu.ts index 13a5e639819..593ae5133cf 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.ts @@ -1,7 +1,7 @@ import { t } from '@lingui/macro'; import { PanelMenuItem } from '@grafana/data'; -import { AngularComponent, getDataSourceSrv, locationService } from '@grafana/runtime'; +import { AngularComponent, getDataSourceSrv, locationService, reportInteraction } from '@grafana/runtime'; import { PanelCtrl } from 'app/angular/panel/panel_ctrl'; import config from 'app/core/config'; import { contextSrv } from 'app/core/services/context_srv'; @@ -63,6 +63,10 @@ export function getPanelMenu( inspect: panel.id, inspectTab: tab, }); + + reportInteraction('grafana_panel_menu_inspect', { + tab: tab ?? InspectTab.Data, + }); }; const onMore = (event: React.MouseEvent) => { @@ -172,14 +176,6 @@ export function getPanelMenu( onClick: (e: React.MouseEvent) => onInspectPanel(InspectTab.JSON), }); - // Only show for editors - if (panel.plugin && dashboard.meta.canEdit && !panel.plugin.meta.skipDataQuery) { - inspectMenu.push({ - text: 'Support snapshot', - onClick: (e: React.MouseEvent) => onInspectPanel(InspectTab.Support), - }); - } - const inspectTextTranslation = t({ id: 'panel.header-menu.inspect', message: `Inspect`, @@ -195,8 +191,9 @@ export function getPanelMenu( }); const subMenu: PanelMenuItem[] = []; + const canEdit = dashboard.canEditPanel(panel); - if (dashboard.canEditPanel(panel) && !(panel.isViewing || panel.isEditing)) { + if (canEdit && !(panel.isViewing || panel.isEditing)) { subMenu.push({ text: 'Duplicate', onClick: onDuplicatePanel, @@ -252,7 +249,19 @@ export function getPanelMenu( }); } - if (!panel.isEditing && subMenu.length) { + // When editing hide most actions + if (panel.isEditing) { + subMenu.length = 0; + } + + if (canEdit && panel.plugin && !panel.plugin.meta.skipDataQuery) { + subMenu.push({ + text: 'Get help', + onClick: (e: React.MouseEvent) => onInspectPanel(InspectTab.Help), + }); + } + + if (subMenu.length) { const moreTextTranslation = t({ id: 'panel.header-menu.more', message: `More...`, diff --git a/public/app/features/inspector/InspectJSONTab.tsx b/public/app/features/inspector/InspectJSONTab.tsx index 2a8b9c313a6..6ebcd4f146e 100644 --- a/public/app/features/inspector/InspectJSONTab.tsx +++ b/public/app/features/inspector/InspectJSONTab.tsx @@ -10,7 +10,7 @@ import { Button, CodeEditor, Field, Select } from '@grafana/ui'; import { appEvents } from 'app/core/core'; import { DashboardModel, PanelModel } from 'app/features/dashboard/state'; -import { getPanelDataFrames } from '../dashboard/components/SupportSnapshot/utils'; +import { getPanelDataFrames } from '../dashboard/components/HelpWizard/utils'; import { getPanelInspectorStyles } from '../inspector/styles'; import { InspectTab } from './types'; @@ -134,9 +134,9 @@ export class InspectJSONTab extends PureComponent { } }; - onShowSupportWizard = () => { + onShowHelpWizard = () => { const queryParms = locationService.getSearch(); - queryParms.set('inspectTab', InspectTab.Support.toString()); + queryParms.set('inspectTab', InspectTab.Help.toString()); locationService.push('?' + queryParms.toString()); }; @@ -169,7 +169,7 @@ export class InspectJSONTab extends PureComponent { )} {show === ShowContent.DataFrames && ( - )} diff --git a/public/app/features/inspector/types.ts b/public/app/features/inspector/types.ts index e246bf031b7..fedd51f5ab5 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! - Support = 'support', // get info required for support+debugging + Help = 'help', // get info required for support+debugging }