Skip to content
Snippets Groups Projects
Unverified Commit b8948be9 authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Fix and reproduce #45300: Broken filter modal when joining using FKs (#45304)


* Add repro for #45300

* Remove empty line

* Fix

---------

Co-authored-by: default avatarAlexander Polyankin <alexander.polyankin@metabase.com>
parent 763dc887
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,8 @@ import {
join,
newButton,
saveQuestion,
modal,
filter,
} from "e2e/support/helpers";
const {
......@@ -1287,3 +1289,67 @@ describe("issue 42385", { tags: "@external" }, () => {
getNotebookStep("join").should("not.exist");
});
});
describe("issue 45300", () => {
beforeEach(() => {
restore();
cy.signInAsNormalUser();
});
it("joins using the foreign key only should not break the filter modal (metabase#45300)", () => {
visitQuestionAdhoc({
dataset_query: {
database: SAMPLE_DB_ID,
type: "query",
query: {
"source-table": REVIEWS_ID,
joins: [
{
fields: "all",
strategy: "left-join",
alias: "Orders - Product",
condition: [
"=",
["field", REVIEWS.PRODUCT_ID, { "base-type": "type/Integer" }],
[
"field",
ORDERS.PRODUCT_ID,
{
"base-type": "type/Integer",
"join-alias": "Orders - Product",
},
],
],
"source-table": ORDERS_ID,
},
],
},
parameters: [],
},
});
filter();
modal().within(() => {
// sidebar
cy.findByRole("tablist").within(() => {
cy.findAllByRole("tab", { name: "Product" }).eq(0).click();
});
// main panel
cy.findAllByTestId("filter-column-Category")
.should("have.length", 1)
.within(() => {
cy.findByText("Doohickey").click();
});
cy.button("Apply filters").click();
cy.wait("@dataset");
});
cy.findByTestId("filter-pill").should(
"have.text",
"Product → Category is Doohickey",
);
});
});
......@@ -34,7 +34,7 @@ export function getGroupItems(query: Lib.Query): GroupItem[] {
const availableSegments = groupIndex === 0 ? segments : [];
return {
key: groupInfo.name ?? String(stageIndex),
key: `${stageIndex}-${groupIndex}`,
displayName: getColumnGroupName(groupInfo) || t`Summaries`,
icon: getColumnGroupIcon(groupInfo) || "sum",
columnItems: availableColumns.map(column => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment