Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StatPanel: Fix data link tooltip not showing for single value #34934

Merged
merged 1 commit into from
May 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/grafana-ui/src/components/BigValue/BigValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export interface Props extends Themeable2 {
text?: TextDisplayOptions;
/** Specify which text should be visible in the BigValue */
textMode?: BigValueTextMode;
/** If true disables the tooltip */
hasLinks?: boolean;

/**
* If part of a series of stat panes, this is the total number.
Expand All @@ -73,16 +75,19 @@ export class BigValue extends PureComponent<Props> {
};

render() {
const { onClick, className } = this.props;
const { onClick, className, hasLinks } = this.props;
const layout = buildLayout(this.props);
const panelStyles = layout.getPanelStyles();
const valueAndTitleContainerStyles = layout.getValueAndTitleContainerStyles();
const valueStyles = layout.getValueStyles();
const titleStyles = layout.getTitleStyles();
const textValues = layout.textValues;

// When there is an outer data link this tooltip will override the outer native tooltip
const tooltip = hasLinks ? undefined : textValues.tooltip;

return (
<div className={className} style={panelStyles} onClick={onClick} title={textValues.tooltip}>
<div className={className} style={panelStyles} onClick={onClick} title={tooltip}>
<div style={valueAndTitleContainerStyles}>
{textValues.title && <div style={titleStyles}>{textValues.title}</div>}
<FormattedValueDisplay value={textValues} style={valueStyles} />
Expand Down