From df1cbdc767c388cd870a779f6c15cb9b3b065d59 Mon Sep 17 00:00:00 2001 From: Simon Malesys <simon.malesys@pasteur.fr> Date: Tue, 25 Feb 2025 16:40:51 +0100 Subject: [PATCH] Add the version date in the interface --- src/client/components/TheHomePage.vue | 16 ++++++++++++++++ src/client/store.ts | 9 +++++++++ src/client/types.ts | 1 + src/server/models/Statistics.js | 1 + 4 files changed, 27 insertions(+) diff --git a/src/client/components/TheHomePage.vue b/src/client/components/TheHomePage.vue index e575d38..d81ccf5 100644 --- a/src/client/components/TheHomePage.vue +++ b/src/client/components/TheHomePage.vue @@ -124,6 +124,13 @@ </p> </section> + <div class="version-date"> + Last update: + <time :datetime="versionDate"> + {{ versionDate }} + </time> + </div> + <SearchBar /> <AntibodiesTable v-if="!noResults" /> @@ -140,6 +147,7 @@ import SearchBar from './SearchBar.vue' const store = useStore() const noResults = computed(() => { return store.noResults }) +const versionDate = computed(() => { return store.antibodiesVersionDate }) /** * Fetch the first antibodies on page load in order to @@ -166,4 +174,12 @@ p { max-width: 900px; text-align: justify; } + +.version-date { + margin: auto; +} + +.version-date time { + font-weight: bold; +} </style> diff --git a/src/client/store.ts b/src/client/store.ts index 5d6111d..50f2bf0 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -69,6 +69,15 @@ export const useStore = defineStore('store', { return Object .keys(state.statistics?.antibodiesPerLightSegment || {}) .sort(alphanumSort) + }, + + /** + * Get the current version date of the database. + * @param state - The state of the store + * @returns The version date as an ISO string + */ + antibodiesVersionDate: (state): Statistics['versionDate'] => { + return state.statistics?.versionDate.replace(/T.*/, "") || "" } }, actions: { diff --git a/src/client/types.ts b/src/client/types.ts index b04bbfd..5591ab1 100644 --- a/src/client/types.ts +++ b/src/client/types.ts @@ -62,6 +62,7 @@ export type SourceMeta = Record<FastaHeader['source'], { * the application. */ export interface Statistics { + versionDate: string antibodies: number species: Array<Antibody['species']> sources: Array<FastaHeader['source']> diff --git a/src/server/models/Statistics.js b/src/server/models/Statistics.js index d38b512..b28b72d 100644 --- a/src/server/models/Statistics.js +++ b/src/server/models/Statistics.js @@ -18,6 +18,7 @@ * Statistics about the antibodies. */ export class Statistics { + versionDate = "" antibodies = 0 species = new Set() sources = new Set() -- GitLab