Skip to content

Commit f9bfc72

Browse files
theosandersonclaude
andcommitted
feat(website): add customDisplay.label for grouped field labels on details page
Add optional `label` property to `customDisplay` config so grouped fields can show a different label than their `displayName` on the sequence details page. Use this to show "Sampling location" for the geoLocation group while keeping `displayName` as "Collection country" for the submission form and search page. Revert integration test changes since displayName is unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3a3d924 commit f9bfc72

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

integration-tests/tests/specs/features/multiseg-multiref-submission-flow.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ test.describe('Multi-segment multi-reference submission flow', () => {
4040
const accessionVersions = await releasedPage.waitForSequencesInSearch(1);
4141
const firstAccessionVersion = accessionVersions[0];
4242
await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.1`);
43-
const expectedDisplayName = new RegExp(`^Laos/${firstAccessionVersion.accession}\\.1`);
43+
const expectedDisplayName = new RegExp(
44+
`^Display Name: Laos/${firstAccessionVersion.accession}\\.1`,
45+
);
4446
await expect(page.getByText(expectedDisplayName)).toBeVisible();
4547
await expect(
4648
page.getByTestId('sequence-preview-modal').getByText('Length S'),
@@ -130,7 +132,9 @@ test.describe('Multi-segment multi-reference submission flow', () => {
130132
await releasedPage.waitForAccessionVersionInSearch(firstAccessionVersion.accession, 2);
131133
await releasedPage.expectResultTableCellText(authorAffiliations);
132134
await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.2`);
133-
const expectedDisplayName = new RegExp(`^Laos/${firstAccessionVersion.accession}\\.2`);
135+
const expectedDisplayName = new RegExp(
136+
`^Display Name: Laos/${firstAccessionVersion.accession}\\.2`,
137+
);
134138
await expect(page.getByText(expectedDisplayName)).toBeVisible();
135139
});
136140
});

integration-tests/tests/specs/features/singleseg-multiref-submission-flow.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ test.describe('Single segment multi-reference submission flow', () => {
3636
const accessionVersions = await releasedPage.waitForSequencesInSearch(1);
3737
const firstAccessionVersion = accessionVersions[0];
3838
await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.1`);
39-
const expectedDisplayName = new RegExp(`^Uganda/${firstAccessionVersion.accession}\\.1`);
39+
const expectedDisplayName = new RegExp(
40+
`^Display Name: Uganda/${firstAccessionVersion.accession}\\.1`,
41+
);
4042
await expect(page.getByText(expectedDisplayName)).toBeVisible();
4143
await expect(
4244
page.getByTestId('sequence-preview-modal').getByText('Clade EV-A71', { exact: true }),
@@ -120,7 +122,9 @@ test.describe('Single segment multi-reference submission flow', () => {
120122
await releasedPage.waitForAccessionVersionInSearch(firstAccessionVersion.accession, 2);
121123
await releasedPage.expectResultTableCellText(authorAffiliations);
122124
await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.2`);
123-
const expectedDisplayName = new RegExp(`^Uganda/${firstAccessionVersion.accession}\\.2`);
125+
const expectedDisplayName = new RegExp(
126+
`^Display Name: Uganda/${firstAccessionVersion.accession}\\.2`,
127+
);
124128
await expect(page.getByText(expectedDisplayName)).toBeVisible();
125129
});
126130
});

kubernetes/loculus/values.schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@
176176
"url": {
177177
"groups": ["metadata"],
178178
"type": "string"
179+
},
180+
"label": {
181+
"groups": ["metadata"],
182+
"type": "string",
183+
"description": "Label to display for grouped fields on the sequence details page. Overrides the field's displayName when fields are grouped via displayGroup."
179184
}
180185
}
181186
},

kubernetes/loculus/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,15 @@ defaultOrganismConfig: &defaultOrganismConfig
220220
orderOnDetailsPage: 440
221221
guidance: Geo-coordinate longitude in decimal degree (WGS84) format, i.e. values in range -180 to 180, where positive values are east of the Prime Meridian.
222222
- name: geoLocCountry
223-
displayName: Sampling location
223+
displayName: Collection country
224224
generateIndex: true
225225
autocomplete: true
226226
initiallyVisible: true
227227
includeInDownloadsByDefault: true
228228
customDisplay:
229229
type: geoLocation
230230
displayGroup: geoLocation
231+
label: Sampling location
231232
header: Sample details
232233
order: 20
233234
orderOnDetailsPage: 400

website/src/components/SequenceDetailsPage/getDataTableData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function grouping(listTableDataEntries: TableDataEntry[]): TableDataEntry[] {
3636
value: '[]',
3737
header: entry.header,
3838
customDisplay: entry.customDisplay,
39-
label: entry.label,
39+
label: entry.customDisplay.label ?? entry.label,
4040
orderOnDetailsPage: entry.orderOnDetailsPage,
4141
});
4242
}

website/src/types/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const customDisplay = z.object({
3939
html: z.string().optional(),
4040
value: z.array(segmentedMutations).optional(),
4141
displayGroup: z.string().optional(),
42+
label: z.string().optional(),
4243
linkMenuItems: z.array(linkMenuItem).optional(),
4344
});
4445

0 commit comments

Comments
 (0)