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

Persist sorting per view #6290

Merged
merged 11 commits into from
Jan 23, 2022
Merged

Persist sorting per view #6290

merged 11 commits into from
Jan 23, 2022

Conversation

kulmann
Copy link
Contributor

@kulmann kulmann commented Jan 20, 2022

Description

This PR adds a new composable (useRouteQueryPersisted) which takes care of syncing non-default query params into the localStorage automatically. It has been hooked into the useSort and usePagination composables (optional, can be overwritten, e.g. with mocks for tests).

This kind of spams the localStorage a little bit, but since we want to be flexible regarding the persistence backend we probably need to be on a fine grained key-value-pair level with persisting options/settings.

With this we now persist the sort choices into the local storage per view. I.e. navigating into subfolders will keep the same sort choices. Navigating to different views will restore the historic sort choices of that respective view.

Related Issue

Motivation and Context

Improve UX.

How Has This Been Tested?

Not yet, unit tests need to be added/adapted.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • changelog item
  • fix sorting on shared with me page

@update-docs
Copy link

update-docs bot commented Jan 20, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@kulmann
Copy link
Contributor Author

kulmann commented Jan 20, 2022

cc @dschmidt since this touches composables you have been working on

@kulmann kulmann self-assigned this Jan 20, 2022
@kulmann kulmann force-pushed the persist-sorting-per-view branch from 884654a to 97ce203 Compare January 20, 2022 13:32
Copy link
Member

@dschmidt dschmidt left a comment

Choose a reason for hiding this comment

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

This is really nice!

When I introduced the sort composable, I was annoyed I had to make the same adjustments in several locations - this nicely gets rid of those duplications. Love it!

Copy link
Contributor

@pascalwengerter pascalwengerter left a comment

Choose a reason for hiding this comment

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

Items per page seems to mostly work fine, just produced a This site appears to use a scroll-linked positioning effect. This may not work well with asynchronous panning; see https://firefox-source-docs.mozilla.org/performance/scroll-linked_effects.html for further details and to join the discussion on related tools and features! for me once in Firefox

Shared with me:

  • [Vue warn]: Property or method "targetRoute" is not defined on the instance but referenced during render. upon page navigation with only pending shares, pending&accepted and pending&accepted&declined shares
  • Accepted&declined shares table persist the same preference, but I suppose that is fine for now

Shared with others:

  • Sorting by name works
  • Sorting by Share receiver is broken
  • Sorting by Sharedate is broken

Shared via Link

  • Sorting by name works
  • Sorting by Share receiver is broken
  • Sorting by Sharedate is broken

@kulmann
Copy link
Contributor Author

kulmann commented Jan 21, 2022

Items per page seems to mostly work fine, just produced a This site appears to use a scroll-linked positioning effect. This may not work well with asynchronous panning; see https://firefox-source-docs.mozilla.org/performance/scroll-linked_effects.html for further details and to join the discussion on related tools and features! for me once in Firefox

Is that related to this PR? 🤔

Shared with me:

  • [Vue warn]: Property or method "targetRoute" is not defined on the instance but referenced during render. upon page navigation with only pending shares, pending&accepted and pending&accepted&declined shares

That's on master, but I fixed it now. The pending shares table was referencing a targetRoute variable that didn't exist anymore - just deleted it, because you can't click on resources in the pending shares table anyway, so there is no need for a target route. Additionally fixed, that the declined shares table had are-resources-clickable set to true, which doesn't make sense either, so I set are-resources-clickable to true now only for accepted shares, otherwise it's false.

  • Accepted&declined shares table persist the same preference, but I suppose that is fine for now

Yes, unfortunately the way the table is built this is not that easily changed, so I'd like to keep it for now. The better UX would be, that accepted and declined shares have their own sorting. Would like to look into that separately.

Shared with others:

  • Sorting by name works
  • Sorting by Share receiver is broken
  • Sorting by Sharedate is broken

Sorting by Shared with fixed - this was again a bug from current master. The fix was to handle undefined values during sorting by interpreting them as empty strings for sorting (undefined.toString() explodes, obviously).
Sorting by sharedate was not broken, but needed a page reload after clicking the broken Shared with sort button.
Same for Shared via Link

@fschade fschade force-pushed the persist-sorting-per-view branch from 2adbde6 to bd89542 Compare January 22, 2022 13:17
@ownclouders
Copy link
Contributor

Results for oC10SharingExternal https://drone.owncloud.com/owncloud/web/22095/40/1
The following scenarios passed on retry:

  • webUISharingExternal/federationSharing.feature:106

@ownclouders
Copy link
Contributor

Results for oC10iPhone3 https://drone.owncloud.com/owncloud/web/22095/49/1
The following scenarios passed on retry:

  • webUISharingPublicDifferentRoles/shareByPublicLinkDifferentRoles.feature:33

@ownclouders
Copy link
Contributor

Results for oC10XGAPortrait3 https://drone.owncloud.com/owncloud/web/22095/45/1
The following scenarios passed on retry:

  • webUISharingPublicDifferentRoles/shareByPublicLinkDifferentRoles.feature:35
  • webUISharingPublicDifferentRoles/shareByPublicLinkDifferentRoles.feature:33

@ownclouders
Copy link
Contributor

Results for oC10iPhone1 https://drone.owncloud.com/owncloud/web/22095/47/1
The following scenarios passed on retry:

  • webUIPrivateLinks/accessingPrivateLinks.feature:9

kulmann and others added 9 commits January 22, 2022 15:14
It's being used to auto-wire RouteQuery params to local storage. It also
enforced RouteQuery params to be set in the URL, even if the route was
visited without them. With this we start to always have a full state in
the URL.
Started with the usePagination composable which now handles the items per page
internally, including persistence to localStorage. Later on this can be
replaced with another storage (like settings in the backend).
@fschade fschade force-pushed the persist-sorting-per-view branch from bd89542 to d0b2b84 Compare January 22, 2022 14:16
@ownclouders
Copy link
Contributor

Results for oC10SharingExternal https://drone.owncloud.com/owncloud/web/22099/40/1
💥 The acceptance tests pipeline failed. The build has been cancelled.

@ownclouders
Copy link
Contributor

Results for oC10SharingPermission https://drone.owncloud.com/owncloud/web/22100/35/1
The following scenarios passed on retry:

  • webUISharingPermissionsUsers/sharePermissionsUsers.feature:21

@ownclouders
Copy link
Contributor

Results for oCISSharingBasic https://drone.owncloud.com/owncloud/web/22100/53/1
💥 The acceptance tests pipeline failed. The build has been cancelled.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

67.4% 67.4% Coverage
0.9% 0.9% Duplication

@kulmann kulmann merged commit 7f9b6c9 into master Jan 23, 2022
@delete-merged-branch delete-merged-branch bot deleted the persist-sorting-per-view branch January 23, 2022 10:49
@kulmann
Copy link
Contributor Author

kulmann commented Jan 23, 2022

Force merged without waiting for another CI run - the last one was green and the two commits didn't change anything that could explode in tests.

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.

File sorting is not persistent
5 participants