OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

refactor(frontend): settings and friends

Open amanape opened this issue 1 year ago • 1 comments

Summary

This PR tests, rebuilds, and refactors code related to anything Settings so that it will be easier to work with in future updates. It also introduces a new feature of disabling modal actions.

Motivation

Extending settings proved to be a more annoying task than it should be (#1319) because of its current state. Responsibilities were mixed between functions, and some were outdated (settings Redux store).

Main Changes

  • Move API handlers to dedicated folder
  • Move initializeAgent to dedicated service folder
    • Modify function definition (initializeAgent(settings: Settings): void)
  • Rebuild settings API
  • Extend <BaseModal/> to support disabling actions
  • Retire Redux settings slice

Improvements

  • Everything modified has complementary tests (TDD except for initializeAgent)
  • Settings type is no longer a generic record type
  • Disable save button if no settings have been changed or if empty value
  • Separation of concerns/responsibilities
  • JSDoc on new/updated service functions
  • Settings is easier to read/extend

amanape avatar Apr 27 '24 10:04 amanape

This looks much cleaner! I'll wait for some FE folks to look but LGTM overall

rbren avatar Apr 27 '24 12:04 rbren