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

Flowchart Orientation #2251

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Flowchart Orientation #2251

wants to merge 10 commits into from

Conversation

rashidakanchwala
Copy link
Contributor

@rashidakanchwala rashidakanchwala commented Jan 28, 2025

Description

Resolves #2159

Development notes

For first PR review, pls QA it and look through the code. I will add dev notes when i am back from PTO

QA notes

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

Signed-off-by: rashidakanchwala <[email protected]>
@rashidakanchwala rashidakanchwala changed the base branch from new-flowchart-rtl to main January 28, 2025 11:49
Signed-off-by: rashidakanchwala <[email protected]>
Signed-off-by: rashidakanchwala <[email protected]>
Signed-off-by: rashidakanchwala <[email protected]>
Signed-off-by: rashidakanchwala <[email protected]>
Signed-off-by: rashidakanchwala <[email protected]>
Signed-off-by: rashidakanchwala <[email protected]>
Signed-off-by: rashidakanchwala <[email protected]>
Signed-off-by: rashidakanchwala <[email protected]>
@rashidakanchwala rashidakanchwala marked this pull request as ready for review February 5, 2025 17:12
Copy link
Member

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

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

I gave this a quick run using the demo project and looks like it works! 😄

Copy link
Contributor

@SajidAlamQB SajidAlamQB left a comment

Choose a reason for hiding this comment

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

Awesome work @rashidakanchwala, tested it manually and looks great!

ariaLabel="Change flowchart orientation"
className={'pipeline-menu-button--orientation'}
dataTest={'sidebar-flowchart-orientation-btn'}
icon={orientation === 'vertical' ? TopBottomIcon : LeftRightIcon}
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be opposite ? Like when vertical we show LeftRightIcon to change, similar to expand/collapse pipelines ?

? (node.width + 20) / -2
: -(node.width / 2) + 10
)
.attr('y', (node) => (orientation === 'vertical' ? -6 : -node.height + 12));
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it be possible to add some comments on these calculations for future ref ? Thank you

const { chartSize, layers, orientation } = this.props;

const layerNamePosition =
orientation === 'vertical' ? chartSize.sidebarWidth || 0 : 100 || 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it be possible to add some comments on these calculations for future ref ? Thank you

width: Math.max(end - start, 0),
height: rectSize,
};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for else I guess, you can just do return { ?

const rectSize = Math.max(width, height) * 5;

if (orientation === 'vertical') {
// Vertical layout when orientation is true
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Vertical layout when orientation is true
// Vertical layout when orientation is vertical

width: rectSize,
};
} else {
// Horizontal layout when orientation is false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Horizontal layout when orientation is false
// Horizontal layout when orientation is horizontal

@@ -33,12 +33,19 @@ export const snap = (value, unit) => Math.round(value / unit) * unit;
export const distance1d = (a, b) => Math.abs(a - b);

/**
* Returns the angle in radians between the points a and b relative to the X-axis about the origin
* Returns the angle in radians between the points a and b based on the given orientation
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a review comment but curious to know how did you find all the locations in the codebase which needed recalculation for the orientation ?

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.

Implementing Left-to-Right Orientation for Kedro-Viz
4 participants