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

[BUG] - Can't sort table #280

Open
ajpanton opened this issue Dec 16, 2024 · 8 comments
Open

[BUG] - Can't sort table #280

ajpanton opened this issue Dec 16, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@ajpanton
Copy link

ajpanton commented Dec 16, 2024

Describe the bug
When viewing a table (Postgres), I can click on the column headers, which kind of sorts the items, but only whatever is visible on that page of (by default) 100 rows. There doesn't seem to be a way to sort the whole table.

To Reproduce
Steps to reproduce the behavior:

  1. Open a Postgres table with multiple pages of rows.
  2. Try to sort by a column. It will sort, but only the visible rows on the page.
  3. Change page. It appears to randomly keep the items sorted, but only one way.

Expected behavior
Being able to sort them whichever way we want, and to sort the whole table.

Desktop (please complete the following information):

  • OS: Which one is being asked here? My desktop is running Windows, but WhoDB is in a Docker container on a server running Linux.
  • Browser: Firefox
  • Version: Windows? 10. WhoDB? I can't find it anywhere. "image: clidey/whodb:latest" when this post was made.
@ajpanton ajpanton added the bug Something isn't working label Dec 16, 2024
@hkdeman
Copy link
Contributor

hkdeman commented Dec 19, 2024

Hello! Thank you for pointing out the bug. Love the detailing!

Definitely an improvement from our end. We will update this thread as soon as we have a PR for it!

@HarshDodiya1
Copy link
Contributor

Can anyone please guide me through this issue, I would like to work on this and require a point to start with.

@hkdeman
Copy link
Contributor

hkdeman commented Dec 23, 2024

@HarshDodiya1 thanks for picking this issue!

We currently only support sorting in frontend (this was done for smaller tables - dev - majorly). To achieve sorting at a query level, you would need to send the sortBy column name to the GraphQL query made. This way you will ensure that the entire data received is sorted in the correct order.

You would have to make changes to this "useGetStorageUnitRowsLazyQuery" (like we have where, pageSize, and pageOffset - you would need sortBy).

Similarly, add this capability to the backend in all the plugins for all the databases (as we need to sort across the board).

Hope this helps!

@modelorona
Copy link
Collaborator

hi @HarshDodiya1 , I wanted to see how you were getting along, if you're still working on the issue :)

@hkdeman hkdeman assigned modelorona and unassigned modelorona Jan 26, 2025
@HarshDodiya1
Copy link
Contributor

Hello, @modelorona! I hope you're doing well. I wanted to give you an update regarding the issue I’ve been working on. I was a step away for a while due to exams, but here’s what I have completed till now:

Changes that I made:

  1. Created a new type definition for sorting in the GraphQL schema to handle sorting input.
    File: frontend/src/graphql/schema.graphql

  2. Added sorting state to the explore-storage-unit component.
    File: frontend/src/pages/storage-unit/explore-storage-unit.tsx

  3. Added sorting handlers to the Table component.
    File: frontend/src/components/table.tsx

When I run the GraphQL code generation command to regenerate the types and queries, I get the following error in the terminal:

(node:26548) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✔ Parse Configuration
⚠ Generate outputs
  ❯ Generate to src/generated/graphql.tsx
    ✖
            Failed to load schema from http://localhost:8080/api/query:
            
            Unexpected response: "Unauthorized\n…
    ◼ Load GraphQL documents
    ◼ Generate
 ELIFECYCLE  Command failed with exit code 1.

Can you please guide me on how to resolve this issue?

I hope this make sense, and let me know if you need any code or further details.

@modelorona
Copy link
Collaborator

modelorona commented Feb 9, 2025

@HarshDodiya1 Apologies for the delayed response, had some personal stuff to handle :)

This is something we have been meaning to modify to make it easier, but for now you can go to core/src/auth/auth.go and comment out the AuthMiddleware so that it looks like this:

Image

this should get around that auth issue when trying to regenerate the GraphQL files. Let me know if it does not work!

@modelorona
Copy link
Collaborator

@HarshDodiya1 we pushed out some code in the latest version that should let you update the graphql stuff w/o having to do the workaround above. Let me know if it's still acting up.

@HarshDodiya1
Copy link
Contributor

Oh, thanks, @modelorona I will let you know about the updates soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants