mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Table panel: Support multiple data links in default cell * Table panel: Show data links for Image and JSONView cells * Simplify DataLinksContextMenu api * Betterer
21 lines
578 B
TypeScript
21 lines
578 B
TypeScript
import { LinkModel } from '@grafana/data';
|
|
|
|
import { MenuItemProps } from '../components/Menu/MenuItem';
|
|
|
|
/**
|
|
* Delays creating links until we need to open the ContextMenu
|
|
*/
|
|
export const linkModelToContextMenuItems: (links: () => LinkModel[]) => MenuItemProps[] = (links) => {
|
|
return links().map((link) => {
|
|
return {
|
|
label: link.title,
|
|
ariaLabel: link.title,
|
|
// TODO: rename to href
|
|
url: link.href,
|
|
target: link.target,
|
|
icon: `${link.target === '_blank' ? 'external-link-alt' : 'link'}`,
|
|
onClick: link.onClick,
|
|
};
|
|
});
|
|
};
|