Skip to content

feat: add volume selection and display preferences to the storage widget - #275

Closed
matviienkop wants to merge 2 commits into
IceWhaleTech:mainfrom
matviienkop:feat/storage-widget-preferences
Closed

matviienkop wants to merge 2 commits into
IceWhaleTech:mainfrom
matviienkop:feat/storage-widget-preferences

Conversation

@matviienkop

Copy link
Copy Markdown

Motivation

On a NAS with a separate system card and data volume, the default storage widget does not let the user choose which mounted filesystems to monitor. This adds an opt-in view without changing the existing behavior for users who have not saved preferences.

Changes

  • Add a Widget tab to Storage Manager with volume selection, separate/combined display modes, explicit Save, and Reset.
  • Keep the original widget and its update logic when preferences are absent or reset.
  • Save preferences per CasaOS user in this browser's localStorage. They are not server-side settings and do not sync between browsers/devices.
  • Read mounted filesystems from the existing storage API, including system volumes. Deduplicate by filesystem UUID, with mount point as the fallback identity.
  • Show compact Used/Total rows and progress bars. Mount paths remain in the picker, not in the dashboard widget.
  • Refresh custom statistics every 30 seconds. Missing volumes are marked unavailable; API errors do not leave stale statistics displayed. Combined mode does not present a partial total when a selected volume is missing.
  • Add English and Russian translations; other languages use the existing English fallback.
  • Add 12 dependency-free Node tests and a dedicated Node 22 GitHub Actions workflow.

This is a UI-only change: it uses the existing read-only API and does not modify disks, RAID, mounts, shared folders, or backend configuration. The custom capacity view does not claim to report per-volume SMART/RAID health.

Validation

  • npm run test:storage-widget — 12 tests passed.
  • Project ESLint configuration passed for the four new JavaScript/Vue source and test files.
  • git diff --check.
  • Full Vue CLI build completed in a temporary dependency environment (see caveat below).
  • Browser verification: default view, select/save, separate and combined views, reload persistence, and reset.
  • Live Raspberry Pi NAS verification and user-approved screenshots of the configured widget and settings tab.

The tests cover preference parsing/user scoping, deduplication, stable identity, missing volumes, explicit save/reset, storage write errors, percentage edge cases, aggregate completeness, API failure/recovery, and late responses after unmount. Component-method tests use mocked APIs; they are not a replacement for browser verification.

Existing build-environment caveat

A clean frozen dependency install currently fails with HTTP 404 for the unused @icewhale/icewhale-files-openapi@1.3.0-alpha133 package. To validate compilation, I omitted that dependency only in a temporary build copy, ran the Vue Office/Vue Demi postinstall steps, and explicitly resolved webpack and Babel preset-env to their existing lockfile versions. No dependency removal, version change, lockfile change, or temporary build workaround is included in this PR. I am not claiming that the existing upstream dependency-install/CI issues are fixed here.

Screenshots

The actual user-configured view in the Russian locale, published with the device owner's permission.

Selected volumes displayed separately

Storage widget with the user's selected volumes

Widget preferences in Storage Manager

Widget preferences tab in Storage Manager

Target branch

The development guide asks contributors not to target main. However, I could not find a generic dev branch in this repository, its CONTRIBUTING.md is empty, and recent PRs target main. For that reason, I opened this PR against main rather than an unrelated topic branch. Please let me know if a different base branch is preferred.

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant