Skip to content

Commit

Permalink
set default local target/source (#1409)
Browse files Browse the repository at this point in the history
Co-authored-by: Margaret Harrigan <[email protected]>
  • Loading branch information
mharrigan26 and mharrigan26 committed Sep 2, 2023
1 parent 0e8c222 commit 6163b5d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/addons/replication/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ const updateFormField = (state, fieldName, value) => {
}
}

// Set default local source/target database to the first in the list (to match the default dropdown display)
if (fieldName === validFieldMap.replicationSource) {
const isLocalDB = updateState[validFieldMap.replicationSource] === Constants.REPLICATION_SOURCE.LOCAL;
if (isLocalDB && updateState.databases.length > 0) {
updateState[validFieldMap.localSource] = updateState.databases[0];
}
}
if (fieldName === validFieldMap.replicationTarget) {
const isLocalDB = updateState[validFieldMap.replicationTarget] === Constants.REPLICATION_TARGET.EXISTING_LOCAL_DATABASE;
if (isLocalDB && updateState.databases.length > 0) {
updateState[validFieldMap.localTarget] = updateState.databases[0];
}
}

return updateState;
};

Expand Down

0 comments on commit 6163b5d

Please sign in to comment.