Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Feb 06, 2024
    • metabase-bot[bot]'s avatar
      :robot: backported "Fixing static-viz exports of saved x-ray dashboards" (#38418) · dab12cff
      metabase-bot[bot] authored
      
      * 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 ee1581fb)
      
      Co-authored-by: default avatarMark Bastian <markbastian@gmail.com>
    • metabase-bot[bot]'s avatar
    • metabase-bot[bot]'s avatar
      [MLv2] Add caching for all the `foo-columns` functions (#37586) (#37665) · a7302996
      metabase-bot[bot] authored
      
      This is at the `metabase.lib.js` level. Should help solve some
      performance issues where eg. `expressionable-columns` was getting called
      on every keystroke for autocomplete; see #37528.
      
      Powered by `metabase.lib.cache/side-channel-cache`, which attaches
      the cache in an Atom on a private property mutated onto the `query`.
      That means it is invalidated with any edit to the query (since a new
      object is returned) and becomes garbage at the same time the query does.
      
      Co-authored-by: default avatarBraden Shepherdson <braden@metabase.com>
    • metabase-bot[bot]'s avatar
  2. Feb 05, 2024
  3. Feb 02, 2024
  4. Feb 01, 2024
  5. Jan 31, 2024
    • metabase-bot[bot]'s avatar
      Query row limit doesn't limit in-product downloads (#37716) (#38326) · a7ee28f3
      metabase-bot[bot] authored
      
      I misunderstood the desired behavior when I implemented this before. We
      only want the limit to apply when the `add-default-userland-constraints`
      middleware is applied to the query, not when we're downloading the data
      directly.
      
      This is a bit of a rat's nest. If there's a better way to approach the
      problem, I'd be happy to hear it. I added documentation for the odd approach
      as much as possible.
      
      The main difficulty is that the userland middleware does not have access
      to db-local settings. So if we want db-local settings to apply only to
      userland, we have to hack our way around it.
      
      The solution here is to divide the userland middleware into two parts:
      
      - the actually-userland bit, which just marks the query as needing
      default limits, and
      
      - a middleware inserted deeper in the middleware stack (just before we
      actually apply limits) that actually calculates those limits and
      attaches them to the query.
      
      Co-authored-by: default avatarJohn Swanson <john.swanson@metabase.com>
    • metabase-bot[bot]'s avatar
      Run selected text loses parameters (#38095) (#38196) · f929d03b
      metabase-bot[bot] authored
      
      * Reproduction: Run selected text does not use parameter values correctly
      
      * Use question instead of card when overriding
      
      * Switch to overrideWithQuestion in RELOAD_CARD
      
      * Rename run to dataset in e2e test
      
      * Use cypress builtins instead of custom selectors
      
      * Remove async from e2e test
      
      * Avoid assigning editor to variable
      
      * Type closing }} on editor
      
      * Set type delay to 0
      
      * Add explainer about why the reproduction differs from the issue
      
      * Add limit to test case
      
      * Test actual vizualisation results instead of implementation detauls of dataset
      
      * Clarify that the space is not needed
      
      * Simplify cypress check
      
      Co-authored-by: default avatarRomeo Van Snick <romeo@romeovansnick.be>
    • metabase-bot[bot]'s avatar
  6. Jan 30, 2024
  7. Jan 29, 2024
  8. Jan 26, 2024
  9. Jan 25, 2024
Loading