Skip to content

Commit

Permalink
Projects (#285)
Browse files Browse the repository at this point in the history
* fix computing size of summary info

* fix bug of saving default scene, reset ngl state during unmounting preview

* add refactor of redux constants

* #2 add autocomplete field for tags

* #3 first draft of issue reporting

* #2 fix validation of select component

* #2 fix tags array

* #3 added URL to LogRocket session into Sentry report on exception

* #3 modified modal window and hooked input fields

* #2 add call api and response actions

* #2 change target property

* #2 change target validation

* #2 open project on given url

* #2 add action of create initial snapshot

* #3 added functionality for getting picture of screen, uploading it to github repo and attaching it to created issue + updated layout of modal form

* #3 add environment variable

* #3 create screenshot before open modal window

* #2 enable to reload project from snapshot

* #3 added form validation

* #3 removed .env from tracking

* #3 added missing styles

* #3 add loading indications when capturing screen and creating issue

* #3 reverted loading

* #2 add snapshot to project

* #2 add load project from snapshot

* #40 remove download Yank button

* #40 remove header of viewer controls, use buttonGroups for viewer controls

* #3 disable all fields on creating issue, added email validation, changed color of button, added info prompt about screen capture, minor fixes, experimental - try to capture just browser tab without cursor

* #40 remove showing vectors in display viewer control, add shadow to viewer controls

* #40 clear the filters after click on Clear selection button

* #40 modify filter dialog (not completed yet)

* #40 apply changes instantly, not on “apply” in sort - filter dialog

* #40 minimise filter/sort dialog

* #40 propagate JS events in filter/sort dialog

* #40 reordering of rows in Settings controls

* #40 move download CSV button to summary info header

* #40 fix hit navigator box size, when I clear filter

* #40 remove unused components

* #3 decomposition of issue report into logic segments

* #3 updated env variable in readme to its proper name

* #3 review modifications, changed axios calls to api

* #3 fixed METHOD referencing

* #3 changed constants prefix to follow path structure, fixed constatnts typo, removed unnecessary log

* #40 close sort dialog after click on clear selection

* #7 added new idea submission, made report form as parent and widen it, removed commented part of code from githubApi

* #58 reordered header bar, show also target name and change cursor to pointer on clickable images

* #3 added also "Cancel" button for preceding dialog of taking a screenshot to have an option to cancel this action

* #48 add not finished table in molecule view

* #48 remove target name from label

* #59 added Janssen into header, changed "Supported by" to be a modal pop up and added there ultra dd, imi, horizon 2020

* #48 move quality labels and title label next to ALCV buttons

* #48 change site number style

* #4 added table with descriptions for mouse controls

* #3 #4 added loading progress to submit button, closing modal is done pure just via cancel button

* #48 add properties header with calculating of window width

* #48 change alignment of grid components in Preview.js

* #48 add count of vectors total (pickable)

* #3 #4 removed "Report error" from the menu, log also version of application into github issues

* #4 typo

* #48 add computation of #cpd property

* #48 fix opening of sort dialog

* #48 fix table rows id

* #48 change size of ALCV buttons

* #48 change size of image in molecule view

* #48 add header of properties

* #48 center the properties

* #48 redesign of molecule view to smallest as possible

* #48 fix count of compounds

* #48 change width of count of compounds property

* #66 change default background color of nglView

* #66 activate first molecule group

* #66 fix padding of quality labels

* #66 add version of app to menu

* #66 Activate first hit of first cluster, display all

* #92 fix layout of grid containers

* #67 testing base64

* #67 add base64 decoding

* #92 remove grid breakpoint of preview component, move breakpoints to css

* #92 change size of control buttons

* #107 not completed fix of compounds spinning wheel

* #107 disable auto check first cluster and molecule

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 add not completed loading images of compounds

* #107 fix of loading images of compounds

* #41 fix showing compound in NGL view

* #41 fix showing compound in NGL view

* #41 fix showing compound in NGL view

* #41 fix compound classes in compounds picker

* #41 fix compound classes in compounds picker

* #41 fix compound classes in compounds picker

* #41 fix compound classes in compounds picker

* #41 fix first compound classes in compounds picker

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix uncheck of compounds

* #41 fix clear selection of compounds

* #41 fix select all compounds

* #41 fix select all compounds

* #108 do not reset paging of molecule list on component update (causes loader to stuck), removed undefined a attribute

* #41 fix indexes of compounds

* #41 fix indexes of compounds

* #41 reset objects from nglView and showedCompoundList

* #41 reset objects from nglView and showedCompoundList

* #41 reset compoundsClasses

* #41 reset compoundsClasses

* #41 reset compoundsClasses

* #41 reset compoundsClasses

* #41 reset highlightedCompoundId, reset configuration

* #41 fix reset compound classes

* #109 changed saving type when sharing snapshot

* #41 fix reset compound classes

* #41 fix reset compound classes

* #109 fixed not working 'Save session as' and 'Share snapshot' buttons on existing session, changed name of saved snapshot from 'undefined' to 'shared snapshot'

* #116 restore preview reducer from session

* #117 add snack bar for error handling

* #117 fix error handling

* #109 modified logic for buttons to work in existing session state, latestSession refers to recently created session and its uuid, added loading for snapshot sharing

* #117 fix error handling

* #117 fix error handling

* #125 remove cpm and vectors properties

* #125 remove clabel with count of compounds

* #125 fix bug of undefined stage

* #125 fix bug of undefined stage

* #125 show title of compounds

* #125 fix undefined stage

* #125 without sending errors to sentry

* reverted handling in errorBoundary and root

* removed all setError()

* #144 without sending errors to sentry

* #144 fix shift + click

* #144 fix axios body data

* removed yarn.lock

* Revert "removed yarn.lock"

This reverts commit 92da24c

* Revert "removed yarn.lock"

This reverts commit 92da24c

remove husky

* comment bad test

* #146 set proper target name

* #144 reset names of colored fields of compounds to pick

* #144 reset names of colored fields of compounds to pick

* #144 reset names of colored fields of compounds to pick in clear selection

* #144 simplify reset compound classes

* #149 changed "Supported by" to "Contributors" and added more entities

* #144 fix disappear of colour fields in compounds to pick

* #144 fix colour fields in compounds to pick

* increase version of app

* added missing log function for console, added setting latestSession for "Save session" to proper complete saving cycle

* #97 add automatic dept queuing

* #155 reduced radius of vectors with some available connections

* #148 changed background color of "A" button in molecule view so it is darker if it has some other options active

* #148 changed background color of "A" button in molecule view so it is darker if it has some other options active

* #148 added hover styling for selected molecule options

* #148 always deselect all control buttons if some is selected on "A" press

* #98 add hide all selected molecules

* #98 hide compound image in shopping cart

* #2 increase version of app

* #2 merge and add small refactoring

* #2 add fixed conflicts

* #2 remove old imports

* #2 reset project reducer after exit from project or target

* add docker configuration for localhost development

* #14 add docker compose for local BE development

* #14 add not completed manual snapshot

* add docker configuration for localhost development

* #14 load projects into table

* #14 enable to create project from scratch

* #14 enable to open project

* #14 enable to simple search for project

* #14 unable to create project without login, project history has expansion card

* #16 create init snapshot and restore from given snapshot

* #16 create init snapshot and restore from given snapshot

* #16 enable to remove project by logged in user

* #16 allow to create manual snapshot

* #16 fix redirecting after creation of manual snapshot

* #16 add validation of snapshot

* #16 fix expansion of project history

* #16 show tree loaded from BE

* #15 add not completed highlighting of selected snapshot in project history

* #15 fix undefined properties

* #15 add completed highlighting of selected snapshot in project history

* #15 fix order of project history tree

* #15 fix undefined value

* #190 Fix inconsistencies - Selecting and reselecting sites

* #246 fixed assigning and removing molecule orientations

* #15 fix method reload session

* #15 disable selection of all molecules when is loaded snapshot

* #15 fix loading of snapshot tree

* #15 remove project with cascade

* #15 create project from opened target

* #15 add not completed creating project from previous snapshot

* #15 add not tested freating of project from existing snapshot

* #15 fix bugs during creating of project from existing snapshot

* #15 fix next bugs during creating of project from existing snapshot

* #9 save initial snapshot only in project mode

* #9 fix loading initial snapshot of empty project

* #9 test without selecting all molecules

* #9 test with selecting all molecules

* #16 share snapshots of projects

* #255 not completed solution of switchings og snapshots in project

* #255 fix switching of snapshots in project

* #255 fix switching of snapshots in project

* #255 fix switching of snapshots in project

* #255 enable to make interaction after switching of snapshots in project

* #256 fix wrong displaying of snapshot details in sharing dialog

* #11 add tooltip of project in project table, fix date of snapshot

* #11 add not completed fix of infinity loop during creating initial snapshot

* #11 add fix of infinity loop during creating initial snapshot

* #11 work with projects with auto selecting first site and all molecules, this feature is kept only in target mode

* #11 test when is called creating initial snapshot method

* #11 fix creating of init snapshot after creating project

* #11 fix creating of init snapshot after creating project

* #261 disable create button during creating project from snapshot

* #16 add modal to save changes before switching snapshots

* #210 fix delay of writing in report dialog

* load only my projects

* enable to load snapshot and project without author

* #276 move share button

* #275 auto create project during save snapshot as anonymous user

* #277 redirect sessions to project's snapshot

* #281 enable to logged in users to make changes and create new snapshot from snapshot, that has anonymous author

* #282 disable to save changes with project, that has no author

* #283 disable to save changes with project for anonymous user

* #283 disable autoselecting al all ligands, after snapshot was loaded

* #283 disable auto selecting of all ligands, after snapshot was loaded

* #283 disable auto selecting of all ligands, after snapshot was loaded

* #278 filter snapshots by assigned project and author

Co-authored-by: matej <matej.vavrek@m2ms.sk>
Co-authored-by: Rachael Skyner <reskyner@googlemail.com>
  • Loading branch information
3 people authored Apr 28, 2020
1 parent a421d1b commit cd06b0a
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 178 deletions.
2 changes: 1 addition & 1 deletion js/components/landing/Landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Landing = memo(
if (DJANGO_CONTEXT['authenticated'] !== true) {
setLoginText(
<>
{'To view own targets login here: '}
{'To view own projects login here: '}
<Link href="/accounts/login" color="inherit" variant="subtitle2">
FedID Login
</Link>
Expand Down
2 changes: 2 additions & 0 deletions js/components/preview/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { HeaderContext } from '../header/headerContext';
import { unmountPreviewComponent } from './redux/dispatchActions';
import { NglContext } from '../nglView/nglProvider';
import { SaveSnapshotBeforeExit } from '../snapshot/modals/saveSnapshotBeforeExit';
import { ModalShareSnapshot } from '../snapshot/modals/modalShareSnapshot';
//import HotspotList from '../hotspot/hotspotList';

const hitNavigatorWidth = 504;
Expand Down Expand Up @@ -158,6 +159,7 @@ const Preview = memo(({ isStateLoaded, hideProjects }) => {
</Grid>*/}
</Grid>
<NewSnapshotModal />
<ModalShareSnapshot />
<SaveSnapshotBeforeExit />
{!hideProjects && <ProjectDetailDrawer showHistory={showHistory} setShowHistory={setShowHistory} />}
</>
Expand Down
10 changes: 8 additions & 2 deletions js/components/preview/molecule/moleculeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
addLigand,
removeLigand
} from './redux/dispatchActions';
import { useRouteMatch } from 'react-router-dom';

const useStyles = makeStyles(theme => ({
container: {
Expand Down Expand Up @@ -214,6 +215,8 @@ const MoleculeList = memo(
const [currentPage, setCurrentPage] = useState(0);
const imgHeight = 34;
const imgWidth = 150;
let match = useRouteMatch();
const target = match && match.params && match.params.target;

const [predefinedFilter, setPredefinedFilter] = useState(filter !== undefined ? filter.predefined : DEFAULT_FILTER);

Expand Down Expand Up @@ -269,7 +272,8 @@ const MoleculeList = memo(
cached_mol_lists[mol_group_on] &&
firstLoadRef &&
firstLoadRef.current &&
hideProjects
hideProjects &&
target !== undefined
) {
console.log('initializing molecules');
firstLoadRef.current = false;
Expand All @@ -289,7 +293,9 @@ const MoleculeList = memo(
target_on,
setCachedMolLists,
cached_mol_lists,
dispatch
dispatch,
hideProjects,
target
]);

const listItemOffset = (currentPage + 1) * moleculesPerPage;
Expand Down
65 changes: 3 additions & 62 deletions js/components/preview/projectHistory/index.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
import React, { memo, useContext, useEffect, useRef } from 'react';
import { Panel } from '../../common/Surfaces/Panel';
import {
Grid,
IconButton,
Typography,
Table,
TableBody,
TableRow,
TableCell,
TableHead,
makeStyles
} from '@material-ui/core';
import { templateExtend, TemplateName, Orientation, Gitgraph } from '@gitgraph/react';
import { MergeType, Share } from '@material-ui/icons';
import { MergeType } from '@material-ui/icons';
import { makeStyles } from '@material-ui/core';
import { Button } from '../../common/Inputs/Button';
import { useDispatch, useSelector } from 'react-redux';
import { useHistory, useRouteMatch } from 'react-router-dom';
import { base_url, URLS } from '../../routes/constants';
import { loadSnapshotTree } from '../../projects/redux/dispatchActions';
import palette from '../../../theme/palette';
import { ModalShareSnapshot } from '../../snapshot/modals/modalShareSnapshot';
import { setIsOpenModalBeforeExit, setSelectedSnapshotToSwitch, setSharedSnapshot } from '../../snapshot/redux/actions';
import { resetReducersBetweenSnapshots, switchBetweenSnapshots } from '../redux/dispatchActions';
import { setIsOpenModalBeforeExit, setSelectedSnapshotToSwitch } from '../../snapshot/redux/actions';
import { NglContext } from '../../nglView/nglProvider';

export const heightOfProjectHistory = '164px';
Expand Down Expand Up @@ -86,11 +74,7 @@ export const ProjectHistory = memo(({ setHeight, showFullHistory }) => {
let match = useRouteMatch();
const projectID = match && match.params && match.params.projectId;
const snapshotId = match && match.params && match.params.snapshotId;

const currentProjectID = useSelector(state => state.projectReducers.currentProject.projectID);
const currentSnapshotID = useSelector(state => state.projectReducers.currentSnapshot.id);
const currentSnapshotTitle = useSelector(state => state.projectReducers.currentSnapshot.title);
const currentSnapshotDescription = useSelector(state => state.projectReducers.currentSnapshot.description);
const currentSnapshotList = useSelector(state => state.projectReducers.currentSnapshotList);
const currentSnapshotTree = useSelector(state => state.projectReducers.currentSnapshotTree);
const isLoadingTree = useSelector(state => state.projectReducers.isLoadingTree);
Expand Down Expand Up @@ -146,23 +130,6 @@ export const ProjectHistory = memo(({ setHeight, showFullHistory }) => {
hasHeader
title="Project History"
headerActions={[
<Button
color="inherit"
variant="text"
size="small"
startIcon={<Share />}
onClick={() => {
dispatch(
setSharedSnapshot({
title: currentSnapshotTitle,
description: currentSnapshotDescription,
url: `${base_url}${URLS.projects}${currentProjectID}/${currentSnapshotID}`
})
);
}}
>
Share
</Button>,
<Button color="inherit" variant="text" size="small" onClick={showFullHistory} startIcon={<MergeType />}>
Detail
</Button>
Expand Down Expand Up @@ -202,33 +169,7 @@ export const ProjectHistory = memo(({ setHeight, showFullHistory }) => {
</Gitgraph>
)}
</div>
{/*<Grid item>*/}
{/* <Table>*/}
{/* <TableHead>*/}
{/* <TableRow>*/}
{/* <TableCell>Title</TableCell>*/}
{/* <TableCell align="right">Author</TableCell>*/}
{/* <TableCell align="right">Created</TableCell>*/}
{/* </TableRow>*/}
{/* </TableHead>*/}
{/* <TableBody>*/}
{/* <TableRow>*/}
{/* <TableCell component="th" scope="row">*/}
{/* {snapshotDetail.name}*/}
{/* </TableCell>*/}
{/* <TableCell align="right">*/}
{/* {snapshotDetail.author && snapshotDetail.author.username},*/}
{/* {snapshotDetail.author && snapshotDetail.author.email}*/}
{/* </TableCell>*/}
{/* <TableCell align="right">*/}
{/* {snapshotDetail.created && moment(snapshotDetail.created).format('LLL')}*/}
{/* </TableCell>*/}
{/* </TableRow>*/}
{/* </TableBody>*/}
{/* </Table>*/}
{/*</Grid>*/}
</Panel>
<ModalShareSnapshot />
</>
);
});
4 changes: 2 additions & 2 deletions js/components/projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import moment from 'moment';
import { setProjectModalOpen } from './redux/actions';
import { useDispatch, useSelector } from 'react-redux';
import { ProjectModal } from './projectModal';
import { loadListOfProjects, removeProject, searchInProjects } from './redux/dispatchActions';
import { loadListOfAllProjects, removeProject, searchInProjects } from './redux/dispatchActions';
import { DJANGO_CONTEXT } from '../../utils/djangoContext';

const useStyles = makeStyles(theme => ({
Expand Down Expand Up @@ -58,7 +58,7 @@ export const Projects = memo(({}) => {
});

useEffect(() => {
dispatch(loadListOfProjects()).catch(error => {
dispatch(loadListOfAllProjects()).catch(error => {
throw new Error(error);
});
}, [dispatch]);
Expand Down
10 changes: 9 additions & 1 deletion js/components/projects/projectPreview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { useRouteMatch } from 'react-router-dom';
import { loadCurrentSnapshotByID, loadSnapshotByProjectID } from '../redux/dispatchActions';
import { HeaderContext } from '../../header/headerContext';
import { DJANGO_CONTEXT } from '../../../utils/djangoContext';

export const ProjectPreview = memo(({}) => {
const { setSnackBarTitle } = useContext(HeaderContext);
Expand All @@ -14,6 +15,7 @@ export const ProjectPreview = memo(({}) => {
const projectId = match && match.params && match.params.projectId;
const snapshotId = match && match.params && match.params.snapshotId;
const currentSnapshotID = useSelector(state => state.projectReducers.currentSnapshot.id);
const currentProject = useSelector(state => state.projectReducers.currentProject);

useEffect(() => {
if (!snapshotId && currentSnapshotID === null) {
Expand Down Expand Up @@ -57,6 +59,12 @@ export const ProjectPreview = memo(({}) => {
}

return canShow === true && isSnapshotLoaded.current !== undefined ? (
<Preview isStateLoaded={isSnapshotLoaded.current !== null} />
<Preview
isStateLoaded={isSnapshotLoaded.current !== null}
hideProjects={
DJANGO_CONTEXT['pk'] === undefined ||
(DJANGO_CONTEXT['pk'] !== undefined && (currentProject.projectID === null || currentProject.authorID === null))
}
/>
) : null;
});
3 changes: 2 additions & 1 deletion js/components/projects/redux/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const constants = {

export const ProjectCreationType = {
NEW: 'NEW',
FROM_SNAPSHOT: 'FROM_SNAPSHOT'
FROM_SNAPSHOT: 'FROM_SNAPSHOT',
READ_ONLY: 'READ_ONLY'
};

export const SnapshotType = {
Expand Down
27 changes: 19 additions & 8 deletions js/components/projects/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { base_url, URLS } from '../../routes/constants';
import { setDialogCurrentStep } from '../../snapshot/redux/actions';
import { createInitSnapshotFromCopy, getListOfSnapshots } from '../../snapshot/redux/dispatchActions';
import { SnapshotType } from './constants';
import { DJANGO_CONTEXT } from '../../../utils/djangoContext';

export const assignSnapshotToProject = ({ projectID, snapshotID, ...rest }) => (dispatch, getState) => {
dispatch(resetCurrentSnapshot());
Expand Down Expand Up @@ -47,16 +48,26 @@ export const assignSnapshotToProject = ({ projectID, snapshotID, ...rest }) => (
});
};

export const loadListOfProjects = () => (dispatch, getState) => {
return api({ url: `${base_url}/api/session-projects/` }).then(response =>
dispatch(setListOfProjects((response && response.data && response.data.results) || []))
);
export const loadListOfAllProjects = () => (dispatch, getState) => {
const userID = DJANGO_CONTEXT['pk'] || null;
if (userID !== null) {
return api({ url: `${base_url}/api/session-projects/?author=${userID}` }).then(response =>
dispatch(setListOfProjects((response && response.data && response.data.results) || []))
);
} else {
return Promise.resolve();
}
};

export const searchInProjects = title => (dispatch, getState) => {
return api({ url: `${base_url}/api/session-projects/?title=${title}` }).then(response =>
dispatch(setListOfProjects((response && response.data && response.data.results) || []))
);
const userID = DJANGO_CONTEXT['pk'] || null;
if (userID !== null) {
return api({ url: `${base_url}/api/session-projects/?author=${userID}&title=${title}` }).then(response =>
dispatch(setListOfProjects((response && response.data && response.data.results) || []))
);
} else {
return Promise.resolve();
}
};

export const removeSnapshotByID = snapshotID => dispatch => {
Expand Down Expand Up @@ -97,7 +108,7 @@ export const removeProject = projectID => dispatch => {
.then(() => dispatch(removeSnapshotTree(projectID)))
.then(() =>
api({ url: `${base_url}/api/session-projects/${projectID}/`, method: METHOD.DELETE }).then(() =>
dispatch(loadListOfProjects())
dispatch(loadListOfAllProjects())
)
)
.finally(() => {
Expand Down
2 changes: 2 additions & 0 deletions js/components/routes/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { HeaderContext } from '../header/headerContext';
import { Close } from '@material-ui/icons';
import { Projects } from '../projects';
import { ProjectDetailSessionList } from '../projects/projectDetailSessionList';
import { SessionRedirect } from '../snapshot/sessionRedirect';

const useStyles = makeStyles(theme => ({
content: {
Expand Down Expand Up @@ -49,6 +50,7 @@ const Routes = memo(() => {
<Route exact path={URLS.management} component={Management} />
<Route exact path="/viewer/react/fraginpect" component={Tindspect} />
<Route exact path={URLS.landing} component={Landing} />
<Route exact path={`${URLS.sessions}:sessionUUID`} component={SessionRedirect} />
<Route
exact
path={`${URLS.target}:target`}
Expand Down
10 changes: 9 additions & 1 deletion js/components/snapshot/downloadPdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import { Button } from '@material-ui/core';
import FileSaver from 'file-saver';
import { api } from '../../utils/api';
import { CloudDownload, Loop } from '@material-ui/icons';
import { useDisableUserInteraction } from '../helpers/useEnableUserInteracion';

const DownloadPdb = memo(({ targetOn, targetOnName, key }) => {
const [downloading, setDownloading] = useState(false);
const disableUserInteraction = useDisableUserInteraction();

const handlePdbDownload = async () => {
setDownloading(true);
Expand Down Expand Up @@ -67,7 +69,13 @@ const DownloadPdb = memo(({ targetOn, targetOnName, key }) => {
);
} else {
return (
<Button key={key} color="primary" onClick={handlePdbDownload} startIcon={<CloudDownload />}>
<Button
key={key}
color="primary"
disabled={disableUserInteraction}
onClick={handlePdbDownload}
startIcon={<CloudDownload />}
>
Download structures
</Button>
);
Expand Down
5 changes: 4 additions & 1 deletion js/components/snapshot/modals/newSnapshotModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';
import { setOpenSnapshotSavingDialog } from '../redux/actions';
import { NewSnapshotForm } from './newSnapshotForm';
import { AddProjectDetail } from '../../projects/addProjectDetail';
import { DJANGO_CONTEXT } from '../../../utils/djangoContext';

export const NewSnapshotModal = memo(({}) => {
const dispatch = useDispatch();
Expand All @@ -17,7 +18,9 @@ export const NewSnapshotModal = memo(({}) => {

return (
<Modal open={openSavingDialog}>
{!projectID && dialogCurrentStep === 0 && <AddProjectDetail handleCloseModal={handleCloseModal} />}
{!projectID && dialogCurrentStep === 0 && DJANGO_CONTEXT['pk'] && (
<AddProjectDetail handleCloseModal={handleCloseModal} />
)}
{projectID && <NewSnapshotForm handleCloseModal={handleCloseModal} />}
</Modal>
);
Expand Down
Loading

0 comments on commit cd06b0a

Please sign in to comment.