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

Add the ability to filter certain properties in the deal list #1097

Merged
merged 11 commits into from
Jan 26, 2023

Conversation

jacobheun
Copy link
Contributor

@jacobheun jacobheun commented Jan 19, 2023

Purpose

Adds the ability to include filters when search for deals in addition to the existing query functionality. This should address all scenarios mentioned in #1014.

Example curls:

Get all offline deals pending transfer

curl -s -X POST -H "Content-Type: application/json" -d '{"query":"query { deals (filter: { Checkpoint: Accepted, IsOffline: true }) { deals { ID  Message} } }"}' http://localhost:8080/graphql/query

Get all deals currently in the sealing pipeline

curl -s -X POST -H "Content-Type: application/json" -d '{"query":"query { deals (filter: { Checkpoint: IndexedAndAnnounced }) { deals { ID  Message} } }"}' http://localhost:8080/graphql/query

Current Supported Properties

I've started with a subset of properties to filter by based on common scenarios. VerifiedDeal may be less useful atm, but there may be some useful applications there outside of the requested scenarios.

  • Checkpoint
  • IsOffline
  • TransferType (Not currently supported in the UI as we havent had requests)
  • IsVerified (Not currently supported in the UI as we havent had requests)

Work remaining

  • Hook up the graphql resolver to pass filters from the client
  • Fix the checkpoint filter so it's optional
  • Add support to the UI to select the filters

Disclaimer: Still getting up to speed on go, so please suggest more idiomatic usage where applicable.

Resolves #1014

Demos

Querying with filters via the GQL UI

20230124141720545.mp4

Querying with filters via the Web UI

20230125195402736_record.mp4

db/deals.go Show resolved Hide resolved
@jacobheun jacobheun force-pushed the feat/checkpoint-filter branch 2 times, most recently from ba29deb to bb0e9d9 Compare January 23, 2023 14:21
db/deals.go Outdated Show resolved Hide resolved
gql/resolver.go Outdated Show resolved Hide resolved
@jacobheun jacobheun force-pushed the feat/checkpoint-filter branch from 32c7abc to 52546b4 Compare January 24, 2023 13:33
jacobheun and others added 7 commits January 25, 2023 13:09
This adds the ability to pass a filter, for limited properties, to the deal list and count functions. This still needs to be properly exposed on the graphql resolver.
Currently checkpoint is mandatory, this needs to be made optional
This could use click away close detection
@jacobheun jacobheun force-pushed the feat/checkpoint-filter branch from 52546b4 to a723dd1 Compare January 25, 2023 16:00
@jacobheun jacobheun marked this pull request as ready for review January 25, 2023 19:18
@jacobheun jacobheun requested a review from dirkmc January 25, 2023 19:18
db/deals.go Outdated Show resolved Hide resolved
db/deals.go Show resolved Hide resolved
Copy link
Contributor

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🙌
Just one nit to fix and then feel free to merge.

@jacobheun jacobheun merged commit b9807c2 into main Jan 26, 2023
@jacobheun jacobheun deleted the feat/checkpoint-filter branch January 26, 2023 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add filter by Checkpoint
2 participants