Skip to content

Commit

Permalink
- partial fix for purple release for #1370
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms committed Mar 7, 2024
1 parent 3c9e696 commit 0b7ae4e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
9 changes: 7 additions & 2 deletions js/components/preview/molecule/observationCmpList.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
[classes.contColButtonHalfSelected]: false
})}
onClick={() => {
dispatch(selectAllHits(joinedMoleculeLists, setNextXMolecules, selectAllHitsPressed));
dispatch(selectAllHits(filteredLHSCompoundsList, setNextXMolecules, selectAllHitsPressed));
setSelectAllHitsPressed(!selectAllHitsPressed);
}}
disabled={false}
Expand Down Expand Up @@ -1214,7 +1214,12 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
>
{filteredLHSCompoundsList.map((data, index, array) => {
const molsForCmp = data.associatedObs;
const selected = allSelectedMolecules.some(molecule => molecule.cmpd === data.origId);
// const selected = allSelectedMolecules.some(
// molecule => molecule.cmpd === data.origId && molecule.canon_site_conf === data.canonSiteConf
// );
const selected = allSelectedMolecules.some(molecule =>
data.associatedObs.some(obs => obs.id === molecule.id)
);

return (
<ObservationCmpView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1184,9 +1184,9 @@ const ObservationCmpView = memo(
onChange={e => {
const result = e.target.checked;
if (result) {
observations?.forEach(obs => {
dispatch(appendToMolListToEdit(obs.id));
});
if (observations?.length > 0) {
dispatch(appendToMolListToEdit(observations[0].id));
}
// dispatch(appendToObsCmpListToEdit(currentID));
} else {
observations?.forEach(obs => {
Expand Down
15 changes: 10 additions & 5 deletions js/components/preview/molecule/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,16 +1232,21 @@ export const withDisabledMoleculesNglControlButtons = (moleculeIds, type, callba
});
};

export const selectAllHits = (allFilteredMolecules, setNextXMolecules, unselect) => (dispatch, getState) => {
export const selectAllHits = (allFilteredLhsCompounds, setNextXMolecules, unselect) => (dispatch, getState) => {
if (setNextXMolecules) {
dispatch(setNextXMolecules(allFilteredMolecules?.length || 0));
dispatch(setNextXMolecules(allFilteredLhsCompounds?.length || 0));
}
const listOfIds = allFilteredMolecules.map(m => m.id);
const listOfIds = [];
allFilteredLhsCompounds.forEach(cmp => {
if (cmp.associatedObs?.length > 0) {
listOfIds.push(cmp.associatedObs[0].id);
}
});
if (!unselect) {
dispatch(setMolListToEdit(listOfIds));
dispatch(setSelectAllMolecules(allFilteredMolecules));
dispatch(setSelectAllMolecules(allFilteredLhsCompounds));
} else {
dispatch(setMolListToEdit([]));
dispatch(setUnselectAllMolecules(allFilteredMolecules));
dispatch(setUnselectAllMolecules(allFilteredLhsCompounds));
}
};

0 comments on commit 0b7ae4e

Please sign in to comment.