Commit 61513102 by Johannes Schill

wip: panel-header: Start implementing the Toggle legend, but its not taken all the way

parent 79da3dc9
......@@ -3,7 +3,14 @@ import { DashboardModel } from 'app/features/dashboard/dashboard_model';
import { PanelHeaderMenuItem, PanelHeaderMenuItemTypes } from './PanelHeaderMenuItem';
import { store } from 'app/store/configureStore';
import { updateLocation } from 'app/core/actions';
import { removePanel, duplicatePanel, copyPanel, editPanelJson, sharePanel } from 'app/features/dashboard/utils/panel';
import {
removePanel,
duplicatePanel,
copyPanel,
editPanelJson,
sharePanel,
toggleLegend,
} from 'app/features/dashboard/utils/panel';
export interface PanelHeaderMenuProps {
panelId: number;
......@@ -73,6 +80,11 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
editPanelJson(dashboard, panel);
};
onToggleLegend = () => {
const panel = this.getPanel();
toggleLegend(panel);
};
render() {
return (
<div className="panel-menu-container dropdown">
......@@ -122,7 +134,7 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
<PanelHeaderMenuItem
type={PanelHeaderMenuItemTypes.Link}
text="Toggle legend"
handleClick={() => {}}
handleClick={this.onToggleLegend}
shortcut="p l"
/>
</ul>
......
......@@ -73,3 +73,14 @@ export const sharePanel = (dashboard: DashboardModel, panel: PanelModel) => {
},
});
};
export const refreshPanel = (panel: PanelModel) => {
panel.refresh();
};
export const toggleLegend = (panel: PanelModel) => {
console.log('Toggle legend is not implemented yet');
// We need to set panel.legend defaults first
// panel.legend.show = !panel.legend.show;
refreshPanel(panel);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment