diff --git a/docs/src/content/docs/reference/helm-chart-config.mdx b/docs/src/content/docs/reference/helm-chart-config.mdx
index 1165ae9e22..842441a25a 100644
--- a/docs/src/content/docs/reference/helm-chart-config.mdx
+++ b/docs/src/content/docs/reference/helm-chart-config.mdx
@@ -814,6 +814,12 @@ Each organism object has the following fields:
|
If true, hides the field on the sequence details page. |
+
+ `hideInSearchResultsTable` |
+ Boolean |
+ |
+ If true, hides the field in the search results table (and makes it impossible to show). |
+
`perSegment` |
Boolean |
diff --git a/kubernetes/loculus/templates/_common-metadata.tpl b/kubernetes/loculus/templates/_common-metadata.tpl
index 0503ef04bd..f0c99b2081 100644
--- a/kubernetes/loculus/templates/_common-metadata.tpl
+++ b/kubernetes/loculus/templates/_common-metadata.tpl
@@ -212,6 +212,9 @@ organisms:
{{- if .initiallyVisible }}
initiallyVisible: {{ .initiallyVisible }}
{{- end }}
+ {{- if .hideInSearchResultsTable }}
+ hideInSearchResultsTable: {{ .hideInSearchResultsTable }}
+ {{- end }}
{{- if or (or (eq .type "timestamp") (eq .type "date")) .rangeSearch }}
rangeSearch: true
{{- end }}
diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml
index a1e16c28d2..7246bf9407 100644
--- a/kubernetes/loculus/values.yaml
+++ b/kubernetes/loculus/values.yaml
@@ -86,6 +86,7 @@ defaultOrganismConfig: &defaultOrganismConfig
displayName: Collection date (lower bound)
type: date
initiallyVisible: true
+ hideInSearchResultsTable: true
header: Sample details
preprocessing:
function: parse_date_into_range
@@ -103,6 +104,7 @@ defaultOrganismConfig: &defaultOrganismConfig
displayName: Collection date (upper bound)
type: date
initiallyVisible: true
+ hideInSearchResultsTable: true
header: Sample details
preprocessing:
function: parse_date_into_range
@@ -1323,6 +1325,11 @@ defaultOrganisms:
required: true
type: string
lineageSystem: pangoLineage
+ - name: hiddenField
+ displayName: "Hidden Field"
+ initiallyVisible: false
+ type: string
+ hideInSearchResultsTable: true
website:
tableColumns:
- country
diff --git a/website/src/types/config.ts b/website/src/types/config.ts
index ae069935b4..9958f2979d 100644
--- a/website/src/types/config.ts
+++ b/website/src/types/config.ts
@@ -37,6 +37,7 @@ export const metadata = z.object({
type: metadataPossibleTypes,
autocomplete: z.boolean().optional(),
notSearchable: z.boolean().optional(),
+ hideInSearchResultsTable: z.boolean().optional(),
customDisplay: customDisplay.optional(),
truncateColumnDisplayTo: z.number().optional(),
initiallyVisible: z.boolean().optional(),
diff --git a/website/src/utils/search.ts b/website/src/utils/search.ts
index 0b04ecf030..430e8ab3ca 100644
--- a/website/src/utils/search.ts
+++ b/website/src/utils/search.ts
@@ -97,9 +97,7 @@ export const getFieldVisibilitiesFromQuery = (schema: Schema, state: Record): Map => {
const initiallyVisibleAccessor: InitialVisibilityAccessor = (field) => schema.tableColumns.includes(field.name);
- // hacky, fix later -- https://github.com/loculus-project/loculus/issues/3325
- const isFieldSelectable: VisiblitySelectableAccessor = (field) =>
- field.name !== 'sampleCollectionDateRangeUpper' && field.name !== 'sampleCollectionDateRangeLower';
+ const isFieldSelectable: VisiblitySelectableAccessor = (field) => !(field.hideInSearchResultsTable ?? false);
return getFieldOrColumnVisibilitiesFromQuery(
schema,
state,
@@ -110,7 +108,7 @@ export const getColumnVisibilitiesFromQuery = (schema: Schema, state: Record {
- const result = [];
+ const result: MetadataFilter[] = [];
for (const field of metadataSchema) {
if (field.rangeOverlapSearch) {
const fieldGroupProps = {
diff --git a/website/tests/pages/search/index.spec.ts b/website/tests/pages/search/index.spec.ts
index 320038e89a..36577b91e3 100644
--- a/website/tests/pages/search/index.spec.ts
+++ b/website/tests/pages/search/index.spec.ts
@@ -149,4 +149,12 @@ test.describe('The search page', () => {
expect(filePath).toBeTruthy();
});
+
+ test('should show visible columns and hide others in the customization modal', async ({ searchPage, page }) => {
+ await searchPage.goto();
+ await page.getByText('Customize columns').click();
+ void page.getByText('Toggle the visibility of columns').waitFor();
+ void expect(page.getByRole('checkbox', { name: 'Pango lineage' })).toBeVisible();
+ void expect(page.getByRole('checkbox', { name: 'Hidden Field' })).not.toBeVisible();
+ });
});