Skip to content

Commit

Permalink
Merge branch 'allfunctionality' into #487
Browse files Browse the repository at this point in the history
  • Loading branch information
ag-m2ms committed Feb 3, 2021
2 parents 717ad54 + 083cc6d commit d9b5895
Show file tree
Hide file tree
Showing 18 changed files with 690 additions and 166 deletions.
265 changes: 142 additions & 123 deletions js/components/datasets/crossReferenceDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,141 +232,160 @@ export const CrossReferenceDialog = memo(
moleculeList
);

if (anchorEl === null) {
dispatch(resetCrossReferenceDialog());
}

return (
<Popper id={id} open={open} anchorEl={anchorEl} placement="left-start" ref={ref}>
<Panel
hasHeader
secondaryBackground
title="Cross Reference"
className={classes.paper}
headerActions={[
<Tooltip title="Close cross reference dialog">
<IconButton
color="inherit"
className={classes.headerButton}
onClick={() => dispatch(resetCrossReferenceDialog())}
<>
{anchorEl && anchorEl !== null && (
<>
<Popper id={id} open={open} anchorEl={anchorEl} placement="left-start" ref={ref}>
<Panel
hasHeader
secondaryBackground
title="Cross Reference"
className={classes.paper}
headerActions={[
<Tooltip title="Close cross reference dialog">
<IconButton
color="inherit"
className={classes.headerButton}
onClick={() => dispatch(resetCrossReferenceDialog())}
>
<Close />
</IconButton>
</Tooltip>
]}
>
<Close />
</IconButton>
</Tooltip>
]}
>
{isLoadingCrossReferenceScores === false && moleculeList && (
<>
<Grid container justify="flex-start" direction="row" className={classes.molHeader} wrap="nowrap">
<Grid item container justify="flex-start" direction="row">
{moleculeList.length > 0 && (
<Grid item>
<Grid
container
direction="row"
justify="flex-start"
alignItems="center"
wrap="nowrap"
className={classes.contButtonsMargin}
>
<Tooltip title="all ligands">
<Grid item>
<Button
variant="outlined"
className={classNames(classes.contColButton, {
[classes.contColButtonSelected]: isLigandOn,
[classes.contColButtonHalfSelected]: isLigandOn === null
})}
onClick={() =>
dispatch(handleAllLigandsOfCrossReferenceDialog(isLigandOn, moleculeList, stage))
}
disabled={false}
>
L
</Button>
</Grid>
</Tooltip>
<Tooltip title="all sidechains">
{isLoadingCrossReferenceScores === false && moleculeList && (
<>
<Grid container justify="flex-start" direction="row" className={classes.molHeader} wrap="nowrap">
<Grid item container justify="flex-start" direction="row">
{moleculeList.length > 0 && (
<Grid item>
<Button
variant="outlined"
className={classNames(classes.contColButton, {
[classes.contColButtonSelected]: isProteinOn,
[classes.contColButtonHalfSelected]: isProteinOn === null
})}
onClick={() =>
dispatch(removeOrAddAllHitProteinsOfList(isProteinOn, moleculeList, stage))
}
disabled={false}
<Grid
container
direction="row"
justify="flex-start"
alignItems="center"
wrap="nowrap"
className={classes.contButtonsMargin}
>
P
</Button>
<Tooltip title="all ligands">
<Grid item>
<Button
variant="outlined"
className={classNames(classes.contColButton, {
[classes.contColButtonSelected]: isLigandOn,
[classes.contColButtonHalfSelected]: isLigandOn === null
})}
onClick={() =>
dispatch(handleAllLigandsOfCrossReferenceDialog(isLigandOn, moleculeList, stage))
}
disabled={false}
>
L
</Button>
</Grid>
</Tooltip>
<Tooltip title="all sidechains">
<Grid item>
<Button
variant="outlined"
className={classNames(classes.contColButton, {
[classes.contColButtonSelected]: isProteinOn,
[classes.contColButtonHalfSelected]: isProteinOn === null
})}
onClick={() =>
dispatch(removeOrAddAllHitProteinsOfList(isProteinOn, moleculeList, stage))
}
disabled={false}
>
P
</Button>
</Grid>
</Tooltip>
<Tooltip title="all interactions">
<Grid item>
{/* C stands for contacts now */}
<Button
variant="outlined"
className={classNames(classes.contColButton, {
[classes.contColButtonSelected]: isComplexOn,
[classes.contColButtonHalfSelected]: isComplexOn === null
})}
onClick={() =>
dispatch(removeOrAddAllComplexesOfList(isComplexOn, moleculeList, stage))
}
disabled={false}
>
C
</Button>
</Grid>
</Tooltip>
</Grid>
</Grid>
</Tooltip>
<Tooltip title="all interactions">
<Grid item>
{/* C stands for contacts now */}
<Button
variant="outlined"
className={classNames(classes.contColButton, {
[classes.contColButtonSelected]: isComplexOn,
[classes.contColButtonHalfSelected]: isComplexOn === null
})}
onClick={() => dispatch(removeOrAddAllComplexesOfList(isComplexOn, moleculeList, stage))}
disabled={false}
>
C
</Button>
</Grid>
</Tooltip>
)}
</Grid>
</Grid>
)}
</Grid>
</Grid>
<div className={classes.content}>
{moleculeList.length > 0 &&
moleculeList.map((data, index, array) => {
let molecule = Object.assign({ isCrossReference: true }, data.molecule);
let previousData = index > 0 && Object.assign({ isCrossReference: true }, array[index - 1]);
let nextData = index < array?.length && Object.assign({ isCrossReference: true }, array[index + 1]);
<div className={classes.content}>
{moleculeList.length > 0 &&
moleculeList.map((data, index, array) => {
let molecule = Object.assign({ isCrossReference: true }, data.molecule);
let previousData = index > 0 && Object.assign({ isCrossReference: true }, array[index - 1]);
let nextData =
index < array?.length && Object.assign({ isCrossReference: true }, array[index + 1]);

return (
<DatasetMoleculeView
key={index}
index={index}
imageHeight={imgHeight}
imageWidth={imgWidth}
data={molecule}
datasetID={data.datasetID}
hideFButton
showDatasetName
previousItemData={previousData}
nextItemData={nextData}
removeOfAllSelectedTypes={removeOfAllSelectedTypes}
L={ligandList.includes(data.id)}
P={proteinList.includes(data.id)}
C={complexList.includes(data.id)}
S={false}
V={false}
/>
);
})}
{!(moleculeList.length > 0) && (
<Grid container justify="center" alignItems="center" direction="row" className={classes.notFound}>
return (
<DatasetMoleculeView
key={index}
index={index}
imageHeight={imgHeight}
imageWidth={imgWidth}
data={molecule}
datasetID={data.datasetID}
hideFButton
showDatasetName
previousItemData={previousData}
nextItemData={nextData}
removeOfAllSelectedTypes={removeOfAllSelectedTypes}
L={ligandList.includes(data.id)}
P={proteinList.includes(data.id)}
C={complexList.includes(data.id)}
S={false}
V={false}
/>
);
})}
{!(moleculeList.length > 0) && (
<Grid
container
justify="center"
alignItems="center"
direction="row"
className={classes.notFound}
>
<Grid item>
<Typography variant="body2">No molecules found!</Typography>
</Grid>
</Grid>
)}
</div>
</>
)}
{isLoadingCrossReferenceScores === true && (
<Grid container alignItems="center" justify="center">
<Grid item>
<Typography variant="body2">No molecules found!</Typography>
<CircularProgress />
</Grid>
</Grid>
)}
</div>
</>
)}
{isLoadingCrossReferenceScores === true && (
<Grid container alignItems="center" justify="center">
<Grid item>
<CircularProgress />
</Grid>
</Grid>
)}
</Panel>
</Popper>
</Panel>
</Popper>
</>
)}
</>
);
})
);
3 changes: 0 additions & 3 deletions js/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ export default memo(
<Grid item>
<IssueReport />
</Grid>
<Grid item>
<IdeaReport />
</Grid>
<Grid item>
<img
src={require('../../img/xchemLogo.png')}
Expand Down
8 changes: 5 additions & 3 deletions js/components/preview/molecule/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,14 @@ export const addLigand = (
});
};

