Skip to content

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

Enable dependency graph UI (#65210)

Alexander Polyankin93d099427ea5
diff --git a/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts b/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts
index 55a8c8dc3d5..08f989d0dd5 100644
--- a/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts
+++ b/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts
@@ -3,12 +3,10 @@ const { H } = cy;
import { WRITABLE_DB_ID } from "e2e/support/cypress_data";
import {
ADMIN_PERSONAL_COLLECTION_ID,
- ALL_USERS_GROUP_ID,
FIRST_COLLECTION_ID,
ORDERS_DASHBOARD_ID,
SECOND_COLLECTION_ID,
} from "e2e/support/cypress_sample_instance_data";
-import { DataPermissionValue } from "metabase/admin/permissions/types";
import type { IconName } from "metabase/ui";
import type {
CardId,
@@ -21,7 +19,7 @@ import type {
TransformId,
} from "metabase-types/api";
-const BASE_URL = "/dependencies";
+const BASE_URL = "/admin/tools/dependencies";
const TABLE_NAME = "scoreboard_actions";
const TABLE_DISPLAY_NAME = "Scoreboard Actions";
const TABLE_ID_ALIAS = "tableId";
@@ -46,8 +44,7 @@ const SNIPPET_BASED_MODEL_NAME = "Snippet-based model";
const SNIPPET_BASED_TRANSFORM_NAME = "Snippet-based transform";
const SNIPPET_BASED_SNIPPET_NAME = "Snippet-based snippet";
-// TODO skipped until v57 is released
-describe.skip("scenarios > dependencies > dependency graph", () => {
+describe("scenarios > dependencies > dependency graph", () => {
beforeEach(() => {
H.restore("postgres-writable");
H.resetTestTable({ type: "postgres", table: TABLE_NAME });
@@ -238,6 +235,7 @@ describe.skip("scenarios > dependencies > dependency graph", () => {
.click();
graphEntryButton().findByText(dependentItemTitle).should("be.visible");
cy.go("back");
+ graphEntryButton().findByText(itemTitle).should("be.visible");
}
it("should display dependencies for a table and navigate to them", () => {
@@ -526,62 +524,6 @@ describe.skip("scenarios > dependencies > dependency graph", () => {
});
});
});
-
- describe("permissions", () => {
- it("should be able to view database entities without collection access", () => {
- cy.updatePermissionsGraph({
- [ALL_USERS_GROUP_ID]: {
- [WRITABLE_DB_ID]: {
- "view-data": DataPermissionValue.UNRESTRICTED,
- "create-queries": DataPermissionValue.QUERY_BUILDER_AND_NATIVE,
- },
- },
- });
-
- getScoreboardTableId().then((tableId) => {
- createTableBasedQuestion({ tableId });
- createTableBasedModel({ tableId });
- createTableBasedMetric({ tableId });
- createTableBasedTransform({ tableName: TABLE_NAME });
- cy.signIn("nocollection");
- visitGraphForEntity(tableId, "table");
- });
-
- dependencyGraph().within(() => {
- cy.findByLabelText(TABLE_DISPLAY_NAME).within(() => {
- cy.findByText(/question/).should("not.exist");
- cy.findByText(/model/).should("not.exist");
- cy.findByText(/metric/).should("not.exist");
- cy.findByText(/transform/).should("not.exist");
- });
- });
- });
-
- it("should be able to view collection entities without data access", () => {
- getScoreboardTableId()
- .then((tableId) => createTableBasedQuestion({ tableId }))
- .then(({ body: card }) => {
- createCardBasedQuestion({ cardId: card.id });
- createCardBasedModel({ cardId: card.id });
- createCardBasedMetric({ cardId: card.id });
- createCardBasedTransform({ cardId: card.id });
- createCardBasedSnippet({ cardId: card.id });
- cy.signIn("nodata");
- visitGraphForEntity(card.id, "card");
- });
-
- dependencyGraph().within(() => {
- cy.findByLabelText(TABLE_DISPLAY_NAME).should("not.exist");
- cy.findByLabelText(TABLE_BASED_QUESTION_NAME).within(() => {
- cy.findByText("1 question").should("be.visible");
- cy.findByText("1 model").should("be.visible");
- cy.findByText("1 metric").should("be.visible");
- cy.findByText(/snippet/).should("not.exist");
- cy.findByText(/transform/).should("not.exist");
- });
- });
- });
- });
});
function visitGraph() {
@@ -589,7 +531,7 @@ function visitGraph() {
}
function visitGraphForEntity(id: DependencyId, type: DependencyType) {
- return cy.visit(`/${BASE_URL}/${type}/${id}`);
+ return cy.visit(BASE_URL, { qs: { id, type } });
}
function dependencyGraph() {
diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/index.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/index.ts
index 1c98d9b17a3..39e00eb354b 100644
--- a/enterprise/frontend/src/metabase-enterprise/dependencies/index.ts
+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/index.ts
@@ -10,8 +10,7 @@ import { useCheckTransformDependencies } from "./hooks/use-check-transform-depen
import { DependencyGraphPage } from "./pages/DependencyGraphPage";
if (hasPremiumFeature("dependencies")) {
- // TODO Alex P re-enable after v57
- PLUGIN_DEPENDENCIES.isEnabled = false;
+ PLUGIN_DEPENDENCIES.isEnabled = true;
PLUGIN_DEPENDENCIES.DependencyGraphPage = DependencyGraphPage;
PLUGIN_DEPENDENCIES.CheckDependenciesForm = CheckDependenciesForm;
PLUGIN_DEPENDENCIES.CheckDependenciesModal = CheckDependenciesModal;
diff --git a/frontend/src/metabase/lib/urls/dependencies.ts b/frontend/src/metabase/lib/urls/dependencies.ts
index 8aff1ed09a7..92f2ca470bb 100644
--- a/frontend/src/metabase/lib/urls/dependencies.ts
+++ b/frontend/src/metabase/lib/urls/dependencies.ts
@@ -11,10 +11,11 @@ export function dependencyGraph({
entry,
baseUrl = BASE_URL,
}: DependencyGraphParams = {}) {
- const params = new URLSearchParams();
+ const searchParams = new URLSearchParams();
if (entry != null) {
- params.set("id", String(entry.id));
- params.set("type", entry.type);
+ searchParams.set("id", String(entry.id));
+ searchParams.set("type", entry.type);
}
- return params.size > 0 ? `${baseUrl}?${params}` : baseUrl;
+ const queryString = searchParams.toString();
+ return queryString.length > 0 ? `${baseUrl}?${queryString}` : baseUrl;
}