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

Refactor modular pipeline expansions to instantly update UI #2225

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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 @@ -7,7 +7,6 @@ import {
toggleTextLabels,
toggleExpandAllPipelines,
} from '../../actions';
import { loadInitialPipelineData } from '../../actions/pipelines';
import IconButton from '../ui/icon-button';
import LabelIcon from '../icons/label';
import ExportIcon from '../icons/export';
Expand Down Expand Up @@ -126,7 +125,6 @@ export const mapDispatchToProps = (dispatch) => ({
},
onToggleExpandAllPipelines: (isExpanded) => {
dispatch(toggleExpandAllPipelines(isExpanded));
dispatch(loadInitialPipelineData());
},
});

Expand Down
20 changes: 13 additions & 7 deletions src/selectors/disabled.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const getNodeLayer = (state) => state.node.layer;
const getNodeModularPipelines = (state) => state.node.modularPipelines;
const getVisibleSidebarNodes = (state) => state.modularPipeline.visible;
const getSliceApply = (state) => state.slice.apply;
const getExpandAllPipelines = (state) => state.expandAllPipelines;

/**
* Return all inputs and outputs of currently visible modular pipelines
Expand Down Expand Up @@ -150,6 +151,7 @@ export const getNodeDisabled = createSelector(
getDisabledModularPipeline,
getSlicedPipeline,
getSliceApply,
getExpandAllPipelines,
],
(
nodeIDs,
Expand All @@ -163,19 +165,23 @@ export const getNodeDisabled = createSelector(
visibleModularPipelineInputsOutputs,
disabledModularPipeline,
slicedPipeline,
isSliceApplied
isSliceApplied,
expandAllPipelines
) =>
arrayToObject(nodeIDs, (id) => {
let isDisabledViaSlicedPipeline = false;
if (isSliceApplied && slicedPipeline.length > 0) {
isDisabledViaSlicedPipeline = !slicedPipeline.includes(id);
}

const isDisabledViaSidebar =
!visibleSidebarNodes[id] &&
!visibleModularPipelineInputsOutputs.has(id);

const isDisabledViaModularPipeline = nodesDisabledViaModularPipeline[id];
let isDisabledViaSidebar = false;
let isDisabledViaModularPipeline = false;
if (!expandAllPipelines) {
isDisabledViaSidebar =
!visibleSidebarNodes[id] &&
!visibleModularPipelineInputsOutputs.has(id);

isDisabledViaModularPipeline = nodesDisabledViaModularPipeline[id];
}

return [
nodeDisabledNode[id],
Expand Down
Loading