Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1551 #459

Merged
merged 6 commits into from
Nov 26, 2024
Merged

#1551 #459

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions js/components/datasets/inspirationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import GroupNglControlButtonsContext from '../preview/molecule/groupNglControlBu

const useStyles = makeStyles(theme => ({
paper: {
width: 472,
height: 294,
width: 505,
// height: 294,
overflowY: 'hidden'
},
molHeader: {
Expand Down Expand Up @@ -382,11 +382,11 @@ export const InspirationDialog = memo(
<>
<Grid container justifyContent="flex-start" direction="row" className={classes.molHeader} wrap="nowrap">
<Grid item container justifyContent="flex-start" direction="row">
{Object.keys(moleculeProperty).map(key => (
{/* {Object.keys(moleculeProperty).map(key => (
<Grid item key={key} className={classes.rightBorder}>
{moleculeProperty[key]}
</Grid>
))}
))} */}
{allSelectedMolecules.length > 0 && (
<Grid item>
<Grid
Expand Down
4 changes: 2 additions & 2 deletions js/components/preview/molecule/moleculeView/moleculeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const useStyles = makeStyles(theme => ({
image: {
border: 'solid 1px',
borderColor: theme.palette.background.divider,
borderStyle: 'solid solid solid none',
borderStyle: 'none none none solid',
position: 'relative'
},
imageMargin: {
Expand Down Expand Up @@ -1203,7 +1203,7 @@ const MoleculeView = memo(
</Grid>
<Grid item container className={classes.detailsCol} justifyContent="space-between" direction="row">
<Grid item container direction="column" alignItems="center" xs>
<Grid item container justifyContent="flex-start" alignItems="center" direction="row">
<Grid item container justifyContent="flex-start" alignItems="center" direction="row" xs>
<Grid item container justifyContent="space-between" direction="column" xs={3}>
{/* Title label */}
<Tooltip title={data.prefix_tooltip ?? '-' + (data.id === pose?.main_site_observation ? " - main observation" : "")} placement="bottom-start">
Expand Down
38 changes: 30 additions & 8 deletions js/components/preview/molecule/observationCmpList.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ const useStyles = makeStyles(theme => ({
//color: theme.palette.black
}
},
selectButton: {
padding: '4px 2px !important'
},
formControl: {
color: 'inherit',
margin: theme.spacing(1),
Expand Down Expand Up @@ -416,10 +419,29 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
const filterRef = useRef();
const tagEditorRef = useRef();
const scrollBarRef = useRef();
const hitNavigatorRef = useRef();
const [tagEditorAnchorEl, setTagEditorAnchorEl] = useState(null);
const [hitNavigatorWidth, setHitNavigatorWidth] = useState(0);

const areLSHCompoundsInitialized = useSelector(state => state.selectionReducers.areLSHCompoundsInitialized);

useEffect(() => {
if (hitNavigatorRef && hitNavigatorRef.current) {

const resizeObserver = new ResizeObserver(() => {
if (hitNavigatorRef.current.offsetWidth !== hitNavigatorWidth) {
setHitNavigatorWidth(hitNavigatorRef.current.offsetWidth);
}
});

resizeObserver.observe(hitNavigatorRef.current);

return function cleanup() {
resizeObserver.disconnect();
}
}
}, [hitNavigatorRef, hitNavigatorWidth]);

if (directDisplay && directDisplay.target) {
target = directDisplay.target;
}
Expand Down Expand Up @@ -1060,7 +1082,7 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
};

return (
<Panel hasHeader title="Hit navigator" headerActions={actions}>
<Panel hasHeader title="Hit navigator" headerActions={actions} ref={hitNavigatorRef}>
<AlertModal
title="Are you sure?"
description={`Loading of ${joinedMoleculeLists?.length} may take a long time`}
Expand Down Expand Up @@ -1200,7 +1222,7 @@ export const ObservationCmpList = memo(({ hideProjects }) => {

{
<Tooltip title={selectAllHitsPressed ? 'Unselect all hits' : 'Select all hits'}>
<Grid item style={{ marginLeft: '5px' }}>
<Grid item style={{ marginLeft: '2px' }} className={classes.selectButton}>
<Button
variant="outlined"
className={classNames(classes.contColButton, {
Expand All @@ -1220,7 +1242,7 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
}
{selectedDisplayHits === true ? (
<Tooltip title={'Unselect displayed hits'}>
<Grid item style={{ marginLeft: '5px' }}>
<Grid item className={classes.selectButton}>
<Button
variant="outlined"
className={classNames(classes.contColButton, {
Expand All @@ -1239,7 +1261,7 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
</Tooltip>
) : (
<Tooltip title={'Select displayed hits'}>
<Grid item style={{ marginLeft: '5px' }}>
<Grid item className={classes.selectButton}>
<Button
variant="outlined"
className={classNames(classes.contColButton, {
Expand All @@ -1258,11 +1280,11 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
</Tooltip>
)}
<Grid style={{ marginTop: '4px' }}>
<Typography variant="caption" className={classes.noOfSelectedHits}>{`Selected: ${allSelectedMolecules ? allSelectedMolecules.length : 0
<Typography variant="caption">{`Selected: ${allSelectedMolecules ? allSelectedMolecules.length : 0
}`}</Typography>
</Grid>
<Grid style={{ marginTop: '4px' }}>
<Typography variant="caption" className={classes.noOfSelectedHits}>Sort by</Typography>
<Typography variant="caption" style={{ paddingLeft: 3 }}>Sort by</Typography>
</Grid>
<Grid style={{ marginTop: '4px', marginLeft: '4px' }}>
<Tooltip title={sortOption ? sortOptions[sortOption].title : "Sort by"}>
Expand All @@ -1283,8 +1305,8 @@ export const ObservationCmpList = memo(({ hideProjects }) => {
</Grid>
<Tooltip title={ascending ? "Ascending" : "Descending"}>
<Grid style={{ marginTop: '4px' }}>
<Checkbox checked={ascending} onChange={handleAscendingChecked} size="small" style={{ padding: 3 }} />
<Typography variant="caption" className={classes.noOfSelectedHits}>ASC</Typography>
<Checkbox checked={ascending} onChange={handleAscendingChecked} size="small" style={{ padding: 0 }} />
<Typography variant="caption">{(selectAllHitsPressed && hitNavigatorWidth > 508) || (!selectAllHitsPressed && hitNavigatorWidth > 491) ? 'Ascending' : 'ASC'}</Typography>
</Grid>
</Tooltip>
</Grid>
Expand Down
4 changes: 2 additions & 2 deletions js/components/preview/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const extractTargetFromURLParam = param => {

export const getProjectsForTarget = (target, projectsList) => {
let result = null;
if (target && projectsList && target.project_id && target.project_id.length > 0) {
const projects = projectsList.filter(project => target.project_id.includes(project.id));
if (target && projectsList && target.project && target.project.length > 0) {
const projects = projectsList.filter(project => target.project.includes(project.id));
result = [...projects];
}
return result;
Expand Down
2 changes: 1 addition & 1 deletion js/components/projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ export const Projects = memo(({ }) => {
</TableCell>
</Tooltip>
<TableCell align="left" style={{ minWidth: '100px', padding: '0px 10px 0px 0px', margin: '0px' }}>
<Link to={`${URLS.target}${project.target}`}>
<Link to={`${URLS.target}${project.target.title}`}>
<div>{project.target.title === undefined ? project.target : project.target.title}</div>
</Link>
</TableCell>
Expand Down
16 changes: 9 additions & 7 deletions js/components/snapshot/modals/downloadStructuresDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const createFlagObjectFromFlagList = flagList => {
);
};

export const DownloadStructureDialog = memo(({}) => {
export const DownloadStructureDialog = memo(({ }) => {
const newDownload = '--- NEW DOWNLOAD ---';
const dispatch = useDispatch();
const classes = useStyles();
Expand All @@ -147,6 +147,7 @@ export const DownloadStructureDialog = memo(({}) => {
const taggedMolecules = useSelector(state => selectJoinedMoleculeList(state));
const downloadTags = useSelector(state => state.apiReducers.downloadTags);
const currentSnapshot = useSelector(state => state.projectReducers.currentSnapshot);
const currentProject = useSelector(state => state.targetReducers.currentProject);

const [structuresSelection, setStructuresSelection] = useState('allStructures');

Expand Down Expand Up @@ -236,6 +237,7 @@ export const DownloadStructureDialog = memo(({}) => {
} else {
requestObject = {
target_name: targetName,
target_access_string: currentProject?.target_access_string,
proteins: proteinNames,
...mapFiles,
...crystallographicFiles,
Expand All @@ -253,12 +255,12 @@ export const DownloadStructureDialog = memo(({}) => {
const prepareDownloadClicked = () => async (dispatch, getState) => {
const options = { link: { linkAction: downloadStructuresZip, linkText: 'Click to Download', linkParams: [] } };
if (selectedDownload !== newDownload) {
const donwloadTag = findDownload(selectedDownload);
if (donwloadTag) {
const downloadTag = findDownload(selectedDownload);
if (downloadTag) {
setGeneralError(false);
setZipPreparing(true);
setAlreadyInProgress(false);
getDownloadStructuresUrl(donwloadTag.additional_info.requestObject)
getDownloadStructuresUrl(downloadTag.additional_info.requestObject)
.then(resp => {
if (resp.status === 208) {
//same download is already preparing for someone else
Expand All @@ -276,7 +278,7 @@ export const DownloadStructureDialog = memo(({}) => {
if (resp) {
const fileSizeInBytes = resp.headers['content-length'];
setFileSize(getFileSizeString(fileSizeInBytes));
const url = generateUrlFromTagName(donwloadTag.tag);
const url = generateUrlFromTagName(downloadTag.tag);
options.link.linkParams = [url];
setDownloadTagUrl(url);
setZipPreparing(false);
Expand Down Expand Up @@ -534,8 +536,8 @@ export const DownloadStructureDialog = memo(({}) => {
<Grid item>
<Select className={classes.select} value={selectedDownload} onChange={onUpdateExistingDownload}>
<MenuItem value={newDownload}>{newDownload}</MenuItem>
{downloadTags.map(dt => (
<MenuItem value={dt.additional_info.downloadName}>{dt.additional_info.downloadName}</MenuItem>
{downloadTags.map((dt, index) => (
<MenuItem key={index} value={dt.additional_info.downloadName}>{dt.additional_info.downloadName}</MenuItem>
))}
</Select>
</Grid>
Expand Down
25 changes: 13 additions & 12 deletions js/components/target/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,19 @@ export const getTargetProjectCombinations = (targets, projects) => {
targetItems.forEach(([targetId, target]) => {
if (!target.isLegacy) {
const updatedTarget = target;
target.project_id.forEach(projectId => {
const project = projects.find(project => project.id === projectId);
// const project = projects[projectId];
if (project) {
updatedTarget.project = project;
result.push({ updatedTarget });
} else {
console.log(
`User don't have access to project ${projectId} which is associated with target ${target.title}`
);
}
});
console.log('target.project', target.project);
// TODO debug this?
const projectId = typeof target.project === 'object' ? target.project.id : target.project;
const project = projects.find(project => project.id === projectId);
// const project = projects[projectId];
if (project) {
updatedTarget.project = project;
result.push({ updatedTarget });
} else {
console.log(
`User don't have access to project ${projectId} which is associated with target ${target.title}`
);
}
} else {
result.push({ updatedTarget: { ...target, project: { target_access_string: 'Legacy' } } });
}
Expand Down
3 changes: 2 additions & 1 deletion js/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export const NON_ASSIGNABLE_CATEGORIES = [
'CanonSites',
'CrystalformSites',
'Quatassemblies',
'Crystalforms'
'Crystalforms',
'Pose'
];

export const PLURAL_TO_SINGULAR = {
Expand Down
Loading