mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
wip: panel-header: Start implementing the Toggle legend, but its not taken all the way
This commit is contained in:
parent
79da3dc9f6
commit
6151310216
@ -3,7 +3,14 @@ import { DashboardModel } from 'app/features/dashboard/dashboard_model';
|
|||||||
import { PanelHeaderMenuItem, PanelHeaderMenuItemTypes } from './PanelHeaderMenuItem';
|
import { PanelHeaderMenuItem, PanelHeaderMenuItemTypes } from './PanelHeaderMenuItem';
|
||||||
import { store } from 'app/store/configureStore';
|
import { store } from 'app/store/configureStore';
|
||||||
import { updateLocation } from 'app/core/actions';
|
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 {
|
export interface PanelHeaderMenuProps {
|
||||||
panelId: number;
|
panelId: number;
|
||||||
@ -73,6 +80,11 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
|
|||||||
editPanelJson(dashboard, panel);
|
editPanelJson(dashboard, panel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onToggleLegend = () => {
|
||||||
|
const panel = this.getPanel();
|
||||||
|
toggleLegend(panel);
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="panel-menu-container dropdown">
|
<div className="panel-menu-container dropdown">
|
||||||
@ -122,7 +134,7 @@ export class PanelHeaderMenu extends PureComponent<PanelHeaderMenuProps, any> {
|
|||||||
<PanelHeaderMenuItem
|
<PanelHeaderMenuItem
|
||||||
type={PanelHeaderMenuItemTypes.Link}
|
type={PanelHeaderMenuItemTypes.Link}
|
||||||
text="Toggle legend"
|
text="Toggle legend"
|
||||||
handleClick={() => {}}
|
handleClick={this.onToggleLegend}
|
||||||
shortcut="p l"
|
shortcut="p l"
|
||||||
/>
|
/>
|
||||||
</ul>
|
</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);
|
||||||
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user