mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Add and configure eslint-plugin-import * Fix the lint:ts npm command * Autofix + prettier all the files * Manually fix remaining files * Move jquery code in jest-setup to external file to safely reorder imports * Resolve issue caused by circular dependencies within Prometheus * Update .betterer.results * Fix missing // @ts-ignore * ignore iconBundle.ts * Fix missing // @ts-ignore
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import React, { PureComponent } from 'react';
|
|
|
|
import { PanelMenuItem } from '@grafana/data';
|
|
|
|
import { PanelHeaderMenuItem } from './PanelHeaderMenuItem';
|
|
|
|
export interface Props {
|
|
items: PanelMenuItem[];
|
|
}
|
|
|
|
export class PanelHeaderMenu extends PureComponent<Props> {
|
|
renderItems = (menu: PanelMenuItem[], isSubMenu = false) => {
|
|
return (
|
|
<ul className="dropdown-menu dropdown-menu--menu panel-menu" role={isSubMenu ? '' : 'menu'}>
|
|
{menu.map((menuItem, idx: number) => {
|
|
return (
|
|
<PanelHeaderMenuItem
|
|
key={`${menuItem.text}${idx}`}
|
|
type={menuItem.type}
|
|
text={menuItem.text}
|
|
iconClassName={menuItem.iconClassName}
|
|
onClick={menuItem.onClick}
|
|
shortcut={menuItem.shortcut}
|
|
>
|
|
{menuItem.subMenu && this.renderItems(menuItem.subMenu, true)}
|
|
</PanelHeaderMenuItem>
|
|
);
|
|
})}
|
|
</ul>
|
|
);
|
|
};
|
|
|
|
render() {
|
|
return <div className="panel-menu-container dropdown open">{this.renderItems(this.props.items)}</div>;
|
|
}
|
|
}
|