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 support for sharing table views via link #164

Closed
wants to merge 3 commits into from

Conversation

clevelandcs
Copy link
Contributor

What does this do?

  • Adds share button to top of list view
    • Share button shares current table sorts, filters, pagination, and columns with hash parameters
    • Sharing is done via link with
      • a) web share api or
      • b) updates link hash in URL bar for user to copy if share API is not supported by browser
  • Automatically sets table sorts, filters, pagination, and columns on load when visiting Spoolman with full share link

What is the use case for this feature?

  • Enables sharing of views in multi-user environments via simple link
  • Adds support for simple and quick location and/or material based inventory counts - in my case writing the link for the shelf or drybox location filter to NFC tags and QR codes attached to the shelf.

What is missing?

  • Possible translation issues. I'm not a linguist but did my best to add translations for the share button where applicable
  • Testing, I spent about an hour testing different scenarios but it would be nice to have more than one pair of eyes
  • QR code generation could possibly be added using this type of link for shelf ID labels

Please let me know if you see problems or things you'd like changed to get this merged. This is my first open-source contribution and I'm not a React developer (Vue+.NET is my wheelhouse). Thanks for the work you've done on this great tool!

@Donkie
Copy link
Owner

Donkie commented Oct 22, 2023

Thank you for your contribution! I agree this is something that is definitely needed.

Isn't it better though if we make the current window location reflect the filter/sorting/etc state instead of having it be generated by a button? That is, remove the button and instead update the browser window location on every render or something. Refine has some built-in functionality for this, the syncWithLocation variable on the useTable hook, but I have deliberately disabled that because it isn't fully compatible with the current way of doing filters and such.

Perhaps your method can be used instead, and we just have to figure out how to set the window hash at appropriate times.

@clevelandcs
Copy link
Contributor Author

I do agree with the idea of having the current window location reflect the current state of the table. The only reason I did it this way was concern for the perceived uglyness with the length of the location hash when it contains the full state of the table.

Perhaps it would be ideal to have the table state only as it differs from the initial state shown in the location hash. I will modify the behavior to that and see how it works. I'll update the PR with the changes of add another comment here if I come up with something else.

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.

2 participants