Exclude archived collections from tree view (#19609)
* Exclude archived collections from tree view This is a bit more nuanced that it might first appear. The bug report is the permissions editor for collections is showing child collections which are archived. But the api sends back ALL collections, regardless of archival state. So the FE knows to omit top-level archived collections but not archived child collections. So we thought about just having the FE remove all archived ones, but best to remove it from the response. One worry is that we're not sure if any callers want archived collections in the tree view or not. So right now they are removed with a `?exclude-archived=true` query param, but if we can demonstrate that no callers of the tree api ever want archived items we can make this the behavior, rather than an optional behavior. To verify that the tree api is sending back all collections, you can check ```clj collection=> (collection/collections->tree {} [{:archived false :name "foo" :id 1 :location "/"} {:archived true :name "foo" :id 2 :location "/1/"} {:archived true :name "its archived" :location "/" :id 3}]) ;; we have always sent back archived collections, both top level and children ({:archived false, :name "foo", :id 1, :location "/", :children ({:archived true, :name "foo", :id 2, :location "/1/", :children ()})} {:archived true, :name "its archived", :location "/", :id 3, :children ()}) ``` * hide archived collections from the collections permissions page (#19616) * fix incorrect issue number Co-authored-by:Alexander Lesnenko <alxnddr@users.noreply.github.com> Co-authored-by:
Aleksandr Lesnenko <alxnddr@gmail.com>
Showing
- frontend/src/metabase/admin/permissions/components/CollectionPermissionsModal/CollectionPermissionsModal.jsx 2 additions, 1 deletion...CollectionPermissionsModal/CollectionPermissionsModal.jsx
- frontend/src/metabase/admin/permissions/pages/CollectionPermissionsPage/CollectionPermissionsPage.jsx 2 additions, 1 deletion...s/CollectionPermissionsPage/CollectionPermissionsPage.jsx
- frontend/src/metabase/admin/permissions/selectors/collection-permissions.js 32 additions, 27 deletions...ase/admin/permissions/selectors/collection-permissions.js
- frontend/test/__support__/e2e/commands/api/collection.js 7 additions, 0 deletionsfrontend/test/__support__/e2e/commands/api/collection.js
- frontend/test/metabase/scenarios/permissions/reproductions/19603-do-not-show-archived-collections.cy.spec.js 32 additions, 0 deletions...uctions/19603-do-not-show-archived-collections.cy.spec.js
- src/metabase/api/collection.clj 9 additions, 6 deletionssrc/metabase/api/collection.clj
- test/metabase/api/collection_test.clj 14 additions, 2 deletionstest/metabase/api/collection_test.clj
Loading
Please register or sign in to comment