-
Notifications
You must be signed in to change notification settings - Fork 447
The Refactor #735
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
Open
dodo920306
wants to merge
84
commits into
hyperledger-cello:lab/kirin-refactor
Choose a base branch
from
dodo920306:task/the-refactoring
base: lab/kirin-refactor
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.
Open
The Refactor #735
dodo920306
wants to merge
84
commits into
hyperledger-cello:lab/kirin-refactor
from
dodo920306:task/the-refactoring
+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
b2553e7 to
4a3123e
Compare
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]>
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]>
Contributor
|
@YoungHypo suggest we create a new branch for this refactor work. |
Contributor
Author
I just realized that I myself can also create a new branch in this repo. Therefore, I created a new branch called Feel free to suggest another branch name. |
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]>
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.
Let's face it: the current state of this project’s code is not so good.
Contributions over time have lacked consistency, leading to duplicated implementations and a fragmented structure that makes maintenance and development difficult.
The combination of Python, Django, and object-oriented design has introduced unnecessary complexity, and without long-term technical stewardship, the project has become hard to extend.
Another pressing issue is the number of long-standing bugs. For a project that has been in existence for over six years, there remain issues that ideally should have been addressed very early on. Many of these are not superficial problems that tools or automated testing could easily detect, but deeper logical flaws that only become evident when the affected code paths are used.
Additionally, it seems that the project has not fully embraced the design principles of Django REST Framework (DRF). For example, serializers are often used only for traffic handling, while much of the core business logic resides in views.py, which goes against DRF’s intended design practices.
To summary, a refactor is inevitable, and to make sure I’m not just another person who criticizes without acting, I’ll do it myself.