-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(website): fix sequence versions page and display submission dates (…
…#1462) Previously, the version page did not show the versions in some cases.
- Loading branch information
1 parent
23a6319
commit 1d2d5e0
Showing
7 changed files
with
76 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/// <reference path="../.astro/types.d.ts" /> | ||
/// <reference types="astro/client" /> | ||
|
||
type TokenCookie = { | ||
|
33 changes: 33 additions & 0 deletions
33
website/src/pages/seq/[accessionVersion]/getVersionsData.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { err, ok } from 'neverthrow'; | ||
|
||
import { getConfiguredOrganisms } from '../../../config.ts'; | ||
import { LapisClient } from '../../../services/lapisClient.ts'; | ||
|
||
export const getVersionsData = async (accession: string) => { | ||
const organisms = getConfiguredOrganisms(); | ||
const promises = organisms.map(async ({ key }) => { | ||
const lapisClient = LapisClient.createForOrganism(key); | ||
|
||
const versionListResult = (await lapisClient.getAllSequenceEntryHistoryForAccession(accession)) | ||
.mapErr((error) => error.detail) | ||
.andThen((result) => (result.length > 0 ? ok(result) : err('Sequence not found'))); | ||
return { | ||
organism: key, | ||
result: versionListResult, | ||
}; | ||
}); | ||
|
||
const queries = await Promise.all(promises); | ||
let versionListResult = queries[0].result; | ||
let organism: string | undefined; | ||
|
||
for (const query of queries) { | ||
if (query.result.isOk()) { | ||
versionListResult = query.result!; | ||
organism = query.organism!; | ||
break; | ||
} | ||
} | ||
|
||
return { versionListResult, organism }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { DateTime, FixedOffsetZone } from 'luxon'; | ||
|
||
export function parseUnixTimestamp(value: number) { | ||
return DateTime.fromSeconds(value, { zone: FixedOffsetZone.utcInstance }).toFormat('yyyy-MM-dd TTT'); | ||
} |