Skip to content

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

Remove moderation reviews from graph filters (#66952)

Alexander Polyankin00c6163ca5db
diff --git a/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts b/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts
index fb5772aadd1..730abbbca81 100644
--- a/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts
+++ b/e2e/test/scenarios/dependencies/dependency-graph.cy.spec.ts
@@ -573,31 +573,19 @@ describe("scenarios > dependencies > dependency graph", () => {
}
it("should be able to filter questions", () => {
- makeCollectionOfficial(FIRST_COLLECTION_ID);
getScoreboardTableId().then((tableId) => {
createDashboard().then(({ body: dashboard }) => {
- createTableBasedQuestion({
- name: "Verified question",
- tableId,
- }).then(({ body: card }) => {
- verifyCard(card.id);
- });
- createTableBasedQuestion({
- name: "Question in dashboard",
- tableId,
- dashboardId: dashboard.id,
- });
createTableBasedQuestion({
name: "Question in root collection",
tableId,
});
createTableBasedQuestion({
- name: "Question in official collection",
+ name: "Question in first collection",
tableId,
collectionId: FIRST_COLLECTION_ID,
});
createTableBasedQuestion({
- name: "Question in regular collection",
+ name: "Question in second collection",
tableId,
collectionId: SECOND_COLLECTION_ID,
});
@@ -606,30 +594,24 @@ describe("scenarios > dependencies > dependency graph", () => {
tableId,
collectionId: ADMIN_PERSONAL_COLLECTION_ID,
});
+ createTableBasedQuestion({
+ name: "Question in dashboard",
+ tableId,
+ dashboardId: dashboard.id,
+ });
});
visitGraphForEntity(tableId, "table");
});
H.DependencyGraph.graph()
.findByLabelText(TABLE_DISPLAY_NAME)
- .findByText("6 questions")
+ .findByText("5 questions")
.click();
- verifyFilter({
- filterName: "Verified",
- visibleItems: ["Verified question"],
- hiddenItems: ["Question in official collection"],
- });
verifyFilter({
filterName: "In a dashboard",
visibleItems: ["Question in dashboard"],
- hiddenItems: ["Verified question", "Question in regular collection"],
- });
- verifyFilter({
- filterName: "In an official collection",
- visibleItems: ["Question in official collection"],
hiddenItems: [
- "Verified question",
- "Question in dashboard",
- "Question in root collection",
+ "Question in first collection",
+ "Question in second collection",
],
});
verifyFilter({
@@ -637,7 +619,8 @@ describe("scenarios > dependencies > dependency graph", () => {
visibleItems: [
"Question in dashboard",
"Question in root collection",
- "Question in regular collection",
+ "Question in first collection",
+ "Question in second collection",
],
hiddenItems: ["Question in personal collection"],
});
@@ -657,20 +640,6 @@ function getScoreboardTableId() {
return cy.get<number>(`@${TABLE_ID_ALIAS}`);
}
-function makeCollectionOfficial(collectionId: CollectionId) {
- cy.request("PUT", `/api/collection/${collectionId}`, {
- authority_level: "official",
- });
-}
-
-function verifyCard(cardId: CardId) {
- cy.request("POST", "/api/moderation-review", {
- status: "verified",
- moderated_item_id: cardId,
- moderated_item_type: "card",
- });
-}
-
function createTableBasedCard({
name,
type,
diff --git a/enterprise/backend/src/metabase_enterprise/dependencies/api.clj b/enterprise/backend/src/metabase_enterprise/dependencies/api.clj
index 3cdf9983fd6..4db0d87304b 100644
--- a/enterprise/backend/src/metabase_enterprise/dependencies/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/dependencies/api.clj
@@ -153,14 +153,12 @@
:created_at :creator :creator_id :description
:result_metadata :last-edit-info
:collection :collection_id :dashboard :dashboard_id
- :document :document_id
- :moderation_reviews]
+ :document :document_id]
:snippet [:name :description]
:transform [:name :description :creator :table]
:dashboard [:name :description :view_count
:created_at :creator :creator_id :last-edit-info
- :collection :collection_id
- :moderation_reviews]
+ :collection :collection_id]
:document [:name :description :view_count
:created_at :creator
:collection :collection_id]
@@ -196,7 +194,7 @@
;; frontend/src/metabase-types/api/dependencies.ts
;; (See CardDependencyNodeData, DashboardDependencyNodeData, etc.)
;;
-;; Note: Some fields (like :creator, :collection, :moderation_reviews) are added via t2/hydrate,
+;; Note: Some fields (like :creator, :collection) are added via t2/hydrate,
;; and others (like :last-edit-info, :view_count) are computed/added separately.
;; This map only lists the base database columns to SELECT.
(def ^:private entity-select-fields
@@ -366,12 +364,12 @@
(let [model (entity-model entity-type)
fields (entity-select-fields entity-type)]
(->> (cond-> (t2/select (into [model] fields) :id [:in entity-ids])
- (= entity-type :card) (-> (t2/hydrate :creator :dashboard :document [:collection :is_personal] :moderation_reviews)
+ (= entity-type :card) (-> (t2/hydrate :creator :dashboard :document [:collection :is_personal])
(->> (map collection.root/hydrate-root-collection))
(revisions/with-last-edit-info :card))
(= entity-type :table) (t2/hydrate :fields :db)
(= entity-type :transform) (t2/hydrate :creator :table-with-db-and-fields)
- (= entity-type :dashboard) (-> (t2/hydrate :creator [:collection :is_personal] :moderation_reviews)
+ (= entity-type :dashboard) (-> (t2/hydrate :creator [:collection :is_personal])
(->> (map collection.root/hydrate-root-collection))
(revisions/with-last-edit-info :dashboard))
(= entity-type :document) (-> (t2/hydrate :creator [:collection :is_personal])
diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/PanelHeader/FilterOptionsPicker/utils.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/PanelHeader/FilterOptionsPicker/utils.ts
index 7e050a1ba96..81210acc15a 100644
--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/PanelHeader/FilterOptionsPicker/utils.ts
+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/PanelHeader/FilterOptionsPicker/utils.ts
@@ -7,9 +7,7 @@ import type { FilterItem } from "./types";
export function getFilterItems(): FilterItem[] {
const allLabels: Record<FilterOption, string> = {
- verified: t`Verified`,
"in-dashboard": t`In a dashboard`,
- "in-official-collection": t`In an official collection`,
"not-in-personal-collection": t`Not in personal collection`,
};
diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/constants.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/constants.ts
index 08ab20aa313..90921bb0981 100644
--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/constants.ts
+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/constants.ts
@@ -1,8 +1,6 @@
// defines the order of options in the UI
export const FILTER_OPTIONS = [
- "verified",
"in-dashboard",
- "in-official-collection",
"not-in-personal-collection",
] as const;
diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/utils.ts b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/utils.ts
index 393654ab7da..929b7aef55a 100644
--- a/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/utils.ts
+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/components/DependencyGraph/GraphDependencyPanel/utils.ts
@@ -42,19 +42,6 @@ function isMatchingSearchQuery(
}
const FILTERS: Record<FilterOption, FilterCallback> = {
- verified: (node) => {
- switch (node.type) {
- case "card":
- case "dashboard": {
- const lastReview = node.data.moderation_reviews?.find(
- (review) => review.most_recent,
- );
- return lastReview != null && lastReview.status === "verified";
- }
- default:
- return false;
- }
- },
"in-dashboard": (node) => {
switch (node.type) {
case "card": {
@@ -65,18 +52,6 @@ const FILTERS: Record<FilterOption, FilterCallback> = {
return false;
}
},
- "in-official-collection": (node) => {
- switch (node.type) {
- case "card":
- case "dashboard":
- case "document": {
- const collection = node.data.collection;
- return collection != null && collection.authority_level === "official";
- }
- default:
- return false;
- }
- },
"not-in-personal-collection": (node) => {
switch (node.type) {
case "card":
@@ -97,14 +72,6 @@ export function canFilterByOption(
): boolean {
const type = getDependencyType(groupType);
switch (option) {
- case "verified":
- switch (type) {
- case "card":
- case "dashboard":
- return true;
- default:
- return false;
- }
case "in-dashboard":
switch (type) {
case "card":
@@ -112,7 +79,6 @@ export function canFilterByOption(
default:
return false;
}
- case "in-official-collection":
case "not-in-personal-collection":
switch (type) {
case "card":
diff --git a/frontend/src/metabase-types/api/dependencies.ts b/frontend/src/metabase-types/api/dependencies.ts
index d2ed1217b41..a4274bbc273 100644
--- a/frontend/src/metabase-types/api/dependencies.ts
+++ b/frontend/src/metabase-types/api/dependencies.ts
@@ -64,7 +64,6 @@ export type CardDependencyNodeData = Pick<
| "creator"
| "created_at"
| "last-edit-info"
- | "moderation_reviews"
> & {
view_count?: number | null;
};