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

NIFI-13368: Allowing tooltip mouse listeners to be destroyed when necessary #8931

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ export class CanvasUtils {
/**
* Determines the connectable type for the specified source.
*
* @argument {type} ComponentType The component type
* @param type The type of component
*/
getConnectableTypeForSource(type: ComponentType): string {
switch (type) {
Expand Down Expand Up @@ -1221,6 +1221,17 @@ export class CanvasUtils {
});
}

/**
* Reset the tooltip for the specified selection.
*
* @param selection
*/
public resetCanvasTooltip(selection: any): void {
// while tooltips are created dynamically, we need to provide the ability to remove the mouse
// listener to prevent new tooltips from being created on subsequent mouse enter/leave
selection.on('mouseenter', null).on('mouseleave', null);
}

/**
* Sets the bulletin visibility and applies a tooltip if necessary.
*
Expand All @@ -1232,6 +1243,9 @@ export class CanvasUtils {
// reset the bulletin icon/background
selection.select('text.bulletin-icon').style('visibility', 'hidden');
selection.select('rect.bulletin-background').style('visibility', 'hidden');

// reset the canvas tooltip
this.resetCanvasTooltip(selection);
} else {
// show the bulletin icon/background
const bulletinIcon: any = selection.select('text.bulletin-icon').style('visibility', 'visible');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ export class PortManager {
.each(function (this: any) {
if (!self.nifiCommon.isBlank(portData.component.comments)) {
self.canvasUtils.canvasTooltip(TextTip, d3.select(this), portData.component.comments);
} else {
self.canvasUtils.resetCanvasTooltip(d3.select(this));
}
});
} else {
Expand Down Expand Up @@ -414,6 +416,8 @@ export class PortManager {
isValidating: false,
validationErrors: d.component.validationErrors
});
} else {
self.canvasUtils.resetCanvasTooltip(d3.select(this));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,8 @@ export class ProcessGroupManager {
self.canvasUtils.canvasTooltip(VersionControlTip, d3.select(this), {
versionControlInformation: processGroupData.component.versionControlInformation
});
} else {
self.canvasUtils.resetCanvasTooltip(d3.select(this));
}
});

Expand All @@ -1144,6 +1146,8 @@ export class ProcessGroupManager {
d3.select(this),
processGroupData.component.comments
);
} else {
self.canvasUtils.resetCanvasTooltip(d3.select(this));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ export class ProcessorManager {
d3.select(nodes[i]),
processorData.component.config.comments
);
} else {
this.canvasUtils.resetCanvasTooltip(d3.select(nodes[i]));
}
});
} else {
Expand Down Expand Up @@ -730,6 +732,8 @@ export class ProcessorManager {
isValidating: d.status.aggregateSnapshot.runStatus === 'Validating',
validationErrors: d.component.validationErrors
});
} else {
this.canvasUtils.resetCanvasTooltip(d3.select(nodes[i]));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,8 @@ export class RemoteProcessGroupManager {
d3.select(this),
remoteProcessGroupData.component.comments
);
} else {
self.canvasUtils.resetCanvasTooltip(d3.select(this));
}
});

Expand Down Expand Up @@ -622,6 +624,8 @@ export class RemoteProcessGroupManager {
isValidating: false,
validationErrors: self.getIssues(d)
});
} else {
self.canvasUtils.resetCanvasTooltip(d3.select(this));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2286,7 +2286,7 @@ export class FlowEffects {
mergeMap(([requests, processGroupId]) => {
if (requests.length === 1) {
return from(this.flowService.deleteComponent(requests[0])).pipe(
map(() => {
map((response) => {
const deleteResponses: DeleteComponentResponse[] = [
{
id: requests[0].id,
Expand All @@ -2304,6 +2304,8 @@ export class FlowEffects {
type: ComponentType.Connection
})
);
} else {
this.store.dispatch(FlowActions.loadComponentsForConnection({ connection: response }));
}

return FlowActions.deleteComponentsSuccess({
Expand Down