export const removeLigand = (stage, data, skipTracking = false) => dispatch => {
export const removeLigand = (stage, data, skipTracking = false, withVector = true) => dispatch => {
dispatch(deleteObject(Object.assign({ display_div: VIEWS.MAJOR_VIEW }, generateMoleculeObject(data)), stage));
dispatch(removeFromFragmentDisplayList(generateMoleculeId(data), skipTracking));

// remove vector
dispatch(removeVector(stage, data, skipTracking));
if (withVector === true) {
// remove vector
dispatch(removeVector(stage, data, skipTracking));
}
};

/**
Expand Down
4 changes: 2 additions & 2 deletions js/components/preview/viewerControls/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ButtonGroup, Grid, makeStyles, Tooltip } from '@material-ui/core';
import { SettingControls } from './settingsControls';
import DisplayControls from './displayControls/';
import { MouseControls } from './mouseControls';
import { ActionCreators as UndoActionCreators } from 'redux-undo';
import { ActionCreators as UndoActionCreators } from '../../../undoredo/actions';
import {
undoAction,
redoAction,
Expand Down Expand Up @@ -226,7 +226,7 @@ export const ViewerControls = memo(({}) => {
startIcon={<Restore />}
className={classes.buttonMargin}
>
Restore view
Restore clip/slab/centre
</Button>
</Tooltip>
</Grid>
Expand Down
3 changes: 3 additions & 0 deletions js/components/preview/viewerControls/settingsControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { setNglBckGrndColor, setNglClipNear, setNglClipFar, setNglClipDist, setN
import { NglContext } from '../../nglView/nglProvider';
import { VIEWS } from '../../../constants/constants';


const useStyles = makeStyles(theme => ({
root: {
width: '100%',
Expand Down Expand Up @@ -44,6 +45,8 @@ export const SettingControls = memo(({ open, onClose }) => {
}
};



return (
<Drawer title="Settings" open={open} onClose={onClose}>
<Grid container justify="flex-start" direction="column" className={classes.root} spacing={1}>
Expand Down
2 changes: 2 additions & 0 deletions js/components/snapshot/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
setSharedSnapshot,
setSnapshotJustSaved
} from './actions';
import { setDialogCurrentStep } from '../../snapshot/redux/actions';
import { DJANGO_CONTEXT } from '../../../utils/djangoContext';
import {
assignSnapshotToProject,
Expand Down Expand Up @@ -306,6 +307,7 @@ export const createNewSnapshot = ({
dispatch(setOpenSnapshotSavingDialog(false));
dispatch(setIsLoadingSnapshotDialog(false));
dispatch(setSnapshotJustSaved(projectResponse.data.id));
dispatch(setDialogCurrentStep());
}
})
.catch(error => {
Expand Down
Loading

0 comments on commit d9b5895

Please sign in to comment.