-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🤖 backported "Fixing static-viz exports of saved x-ray dashboards" #38418
Merged
markbastian
merged 2 commits into
release-x.48.x
from
backport-ee1581fb6bec52adb4a0044230bec6ae4e51ad79
Feb 6, 2024
Merged
🤖 backported "Fixing static-viz exports of saved x-ray dashboards" #38418
markbastian
merged 2 commits into
release-x.48.x
from
backport-ee1581fb6bec52adb4a0044230bec6ae4e51ad79
Feb 6, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
metabase-bot
bot
added
the
was-backported
apply this to PRs that are themselves backports
label
Feb 2, 2024
* Fixing static-viz exports of saved x-ray dashboards When dashboards were generated with x-rays, the `:visualization_settings` were not properly filled in. In particular, the `:graph.dimensions` and `:graph.metrics` were being populated from either the raw template values or not at all. The following namespace demonstrates this: ```clojure (ns tickets.38350-broken-xray-export (:require [dev.render-png :as render-png] [metabase.models :refer [Card]] [metabase.test :as mt])) (mt/dataset test-data (mt/with-temp [Card {bad-card-id :id} {:display :row :dataset_query {:database (mt/id) :type :query :query {:source-table (mt/id :orders) :aggregation [[:count]] :breakout [[:field (mt/id :products :category) {:source-field (mt/id :orders :product_id)}]]}} :visualization_settings {:graph.series_labels [nil] :graph.dimensions [{:ProductCategoryMedium {}}] :graph.colors ["#EF8C8C"] :graph.metrics [nil]}} Card {good-card-id :id} {:display :row :dataset_query {:database (mt/id) :type :query :query {:source-table (mt/id :orders) :aggregation [[:count]] :breakout [[:field (mt/id :products :category) {:base-type :type/Text :source-field (mt/id :orders :product_id)}]]}} :visualization_settings {:graph.dimensions ["CATEGORY"] :graph.metrics ["count"]}}] (render-png/render-card-to-png bad-card-id) (render-png/render-card-to-png good-card-id))) ``` The FE seemed to have some level of error checking and was robust enough to recover from these bad `:visualization_settings`. The solution is to correctly populate these values. This required updating the `:dimension-name->field` value in each card to include mappings derived from both metrics and dimensions and then using the right logic in the `visualization-settings` function. * Removed unneeded `->legacy-MBQL` on values in `:mbql/query` dispatch (cherry picked from commit ee1581f)
markbastian
force-pushed
the
backport-ee1581fb6bec52adb4a0044230bec6ae4e51ad79
branch
from
February 6, 2024 15:09
5c40011
to
fd07115
Compare
|
adam-james-v
approved these changes
Feb 6, 2024
markbastian
deleted the
backport-ee1581fb6bec52adb4a0044230bec6ae4e51ad79
branch
February 6, 2024 16:16
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#38379
Important
Manual conflict resolution is required.
Checkout the branch and run
./backport.sh
script. Force push your changes after cherry-picking.