Skip to content
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

fix: Add Helper for Field Processing & Update Code Validation Logic #4429

Merged
merged 7 commits into from
Nov 7, 2024

Conversation

Cristhianzl
Copy link
Collaborator

This pull request introduces several changes to enhance the functionality of the GenericNode component in the frontend. The most notable changes include the addition of a new helper function to process node fields, updates to the code validation logic, and the inclusion of new imports to support these functionalities.

Enhancements to GenericNode functionality:

  • New Helper Function:

    • Added processNodeAdvancedFields in src/frontend/src/CustomNodes/helpers/process-node-advanced-fields.ts to handle advanced field processing for nodes. This function filters edges and updates node templates accordingly.
  • Code Validation Updates:

    • Modified the onSuccess callback in GenericNode to use processNodeAdvancedFields for processing node fields before updating the node code.

Additional Imports:

  • Imports in GenericNode:
    • Added cloneDeep from lodash to deep clone objects.
    • Imported processNodeAdvancedFields from the new helper file.
    • Added edges state from useFlowStore to access current edges in the flow.

…dash library

📝 (GenericNode/index.tsx): Add import statement for processNodeAdvancedFields helper function
📝 (GenericNode/index.tsx): Add edges variable to store edges state using useFlowStore hook
📝 (GenericNode/index.tsx): Modify onSuccess callback to process and update node data with advanced fields using processNodeAdvancedFields helper function
…vanced fields of a node based on edges in a graph for better customization and control.
@Cristhianzl Cristhianzl self-assigned this Nov 6, 2024
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Nov 6, 2024
…dash to clean up the code and improve maintainability.
@github-actions github-actions bot added bug Something isn't working and removed enhancement New feature or request labels Nov 6, 2024
…onent for tooltip styling and add support for accent colors

📝 (NodeStatus/index.tsx): Update border and text color classes to use accent colors for better visual consistency
📝 (handleRenderComponent/index.tsx): Refactor code to use accent colors for handle styling and tooltip components
📝 (index.tsx): Remove unused imports and refactor code to use accent colors for border beams and build status styling

📝 (get-class-from-build-status.ts): Update CSS class based on build status for better visual representation
📝 (index.tsx, sidebarFilterComponent/index.tsx, nodeToolbarComponent/index.tsx): Update CSS variable names for consistency and clarity
📝 (index.tsx): Refactor code to use ReactFlow hooks for better maintainability and readability
📝 (applies.css): Refactor CSS classes for consistency and improved styling

📝 (index.css): Update color variables names from inner- to accent- for better clarity and consistency in the codebase.

📝 (tailwind.config.mjs): refactor color classes from "inner-" to "accent-" for better clarity and consistency
📝 (tailwind.config.mjs): add new "node-ring" color class to the tailwind config
📝 (freeze-path.spec.ts): update test to click on "freeze-path-button" instead of "icon-FreezeAll" for better test coverage and accuracy
… relevantEdges for clarity and consistency

🐛 (process-node-advanced-fields.ts): fix condition to check relevantEdges length instead of edgesWithNode length for correct logic
Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 7, 2024
Copy link
Contributor

@anovazzi1 anovazzi1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Cristhianzl Cristhianzl enabled auto-merge (squash) November 7, 2024 13:38
@Cristhianzl Cristhianzl merged commit ada5f17 into main Nov 7, 2024
20 of 21 checks passed
@Cristhianzl Cristhianzl deleted the cz/fix-handles-on-update branch November 7, 2024 13:41
joaoguilhermeS pushed a commit that referenced this pull request Nov 7, 2024
…4429)

* 📝 (GenericNode/index.tsx): Add import statement for cloneDeep from lodash library
📝 (GenericNode/index.tsx): Add import statement for processNodeAdvancedFields helper function
📝 (GenericNode/index.tsx): Add edges variable to store edges state using useFlowStore hook
📝 (GenericNode/index.tsx): Modify onSuccess callback to process and update node data with advanced fields using processNodeAdvancedFields helper function

* ✨ (process-node-advanced-fields.ts): add a new function to process advanced fields of a node based on edges in a graph for better customization and control.

* ♻️ (GenericNode/index.tsx): Remove unused import of cloneDeep from lodash to clean up the code and improve maintainability.

* 🔧 (process-node-advanced-fields.ts): rename variable edgesWithNode to relevantEdges for clarity and consistency
🐛 (process-node-advanced-fields.ts): fix condition to check relevantEdges length instead of edgesWithNode length for correct logic

---------

Co-authored-by: anovazzi1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants