Skip to content

Commit

Permalink
xchem#66 activate first molecule group
Browse files Browse the repository at this point in the history
  • Loading branch information
tibor-postek-m2ms committed Mar 10, 2020
1 parent 92937ad commit 6f778b1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/components/nglView/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const toggleMoleculeGroup = (molGroupId, summaryViewStage, majorViewStage
if (objIdx === -1) {
dispatch(setMolGroupOn(molGroupId));
selectionCopy.push(molGroupId);
dispatch(setMolGroupSelection(selectionCopy, summaryViewStage));
dispatch(setMolGroupSelection(selectionCopy));
dispatch(
deleteObject(
{
Expand All @@ -37,7 +37,7 @@ export const toggleMoleculeGroup = (molGroupId, summaryViewStage, majorViewStage
);
} else {
selectionCopy.splice(objIdx, 1);
dispatch(setMolGroupSelection(selectionCopy, summaryViewStage));
dispatch(setMolGroupSelection(selectionCopy));
dispatch(
deleteObject(
{
Expand Down
23 changes: 22 additions & 1 deletion js/components/preview/moleculeGroups/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,28 @@ export const loadMoleculeGroups = ({ stage, setOldUrl, oldUrl, onCancel, isState
old_url: oldUrl,
afterPush: data_list => dispatch(saveMoleculeGroupsToNglView(data_list, stage, projectId)),
list_type,
setObjectList: mol_group_list => dispatch(setMolGroupList(mol_group_list)),
setObjectList: async mol_group_list => {
await dispatch(setMolGroupList(mol_group_list));
const currentMolGroup = state.apiReducers.mol_group_list[0];
if (currentMolGroup) {
const currMolGroupID = currentMolGroup.id;
dispatch(setMolGroupOn(currMolGroupID));
const currentMolGroupStringID = `${OBJECT_TYPE.MOLECULE_GROUP}_${currMolGroupID}`;
dispatch(setMolGroupSelection([currMolGroupID]));
dispatch(
deleteObject(
{
display_div: VIEWS.SUMMARY_VIEW,
name: currentMolGroupStringID
},
stage
)
);
dispatch(
loadObject(Object.assign({ display_div: VIEWS.SUMMARY_VIEW }, generateSphere(currentMolGroup, true)), stage)
);
}
},
cancel: onCancel
});
} else if (target_on && isStateLoaded) {
Expand Down

0 comments on commit 6f778b1

Please sign in to comment.