Skip to content

Persist and remember user choice of object views #1395

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

Open
charlesh88 opened this issue Jan 12, 2017 · 4 comments · May be fixed by #8068
Open

Persist and remember user choice of object views #1395

charlesh88 opened this issue Jan 12, 2017 · 4 comments · May be fixed by #8068

Comments

@charlesh88
Copy link
Contributor

charlesh88 commented Jan 12, 2017

From Kevin Smith JSC, via email thread Jan 10 - 12, 2017.

  1. When an object is placed in an Layout and set to a particular view, save that view with the Layout such that the saved view is instantiated by default when navving to the Layout.
  2. When viewing an object that supports multiple views, remember the last view associated with the object by that user and re-instantiate it the next time the user navs to that object. Apply this to not only "main" views of an object (such as navving to a Telemetry Point) but also to changing the view of a Telemetry Point in a Layout. In environments where we don't have user auth, it'd be better to do this per session locally than what we do now, which is nothing.

Related issues:

@charlesh88
Copy link
Contributor Author

Relates to #791

@charlesh88
Copy link
Contributor Author

charlesh88 commented May 14, 2025

Mods for item 2 above have been pushed to branch persist-folder-view-1395.

Changes

  • TLDR: the view switcher now locally stores and restores the last selected view for a given object type. This makes a folder's List View actually usable as the view persists as you navigate folders, rather than completely useless as in the current behavior of constantly reverting to the grid view.
  • Interacting with the view switcher in any view that uses it now stores that selection as a "view preference" for that object type in a localstorage object named 'openmct-stored-view-prefs'.
  • Browse.js > #navigateToPath now retrieves the stored view preference when its currentViewKey argument is undefined. This allows bookmarked views or links that include a view searchparam to force a particular view when desired. Navving to a link in this way doesn't update the stored preference; that only occurs when the view switcher is actively changed by the user.

Testing Notes

  1. Navigate to a folder and verify it displays by default with the "grid" view.
  2. Use the view switcher to select "List View". Verify that the view changes to the selected view, and that the label in the switcher displays "List View".
  3. Nav away to another view not a folder, then back to the initial folder or any other folder.
  4. Verify that the view is still the List View and didn't revert to the Grid View.
  5. Refresh the page, verify that the view remains as it was in step 6.
  6. Use the view switcher to select "Grid View". Verify that the view changes as expected.
  7. Repeat step 3 above.
  8. Verify that the view remains as Grid View.
  9. Manually edit the browser's URL querystring view parameter to change it from 'grid' to 'list-view', then press Enter to go to that URL. Verify that the view loads in the List View.
  10. Repeat step 3 above.
  11. Verify that the folder view is back to the last selected view which is Grid.

Repeat this test with other object types that have multiple views, like telemetry and Condition Sets.

@charlesh88
Copy link
Contributor Author

@mudinthewater Can you have a look at the changes above and let me know if you'd have any issues with this behavior?

@charlesh88 charlesh88 linked a pull request May 14, 2025 that will close this issue
14 tasks
@mudinthewater
Copy link

mudinthewater commented May 14, 2025

I think it should be fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants