mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelMenu: Remove hide legend action as it was showing on all panel types (#54876)
* PanelMenu: Remove hide legend action * Fix test * Updated
This commit is contained in:
parent
dc1f7cc226
commit
ab045184e4
@ -4200,13 +4200,12 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
|
[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.", "8"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
[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.", "10"],
|
||||||
[0, 0, 0, "Do not use any type assertions.", "11"],
|
[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.", "12"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"],
|
[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.", "14"],
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "15"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "15"]
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "16"]
|
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard/utils/panelMerge.test.ts:5381": [
|
"public/app/features/dashboard/utils/panelMerge.test.ts:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
|
@ -45,12 +45,6 @@ describe('getPanelMenu', () => {
|
|||||||
"shortcut": "x",
|
"shortcut": "x",
|
||||||
"text": "Explore",
|
"text": "Explore",
|
||||||
},
|
},
|
||||||
Object {
|
|
||||||
"iconClassName": "exchange-alt",
|
|
||||||
"onClick": [Function],
|
|
||||||
"shortcut": "p l",
|
|
||||||
"text": "Show legend",
|
|
||||||
},
|
|
||||||
Object {
|
Object {
|
||||||
"iconClassName": "info-circle",
|
"iconClassName": "info-circle",
|
||||||
"onClick": [Function],
|
"onClick": [Function],
|
||||||
@ -135,12 +129,6 @@ describe('getPanelMenu', () => {
|
|||||||
"shortcut": "x",
|
"shortcut": "x",
|
||||||
"text": "Explore",
|
"text": "Explore",
|
||||||
},
|
},
|
||||||
Object {
|
|
||||||
"iconClassName": "exchange-alt",
|
|
||||||
"onClick": [Function],
|
|
||||||
"shortcut": "p l",
|
|
||||||
"text": "Show legend",
|
|
||||||
},
|
|
||||||
Object {
|
Object {
|
||||||
"iconClassName": "info-circle",
|
"iconClassName": "info-circle",
|
||||||
"onClick": [Function],
|
"onClick": [Function],
|
||||||
|
@ -48,11 +48,6 @@ export function getPanelMenu(
|
|||||||
sharePanel(dashboard, panel);
|
sharePanel(dashboard, panel);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onToggleLegend = (event: React.MouseEvent<any>) => {
|
|
||||||
event.preventDefault();
|
|
||||||
toggleLegend(panel);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onAddLibraryPanel = (event: React.MouseEvent<any>) => {
|
const onAddLibraryPanel = (event: React.MouseEvent<any>) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
addLibraryPanel(dashboard, panel);
|
addLibraryPanel(dashboard, panel);
|
||||||
@ -96,6 +91,10 @@ export function getPanelMenu(
|
|||||||
store.dispatch(navigateToExplore(panel, { getDataSourceSrv, getTimeSrv, getExploreUrl, openInNewWindow }) as any);
|
store.dispatch(navigateToExplore(panel, { getDataSourceSrv, getTimeSrv, getExploreUrl, openInNewWindow }) as any);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onToggleLegend = (event: React.MouseEvent) => {
|
||||||
|
event.preventDefault();
|
||||||
|
toggleLegend(panel);
|
||||||
|
};
|
||||||
const menu: PanelMenuItem[] = [];
|
const menu: PanelMenuItem[] = [];
|
||||||
|
|
||||||
if (!panel.isEditing) {
|
if (!panel.isEditing) {
|
||||||
@ -141,13 +140,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[] = [];
|
const inspectMenu: PanelMenuItem[] = [];
|
||||||
|
|
||||||
// Only show these inspect actions for data plugins
|
// Only show these inspect actions for data plugins
|
||||||
@ -192,6 +184,7 @@ export function getPanelMenu(
|
|||||||
id: 'panel.header-menu.inspect',
|
id: 'panel.header-menu.inspect',
|
||||||
message: `Inspect`,
|
message: `Inspect`,
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.push({
|
menu.push({
|
||||||
type: 'submenu',
|
type: 'submenu',
|
||||||
text: inspectTextTranslation,
|
text: inspectTextTranslation,
|
||||||
@ -251,6 +244,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) {
|
if (!panel.isEditing && subMenu.length) {
|
||||||
const moreTextTranslation = t({
|
const moreTextTranslation = t({
|
||||||
id: 'panel.header-menu.more',
|
id: 'panel.header-menu.more',
|
||||||
|
Loading…
Reference in New Issue
Block a user