Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix: remote-sync icons matching non-collections (#66558)

Edward Paget09a24ab09d22
diff --git a/enterprise/frontend/src/metabase-enterprise/collections/utils.ts b/enterprise/frontend/src/metabase-enterprise/collections/utils.ts
index 69a09db7c68..1f67870971d 100644
--- a/enterprise/frontend/src/metabase-enterprise/collections/utils.ts
+++ b/enterprise/frontend/src/metabase-enterprise/collections/utils.ts
@@ -64,21 +64,22 @@ export const getIcon = (item: ObjectWithModel): IconData => {
};
}
- if (item.is_remote_synced) {
- return {
- name: REMOTE_SYNC_COLLECTION.icon,
- };
- }
+ if (item.model === "collection") {
+ if (item.is_remote_synced) {
+ return {
+ name: REMOTE_SYNC_COLLECTION.icon,
+ };
+ }
- if (
- item.model === "collection" &&
- (item.authority_level === "official" ||
- item.collection_authority_level === "official")
- ) {
- return {
- name: OFFICIAL_COLLECTION.icon,
- color: OFFICIAL_COLLECTION.color,
- };
+ if (
+ item.authority_level === "official" ||
+ item.collection_authority_level === "official"
+ ) {
+ return {
+ name: OFFICIAL_COLLECTION.icon,
+ color: OFFICIAL_COLLECTION.color,
+ };
+ }
}
if (item.model === "dataset" && item.moderated_status === "verified") {
diff --git a/enterprise/frontend/src/metabase-enterprise/collections/utils.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/collections/utils.unit.spec.tsx
index 35e1e6bb3bd..ae71fd4f6a4 100644
--- a/enterprise/frontend/src/metabase-enterprise/collections/utils.unit.spec.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/collections/utils.unit.spec.tsx
@@ -91,6 +91,18 @@ describe("Collections plugin utils", () => {
).toEqual({ name: "official_collection", color: "saturated-yellow" });
});
+ it("should return the correct icon for a remote synced collection", () => {
+ expect(
+ getIcon({ model: "collection", is_remote_synced: true }),
+ ).toEqual({ name: "synced_collection" });
+ });
+
+ it("should return the correct icon for a remote synced entity", () => {
+ expect(getIcon({ model: "dashboard", is_remote_synced: true })).toEqual(
+ { name: "dashboard" },
+ );
+ });
+
it("official collection in search", () => {
const collection = {
id: 101,