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

Tweak date displayNames on website #1561

Merged
merged 14 commits into from
Apr 10, 2024
Merged
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
2 changes: 2 additions & 0 deletions kubernetes/loculus/templates/_common-metadata.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ fields:
autocomplete: true
- name: submittedAt
type: timestamp
displayName: Date submitted
- name: releasedAt
type: timestamp
displayName: Date released
- name: dataUseTerms
type: string
generateIndex: true
Expand Down
6 changes: 5 additions & 1 deletion website/src/components/SearchPage/SearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ export const SearchForm: FC<SearchFormProps> = ({
if (field.grouped === true) {
return (
<div key={field.name} className='flex flex-col border p-3 mb-3 rounded-md border-gray-300'>
<h3 className='text-gray-500 text-sm mb-1'>{field.label}</h3>
<h3 className='text-gray-500 text-sm mb-1'>
{field.displayName !== undefined ? field.displayName : field.label}
</h3>

{field.groupedFields.map((groupedField) => (
<SearchField
Expand Down Expand Up @@ -321,6 +323,8 @@ const consolidateGroupedFields = (filters: MetadataFilter[]): (MetadataFilter |
groupedFields: [],
type: filter.type,
grouped: true,
displayName: filter.fieldGroupDisplayName,
label: filter.label,
initiallyVisible: filter.initiallyVisible,
};
fieldList.push(fieldForGroup);
Expand Down
1 change: 1 addition & 0 deletions website/src/components/SearchPage/fields/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const TextField = forwardRef<HTMLInputElement | HTMLTextAreaElement, Text
placeholder: '',
label: label !== undefined ? label : '',
};
// "left-1" - leave this comment in to ensure tailwind maintains left-1 in the build
return <FloatingLabel {...inputProps} variant='outlined' type='text' />;
}
const refTextArea = ref as ForwardedRef<HTMLTextAreaElement>;
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 @@ -29,6 +29,7 @@ export type MetadataFilter = Metadata & {
label?: string;
fieldGroup?: string;
grouped?: false;
fieldGroupDisplayName?: string;
isVisible?: boolean;
};

Expand Down
3 changes: 3 additions & 0 deletions website/src/utils/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,16 @@ export const getMetadataFilters = (
displayName: 'From',
filterValue: getSearchParams(`${metadata.name}From`),
fieldGroup: metadata.name,
fieldGroupDisplayName: metadata.displayName,
};

const metadataTo = {
...metadata,
name: `${metadata.name}To`,
displayName: 'To',
filterValue: getSearchParams(`${metadata.name}To`),
fieldGroup: metadata.name,
fieldGroupDisplayName: metadata.displayName,
};
return [metadataFrom, metadataTo];
}
Expand Down
5 changes: 4 additions & 1 deletion website/tailwind.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ const mainTailwindColor = {
};

module.exports = {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}', 'node_modules/flowbite-react/lib/esm/**/*.js'],
content: [
'./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}',
'node_modules/flowbite-react/lib/esm/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}',
],
theme: {
extend: {
colors: {
Expand Down
13 changes: 13 additions & 0 deletions website/tests/pages/search/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ test.describe('The search page', () => {
const testAccessionVersion = getAccessionVersionString(getTestSequences().testSequenceEntry);

await searchPage.goto();
await searchPage.getAccessionField().click();
await searchPage.page.waitForTimeout(1000);
await searchPage.getAccessionField().fill(testAccessionVersion);

await searchPage.page.waitForTimeout(1000);
await searchPage.clickSearchButton();

await searchPage.page.waitForURL(
Expand Down Expand Up @@ -66,7 +70,10 @@ test.describe('The search page', () => {
for (let i = 0; i < 1000; i++) {
query += `\ndoesnotexist${i}`;
}
await searchPage.getAccessionField().click();
await searchPage.page.waitForTimeout(100);
await searchPage.getAccessionField().fill(query);
await searchPage.page.waitForTimeout(100);
await searchPage.clickSearchButton();

const newAccessions = (await searchPage.getTableContent()).map((arr) => arr[0]);
Expand All @@ -90,8 +97,14 @@ test.describe('The search page', () => {
await searchPage.goto();

const testAccessionVersion = getAccessionVersionString(getTestSequences().testSequenceEntry);

await searchPage.getAccessionField().click();

await searchPage.page.waitForTimeout(100);
await searchPage.getAccessionField().fill(testAccessionVersion);

await searchPage.page.waitForTimeout(100);

await expect(searchPage.getAccessionField()).toHaveValue(testAccessionVersion);

await searchPage.clickResetButton();
Expand Down
Loading