Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nleroy917 committed Feb 19, 2024
1 parent 4d8dae5 commit b6d37a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion web/src/hooks/queries/useSampleTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ interface SampleTableQuery {

export const useSampleTable = (sampleTableQuery: SampleTableQuery) => {
const { namespace, project, tag, enabled } = sampleTableQuery;

const enableQuery = enabled && !!namespace && !!project && !!tag;

const session = useSession();
const query = useQuery({
queryKey: [namespace, project, tag, 'samples'],
queryFn: () => getSampleTable(namespace || '', project || '', tag, session.jwt || ''),
enabled: enabled && namespace !== undefined && project !== undefined,
enabled: enableQuery === undefined ? false : enableQuery,
});
return query;
};
15 changes: 10 additions & 5 deletions web/src/pages/Project.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FC, Fragment, MouseEvent, forwardRef, useEffect, useRef, useState } from 'react';
import { Breadcrumb, Dropdown } from 'react-bootstrap';
import { set } from 'react-hook-form';
import { useParams, useSearchParams } from 'react-router-dom';

import { Sample } from '../../types';
Expand Down Expand Up @@ -31,7 +32,7 @@ import { useSubsampleTable } from '../hooks/queries/useSubsampleTable';
import { useValidation } from '../hooks/queries/useValidation';
import { useView } from '../hooks/queries/useView';
import { useSession } from '../hooks/useSession';
import { dateStringToDate, dateStringToDateTime } from '../utils/dates';
import { dateStringToDateTime } from '../utils/dates';
import { copyToClipboard, getOS, numberWithCommas } from '../utils/etc';
import { canEdit } from '../utils/permissions';
import { downloadZip } from '../utils/project';
Expand Down Expand Up @@ -104,7 +105,7 @@ export const ProjectPage: FC = () => {
namespace,
project,
tag,
enabled: fetchSampleTable,
enabled: projectInfo === undefined ? false : fetchSampleTable,
});
const { data: projectSubsamples } = useSubsampleTable(namespace, project, tag);
const { data: projectConfig, isLoading: projectConfigIsLoading } = useProjectConfig(namespace, project || '', tag);
Expand All @@ -124,9 +125,7 @@ export const ProjectPage: FC = () => {
const [showAPIEndpointsModal, setShowAPIEndpointsModal] = useState(false);
const [showEditMetaMetadataModal, setShowEditMetaMetadataModal] = useState(false);
const [showAddToPOPModal, setShowAddToPOPModal] = useState(false);
const [showLargeSampleTableModal, setShowLargeSampleTableModal] = useState(
projectInfo === undefined ? false : !fetchSampleTable,
);
const [showLargeSampleTableModal, setShowLargeSampleTableModal] = useState(false);
const [copied, setCopied] = useState(false);
const [forceTraditionalInterface, setForceTraditionalInterface] = useState(false); // let users toggle between PEP and POP interfaces

Expand Down Expand Up @@ -169,6 +168,12 @@ export const ProjectPage: FC = () => {
}
}, [fork]);

useEffect(() => {
if (projectInfo !== undefined) {
setShowLargeSampleTableModal(!fetchSampleTable);
}
}, [fetchSampleTable, projectInfo]);

// check if config or samples are dirty
const configIsDirty = newProjectConfig !== projectConfig?.config;

Expand Down

0 comments on commit b6d37a8

Please sign in to comment.