Repository navigation
feat(widgets): reset the widget order to the default, specs for the keyboard move - #159
Merged
Merged
Conversation
…he keyboard move Widgets Settings gets a "Reset to the default order" link: the widgets go back to the order the dashboard ships them, each keeping whether it is hidden. It is disabled while the order already is the shipped one. The shipped-widgets list moves out of Settings.vue into shippedWidgets.js so a component spec can replace webpack's require.context. New specs cover the arrow key move (down, up, ends, focus following the widget), the reset button, and resetWidgetOrder with a name the dashboard no longer ships. The drag handles and the arrow keys this completes come from IceWhaleTech/CasaOS-UI#270 by moderathor12 (Apache-2.0).
# Conflicts: # CHANGELOG.md # src/assets/lang/en_US.json # src/assets/lang/fr_FR.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Reordering the sidebar widgets by drag and drop already ships on
main(v0.4.88, ported from IceWhaleTech/CasaOS-UI#270 by moderathor12, Apache-2.0): a drag handle per widget in Widgets Settings, arrow keys on the handle, and a saved order that survives a reload. This PR adds what that left out.Settings.spec.js): down, up, no-op at either end, visibility kept, focus follows the moved widget, reset button enabled/disabled and its result.resetWidgetOrderinwidgetOrder.js, with specs (a name the dashboard no longer ships goes last instead of being lost).Settings.vuetoshippedWidgets.jsso a spec can replace webpack'srequire.context. No behaviour change.Where the order lives (unchanged, and why)
The user service's custom storage, key
widgets_config, through$api.users.getCustomStorage/setCustomStorage. It is per user and follows them across browsers and phones, which localStorage would not. Loading goes throughcombineWidgetSettings: saved order wins, a widget a newer version adds goes at the end, one that is no longer shipped or is named twice is dropped, a missing or non-booleanshowfalls back to the shipped one. These cases were already specced.The "widgets" that can be ordered are the four sidebar ones (Time, System status, Storage, Network). Backups, Statistics and Fleet are app-grid cards, not sidebar widgets, so they are outside this setting.
Checked
src/components/widgets: clean. Full vitest on Node 22 / pnpm 9: 182 files, 8297 tests pass.vue-cli-service serve --mode mockagainst the in-repo stub), desktop 1024 wide: ArrowDown on the Time handle moved it below System status, focus stayed on the handle, the sidebar followed, the saved list changed, the order survived a reload, the reset link was disabled at the shipped order and enabled afterwards, and clicking it restoredclock, cpu, disks, networkin the saved list.