Skip to content

Commit 137f648

Browse files
- additional fixes from #1321 (#405)
1 parent c3626b0 commit 137f648

File tree

4 files changed

+50
-19
lines changed

4 files changed

+50
-19
lines changed

docker-compose.dev.vector.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ services:
106106
PROXY_FORWARDED_PROTO_HEADER: 'http'
107107
LEGACY_URL: 'https://fragalysis.diamond.ac.uk'
108108
DEPLOYMENT_MODE: 'development'
109+
# INFECTIONS: 'structure-download'
109110
depends_on:
110111
database:
111112
condition: service_healthy

js/components/preview/molecule/redux/dispatchActions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,10 +428,10 @@ export const addDensityCustomView = (
428428
// dispatch(setNglViewParams(NGL_PARAMS.contour_DENSITY, invertedWireframe));
429429
// dispatch(setNglViewParams(NGL_PARAMS.contour_DENSITY_MAP_sigmaa, invertedWireframe));
430430
// dispatch(setNglViewParams(NGL_PARAMS.contour_DENSITY_MAP_diff, invertedWireframe));
431+
} else {
432+
await dispatch(getDensityMapData(data));
433+
return dispatch(setDensityCustom(stage, data, colourToggle, isWireframeStyle, skipTracking, representations));
431434
}
432-
433-
await dispatch(getDensityMapData(data));
434-
return dispatch(setDensityCustom(stage, data, colourToggle, isWireframeStyle, skipTracking, representations));
435435
// dispatch(setNglViewParams(NGL_PARAMS.contour_DENSITY, invertedWireframe));
436436
// dispatch(setNglViewParams(NGL_PARAMS.contour_DENSITY_MAP_sigmaa, invertedWireframe));
437437
// dispatch(setNglViewParams(NGL_PARAMS.contour_DENSITY_MAP_diff, invertedWireframe));

js/components/snapshot/modals/downloadStructuresDialog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,9 @@ export const DownloadStructureDialog = memo(({}) => {
357357
setZipPreparing(false);
358358
console.log(JSON.stringify(e?.response?.data));
359359
let errorMessage = '';
360-
if (e?.response?.data?.error) {
360+
if (e?.response?.data?.message) {
361361
setBackendError(true);
362-
errorMessage = `Download failed, with backend error ${e.response.data[0].error}. Please contact administrator.`;
362+
errorMessage = `Download failed, with backend error '${e?.response?.data?.message}'. Please contact administrator.`;
363363
} else {
364364
setGeneralError(true);
365365
errorMessage = 'Downoad failed, please try again later. If error persists, contact administrator';

js/reducers/tracking/dispatchActions.js

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ const saveActionsList = (project, snapshot, actionList, nglViewList) => async (d
336336
// getCollection(currentQualities),
337337
// currentActions
338338
// );
339-
getCurrentActionList(
339+
getCurrentActionListDensity(
340340
orderedActionList,
341341
actionType.DENSITY_TURNED_ON,
342342
getCollection(currentDensities),
@@ -348,8 +348,8 @@ const saveActionsList = (project, snapshot, actionList, nglViewList) => async (d
348348
getCollection(selectedMolecules),
349349
currentActions
350350
);
351-
getCurrentActionList(orderedActionList, actionType.DENSITY_TYPE_ON, currentDensitiesType, currentActions);
352-
getCurrentActionList(
351+
getCurrentActionListDensity(orderedActionList, actionType.DENSITY_TYPE_ON, currentDensitiesType, currentActions);
352+
getCurrentActionListDensity(
353353
orderedActionList,
354354
actionType.DENSITY_CUSTOM_TURNED_ON,
355355
getCollection(currentDensitiesCustom),
@@ -632,6 +632,20 @@ const getCurrentActionList = (orderedActionList, type, collection, currentAction
632632
}
633633
};
634634

635+
const getCurrentActionListDensity = (orderedActionList, type, collection, currentActions) => {
636+
let actionList = orderedActionList.filter(action => action.type === type);
637+
638+
if (collection) {
639+
collection.forEach(data => {
640+
const action = actionList.find(a => a.object_id === data.id && a.dataset_id === data.datasetId);
641+
642+
if (action) {
643+
currentActions.push({ ...action });
644+
}
645+
});
646+
}
647+
};
648+
635649
const getCommonLastActionByType = (orderedActionList, type, currentActions) => {
636650
let action = orderedActionList.find(action => action.type === type);
637651
if (action) {
@@ -1964,11 +1978,15 @@ const removeTypeCompound = {
19641978
surface: removeDatasetSurface
19651979
};
19661980

1967-
const addNewType = (moleculesAction, actionType, type, stage, state, skipTracking = false) => async dispatch => {
1981+
const addNewType = (moleculesAction, actionType, type, stage, state, skipTracking = false) => async (
1982+
dispatch,
1983+
getState
1984+
) => {
19681985
let actions = moleculesAction.filter(action => action.type === actionType);
19691986
if (actions) {
19701987
for (const action of actions) {
1971-
let data = getMolecule(action.object_name, state);
1988+
const freshState = getState();
1989+
let data = getMolecule(action.object_name, freshState);
19721990
if (data) {
19731991
if (type === 'ligand') {
19741992
await dispatch(addType[type](stage, data, colourList[data.id % colourList.length], true, true, skipTracking));
@@ -1980,19 +1998,31 @@ const addNewType = (moleculesAction, actionType, type, stage, state, skipTrackin
19801998
if (!data.proteinData) {
19811999
await dispatch(getProteinData(data)).then(i => {
19822000
const proteinData = i;
1983-
data.proteinData = proteinData;
2001+
if (type === 'density') {
2002+
data.proteinData = proteinData;
2003+
data.proteinData.render_event = !!action.render_event;
2004+
data.proteinData.render_diff = !!action.render_diff;
2005+
data.proteinData.render_sigmaa = !!action.render_sigmaa;
2006+
data.proteinData.render_quality = !!action.render_quality;
2007+
}
2008+
});
2009+
if (type === 'density') {
2010+
await dispatch(addType[type](stage, data, colourList[data.id % colourList.length], true, skipTracking));
2011+
} else {
2012+
await dispatch(addType[type](stage, data, colourList[data.id % colourList.length], true, skipTracking));
2013+
}
2014+
} else {
2015+
if (type === 'density') {
19842016
data.proteinData.render_event = !!action.render_event;
19852017
data.proteinData.render_diff = !!action.render_diff;
19862018
data.proteinData.render_sigmaa = !!action.render_sigmaa;
19872019
data.proteinData.render_quality = !!action.render_quality;
1988-
});
1989-
await dispatch(addType[type](stage, data, colourList[data.id % colourList.length], true, skipTracking));
1990-
} else {
1991-
data.proteinData.render_event = !!action.render_event;
1992-
data.proteinData.render_diff = !!action.render_diff;
1993-
data.proteinData.render_sigmaa = !!action.render_sigmaa;
1994-
data.proteinData.render_quality = !!action.render_quality;
1995-
await dispatch(addType[type](stage, data, colourList[data.id % colourList.length], true, skipTracking));
2020+
}
2021+
if (type === 'density') {
2022+
await dispatch(addType[type](stage, data, colourList[data.id % colourList.length], true, skipTracking));
2023+
} else {
2024+
await dispatch(addType[type](stage, data, colourList[data.id % colourList.length], true, skipTracking));
2025+
}
19962026
}
19972027
} else if (type === 'quality') {
19982028
await dispatch(removeType[type](stage, data, colourList[data.id % colourList.length], skipTracking));

0 commit comments

Comments
 (0)