Skip to content

Commit

Permalink
fix(designer): Revert "Prevent parent node from being dragged below d…
Browse files Browse the repository at this point in the history
…ependent node (#4973)" (#5037)


This reverts commit a29916d.
  • Loading branch information
ccastrotrejo committed Jun 27, 2024
1 parent d6b0e30 commit 5011fdb
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export const AzureStandardLogicAppSelector = () => {
disabled={workflowOptions.length === 0 || !appId || isWorkflowsLoading}
defaultValue={workflowName}
onChange={(_, option) => {
dispatch(setWorkflowName(option?.key as string));
dispatch(setResourcePath(`${appId}/workflows/${option?.key}`));
dispatch(setWorkflowName(option?.key as string));
}}
/>
{isWorkflowsLoading ? (
Expand Down
2 changes: 0 additions & 2 deletions libs/designer/src/lib/__test__/redux-test-helper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import designerOptionsReducer from '../core/state/designerOptions/designerOption
import designerViewReducer from '../core/state/designerView/designerViewSlice';
import operationMetadataReducer from '../core/state/operation/operationMetadataSlice';
import panelReducer from '../core/state/panel/panelSlice';
import customCodeReducer from '../core/state/customcode/customcodeSlice';
import settingsReducer from '../core/state/setting/settingSlice';
import staticResultsSchemasReducer from '../core/state/staticresultschema/staticresultsSlice';
import tokens from '../core/state/tokens/tokensSlice';
Expand Down Expand Up @@ -40,7 +39,6 @@ export function renderWithRedux(
tokens: tokens,
workflowParameters: workflowParametersReducer,
staticResults: staticResultsSchemasReducer,
customCode: customCodeReducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware({
Expand Down

This file was deleted.

30 changes: 0 additions & 30 deletions libs/designer/src/lib/core/state/operation/operationSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,36 +131,6 @@ export const useTokenDependencies = (nodeId: string) => {
}, [operationInputParameters]);
};

export const useNodesTokenDependencies = (nodes: Set<string>) => {
const operationsInputsParameters = useOperationsInputParameters();
const dependencies: Record<string, Set<string>> = {};
if (!operationsInputsParameters) {
return dependencies;
}
for (const node of nodes) {
const operationInputParameters = getRecordEntry(operationsInputsParameters, node);
if (operationInputParameters) {
const innerDependencies = new Set<string>();
for (const group of Object.values(operationInputParameters.parameterGroups)) {
for (const parameter of group.parameters) {
for (const value of parameter.value) {
if (value.token?.actionName) {
innerDependencies.add(value.token.actionName);
}
if (value.token?.arrayDetails?.loopSource) {
innerDependencies.add(value.token.arrayDetails.loopSource);
}
}
}
}
dependencies[node] = innerDependencies;
} else {
dependencies[node] = new Set();
}
}
return dependencies;
};

export const useAllOperationErrors = () => useSelector(createSelector(getOperationState, (state) => state.errors));

export const useParameterValidationErrors = (nodeId: string) => {
Expand Down
10 changes: 1 addition & 9 deletions libs/designer/src/lib/ui/connections/dropzone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
LogEntryLevel,
LoggerService,
} from '@microsoft/logic-apps-shared';
import { useNodesTokenDependencies } from '../../core/state/operation/operationSelector';
import { useCallback, useMemo, useState } from 'react';
import { useDrop } from 'react-dnd';
import { useHotkeys } from 'react-hotkeys-hook';
Expand Down Expand Up @@ -69,7 +68,6 @@ export const DropZone: React.FC<DropZoneProps> = ({ graphId, parentId, childId,
const upstreamNodesOfChild = useUpstreamNodes(removeIdTag(childId ?? newParentId ?? graphId));
const immediateAncestor = useGetAllOperationNodesWithin(parentId && !containsIdTag(parentId) ? parentId : '');
const upstreamNodes = useMemo(() => new Set([...upstreamNodesOfChild, ...immediateAncestor]), [immediateAncestor, upstreamNodesOfChild]);
const upstreamNodesDependencies = useNodesTokenDependencies(upstreamNodes);
const upstreamScopeArr = useAllGraphParents(graphId);
const upstreamScopes = useMemo(() => new Set(upstreamScopeArr), [upstreamScopeArr]);
useOnViewportChange({
Expand Down Expand Up @@ -210,12 +208,6 @@ export const DropZone: React.FC<DropZoneProps> = ({ graphId, parentId, childId,
return false;
}
}

for (const node of upstreamNodes) {
if (upstreamNodesDependencies[node].has(item.id) || upstreamNodesDependencies[item.id].has(node)) {
return false;
}
}
// TODO: Support preventing moving a node below downstream output
// TODO: Support calculating dependencies when dragging of scopes
return item.id !== childId && item.id !== parentId;
Expand All @@ -225,7 +217,7 @@ export const DropZone: React.FC<DropZoneProps> = ({ graphId, parentId, childId,
canDrop: monitor.isOver() && monitor.canDrop(), // Only calculate canDrop when isOver is true
}),
}),
[graphId, parentId, childId, upstreamNodes, upstreamNodesDependencies]
[graphId, parentId, childId, upstreamNodes]
);

const parentName = useNodeDisplayName(parentId);
Expand Down

0 comments on commit 5011fdb

Please sign in to comment.