{orderedActionList &&
- orderedActionList.map((data, index) => (
-
- ) : (
-
- )
- }
- iconColor={palette.primary.main}
- className={classes.timelineEvent}
- >
- ))}
+ orderedActionList.map((data, index) => {
+ if (data && data != null) {
+ return (
+
+ ) : (
+
+ )
+ }
+ iconColor={palette.primary.main}
+ className={classes.timelineEvent}
+ >
+ );
+ }
+ })}
diff --git a/js/reducers/tracking/actions.js b/js/reducers/tracking/actions.js
index decfb1e3a..65c3f301c 100644
--- a/js/reducers/tracking/actions.js
+++ b/js/reducers/tracking/actions.js
@@ -20,3 +20,17 @@ export const setCurrentActionsList = function(current_actions_list) {
current_actions_list: current_actions_list
};
};
+
+export const setIsTrackingMoleculesRestoring = function(isTrackingMoleculesRestoring) {
+ return {
+ type: constants.SET_IS_TRACKING_MOLECULES_RESTORING,
+ isTrackingMoleculesRestoring: isTrackingMoleculesRestoring
+ };
+};
+
+export const setIsTrackingCompoundsRestoring = function(isTrackingCompoundsRestoring) {
+ return {
+ type: constants.SET_IS_TRACKING_COMPOUNDS_RESTORING,
+ isTrackingCompoundsRestoring: isTrackingCompoundsRestoring
+ };
+};
diff --git a/js/reducers/tracking/constants.js b/js/reducers/tracking/constants.js
index 18b77abef..8863e0915 100644
--- a/js/reducers/tracking/constants.js
+++ b/js/reducers/tracking/constants.js
@@ -3,7 +3,9 @@ const prefix = 'REDUCERS_TRACKING_';
export const constants = {
SET_ACTIONS_LIST: prefix + 'SET_ACTIONS_LIST',
APPEND_ACTIONS_LIST: prefix + 'APPEND_ACTIONS_LIST',
- SET_CURRENT_ACTIONS_LIST: prefix + 'SET_CURRENT_ACTIONS_LIST'
+ SET_CURRENT_ACTIONS_LIST: prefix + 'SET_CURRENT_ACTIONS_LIST',
+ SET_IS_TRACKING_COMPOUNDS_RESTORING: prefix + 'SET_IS_TRACKING_COMPOUNDS_RESTORING',
+ SET_IS_TRACKING_MOLECULES_RESTORING: prefix + 'SET_IS_TRACKING_MOLECULES_RESTORING'
};
export const actionType = {
diff --git a/js/reducers/tracking/dispatchActions.js b/js/reducers/tracking/dispatchActions.js
index 1bdb72b50..f98ba1d78 100644
--- a/js/reducers/tracking/dispatchActions.js
+++ b/js/reducers/tracking/dispatchActions.js
@@ -1,4 +1,4 @@
-import { setCurrentActionsList } from './actions';
+import { setCurrentActionsList, setIsTrackingMoleculesRestoring, setIsTrackingCompoundsRestoring } from './actions';
import { actionType, actionObjectType } from './constants';
import { VIEWS } from '../../../js/constants/constants';
import { setCurrentVector } from '../selection/actions';
@@ -24,7 +24,10 @@ import {
loadDataSets,
loadDatasetCompoundsWithScores
} from '../../components/datasets/redux/dispatchActions';
-import { appendMoleculeToCompoundsOfDatasetToBuy } from '../../components/datasets/redux/actions';
+import {
+ appendMoleculeToCompoundsOfDatasetToBuy,
+ setMoleculeListIsLoading
+} from '../../components/datasets/redux/actions';
import { setAllMolLists } from '../api/actions';
import { getUrl, loadAllMolsFromMolGroup } from '../../../js/utils/genericList';
import * as listType from '../../constants/listTypes';
@@ -157,7 +160,8 @@ const mapCurrentAction = action => {
timestamp: action.timestamp,
object_name: action.object_name,
object_type: action.object_type,
- action_type: action.type
+ action_type: action.type,
+ dataset_id: action.dataset_id
});
};
@@ -212,6 +216,8 @@ const getCollectionOfDatasetOfRepresentation = dataList => {
};
export const restoreCurrentActionsList = (stages = []) => (dispatch, getState) => {
+ dispatch(setIsTrackingMoleculesRestoring(true));
+ dispatch(setIsTrackingCompoundsRestoring(true));
dispatch(unmountPreviewComponent(stages));
dispatch(resetTargetState());
dispatch(restoreStateBySavedActionList(stages));
@@ -226,9 +232,10 @@ const restoreStateBySavedActionList = stages => (dispatch, getState) => {
dispatch(restoreTargetActions(orderedActionList, stages));
};
-const restoreTargetActions = (orderedActionList, stages, state) => (dispatch, getState) => {
+const restoreTargetActions = (orderedActionList, stages) => (dispatch, getState) => {
const state = getState();
+ const majorView = stages.find(view => view.id === VIEWS.MAJOR_VIEW);
const summaryView = stages.find(view => view.id === VIEWS.SUMMARY_VIEW);
let targetAction = orderedActionList.find(action => action.action_type === actionType.TARGET_LOADED);
@@ -250,32 +257,28 @@ const restoreTargetActions = (orderedActionList, stages, state) => (dispatch, ge
throw error;
})
.finally(() => {
- const majorView = stages.find(view => view.id === VIEWS.MAJOR_VIEW);
- const stage = majorView.stage;
-
dispatch(restoreSitesActions(orderedActionList, summaryView));
- dispatch(loadAllMolecules(orderedActionList, target.id, stage));
+ dispatch(loadAllMolecules(orderedActionList, target.id, majorView.stage));
});
- dispatch(loadAllDatasaets);
+ dispatch(loadAllDatasets(orderedActionList, target.id, majorView.stage));
}
}
};
-const loadAllDatasaets = (orderedActionList, target_on, stage) => (dispatch, getState) => {
- //dispatch(setMoleculeListIsLoading(true));
+const loadAllDatasets = (orderedActionList, target_on, stage) => (dispatch, getState) => {
+ dispatch(setMoleculeListIsLoading(true));
dispatch(loadDataSets(target_on))
.then(results => {
- //setSelectedDatasetIndex(0);
-
return dispatch(loadDatasetCompoundsWithScores());
})
.catch(error => {
throw new Error(error);
})
.finally(() => {
- //dispatch(setMoleculeListIsLoading(false));
dispatch(restoreCompoundsActions(orderedActionList, stage));
+ dispatch(setMoleculeListIsLoading(false));
+ dispatch(setIsTrackingCompoundsRestoring(false));
});
};
@@ -304,6 +307,7 @@ const loadAllMolecules = (orderedActionList, target_on, stage) => (dispatch, get
});
dispatch(setAllMolLists(listToSet));
dispatch(restoreMoleculesActions(orderedActionList, stage));
+ dispatch(setIsTrackingMoleculesRestoring(false));
})
.catch(err => console.log(err));
};
@@ -390,7 +394,7 @@ const addNewType = (moleculesAction, actionType, type, stage, state) => dispatch
actions.forEach(action => {
let data = getMolecule(action.object_name, state);
if (data) {
- dispatch(addType[type](stage, data, colourList[data.id % colourList.length]), true);
+ dispatch(addType[type](stage, data, colourList[data.id % colourList.length]));
}
});
}
@@ -402,7 +406,7 @@ const addNewTypeCompound = (moleculesAction, actionType, type, stage, state) =>
actions.forEach(action => {
let data = getCompound(action.object_name, state);
if (data) {
- dispatch(addTypeCompound[type](stage, data, colourList[data.id % colourList.length]), data.datasetID);
+ dispatch(addTypeCompound[type](stage, data, colourList[data.id % colourList.length], action.dataset_id));
}
});
}
diff --git a/js/reducers/tracking/trackingReducers.js b/js/reducers/tracking/trackingReducers.js
index a9e9e793b..4f2ddea98 100644
--- a/js/reducers/tracking/trackingReducers.js
+++ b/js/reducers/tracking/trackingReducers.js
@@ -2,7 +2,9 @@ import { constants } from './constants';
export const INITIAL_STATE = {
truck_actions_list: [],
- current_actions_list: []
+ current_actions_list: [],
+ isTrackingMoleculesRestoring: false,
+ isTrackingCompoundsRestoring: false
};
export default function trackingReducers(state = INITIAL_STATE, action = {}) {
@@ -22,6 +24,16 @@ export default function trackingReducers(state = INITIAL_STATE, action = {}) {
current_actions_list: action.current_actions_list
});
+ case constants.SET_IS_TRACKING_MOLECULES_RESTORING:
+ return Object.assign({}, state, {
+ isTrackingMoleculesRestoring: action.isTrackingMoleculesRestoring
+ });
+
+ case constants.SET_IS_TRACKING_COMPOUNDS_RESTORING:
+ return Object.assign({}, state, {
+ isTrackingCompoundsRestoring: action.isTrackingCompoundsRestoring
+ });
+
default:
return state;
}