Skip to content
Open
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 @@ -1777,24 +1777,6 @@ describe("WorkflowEditorComponent link breakpoints", () => {

expect(wrapper.multiSelect).toBe(true);
});

it("shows and hides the tool as the breakpoint streams ask", () => {
// These two streams are how a link that already has a breakpoint keeps its marker visible after
// the cursor leaves it.
const { linkID, view } = withLink();
const wrapper = workflowActionService.getJointGraphWrapper();
const show = vi.spyOn(view, "showTools");
const hide = vi.spyOn(view, "hideTools");

(wrapper as any).jointLinkBreakpointShowStream.next({ linkID });
(wrapper as any).jointLinkBreakpointHideStream.next({ linkID });

expect(show).toHaveBeenCalledTimes(1);
expect(hide).toHaveBeenCalledTimes(1);
// Order matters, otherwise a handler pair wired to each other's stream passes: both would
// still be called once, just for the opposite reason.
expect(show.mock.invocationCallOrder[0]).toBeLessThan(hide.mock.invocationCallOrder[0]);
});
});

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1553,19 +1553,14 @@ export class WorkflowEditorComponent implements OnInit, AfterViewInit, OnDestroy

/**
* When the cursor leaves a link, the delete button disappears.
* If there is no breakpoint present on that link, the breakpoint button also disappears,
* otherwise, the breakpoint button is not changed.
*/
fromJointPaperEvent(this.paper, "link:mouseleave")
.pipe(map(value => value[0]))
.pipe(untilDestroyed(this))
.subscribe(elementView => {
// ensure that the link element exists
if (this.paper.getModelById(elementView.model.id)) {
const LinksWithBreakpoint = this.wrapper.getLinkIDsWithBreakpoint();
if (!LinksWithBreakpoint.includes(elementView.model.id.toString())) {
this.paper.getModelById(elementView.model.id).findView(this.paper).hideTools();
}
this.paper.getModelById(elementView.model.id).findView(this.paper).hideTools();
this.paper.getModelById(elementView.model.id).attr({
".tool-remove": { display: "none" },
});
Expand All @@ -1580,7 +1575,6 @@ export class WorkflowEditorComponent implements OnInit, AfterViewInit, OnDestroy
this.handleLinkBreakpointToolAttachment();
this.handleLinkBreakpointButtonClick();
this.handleLinkBreakpointHighlightEvents();
this.handleLinkBreakpointToggleEvents();
}

// when a link is added, append a breakpoint link-tool to its LinkView
Expand Down Expand Up @@ -1669,25 +1663,6 @@ export class WorkflowEditorComponent implements OnInit, AfterViewInit, OnDestroy
});
}

/**
* show/hide the breakpoint button according to the observable value received
*/
private handleLinkBreakpointToggleEvents(): void {
this.wrapper
.getLinkBreakpointShowStream()
.pipe(this.wrapper.jointGraphContext.bufferWhileAsync, untilDestroyed(this))
.subscribe(linkID => {
this.paper.getModelById(linkID.linkID).findView(this.paper).showTools();
});

this.wrapper
.getLinkBreakpointHideStream()
.pipe(this.wrapper.jointGraphContext.bufferWhileAsync, untilDestroyed(this))
.subscribe(linkID => {
this.paper.getModelById(linkID.linkID).findView(this.paper).hideTools();
});
}

