GeezerVison is showing github.com — refactor!: move properties of `utils` to `guiUtils` by tbouffard · Pull Request #741 · maxGraph/maxGraph
Conversation
tbouffard
commented
Mar 31, 2025
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Use a namespace that better matches what the properties deal with.
BREAKING CHANGES: The utils namespace has been removed. The remaining properties associated to this namespace have been moved to the guiUtils namespace.
Summary by CodeRabbit
-
New Features
- Introduced enhanced configuration settings for improved error dialog presentation.
- Added a new
guiUtils namespace with specific functions and properties for better organization.
-
Refactor
- Reorganized internal utility components for a cleaner structure and streamlined access.
- Removed the outdated
utils namespace, consolidating functionality under guiUtils and printUtils.
-
Documentation
- Updated migration instructions with clearer, type-safe examples to simplify the transition for developers.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Use a namespace that better matches what the properties deal with.
BREAKING CHANGES: The `utils` namespace has been removed. The remaining properties associated to this namespace have been moved to the `guiUtils` namespace.
coderabbitai
Bot
commented
Mar 31, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Walkthrough
The pull request restructures the codebase by removing the legacy utils namespace and relocating its properties into the guiUtils namespace. A new configuration object, GuiConfig, is introduced to manage GUI error settings. Additionally, associated export statements and documentation have been updated to reflect these changes, impacting both the source code and migration guides.
Changes
| File(s) |
Change Summary |
CHANGELOG.md, packages/core/src/index.ts, packages/core/src/util/Utils.ts |
Removed the utils namespace and its export; utility properties are now accessed via guiUtils. The Utils.ts file containing the singleton utils object was deleted. |
packages/core/src/gui/guiUtils.ts |
Updated error handling to use a new GuiConfig object for error resources and configuration; removed dependency on the obsolete utils import. |
packages/core/src/i18n/config.ts, packages/website/docs/usage/migrate-from-mxgraph.md |
Updated documentation and resource link references, switching from utils to GuiConfig, and refined migration instructions to reflect the namespace changes and TypeScript generic usage. |
packages/html/stories/OrgChart.stories.js |
Updated import statements to remove utils and include printUtils; modified functionality to utilize printUtils for page count and scale calculations. |
Sequence Diagram(s)
sequenceDiagram
participant Client
participant GUI_Utils as guiUtils
participant Config as GuiConfig
Client->>GUI_Utils: Trigger error handling
GUI_Utils->>Config: Retrieve error configuration
Config-->>GUI_Utils: Return errorImage, errorResource, closeResource
GUI_Utils-->>Client: Display error dialog using configured resources
Loading
Possibly related PRs
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 16a5ebc and b1c4af9.
📒 Files selected for processing (1)
packages/html/stories/OrgChart.stories.js (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build (windows-2022)
🔇 Additional comments (4)
packages/html/stories/OrgChart.stories.js (4)
33-33: Import statement update aligns with namespace refactoring
The import statement has been updated to include printUtils instead of utils, which is in line with the PR objective of moving properties from the utils namespace to more specific namespaces.
254-257: Function namespace migration correctly implemented
The code now uses the global prompt function directly instead of utils.prompt, and the scale calculation now uses printUtils.getScaleForPageCount instead of utils.getScaleForPageCount. This maintains the same functionality while following the namespace reorganization.
303-306: Function namespace migration consistently applied
The same changes made in the toolbar implementation are also correctly applied in the popup menu implementation, ensuring consistency throughout the codebase.
33-306:
Details
✅ Verification successful
Verify any additional utils references in this file
The changes look good, but it's important to verify that all utils references have been migrated to the appropriate namespaces.
🏁 Script executed:
#!/bin/bash
# Check if there are any remaining 'utils' references in this file
rg "utils\." "packages/html/stories/OrgChart.stories.js"
# Also check for other potential references in nearby files
rg "utils\." "packages/html/stories/" --type js
Length of output: 501
OrgChart.stories.js: Clean Migration of "utils" References
The verification confirms that there are no remaining occurrences of utils. in the OrgChart file. All migrations in this file appear complete. However, note that additional utils references were found in other story files (e.g., FixedPoints.stories.js and PortRefs.stories.js). Please verify if those references also require migration to maintain consistency across the codebase.
🧰 Tools
🪛 ESLint
[error] 249-249: 'PrintPreview' is not defined.
(no-undef)
[error] 258-258: 'PrintPreview' is not defined.
(no-undef)
[error] 298-298: 'PrintPreview' is not defined.
(no-undef)
✨ Finishing Touches
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.
Generate unit testing code for this file.
Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitai in a new review comment at the desired location with your query. Examples:
@coderabbitai generate unit testing code for this file.
@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
@coderabbitai read src/utils.ts and generate unit testing code.
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
@coderabbitai help me debug CodeRabbit configuration file.
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)
@coderabbitai pause to pause the reviews on a PR.
@coderabbitai resume to resume the paused reviews.
@coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
@coderabbitai full review to do a full review from scratch and review all the files again.
@coderabbitai summary to regenerate the summary of the PR.
@coderabbitai generate docstrings to generate docstrings for this PR.
@coderabbitai resolve resolve all the CodeRabbit review comments.
@coderabbitai plan to trigger planning for file edits and PR creation.
@coderabbitai configuration to show the current CodeRabbit configuration for the repository.
@coderabbitai help to get help.
Other keywords and placeholders
- Add
@coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
- Add
@coderabbitai summary to generate the high-level summary at a specific location in the PR description.
- Add
@coderabbitai anywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yaml file to the root of your repository.
- Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|