diff --git a/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx b/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx index 9524e497cad..bf91200c338 100644 --- a/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx +++ b/packages/grafana-ui/src/components/DataLinks/DataLinksContextMenu.tsx @@ -1,5 +1,5 @@ import { css } from '@emotion/css'; -import React from 'react'; +import React, { CSSProperties } from 'react'; import { LinkModel } from '@grafana/data'; import { selectors } from '@grafana/e2e-selectors'; @@ -12,6 +12,7 @@ import { MenuItem } from '../Menu/MenuItem'; interface DataLinksContextMenuProps { children: (props: DataLinksContextMenuApi) => JSX.Element; links: () => LinkModel[]; + style?: CSSProperties; } export interface DataLinksContextMenuApi { @@ -19,7 +20,7 @@ export interface DataLinksContextMenuApi { targetClassName?: string; } -export const DataLinksContextMenu: React.FC = ({ children, links }) => { +export const DataLinksContextMenu: React.FC = ({ children, links, style }) => { const itemsGroup: MenuItemsGroup[] = [{ items: linkModelToContextMenuItems(links), label: 'Data links' }]; const linksCounter = itemsGroup[0].items.length; const renderMenuGroupItems = () => { @@ -61,7 +62,7 @@ export const DataLinksContextMenu: React.FC = ({ chil onClick={linkModel.onClick} target={linkModel.target} title={linkModel.title} - style={{ display: 'flex', width: '100%' }} + style={style} aria-label={selectors.components.DataLinksContextMenu.singleLink} > {children({})} diff --git a/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx b/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx index 842a09ef47f..4e1c61f858e 100644 --- a/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx +++ b/packages/grafana-ui/src/components/Table/BarGaugeCell.tsx @@ -50,7 +50,7 @@ export const BarGaugeCell: FC = (props) => { return field.getLinks({ valueRowIndex: row.index }); }; - const hasLinks = !!getLinks().length; + const hasLinks = Boolean(getLinks().length); const renderComponent = (menuProps: DataLinksContextMenuApi) => { const { openMenu, targetClassName } = menuProps; @@ -76,7 +76,11 @@ export const BarGaugeCell: FC = (props) => { return (
- {hasLinks && {(api) => renderComponent(api)}} + {hasLinks && ( + + {(api) => renderComponent(api)} + + )} {!hasLinks && ( = (props) => { const displayValue = field.display!(cell.value); - const hasLinks = getCellLinks(field, row)?.length; + const hasLinks = Boolean(getCellLinks(field, row)?.length); return (
diff --git a/packages/grafana-ui/src/components/Table/JSONViewCell.tsx b/packages/grafana-ui/src/components/Table/JSONViewCell.tsx index 029dd2abd2d..70c73fce64e 100644 --- a/packages/grafana-ui/src/components/Table/JSONViewCell.tsx +++ b/packages/grafana-ui/src/components/Table/JSONViewCell.tsx @@ -27,7 +27,7 @@ export function JSONViewCell(props: TableCellProps): JSX.Element { displayValue = JSON.stringify(value, null, ' '); } - const hasLinks = getCellLinks(field, row)?.length; + const hasLinks = Boolean(getCellLinks(field, row)?.length); return (
diff --git a/packages/grafana-ui/src/components/Table/styles.ts b/packages/grafana-ui/src/components/Table/styles.ts index 7bb9d5b5b21..bc7261316c2 100644 --- a/packages/grafana-ui/src/components/Table/styles.ts +++ b/packages/grafana-ui/src/components/Table/styles.ts @@ -165,7 +165,6 @@ export const getTableStyles = (theme: GrafanaTheme2) => { imageCellLink: css` cursor: pointer; overflow: hidden; - width: 100%; height: 100%; `, headerFilter: css`