-
Notifications
You must be signed in to change notification settings - Fork 199
feat: introduce global config for the Entity Relation connector #620
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
feat: introduce global config for the Entity Relation connector #620
Conversation
Previously, it was not possible to update the “segment” default value globally. This is now possible, as is resetting the value to the maxGraph default.
WalkthroughThis pull request introduces a new configuration mechanism for Entity Relation connectors in the maxGraph library. The changes include creating a new Changes
Possibly related PRs
Suggested labels
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
packages/html/.storybook/preview.ts (1)
6-6: Use consistent naming for import statements.
While this import is valid, ensure that naming and ordering align with the rest of your styling for consistency and readability.packages/core/src/view/style/config.ts (1)
17-33: Consider using a type definition forEntityRelationConnectorConfig.
Defining an explicit interface could improve TypeScript IntelliSense and prevent accidental property name changes.-export const EntityRelationConnectorConfig = { +interface EntityRelationConnectorConfigType { + segment: number; +} + +export const EntityRelationConnectorConfig: EntityRelationConnectorConfigType = { segment: ENTITY_SEGMENT, };packages/html/stories/Folding.stories.ts (1)
21-21: Ensure consistent grouping of imports.
EntityRelationConnectorConfigis an experimental feature. Consider grouping these imports under a commented remark to indicate their status.packages/website/docs/usage/global-configuration.md (1)
17-17: Fix markdown list indentation.The unordered lists have incorrect indentation. According to markdownlint, the indentation should be 0 instead of 2 spaces.
Apply this diff to fix the indentation:
- - `EntityRelationConnectorConfig` (since 0.15.0): for the `EntityRelation` Connector/EdgeStyle. +- `EntityRelationConnectorConfig` (since 0.15.0): for the `EntityRelation` Connector/EdgeStyle. - - `resetEntityRelationConnectorConfig` (since 0.15.0) +- `resetEntityRelationConnectorConfig` (since 0.15.0)Also applies to: 27-27
🧰 Tools
🪛 Markdownlint (0.37.0)
17-17: Expected: 0; Actual: 2
Unordered list indentation(MD007, ul-indent)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
packages/core/src/index.ts(1 hunks)packages/core/src/util/Constants.ts(1 hunks)packages/core/src/view/style/config.ts(1 hunks)packages/core/src/view/style/edge/EntityRelation.ts(2 hunks)packages/html/.storybook/preview.ts(2 hunks)packages/html/stories/Folding.stories.ts(2 hunks)packages/website/docs/usage/global-configuration.md(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/core/src/util/Constants.ts
🧰 Additional context used
🪛 Markdownlint (0.37.0)
packages/website/docs/usage/global-configuration.md
17-17: Expected: 0; Actual: 2
Unordered list indentation
(MD007, ul-indent)
27-27: Expected: 0; Actual: 2
Unordered list indentation
(MD007, ul-indent)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build (windows-2022)
- GitHub Check: build (ubuntu-22.04)
🔇 Additional comments (10)
packages/html/.storybook/preview.ts (1)
23-23: Validate reset order or potential side effects.
AddingresetEntityRelationConnectorConfigafterresetEdgeHandlerConfig()is fine, but verify there isn't a dependency on any prior reset calls that might alter the default connector state.packages/core/src/view/style/config.ts (2)
1-15: License header compliance confirmed.
The file appropriately includes the Apache License header, adhering to open-source standards.
35-45: Sufficient documentation for reset function.
The reset execution path is straightforward and documented. Ensure to keep it in sync if new fields are added toEntityRelationConnectorConfig.packages/core/src/view/style/edge/EntityRelation.ts (3)
22-22: Confirm usage ofDIRECTION_MASK.
Although no issues are apparent here, verify that it is necessary for your logic. Otherwise, consider importing only what you use.
25-25: Good use of the configuration object.
This import aligns with the new global config changes.
35-36: Nullable style check is correct.
Usingstate.style?.segmentis a best practice to avoid runtime errors ifstyleis undefined.packages/html/stories/Folding.stories.ts (1)
49-49: Globally modifying the config at story level.
AlteringEntityRelationConnectorConfig.segmentwithin a Story might carry over to subsequent stories if not reset. Validate or call a reset function as a cleanup step.packages/website/docs/usage/global-configuration.md (2)
17-17: LGTM! Documentation clearly describes the new configuration.The addition of
EntityRelationConnectorConfigis well-documented and properly versioned.🧰 Tools
🪛 Markdownlint (0.37.0)
17-17: Expected: 0; Actual: 2
Unordered list indentation(MD007, ul-indent)
27-27: LGTM! Reset function properly documented.The addition of
resetEntityRelationConnectorConfigcomplements the configuration object.🧰 Tools
🪛 Markdownlint (0.37.0)
27-27: Expected: 0; Actual: 2
Unordered list indentation(MD007, ul-indent)
packages/core/src/index.ts (1)
162-162: LGTM! Export statement correctly placed.The new export for style configuration is well-placed among other style-related exports and follows the established pattern.
Previously, it was not possible to update the “segment” default value globally.
This is now possible, as is resetting the value to the maxGraph default.
Notes
Covers #192
Summary by CodeRabbit
New Features
EntityRelationConnectorConfigfor customizing Entity Relation connector stylesresetEntityRelationConnectorConfigfunction to reset connector configurationDocumentation
Refactor