diff --git a/frontend/src/metabase/lib/query.js b/frontend/src/metabase/lib/query.js index 5901fd861be8e4ac1d855f9c7a08e0635fb6c829..cdfb23a347e695a4297bffa58d03cd3b78a9be40 100644 --- a/frontend/src/metabase/lib/query.js +++ b/frontend/src/metabase/lib/query.js @@ -676,7 +676,7 @@ const Query = { }, getFilterClauseDescription(tableMetadata, filter, options) { - if (filter[0] === "AND" || filter[0] === "OR") { + if (mbqlEq(filter[0], "AND") || mbqlEq(filter[0], "OR")) { let clauses = filter .slice(1) .map(f => Query.getFilterClauseDescription(tableMetadata, f, options)); diff --git a/frontend/src/metabase/qb/components/actions/GenerateDashboardAction.jsx b/frontend/src/metabase/qb/components/actions/GenerateDashboardAction.jsx index 4c2378159ab6d008dae23c74c9693f5dcb1f5783..14fc79219039394853e24ec170ca937e52725902 100644 --- a/frontend/src/metabase/qb/components/actions/GenerateDashboardAction.jsx +++ b/frontend/src/metabase/qb/components/actions/GenerateDashboardAction.jsx @@ -4,6 +4,7 @@ import type { ClickAction, ClickActionProps, } from "metabase/meta/types/Visualization"; +import StructuredQuery from "metabase-lib/lib/queries/StructuredQuery"; import { utf8_to_b64url } from "metabase/lib/card"; import { t } from "c-3po"; @@ -11,6 +12,16 @@ export default ({ question, settings }: ClickActionProps): ClickAction[] => { // currently time series xrays require the maximum fidelity console.log(JSON.stringify(question.query().datasetQuery())); let dashboard_url = "adhoc"; + + const query = question.query(); + if (!(query instanceof StructuredQuery)) { + return []; + } + + // aggregations + if (query.aggregations().length) { + return []; + } if (question.card().id) { dashboard_url = `/auto/dashboard/question/${question.card().id}`; } else { diff --git a/frontend/src/metabase/qb/components/drill/AutomaticDashboardDrill.jsx b/frontend/src/metabase/qb/components/drill/AutomaticDashboardDrill.jsx index d92415857b52e8c1eebbe13c09d8dcd45b8b27ef..cc089251c8824b8e36548107c7e755256dfe5ae5 100644 --- a/frontend/src/metabase/qb/components/drill/AutomaticDashboardDrill.jsx +++ b/frontend/src/metabase/qb/components/drill/AutomaticDashboardDrill.jsx @@ -15,11 +15,6 @@ export default ({ question, clicked }: ClickActionProps): ClickAction[] => { return []; } - // aggregations - if (query.aggregations().length) { - return []; - } - // questions with a breakout const dimensions = (clicked && clicked.dimensions) || []; if (!clicked || dimensions.length === 0) { @@ -39,7 +34,9 @@ export default ({ question, clicked }: ClickActionProps): ClickAction[] => { count, )}`, url: () => { - const filters = question + const filters = query + .clearFilters() // clear existing filters so we don't duplicate them + .question() .drillUnderlyingRecords(dimensions) .query() .filters();