OpenHands
OpenHands copied to clipboard
refactor(frontend): settings and friends
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
initializeAgentto dedicated service folder- Modify function definition (
initializeAgent(settings: Settings): void)
- Modify function definition (
- Rebuild settings API
- Extend
<BaseModal/>to support disabling actions - Retire Redux settings slice
Improvements
- Everything modified has complementary tests (TDD except for
initializeAgent) Settingstype 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
This looks much cleaner! I'll wait for some FE folks to look but LGTM overall