-
Notifications
You must be signed in to change notification settings - Fork 445
Modernize frontend component s and reduce codes #749
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
Draft
dodo920306
wants to merge
84
commits into
hyperledger-cello:main
Choose a base branch
from
dodo920306:refactor/frontend-components
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Modernize frontend component s and reduce codes #749
dodo920306
wants to merge
84
commits into
hyperledger-cello:main
from
dodo920306:refactor/frontend-components
+6,287
−18,050
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: KIRIN.CHU 朱祐麟 <[email protected]> Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Move inside api engine. Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
All dockerfiles should be directly placed inside with their codes. By this way, it reduces the effort to pay attention to connect them with their true codebase and context. Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Since the login page doesn't include the `GlobalHeader`, the icon of the language selection doesn't include the padding like pages after login. Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
The peers dropdown in the chaincode form should be labelled as "peers" directly instead of "Please select peers" which should be the warning message. Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
The directory contains organizational MSPs should be ignored by Git. Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
Signed-off-by: dodo920306 <[email protected]>
To block duplicate package IDs, chaincodes package IDs will be set when they're created. Signed-off-by: dodo920306 <[email protected]>
- Add src/utils/serviceFactory.js with reusable utilities: - createCrudService(): generates standard CRUD methods for REST resources - customRequest(): wrapper for non-standard API endpoints - formDataRequest(): helper for file uploads - blobRequest(): helper for file downloads - Refactor all service files to use the new factory: - agent.js: use createCrudService, remove duplicate applyAgent/createAgent - network.js: use createCrudService - node.js: use createCrudService + custom helpers - organization.js: use createCrudService, fix getOrganization URL path - channel.js: use createCrudService - chaincode.js: use customRequest + formDataRequest - user.js: use createCrudService This reduces ~87 lines of duplicate code and provides: - Consistent API call patterns across all services - Centralized extension point for future enhancements - Better code readability and maintainability --- Generated-by: AI (Claude, Anthropic) Note: All changes in this commit were generated by AI assistant. Signed-off-by: dodo920306 <[email protected]>
- Add src/utils/modelFactory.js with reusable utilities: - createModel(): generates complete dva model with auto reducers - createListEffect(): handles paginated list with consistent logic - createSimpleEffect(): generates simple call-and-callback effects - commonReducers: shared save reducer - createClearReducer(): generates reset reducer from initial state - Refactor all model files to use the new factory: - agent.js: 127 -> 56 lines - network.js: 75 -> 28 lines - node.js: 140 -> 54 lines - organization.js: 97 -> 38 lines - channel.js: 73 -> 37 lines - chaincode.js: 90 -> 48 lines This reduces ~176 lines of duplicate code and provides: - Consistent pagination handling across all models - Auto-generated save/clear reducers - Flexible customization for edge cases --- Generated-by: AI (Claude, Anthropic) Signed-off-by: dodo920306 <[email protected]>
- Add src/hooks/ directory with custom React hooks: - useTableManagement: handles selected rows, pagination, filters - useModalForm: handles modal visibility, create/update modes - useDeleteConfirm: handles delete confirmation dialog with i18n These hooks can reduce ~50 lines of boilerplate code per page when migrating from Class Components to Function Components. --- Generated-by: AI (Claude, Anthropic) Signed-off-by: dodo920306 <[email protected]>
New models generated by the factory now will fail to be loaded since they're not static. Thus, they will be forced to be loaded after the DVA app is ready. Signed-off-by: dodo920306 <[email protected]>
With the introduction of Hooks in React 16.8, function components have become the preferred way to write React components. They are simpler, more readable, and provide more powerful patterns for managing state and side effects compared to class components. Signed-off-by: dodo920306 <[email protected]>
With the introduction of Hooks in React 16.8, function components have become the preferred way to write React components. They are simpler, more readable, and provide more powerful patterns for managing state and side effects compared to class components. Signed-off-by: dodo920306 <[email protected]>
Network is deprecated. Signed-off-by: dodo920306 <[email protected]>
Network is deprecated. Signed-off-by: dodo920306 <[email protected]>
Contributor
Author
|
This is draft only because #748 hasn't been merged yet. |
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Modernize frontend code architecture by introducing Factory Pattern and converting Class Components to Functional Components.
Changes
New Utilities
serviceFactory.js: Provides reusable CRUD operations
createCrudService(): Generates standard CRUD methodscustomRequest(): Wrapper for non-standard API endpointsformDataRequest(): File upload helperblobRequest(): File download helpermodelFactory.js: Provides reusable dva model logic
createModel(): Generates complete dva modelcreateListEffect(): Handles paginated listscreateSimpleEffect(): Generates simple effectscommonReducers: Shared reducershooks/: New reusable React Hooks
useTableManagement: Table managementuseModalForm: Modal form handlinguseDeleteConfirm: Delete confirmation dialogComponent Refactoring
Remove Network Feature
src/pages/Network/)Code Reduction
Benefits
Breaking Changes
Dependencies