-
Notifications
You must be signed in to change notification settings - Fork 11
Refactor/datasets content #437
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
Creylay
wants to merge
15
commits into
develop
Choose a base branch
from
refactor/datasets-content
base: develop
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
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
…ataset management
… state management
…aset management and job polling
…dataset and notebook management
… notebook management
…s directory and remove unused hooks for improved code structure and maintainability
…ed LeftPanel, CenterPanel, and RightPanel components for improved UI structure and maintainability
…tructure, moving SideBar and CenterBox to panelContainers, and implement DatasetsCenterContent for improved layout management and maintainability
…rect path for improved module organization
…oning in DatasetsContent
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
This PR refactors the
DatasetsContent.jsxmodule, which had grown in complexity by mixing business logic, state management, and UI rendering in a single file. The refactor aims to improve code readability, maintainability, and scalability by separating concerns, extracting reusable and specific components, and preparing the codebase for future extensions and performance improvements.Type of Change
Check all that apply like this [x]:
Changes (by file)
src/pages/datasets/DatasetsContent.jsx: Refactored to delegate business logic and UI state to specialized hooks, and to use new reusable layout components for a three-panel structure. Central render logic is now encapsulated in a dedicated subcomponent.src/components/threeSectionLayout/panels/LeftPanel.jsx: Reusable left sidebar panel with show/hide and resize logic, using context for state.src/components/threeSectionLayout/panels/RightPanel.jsx: Fully generic right sidebar panel, with customizable toggle button position via thetoggleButtonTopprop, and context-driven state.src/components/threeSectionLayout/panels/CenterPanel.jsx: Central panel that dynamically adjusts its width based on the state of the side panels.src/components/notebooks/dataset/DatasetsCenterContent.jsx: New subcomponent that encapsulates all conditional rendering logic for the central panel, improving modularity and readability.src/hooks/datasets/useDatasets.js: Encapsulates all logic related to the Dataset entity (state, lifecycle, CRUD, polling, metadata enrichment).src/hooks/datasets/useNotebooks.js: Manages state and operations for the Notebook entity, including its relationship with datasets.src/hooks/datasets/useDatasetUIState.js: Maintains navigation and flow state for the module (step, selectedOption).src/hooks/datasets/useDatasetFlow.js: Handles complex business flows involving datasets, such as creating a dataset from a notebook.src/hooks/datasets/useDatasetActions.js: Defines user actions on datasets and notebooks from a UI interaction perspective.src/hooks/datasets/useNotebooksActions.js: Contains notebook-specific actions, such as creating notebooks from datasets and navigation after creation.src/hooks/datasets/useLayoutActions.js: Centralizes high-level actions that coordinate navigation, UI state, and UX side-effects.src/hooks/useThreePanelsLayout.js: Manages the three-panel layout behavior (visibility, sizing, resizing, transitions).Testing (optional)
Notes (optional)
1) Datasets Module Hook Architecture
The Datasets module is now structured using multiple specialized hooks, each with a clearly defined responsibility. This reduces coupling, improves maintainability, and allows each part of the system to evolve independently.
2) Three Panel Layout Components
Reusable components were introduced to encapsulate the logic and presentation of a three-section layout (left, center, right):
toggleButtonTopprop).All panels use context to manage visibility, sizing, and user interaction events, and render their content via
children.3) Central Content Encapsulation
A new subcomponent, DatasetsCenterContent, was implemented to encapsulate and centralize the conditional rendering logic for the central panel of the datasets module. This improves readability, maintainability, and keeps the main file clean and modular.