From 217553c7238b9995c42dbd1dcc2f9f80107854fb Mon Sep 17 00:00:00 2001 From: Boris Kovar Date: Wed, 2 Dec 2020 09:27:35 +0100 Subject: [PATCH 1/8] - updated version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6cc719d60..d05f1d3aa 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fragalysis-frontend", - "version": "0.9.31", + "version": "0.9.33", "description": "Frontend for fragalysis", "main": "webpack.config.js", "scripts": { From ff4863118e3eac44e6a5c83afe059db6aa2e0b70 Mon Sep 17 00:00:00 2001 From: Boris Kovar Date: Fri, 4 Dec 2020 09:42:12 +0100 Subject: [PATCH 2/8] - updated version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d05f1d3aa..fd95d5e9d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fragalysis-frontend", - "version": "0.9.33", + "version": "0.9.34", "description": "Frontend for fragalysis", "main": "webpack.config.js", "scripts": { From c624767569b8e966959cbd341a089a0d8449f11f Mon Sep 17 00:00:00 2001 From: Boris Kovar Date: Tue, 8 Dec 2020 15:12:48 +0100 Subject: [PATCH 3/8] - updated version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fd95d5e9d..1c3a26c12 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fragalysis-frontend", - "version": "0.9.34", + "version": "0.9.35", "description": "Frontend for fragalysis", "main": "webpack.config.js", "scripts": { From 4be4ac6444395266e8a7fc61db534a15be348e84 Mon Sep 17 00:00:00 2001 From: ag-m2ms Date: Thu, 10 Dec 2020 09:36:46 +0100 Subject: [PATCH 4/8] Fixed 'A' button --- js/components/preview/molecule/moleculeView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/components/preview/molecule/moleculeView.js b/js/components/preview/molecule/moleculeView.js index efaa161b2..42640d2e0 100644 --- a/js/components/preview/molecule/moleculeView.js +++ b/js/components/preview/molecule/moleculeView.js @@ -618,7 +618,7 @@ const MoleculeView = memo( )} onClick={() => { // always deselect all if are selected only some of options - selectedAll.current = hasSomeValuesOn ? false : !selectedAll.current; + selectedAll.current = hasSomeValuesOn || hasAllValuesOn ? false : !selectedAll.current; setCalledFromAll(); onLigand(true); From 8b7779ccd2eca6ac6e8ba8319e50d663ffc8cea6 Mon Sep 17 00:00:00 2001 From: Boris Kovar Date: Thu, 10 Dec 2020 10:42:33 +0100 Subject: [PATCH 5/8] - updated version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c3a26c12..71c338464 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fragalysis-frontend", - "version": "0.9.35", + "version": "0.9.36", "description": "Frontend for fragalysis", "main": "webpack.config.js", "scripts": { From 99591ac60f9b64a912c9c094eda3d216d7dd9d8d Mon Sep 17 00:00:00 2001 From: ag-m2ms Date: Thu, 10 Dec 2020 14:05:24 +0100 Subject: [PATCH 6/8] Adjusted tracking behaviour for turned off sites --- .../moleculeGroups/redux/dispatchActions.js | 33 +++++++++++++++---- js/reducers/api/actions.js | 8 +++++ js/reducers/api/constants.js | 1 + js/reducers/selection/actions.js | 25 ++++++++------ js/reducers/tracking/dispatchActions.js | 16 ++++++++- js/reducers/tracking/trackingActions.js | 27 ++++++++------- 6 files changed, 78 insertions(+), 32 deletions(-) diff --git a/js/components/preview/moleculeGroups/redux/dispatchActions.js b/js/components/preview/moleculeGroups/redux/dispatchActions.js index 47cc081ae..d152f4d41 100644 --- a/js/components/preview/moleculeGroups/redux/dispatchActions.js +++ b/js/components/preview/moleculeGroups/redux/dispatchActions.js @@ -27,7 +27,7 @@ import { setVectorOnList } from '../../../../reducers/selection/actions'; import { setCountOfRemainingMoleculeGroups, setMoleculeOrientations } from '../../../../reducers/ngl/actions'; -import { setMolGroupList, setMolGroupOn } from '../../../../reducers/api/actions'; +import { setMolGroupList, setMolGroupOn, setMolGroupOff } from '../../../../reducers/api/actions'; import { getUrl, loadFromServer } from '../../../../utils/genericList'; import { OBJECT_TYPE } from '../../../nglView/constants'; import { setSortDialogOpen } from '../../molecule/redux/actions'; @@ -43,7 +43,13 @@ export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, currentMolGroup let site; const state = getState(); - const vector_list = state.selectionReducers.vector_list; + const { fragmentDisplayList, complexList, proteinList, surfaceList, vectorOnList, vector_list } = state.selectionReducers; + + const actionFragmentDisplayList = []; + const actionComplexList = []; + const actionProteinList = []; + const actionSurfaceList = []; + const actionVectorOnList = []; // loop through all molecules selectJoinedMoleculeList(state).forEach(mol => { @@ -69,7 +75,20 @@ export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, currentMolGroup ) ); }); + + if (fragmentDisplayList.find(ligand => ligand === mol.id)) actionFragmentDisplayList.push(mol); + if (complexList.find(ligand => ligand === mol.id)) actionComplexList.push(mol); + if (proteinList.find(ligand => ligand === mol.id)) actionProteinList.push(mol); + if (surfaceList.find(ligand => ligand === mol.id)) actionSurfaceList.push(mol); + if (vectorOnList.find(ligand => ligand === mol.id)) actionVectorOnList.push(mol); }); + dispatch(setMolGroupOff(molGroupId, { + ligand: actionFragmentDisplayList, + protein: actionProteinList, + complex: actionComplexList, + surface: actionSurfaceList, + vector: actionVectorOnList + })); // remove all Vectors vector_list @@ -87,15 +106,15 @@ export const clearAfterDeselectingMoleculeGroup = ({ molGroupId, currentMolGroup currentMolGroup.mol_id.forEach(moleculeID => { // remove Ligand, Complex, Vectors from selection //Ligand - dispatch(removeFromFragmentDisplayList({ id: moleculeID })); + dispatch(removeFromFragmentDisplayList({ id: moleculeID }, true)); // Complex - dispatch(removeFromComplexList({ id: moleculeID })); + dispatch(removeFromComplexList({ id: moleculeID }, true)); // Protein - dispatch(removeFromProteinList({ id: moleculeID })); + dispatch(removeFromProteinList({ id: moleculeID }, true)); // Surface - dispatch(removeFromSurfaceList({ id: moleculeID })); + dispatch(removeFromSurfaceList({ id: moleculeID }, true)); // Vectors - dispatch(removeFromVectorOnList({ id: moleculeID })); + dispatch(removeFromVectorOnList({ id: moleculeID }, true)); }); }; diff --git a/js/reducers/api/actions.js b/js/reducers/api/actions.js index 925e9b56a..d384e30e4 100644 --- a/js/reducers/api/actions.js +++ b/js/reducers/api/actions.js @@ -59,6 +59,14 @@ export const setMolGroupOn = function(mol_group_id) { }; }; +export const setMolGroupOff = function(mol_group_id, selectionGroups) { + return { + type: constants.SET_MOL_GROUP_OFF, + mol_group_off: mol_group_id, + selectionGroups + }; +}; + export const setMolGroupList = function(mol_group_list) { return { type: constants.SET_MOL_GROUP_LIST, diff --git a/js/reducers/api/constants.js b/js/reducers/api/constants.js index b15a46d25..00208acbc 100644 --- a/js/reducers/api/constants.js +++ b/js/reducers/api/constants.js @@ -11,6 +11,7 @@ export const constants = { SET_PANNDA_EVENT_ON: prefix + 'SET_PANNDA_EVENT_ON', SET_MOL_GROUP_ON: prefix + 'SET_MOL_GROUP_ON', + SET_MOL_GROUP_OFF: prefix + 'SET_MOL_GROUP_OFF', SET_MOL_GROUP_LIST: prefix + 'SET_MOL_GROUP_LIST', SET_MOLECULE_LIST: prefix + 'SET_MOLECULE_LIST', SET_CACHED_MOL_LISTS: prefix + 'SET_CACHED_MOL_LISTS', diff --git a/js/reducers/selection/actions.js b/js/reducers/selection/actions.js index 9c154498c..d1b9a5479 100644 --- a/js/reducers/selection/actions.js +++ b/js/reducers/selection/actions.js @@ -39,10 +39,11 @@ export const setCurrentVector = vectorSmile => { }; }; -export const setFragmentDisplayList = function(fragmentDisplayList) { +export const setFragmentDisplayList = function(fragmentDisplayList, skipTracking = false) { return { type: constants.SET_FRAGMENT_DISPLAY_LIST, - fragmentDisplayList: fragmentDisplayList + fragmentDisplayList: fragmentDisplayList, + skipTracking }; }; @@ -62,10 +63,11 @@ export const removeFromFragmentDisplayList = function(item, skipTracking = false }; }; -export const setProteinList = function(proteinList) { +export const setProteinList = function(proteinList, skipTracking = false) { return { type: constants.SET_PROTEIN_LIST, - proteinList: proteinList + proteinList: proteinList, + skipTracking }; }; @@ -84,10 +86,11 @@ export const removeFromProteinList = function(item, skipTracking = false) { skipTracking: skipTracking }; }; -export const setComplexList = function(complexList) { +export const setComplexList = function(complexList, skipTracking = false) { return { type: constants.SET_COMPLEX_LIST, - complexList: complexList + complexList: complexList, + skipTracking }; }; @@ -107,10 +110,11 @@ export const removeFromComplexList = function(item, skipTracking = false) { }; }; -export const setSurfaceList = function(surfaceList) { +export const setSurfaceList = function(surfaceList, skipTracking = false) { return { type: constants.SET_SURFACE_LIST, - surfaceList: surfaceList + surfaceList: surfaceList, + skipTracking }; }; @@ -151,10 +155,11 @@ export const removeFromDensityList = function(item) { }; }; -export const setVectorOnList = function(vectorOnList) { +export const setVectorOnList = function(vectorOnList, skipTracking = false) { return { type: constants.SET_VECTOR_ON_LIST, - vectorOnList: vectorOnList + vectorOnList: vectorOnList, + skipTracking }; }; diff --git a/js/reducers/tracking/dispatchActions.js b/js/reducers/tracking/dispatchActions.js index 93b2b353e..fc8aee47c 100644 --- a/js/reducers/tracking/dispatchActions.js +++ b/js/reducers/tracking/dispatchActions.js @@ -1513,10 +1513,24 @@ const removeRepresentation = (parentKey, representation, nglView) => (dispatch, const handleMoleculeGroupAction = (action, isSelected, stageSummaryView, majorViewStage) => (dispatch, getState) => { const state = getState(); if (action) { - let moleculeGroup = getMolGroup(action.object_name, state); + const { selectionGroups, object_name } = action; + let moleculeGroup = getMolGroup(object_name, state); if (moleculeGroup) { if (isSelected === true) { dispatch(selectMoleculeGroup(moleculeGroup, stageSummaryView)); + + for (const type in selectionGroups) { + if (selectionGroups.hasOwnProperty(type)) { + const typeGroup = selectionGroups[type]; + for (const mol of typeGroup) { + if (type === 'ligand') { + dispatch(addType[type](majorViewStage, mol, colourList[mol.id % colourList.length], true, true)); + } else { + dispatch(addType[type](majorViewStage, mol, colourList[mol.id % colourList.length], true)); + } + } + } + } } else { dispatch(onDeselectMoleculeGroup({ moleculeGroup, stageSummaryView, majorViewStage })); } diff --git a/js/reducers/tracking/trackingActions.js b/js/reducers/tracking/trackingActions.js index 963671514..5d359a6b5 100644 --- a/js/reducers/tracking/trackingActions.js +++ b/js/reducers/tracking/trackingActions.js @@ -42,20 +42,19 @@ export const findTrackAction = (action, state) => { }; } } - } else if (action.type.includes(selectionConstants.SET_OBJECT_SELECTION)) { - let objectId = action.payload && action.payload[0]; - if (objectId) { - let molGroupName = getMolGroupName(objectId, state); - trackAction = { - type: actionType.SITE_TURNED_OFF, - timestamp: Date.now(), - username: username, - object_type: actionObjectType.SITE, - object_name: molGroupName, - object_id: objectId, - text: `${actionDescription.SITE} ${molGroupName} ${actionDescription.TURNED_OFF}` - }; - } + } else if (action.type.includes(apiConstants.SET_MOL_GROUP_OFF)) { + const { mol_group_off, selectionGroups } = action; + let molGroupName = getMolGroupName(mol_group_off, state); + trackAction = { + type: actionType.SITE_TURNED_OFF, + timestamp: Date.now(), + username: username, + object_type: actionObjectType.SITE, + object_name: molGroupName, + object_id: mol_group_off, + selectionGroups, + text: `${actionDescription.SITE} ${molGroupName} ${actionDescription.TURNED_OFF}` + }; } else if (action.type === selectionConstants.SET_HIDE_ALL) { if (action.data) { let objectType = actionObjectType.MOLECULE; From 2e9939ff449229aa9199d07a33581abe6c4a10a5 Mon Sep 17 00:00:00 2001 From: Boris Kovar Date: Thu, 10 Dec 2020 15:09:30 +0100 Subject: [PATCH 7/8] - updated version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71c338464..07465ed91 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fragalysis-frontend", - "version": "0.9.36", + "version": "0.9.39", "description": "Frontend for fragalysis", "main": "webpack.config.js", "scripts": { From 14b1e615dccf6b41bc31ef7f426be8b289e7abbf Mon Sep 17 00:00:00 2001 From: Boris Kovar Date: Fri, 11 Dec 2020 11:57:01 +0100 Subject: [PATCH 8/8] - fixed bad merge --- .../preview/moleculeGroups/redux/dispatchActions.js | 6 +++++- package.json | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/components/preview/moleculeGroups/redux/dispatchActions.js b/js/components/preview/moleculeGroups/redux/dispatchActions.js index 26c37bde2..2c026fd1e 100644 --- a/js/components/preview/moleculeGroups/redux/dispatchActions.js +++ b/js/components/preview/moleculeGroups/redux/dispatchActions.js @@ -286,7 +286,11 @@ export const onDeselectMoleculeGroup = ({ moleculeGroup, stageSummaryView, major const selectionCopy = mol_group_selection.slice(); const objIdx = mol_group_selection.indexOf(moleculeGroup.id); dispatch( - clearAfterDeselectingMoleculeGroup() + clearAfterDeselectingMoleculeGroup({ + molGroupId: moleculeGroup.id, + currentMolGroup, + majorViewStage + }) ); selectionCopy.splice(objIdx, 1); dispatch( diff --git a/package.json b/package.json index 07465ed91..53677783f 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fragalysis-frontend", - "version": "0.9.39", + "version": "0.9.40", "description": "Frontend for fragalysis", "main": "webpack.config.js", "scripts": {