mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-29 06:29:42 -08:00
refactor
This commit is contained in:
parent
a822539195
commit
1212eb9097
|
@ -1363,24 +1363,6 @@ export default mixins(
|
||||||
// only one set of visible actions should be visible at the same time
|
// only one set of visible actions should be visible at the same time
|
||||||
let activeConnection: null | Connection = null;
|
let activeConnection: null | Connection = null;
|
||||||
|
|
||||||
const hideActions = (connection: Connection | null) => {
|
|
||||||
if (connection) {
|
|
||||||
CanvasHelpers.hideOverlay(connection, CanvasHelpers.OVERLAY_CONNECTION_ACTIONS_ID);
|
|
||||||
CanvasHelpers.showOrHideItemsLabel(connection);
|
|
||||||
CanvasHelpers.showOrHideMidpointArrow(connection);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const showActions = (connection: Connection | null) => {
|
|
||||||
if (connection) {
|
|
||||||
CanvasHelpers.showOverlay(connection, CanvasHelpers.OVERLAY_CONNECTION_ACTIONS_ID);
|
|
||||||
CanvasHelpers.hideOverlay(connection, CanvasHelpers.OVERLAY_RUN_ITEMS_ID);
|
|
||||||
if (!connection.getOverlay(CanvasHelpers.OVERLAY_RUN_ITEMS_ID)) {
|
|
||||||
CanvasHelpers.hideOverlay(connection, CanvasHelpers.OVERLAY_MIDPOINT_ARROW_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.instance.bind('connection', (info: OnConnectionBindInfo) => {
|
this.instance.bind('connection', (info: OnConnectionBindInfo) => {
|
||||||
const sourceInfo = info.sourceEndpoint.getParameters();
|
const sourceInfo = info.sourceEndpoint.getParameters();
|
||||||
const targetInfo = info.targetEndpoint.getParameters();
|
const targetInfo = info.targetEndpoint.getParameters();
|
||||||
|
@ -1422,12 +1404,12 @@ export default mixins(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hideActions(activeConnection);
|
CanvasHelpers.hideConnectionActions(activeConnection);
|
||||||
|
|
||||||
enterTimer = setTimeout(() => {
|
enterTimer = setTimeout(() => {
|
||||||
enterTimer = undefined;
|
enterTimer = undefined;
|
||||||
activeConnection = info.connection;
|
activeConnection = info.connection;
|
||||||
showActions(info.connection);
|
CanvasHelpers.showConnectionActions(info.connection);
|
||||||
}, 150);
|
}, 150);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1449,7 +1431,7 @@ export default mixins(
|
||||||
exitTimer = undefined;
|
exitTimer = undefined;
|
||||||
|
|
||||||
if (activeConnection === info.connection) {
|
if (activeConnection === info.connection) {
|
||||||
hideActions(activeConnection);
|
CanvasHelpers.hideConnectionActions(activeConnection);
|
||||||
activeConnection = null;
|
activeConnection = null;
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
|
@ -343,3 +343,22 @@ export const getBackgroundStyles = (scale: number, offsetPosition: XYPosition) =
|
||||||
}
|
}
|
||||||
return styles;
|
return styles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const hideConnectionActions = (connection: Connection | null) => {
|
||||||
|
if (connection) {
|
||||||
|
hideOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
|
||||||
|
showOrHideItemsLabel(connection);
|
||||||
|
showOrHideMidpointArrow(connection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const showConectionActions = (connection: Connection | null) => {
|
||||||
|
if (connection) {
|
||||||
|
showOverlay(connection, OVERLAY_CONNECTION_ACTIONS_ID);
|
||||||
|
hideOverlay(connection, OVERLAY_RUN_ITEMS_ID);
|
||||||
|
if (!connection.getOverlay(OVERLAY_RUN_ITEMS_ID)) {
|
||||||
|
hideOverlay(connection, OVERLAY_MIDPOINT_ARROW_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue