diff --git a/kubernetes/loculus/templates/_common-metadata.tpl b/kubernetes/loculus/templates/_common-metadata.tpl index 41c21f956b..896d5fcfa9 100644 --- a/kubernetes/loculus/templates/_common-metadata.tpl +++ b/kubernetes/loculus/templates/_common-metadata.tpl @@ -213,6 +213,9 @@ enableSeqSets: {{ $.Values.seqSets.enabled }} seqSetsFieldsToDisplay: {{ $.Values.seqSets.fieldsToDisplay | toJson }} {{- end }} enableDataUseTerms: {{ $.Values.dataUseTerms.enabled }} +{{ if $.Values.dataUseTerms.agreementHtml }} +dataUseTermsAgreementHtml: {{ quote $.Values.dataUseTerms.agreementHtml }} +{{- end }} accessionPrefix: {{ quote $.Values.accessionPrefix }} {{- $commonMetadata := (include "loculus.commonMetadata" . | fromYaml).fields }} organisms: diff --git a/kubernetes/loculus/values.schema.json b/kubernetes/loculus/values.schema.json index e6ca37d919..3a6130e500 100644 --- a/kubernetes/loculus/values.schema.json +++ b/kubernetes/loculus/values.schema.json @@ -1526,6 +1526,11 @@ }, "required": ["open", "restricted"], "additionalProperties": false + }, + "agreementHtml": { + "groups": ["general"], + "type": "string", + "description": "Custom HTML for the data use terms agreement checkbox label shown in the download dialog. Can contain links and other HTML elements." } }, "required": ["enabled", "urls"], diff --git a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx index 8c5bdedaab..448f23cc18 100644 --- a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx +++ b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.spec.tsx @@ -55,6 +55,7 @@ async function renderDialog({ downloadParams = new SequenceEntrySelection(new Set()), allowSubmissionOfConsensusSequences = true, dataUseTermsEnabled = true, + dataUseTermsAgreementHtml, richFastaHeaderFields, metadata = mockMetadata, selectedReferenceNames = { main: null }, @@ -64,6 +65,7 @@ async function renderDialog({ downloadParams?: SequenceFilter; allowSubmissionOfConsensusSequences?: boolean; dataUseTermsEnabled?: boolean; + dataUseTermsAgreementHtml?: string; richFastaHeaderFields?: string[]; metadata?: Metadata[]; selectedReferenceNames?: SegmentReferenceSelections; @@ -92,6 +94,7 @@ async function renderDialog({ referenceGenomesInfo={referenceGenomesInfo} allowSubmissionOfConsensusSequences={allowSubmissionOfConsensusSequences} dataUseTermsEnabled={dataUseTermsEnabled} + dataUseTermsAgreementHtml={dataUseTermsAgreementHtml} schema={schema} richFastaHeaderFields={richFastaHeaderFields} selectedReferenceNames={selectedReferenceNames} diff --git a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx index b8b2e16970..6119a3afcc 100644 --- a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx +++ b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx @@ -7,7 +7,6 @@ import { DownloadForm, type DownloadFormState } from './DownloadForm.tsx'; import { type DownloadOption, type DownloadUrlGenerator } from './DownloadUrlGenerator.ts'; import { getDefaultSelectedFields } from './FieldSelector/FieldSelectorModal.tsx'; import type { SequenceFilter } from './SequenceFilters.tsx'; -import { routes } from '../../../routes/routes.ts'; import { ACCESSION_VERSION_FIELD } from '../../../settings.ts'; import type { Metadata, Schema } from '../../../types/config.ts'; import type { ReferenceGenomesInfo } from '../../../types/referencesGenomes.ts'; @@ -30,6 +29,7 @@ type DownloadDialogProps = { referenceGenomesInfo: ReferenceGenomesInfo; allowSubmissionOfConsensusSequences: boolean; dataUseTermsEnabled: boolean; + dataUseTermsAgreementHtml?: string; schema: Schema; richFastaHeaderFields: Schema['richFastaHeaderFields']; selectedReferenceNames?: SegmentReferenceSelections; @@ -42,6 +42,7 @@ export const DownloadDialog: FC = ({ referenceGenomesInfo, allowSubmissionOfConsensusSequences, dataUseTermsEnabled, + dataUseTermsAgreementHtml, schema, richFastaHeaderFields, selectedReferenceNames, @@ -141,18 +142,13 @@ export const DownloadDialog: FC = ({ checked={agreedToDataUseTerms} onChange={() => setAgreedToDataUseTerms(!agreedToDataUseTerms)} /> - - I agree to the{' '} - - data use terms - - . - + )} diff --git a/website/src/components/SearchPage/SearchFullUI.tsx b/website/src/components/SearchPage/SearchFullUI.tsx index 32643636cd..be98ad9da3 100644 --- a/website/src/components/SearchPage/SearchFullUI.tsx +++ b/website/src/components/SearchPage/SearchFullUI.tsx @@ -48,6 +48,7 @@ export interface InnerSearchFullUIProps { initialQueryDict: QueryState; showEditDataUseTermsControls?: boolean; dataUseTermsEnabled?: boolean; + dataUseTermsAgreementHtml?: string; sequenceFlaggingConfig?: SequenceFlaggingConfig; linkOuts?: LinkOut[]; contactConfig?: ContactConfig; @@ -76,6 +77,7 @@ export const InnerSearchFullUI = ({ initialQueryDict, showEditDataUseTermsControls = false, dataUseTermsEnabled = true, + dataUseTermsAgreementHtml, sequenceFlaggingConfig, linkOuts, contactConfig, @@ -354,6 +356,7 @@ export const InnerSearchFullUI = ({ referenceGenomesInfo={referenceGenomesInfo} allowSubmissionOfConsensusSequences={schema.submissionDataTypes.consensusSequences} dataUseTermsEnabled={dataUseTermsEnabled} + dataUseTermsAgreementHtml={dataUseTermsAgreementHtml} schema={schema} richFastaHeaderFields={schema.richFastaHeaderFields} selectedReferenceNames={referenceSelection?.selectedReferences} diff --git a/website/src/config.ts b/website/src/config.ts index b478f2f916..d8a379fc75 100644 --- a/website/src/config.ts +++ b/website/src/config.ts @@ -251,6 +251,10 @@ export function dataUseTermsAreEnabled() { return getWebsiteConfig().enableDataUseTerms; } +export function getDataUseTermsAgreementHtml() { + return getWebsiteConfig().dataUseTermsAgreementHtml; +} + function readTypedConfigFile(fileName: string, schema: z.ZodType) { const configFilePath = path.join(getConfigDir(), fileName); const json = JSON.parse(fs.readFileSync(configFilePath, 'utf8')); diff --git a/website/src/pages/[organism]/search/index.astro b/website/src/pages/[organism]/search/index.astro index 0a7c01af38..3f5b0ca754 100644 --- a/website/src/pages/[organism]/search/index.astro +++ b/website/src/pages/[organism]/search/index.astro @@ -4,6 +4,7 @@ import { SearchFullUI } from '../../../components/SearchPage/SearchFullUI'; import { dataUseTermsAreEnabled, getContactConfig, + getDataUseTermsAgreementHtml, getReferenceGenomes, getRuntimeConfig, getSchema, @@ -69,6 +70,7 @@ const contactConfig = getContactConfig(websiteConfig); initialCount={totalCount} initialQueryDict={initialQueryDict} dataUseTermsEnabled={dataUseTermsAreEnabled()} + dataUseTermsAgreementHtml={getDataUseTermsAgreementHtml()} sequenceFlaggingConfig={sequenceFlaggingConfig} linkOuts={schema.linkOuts} contactConfig={contactConfig} diff --git a/website/src/types/config.ts b/website/src/types/config.ts index 41bd804cd8..6871dd62f5 100644 --- a/website/src/types/config.ts +++ b/website/src/types/config.ts @@ -246,6 +246,7 @@ export const websiteConfig = z.object({ enableSubmissionNavigationItem: z.boolean(), enableSubmissionPages: z.boolean(), enableDataUseTerms: z.boolean(), + dataUseTermsAgreementHtml: z.string().optional(), sequenceFlagging: sequenceFlaggingConfig.optional(), }); export type WebsiteConfig = z.infer;