feat: migrate account management features from Angular to React#23
feat: migrate account management features from Angular to React#23devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Add AccountManagement page with account list grid, edit/create form, user assignment, and users grid - Add Header component with Trade/Account navigation tabs - Add react-router-dom routing between Trade and Account pages - Port Angular account service API calls (CRUD accounts, account users, people search) - Maintain feature parity with Angular frontend account management Co-Authored-By: Lukas Burger <lukas.burger@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| const handleUpdate = useCallback( | ||
| (account: AccountData) => { | ||
| fetchAccounts(); | ||
| fetchAccountUsers(); | ||
| if (account?.id) { | ||
| setSelectedAccount(account); | ||
| } | ||
| }, | ||
| [fetchAccounts, fetchAccountUsers] | ||
| ); |
There was a problem hiding this comment.
🟡 EditAccount form stuck in 'update mode' after successful save because accountToBeUpdate is never cleared
accountToBeUpdate is set when the user clicks an "Update" button in the grid (AccountManagement.tsx:43), and is passed as the account prop to EditAccount (AccountManagement.tsx:117). After a successful save, EditAccount.handleAdd calls onUpdate(savedAccount) then handleReset() which clears displayName to ''. However, the parent's handleUpdate (AccountManagement.tsx:90-99) never calls setAccountToBeUpdate(undefined), so the form permanently remains in update mode: the button label stays "Update Account" (line 81: {account ? 'Update' : 'Add'} Account) and any subsequent submission spreads the stale old account data into the payload (line 34-35: { ...account, displayName }). The user sees an empty text field but is unknowingly updating the same account instead of creating a new one.
| const handleUpdate = useCallback( | |
| (account: AccountData) => { | |
| fetchAccounts(); | |
| fetchAccountUsers(); | |
| if (account?.id) { | |
| setSelectedAccount(account); | |
| } | |
| }, | |
| [fetchAccounts, fetchAccountUsers] | |
| ); | |
| const handleUpdate = useCallback( | |
| (account: AccountData) => { | |
| fetchAccounts(); | |
| fetchAccountUsers(); | |
| setAccountToBeUpdate(undefined); | |
| if (account?.id) { | |
| setSelectedAccount(account); | |
| } | |
| }, | |
| [fetchAccounts, fetchAccountUsers] | |
| ); |
Was this helpful? React with 👍 or 👎 to provide feedback.
| useEffect(() => { | ||
| if (account?.displayName) { | ||
| setDisplayName(account.displayName); | ||
| } | ||
| }, [account]); |
There was a problem hiding this comment.
🟡 EditAccount useEffect doesn't clear displayName when account prop becomes undefined
The useEffect at EditAccount.tsx:20-24 only sets displayName when account?.displayName is truthy. If the parent clears the account prop to undefined (e.g., after BUG-0001 is fixed by calling setAccountToBeUpdate(undefined)), the displayName state will retain the previous account's name instead of being cleared. This means the form would show the old name but the button would correctly switch to "Add Account", causing the user to accidentally create a new account with the old name.
| useEffect(() => { | |
| if (account?.displayName) { | |
| setDisplayName(account.displayName); | |
| } | |
| }, [account]); | |
| useEffect(() => { | |
| if (account?.displayName) { | |
| setDisplayName(account.displayName); | |
| } else { | |
| setDisplayName(''); | |
| } | |
| }, [account]); |
Was this helpful? React with 👍 or 👎 to provide feedback.
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
1 similar comment
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
feat: migrate account management from Angular to React frontend
Summary
Ports the account management features from the Angular GUI (
web-front-end/angular) to the React GUI (web-front-end/react), achieving feature parity for account CRUD and user assignment.New components:
AccountManagement— main page with two ag-grid tables (accounts list + users list for selected account), an inline create/update account form, and a user-to-account assignment form with autocomplete people searchEditAccount— create or update an account viaPOST /account/AssignUser— search people via/People/GetMatchingPeople, select an account, and assign viaPOST /accountuser/Header— navigation bar with Trade / Account tabsRouting changes (
react-router-domv7 added):/trade→ existingDatatable(trade blotter)/account→ newAccountManagement/redirects to/tradeBrowserRouterwraps the app inindex.tsxLocal Testing
Ran
docker-compose upand started the React dev server on port 18094. Both pages render and the Account list grid successfully loads accounts from the backend.Trade page (

/trade):Account page (

/account):Review & Testing Checklist for Human
POST /account/(create & update) andPOST /accountuser/(assign user) to confirm they succeed and the grids refresh correctly.AssignUsertriesdata.people || data || []— the Angular service specifically reads.people. Confirm which shape the backend returns and whether this fallback is correct.EditAccountPOST response handling: After creating/updating an account, the code parses the response body as JSON and passes it toonUpdate. The Angular version does not rely on the response body — confirm the backend actually returns a fullAccountobject fromPOST /account/.@types/react-router-dom@5.3.3addition:react-router-domv7 ships its own TypeScript types, so this separate@typespackage may be redundant or conflict. Consider removing it.Suggested test plan:
/account, verify the account list grid loadsNotes
CreateAccountandCreateAccountUsermodal buttons on the Trade page (Datatable) are untouched — account creation is now available from two places.accountColumnDefsanduserColumnDefsinAccountManagement.tsxare re-created on every render; could be memoized for performance if ag-grid re-render becomes noticeable.package.jsondevDependencies were reordered alphabetically by npm — this is cosmetic.AccountsDropdown.tsxandCreateAccountUser.tsxwere not modified.Requested by: @lburgers
Link to Devin run