Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(website): specify width for column(s) in search table #3353

Merged
merged 24 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ca0cafa
feat: Add columnWidth to metadata items in values.yaml
theosanderson Dec 3, 2024
3a0d7ad
feat: Add columnWidth to NCBI and geolocation metadata fields
theosanderson Dec 3, 2024
6b3d84d
feat: Add columnWidth values to geo-location metadata fields
theosanderson Dec 3, 2024
e8e2be1
feat: Add columnWidth values to common metadata fields
theosanderson Dec 3, 2024
a9e66bc
feat: Add columnWidth support to standardWebsiteMetadata template
theosanderson Dec 3, 2024
ce0c4ba
feat: Add optional columnWidth to metadata schema definition
theosanderson Dec 3, 2024
045e123
feat: Add column width support to table headers and cells
theosanderson Dec 3, 2024
537791f
update
theosanderson Dec 3, 2024
b51ffa1
fix: Handle nullable and zero column width in table rendering
theosanderson Dec 3, 2024
900d5c1
update values
theosanderson Dec 3, 2024
0a19686
Automated code formatting
Dec 3, 2024
73666ab
update docs
theosanderson Dec 3, 2024
56d2532
update
theosanderson Dec 3, 2024
edbe48d
update
theosanderson Dec 3, 2024
c8a0a42
Automated code formatting
Dec 3, 2024
a8c021a
widen
theosanderson Dec 3, 2024
3c15acb
update
theosanderson Dec 3, 2024
7921d3c
Update setup-with-kubernetes.md
theosanderson Dec 3, 2024
e8f73fb
update helm config
theosanderson Dec 3, 2024
cffd1b8
address != vs !==
theosanderson Dec 3, 2024
891ad86
update
theosanderson Dec 3, 2024
2248734
Automated code formatting
Dec 3, 2024
b31b652
update docs partly to trigger CI
theosanderson Dec 3, 2024
08498d5
Update values.yaml
theosanderson Dec 3, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ organisms:

In this example, the configuration for the "ebolavirus-sudan" organism is defined. It includes schema settings, website display options, silo configuration, preprocessing details, and reference genome information.

Note the metadata section includes various fields for how the metadata of specific sequences should be displayed. Each metadata item must have a `name` which will also be displayed on the page unless `displayName` is also set. The `type` of the data, as well as if the field is `required` and if `autoComplete` is enabled can also be added. Additionally, links from metadata entries to external websites can be added using the `customDisplay` option. We also allow metadata to be grouped in sections, specified by the `header` field. The `noInput` parameter specifies that a parameter is generated internally by loculus (can be specified in the preprocessing pipeline) and should not be expected as input.
Note the metadata section includes various fields for how the metadata of specific sequences should be displayed. Each metadata item must have a `name` which will also be displayed on the page unless `displayName` is also set. The `type` of the data, as well as if the field is `required` and if `autoComplete` is enabled can also be added. Additionally, links from metadata entries to external websites can be added using the `customDisplay` option. We also allow metadata to be grouped in sections, specified by the `header` field. The `noInput` parameter specifies that a parameter is generated internally by loculus (can be specified in the preprocessing pipeline) and should not be expected as input. You can optionally add a `columnWidth` for the column in the search table, in pixels, which will be the minimal width for the column.
chaoran-chen marked this conversation as resolved.
Show resolved Hide resolved

Your preprocessing pipeline can be customized for each organism. Currently, we use `nextclade run` in our preprocessing pipeline and we suggest it as a fast option to do basic checks on your input sequences. Given a `nextclade dataset` (in its simplest form a reference sequence and a gene_annotation file) nextclade tries to align new sequences to the reference and will discard sequences that cannot be aligned. It will also compute mutations, insertions and deletions for the nucleotide sequence as well as for the corresponding genes. If you would like to use our preprocessing set-up you can add a nextclade dataset to your `values.yaml` as follows:

