Skip to content

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

Fixed the dependency graph showing the find and replace button for questions and models in a data app's collection (#85415)

Timofey Kachalov86c90ea80296
diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/utils.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/utils.ts
index f04d7a28509..735b186ad59 100644
--- a/enterprise/frontend/src/metabase-enterprise/dependencies/utils.ts
+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/utils.ts
@@ -582,6 +582,9 @@ export function getNodeSourceReplacementEntry(
case "table":
return { id: node.id, type: node.type };
case "card":
+ if (isInDataAppCollection(node.data.collection)) {
+ return null;
+ }
if (node.data.type === "question" || node.data.type === "model") {
return { id: node.id, type: node.type };
}
diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/utils.unit.spec.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/utils.unit.spec.ts
index 0b928a29b2d..80e036b9d4f 100644
--- a/enterprise/frontend/src/metabase-enterprise/dependencies/utils.unit.spec.ts
+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/utils.unit.spec.ts
@@ -2,6 +2,7 @@ import { registerVisualizations } from "metabase/visualizations/register";
import type {
AnalysisFindingError,
AnalysisFindingErrorType,
+ CardType,
DependencyEntry,
DependencyGroupType,
DependencyNode,
@@ -1190,4 +1191,17 @@ describe("getNodeDataSourceEntry", () => {
])("should return $expected for $description", ({ node, expected }) => {
expect(getNodeSourceReplacementEntry(node)).toEqual(expected);
});
+
+ it.each<CardType>(["question", "model"])(
+ "should return null for a %s card in a data app's collection",
+ (type) => {
+ const node = createMockCardDependencyNode({
+ data: createMockCardDependencyNodeData({
+ type,
+ collection: createMockCollection({ namespace: "data-apps" }),
+ }),
+ });
+ expect(getNodeSourceReplacementEntry(node)).toBeNull();
+ },
+ );
});