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

Fix 871 fix extraction popup after curation complete #873

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ describe('Ingestion', () => {
beforeEach(() => {
cy.clearLocalStorage();
cy.intercept('GET', 'https://api.appzi.io/**', { fixture: 'appzi' }).as('appziFixture');
cy.intercept('GET', `**/api/meta-analyses*`, { fixture: 'metaAnalyses' }).as(
'metaAnalysesFixture'
);
cy.intercept('GET', `**/api/meta-analyses*`, { fixture: 'metaAnalyses' }).as('metaAnalysesFixture');

cy.intercept('POST', `https://www.google-analytics.com/*/**`, {}).as(
'googleAnalyticsFixture'
);
cy.intercept('POST', `https://www.google-analytics.com/*/**`, {}).as('googleAnalyticsFixture');

cy.intercept('GET', `**/api/projects/*`, {
fixture: 'IngestionFixtures/projectFixture',
Expand Down Expand Up @@ -48,9 +44,7 @@ describe('Ingestion', () => {

it('should show the dialog', () => {
cy.login('mocked').visit(PATH);
cy.contains('button', 'go to extraction').click();

cy.contains('button', 'extraction: get started').click();
cy.contains('button', 'go to extraction').click(); // popup should open automatically as extraction has not been initialized in this mock
cy.contains('button', 'NEXT').click();

cy.get('@baseStudiesFixture').its('request.body').should('not.have.a.property', 'doi');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,13 @@ const BaseNavigation: React.FC = (_props) => {
</ProtectedProjectRoute>
}
children={[
<Route
key="project-id-project"
path="project"
element={<ProjectEditMetaAnalyses />}
/>,
<Route key="project-id-project" path="project" element={<ProjectEditMetaAnalyses />} />,
<Route
key="project-id-meta-analyses"
path="meta-analyses"
element={<ProjectViewMetaAnalyses />}
/>,
<Route
key="project-id-index"
index
element={<Navigate replace to="project" />}
/>,
<Route
key="project-id-*"
path="*"
element={<Navigate replace to="project" />}
/>,
<Route key="project-id-index" index element={<Navigate replace to="project" />} />,
]}
/>
<Route
Expand Down Expand Up @@ -138,10 +125,7 @@ const BaseNavigation: React.FC = (_props) => {
<Route
path="/projects/:projectId/extraction/studies/:studyId/edit"
element={
<ProtectedProjectRoute
onlyOwnerCanAccess
errorMessage="You do not have access to this project"
>
<ProtectedProjectRoute onlyOwnerCanAccess errorMessage="You do not have access to this project">
<Box sx={BaseNavigationStyles.pagesContainer}>
<EditStudyPage />
</Box>
Expand Down Expand Up @@ -196,19 +180,17 @@ const BaseNavigation: React.FC = (_props) => {
</Box>
}
/>
{['/base-studies/:baseStudyId', '/base-studies/:baseStudyId/:studyVersionId'].map(
(path) => (
<Route
key={path}
path={path}
element={
<Box sx={BaseNavigationStyles.pagesContainer}>
<BaseStudyPage />
</Box>
}
/>
)
)}
{['/base-studies/:baseStudyId', '/base-studies/:baseStudyId/:studyVersionId'].map((path) => (
<Route
key={path}
path={path}
element={
<Box sx={BaseNavigationStyles.pagesContainer}>
<BaseStudyPage />
</Box>
}
/>
))}
<Route
path="/meta-analyses"
element={
Expand Down
12 changes: 4 additions & 8 deletions compose/neurosynth-frontend/src/pages/Curation/CurationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import CurationDownloadIncludedStudiesButton from './components/CurationDownloadIncludedStudiesButton';

const CurationPage: React.FC = (props) => {
const CurationPage: React.FC = () => {
const [prismaIsOpen, setPrismaIsOpen] = useState(false);
const { projectId } = useParams<{ projectId: string | undefined }>();
const projectUser = useProjectUser();
Expand All @@ -38,14 +38,13 @@ const CurationPage: React.FC = (props) => {
const { included, uncategorized } = useGetCurationSummary();
const { data: studyset } = useGetStudysetById(studysetId || '', false);

const extractionStepInitialized =
studysetId && annotationId && (studyset?.studies?.length || 0) > 0;
const extractionStepInitialized = studysetId && annotationId && (studyset?.studies?.length || 0) > 0;

const handleMoveToExtractionPhase = () => {
if (extractionStepInitialized) {
navigate(`/projects/${projectId}/extraction`);
} else {
navigate(`/projects/${projectId}`, {
navigate(`/projects/${projectId}/project`, {
state: {
projectPage: {
openCurationDialog: true,
Expand Down Expand Up @@ -93,10 +92,7 @@ const CurationPage: React.FC = (props) => {
<CurationDownloadIncludedStudiesButton />
{isPrisma && (
<>
<PrismaDialog
onCloseDialog={() => setPrismaIsOpen(false)}
isOpen={prismaIsOpen}
/>
<PrismaDialog onCloseDialog={() => setPrismaIsOpen(false)} isOpen={prismaIsOpen} />
<Button
onClick={() => setPrismaIsOpen(true)}
variant="outlined"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
});

const newStudysetId = newStudyset.data.id;
if (!newStudysetId)
throw new Error('expected a studyset id but did not receive one');
if (!newStudysetId) throw new Error('expected a studyset id but did not receive one');

tempStudysetId = newStudysetId;

Expand Down Expand Up @@ -114,8 +113,7 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
});

const newAnnotationId = newAnnotation.data.id;
if (!newAnnotationId)
throw new Error('expected a studyset id but did not receive one');
if (!newAnnotationId) throw new Error('expected a studyset id but did not receive one');

tempAnnotationId = newAnnotationId;
updateExtractionMetadata({
Expand All @@ -140,15 +138,7 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
const stubsToBaseStudies: Array<
Pick<
BaseStudy,
| 'name'
| 'doi'
| 'pmid'
| 'pmcid'
| 'year'
| 'description'
| 'publication'
| 'authors'
| 'level'
'name' | 'doi' | 'pmid' | 'pmcid' | 'year' | 'description' | 'publication' | 'authors' | 'level'
>
> = includedStubs.map((stub) => ({
name: stub.title,
Expand Down Expand Up @@ -252,14 +242,10 @@ const MoveToExtractionDialog: React.FC<IDialog> = (props) => {
value={progress}
/>
</Box>
<Box
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}
>
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
<CircularProgress />
<Typography>{progressText}</Typography>
<Typography sx={{ marginTop: '1rem' }}>
(This may take a minute)
</Typography>
<Typography sx={{ marginTop: '1rem' }}>(This may take a minute)</Typography>
</Box>
{/* need this empty div to space out elements properly */}
<div></div>
Expand Down
Loading