-
Notifications
You must be signed in to change notification settings - Fork 3
feat!(website): allow selecting fields to download in metadata and default to a shorter selection #3761
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
Merged
Merged
feat!(website): allow selecting fields to download in metadata and default to a shorter selection #3761
Changes from 4 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
81ac9dc
working
theosanderson db91646
lint and format
theosanderson 7e91312
improvements
theosanderson c4a86b7
adjust some defaults
theosanderson 3bebda4
try integration test
theosanderson 99cfe6a
update
theosanderson 2422783
fixup
theosanderson c64979a
update
theosanderson 033fae9
try again
theosanderson bef8bd3
fix test
theosanderson 1b75040
fix test and delete test I had already moved
theosanderson 46a2dee
update
theosanderson bd73224
update
theosanderson c0bdec6
Update download.spec.ts
theosanderson e4403ca
Update values.schema.json
theosanderson 4d6e1f1
Update values.schema.json
theosanderson b331209
Merge branch 'main' into select-fields
theosanderson 5ce45a2
Update download.spec.ts
theosanderson 9ddfa8e
Automated code formatting
c847421
Update DownloadDialog.spec.tsx
theosanderson 0797f0a
add select all/none
theosanderson 52ccee1
improve testing output and fix test
theosanderson d3e916a
Automated code formatting
c6b3b98
limit width of modal
theosanderson 87a5913
fixup
theosanderson f7c0bc8
try a POST test
theosanderson 450102d
try again
theosanderson 11baf47
extend test start-delay more
theosanderson 6edb238
update
theosanderson e0ca5c7
update
theosanderson 5d64f02
update
theosanderson 2ed5865
update
theosanderson 5b10c05
fixup
theosanderson 9179f7f
Merge branch 'main' into select-fields
theosanderson b7397eb
Automated code formatting
183be5c
Merge branch 'main' into select-fields
theosanderson c6a3ccc
Merge branch 'main' into select-fields
theosanderson e3e2599
fix merge
theosanderson 6a02c92
remove duplicate test
theosanderson 9ed1544
progress
theosanderson 53dc536
update
theosanderson c9d37bf
update
theosanderson 9a22091
format and test better
theosanderson 355db9f
Merge branch 'main' into select-fields
theosanderson e1db3e4
remove logging
theosanderson 2decc37
Update button class in FieldSelectorModal
theosanderson 5f70af5
Automated code formatting
c622097
Fix button padding in FieldSelectorModal
theosanderson 93f5443
Merge branch 'main' into select-fields
theosanderson e3173fe
Increase minimum width of FieldSelectorModal
theosanderson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
website/src/components/SearchPage/DownloadDialog/DownloadUrlGenerator.spec.ts
theosanderson marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { DownloadUrlGenerator } from './DownloadUrlGenerator'; | ||
import { FieldFilter } from './SequenceFilters'; | ||
import type { ConsolidatedMetadataFilters } from '../../../utils/search'; | ||
|
||
describe('DownloadUrlGenerator', () => { | ||
const organism = 'test-organism'; | ||
const lapisUrl = 'https://example.com/api'; | ||
const dataUseTermsEnabled = true; | ||
|
||
it('includes selected fields in the URL for metadata downloads', () => { | ||
const generator = new DownloadUrlGenerator(organism, lapisUrl, dataUseTermsEnabled); | ||
|
||
const sequenceFilter = new FieldFilter({}, {}, [] as ConsolidatedMetadataFilters); | ||
|
||
const result = generator.generateDownloadUrl(sequenceFilter, { | ||
dataType: { type: 'metadata' }, | ||
includeOldData: false, | ||
includeRestricted: false, | ||
compression: undefined, | ||
fields: ['field1', 'field2', 'field3'], | ||
}); | ||
|
||
// Check that the fields parameter is included in the URL | ||
expect(result.params.get('fields')).toBe('field1,field2,field3'); | ||
}); | ||
|
||
it('does not include fields parameter for non-metadata downloads', () => { | ||
const generator = new DownloadUrlGenerator(organism, lapisUrl, dataUseTermsEnabled); | ||
|
||
const sequenceFilter = new FieldFilter({}, {}, [] as ConsolidatedMetadataFilters); | ||
|
||
const result = generator.generateDownloadUrl(sequenceFilter, { | ||
dataType: { type: 'unalignedNucleotideSequences' }, | ||
includeOldData: false, | ||
includeRestricted: false, | ||
compression: undefined, | ||
fields: ['field1', 'field2', 'field3'], | ||
}); | ||
|
||
// Check that the fields parameter is not included in the URL | ||
expect(result.params.has('fields')).toBe(false); | ||
}); | ||
|
||
it('does not include fields parameter when fields array is empty', () => { | ||
const generator = new DownloadUrlGenerator(organism, lapisUrl, dataUseTermsEnabled); | ||
|
||
const sequenceFilter = new FieldFilter({}, {}, [] as ConsolidatedMetadataFilters); | ||
|
||
const result = generator.generateDownloadUrl(sequenceFilter, { | ||
dataType: { type: 'metadata' }, | ||
includeOldData: false, | ||
includeRestricted: false, | ||
compression: undefined, | ||
fields: [], | ||
}); | ||
|
||
// Check that the fields parameter is not included in the URL | ||
expect(result.params.has('fields')).toBe(false); | ||
}); | ||
|
||
it('does not include fields parameter when fields are undefined', () => { | ||
const generator = new DownloadUrlGenerator(organism, lapisUrl, dataUseTermsEnabled); | ||
|
||
const sequenceFilter = new FieldFilter({}, {}, [] as ConsolidatedMetadataFilters); | ||
|
||
const result = generator.generateDownloadUrl(sequenceFilter, { | ||
dataType: { type: 'metadata' }, | ||
includeOldData: false, | ||
includeRestricted: false, | ||
compression: undefined, | ||
fields: undefined, | ||
}); | ||
|
||
// Check that the fields parameter is not included in the URL | ||
expect(result.params.has('fields')).toBe(false); | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.