-
Notifications
You must be signed in to change notification settings - Fork 375
feat(topology): Allow tooltip usage on pipeline task node badges #8208
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,8 +45,10 @@ export type TaskNodeProps = { | |
| badgeTextColor?: string; | ||
| badgeBorderColor?: string; | ||
| badgeClassName?: string; | ||
| /** @deprecated Use badgePopoverParams instead */ | ||
| badgePopoverProps?: string; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing props is considered a breaking change. Rather than removing it, maybe just log a warning that this prop is not used for anything.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This prop was never used. Anyone using it (only one adopter thus far and they are not) would not have gotten any use from doing so. I would rather remove it to avoid confusion that would be cause by auto-complete showing this parameter.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WDYT @tlabaj
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jeff-phillips-18 can you at least bump the major version if remove the prop?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll just put it back and deprecate it |
||
| badgePopoverParams?: PopoverProps; | ||
| badgeTooltip?: React.ReactNode; // Set to use a tooltip on the badge, takes precedence over the badgePopoverParams | ||
| badgePopoverParams?: PopoverProps; // Set to use a popover on the badge, ignored if the badgeTooltip parameter is set | ||
| taskIconClass?: string; // Icon to show for the task | ||
| taskIcon?: React.ReactNode; | ||
| taskIconTooltip?: React.ReactNode; | ||
|
|
@@ -81,6 +83,8 @@ const TaskNode: React.FC<TaskNodeProps & { innerRef: React.Ref<SVGGElement> }> = | |
| badgeTextColor, | ||
| badgeBorderColor, | ||
| badgeClassName = styles.topologyPipelinesPillBadge, | ||
| badgeTooltip, | ||
| badgePopoverProps, | ||
| badgePopoverParams, | ||
| taskIconClass, | ||
| taskIcon, | ||
|
|
@@ -114,6 +118,11 @@ const TaskNode: React.FC<TaskNodeProps & { innerRef: React.Ref<SVGGElement> }> = | |
| const [contextSize, contextRef] = useSize([onContextMenu, paddingX]); | ||
| const detailsLevel = useDetailsLevel(); | ||
|
|
||
| if (badgePopoverProps) { | ||
| // eslint-disable-next-line no-console | ||
| console.warn('badgePopoverProps is deprecated. Use badgePopoverParams instead.'); | ||
| } | ||
|
|
||
| const textWidth = textSize?.width ?? 0; | ||
| const textHeight = textSize?.height ?? 0; | ||
| useAnchor( | ||
|
|
@@ -261,7 +270,7 @@ const TaskNode: React.FC<TaskNodeProps & { innerRef: React.Ref<SVGGElement> }> = | |
| /> | ||
| ); | ||
|
|
||
| const badgeComponent = badge && ( | ||
| const badgeLabel = badge ? ( | ||
| <LabelBadge | ||
| ref={badgeRef} | ||
| x={badgeStartX} | ||
|
|
@@ -272,7 +281,20 @@ const TaskNode: React.FC<TaskNodeProps & { innerRef: React.Ref<SVGGElement> }> = | |
| badgeTextColor={badgeTextColor} | ||
| badgeBorderColor={badgeBorderColor} | ||
| /> | ||
| ); | ||
| ) : null; | ||
|
|
||
| let badgeComponent: React.ReactNode; | ||
| if (badgeLabel && badgeTooltip) { | ||
| badgeComponent = <Tooltip content={badgeTooltip}>{badgeLabel}</Tooltip>; | ||
| } else if (badgeLabel && badgePopoverParams) { | ||
| badgeComponent = ( | ||
| <g onClick={e => e.stopPropagation()}> | ||
| <Popover {...badgePopoverParams}>{badgeLabel}</Popover> | ||
| </g> | ||
| ); | ||
| } else { | ||
| badgeComponent = badgeLabel; | ||
| } | ||
|
|
||
| const renderTask = () => { | ||
| if (showStatusState && !scaleNode && hideDetailsAtMedium && detailsLevel !== ScaleDetailsLevel.high) { | ||
|
|
@@ -352,14 +374,7 @@ const TaskNode: React.FC<TaskNodeProps & { innerRef: React.Ref<SVGGElement> }> = | |
| )} | ||
| {taskIconComponent && | ||
| (taskIconTooltip ? <Tooltip content={taskIconTooltip}>{taskIconComponent}</Tooltip> : taskIconComponent)} | ||
| {badgeComponent && | ||
| (badgePopoverParams ? ( | ||
| <g onClick={e => e.stopPropagation()}> | ||
| <Popover {...badgePopoverParams}>{badgeComponent}</Popover> | ||
| </g> | ||
| ) : ( | ||
| badgeComponent | ||
| ))} | ||
| {badgeComponent} | ||
| {actionIcon && ( | ||
| <> | ||
| <line | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth communicating somehow, that when data.badgeTooltips is true, then the badgePopoverParams are not going to be used anymore. Right now, they are constant and appear to always be used, but that is not the case.