The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Move collection helpers out of entities folder (#74209)
Romeo Van Snick0bcbe46b2a3b
diff --git a/enterprise/frontend/src/embedding/data-picker/DataSelector/tests/DataSourceSelector.unit.spec.tsx b/enterprise/frontend/src/embedding/data-picker/DataSelector/tests/DataSourceSelector.unit.spec.tsxindex 782cec7b3d8..d39834de5e6 100644--- a/enterprise/frontend/src/embedding/data-picker/DataSelector/tests/DataSourceSelector.unit.spec.tsx+++ b/enterprise/frontend/src/embedding/data-picker/DataSelector/tests/DataSourceSelector.unit.spec.tsx@@ -8,7 +8,7 @@ import {} from "__support__/server-mocks";import { renderWithProviders, screen } from "__support__/ui";import { getNextId } from "__support__/utils";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import type { EmbeddingEntityType } from "metabase/redux/store/embedding-data-picker";import {createMockSettingsState,diff --git a/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsx b/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsxindex d389c109f84..fcd1f261480 100644--- a/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsx+++ b/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsx@@ -2,10 +2,10 @@ import { Fragment } from "react";import { t } from "ttag";import { skipToken, useListCollectionItemsQuery } from "metabase/api";+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import { EmptyState } from "metabase/common/components/EmptyState";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { SelectList } from "metabase/common/components/SelectList";-import { PERSONAL_COLLECTIONS } from "metabase/entities/collections/constants";import { useTranslateContent } from "metabase/i18n/hooks";import { PLUGIN_MODERATION } from "metabase/plugins";import { Box } from "metabase/ui";diff --git a/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityPicker.jsx b/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityPicker.jsxindex 3e70736a2b2..2b3697cc794 100644--- a/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityPicker.jsx+++ b/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityPicker.jsx@@ -5,17 +5,15 @@ import {useGetCollectionQuery,useListCollectionsTreeQuery,} from "metabase/api";+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import {+ buildCollectionTree,currentUserPersonalCollections,isRootPersonalCollection,nonPersonalOrArchivedCollection,} from "metabase/collections/utils";import { Tree } from "metabase/common/components/tree";import CS from "metabase/css/core/index.css";-import {- PERSONAL_COLLECTIONS,- buildCollectionTree,-} from "metabase/entities/collections";import { useSelector } from "metabase/redux";import { getUser } from "metabase/selectors/user";import { Box, Icon } from "metabase/ui";diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/CollectionsNavTree/CollectionsNavTree.tsx b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/CollectionsNavTree/CollectionsNavTree.tsxindex e24c85528a3..09da863ead7 100644--- a/enterprise/frontend/src/metabase-enterprise/remote_sync/components/CollectionsNavTree/CollectionsNavTree.tsx+++ b/enterprise/frontend/src/metabase-enterprise/remote_sync/components/CollectionsNavTree/CollectionsNavTree.tsx@@ -1,9 +1,9 @@import { useCallback, useMemo } from "react";import { useListCollectionsQuery } from "metabase/api";+import type { CollectionTreeItem } from "metabase/collections/utils";import { Tree } from "metabase/common/components/tree";import type { ITreeNodeItem } from "metabase/common/components/tree/types";-import type { CollectionTreeItem } from "metabase/entities/collections";import { SidebarCollectionLink } from "metabase/nav/containers/MainNavbar/SidebarItems";import { useRemoteSyncDirtyState } from "../../hooks/use-remote-sync-dirty-state";diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-library-dirty-changes.ts b/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-library-dirty-changes.tsindex d0e2777bd9e..919d73c67eb 100644--- a/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-library-dirty-changes.ts+++ b/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-library-dirty-changes.ts@@ -1,9 +1,11 @@import { useMemo } from "react";import { useListCollectionsTreeQuery } from "metabase/api";-import { isLibraryCollection } from "metabase/collections/utils";+import {+ buildCollectionTree,+ isLibraryCollection,+} from "metabase/collections/utils";import { getAllDescendantIds } from "metabase/common/components/tree/utils";-import { buildCollectionTree } from "metabase/entities/collections";import type { CollectionId } from "metabase-types/api";import { useGitSyncVisible } from "./use-git-sync-visible";diff --git a/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-transform-dirty-changes.ts b/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-transform-dirty-changes.tsindex 7ed8c49a847..a337e5612cc 100644--- a/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-transform-dirty-changes.ts+++ b/enterprise/frontend/src/metabase-enterprise/remote_sync/hooks/use-has-transform-dirty-changes.ts@@ -1,9 +1,9 @@import { useMemo } from "react";import { useListCollectionsTreeQuery } from "metabase/api";+import { buildCollectionTree } from "metabase/collections/utils";import { getAllDescendantIds } from "metabase/common/components/tree/utils";import { useSetting } from "metabase/common/hooks";-import { buildCollectionTree } from "metabase/entities/collections";import { TRANSFORMS_ROOT_ID } from "metabase-enterprise/remote_sync/utils";import { useGitSyncVisible } from "./use-git-sync-visible";diff --git a/enterprise/frontend/src/metabase-enterprise/replacement/pages/MigrateModelsPage/ModelTable/utils.tsx b/enterprise/frontend/src/metabase-enterprise/replacement/pages/MigrateModelsPage/ModelTable/utils.tsxindex 9d3f1cc0734..6f25edf5d2b 100644--- a/enterprise/frontend/src/metabase-enterprise/replacement/pages/MigrateModelsPage/ModelTable/utils.tsx+++ b/enterprise/frontend/src/metabase-enterprise/replacement/pages/MigrateModelsPage/ModelTable/utils.tsx@@ -1,6 +1,6 @@import { t } from "ttag";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import type { TreeTableColumnDef } from "metabase/ui";import { Ellipsified, EntityNameCell } from "metabase/ui";import type { SearchResult } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.unit.spec.tsxindex a801db6ae55..8294b8305fb 100644--- a/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.unit.spec.tsx+++ b/enterprise/frontend/src/metabase-enterprise/sandboxes/components/EditSandboxingModal/EditSandboxingModal.unit.spec.tsx@@ -16,7 +16,7 @@ import {waitFor,waitForLoaderToBeRemoved,} from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import type {DatabaseFeature,GroupTableAccessPolicy,diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/components/MainNavSharedCollections/MainNavSharedCollections.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/components/MainNavSharedCollections/MainNavSharedCollections.tsxindex a7766573b95..b39cc851a25 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/components/MainNavSharedCollections/MainNavSharedCollections.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/components/MainNavSharedCollections/MainNavSharedCollections.tsx@@ -7,9 +7,9 @@ import {} from "metabase/api";import { CreateCollectionForm } from "metabase/collections/components/CreateCollectionForm";import type { CreateCollectionProperties } from "metabase/collections/components/CreateCollectionForm/CreateCollectionForm";+import { buildCollectionTree } from "metabase/collections/utils";import { Tree } from "metabase/common/components/tree";import { useSetting } from "metabase/common/hooks";-import { buildCollectionTree } from "metabase/entities/collections";import {PaddedSidebarLink,SidebarHeading,diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionList/TenantCollectionList.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionList/TenantCollectionList.tsxindex eeaeb77f2d7..b2cda09a324 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionList/TenantCollectionList.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionList/TenantCollectionList.tsx@@ -1,7 +1,7 @@import { t } from "ttag";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { CollectionListView } from "metabase/common/components/CollectionListView";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";import * as Urls from "metabase/urls";import { useListTenantsQuery } from "metabase-enterprise/api";import type { IconName } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionPermissionsPage/selectors.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionPermissionsPage/selectors.tsxindex b5d979b54aa..a42542a2323 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionPermissionsPage/selectors.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantCollectionPermissionsPage/selectors.tsx@@ -23,10 +23,8 @@ import {isDefaultGroup,} from "metabase/admin/utils/groups";import { collectionApi } from "metabase/api";-import {- ROOT_COLLECTION,- getCollectionIcon,-} from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";+import { getCollectionIcon } from "metabase/collections/utils";import { PLUGIN_TENANTS } from "metabase/plugins";import type { ExpandedCollection, State } from "metabase/redux/store";import { isNotNull } from "metabase/utils/types";diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantSpecificCollectionPermissionsPage/selectors.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantSpecificCollectionPermissionsPage/selectors.tsxindex feeb36a80d2..be30b90d19b 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantSpecificCollectionPermissionsPage/selectors.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantSpecificCollectionPermissionsPage/selectors.tsx@@ -22,11 +22,9 @@ import {isDefaultGroup,} from "metabase/admin/utils/groups";import { collectionApi } from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";+import { getCollectionIcon } from "metabase/collections/utils";import { findCollectionById } from "metabase/common/utils/collections";-import {- ROOT_COLLECTION,- getCollectionIcon,-} from "metabase/entities/collections";import { PLUGIN_TENANTS } from "metabase/plugins";import type { ExpandedCollection, State } from "metabase/redux/store";import { isNotNull } from "metabase/utils/types";diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersList/TenantUsersList.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersList/TenantUsersList.tsxindex 04a3b2b02d6..e914663f5cf 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersList/TenantUsersList.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersList/TenantUsersList.tsx@@ -1,7 +1,7 @@import { t } from "ttag";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { CollectionListView } from "metabase/common/components/CollectionListView";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";import * as Urls from "metabase/urls";import { useListTenantsQuery } from "metabase-enterprise/api";import type { IconName } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersPersonalCollectionList/TenantUsersPersonalCollectionList.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersPersonalCollectionList/TenantUsersPersonalCollectionList.tsxindex 0b418b32d66..8e4eab224a3 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersPersonalCollectionList/TenantUsersPersonalCollectionList.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantUsersPersonalCollectionList/TenantUsersPersonalCollectionList.tsx@@ -1,8 +1,8 @@import { t } from "ttag";import { useListUsersQuery } from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { CollectionListView } from "metabase/common/components/CollectionListView";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";import * as Urls from "metabase/urls";import { useGetTenantQuery } from "metabase-enterprise/api";import type { IconName } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/index.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/index.tsxindex b09ea2a2716..fd6996fd7b7 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/index.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/index.tsx@@ -12,12 +12,12 @@ import {useGetCollectionQuery,useListCollectionsTreeQuery,} from "metabase/api";-import { useSetting } from "metabase/common/hooks/use-setting";import {type CollectionTreeItem,buildCollectionTree,getCollectionIcon,-} from "metabase/entities/collections";+} from "metabase/collections/utils";+import { useSetting } from "metabase/common/hooks/use-setting";import { ModalRoute } from "metabase/hoc/ModalRoute";import {PLUGIN_ADMIN_PERMISSIONS_TABS,diff --git a/frontend/src/embedding-sdk-bundle/components/private/SdkBreadcrumbs/setup.spec.tsx b/frontend/src/embedding-sdk-bundle/components/private/SdkBreadcrumbs/setup.spec.tsxindex 05c38767e3c..1941e6f5d97 100644--- a/frontend/src/embedding-sdk-bundle/components/private/SdkBreadcrumbs/setup.spec.tsx+++ b/frontend/src/embedding-sdk-bundle/components/private/SdkBreadcrumbs/setup.spec.tsx@@ -25,8 +25,8 @@ import { createMockSdkConfig } from "embedding-sdk-bundle/test/mocks/config";import { setupSdkState } from "embedding-sdk-bundle/test/server-mocks/sdk-init";import type { SdkCollectionId } from "embedding-sdk-bundle/types";import type { SdkBreadcrumbItemType } from "embedding-sdk-bundle/types/breadcrumb";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { useLocale } from "metabase/common/hooks/use-locale";-import { ROOT_COLLECTION } from "metabase/entities/collections";import { Stack } from "metabase/ui";import {createMockCard,diff --git a/frontend/src/embedding-sdk-bundle/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsxindex 864487529e3..59e47f09d7d 100644--- a/frontend/src/embedding-sdk-bundle/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsx+++ b/frontend/src/embedding-sdk-bundle/components/public/CollectionBrowser/CollectionBrowser.unit.spec.tsx@@ -13,8 +13,8 @@ import {import { renderWithSDKProviders } from "embedding-sdk-bundle/test/__support__/ui";import { createMockSdkConfig } from "embedding-sdk-bundle/test/mocks/config";import { setupSdkState } from "embedding-sdk-bundle/test/server-mocks/sdk-init";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { useLocale } from "metabase/common/hooks/use-locale";-import { ROOT_COLLECTION } from "metabase/entities/collections";import type { Collection, CollectionItem, User } from "metabase-types/api";import {createMockCollection,diff --git a/frontend/src/embedding-sdk-bundle/components/public/CreateDashboardModal/CreateDashboardModal.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/CreateDashboardModal/CreateDashboardModal.unit.spec.tsxindex f9b7868baad..2db5b17be30 100644--- a/frontend/src/embedding-sdk-bundle/components/public/CreateDashboardModal/CreateDashboardModal.unit.spec.tsx+++ b/frontend/src/embedding-sdk-bundle/components/public/CreateDashboardModal/CreateDashboardModal.unit.spec.tsx@@ -9,8 +9,8 @@ import { screen, waitFor } from "__support__/ui";import { getNextId } from "__support__/utils";import { renderWithSDKProviders } from "embedding-sdk-bundle/test/__support__/ui";import { createMockSdkConfig } from "embedding-sdk-bundle/test/mocks/config";+import { ROOT_COLLECTION as ROOT } from "metabase/collections/constants";import { useLocale } from "metabase/common/hooks/use-locale";-import { ROOT_COLLECTION as ROOT } from "metabase/entities/collections";import type { Collection, Dashboard } from "metabase-types/api";import {createMockCollection,diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/enterprise.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/enterprise.unit.spec.tsxindex 1e67dae3b0c..5238cec0136 100644--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/enterprise.unit.spec.tsx+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/enterprise.unit.spec.tsx@@ -7,7 +7,7 @@ import {setupSearchEndpoints,} from "__support__/server-mocks";import { screen, waitFor, within } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockCollection } from "metabase-types/api/mocks";import { addEnterpriseAutoRefreshTests } from "../shared-tests/auto-refresh.spec";diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/premium.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/premium.unit.spec.tsxindex faf5b14efa2..1fbfea54cc0 100644--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/premium.unit.spec.tsx+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/premium.unit.spec.tsx@@ -7,7 +7,7 @@ import {setupSearchEndpoints,} from "__support__/server-mocks";import { screen, within } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockCollection } from "metabase-types/api/mocks";import { addPremiumAutoRefreshTests } from "../shared-tests/auto-refresh.spec";diff --git a/frontend/src/metabase/admin/permissions/selectors/collection-permissions.tsx b/frontend/src/metabase/admin/permissions/selectors/collection-permissions.tsxindex 4c638ce26e2..dde7bd50d38 100644--- a/frontend/src/metabase/admin/permissions/selectors/collection-permissions.tsx+++ b/frontend/src/metabase/admin/permissions/selectors/collection-permissions.tsx@@ -10,15 +10,13 @@ import {isDefaultGroup,} from "metabase/admin/utils/groups";import { collectionApi } from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";import {+ getCollectionIcon,isInstanceAnalyticsCollection,isLibraryCollection,nonPersonalOrArchivedCollection,} from "metabase/collections/utils";-import {- ROOT_COLLECTION,- getCollectionIcon,-} from "metabase/entities/collections";import { PLUGIN_COLLECTIONS, PLUGIN_TENANTS } from "metabase/plugins";import type {CollectionTreeItem,diff --git a/frontend/src/metabase/collections/components/PinnedQuestionCard/test/setup.tsx b/frontend/src/metabase/collections/components/PinnedQuestionCard/test/setup.tsxindex 81d39f64590..d758dd6584f 100644--- a/frontend/src/metabase/collections/components/PinnedQuestionCard/test/setup.tsx+++ b/frontend/src/metabase/collections/components/PinnedQuestionCard/test/setup.tsx@@ -6,7 +6,7 @@ import {import { mockSettings } from "__support__/settings";import { createMockEntitiesState } from "__support__/store";import { renderWithProviders } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockState } from "metabase/redux/store/mocks";import registerVisualizations from "metabase/visualizations/register";import type { CollectionItem } from "metabase-types/api";diff --git a/frontend/src/metabase/entities/collections/constants.ts b/frontend/src/metabase/collections/constants.tssimilarity index 100%rename from frontend/src/metabase/entities/collections/constants.tsrename to frontend/src/metabase/collections/constants.tsdiff --git a/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.tsx b/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.tsxindex 7ebf38ac0c1..550cbf578d4 100644--- a/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.tsx+++ b/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.tsx@@ -12,6 +12,7 @@ import {import {type EntityType,canonicalCollectionId,+ getCollectionIcon,isTrashedCollection,isValidCollectionId,} from "metabase/collections/utils";@@ -31,7 +32,6 @@ import {} from "metabase/common/components/Pickers";import { SnippetCollectionName } from "metabase/common/components/SnippetCollectionName";import { useUniqueId } from "metabase/common/hooks/use-unique-id";-import { getCollectionIcon } from "metabase/entities/collections/utils";import { Button, Flex, Icon } from "metabase/ui";import type { CollectionId, DashboardId } from "metabase-types/api";diff --git a/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.unit.spec.tsx b/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.unit.spec.tsxindex 791e9baabe8..c26540073cf 100644--- a/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.unit.spec.tsx+++ b/frontend/src/metabase/collections/containers/FormCollectionAndDashboardPicker/FormCollectionAndDashboardPicker.unit.spec.tsx@@ -15,8 +15,8 @@ import {screen,waitForLoaderToBeRemoved,} from "__support__/ui";+import { ROOT_COLLECTION } from "metabase/collections/constants";import type { OmniPickerItem } from "metabase/common/components/Pickers";-import { ROOT_COLLECTION } from "metabase/entities/collections";import { FormProvider } from "metabase/forms";import {createMockCollection,diff --git a/frontend/src/metabase/entities/collections/getExpandedCollectionsById.js b/frontend/src/metabase/collections/getExpandedCollectionsById.jssimilarity index 100%rename from frontend/src/metabase/entities/collections/getExpandedCollectionsById.jsrename to frontend/src/metabase/collections/getExpandedCollectionsById.jsdiff --git a/frontend/src/metabase/collections/hooks.ts b/frontend/src/metabase/collections/hooks.tsindex e9b40a93cf5..f44c2151402 100644--- a/frontend/src/metabase/collections/hooks.ts+++ b/frontend/src/metabase/collections/hooks.ts@@ -2,7 +2,7 @@ import type { Location } from "history";import { useMemo } from "react";import { skipToken, useGetCollectionQuery } from "metabase/api";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { PLUGIN_COLLECTIONS } from "metabase/plugins";import { useSelector } from "metabase/redux";import { getUser, getUserPersonalCollectionId } from "metabase/selectors/user";diff --git a/frontend/src/metabase/collections/utils.ts b/frontend/src/metabase/collections/utils.tsindex c47fa344880..0f8af898286 100644--- a/frontend/src/metabase/collections/utils.ts+++ b/frontend/src/metabase/collections/utils.ts@@ -4,21 +4,28 @@ import {canPlaceEntityInCollection as canPlaceEntityInCollectionImpl,canPlaceEntityInCollectionOrDescendants as canPlaceEntityInCollectionOrDescendantsImpl,} from "metabase/data-studio/utils";-// Importing from collections/constants to break import cycle-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";import { PLUGIN_COLLECTIONS, PLUGIN_LIBRARY } from "metabase/plugins";+import type { State } from "metabase/redux/store";+import { getUserPersonalCollectionId } from "metabase/selectors/user";+import type { IconProps } from "metabase/ui";+import { color } from "metabase/ui/colors";+import type { ColorName } from "metabase/ui/colors/types";import {type CardType,type Collection,+ type CollectionContentModel,type CollectionEssentials,type CollectionId,type CollectionItem,type CollectionItemModel,type CollectionType,+ type IconName,type User,isBaseEntityID,} from "metabase-types/api";+import { PERSONAL_COLLECTIONS, ROOT_COLLECTION } from "./constants";+export type EntityType = CollectionItemModel;export function getEntityTypeFromCardType(cardType: CardType): EntityType {@@ -380,3 +387,111 @@ export const getCollectionPathAsArray = (collection: Collection): string[] => {const parentIds = (collection.location ?? "").split("/").filter(Boolean);return [...parentIds, String(collection.id)];};++export function getCollectionIcon(+ collection: Partial<Collection>,+ { tooltip = "default", isTenantUser = false } = {},+): {+ name: IconName;+ color?: ColorName;+ tooltip?: string;+} {+ if (collection.id === PERSONAL_COLLECTIONS.id) {+ return { name: "group" };+ }++ if (collection.type === "trash") {+ return { name: "trash" };+ }++ if (isRootPersonalCollection(collection)) {+ return { name: "person" };+ }++ if (isSyncedCollection(collection) && !isTenantUser) {+ // tenant users see the normal icon, they don't know what a synced collection is+ return { name: "synced_collection" };+ }++ if (collection.is_library_root) {+ switch (collection.type) {+ case "library":+ return { name: "repository" };+ case "library-data":+ return { name: "table" };+ case "library-metrics":+ return { name: "metric" };+ }+ }++ const type = PLUGIN_COLLECTIONS.getCollectionType(collection);+ return type+ ? {+ name: type.icon as unknown as IconName,+ color: type.color ? color(type.color) : undefined,+ tooltip: type.tooltips?.[tooltip],+ }+ : { name: "folder" };+}++export function getCollectionType(+ collectionId: Collection["id"] | undefined | null,+ state: State,+) {+ if (collectionId === null || collectionId === "root") {+ return "root";+ }+ if (collectionId === getUserPersonalCollectionId(state)) {+ return "personal";+ }+ return collectionId !== undefined ? "other" : null;+}++export interface CollectionTreeItem extends Collection {+ icon: IconName | IconProps;+ children: CollectionTreeItem[];+ schemaName?: string;+ nonNavigable?: boolean;+}++export function buildCollectionTree(+ collections: Collection[] = [],+ {+ modelFilter,+ isTenantUser = false,+ }: {+ modelFilter?: (model: CollectionContentModel) => boolean;+ isTenantUser?: boolean;+ } = {},+): CollectionTreeItem[] {+ return collections.flatMap((collection) => {+ const isPersonalRoot = collection.id === PERSONAL_COLLECTIONS.id;++ const isMatchedByFilter =+ !modelFilter ||+ collection.here?.some(modelFilter) ||+ collection.below?.some(modelFilter);++ if (!isPersonalRoot && !isMatchedByFilter) {+ return [];+ }++ const children = !isRootTrashCollection(collection)+ ? buildCollectionTree(+ collection.children?.filter((child) => !child.archived) || [],+ { modelFilter, isTenantUser },+ )+ : [];++ if (isPersonalRoot && children.length === 0) {+ return [];+ }++ return {+ ...collection,+ schemaName: collection.originalName || collection.name,+ icon: getCollectionIcon(collection, { isTenantUser }),+ children,+ };+ });+}diff --git a/frontend/src/metabase/collections/utils.unit.spec.ts b/frontend/src/metabase/collections/utils.unit.spec.tsindex 8871ee1c993..333e8898da1 100644--- a/frontend/src/metabase/collections/utils.unit.spec.ts+++ b/frontend/src/metabase/collections/utils.unit.spec.ts@@ -1,6 +1,14 @@+import { setupEnterpriseOnlyPlugin } from "__support__/enterprise";+import { mockSettings } from "__support__/settings";import {+ PERSONAL_COLLECTIONS,+ ROOT_COLLECTION,+} from "metabase/collections/constants";+import {+ buildCollectionTree,canonicalCollectionId,canonicalCollectionIdOrEntityId,+ getCollectionIcon,getCollectionPathAsString,isExamplesCollection,isItemCollection,@@ -10,12 +18,12 @@ import {isRootTrashCollection,normalizedCollection,} from "metabase/collections/utils";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";import { type Collection, SEARCH_MODELS } from "metabase-types/api";import {createMockCollection,createMockCollectionItem,createMockSearchResult,+ createMockTokenFeatures,} from "metabase-types/api/mocks";describe("Collections > utils", () => {@@ -342,4 +350,408 @@ describe("Collections > utils", () => {);});});++ describe("buildCollectionTree", () => {+ it("returns an empty array when collections are not passed", () => {+ expect(buildCollectionTree()).toEqual([]);+ });++ it("correctly transforms collections", () => {+ const collection = createMockCollection({ children: [] });+ const [transformed] = buildCollectionTree([collection]);+ expect(transformed).toMatchObject({+ id: collection.id,+ name: collection.name,+ schemaName: collection.name,+ icon: { name: "folder" },+ children: [],+ });+ });++ it("prefers originalName over name for schema names", () => {+ const collection = createMockCollection({+ name: "bar",+ originalName: "foo",+ });+ const [transformed] = buildCollectionTree([collection]);+ expect(transformed.schemaName).toBe(collection.originalName);+ });++ it("recursively transforms collection children", () => {+ const grandchild = createMockCollection({ id: 3, name: "C3" });+ const child = createMockCollection({+ id: 2,+ name: "C2",+ children: [grandchild],+ });+ const collection = createMockCollection({+ id: 1,+ name: "C1",+ children: [child],+ });++ const [transformed] = buildCollectionTree([collection]);++ expect(transformed).toMatchObject({+ id: collection.id,+ name: collection.name,+ schemaName: collection.name,+ icon: { name: "folder" },+ children: [+ {+ id: child.id,+ name: child.name,+ schemaName: child.name,+ icon: { name: "folder" },+ children: [+ {+ id: grandchild.id,+ name: grandchild.name,+ schemaName: grandchild.name,+ icon: { name: "folder" },+ children: [],+ },+ ],+ },+ ],+ });+ });++ it("returns regular icon for official collections in OSS", () => {+ const collection = createMockCollection({ authority_level: "official" });+ const [transformed] = buildCollectionTree([collection]);+ expect(transformed.icon).toEqual({ name: "folder" });+ });++ describe("filtering by models", () => {+ it("only keeps collection branches containing target models", () => {+ const grandchild1 = createMockCollection({+ id: 4,+ name: "Grandchild 1",+ here: ["dataset"],+ });+ const grandchild2 = createMockCollection({+ id: 3,+ name: "Grandchild 2",+ here: ["card"],+ });+ const child = createMockCollection({+ id: 2,+ name: "Child",+ below: ["dataset", "card"],+ children: [grandchild1, grandchild2],+ });+ const collection = createMockCollection({+ id: 1,+ name: "Top-level",+ below: ["dataset", "card"],+ children: [child],+ });++ const transformed = buildCollectionTree([collection], {+ modelFilter: (model) => model === "dataset",+ });++ expect(transformed).toMatchObject([+ {+ id: collection.id,+ name: collection.name,+ schemaName: collection.name,+ icon: { name: "folder" },+ below: ["dataset", "card"],+ children: [+ {+ id: child.id,+ name: child.name,+ schemaName: child.name,+ below: ["dataset", "card"],+ icon: { name: "folder" },+ children: [+ {+ id: grandchild1.id,+ name: grandchild1.name,+ schemaName: grandchild1.name,+ icon: { name: "folder" },+ children: [],+ here: ["dataset"],+ },+ ],+ },+ ],+ },+ ]);+ });++ it("filters top-level collections not containing target models", () => {+ const collectionWithDatasets = createMockCollection({+ id: 1,+ name: "Top-level",+ here: ["dataset"],+ children: [],+ });+ const collectionWithCards = createMockCollection({+ id: 5,+ name: "Top-level 2",+ below: ["card"],+ });++ const transformed = buildCollectionTree(+ [collectionWithDatasets, collectionWithCards],+ { modelFilter: (model) => model === "dataset" },+ );++ expect(transformed).toMatchObject([+ {+ id: collectionWithDatasets.id,+ name: collectionWithDatasets.name,+ schemaName: collectionWithDatasets.name,+ icon: { name: "folder" },+ here: ["dataset"],+ children: [],+ },+ ]);+ });++ it("preserves personal collections root if there are other users personal collections with target models", () => {+ const collection = createMockCollection({+ ...PERSONAL_COLLECTIONS,+ children: [+ createMockCollection({+ name: "A",+ below: ["card"],+ children: [+ createMockCollection({+ name: "A1",+ here: ["card"],+ }),+ ],+ }),+ createMockCollection({+ name: "B",+ below: ["dataset"],+ children: [+ createMockCollection({+ name: "B1",+ here: ["dataset"],+ }),+ ],+ }),+ createMockCollection({+ name: "C",+ children: [+ createMockCollection({+ name: "C1",+ }),+ ],+ }),+ ],+ });++ const collectionTree = buildCollectionTree([collection], {+ modelFilter: (model) => model === "card",+ });++ expect(collectionTree).toMatchObject([+ {+ ...PERSONAL_COLLECTIONS,+ children: [+ {+ name: "A",+ children: [+ {+ name: "A1",+ },+ ],+ },+ ],+ },+ ]);+ });++ it("does not preserve personal collections root if there are no other users personal collections with target models", () => {+ const collection = createMockCollection({+ ...PERSONAL_COLLECTIONS,+ children: [+ createMockCollection({+ name: "A",+ here: ["dataset"],+ children: [+ createMockCollection({+ name: "A1",+ }),+ ],+ }),+ createMockCollection({+ name: "B",+ }),+ ],+ });++ const collectionTree = buildCollectionTree([collection], {+ modelFilter: (model) => model === "card",+ });++ expect(collectionTree).toEqual([]);+ });++ it("doesn't filter collections if model filter is not passed", () => {+ const child = createMockCollection({+ id: 2,+ name: "Child",+ here: ["dataset"],+ });+ const collection = createMockCollection({+ id: 1,+ name: "Top-level",+ below: ["dataset"],+ children: [child],+ });+ const collectionWithCards = createMockCollection({+ id: 5,+ name: "Top-level 2",+ below: ["card"],+ });++ const transformed = buildCollectionTree([+ collection,+ collectionWithCards,+ ]);++ expect(transformed).toMatchObject([+ {+ id: collection.id,+ name: collection.name,+ schemaName: collection.name,+ icon: { name: "folder" },+ below: ["dataset"],+ children: [+ {+ id: child.id,+ name: child.name,+ schemaName: child.name,+ icon: { name: "folder" },+ here: ["dataset"],+ children: [],+ },+ ],+ },+ {+ id: collectionWithCards.id,+ name: collectionWithCards.name,+ schemaName: collectionWithCards.name,+ icon: { name: "folder" },+ children: [],+ below: ["card"],+ },+ ]);+ });+ });++ describe("EE", () => {+ beforeEach(() => {+ mockSettings({+ "token-features": createMockTokenFeatures({+ official_collections: true,+ audit_app: true,+ }),+ });+ setupEnterpriseOnlyPlugin("collections");+ });++ it("returns correct icon for official collections", () => {+ const collection = createMockCollection({+ authority_level: "official",+ });+ const [transformed] = buildCollectionTree([collection]);+ expect(transformed.icon).toEqual({+ color: expect.any(String),+ name: "official_collection",+ tooltip: "Official collection",+ });+ });+ });+ });++ describe("getCollectionIcon", () => {+ const commonTestCases = [+ {+ name: "Our analytics",+ collection: createMockCollection({ id: undefined }),+ expectedIcon: "folder",+ },+ {+ name: "All personal collections",+ collection: createMockCollection({ id: "personal" }),+ expectedIcon: "group",+ },+ {+ name: "Regular collection",+ collection: createMockCollection(),+ expectedIcon: "folder",+ },+ {+ name: "Personal collection",+ collection: createMockCollection({ personal_owner_id: 4 }),+ expectedIcon: "person",+ },+ {+ name: "Usage Analytics",+ collection: createMockCollection({ type: "instance-analytics" }),+ expectedIcon: "audit",+ },+ ];++ const testCasesOSS = [+ ...commonTestCases,+ // this is a good test, but due to (#29269) it fails currently+ // {+ // name: "Official collection",+ // collection: createMockCollection({ authority_level: "official"}),+ // expectedIcon: "folder",+ // },+ ];++ const testCasesEE = [+ ...commonTestCases,+ {+ name: "Official collection",+ collection: createMockCollection({ authority_level: "official" }),+ expectedIcon: "official_collection",+ },+ ];++ describe("OSS", () => {+ testCasesOSS.forEach((testCase) => {+ const { name, collection, expectedIcon } = testCase;++ it(`returns '${expectedIcon}' for '${name}'`, () => {+ expect(getCollectionIcon(collection)).toMatchObject({+ name: expectedIcon,+ });+ });+ });+ });++ describe("EE", () => {+ beforeEach(() => {+ mockSettings({+ "token-features": createMockTokenFeatures({+ official_collections: true,+ audit_app: true,+ }),+ });+ setupEnterpriseOnlyPlugin("collections");+ });++ testCasesEE.forEach((testCase) => {+ const { name, collection, expectedIcon } = testCase;++ it(`returns '${expectedIcon}' for '${name}'`, () => {+ expect(getCollectionIcon(collection)).toMatchObject({+ name: expectedIcon,+ });+ });+ });+ });+ });});diff --git a/frontend/src/metabase/common/CreateDashboard/CreateDashboardModal.unit.spec.tsx b/frontend/src/metabase/common/CreateDashboard/CreateDashboardModal.unit.spec.tsxindex 1c652646d38..7edc38e9cec 100644--- a/frontend/src/metabase/common/CreateDashboard/CreateDashboardModal.unit.spec.tsx+++ b/frontend/src/metabase/common/CreateDashboard/CreateDashboardModal.unit.spec.tsx@@ -18,7 +18,7 @@ import {waitFor,within,} from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import {createMockCollection,createMockCollectionItemFromCollection,diff --git a/frontend/src/metabase/common/components/CollectionName.tsx b/frontend/src/metabase/common/components/CollectionName.tsxindex bdba770f8a7..8630c1e61ee 100644--- a/frontend/src/metabase/common/components/CollectionName.tsx+++ b/frontend/src/metabase/common/components/CollectionName.tsx@@ -1,5 +1,5 @@import { useGetCollectionQuery } from "metabase/api";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { useTranslateContent } from "metabase/i18n/hooks";import { getName } from "metabase/utils/name";import type { CollectionId } from "metabase-types/api";diff --git a/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.tsx b/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.tsxindex 45564a73718..6b6b64e9645 100644--- a/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.tsx+++ b/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.tsx@@ -1,8 +1,8 @@import { useCallback, useMemo } from "react";import { t } from "ttag";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { canPlaceEntityInCollectionOrDescendants } from "metabase/data-studio/utils";-import { ROOT_COLLECTION } from "metabase/entities/collections";import { useSelector } from "metabase/redux";import { getUserPersonalCollectionId } from "metabase/selectors/user";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.unit.spec.tsx b/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.unit.spec.tsxindex 6edc1640f56..cee2cbb151f 100644--- a/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.unit.spec.tsx+++ b/frontend/src/metabase/common/components/Pickers/AddToDashSelectDashModal/AddToDashSelectDashModal.unit.spec.tsx@@ -19,7 +19,7 @@ import {waitForLoaderToBeRemoved,} from "__support__/ui";import { getNextId } from "__support__/utils";-import { ROOT_COLLECTION as ROOT } from "metabase/entities/collections";+import { ROOT_COLLECTION as ROOT } from "metabase/collections/constants";import { checkNotNull, isNotNull } from "metabase/utils/types";import type {BaseEntityId,diff --git a/frontend/src/metabase/common/components/Pickers/EntityPicker/components/ItemLists/ItemListRouter.tsx b/frontend/src/metabase/common/components/Pickers/EntityPicker/components/ItemLists/ItemListRouter.tsxindex 761ef56561b..b61c61cca13 100644--- a/frontend/src/metabase/common/components/Pickers/EntityPicker/components/ItemLists/ItemListRouter.tsx+++ b/frontend/src/metabase/common/components/Pickers/EntityPicker/components/ItemLists/ItemListRouter.tsx@@ -1,9 +1,9 @@+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import {ItemListLoader,type OmniPickerFolderItem,type OmniPickerItem,} from "metabase/common/components/Pickers";-import { PERSONAL_COLLECTIONS } from "metabase/entities/collections";import { PLUGIN_TENANTS } from "metabase/plugins";import { CollectionItemList } from "./CollectionItemList";diff --git a/frontend/src/metabase/common/components/Pickers/EntityPicker/components/test/setup.tsx b/frontend/src/metabase/common/components/Pickers/EntityPicker/components/test/setup.tsxindex d136ed8cd20..3339e66fc49 100644--- a/frontend/src/metabase/common/components/Pickers/EntityPicker/components/test/setup.tsx+++ b/frontend/src/metabase/common/components/Pickers/EntityPicker/components/test/setup.tsx@@ -15,7 +15,7 @@ import {renderWithProviders,waitForLoaderToBeRemoved,} from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockState } from "metabase/redux/store/mocks";import type {Collection,diff --git a/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/use-get-root-items.ts b/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/use-get-root-items.tsindex dafad62cf30..22fdd6ffce7 100644--- a/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/use-get-root-items.ts+++ b/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/use-get-root-items.ts@@ -7,12 +7,12 @@ import {useListCollectionItemsQuery,useListDatabasesQuery,} from "metabase/api";+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import {useGetPersonalCollection,useHasTokenFeature,useSetting,} from "metabase/common/hooks";-import { PERSONAL_COLLECTIONS } from "metabase/entities/collections/constants";import { PLUGIN_LIBRARY, PLUGIN_TENANTS } from "metabase/plugins";import { type DispatchFn, useDispatch, useSelector } from "metabase/redux";import { getUser, getUserIsAdmin } from "metabase/selectors/user";diff --git a/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/utils.ts b/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/utils.tsindex 0ef004f7147..16b8396f6e6 100644--- a/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/utils.ts+++ b/frontend/src/metabase/common/components/Pickers/EntityPicker/hooks/utils.ts@@ -1,7 +1,7 @@import { t } from "ttag";import { collectionApi } from "metabase/api";-import { PERSONAL_COLLECTIONS } from "metabase/entities/collections/constants";+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import { PLUGIN_TENANTS } from "metabase/plugins";import type { DispatchFn } from "metabase/redux";import { getRootCollectionItem as getTransformsRootCollectionItem } from "metabase/transforms/utils";diff --git a/frontend/src/metabase/common/components/Pickers/MoveModal/MoveModal.render.unit.spec.tsx b/frontend/src/metabase/common/components/Pickers/MoveModal/MoveModal.render.unit.spec.tsxindex 283c3e734e5..1f9414a8a3c 100644--- a/frontend/src/metabase/common/components/Pickers/MoveModal/MoveModal.render.unit.spec.tsx+++ b/frontend/src/metabase/common/components/Pickers/MoveModal/MoveModal.render.unit.spec.tsx@@ -14,7 +14,7 @@ import {screen,waitForLoaderToBeRemoved,} from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import {createMockCollection,createMockCollectionItem,diff --git a/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsx b/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsxindex f23429adffb..3d33f370cfb 100644--- a/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsx+++ b/frontend/src/metabase/common/components/SaveQuestionModal/SaveQuestionModal.unit.spec.tsx@@ -21,8 +21,8 @@ import {waitFor,within,} from "__support__/ui";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { SaveQuestionModal } from "metabase/common/components/SaveQuestionModal";-import { ROOT_COLLECTION } from "metabase/entities/collections";import * as qbSelectors from "metabase/query_builder/selectors";import { QUESTION_NAME_MAX_LENGTH } from "metabase/questions/constants";import {diff --git a/frontend/src/metabase/common/components/UserCollectionList.tsx b/frontend/src/metabase/common/components/UserCollectionList.tsxindex 373279e7dd8..6bcd92ff222 100644--- a/frontend/src/metabase/common/components/UserCollectionList.tsx+++ b/frontend/src/metabase/common/components/UserCollectionList.tsx@@ -1,9 +1,9 @@import { useListUsersQuery } from "metabase/api";-import { CollectionListView } from "metabase/common/components/CollectionListView";import {PERSONAL_COLLECTIONS,ROOT_COLLECTION,-} from "metabase/entities/collections/constants";+} from "metabase/collections/constants";+import { CollectionListView } from "metabase/common/components/CollectionListView";import * as Urls from "metabase/urls";import type { IconName } from "metabase-types/api";diff --git a/frontend/src/metabase/dashboard/components/AddCardSidebar/AddCardSidebar.unit.spec.tsx b/frontend/src/metabase/dashboard/components/AddCardSidebar/AddCardSidebar.unit.spec.tsxindex 2faccba3e56..0caf20fbde6 100644--- a/frontend/src/metabase/dashboard/components/AddCardSidebar/AddCardSidebar.unit.spec.tsx+++ b/frontend/src/metabase/dashboard/components/AddCardSidebar/AddCardSidebar.unit.spec.tsx@@ -7,8 +7,8 @@ import {} from "__support__/server-mocks";import { renderWithProviders, screen, waitFor } from "__support__/ui";import { getNextId } from "__support__/utils";+import { ROOT_COLLECTION as ROOT } from "metabase/collections/constants";import { MockDashboardContext } from "metabase/dashboard/context/mock-context";-import { ROOT_COLLECTION as ROOT } from "metabase/entities/collections";import {createMockDashboardState,createMockState,diff --git a/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.tsx b/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.tsxindex b2b5386528a..ceb3e508e05 100644--- a/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.tsx+++ b/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.tsx@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";import { t } from "ttag";import { skipToken, useGetCardQuery, useGetDashboardQuery } from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { isPublicCollection } from "metabase/collections/utils";import { DashboardName } from "metabase/common/components/DashboardName";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";@@ -15,7 +16,6 @@ import {clickTargetObjectType,} from "metabase/dashboard/components/ClickMappings";import { getDashboard } from "metabase/dashboard/selectors";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";import { Questions } from "metabase/entities/questions";import { useSelector } from "metabase/redux";import { getMetadata } from "metabase/selectors/metadata";diff --git a/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.unit.spec.tsx b/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.unit.spec.tsxindex 264b2e3d06a..5c62e1f9a4d 100644--- a/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.unit.spec.tsx+++ b/frontend/src/metabase/dashboard/components/ClickBehaviorSidebar/LinkOptions/LinkedEntityPicker/LinkedEntityPicker.unit.spec.tsx@@ -15,7 +15,7 @@ import {screen,} from "__support__/ui";import { getNextId } from "__support__/utils";-import { ROOT_COLLECTION as ROOT } from "metabase/entities/collections";+import { ROOT_COLLECTION as ROOT } from "metabase/collections/constants";import type { StoreDashboard } from "metabase/redux/store";import { createMockDashboardState } from "metabase/redux/store/mocks";import { checkNotNull } from "metabase/utils/types";diff --git a/frontend/src/metabase/dashboard/components/DashboardMoveModal.tsx b/frontend/src/metabase/dashboard/components/DashboardMoveModal.tsxindex dbe43c91ac3..bf55e22c9ee 100644--- a/frontend/src/metabase/dashboard/components/DashboardMoveModal.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardMoveModal.tsx@@ -5,11 +5,11 @@ import {useGetCollectionQuery,useGetDashboardQuery,} from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { Link } from "metabase/common/components/Link";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { MoveModal } from "metabase/common/components/Pickers/MoveModal/MoveModal";import { useSetCollection } from "metabase/common/hooks";-import { ROOT_COLLECTION } from "metabase/entities/collections";import { Flex, Icon } from "metabase/ui";import { color } from "metabase/ui/utils/colors";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/dashboard/components/DashboardMoveModal.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashboardMoveModal.unit.spec.tsxindex 8997b47189e..b659c942a9f 100644--- a/frontend/src/metabase/dashboard/components/DashboardMoveModal.unit.spec.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardMoveModal.unit.spec.tsx@@ -15,7 +15,7 @@ import {renderWithProviders,screen,} from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import {createMockCollection,createMockDashboard,diff --git a/frontend/src/metabase/dashboard/components/QuestionPicker/QuestionPicker.tsx b/frontend/src/metabase/dashboard/components/QuestionPicker/QuestionPicker.tsxindex 5307dfc7b78..ea71450503b 100644--- a/frontend/src/metabase/dashboard/components/QuestionPicker/QuestionPicker.tsx+++ b/frontend/src/metabase/dashboard/components/QuestionPicker/QuestionPicker.tsx@@ -2,6 +2,8 @@ import { useMemo, useState } from "react";import { t } from "ttag";import { useListCollectionsQuery } from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";+import getExpandedCollectionsById from "metabase/collections/getExpandedCollectionsById";import { isPublicCollection } from "metabase/collections/utils";import { Breadcrumbs } from "metabase/common/components/Breadcrumbs";import { Input } from "metabase/common/components/Input";@@ -12,10 +14,6 @@ import { getCollectionBreadCrumbs } from "metabase/common/utils/collections";import { useDashboardContext } from "metabase/dashboard/context";import { getDashboard } from "metabase/dashboard/selectors";import { isEmbeddingSdk } from "metabase/embedding-sdk/config";-import {- ROOT_COLLECTION,- getExpandedCollectionsById,-} from "metabase/entities/collections";import { useGetIcon } from "metabase/hooks/use-icon";import { PLUGIN_COLLECTIONS } from "metabase/plugins";import { useDispatch, useSelector } from "metabase/redux";diff --git a/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.ts b/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.tsindex e1fb5317c43..36771b8a830 100644--- a/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.ts+++ b/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.ts@@ -2,9 +2,9 @@ import { useMemo } from "react";import { t } from "ttag";import { skipToken, useListCollectionsTreeQuery } from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";+import getExpandedCollectionsById from "metabase/collections/getExpandedCollectionsById";import { useSetting } from "metabase/common/hooks/use-setting";-import { ROOT_COLLECTION } from "metabase/entities/collections";-import getExpandedCollectionsById from "metabase/entities/collections/getExpandedCollectionsById";import { PLUGIN_TENANTS } from "metabase/plugins";import { useSelector } from "metabase/redux";import { getUserPersonalCollectionId } from "metabase/selectors/user";diff --git a/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.unit.spec.ts b/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.unit.spec.tsindex f448402cafd..e535add16b9 100644--- a/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.unit.spec.ts+++ b/frontend/src/metabase/dashboard/components/QuestionPicker/hooks/use-collections-with-tenants.unit.spec.ts@@ -2,7 +2,7 @@ import { setupEnterprisePlugins } from "__support__/enterprise";import { setupCollectionTreeEndpoint } from "__support__/server-mocks/collection";import { mockSettings } from "__support__/settings";import { renderHookWithProviders, waitFor } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockState } from "metabase/redux/store/mocks";import type { Collection, CollectionId } from "metabase-types/api";import {diff --git a/frontend/src/metabase/data-studio/nav/components/NavbarLibrarySection/NavbarLibrarySection.tsx b/frontend/src/metabase/data-studio/nav/components/NavbarLibrarySection/NavbarLibrarySection.tsxindex 7189468421d..a5d4dea41a9 100644--- a/frontend/src/metabase/data-studio/nav/components/NavbarLibrarySection/NavbarLibrarySection.tsx+++ b/frontend/src/metabase/data-studio/nav/components/NavbarLibrarySection/NavbarLibrarySection.tsx@@ -2,15 +2,15 @@ import { useCallback, useMemo } from "react";import { t } from "ttag";import ErrorBoundary from "metabase/ErrorBoundary";-import { isLibraryCollection } from "metabase/collections/utils";-import { CollapseSection } from "metabase/common/components/CollapseSection";-import { Tree } from "metabase/common/components/tree";-import { useUserSetting } from "metabase/common/hooks";-import type { CollectionTreeItem } from "metabase/entities/collections";+import type { CollectionTreeItem } from "metabase/collections/utils";import {buildCollectionTree,getCollectionIcon,-} from "metabase/entities/collections";+ isLibraryCollection,+} from "metabase/collections/utils";+import { CollapseSection } from "metabase/common/components/CollapseSection";+import { Tree } from "metabase/common/components/tree";+import { useUserSetting } from "metabase/common/hooks";import {SidebarHeading,SidebarSection,diff --git a/frontend/src/metabase/data-studio/segments/components/SegmentBreadcrumbs/SegmentBreadcrumbs.unit.spec.tsx b/frontend/src/metabase/data-studio/segments/components/SegmentBreadcrumbs/SegmentBreadcrumbs.unit.spec.tsxindex 3210775c2ad..09c8ab83552 100644--- a/frontend/src/metabase/data-studio/segments/components/SegmentBreadcrumbs/SegmentBreadcrumbs.unit.spec.tsx+++ b/frontend/src/metabase/data-studio/segments/components/SegmentBreadcrumbs/SegmentBreadcrumbs.unit.spec.tsx@@ -6,7 +6,7 @@ import {setupTablesEndpoints,} from "__support__/server-mocks";import { renderWithProviders, screen, waitFor } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { checkNotNull } from "metabase/utils/types";import type { Segment, Table } from "metabase-types/api";import {diff --git a/frontend/src/metabase/entities/collections/index.ts b/frontend/src/metabase/entities/collections/index.tsdeleted file mode 100644index 6c27f4cae60..00000000000--- a/frontend/src/metabase/entities/collections/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export { default as getExpandedCollectionsById } from "./getExpandedCollectionsById";-export * from "./constants";-export * from "./utils";diff --git a/frontend/src/metabase/entities/collections/utils.ts b/frontend/src/metabase/entities/collections/utils.tsdeleted file mode 100644index 818766b7a59..00000000000--- a/frontend/src/metabase/entities/collections/utils.ts+++ /dev/null@@ -1,126 +0,0 @@-import {- isRootPersonalCollection,- isRootTrashCollection,- isSyncedCollection,-} from "metabase/collections/utils";-import { PLUGIN_COLLECTIONS } from "metabase/plugins";-import type { State } from "metabase/redux/store";-import { getUserPersonalCollectionId } from "metabase/selectors/user";-import type { IconProps } from "metabase/ui";-import { color } from "metabase/ui/colors";-import type { ColorName } from "metabase/ui/colors/types";-import type {- Collection,- CollectionContentModel,- IconName,-} from "metabase-types/api";--import { PERSONAL_COLLECTIONS } from "./constants";--export function getCollectionIcon(- collection: Partial<Collection>,- { tooltip = "default", isTenantUser = false } = {},-): {- name: IconName;- color?: ColorName;- tooltip?: string;-} {- if (collection.id === PERSONAL_COLLECTIONS.id) {- return { name: "group" };- }-- if (collection.type === "trash") {- return { name: "trash" };- }-- if (isRootPersonalCollection(collection)) {- return { name: "person" };- }-- if (isSyncedCollection(collection) && !isTenantUser) {- // tenant users see the normal icon, they don't know what a synced collection is- return { name: "synced_collection" };- }-- if (collection.is_library_root) {- switch (collection.type) {- case "library":- return { name: "repository" };- case "library-data":- return { name: "table" };- case "library-metrics":- return { name: "metric" };- }- }-- const type = PLUGIN_COLLECTIONS.getCollectionType(collection);- return type- ? {- name: type.icon as unknown as IconName,- color: type.color ? color(type.color) : undefined,- tooltip: type.tooltips?.[tooltip],- }- : { name: "folder" };-}--export function getCollectionType(- collectionId: Collection["id"] | undefined | null,- state: State,-) {- if (collectionId === null || collectionId === "root") {- return "root";- }- if (collectionId === getUserPersonalCollectionId(state)) {- return "personal";- }- return collectionId !== undefined ? "other" : null;-}--export interface CollectionTreeItem extends Collection {- icon: IconName | IconProps;- children: CollectionTreeItem[];- schemaName?: string;- nonNavigable?: boolean;-}--export function buildCollectionTree(- collections: Collection[] = [],- {- modelFilter,- isTenantUser = false,- }: {- modelFilter?: (model: CollectionContentModel) => boolean;- isTenantUser?: boolean;- } = {},-): CollectionTreeItem[] {- return collections.flatMap((collection) => {- const isPersonalRoot = collection.id === PERSONAL_COLLECTIONS.id;-- const isMatchedByFilter =- !modelFilter ||- collection.here?.some(modelFilter) ||- collection.below?.some(modelFilter);-- if (!isPersonalRoot && !isMatchedByFilter) {- return [];- }-- const children = !isRootTrashCollection(collection)- ? buildCollectionTree(- collection.children?.filter((child) => !child.archived) || [],- { modelFilter, isTenantUser },- )- : [];-- if (isPersonalRoot && children.length === 0) {- return [];- }-- return {- ...collection,- schemaName: collection.originalName || collection.name,- icon: getCollectionIcon(collection, { isTenantUser }),- children,- };- });-}diff --git a/frontend/src/metabase/entities/collections/utils.unit.spec.ts b/frontend/src/metabase/entities/collections/utils.unit.spec.tsdeleted file mode 100644index 065c9e4319b..00000000000--- a/frontend/src/metabase/entities/collections/utils.unit.spec.ts+++ /dev/null@@ -1,419 +0,0 @@-import { setupEnterpriseOnlyPlugin } from "__support__/enterprise";-import { mockSettings } from "__support__/settings";-import {- createMockCollection,- createMockTokenFeatures,-} from "metabase-types/api/mocks";--import { PERSONAL_COLLECTIONS } from "./constants";-import {- buildCollectionTree,- getCollectionIcon,- // getCollectionTooltip,-} from "./utils";--describe("entities > collections > utils", () => {- describe("buildCollectionTree", () => {- it("returns an empty array when collections are not passed", () => {- expect(buildCollectionTree()).toEqual([]);- });-- it("correctly transforms collections", () => {- const collection = createMockCollection({ children: [] });- const [transformed] = buildCollectionTree([collection]);- expect(transformed).toMatchObject({- id: collection.id,- name: collection.name,- schemaName: collection.name,- icon: { name: "folder" },- children: [],- });- });-- it("prefers originalName over name for schema names", () => {- const collection = createMockCollection({- name: "bar",- originalName: "foo",- });- const [transformed] = buildCollectionTree([collection]);- expect(transformed.schemaName).toBe(collection.originalName);- });-- it("recursively transforms collection children", () => {- const grandchild = createMockCollection({ id: 3, name: "C3" });- const child = createMockCollection({- id: 2,- name: "C2",- children: [grandchild],- });- const collection = createMockCollection({- id: 1,- name: "C1",- children: [child],- });-- const [transformed] = buildCollectionTree([collection]);-- expect(transformed).toMatchObject({- id: collection.id,- name: collection.name,- schemaName: collection.name,- icon: { name: "folder" },- children: [- {- id: child.id,- name: child.name,- schemaName: child.name,- icon: { name: "folder" },- children: [- {- id: grandchild.id,- name: grandchild.name,- schemaName: grandchild.name,- icon: { name: "folder" },- children: [],- },- ],- },- ],- });- });-- it("returns regular icon for official collections in OSS", () => {- const collection = createMockCollection({ authority_level: "official" });- const [transformed] = buildCollectionTree([collection]);- expect(transformed.icon).toEqual({ name: "folder" });- });-- describe("filtering by models", () => {- it("only keeps collection branches containing target models", () => {- const grandchild1 = createMockCollection({- id: 4,- name: "Grandchild 1",- here: ["dataset"],- });- const grandchild2 = createMockCollection({- id: 3,- name: "Grandchild 2",- here: ["card"],- });- const child = createMockCollection({- id: 2,- name: "Child",- below: ["dataset", "card"],- children: [grandchild1, grandchild2],- });- const collection = createMockCollection({- id: 1,- name: "Top-level",- below: ["dataset", "card"],- children: [child],- });-- const transformed = buildCollectionTree([collection], {- modelFilter: (model) => model === "dataset",- });-- expect(transformed).toMatchObject([- {- id: collection.id,- name: collection.name,- schemaName: collection.name,- icon: { name: "folder" },- below: ["dataset", "card"],- children: [- {- id: child.id,- name: child.name,- schemaName: child.name,- below: ["dataset", "card"],- icon: { name: "folder" },- children: [- {- id: grandchild1.id,- name: grandchild1.name,- schemaName: grandchild1.name,- icon: { name: "folder" },- children: [],- here: ["dataset"],- },- ],- },- ],- },- ]);- });-- it("filters top-level collections not containing target models", () => {- const collectionWithDatasets = createMockCollection({- id: 1,- name: "Top-level",- here: ["dataset"],- children: [],- });- const collectionWithCards = createMockCollection({- id: 5,- name: "Top-level 2",- below: ["card"],- });-- const transformed = buildCollectionTree(- [collectionWithDatasets, collectionWithCards],- { modelFilter: (model) => model === "dataset" },- );-- expect(transformed).toMatchObject([- {- id: collectionWithDatasets.id,- name: collectionWithDatasets.name,- schemaName: collectionWithDatasets.name,- icon: { name: "folder" },- here: ["dataset"],- children: [],- },- ]);- });-- it("preserves personal collections root if there are other users personal collections with target models", () => {- const collection = createMockCollection({- ...PERSONAL_COLLECTIONS,- children: [- createMockCollection({- name: "A",- below: ["card"],- children: [- createMockCollection({- name: "A1",- here: ["card"],- }),- ],- }),- createMockCollection({- name: "B",- below: ["dataset"],- children: [- createMockCollection({- name: "B1",- here: ["dataset"],- }),- ],- }),- createMockCollection({- name: "C",- children: [- createMockCollection({- name: "C1",- }),- ],- }),- ],- });-- const collectionTree = buildCollectionTree([collection], {- modelFilter: (model) => model === "card",- });-- expect(collectionTree).toMatchObject([- {- ...PERSONAL_COLLECTIONS,- children: [- {- name: "A",- children: [- {- name: "A1",- },- ],- },- ],- },- ]);- });-- it("does not preserve personal collections root if there are no other users personal collections with target models", () => {- const collection = createMockCollection({- ...PERSONAL_COLLECTIONS,- children: [- createMockCollection({- name: "A",- here: ["dataset"],- children: [- createMockCollection({- name: "A1",- }),- ],- }),- createMockCollection({- name: "B",- }),- ],- });-- const collectionTree = buildCollectionTree([collection], {- modelFilter: (model) => model === "card",- });-- expect(collectionTree).toEqual([]);- });-- it("doesn't filter collections if model filter is not passed", () => {- const child = createMockCollection({- id: 2,- name: "Child",- here: ["dataset"],- });- const collection = createMockCollection({- id: 1,- name: "Top-level",- below: ["dataset"],- children: [child],- });- const collectionWithCards = createMockCollection({- id: 5,- name: "Top-level 2",- below: ["card"],- });-- const transformed = buildCollectionTree([- collection,- collectionWithCards,- ]);-- expect(transformed).toMatchObject([- {- id: collection.id,- name: collection.name,- schemaName: collection.name,- icon: { name: "folder" },- below: ["dataset"],- children: [- {- id: child.id,- name: child.name,- schemaName: child.name,- icon: { name: "folder" },- here: ["dataset"],- children: [],- },- ],- },- {- id: collectionWithCards.id,- name: collectionWithCards.name,- schemaName: collectionWithCards.name,- icon: { name: "folder" },- children: [],- below: ["card"],- },- ]);- });- });-- describe("EE", () => {- beforeEach(() => {- mockSettings({- "token-features": createMockTokenFeatures({- official_collections: true,- audit_app: true,- }),- });- setupEnterpriseOnlyPlugin("collections");- });-- it("returns correct icon for official collections", () => {- const collection = createMockCollection({- authority_level: "official",- });- const [transformed] = buildCollectionTree([collection]);- expect(transformed.icon).toEqual({- color: expect.any(String),- name: "official_collection",- tooltip: "Official collection",- });- });- });- });-- describe("getCollectionIcon", () => {- const commonTestCases = [- {- name: "Our analytics",- collection: createMockCollection({ id: undefined }),- expectedIcon: "folder",- },- {- name: "All personal collections",- collection: createMockCollection({ id: "personal" }),- expectedIcon: "group",- },- {- name: "Regular collection",- collection: createMockCollection(),- expectedIcon: "folder",- },- {- name: "Personal collection",- collection: createMockCollection({ personal_owner_id: 4 }),- expectedIcon: "person",- },- {- name: "Usage Analytics",- collection: createMockCollection({ type: "instance-analytics" }),- expectedIcon: "audit",- },- ];-- const testCasesOSS = [- ...commonTestCases,- // this is a good test, but due to (#29269) it fails currently- // {- // name: "Official collection",- // collection: createMockCollection({ authority_level: "official"}),- // expectedIcon: "folder",- // },- ];-- const testCasesEE = [- ...commonTestCases,- {- name: "Official collection",- collection: createMockCollection({ authority_level: "official" }),- expectedIcon: "official_collection",- },- ];-- describe("OSS", () => {- testCasesOSS.forEach((testCase) => {- const { name, collection, expectedIcon } = testCase;-- it(`returns '${expectedIcon}' for '${name}'`, () => {- expect(getCollectionIcon(collection)).toMatchObject({- name: expectedIcon,- });- });- });- });-- describe("EE", () => {- beforeEach(() => {- mockSettings({- "token-features": createMockTokenFeatures({- official_collections: true,- audit_app: true,- }),- });- setupEnterpriseOnlyPlugin("collections");- });-- testCasesEE.forEach((testCase) => {- const { name, collection, expectedIcon } = testCase;-- it(`returns '${expectedIcon}' for '${name}'`, () => {- expect(getCollectionIcon(collection)).toMatchObject({- name: expectedIcon,- });- });- });- });- });-});diff --git a/frontend/src/metabase/entities/questions.js b/frontend/src/metabase/entities/questions.jsindex c761100fbd4..73b501a70ff 100644--- a/frontend/src/metabase/entities/questions.js+++ b/frontend/src/metabase/entities/questions.js@@ -1,7 +1,7 @@import { updateIn } from "icepick";import { cardApi, useGetCardQuery, useListCardsQuery } from "metabase/api";-import { getCollectionType } from "metabase/entities/collections";+import { getCollectionType } from "metabase/collections/utils";import { SOFT_RELOAD_CARD } from "metabase/redux/query-builder";import {getMetadata,diff --git a/frontend/src/metabase/hooks/use-icon.ts b/frontend/src/metabase/hooks/use-icon.tsindex b9c7ddbd043..d96e240991f 100644--- a/frontend/src/metabase/hooks/use-icon.ts+++ b/frontend/src/metabase/hooks/use-icon.ts@@ -1,8 +1,8 @@import { useCallback } from "react";+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import type { IconData, ObjectWithModel } from "metabase/common/utils/icon";import { modelIconMap } from "metabase/common/utils/icon";-import { PERSONAL_COLLECTIONS } from "metabase/entities/collections/constants";import { PLUGIN_COLLECTIONS, PLUGIN_CUSTOM_VIZ } from "metabase/plugins";import { getIconForVisualizationType } from "metabase/visualizations";import type { VisualizationDisplay } from "metabase-types/api";diff --git a/frontend/src/metabase/metabot/components/MetabotChat/MetabotChatEditor/MetabotChatEditor.unit.spec.tsx b/frontend/src/metabase/metabot/components/MetabotChat/MetabotChatEditor/MetabotChatEditor.unit.spec.tsxindex ec2c97cc19c..a4a51380ac0 100644--- a/frontend/src/metabase/metabot/components/MetabotChat/MetabotChatEditor/MetabotChatEditor.unit.spec.tsx+++ b/frontend/src/metabase/metabot/components/MetabotChat/MetabotChatEditor/MetabotChatEditor.unit.spec.tsx@@ -11,7 +11,7 @@ import {import { setupSearchEndpoints } from "__support__/server-mocks/search";import { mockSettings } from "__support__/settings";import { renderWithProviders } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockState } from "metabase/redux/store/mocks";import type { SuggestionModel } from "metabase/rich_text_editing/tiptap/extensions/shared/types";import {diff --git a/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.unit.spec.tsx b/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.unit.spec.tsxindex 233cf72e260..d8c1ba0ea89 100644--- a/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.unit.spec.tsx+++ b/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.unit.spec.tsx@@ -9,7 +9,7 @@ import {} from "__support__/server-mocks";import { mockSettings } from "__support__/settings";import { renderWithProviders } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import type { MetabotPromptInputRef } from "metabase/metabot";import { createMockState } from "metabase/redux/store/mocks";import { MetabotMentionPluginKey } from "metabase/rich_text_editing/tiptap/extensions/MetabotMention/MetabotMentionExtension";diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/tests/setup.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/tests/setup.tsxindex d883d115af1..11c4e9d8317 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/tests/setup.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/AddDataModal/tests/setup.tsx@@ -10,7 +10,7 @@ import {import { mockSettings } from "__support__/settings";import { createMockEntitiesState } from "__support__/store";import { renderWithProviders } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockState } from "metabase/redux/store/mocks";import type { GdrivePayload, TokenFeatures } from "metabase-types/api";import {diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsxindex a8be5a7cb5c..23eae5ff9b5 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsx@@ -10,18 +10,16 @@ import {useReorderBookmarksMutation,} from "metabase/api";import { logout } from "metabase/auth/actions";+import { ROOT_COLLECTION } from "metabase/collections/constants";import CreateCollectionModal from "metabase/collections/containers/CreateCollectionModal";+import type { CollectionTreeItem } from "metabase/collections/utils";import {+ buildCollectionTree,currentUserPersonalCollections,+ getCollectionIcon,nonPersonalOrArchivedCollection,} from "metabase/collections/utils";import { Modal } from "metabase/common/components/Modal";-import type { CollectionTreeItem } from "metabase/entities/collections";-import {- ROOT_COLLECTION,- buildCollectionTree,- getCollectionIcon,-} from "metabase/entities/collections";import { Databases } from "metabase/entities/databases";import { PLUGIN_TENANTS } from "metabase/plugins";import { connect, useDispatch, useSelector } from "metabase/redux";diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsxindex af8fbf47b96..a23648d6126 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx@@ -5,6 +5,7 @@ import { t } from "ttag";import _ from "underscore";import ErrorBoundary from "metabase/ErrorBoundary";+import type { CollectionTreeItem } from "metabase/collections/utils";import {isExamplesCollection,isLibraryCollection,@@ -16,7 +17,6 @@ import { useSetting, useUserSetting } from "metabase/common/hooks";import { useIsAtHomepageDashboard } from "metabase/common/hooks/use-is-at-homepage-dashboard";import { useShowOtherUsersCollections } from "metabase/common/hooks/use-show-other-users-collections";import { NavbarLibrarySection } from "metabase/data-studio/nav/components/NavbarLibrarySection";-import type { CollectionTreeItem } from "metabase/entities/collections";import {getCanAccessOnboardingPage,getIsNewInstance,diff --git a/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsx b/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsxindex e3ff68d2a89..7b215ad8cfb 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsx@@ -2,13 +2,13 @@ import type { KeyboardEvent } from "react";import { forwardRef, useCallback, useEffect, useRef } from "react";import { usePrevious } from "react-use";+import { getCollectionIcon } from "metabase/collections/utils";import { CollectionDropTarget } from "metabase/common/components/dnd/CollectionDropTarget";import { TreeNode } from "metabase/common/components/tree/TreeNode";import type {ITreeNodeItem,TreeNodeProps,} from "metabase/common/components/tree/types";-import { getCollectionIcon } from "metabase/entities/collections/utils";import { PLUGIN_COLLECTIONS } from "metabase/plugins";import { useSelector } from "metabase/redux";import { getIsTenantUser } from "metabase/selectors/user";diff --git a/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsx b/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsxindex 2e1fda3b5c0..1d28c185fde 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/tests/common.unit.spec.tsx@@ -3,7 +3,7 @@ import dayjs from "dayjs";import { screen, within } from "__support__/ui";import { createMockModelResult } from "metabase/browse/models/test-utils";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import * as Urls from "metabase/urls";import {createMockCard,diff --git a/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsx b/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsxindex be20705326f..922e25294e9 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/tests/setup.tsx@@ -20,7 +20,7 @@ import {waitForLoaderToBeRemoved,} from "__support__/ui";import type { ModelResult } from "metabase/browse/models";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import type { DashboardState } from "metabase/redux/store";import {createMockDashboardState,diff --git a/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsx b/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsxindex 73d7ddadcd7..59bcc4d3846 100644--- a/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsx+++ b/frontend/src/metabase/nav/containers/Navbar.unit.spec.tsx@@ -15,7 +15,7 @@ import {screen,waitForLoaderToBeRemoved,} from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import {CLOSE_NAVBAR,OPEN_NAVBAR,diff --git a/frontend/src/metabase/palette/hooks/useCommandPalette.tsx b/frontend/src/metabase/palette/hooks/useCommandPalette.tsxindex 35bab8ba043..5cad57c9949 100644--- a/frontend/src/metabase/palette/hooks/useCommandPalette.tsx+++ b/frontend/src/metabase/palette/hooks/useCommandPalette.tsx@@ -5,10 +5,10 @@ import { useDebounce } from "react-use";import { jt, t } from "ttag";import { useListRecentsQuery, useSearchQuery } from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { getCollection } from "metabase/collections/utils";import type { OmniPickerItem } from "metabase/common/components/Pickers";import { useSetting } from "metabase/common/hooks";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";import { useGetIcon } from "metabase/hooks/use-icon";import { useSelector } from "metabase/redux";import { trackSearchClick } from "metabase/search/analytics";diff --git a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.unit.spec.tsx b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.unit.spec.tsxindex a057bf3fcc4..11429aea1ac 100644--- a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.unit.spec.tsx+++ b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.unit.spec.tsx@@ -23,7 +23,7 @@ import {screen,waitForLoaderToBeRemoved,} from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockState } from "metabase/redux/store/mocks";import { checkNotNull } from "metabase/utils/types";import { createMockUiParameter } from "metabase-lib/v1/parameters/mock";diff --git a/frontend/src/metabase/parameters/components/ValuesSourceModal/tests/setup.tsx b/frontend/src/metabase/parameters/components/ValuesSourceModal/tests/setup.tsxindex b99aa8b3865..cfb98a7ee94 100644--- a/frontend/src/metabase/parameters/components/ValuesSourceModal/tests/setup.tsx+++ b/frontend/src/metabase/parameters/components/ValuesSourceModal/tests/setup.tsx@@ -16,7 +16,7 @@ import {import { mockSettings } from "__support__/settings";import { createMockEntitiesState } from "__support__/store";import { renderWithProviders, waitForLoaderToBeRemoved } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { createMockState } from "metabase/redux/store/mocks";import { createMockUiParameter } from "metabase-lib/v1/parameters/mock";import type { UiParameter } from "metabase-lib/v1/parameters/types";diff --git a/frontend/src/metabase/plugins/oss/remote-sync.ts b/frontend/src/metabase/plugins/oss/remote-sync.tsindex 12c00e7b5ca..ce4fe2c32ee 100644--- a/frontend/src/metabase/plugins/oss/remote-sync.ts+++ b/frontend/src/metabase/plugins/oss/remote-sync.ts@@ -6,8 +6,8 @@ import type {import type { ComponentType, ReactNode } from "react";import type { TagType } from "metabase/api/tags";+import type { CollectionTreeItem } from "metabase/collections/utils";import type { ITreeNodeItem } from "metabase/common/components/tree/types";-import type { CollectionTreeItem } from "metabase/entities/collections";import type { UseQuery } from "metabase/entities/containers/rtk-query/types/rtk";import type {GitSyncSetupMenuItemProps,diff --git a/frontend/src/metabase/plugins/oss/tenants.ts b/frontend/src/metabase/plugins/oss/tenants.tsindex 6953dfbbfbe..44cab9d5468 100644--- a/frontend/src/metabase/plugins/oss/tenants.ts+++ b/frontend/src/metabase/plugins/oss/tenants.ts@@ -1,11 +1,11 @@import type React from "react";import type { SetStateAction } from "react";+import type { CollectionTreeItem } from "metabase/collections/utils";import type {OmniPickerCollectionItem,OmniPickerItem,} from "metabase/common/components/Pickers";-import type { CollectionTreeItem } from "metabase/entities/collections/utils";import type {Collection,CollectionId,diff --git a/frontend/src/metabase/plugins/types.ts b/frontend/src/metabase/plugins/types.tsindex 3cbcd620a49..9561933b72c 100644--- a/frontend/src/metabase/plugins/types.ts+++ b/frontend/src/metabase/plugins/types.ts@@ -1,7 +1,7 @@import type { ComponentType } from "react";+import type { CollectionTreeItem } from "metabase/collections/utils";import type { ConfirmationState } from "metabase/common/hooks/use-confirmation";-import type { CollectionTreeItem } from "metabase/entities/collections";import type { Member, Membership, User } from "metabase-types/api";export interface AuthProvider {diff --git a/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsx b/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsxindex 4a1e1e1d989..887207cf820 100644--- a/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsx+++ b/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsx@@ -2,10 +2,10 @@ import { Fragment } from "react";import { t } from "ttag";import { skipToken, useListCollectionItemsQuery } from "metabase/api";+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import { EmptyState } from "metabase/common/components/EmptyState";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { SelectList } from "metabase/common/components/SelectList";-import { PERSONAL_COLLECTIONS } from "metabase/entities/collections/constants";import { PLUGIN_MODERATION } from "metabase/plugins";import { Box } from "metabase/ui";import { getQuestionVirtualTableId } from "metabase-lib/v1/metadata/utils/saved-questions";diff --git a/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityPicker.jsx b/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityPicker.jsxindex c858bbe9e91..8108d34052c 100644--- a/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityPicker.jsx+++ b/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityPicker.jsx@@ -5,7 +5,9 @@ import {useGetCollectionQuery,useListCollectionsTreeQuery,} from "metabase/api";+import { PERSONAL_COLLECTIONS } from "metabase/collections/constants";import {+ buildCollectionTree,currentUserPersonalCollections,isRootPersonalCollection,nonPersonalOrArchivedCollection,@@ -13,10 +15,6 @@ import {import { Tree } from "metabase/common/components/tree";import { findCollectionById } from "metabase/common/utils/collections";import CS from "metabase/css/core/index.css";-import {- PERSONAL_COLLECTIONS,- buildCollectionTree,-} from "metabase/entities/collections";import { useSelector } from "metabase/redux";import { getUser } from "metabase/selectors/user";import { Box, Icon } from "metabase/ui";diff --git a/frontend/src/metabase/querying/notebook/components/DataStep/tests/setup.tsx b/frontend/src/metabase/querying/notebook/components/DataStep/tests/setup.tsxindex 9f4eae638bb..455d823cdbc 100644--- a/frontend/src/metabase/querying/notebook/components/DataStep/tests/setup.tsx+++ b/frontend/src/metabase/querying/notebook/components/DataStep/tests/setup.tsx@@ -7,7 +7,7 @@ import {} from "__support__/server-mocks";import { renderWithProviders } from "__support__/ui";import { createMockModelResult } from "metabase/browse/models/test-utils";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import * as Lib from "metabase-lib";import { columnFinder } from "metabase-lib/test-helpers";import { createMockCollection } from "metabase-types/api/mocks";diff --git a/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStep.unit.spec.tsx b/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStep.unit.spec.tsxindex 9e0e990f206..29f726faf54 100644--- a/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStep.unit.spec.tsx+++ b/frontend/src/metabase/querying/notebook/components/NotebookStep/NotebookStep.unit.spec.tsx@@ -7,7 +7,7 @@ import {setupSearchEndpoints,} from "__support__/server-mocks";import { renderWithProviders, screen } from "__support__/ui";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import type Question from "metabase-lib/v1/Question";import { createMockCollection } from "metabase-types/api/mocks";import { createSampleDatabase } from "metabase-types/api/mocks/presets";diff --git a/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/LinkedEntityPickerModal/utils.ts b/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/LinkedEntityPickerModal/utils.tsindex cbde0556447..a47f75dd623 100644--- a/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/LinkedEntityPickerModal/utils.ts+++ b/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/LinkedEntityPickerModal/utils.ts@@ -1,8 +1,8 @@-import type { OmniPickerItem } from "metabase/common/components/Pickers";import {PERSONAL_COLLECTIONS,ROOT_COLLECTION,-} from "metabase/entities/collections";+} from "metabase/collections/constants";+import type { OmniPickerItem } from "metabase/common/components/Pickers";import { DOCUMENT_LINK_MODELS } from "./constants";import type { DocumentLinkedEntityPickerItemValue } from "./types";diff --git a/frontend/src/metabase/timelines/questions/containers/MoveEventModal/MoveEventModal.tsx b/frontend/src/metabase/timelines/questions/containers/MoveEventModal/MoveEventModal.tsxindex 7904e86e7b1..52f7d56d2c5 100644--- a/frontend/src/metabase/timelines/questions/containers/MoveEventModal/MoveEventModal.tsx+++ b/frontend/src/metabase/timelines/questions/containers/MoveEventModal/MoveEventModal.tsx@@ -3,7 +3,7 @@ import {useGetTimelineEventQuery,useListTimelinesQuery,} from "metabase/api";-import { ROOT_COLLECTION } from "metabase/entities/collections";+import { ROOT_COLLECTION } from "metabase/collections/constants";import MoveEventModal, {type MoveEventModalProps,} from "metabase/timelines/common/components/MoveEventModal";diff --git a/frontend/src/metabase/timelines/questions/containers/NewEventModal/NewEventModal.tsx b/frontend/src/metabase/timelines/questions/containers/NewEventModal/NewEventModal.tsxindex b92ae8dca05..6a241135a39 100644--- a/frontend/src/metabase/timelines/questions/containers/NewEventModal/NewEventModal.tsx+++ b/frontend/src/metabase/timelines/questions/containers/NewEventModal/NewEventModal.tsx@@ -6,8 +6,8 @@ import {useGetCollectionQuery,useListTimelinesQuery,} from "metabase/api";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { getDefaultTimeline } from "metabase/common/utils/timelines";-import { ROOT_COLLECTION } from "metabase/entities/collections";import { useDispatch } from "metabase/redux";import { addUndo } from "metabase/redux/undo";import NewEventModal from "metabase/timelines/common/components/NewEventModal";diff --git a/frontend/src/metabase/timelines/questions/containers/TimelinePanel/TimelinePanel.tsx b/frontend/src/metabase/timelines/questions/containers/TimelinePanel/TimelinePanel.tsxindex e3b06eafc6c..1dabfac5595 100644--- a/frontend/src/metabase/timelines/questions/containers/TimelinePanel/TimelinePanel.tsx+++ b/frontend/src/metabase/timelines/questions/containers/TimelinePanel/TimelinePanel.tsx@@ -2,8 +2,8 @@ import type { ComponentProps } from "react";import { useGetCollectionQuery } from "metabase/api";import { useSetArchive } from "metabase/archive/hooks";+import { ROOT_COLLECTION } from "metabase/collections/constants";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";-import { ROOT_COLLECTION } from "metabase/entities/collections";import type { CollectionId, TimelineEvent } from "metabase-types/api";import TimelinePanel from "../../components/TimelinePanel";diff --git a/frontend/src/metabase/transforms/pages/TransformListPage/utils.ts b/frontend/src/metabase/transforms/pages/TransformListPage/utils.tsindex d6116e5098e..692ff58edcb 100644--- a/frontend/src/metabase/transforms/pages/TransformListPage/utils.ts+++ b/frontend/src/metabase/transforms/pages/TransformListPage/utils.ts@@ -1,7 +1,7 @@import { useMemo, useRef } from "react";import { t } from "ttag";-import { getCollectionIcon } from "metabase/entities/collections/utils";+import { getCollectionIcon } from "metabase/collections/utils";import { useSelector } from "metabase/redux";import { getMetadata } from "metabase/selectors/metadata";import { getLibQuery } from "metabase/transforms/utils";diff --git a/frontend/test/__support__/server-mocks/collection.ts b/frontend/test/__support__/server-mocks/collection.tsindex 1e8b2c2b5d9..b4fb413e244 100644--- a/frontend/test/__support__/server-mocks/collection.ts+++ b/frontend/test/__support__/server-mocks/collection.ts@@ -1,7 +1,7 @@import fetchMock from "fetch-mock";import _ from "underscore";-import { ROOT_COLLECTION } from "metabase/entities/collections/constants";+import { ROOT_COLLECTION } from "metabase/collections/constants";import {SAVED_QUESTIONS_VIRTUAL_DB_ID,convertSavedQuestionToVirtualTable,