/**
* Handles mouse events to enable shared cursor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1078,10 +1078,6 @@ describe("JointGraphWrapperService", () => {
);
});

it("getLinkIDsWithBreakpoint starts empty", () => {
expect(jointGraphWrapper.getLinkIDsWithBreakpoint()).toEqual([]);
});

it("getElementPositionChangeEvent reports the old and new position of a moved element", () => {
jointGraph.addCell(jointUIService.getJointOperatorElement(mockScanPredicate, mockPoint));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import { dia } from "jointjs/types/joint";
import * as _ from "lodash";
import Selectors = dia.Cell.Selectors;

type linkIDType = { linkID: string };

type JointModelEventInfo = {
add: boolean;
merge: boolean;
Expand Down Expand Up @@ -152,17 +150,10 @@ export class JointGraphWrapper {
// event stream of restoring zoom / offset default of the jointJS paper
private restorePaperOffsetSubject: Subject<void> = new Subject<void>();

// event stream of showing the breakpoint button of a link
private jointLinkBreakpointShowStream = new Subject<linkIDType>();
// event stream of hiding the breakpoint button of a link
private jointLinkBreakpointHideStream = new Subject<linkIDType>();
// the currently highlighted links' ids
private currentHighlightedLinks: string[] = [];
// the linkIDs of those links with a breakpoint

private currentHighlightedPorts: LogicalPort[] = [];
// the IDs of ports currently being edited
private linksWithBreakpoints: string[] = [];

// current zoom ratio
private zoomRatio: number = JointGraphWrapper.INIT_ZOOM_VALUE;
Expand Down Expand Up @@ -479,13 +470,6 @@ export class JointGraphWrapper {
return this.jointOperatorUnhighlightStream.pipe(this.jointGraphContext.bufferWhileAsync);
}

/**
* get the ids of all the links that have a breakpoint
*/
public getLinkIDsWithBreakpoint(): readonly string[] {
return this.linksWithBreakpoints;
}

/**
* get the event stream of a link being highlighted.
*/
Expand All @@ -500,20 +484,6 @@ export class JointGraphWrapper {
return this.jointLinkUnhighlightStream.pipe(this.jointGraphContext.bufferWhileAsync);
}

/**
* get the event stream of showing the breakpoint button of a link
*/
public getLinkBreakpointShowStream(): Observable<linkIDType> {
return this.jointLinkBreakpointShowStream.asObservable();
}

/**
* get the event stream of hiding the breakpoint button of a link
*/
public getLinkBreakpointHideStream(): Observable<linkIDType> {
return this.jointLinkBreakpointHideStream.asObservable();
}

/**
* Gets the event stream of an operator being dragged.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,6 @@ export class WorkflowActionService {
this.getTexeraGraph().getLinkDeleteStream(),
this.getTexeraGraph().getPortAddedOrDeletedStream(),
this.getTexeraGraph().getOperatorPropertyChangeStream(),
this.getTexeraGraph().getBreakpointChangeStream(),
this.getJointGraphWrapper().getElementPositionChangeEvent(),
this.getTexeraGraph().getDisabledOperatorsChangedStream(),
this.getTexeraGraph().getCommentBoxAddStream(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,6 @@ describe("WorkflowGraph", () => {
workflowGraph.operatorPropertyChangeSubject,
{ operator: mockScanPredicate },
],
[
workflowGraph.getBreakpointChangeStream(),
workflowGraph.breakpointChangeStream,
{ oldBreakpoint: undefined, linkID: "link-1" },
],
[
workflowGraph.getPortAddedOrDeletedStream(),
workflowGraph.portAddedOrDeletedSubject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ type restrictedMethods =
| "setOperatorProperty"
| "addPort"
| "removePort"
| "setLinkBreakpoint"
| "operatorAddSubject"
| "operatorDeleteSubject"
| "operatorDisplayNameChangedSubject"
| "linkAddSubject"
| "linkDeleteSubject"
| "operatorPropertyChangeSubject"
| "breakpointChangeStream"
| "commentBoxAddSubject"
| "commentBoxDeleteSubject"
| "commentBoxAddCommentSubject"
Expand Down Expand Up @@ -130,10 +128,6 @@ export class WorkflowGraph {
public readonly operatorPropertyChangeSubject = new Subject<{
operator: OperatorPredicate;
}>();
public readonly breakpointChangeStream = new Subject<{
oldBreakpoint: object | undefined;
linkID: string;
}>();
public readonly portAddedOrDeletedSubject = new Subject<{
newOperator: OperatorPredicate;
}>();
Expand Down Expand Up @@ -984,16 +978,6 @@ export class WorkflowGraph {
return this.operatorPropertyChangeSubject.asObservable();
}

/**
* Gets the observable event stream of a link breakpoint is changed.
*/
public getBreakpointChangeStream(): Observable<{
oldBreakpoint: object | undefined;
linkID: string;
}> {
return this.breakpointChangeStream.asObservable();
}

public getPortAddedOrDeletedStream(): Observable<{
newOperator: OperatorPredicate;
}> {
Expand Down
Loading