Skip to content

Commit

Permalink
clarify sequency entry route naming
Browse files Browse the repository at this point in the history
  • Loading branch information
fhennig committed Oct 17, 2024
1 parent 7f34c6f commit 4650614
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 20 deletions.
6 changes: 3 additions & 3 deletions website/src/components/SearchPage/SeqPreviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const SeqPreviewModal: React.FC<SeqPreviewModalProps> = ({
)}
</button>
<DownloadButton seqId={seqId} />
<a href={routes.sequencesDetailsPage(seqId)} title='Open in full window' className={BUTTONCLASS}>
<a href={routes.sequenceEntryDetailsPage(seqId)} title='Open in full window' className={BUTTONCLASS}>
<OouiNewWindowLtr className='w-6 h-6' />
</a>
<button type='button' className={BUTTONCLASS} onClick={onClose} title='Close'>
Expand Down Expand Up @@ -146,12 +146,12 @@ const DownloadButton: React.FC<DownloadButtonProps> = ({ seqId }: { seqId: strin
</button>
<ul className='dropdown-content z-20 menu p-1 shadow bg-base-100 rounded-btn absolute top-full -left-4'>
<li>
<a href={routes.sequencesFastaPage(seqId, true)} className='block px-4 py-2 hover:bg-gray-100'>
<a href={routes.sequenceEntryFastaPage(seqId, true)} className='block px-4 py-2 hover:bg-gray-100'>
FASTA
</a>
</li>
<li>
<a href={routes.sequencesTsvPage(seqId, true)} className='block px-4 py-2 hover:bg-gray-100'>
<a href={routes.sequenceEntryTsvPage(seqId, true)} className='block px-4 py-2 hover:bg-gray-100'>
Metadata TSV
</a>
</li>
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/SearchPage/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export const Table: FC<TableProps> = ({
e.preventDefault();
setPreviewedSeqId(seqId);
} else {
window.open(routes.sequencesDetailsPage(seqId));
window.open(routes.sequenceEntryDetailsPage(seqId));
}
} else if (e.button === 1) {
window.open(routes.sequencesDetailsPage(seqId));
window.open(routes.sequenceEntryDetailsPage(seqId));
}
};

Expand Down Expand Up @@ -186,7 +186,7 @@ export const Table: FC<TableProps> = ({
aria-label='SearchResult'
>
<a
href={routes.sequencesDetailsPage(row[primaryKey] as string)}
href={routes.sequenceEntryDetailsPage(row[primaryKey] as string)}
className='text-primary-900 hover:text-primary-800 hover:no-underline'
onClick={(e) => e.preventDefault()}
onAuxClick={(e) => e.preventDefault()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const SequenceEntryHistoryMenu: React.FC<Props> = ({
{sequenceEntryHistory.map((version) => (
<li key={version.accessionVersion}>
<a
href={routes.sequencesDetailsPage(version.accessionVersion)}
href={routes.sequenceEntryDetailsPage(version.accessionVersion)}
onClick={(e) => {
if (setPreviewedSeqId) {
setPreviewedSeqId(version.accessionVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const isLatestVersion = ownHistoryEntry?.versionStatus === versionStatuses.lates
{latestAccessionVersion !== undefined && (
<p>
The latest version is:
<a href={routes.sequencesDetailsPage(latestAccessionVersion)} class='font-bold underline mx-1'>
<a
href={routes.sequenceEntryDetailsPage(latestAccessionVersion)}
class='font-bold underline mx-1'
>
{getAccessionVersionString(latestAccessionVersion)}
</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ const { sequenceEntryHistory, accessionVersion, showDownload } = Astro.props;
<ul class='dropdown-content z-20 menu p-1 shadow bg-base-100 rounded-btn top-full -left-22 w-35'>
<li>
<a
href={routes.sequencesFastaPage(accessionVersion, true)}
href={routes.sequenceEntryFastaPage(accessionVersion, true)}
class='block px-4 py-2 outlineButtonDropdownItem'
>
FASTA
</a>
</li>
<li>
<a
href={routes.sequencesTsvPage(accessionVersion, true)}
href={routes.sequenceEntryTsvPage(accessionVersion, true)}
class='block px-4 py-2 outlineButtonDropdownItem'
>
Metadata TSV
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/seq/[accessionVersion].fa/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createDownloadAPIRoute } from '../sequenceDownload.ts';
export const GET: APIRoute = createDownloadAPIRoute(
'text/x-fasta',
'fa',
routes.sequencesFastaPage,
routes.sequenceEntryFastaPage,
async (accessionVersion: string, organism: string) => {
const lapisClient = LapisClient.createForOrganism(organism);
const referenceGenomes = getReferenceGenomes(organism);
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/seq/[accessionVersion].tsv/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createDownloadAPIRoute } from '../sequenceDownload';
export const GET: APIRoute = createDownloadAPIRoute(
'text/tab-separated-values',
'tsv',
routes.sequencesTsvPage,
routes.sequenceEntryTsvPage,
(accessionVersion: string, organism: string) => {
const lapisClient = LapisClient.createForOrganism(organism);
return lapisClient.getSequenceEntryVersionDetailsTsv(accessionVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getSequenceDetailsTableData = async (
const latestVersionResult = await lapisClient.getLatestAccessionVersion(accession);
return latestVersionResult.map((latestVersion) => ({
type: SequenceDetailsTableResultType.REDIRECT,
redirectUrl: routes.sequencesDetailsPage(latestVersion),
redirectUrl: routes.sequenceEntryDetailsPage(latestVersion),
}));
}

Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/seq/[accessionVersion]/versions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const { organism, versionListResult } = await getVersionsData(accession);
<div class='font-semibold'>{version.submittedAtTimestamp}</div>
<div class='flex flex-row gap-3 justify-start'>
<a
href={routes.sequencesDetailsPage(
href={routes.sequenceEntryDetailsPage(
getAccessionVersionString(extractAccessionVersion(version)),
)}
class='underline'
Expand Down
10 changes: 5 additions & 5 deletions website/src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export const routes = {
groupId,
searchParams: new URLSearchParams({}),
}),
sequencesDetailsPage: (accessionVersion: AccessionVersion | string) =>
sequenceEntryDetailsPage: (accessionVersion: AccessionVersion | string) =>
`/seq/${getAccessionVersionString(accessionVersion)}`,
sequencesVersionsPage: (accessionVersion: AccessionVersion | string) =>
sequenceEntryVersionsPage: (accessionVersion: AccessionVersion | string) =>
`/seq/${getAccessionVersionString(accessionVersion)}/versions`,
sequencesFastaPage: (accessionVersion: AccessionVersion | string, download = false) =>
sequenceEntryFastaPage: (accessionVersion: AccessionVersion | string, download = false) =>
sequenceEntryDownloadUrl(accessionVersion, FileType.FASTA, download),
sequencesTsvPage: (accessionVersion: AccessionVersion | string, download = false) =>
sequenceEntryTsvPage: (accessionVersion: AccessionVersion | string, download = false) =>
sequenceEntryDownloadUrl(accessionVersion, FileType.TSV, download),
createGroup: () => '/user/createGroup',
submissionPageWithoutGroup: (organism: string) => withOrganism(organism, '/submission'),
Expand Down Expand Up @@ -67,7 +67,7 @@ function withOrganism(organism: string, path: `/${string}`) {
}

function sequenceEntryDownloadUrl(accessionVersion: AccessionVersion | string, fileType: FileType, download = false) {
let url = `${routes.sequencesDetailsPage(accessionVersion)}.${fileType}`;
let url = `${routes.sequenceEntryDetailsPage(accessionVersion)}.${fileType}`;
if (download) {
url += '?download';
}
Expand Down
2 changes: 1 addition & 1 deletion website/src/utils/shouldMiddlewareEnforceLogin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('shouldMiddlewareEnforceLogin', () => {
expectNoLogin(`/${testOrganism}/search`);
expectNoLogin(`/`);
expectNoLogin(`/${testOrganism}`);
expectNoLogin(routes.sequencesDetailsPage('id_002156'));
expectNoLogin(routes.sequenceEntryDetailsPage('id_002156'));
});

function expectForceLogin(path: string) {
Expand Down

0 comments on commit 4650614

Please sign in to comment.