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

fix(designer): Revert "Prevent parent node from being dragged below dependent node (#4973)" #5037

Merged
merged 1 commit into from
Jun 27, 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 @@ -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
Loading