Skip to content

Commit

Permalink
- #1483 - removed old code
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms committed Aug 19, 2024
1 parent d651036 commit 26ff98a
Show file tree
Hide file tree
Showing 49 changed files with 154 additions and 10,978 deletions.
2 changes: 0 additions & 2 deletions js/components/datasets/datasetMoleculeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,6 @@ const DatasetMoleculeList = ({ title, datasetID, url }) => {

const searchString = useSelector(state => state.datasetsReducers.searchString);

const currentActionList = useSelector(state => state.trackingReducers.current_actions_list);

const isActiveFilter = !!(filterSettings || {}).active;
const { getNglView } = useContext(NglContext);

Expand Down
9 changes: 3 additions & 6 deletions js/components/datasets/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@ import {
} from '../../preview/molecule/redux/dispatchActions';
import { OBJECT_TYPE } from '../../nglView/constants';
import { getRepresentationsByType } from '../../nglView/generatingObjects';
import { selectAllMoleculeList } from '../../preview/molecule/redux/selectors';
import { getCompoundById } from '../../../reducers/tracking/dispatchActionsSwitchSnapshot';
import { getRandomColor } from '../../preview/molecule/utils/color';
import { BreakfastDiningOutlined } from '@mui/icons-material';
import { isCompoundFromVectorSelector } from '../../preview/compounds/redux/dispatchActions';
import { getCompoundById } from '../../../utils/genericDispatchActions';

export const initializeDatasetFilter = datasetID => (dispatch, getState) => {
const state = getState();
Expand Down Expand Up @@ -224,8 +222,7 @@ export const addDatasetLigand = (
markAsRightSideLigand: true
})
).finally(() => {
const state = getState();
const skipOrientation = state.trackingReducers.skipOrientationChange;
const skipOrientation = false; //state.trackingReducers.skipOrientationChange;
if (!skipOrientation) {
const ligandOrientation = stage.viewerControls.getOrientation();
dispatch(setOrientation(VIEWS.MAJOR_VIEW, ligandOrientation));
Expand Down Expand Up @@ -553,7 +550,7 @@ export const autoHideDatasetDialogsOnScroll = ({ inspirationDialogRef, crossRefe
const state = getState();
const isOpenInspirationDialog = state.datasetsReducers.isOpenInspirationDialog;
const isOpenCrossReferenceDialog = state.datasetsReducers.isOpenCrossReferenceDialog;
const isActionRestoring = state.trackingReducers.isActionRestoring;
const isActionRestoring = false; //state.trackingReducers.isActionRestoring;

const currentBoundingClientRectInspiration =
(inspirationDialogRef.current && inspirationDialogRef.current.getBoundingClientRect()) || null;
Expand Down
11 changes: 0 additions & 11 deletions js/components/datasets/redux/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,17 +461,6 @@ export const getJoinedMoleculeLists = (datasetID, state) => {
}
}

// const restoredSearchString = state.trackingReducers.current_actions_list.find(
// action => action.type === 'SEARCH_STRING'
// );
// if (restoredSearchString !== null && restoredSearchString !== undefined) {
// const searchedString = restoredSearchString.searchString;
// if (searchedString !== undefined) {
// moleculeList = moleculeList.filter(molecule =>
// molecule.name.toLowerCase().includes(searchedString.toLowerCase())
// );
// }
// }
if (searchString !== null && searchString !== undefined) {
moleculeList = moleculeList.filter(molecule => molecule.name.toLowerCase().includes(searchString.toLowerCase()));
}
Expand Down
11 changes: 0 additions & 11 deletions js/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import { DJANGO_CONTEXT } from '../../utils/djangoContext';
import { useHistory } from 'react-router-dom';
import { IssueReport } from '../userFeedback/issueReport';
import { FundersModal } from '../funders/fundersModal';
import { TrackingModal } from '../tracking/trackingModal';
// eslint-disable-next-line import/extensions
import { version } from '../../../package.json';
import { isDiscourseAvailable, openDiscourseLink } from '../../utils/discourse';
Expand All @@ -58,7 +57,6 @@ import { DiscourseErrorModal } from './discourseErrorModal';
import { setOpenDiscourseErrorModal } from '../../reducers/api/actions';
import { lockLayout, resetCurrentLayout } from '../../reducers/layout/actions';
import { ChangeLayoutButton } from './changeLayoutButton';
import { setIsActionsRestoring, setProjectActionListLoaded } from '../../reducers/tracking/actions';
import { layouts } from '../../reducers/layout/layouts';
import { setOpenSnapshotSavingDialog } from '../snapshot/redux/actions';
import { activateSnapshotDialog } from '../snapshot/redux/dispatchActions';
Expand All @@ -67,7 +65,6 @@ import { getVersions } from '../../utils/version';
import { AddProjectDetail } from '../projects/addProjectDetail';
import { ServicesStatusWrapper } from '../services';
import { COMPANIES, get_logo } from '../funders/constants';
import { setEditTargetDialogOpen } from '../target/redux/actions';

const useStyles = makeStyles(theme => ({
padding: {
Expand Down Expand Up @@ -256,11 +253,6 @@ export default memo(
variant="h5"
color="textPrimary"
onClick={() => {
dispatch(setIsActionsRestoring(false, false));
dispatch(setProjectActionListLoaded(false));
// dispatch(setCurrentProject(null, null, null, null, null, [], null));
// dispatch(setDialogCurrentStep(0));
// dispatch(setForceCreateProject(false));
history.push(URLS.landing);
window.location.reload();
}}
Expand Down Expand Up @@ -502,7 +494,6 @@ export default memo(
</Grid>
</AppBar>
<FundersModal openModal={openFunders} onModalClose={() => setOpenFunders(false)} />
<TrackingModal openModal={openTrackingModal} onModalClose={() => setOpenTrackingModal(false)} />
<DiscourseErrorModal openModal={openDiscourseError} />
<Drawer
anchor="left"
Expand Down Expand Up @@ -541,8 +532,6 @@ export default memo(
<ListItem
button
onClick={() => {
dispatch(setIsActionsRestoring(false, false));
dispatch(setProjectActionListLoaded(false));
history.push(URLS.landing);
window.location.reload();
}}
Expand Down
4 changes: 2 additions & 2 deletions js/components/nglView/renderingObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const showLigand = async ({
}) => {
let stringBlob = new Blob([input_dict.sdf_info], { type: 'text/plain' });
console.count(`showLigand started`);
const skipOrientation = state.trackingReducers.skipOrientationChange;
const skipOrientation = false; //state.trackingReducers.skipOrientationChange;

if (loadQuality && quality && quality.badids?.length > 0) {
return loadQualityFromFile(
Expand Down Expand Up @@ -379,7 +379,7 @@ const showProtein = ({ stage, input_dict, object_name, representations, orientat
const reprArray =
representations || createRepresentationsArray([createRepresentationStructure(input_dict.nglProtStyle, {})]);

const skipOrientation = state.trackingReducers.skipOrientationChange;
const skipOrientation = false; //state.trackingReducers.skipOrientationChange;

if (!skipOrientation) {
if (orientationMatrix) {
Expand Down
2 changes: 1 addition & 1 deletion js/components/preview/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const Preview = memo(({ isStateLoaded, hideProjects, isSnapshot = false }) => {

const customDatasets = useSelector(state => state.datasetsReducers.datasets);
const target_on = useSelector(state => state.apiReducers.target_on);
const isTrackingRestoring = useSelector(state => state.trackingReducers.isTrackingCompoundsRestoring);
const isTrackingRestoring = false; //useSelector(state => state.trackingReducers.isTrackingCompoundsRestoring);

const all_mol_lists = useSelector(state => state.apiReducers.all_mol_lists);
const moleculeLists = useSelector(state => state.datasetsReducers.moleculeLists);
Expand Down
2 changes: 1 addition & 1 deletion js/components/preview/jobTable/redux/dispatchActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { setSelectedDatasetIndex, setTabValue } from '../../../datasets/redux/actions';
import { turnSide } from '../../viewerControls/redux/actions';
import { getCompoundById } from '../../../../reducers/tracking/dispatchActionsSwitchSnapshot';
import {
removeDatasetLigand,
removeDatasetHitProtein,
Expand All @@ -10,6 +9,7 @@ import {
} from '../../../datasets/redux/dispatchActions';
import { getRandomColor } from '../../molecule/utils/color';
import { getJoinedMoleculeLists } from '../../../datasets/redux/selectors';
import { getCompoundById } from '../../../../utils/genericDispatchActions';

const removeRHSfromNGL = stage => (dispatch, getState) => {
const state = getState();
Expand Down
7 changes: 5 additions & 2 deletions js/components/preview/molecule/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ export const addLigand = (
})
).then(() => {
const state = getState();
const skipOrientation = state.trackingReducers.skipOrientationChange;
const skipOrientation = false; //state.trackingReducers.skipOrientationChange;
if (!skipOrientation) {
const ligandOrientation = stage.viewerControls.getOrientation();
dispatch(setOrientation(VIEWS.MAJOR_VIEW, ligandOrientation));
Expand Down Expand Up @@ -1260,7 +1260,10 @@ export const selectAllHits = (allFilteredLhsCompounds, setNextXMolecules, unsele
}
};

export const selectAllVisibleObservations = (visibleObservations, setNextXMolecules, unselect) => (dispatch, getState) => {
export const selectAllVisibleObservations = (visibleObservations, setNextXMolecules, unselect) => (
dispatch,
getState
) => {
if (setNextXMolecules) {
dispatch(setNextXMolecules(visibleObservations?.length || 0));
}
Expand Down
2 changes: 0 additions & 2 deletions js/components/preview/moleculeGroups/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { OBJECT_TYPE } from '../../../nglView/constants';
import { setSortDialogOpen } from '../../molecule/redux/actions';
import { resetCurrentCompoundsSettings } from '../../compounds/redux/actions';
import { reloadSession } from '../../../snapshot/redux/dispatchActions';
import { resetRestoringState } from '../../../../reducers/tracking/dispatchActions';
import { URLS } from '../../../routes/constants';

export const clearAfterDeselectingMoleculeGroup = ({ molGroupId }) => dispatch => {
Expand Down Expand Up @@ -179,7 +178,6 @@ export const restoreFromCurrentSnapshot = ({ nglViewList }) => (dispatch, getSta
};

export const restoreSnapshotActions = ({ nglViewList, projectId, snapshotId, history }) => (dispatch, getState) => {
dispatch(resetRestoringState(nglViewList));
// Trigger react-router to get rid of snapshot just saved flag
history.replace(`${URLS.projects}${projectId}/${snapshotId}`);
};
Expand Down
7 changes: 2 additions & 5 deletions js/components/preview/projectHistoryPanel/ProjectHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import JobLauncherDialog from './JobLauncherDialog';
import { DJANGO_CONTEXT } from '../../../utils/djangoContext';
import { SQUONK_NOT_AVAILABLE } from './constants';
import { PROJECTS_JOBS_PANEL_HEIGHT } from '../constants';
import { changeSnapshot } from '../../../reducers/tracking/dispatchActionsSwitchSnapshot';
import { NglContext } from '../../nglView/nglProvider';
import { VIEWS } from '../../../constants/constants';
import { useRouteMatch } from 'react-router-dom';
Expand Down Expand Up @@ -89,14 +88,12 @@ export const ProjectHistory = memo(({ showFullHistory, graphKey, expanded, onExp
const currentSnapshotJobList = useSelector(state => state.projectReducers.currentSnapshotJobList);
const currentSnapshotTree = useSelector(state => state.projectReducers.currentSnapshotTree);
const jobPopUpAnchorEl = useSelector(state => state.projectReducers.jobPopUpAnchorEl);
const isSnapshotDirty = useSelector(state => state.trackingReducers.isSnapshotDirty);
const isSnapshotDirty = false; //useSelector(state => state.trackingReducers.isSnapshotDirty);
const currentSessionProject = useSelector(state => state.projectReducers.currentProject);
const currentSessionProjectID = currentSessionProject && currentSessionProject.projectID;
const sessionProjectID = paramsProjectID && paramsProjectID != null ? paramsProjectID : currentSessionProjectID;

const currentProject = useSelector(state => state.targetReducers.currentProject);
const actionListNGL = useSelector(state => state.nglTrackingReducers.track_actions_list);
const actionList = useSelector(state => state.trackingReducers.track_actions_list);

const [tryToOpen, setTryToOpen] = useState(false);
const [transitionToSnapshot, setTransitionToSnapshot] = useState(null);
Expand All @@ -122,7 +119,7 @@ export const ProjectHistory = memo(({ showFullHistory, graphKey, expanded, onExp
setTryToOpen(false);
// dispatch(changeSnapshot(sessionProjectID, transitionToSnapshot.hash, nglViewList, stage));
} else if (!isSnapshotDirty && tryToOpen && transitionToSnapshot) {
dispatch(changeSnapshot(sessionProjectID, transitionToSnapshot.hash, nglViewList, stage));
// dispatch(changeSnapshot(sessionProjectID, transitionToSnapshot.hash, nglViewList, stage));
setTryToOpen(false);
}
}, [dispatch, isSnapshotDirty, nglViewList, sessionProjectID, stage, transitionToSnapshot, tryToOpen]);
Expand Down
13 changes: 4 additions & 9 deletions js/components/preview/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import { resetLoadedSnapshots, resetProjectsReducer } from '../../projects/redux
import { resetSelectionState } from '../../../reducers/selection/actions';
import { URLS } from '../../routes/constants';
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';
import { resetViewerControlsState } from '../viewerControls/redux/actions';
// eslint-disable-next-line import/extensions
import { default_squonk_project } from '../../../../package.json';
Expand Down Expand Up @@ -56,7 +53,7 @@ export const shouldLoadProtein = ({

const targetOn = targetIdList.find(target => target.id === targetOnId);

const isRestoring = state.trackingReducers.isActionRestoring;
const isRestoring = false; //state.trackingReducers.isActionRestoring;
if (
targetIdList &&
targetIdList.length > 0 &&
Expand Down Expand Up @@ -90,7 +87,7 @@ export const shouldLoadProtein = ({
(!routeSnapshotID || routeSnapshotID === currentSnapshotID.toString()) &&
isRestoring === true
) {
dispatch(restoreAfterTargetActions(nglViewList, routeProjectID, currentSnapshotID));
// dispatch(restoreAfterTargetActions(nglViewList, routeProjectID, currentSnapshotID));
}

if (targetOn !== undefined) {
Expand Down Expand Up @@ -133,8 +130,8 @@ export const unmountPreviewComponent = (stages = []) => dispatch => {
}
});

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

dispatch(resetCurrentCompoundsSettings(true));
dispatch(resetProjectsReducer());
Expand All @@ -161,8 +158,6 @@ export const resetReducersBetweenSnapshots = (stages = []) => dispatch => {
dispatch(resetLoadedSnapshots());
dispatch(resetSelectionState());
dispatch(resetDatasetsState());
dispatch(resetTrackingState());
dispatch(resetNglTrackingState());
dispatch(setTargetOn(undefined));
dispatch(resetViewerControlsState());
};
Expand Down
21 changes: 0 additions & 21 deletions js/components/preview/tags/withLoadingMolecules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,6 @@ import { compareTagsAsc } from '../tags/utils/tagUtils';

export const withLoadingMolecules = WrappedComponent => {
return memo(({ ...rest }) => {
const dispatch = useDispatch();

const target_on = useSelector(state => state.apiReducers.target_on);
const isTrackingRestoring = useSelector(state => state.trackingReducers.isTrackingCompoundsRestoring);
const isAllDataLoaded = useSelector(state => state.apiReducers.all_data_loaded);

// useEffect(() => {
// if (target_on && !isTrackingRestoring && !isAllDataLoaded) {
// dispatch(loadMoleculesAndTagsNew(target_on));
// }
// }, [dispatch, target_on, isTrackingRestoring, isAllDataLoaded]);

// useEffect(() => {
// if (target_on) {
// getTags(target_on).then(data => {
// const sorted = data.results.sort(compareTagsAsc);
// dispatch(setMoleculeTags(sorted));
// });
// }
// }, [dispatch, target_on]);

return <WrappedComponent {...rest} />;
});
};
Loading

0 comments on commit 26ff98a

Please sign in to comment.