Skip to content

Store and retrieve the view type, per object type #8068

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
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

charlesh88
Copy link
Contributor

@charlesh88 charlesh88 commented May 14, 2025

Closes #1395

Describe your 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.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this a notable change that will require a special callout in the release notes? For example, will this break compatibility with existing APIs or projects that consume these plugins?

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Has this been smoke tested?
  • Have you associated this PR with a type: label? Note: this is not necessarily the same as the original issue.
  • Have you associated a milestone with this PR? Note: leave blank if unsure.
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?

- WIP
- BrowseBar.vue now stores view selection when viewSwitcher component is invoked as localstorage object 'openmct-stored-view-prefs'.
- Browse.js in `#viewObject` looks for an existing value in 'openmct-stored-view-prefs' and uses it.
- TODO: stored pref currently overrides `view` querystring parameters, but shouldn't.
- Browse.js now sets currentViewKey in the right spot.
  - Changes in #viewObject reset.
- Style tweaks to `c-list-view` when used in object-type folder.
- Added missing copyright header to list-view.scss.
Copy link

codecov bot commented May 14, 2025

Codecov Report

Attention: Patch coverage is 31.25000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 57.11%. Comparing base (826c713) to head (0464356).

Files with missing lines Patch % Lines
src/ui/layout/BrowseBar.vue 8.33% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8068      +/-   ##
==========================================
- Coverage   57.66%   57.11%   -0.56%     
==========================================
  Files         684      684              
  Lines       27558    27574      +16     
  Branches     2700     2704       +4     
==========================================
- Hits        15892    15748     -144     
- Misses      11330    11488     +158     
- Partials      336      338       +2     
Flag Coverage Δ
e2e-ci 63.14% <100.00%> (-0.07%) ⬇️
e2e-full 23.91% <100.00%> (-18.98%) ⬇️
unit 49.06% <31.25%> (-0.06%) ⬇️
Files with missing lines Coverage Δ
src/ui/router/Browse.js 93.67% <100.00%> (+0.33%) ⬆️
src/ui/layout/BrowseBar.vue 37.40% <8.33%> (-6.30%) ⬇️

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 826c713...0464356. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Successfully merging this pull request may close these issues.

Persist and remember user choice of object views
1 participant