Skip to content

Commit

Permalink
Clear history on project change
Browse files Browse the repository at this point in the history
  • Loading branch information
ag-m2ms committed Feb 1, 2021
1 parent 419c268 commit 57b71e0
Show file tree
Hide file tree
Showing 6 changed files with 1,537 additions and 1,518 deletions.
3 changes: 3 additions & 0 deletions js/components/preview/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { resetDatasetsState } from '../../datasets/redux/actions';
import { restoreAfterTargetActions } from '../../../reducers/tracking/dispatchActions';
import { resetTrackingState } from '../../../reducers/tracking/actions';
import { setTargetOn } from '../../../reducers/api/actions';
import { resetNglTrackingState } from '../../../reducers/nglTracking/dispatchActions';

const loadProtein = nglView => (dispatch, getState) => {
const state = getState();
Expand Down Expand Up @@ -122,6 +123,7 @@ export const unmountPreviewComponent = (stages = []) => dispatch => {
});

dispatch(resetTrackingState());
dispatch(resetNglTrackingState());

dispatch(resetCurrentCompoundsSettings(true));
dispatch(resetProjectsReducer());
Expand All @@ -146,6 +148,7 @@ export const resetReducersBetweenSnapshots = (stages = []) => dispatch => {
dispatch(resetSelectionState());
dispatch(resetDatasetsState());
dispatch(resetTrackingState());
dispatch(resetNglTrackingState());
dispatch(setTargetOn(undefined));
};

Expand Down
3 changes: 3 additions & 0 deletions js/components/projects/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { sendInitTrackingActionByProjectId } from '../../../reducers/tracking/di
import { resetTrackingState } from '../../../reducers/tracking/actions';

import moment from 'moment';
import { resetNglTrackingState } from '../../../reducers/nglTracking/dispatchActions';

export const assignSnapshotToProject = ({ projectID, snapshotID, ...rest }) => (dispatch, getState) => {
dispatch(resetCurrentSnapshot());
Expand Down Expand Up @@ -323,6 +324,7 @@ export const createProjectFromSnapshot = ({ title, description, author, tags, hi

dispatch(setProjectModalIsLoading(true));
dispatch(resetTrackingState());
dispatch(resetNglTrackingState());
return dispatch(
createProject({
title,
Expand Down Expand Up @@ -369,6 +371,7 @@ export const createProjectFromScratch = ({ title, description, target, author, t
) => {
dispatch(setProjectModalIsLoading(true));
dispatch(resetTrackingState());
dispatch(resetNglTrackingState());
return api({
url: `${base_url}/api/session-projects/`,
method: METHOD.POST,
Expand Down
6 changes: 6 additions & 0 deletions js/reducers/nglTracking/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,10 @@ export const nglTrackingRedo = function() {
return {
type: undoConstants.NGL_TRACKING_REDO
};
}

export const nglClearHistory = function() {
return {
type: undoConstants.NGL_CLEAR_HISTORY
}
}
5 changes: 3 additions & 2 deletions js/reducers/nglTracking/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const actionAnnotation = {
export const NUM_OF_SECONDS_TO_IGNORE_MERGE = 5;

export const undoConstants = {
NGL_TRACKING_UNDO: prefix + 'UNDO',
NGL_TRACKING_REDO: prefix + 'REDO'
NGL_TRACKING_UNDO: prefix + 'UNDO',
NGL_TRACKING_REDO: prefix + 'REDO',
NGL_CLEAR_HISTORY: prefix + 'CLEAR_HISTORY'
}
Loading

0 comments on commit 57b71e0

Please sign in to comment.