Skip to content

Commit

Permalink
#571 [L] toggle not restored from snapshot for things on Selected Com…
Browse files Browse the repository at this point in the history
…pounds tab
  • Loading branch information
Adriána Kohanová committed Mar 12, 2021
1 parent 22a978c commit a063e67
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
29 changes: 17 additions & 12 deletions js/components/preview/compounds/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,21 @@ const clearCompounds = (items, majorViewStage) => (dispatch, getState) => {
};

export const prepareFakeFilterData = () => (dispatch, getState) => {
dispatch(updateFilterShowedScoreProperties({
datasetID: AUX_VECTOR_SELECTOR_DATASET_ID,
scoreList: [{id: 1, name: 'smiles', description: 'smiles', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID},
{id: 2, name: 'mol', description: 'mol', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID},
{id: 3, name: 'vector', description: 'vector', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID},
{id: 4, name: 'class', description: 'class', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID},
{id: 5, name: 'compoundClass', description: 'compoundClass', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID}]
}));
}

export const isCompoundFromVectorSelector = (data) => {
dispatch(
updateFilterShowedScoreProperties({
datasetID: AUX_VECTOR_SELECTOR_DATASET_ID,
scoreList: [
{ id: 1, name: 'smiles', description: 'smiles', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID },
{ id: 2, name: 'mol', description: 'mol', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID },
{ id: 3, name: 'vector', description: 'vector', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID },
{ id: 4, name: 'class', description: 'class', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID },
{ id: 5, name: 'compoundClass', description: 'compoundClass', computed_set: AUX_VECTOR_SELECTOR_DATASET_ID }
]
})
);
};

export const isCompoundFromVectorSelector = data => {
if (data['index'] !== undefined) {
return true;
} else {
Expand Down Expand Up @@ -330,7 +334,8 @@ export const handleBuyListAll = ({ isSelected, items, majorViewStage }) => (disp
}
};

export const handleShowVectorCompound = ({ isSelected, data, index, majorViewStage }) => async (dispatch, getState) => {
export const handleShowVectorCompound = ({ isSelected, data, majorViewStage }) => async (dispatch, getState) => {
const index = data.index;
await dispatch(showCompoundNglView({ majorViewStage, data, index }));
if (isSelected === false) {
dispatch(removeShowedCompoundFromList(index, data));
Expand Down
8 changes: 3 additions & 5 deletions js/reducers/tracking/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ const getCurrentActionList = (orderedActionList, type, collection, currentAction

if (collection) {
collection.forEach(data => {
let action = actionList.find(action => action.object_id === data.id && action.dataset_id === data.datasetId);
let action = actionList.find(a => a.object_id === data.id && a.dataset_id === data.datasetId);

if (action) {
currentActions.push(Object.assign({ ...action }));
Expand Down Expand Up @@ -972,8 +972,7 @@ const restoreCartActions = (orderedActionList, majorViewStage) => async (dispatc
if (vectorCompoundActions) {
vectorCompoundActions.forEach(action => {
let data = action.item;
let compoundId = action.compoundId;
dispatch(handleShowVectorCompound({ isSelected: true, data, index: compoundId, majorViewStage: majorViewStage }));
dispatch(handleShowVectorCompound({ isSelected: true, data, majorViewStage: majorViewStage }));
});
}
};
Expand Down Expand Up @@ -1936,8 +1935,7 @@ const handleVectorAction = (action, isSelected) => (dispatch, getState) => {
const handleVectorCompoundAction = (action, isSelected, majorViewStage) => (dispatch, getState) => {
if (action) {
let data = action.item;
let compoundId = action.compoundId;
dispatch(handleShowVectorCompound({ isSelected, data, index: compoundId, majorViewStage: majorViewStage }));
dispatch(handleShowVectorCompound({ isSelected, data, majorViewStage: majorViewStage }));
}
};

Expand Down
6 changes: 4 additions & 2 deletions js/reducers/tracking/trackingActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ export const findTrackAction = (action, state) => {
} else if (action.type === previewCompoundConstants.APPEND_SHOWED_COMPOUND_LIST) {
let objectType = actionObjectType.COMPOUND;
let objectName = action.item && action.item.vector;
let objectId = action.item && action.item.smiles;

trackAction = {
type: actionType.VECTOR_COUMPOUND_ADDED,
Expand All @@ -457,14 +458,15 @@ export const findTrackAction = (action, state) => {
username: username,
object_type: objectType,
object_name: objectName,
object_id: action.payload,
object_id: objectId,
item: action.item,
compoundId: action.payload,
text: `${actionDescription.COMPOUND} ${objectName} ${actionDescription.ADDED}`
};
} else if (action.type === previewCompoundConstants.REMOVE_SHOWED_COMPOUND_LIST) {
let objectType = actionObjectType.COMPOUND;
let objectName = action.item && action.item.vector;
let objectId = action.item && action.item.smiles;

trackAction = {
type: actionType.VECTOR_COUMPOUND_REMOVED,
Expand All @@ -473,7 +475,7 @@ export const findTrackAction = (action, state) => {
username: username,
object_type: objectType,
object_name: objectName,
object_id: action.payload,
object_id: objectId,
item: action.item,
compoundId: action.payload,
text: `${actionDescription.COMPOUND} ${objectName} ${actionDescription.REMOVED}`
Expand Down

0 comments on commit a063e67

Please sign in to comment.