-
Notifications
You must be signed in to change notification settings - Fork 9
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: add filter panel to single deposition page #1030
Merged
Merged
Changes from all commits
Commits
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
19 changes: 16 additions & 3 deletions
19
...end/packages/data-portal/app/components/DatasetFilter/AnnotationMetadataFilterSection.tsx
This file contains 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 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 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 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 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 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 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 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 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 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
57 changes: 57 additions & 0 deletions
57
frontend/packages/data-portal/app/graphql/getDatasetsFilterData.server.ts
This file contains 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,57 @@ | ||
import type { ApolloClient, NormalizedCacheObject } from '@apollo/client' | ||
|
||
import { gql } from 'app/__generated__' | ||
import { Datasets_Bool_Exp } from 'app/__generated__/graphql' | ||
|
||
const GET_DATASETS_FILTER_DATA_QUERY = gql(` | ||
query GetDatasetsFilterData( | ||
$filter: datasets_bool_exp, | ||
) { | ||
organism_names: datasets(where: $filter, distinct_on: organism_name) { | ||
organism_name | ||
} | ||
|
||
camera_manufacturers: tiltseries(distinct_on: camera_manufacturer) { | ||
camera_manufacturer | ||
} | ||
|
||
reconstruction_methods: tomograms(distinct_on: reconstruction_method) { | ||
reconstruction_method | ||
} | ||
|
||
reconstruction_softwares: tomograms(distinct_on: reconstruction_software) { | ||
reconstruction_software | ||
} | ||
|
||
object_names: annotations(distinct_on: object_name) { | ||
object_name | ||
} | ||
|
||
object_shape_types: annotation_files(distinct_on: shape_type) { | ||
shape_type | ||
} | ||
} | ||
`) | ||
|
||
export async function getDatasetsFilterData({ | ||
client, | ||
filter = {}, | ||
}: { | ||
client: ApolloClient<NormalizedCacheObject> | ||
filter: Datasets_Bool_Exp | ||
}) { | ||
const start = performance.now() | ||
|
||
const results = await client.query({ | ||
query: GET_DATASETS_FILTER_DATA_QUERY, | ||
variables: { | ||
filter, | ||
}, | ||
}) | ||
|
||
const end = performance.now() | ||
// eslint-disable-next-line no-console | ||
console.log(`getDatasetsFilterData query perf: ${end - start}ms`) | ||
|
||
return results | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to just make this a fragment? https://www.apollographql.com/docs/react/data/fragments/ That way any query can add this just by concatenating the string. It should generate the type too, hopefully that would work with
useTypedLoaderData()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes i think so. a lot of the codebase could actually benefit from fragments (for example authors)
how important do you think this is? since i have low bandwidth i would prefer to keep this as-is and make the refactor along with the other places we should be using fragments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's too important! Maybe file a ticket?