langflow icon indicating copy to clipboard operation
langflow copied to clipboard

refactor: parameter component, edit node modal and api modal

Open lucaseduoli opened this issue 7 months ago • 2 comments

This pull request includes various code refactorings and bug fixes. It improves the overall code structure and resolves several issues. Some of the changes include:

  • Refactoring column definitions to receive handleOnNewValue and use it to change the Advanced variable

  • Exporting function isTargetHandleConnected

  • Refactoring types of setNodeClass

  • Exporting type of handleOnNewValue

  • Refactoring useHandleNodeClass to only handle changes to node data

  • Refactoring toggleCellRender to handle advanced values by itself with the handleOnNewValue

  • Changing setNodeClass types and disabling hook

  • Changing handleNodeClass on parametercomponent

  • Changing handleNodeClass on the two components that used it

  • Updating handleNodeClass to accept newNodeClass and type only

  • Refactoring EditNodeModal component to use new handleNodeClass and columnDefs

  • Changing columnDefs to receive new handleNodeClass and not receive useless parameters

  • Changing cellTypeStr to strRender

  • Refactoring inputFileComponent to use the new handleOnNewValue

  • Refactoring keypairList to convert values on the fly

  • Adding parameterRenderComponent that renders all parameters in one place

  • Exporting parameterRenderComponent

  • Changing tableNodeCellRender to use ParameterRenderComponent

  • Changing parameterredercomponent to receive name

  • Changing strrendercomponent to receive name

  • Changing nodecellrender to pass name and to check if value is undefined before assigning on templateData

  • Refactoring use-handle-new-value to handle undefined values in changes

  • Using ParameterRenderComponent at parameterComponent

  • Refactoring parameterRenderComponent to include refresh button

  • Creating refresh parameter component

  • Adding nodeId to parameterrendercomponent call

  • Removing unused variable

  • Refactoring refreshButton

  • Fixing parameters not showing when they don't have a value

  • Creating a tweakComponent that renders the tweak individually, with the same table as the EditNode

  • Creating tweaks component, that renders all tweaks

  • Changing tableNodeCellRender to pass setNode as well

  • Changing handleOnNewValue to use custom setNode if specified

  • Adding editNodeComponent that handles the table and rowData and columnDefs

  • Changing editNodeModal to use editNodeComponent instead of table

  • Changing columndefs type to handle setNode and hideVisibility optional parameters

  • Changing useRowData to not use myData, and just use nodeClass

  • Changing codeTabsPropsType tweaks property to include only the necessary

  • Changing codeTabsComponent to use TweaksComponent and handle an internal nodes state

  • Changing apiModal to handle the tweaks built by finding the differences between old and current node

  • Fixing bug on API modal that refreshes tweaks table all the time

  • Creating new tweaks store type

  • Adding tweaks store with all of the logic needed to get the tweaks on the API page

  • Refactoring TweakComponent to hold a temporary state to prevent the table from rerendering

  • Adding TweakComponent into TweaksComponent

  • Removing external state on tableAdvancedToggle, making every state come from the Stores

  • Removing external state from TableNodeCellRender and adding isTweaks to choose which store to use

  • Adding SetNode type on HandleOnNewValue

  • Adding custom setNode to handleNodeClass

  • Removing unused logic from apiModal

  • Removing unused old code

  • Changing type of getChangesTypes

  • Transforming string into object on get codes

  • Changing getNodesWithDefaultValue to return nodes that will appear on Tweaks, as well as just the allowed parameters

  • Adding hasTweaks to tabs

  • Adding check of template keys to update the local nodeClass state, allowing the table to be updated just when the number of parameters changes

  • Passing isTweaks to columnDefs

  • Removing unused state and passing isTweaks to value getters

  • Removing unused state

  • Updating tabsArrayType with hasTweaks and removing unused types

  • Adding local nodes tweaks state to the codetabscomponent and refactoring conditions of display

  • Removing unused console.log

  • Changing advanced toggle to use parameterid given by the value

  • Changing nodecellrender to use parameter id given by the value

  • Passing parameter id by value to the renderers

  • Removing nodeClass from columnDefs definition

  • Fixing isTargetHandleConnected returning error if field is undefined

  • Fixing performance issues on edit node modal

  • Fixing scroll overflow issues on tweaksComponent

These changes improve the code structure, fix bugs, and enhance the overall performance and user experience.

lucaseduoli avatar Jul 24 '24 18:07 lucaseduoli