Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions kubernetes/loculus/templates/_common-metadata.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions kubernetes/loculus/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ async function renderDialog({
downloadParams = new SequenceEntrySelection(new Set()),
allowSubmissionOfConsensusSequences = true,
dataUseTermsEnabled = true,
dataUseTermsAgreementHtml,
richFastaHeaderFields,
metadata = mockMetadata,
selectedReferenceNames = { main: null },
Expand All @@ -64,6 +65,7 @@ async function renderDialog({
downloadParams?: SequenceFilter;
allowSubmissionOfConsensusSequences?: boolean;
dataUseTermsEnabled?: boolean;
dataUseTermsAgreementHtml?: string;
richFastaHeaderFields?: string[];
metadata?: Metadata[];
selectedReferenceNames?: SegmentReferenceSelections;
Expand Down Expand Up @@ -92,6 +94,7 @@ async function renderDialog({
referenceGenomesInfo={referenceGenomesInfo}
allowSubmissionOfConsensusSequences={allowSubmissionOfConsensusSequences}
dataUseTermsEnabled={dataUseTermsEnabled}
dataUseTermsAgreementHtml={dataUseTermsAgreementHtml}
schema={schema}
richFastaHeaderFields={richFastaHeaderFields}
selectedReferenceNames={selectedReferenceNames}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -30,6 +29,7 @@ type DownloadDialogProps = {
referenceGenomesInfo: ReferenceGenomesInfo;
allowSubmissionOfConsensusSequences: boolean;
dataUseTermsEnabled: boolean;
dataUseTermsAgreementHtml?: string;
schema: Schema;
richFastaHeaderFields: Schema['richFastaHeaderFields'];
selectedReferenceNames?: SegmentReferenceSelections;
Expand All @@ -42,6 +42,7 @@ export const DownloadDialog: FC<DownloadDialogProps> = ({
referenceGenomesInfo,
allowSubmissionOfConsensusSequences,
dataUseTermsEnabled,
dataUseTermsAgreementHtml,
schema,
richFastaHeaderFields,
selectedReferenceNames,
Expand Down Expand Up @@ -141,18 +142,13 @@ export const DownloadDialog: FC<DownloadDialogProps> = ({
checked={agreedToDataUseTerms}
onChange={() => setAgreedToDataUseTerms(!agreedToDataUseTerms)}
/>
<span className='text-sm'>
I agree to the{' '}
<a
href={routes.datauseTermsPage()}
className='underline'
target='_blank'
rel='noopener noreferrer'
>
data use terms
</a>
.
</span>
<span
className='text-sm'
dangerouslySetInnerHTML={{
// eslint-disable-next-line @typescript-eslint/naming-convention
__html: dataUseTermsAgreementHtml ?? 'I agree to the data use terms.',
}}
/>
</label>
</div>
)}
Expand Down
3 changes: 3 additions & 0 deletions website/src/components/SearchPage/SearchFullUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface InnerSearchFullUIProps {
initialQueryDict: QueryState;
showEditDataUseTermsControls?: boolean;
dataUseTermsEnabled?: boolean;
dataUseTermsAgreementHtml?: string;
sequenceFlaggingConfig?: SequenceFlaggingConfig;
linkOuts?: LinkOut[];
contactConfig?: ContactConfig;
Expand Down Expand Up @@ -76,6 +77,7 @@ export const InnerSearchFullUI = ({
initialQueryDict,
showEditDataUseTermsControls = false,
dataUseTermsEnabled = true,
dataUseTermsAgreementHtml,
sequenceFlaggingConfig,
linkOuts,
contactConfig,
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 4 additions & 0 deletions website/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ export function dataUseTermsAreEnabled() {
return getWebsiteConfig().enableDataUseTerms;
}

export function getDataUseTermsAgreementHtml() {
return getWebsiteConfig().dataUseTermsAgreementHtml;
}

function readTypedConfigFile<T>(fileName: string, schema: z.ZodType<T>) {
const configFilePath = path.join(getConfigDir(), fileName);
const json = JSON.parse(fs.readFileSync(configFilePath, 'utf8'));
Expand Down
2 changes: 2 additions & 0 deletions website/src/pages/[organism]/search/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { SearchFullUI } from '../../../components/SearchPage/SearchFullUI';
import {
dataUseTermsAreEnabled,
getContactConfig,
getDataUseTermsAgreementHtml,
getReferenceGenomes,
getRuntimeConfig,
getSchema,
Expand Down Expand Up @@ -69,6 +70,7 @@ const contactConfig = getContactConfig(websiteConfig);
initialCount={totalCount}
initialQueryDict={initialQueryDict}
dataUseTermsEnabled={dataUseTermsAreEnabled()}
dataUseTermsAgreementHtml={getDataUseTermsAgreementHtml()}
sequenceFlaggingConfig={sequenceFlaggingConfig}
linkOuts={schema.linkOuts}
contactConfig={contactConfig}
Expand Down
1 change: 1 addition & 0 deletions website/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof websiteConfig>;
Expand Down
Loading