diff --git a/js/components/header/index.js b/js/components/header/index.js index 9a86f3cdf..c7a3b316a 100644 --- a/js/components/header/index.js +++ b/js/components/header/index.js @@ -514,16 +514,6 @@ export default memo( > )} - - } - variant="text" - size="small" - onClick={() => setOpenTrackingModal(true)} - > - Timeline - - diff --git a/js/components/preview/molecule/moleculeView/moleculeView.js b/js/components/preview/molecule/moleculeView/moleculeView.js index 951c8d886..900af8be6 100644 --- a/js/components/preview/molecule/moleculeView/moleculeView.js +++ b/js/components/preview/molecule/moleculeView/moleculeView.js @@ -1034,7 +1034,7 @@ const MoleculeView = memo( if (isDensityOn === false && isDensityCustomOn === false) { dispatch(getDensityMapData(data)).then(r => { if (r) { - dispatch(setDensityModalOpen(true)); + setDensityModalOpen(true); } else { addNewDensity(); } diff --git a/js/components/preview/molecule/redux/dispatchActions.js b/js/components/preview/molecule/redux/dispatchActions.js index 50b7d1f74..ac0044287 100644 --- a/js/components/preview/molecule/redux/dispatchActions.js +++ b/js/components/preview/molecule/redux/dispatchActions.js @@ -868,22 +868,6 @@ export const removeSelectedMolTypes = (majorViewStage, molecules, skipTracking, }); }; -// export const searchMoleculeGroupByMoleculeID = moleculeID => (dispatch, getState) => -// api({ url: `${base_url}/api/molgroup/?mol_id=${moleculeID}` }).then(response => { -// let resultMolGroupID = null; -// const molGroupID = response?.data?.results[0]?.id; -// const mol_group_list = getState().apiReducers.mol_group_list; - -// if (mol_group_list && Array.isArray(mol_group_list) && molGroupID) { -// mol_group_list.forEach((item, index) => { -// if (item.id === molGroupID) { -// resultMolGroupID = index + 1; -// } -// }); -// } -// return Promise.resolve(resultMolGroupID); -// }); - export const applyDirectSelection = stage => (dispatch, getState) => { const state = getState(); @@ -947,44 +931,9 @@ export const getQualityInformation = (data, molType, width, height) => (dispatch export const getProteinData = molecule => dispatch => { return new Promise((resolve, reject) => { resolve(molecule.proteinData); - }); /*dispatch(getProteinDataByMolId(molecule.id, molecule.code));*/ + }); }; -// export const getProteinDataByMolId = (molId, proteinCode) => (dispatch, getState) => { -// const state = getState(); -// const proteindDataCache = state.previewReducers.molecule.proteinDataCache; - -// const molIdStr = molId.toString(); -// if (proteindDataCache.hasOwnProperty(molIdStr)) { -// return new Promise((resolve, reject) => { -// resolve(proteindDataCache[molIdStr]); -// }); -// } else { -// return loadProteinData(proteinCode).then(i => { -// if (!proteindDataCache.hasOwnProperty(molIdStr)) { -// dispatch(addProteindDataToCache(molId.toString(), i)); -// } -// return i; -// }); -// } -// }; - -// const loadProteinData = code => { -// if (code) { -// let url = new URL(`${base_url}/api/proteins/?code=${code}`); -// let onCancel = () => {}; -// return api({ -// url, -// onCancel -// }).then(response => { -// return response.data.results; -// }); -// } else { -// console.error('Trying to load protein data for unknown molecule protein code.'); -// return Promise.resolve(); -// } -// }; - export const getMolImage = (molId, molType, width, height) => (dispatch, getState) => { const state = getState(); diff --git a/js/components/preview/projectHistoryPanel/editSnapshotDialog.js b/js/components/preview/projectHistoryPanel/editSnapshotDialog.js index ff36aa5ca..885fdf016 100644 --- a/js/components/preview/projectHistoryPanel/editSnapshotDialog.js +++ b/js/components/preview/projectHistoryPanel/editSnapshotDialog.js @@ -8,6 +8,8 @@ import { base_url } from '../../routes/constants'; import { api, METHOD } from '../../../utils/api'; import { addToastMessage } from '../../../reducers/selection/actions'; import { TOAST_LEVELS } from '../../toast/constants'; +import { InputFieldAvatar } from '../../projects/projectModal/inputFieldAvatar'; +import { Description, Title } from '@material-ui/icons'; const useStyles = makeStyles(theme => ({ body: { @@ -25,8 +27,8 @@ const useStyles = makeStyles(theme => ({ margin: theme.spacing(1), width: 400 }, - renameTargetPopup: { - width: '300px', + editSnashotPopup: { + width: '600px', borderRadius: '5px', border: '1px solid #000', display: 'flex', @@ -116,7 +118,7 @@ export const EditSnapshotDialog = () => { return ( snapshotToBeEdited && ( - + Edit target @@ -133,34 +135,28 @@ export const EditSnapshotDialog = () => { validate={validate} > {({ submitForm, isSubmitting }) => ( - + - - - Name: - - + } + field={ + + } /> - - - Description: - - + } + field={ + + } /> diff --git a/js/components/preview/redux/dispatchActions.js b/js/components/preview/redux/dispatchActions.js index dcae19abf..980ce9ca3 100644 --- a/js/components/preview/redux/dispatchActions.js +++ b/js/components/preview/redux/dispatchActions.js @@ -27,6 +27,7 @@ const loadProtein = nglView => (dispatch, getState) => { targetData = thisTarget; } }); + if (!targetData.template_protein) return; const targObject = generateProteinObject(targetData); if (targObject) { let newParams = { display_div: nglView.id }; @@ -36,7 +37,7 @@ const loadProtein = nglView => (dispatch, getState) => { return dispatch(loadObject({ target: Object.assign({}, targObject, newParams), stage: nglView.stage })); } } - return Promise.reject('Cannot load Protein to NGL View ID ', nglView.id); + // return Promise.reject('Cannot load Protein to NGL View ID ', nglView.id); }; export const shouldLoadProtein = ({ diff --git a/js/components/projects/addProjectDetail/index.js b/js/components/projects/addProjectDetail/index.js index 36f893ded..9df40d368 100644 --- a/js/components/projects/addProjectDetail/index.js +++ b/js/components/projects/addProjectDetail/index.js @@ -158,8 +158,11 @@ export const AddProjectDetail = memo(({}) => { }); } else { dispatch(createProjectFromSnapshotDialog(data)) - .then(() => dispatch(createNewSnapshot({ ...snapshotData, session_project: data.projectID }))) - .then(() => handleCloseModal()) + .then(() => { + dispatch(createNewSnapshot({ ...snapshotData, session_project: data.projectID })); + handleCloseModal(); + }) + // .then(() => handleCloseModal()) .catch(error => { setState(() => { throw error; diff --git a/js/components/projects/redux/dispatchActions.js b/js/components/projects/redux/dispatchActions.js index bbe8933cb..d9f28d143 100644 --- a/js/components/projects/redux/dispatchActions.js +++ b/js/components/projects/redux/dispatchActions.js @@ -291,9 +291,7 @@ export const loadSnapshotTree = projectID => (dispatch, getState) => { dispatch(setCurrentSnapshotTree(null)); return api({ url: `${base_url}/api/snapshots/?session_project=${projectID}&type=INIT` }) .then(response => { - if (response.data.count === 0) { - return Promise.reject('Not found INITIAL snapshot'); - } else if (response.data.count === 1) { + if (response.data.count > 0) { const tree = parseSnapshotAttributes(response.data.results[0]); dispatch(setCurrentSnapshotTree(tree)); return dispatch(populateChildren([tree.id])); diff --git a/js/components/snapshot/redux/dispatchActions.js b/js/components/snapshot/redux/dispatchActions.js index 4d9569d61..b2ee8a807 100644 --- a/js/components/snapshot/redux/dispatchActions.js +++ b/js/components/snapshot/redux/dispatchActions.js @@ -310,6 +310,8 @@ export const createNewSnapshot = ({ newType = SnapshotType.INIT; // Without this, the snapshot tree wouldnt work dispatch(setForceProjectCreated(false)); + //if it's INIT snapshot than it's a root snapshot of a project so parent MUST be null + parent = null; } return api({