Expand Down
5 changes: 5 additions & 0 deletions kubernetes/loculus/templates/_common-metadata.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ fields:
type: timestamp
displayName: Date released
header: Submission details
columnWidth: 100
- name: releasedDate
type: string
hideOnSequenceDetailsPage: true
generateIndex: true
autocomplete: true
displayName: Date released (exact)
columnWidth: 100
- name: dataUseTerms
type: string
generateIndex: true
Expand Down Expand Up @@ -211,6 +213,9 @@ organisms:
{{- if .truncateColumnDisplayTo }}
truncateColumnDisplayTo: {{ .truncateColumnDisplayTo }}
{{- end }}
{{- if .columnWidth }}
columnWidth: {{ .columnWidth }}
{{- end }}
chaoran-chen marked this conversation as resolved.
Show resolved Hide resolved
{{- if .customDisplay }}
customDisplay:
type: {{ quote .customDisplay.type }}
Expand Down
4 changes: 4 additions & 0 deletions kubernetes/loculus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ defaultOrganismConfig: &defaultOrganismConfig
fieldType: dateRangeString
required: true
notSearchable: true
columnWidth: 100
- name: sampleCollectionDateRangeLower
displayName: Collection date (lower bound)
type: date
Expand Down Expand Up @@ -128,6 +129,7 @@ defaultOrganismConfig: &defaultOrganismConfig
inputs:
timestamp: ncbiReleaseDate
noInput: true
columnWidth: 100
- name: ncbiUpdateDate
type: date
displayName: NCBI update date
Expand All @@ -139,6 +141,7 @@ defaultOrganismConfig: &defaultOrganismConfig
noInput: true
perSegment: true
oneHeader: true
columnWidth: 100
- name: geoLocLatitude
displayName: Latitude
header: Sample details
Expand Down Expand Up @@ -506,6 +509,7 @@ defaultOrganismConfig: &defaultOrganismConfig
function: check_authors
inputs:
authors: authors
columnWidth: 280
- name: authorAffiliations
displayName: Author affiliations
enableSubstringSearch: true
Expand Down
7 changes: 7 additions & 0 deletions website/src/components/SearchPage/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const Table: FC<TableProps> = ({
headerName: schema.metadata.find((m) => m.name === field)?.displayName ?? capitalCase(field),
maxLength: maxLengths[field],
type: schema.metadata.find((m) => m.name === field)?.type ?? 'string',
columnWidth: schema.metadata.find((m) => m.name === field)?.columnWidth,
}));

const handleSort = (field: string) => {
Expand Down Expand Up @@ -145,6 +146,9 @@ export const Table: FC<TableProps> = ({
key={c.field}
onClick={() => handleSort(c.field)}
className='px-2 py-3 text-xs font-medium tracking-wider text-gray-500 uppercase cursor-pointer last:pr-6 text-left'
style={{
minWidth: c.columnWidth != null ? `${c.columnWidth}px` : undefined,
}}
theosanderson marked this conversation as resolved.
Show resolved Hide resolved
>
{c.headerName} {orderBy.field === c.field && orderIcon}
</th>
Expand Down Expand Up @@ -198,6 +202,9 @@ export const Table: FC<TableProps> = ({
<td
key={`${index}-${c.field}`}
className='px-2 py-2 text-primary-900 last:pr-6'
style={{
minWidth: c.columnWidth != null ? `${c.columnWidth}px` : undefined,
}}
data-tooltip-content={
typeof row[c.field] === 'string' &&
row[c.field]!.toString().length > c.maxLength
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 @@ -54,6 +54,7 @@ export const metadata = z.object({
rangeSearch: z.boolean().optional(),
rangeOverlapSearch: rangeOverlapSearch.optional(),
substringSearch: z.boolean().optional(),
columnWidth: z.number().optional(),
});

export const inputField = z.object({
Expand Down
Loading