feat: Shared Views — save the current table view as a (shareable) bookmark (#41)#74
Conversation
Quality Check ResultsTypeScript Type Check✅ Passed - No type errors found ESLint✅ Passed - No linting errors Prettier Format Check✅ Passed - Code is properly formatted Build✅ Passed - Extension builds successfully Updated: 2026-06-29T20:00:58.927Z |
…f-share duplicates
…ows do not linger in the sharer nav
…void duplicate recipient bookmarks
Extended: multi-target view sharing (+ 3 follow-up bug fixes)This PR now also carries the multi-target enhancement on top of the original 3-scope Shared Views feature (folded in via fast-forward). What was addedAn admin can share a saved view with multiple specific roles and/or users in one save (scope
Permissions
Follow-up bug fixes (each live-reproduced and re-verified)
Testing
|
…tigial scope inputs
Summary
Closes #41.
Adds a "Save view" button to the Super Table header that saves the current table view as a native Directus bookmark, with a visibility scope:
The real gap behind #41 was sharing. Directus' built-in "Save as bookmark" hardcodes the current user, so a configured view could only ever be personal. This adds the missing in-layout way to create shared (role-wide / global) views. Saving the full layout configuration into a bookmark already worked natively — the missing piece was the shared scope.
How it works (native — no custom storage)
presetsStore(viauseStores()), never a custom collection or raw API:me→presetsStore.savePreset(...)(core stamps the current user)role/all→presetsStore.create({ ..., user: null, role })(the high-level helpers can't, because they force the current user)?bookmark=routing restores the view).directus_presetscreate permission +userStore.isAdmin, with a 403 fallback (the "own presets only" rule lives in a validation constraint that/permissions/meomits, so admin is the only client-side-reliable signal).Changes
src/types/sharedViews.types.ts— shared types (ViewScope, etc.)src/utils/buildViewPreset.ts— pure, layout-keyed preset payload buildersrc/utils/resolveAvailableScopes.ts— pure scope-availability logicsrc/composables/useSharedViews.ts— orchestration over the native storessrc/actions.vue— the header button + dialog (placed left of the existing "Save as Quick Filter" button)Testing
directus_presetsrow (user=null, role=null) carrying the correct layout-keyedlayout_query/layout_options, the URL switches to?bookmark=…, the bookmark appears in the nav, and the view restores on loadpnpm run quality(vue-tsc + eslint--max-warnings=0+ prettier) green