From f0057dedd40d4331d27ce5764b2eea8d35d2edd7 Mon Sep 17 00:00:00 2001 From: Mutasem Date: Mon, 1 Nov 2021 14:14:56 +0100 Subject: [PATCH] use variable for id --- packages/editor-ui/src/components/mixins/nodeBase.ts | 3 ++- packages/editor-ui/src/views/NodeView.vue | 8 ++++---- packages/editor-ui/src/views/canvasHelpers.ts | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/editor-ui/src/components/mixins/nodeBase.ts b/packages/editor-ui/src/components/mixins/nodeBase.ts index 2088ae9cc6..7aa0eb6c27 100644 --- a/packages/editor-ui/src/components/mixins/nodeBase.ts +++ b/packages/editor-ui/src/components/mixins/nodeBase.ts @@ -6,6 +6,7 @@ import { deviceSupportHelpers } from '@/components/mixins/deviceSupportHelpers'; import { nodeIndex } from '@/components/mixins/nodeIndex'; import { NODE_NAME_PREFIX, NO_OP_NODE_TYPE } from '@/constants'; import { getStyleTokenValue } from '../helpers'; +import { OVERLAY_INPUT_NAME_LABEL } from '@/views/canvasHelpers'; export const nodeBase = mixins( deviceSupportHelpers, @@ -199,7 +200,7 @@ export const nodeBase = mixins( newEndpointData.overlays = [ ['Label', { - id: 'input-name-label', + id: OVERLAY_INPUT_NAME_LABEL, location: [-3, 0.5], label: nodeTypeData.inputNames[index], cssClass: 'node-input-endpoint-label', diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 6d6027c398..da01d72d0b 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -135,7 +135,7 @@ import NodeCreator from '@/components/NodeCreator/NodeCreator.vue'; import NodeSettings from '@/components/NodeSettings.vue'; import RunData from '@/components/RunData.vue'; -import { JSPLUMB_FLOWCHART_STUB, getLeftmostTopNode, getWorkflowCorners, scaleSmaller, scaleBigger, scaleReset, showOrHideMidpointArrow, getIcon, getNewNodePosition, hideOverlay, showOrHideItemsLabel, showOverlay, OVERLAY_ENDPOINT_ARROW_ID, OVERLAY_MIDPOINT_ARROW_ID, OVERLAY_DROP_NODE_ID, OVERLAY_RUN_ITEMS_ID, OVERLAY_CONNECTION_ACTIONS_ID, getConnectorLengths, getRelativePosition, getMousePosition } from './canvasHelpers'; +import { OVERLAY_INPUT_NAME_LABEL, JSPLUMB_FLOWCHART_STUB, getLeftmostTopNode, getWorkflowCorners, scaleSmaller, scaleBigger, scaleReset, showOrHideMidpointArrow, getIcon, getNewNodePosition, hideOverlay, showOrHideItemsLabel, showOverlay, OVERLAY_ENDPOINT_ARROW_ID, OVERLAY_MIDPOINT_ARROW_ID, OVERLAY_DROP_NODE_ID, OVERLAY_RUN_ITEMS_ID, OVERLAY_CONNECTION_ACTIONS_ID, getConnectorLengths, getRelativePosition, getMousePosition } from './canvasHelpers'; import mixins from 'vue-typed-mixins'; import { v4 as uuidv4} from 'uuid'; @@ -1610,7 +1610,7 @@ export default mixins( ]); } - const inputNameOverlay = info.targetEndpoint.getOverlay('input-name-label'); + const inputNameOverlay = info.targetEndpoint.getOverlay(OVERLAY_INPUT_NAME_LABEL); if (inputNameOverlay) { inputNameOverlay.setLocation([-4.5, .5]); } @@ -1642,7 +1642,7 @@ export default mixins( } } if (targetEndpoint !== undefined && targetEndpoint.connections!.length === maxConnections) { - const inputNameOverlay = targetEndpoint.getOverlay('input-name-label'); + const inputNameOverlay = targetEndpoint.getOverlay(OVERLAY_INPUT_NAME_LABEL); if (![null, undefined].includes(inputNameOverlay)) { inputNameOverlay.setVisible(true); } @@ -1682,7 +1682,7 @@ export default mixins( }); this.instance.bind('connectionDetached', (info) => { - const inputNameOverlay = info.targetEndpoint.getOverlay('input-name-label'); + const inputNameOverlay = info.targetEndpoint.getOverlay(OVERLAY_INPUT_NAME_LABEL); if (inputNameOverlay) { // todo inputNameOverlay.setLocation([-3, .5]); diff --git a/packages/editor-ui/src/views/canvasHelpers.ts b/packages/editor-ui/src/views/canvasHelpers.ts index 7c5d6311b9..9581896c9e 100644 --- a/packages/editor-ui/src/views/canvasHelpers.ts +++ b/packages/editor-ui/src/views/canvasHelpers.ts @@ -7,6 +7,7 @@ export const OVERLAY_ENDPOINT_ARROW_ID = 'endpoint-arrow'; export const OVERLAY_RUN_ITEMS_ID = 'output-items-label'; export const OVERLAY_CONNECTION_ACTIONS_ID = 'connection-actions'; export const JSPLUMB_FLOWCHART_STUB = 26; +export const OVERLAY_INPUT_NAME_LABEL = 'input-name-label'; const _MIN_X_TO_SHOW_OUTPUT_LABEL = 90; const _MIN_Y_TO_SHOW_OUTPUT_LABEL = 100;