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 16 commits into
base: main
Choose a base branch
from

Conversation

SajidAlamQB
Copy link
Contributor

Description

This PR updates the logic for determining which nodes are visible when toggling expandAllPipelines. Previously, modular pipeline expansions were applied once during initial start, requiring data reloads to see changes. Now, the visibility logic is integrated directly into disabled.js, allowing the UI to reflect state changes immediately.

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expand/collapse doesn't work with the NodeList in the sidebar.

@SajidAlamQB
Copy link
Contributor Author

I noticed for the first time the toggle doesn't update the view instantly but subsequent presses do.

@rashidakanchwala
Copy link
Contributor

I noticed for the first time the toggle doesn't update the view instantly but subsequent presses do.

yeah i noticed that too.

@SajidAlamQB
Copy link
Contributor Author

I noticed for the first time the toggle doesn't update the view instantly but subsequent presses do.

Fixed the onToggleExpandPipelines was toggling wrong way around.

@SajidAlamQB SajidAlamQB requested a review from Huongg January 13, 2025 11:59
@rashidakanchwala rashidakanchwala self-requested a review January 17, 2025 10:36
@@ -7,7 +7,10 @@ import {
toggleTextLabels,
toggleExpandAllPipelines,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think you should add this actions/modular-pipelines as well, it's confusing why this is here. and the other expanded ones are in the other

@@ -7,7 +7,10 @@ import {
toggleTextLabels,
toggleExpandAllPipelines,
} from '../../actions';
import { loadInitialPipelineData } from '../../actions/pipelines';
import {
toggleModularPipelinesExpanded,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suppose we no longer need this action

Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left some minor comments. Around repeated code

@rashidakanchwala rashidakanchwala self-requested a review January 20, 2025 15:07
Copy link
Contributor

@Huongg Huongg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SajidAlamQB, thank you for the updates! I have two main comments:

  • Could we rename the reducers TOGGLE_EXPAND_ALL_PIPELINES and TOGGLE_ALL_MODULAR_PIPELINES_EXPANDED to better reflect their purpose?

  • Both TOGGLE_ALL_MODULAR_PIPELINES_EXPANDED and normalize share similar logic (I replicated the logic from normalize). Could this be moved to a helper function?

@@ -24,6 +27,7 @@ import { useGeneratePathname } from '../../utils/hooks/use-generate-pathname';
* @param {Boolean} textLabels Whether text labels are displayed
*/
export const FlowchartPrimaryToolbar = ({
modularPipelineIDs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need it anymore i think

onToggleExpandAllPipelines: (isExpanded) => {
dispatch(toggleExpandAllPipelines(isExpanded));
dispatch(loadInitialPipelineData());
dispatch(toggleAllModularPipelinesExpanded(isExpanded));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we decide to go with this refactor, I suggest renaming two reducers to improve clarity: TOGGLE_EXPAND_ALL_PIPELINES (which returns a boolean) and TOGGLE_ALL_MODULAR_PIPELINES_EXPANDED (which updates the state). Currently, their names are very similar, even though they do slightly different things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants