diff --git a/.betterer.results b/.betterer.results index 38f262614ad..03847026bb1 100644 --- a/.betterer.results +++ b/.betterer.results @@ -4538,13 +4538,12 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "7"], [0, 0, 0, "Unexpected any. Specify a different type.", "8"], [0, 0, 0, "Unexpected any. Specify a different type.", "9"], - [0, 0, 0, "Unexpected any. Specify a different type.", "10"], - [0, 0, 0, "Do not use any type assertions.", "11"], + [0, 0, 0, "Do not use any type assertions.", "10"], + [0, 0, 0, "Unexpected any. Specify a different type.", "11"], [0, 0, 0, "Unexpected any. Specify a different type.", "12"], [0, 0, 0, "Unexpected any. Specify a different type.", "13"], [0, 0, 0, "Unexpected any. Specify a different type.", "14"], - [0, 0, 0, "Unexpected any. Specify a different type.", "15"], - [0, 0, 0, "Unexpected any. Specify a different type.", "16"] + [0, 0, 0, "Unexpected any. Specify a different type.", "15"] ], "public/app/features/dashboard/utils/panelMerge.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/public/app/features/dashboard/utils/getPanelMenu.test.ts b/public/app/features/dashboard/utils/getPanelMenu.test.ts index 094be864769..ab6751711f7 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.test.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.test.ts @@ -45,12 +45,6 @@ describe('getPanelMenu', () => { "shortcut": "x", "text": "Explore", }, - Object { - "iconClassName": "exchange-alt", - "onClick": [Function], - "shortcut": "p l", - "text": "Show legend", - }, Object { "iconClassName": "info-circle", "onClick": [Function], @@ -135,12 +129,6 @@ describe('getPanelMenu', () => { "shortcut": "x", "text": "Explore", }, - Object { - "iconClassName": "exchange-alt", - "onClick": [Function], - "shortcut": "p l", - "text": "Show legend", - }, Object { "iconClassName": "info-circle", "onClick": [Function], diff --git a/public/app/features/dashboard/utils/getPanelMenu.ts b/public/app/features/dashboard/utils/getPanelMenu.ts index 5cb16e663f2..a0d705804ae 100644 --- a/public/app/features/dashboard/utils/getPanelMenu.ts +++ b/public/app/features/dashboard/utils/getPanelMenu.ts @@ -47,11 +47,6 @@ export function getPanelMenu( sharePanel(dashboard, panel); }; - const onToggleLegend = (event: React.MouseEvent) => { - event.preventDefault(); - toggleLegend(panel); - }; - const onAddLibraryPanel = (event: React.MouseEvent) => { event.preventDefault(); addLibraryPanel(dashboard, panel); @@ -95,6 +90,10 @@ export function getPanelMenu( store.dispatch(navigateToExplore(panel, { getDataSourceSrv, getTimeSrv, getExploreUrl, openInNewWindow }) as any); }; + const onToggleLegend = (event: React.MouseEvent) => { + event.preventDefault(); + toggleLegend(panel); + }; const menu: PanelMenuItem[] = []; if (!panel.isEditing) { @@ -140,13 +139,6 @@ export function getPanelMenu( }); } - menu.push({ - text: panel.options.legend?.showLegend ? 'Hide legend' : 'Show legend', - iconClassName: 'exchange-alt', - onClick: onToggleLegend, - shortcut: 'p l', - }); - const inspectMenu: PanelMenuItem[] = []; // Only show these inspect actions for data plugins @@ -183,6 +175,7 @@ export function getPanelMenu( id: 'panel.header-menu.inspect', message: `Inspect`, }); + menu.push({ type: 'submenu', text: inspectTextTranslation, @@ -242,6 +235,14 @@ export function getPanelMenu( } } + if (panel.options.legend) { + subMenu.push({ + text: panel.options.legend.showLegend ? 'Hide legend' : 'Show legend', + onClick: onToggleLegend, + shortcut: 'p l', + }); + } + if (!panel.isEditing && subMenu.length) { const moreTextTranslation = t({ id: 'panel.header-menu.more',