Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Sep 18, 2023
  2. Sep 16, 2023
  3. Sep 15, 2023
    • Nicolò Pretto's avatar
      Whats new notification (#33593) · ba983535
      Nicolò Pretto authored
      
      * Whats new notification (#33325)
      
      * feat: add last-acknowledged-version to settings types
      
      * whats new notification logic with mock ui
      
      * updated logic to look for the release notes url  as for last sync
      
      * move folder in nav/components
      
      * wip dismiss logic
      
      * wait for @sessionProperty to make sure notification would have loaded in case of failing test
      
      * skipped test for manual testing/qa
      
      * updated ui with mantine
      
      * docs for getLatestEligibleReleaseNotes
      
      * fix e2e to use icon
      
      * use real sparkles image/icon
      
      * refactor and clean up to use correct components
      
      * moved all the logic into the util function to ease testing
      
      * removed Paper import
      
      * styled component instead of sx prop
      
      * renamed things as per pr feedback
      
      * fix ts error
      
      * use createMockVersion
      
      * removed getLastAcknowledgedVersion from 'settings.ts'
      
      * added tests
      
      * added multi user e2e test
      
      * fix function not bein called by mistake
      
      * removed new line that was added in previous commit
      
      * test: adds test for case when current version is not present in version info
      
      * fix logic to exclude versions not found in version-info
      
      * releaseNotesUrl -> announcement_url
      
      * fix manual test
      
      * Whats new test refactor (#33592)
      
      * moved NotificationContainer into styled.tsx file
      
      * removed commented code
      
      * move version list logic in helper function
      
      * removed describe block wrapping everything
      
      * refactored unit test for util function to prepare them to accept tests currently in the component
      
      * fix test passing for the wrong reason
      
      * switched order of cy.wait/cy.findBy to make test more resilient
      
      * adds tests as suggested on pr
      
      * moved test to unit test file, removed component tests already covered
      
      * added jest test to check if endpoint is called when dismissing the notification
      
      * use paper from metabase/ui (#33595)
      
      * fix font size (#33596)
      
      * added hover color to icon in what's new notification (#33633)
      
      * added hover color to icon
      
      * use colors from theme
      
      * What's new - adds white labeling check to logic (#33673)
      
      * adds white labeling check to logic
      
      * sets isEmbedded and isWhiteLabeling as non optional
      
      * made currentVersion non-optional
      
      * Fix compareversions (#33671)
      
      * adds typing to compareVersions util function
      
      * sort versions before doing logic
      
      * add logic to version comparison to make 0.46 = 0.46.0
      
      * adds tests that is actuall needing the padding
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
      
      * remove new test file before moving new one there
      
      * moved old test file to be colocated
      
      * added back new tests
      
      * versionToNumericComponents
      
      * correct VersionInfoTyping to make version always present
      
      * fix for type error that appears in ci but not locally?
      
      * refactor test to not use shuffle + whitespace fixes
      
      * Update frontend/src/metabase/lib/utils.unit.spec.ts
      
      * refactored versionToNumericComponents to use regex to be more readbale after suggestion of alex
      
      * fix not working for v1
      
      ---------
      
      Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
      
      * remove cy test used for manual test
      
      ---------
      
      Co-authored-by: default avatarKamil Mielnik <kamil@kamilmielnik.com>
      Unverified
      ba983535
    • Uladzimir Havenchyk's avatar
      Drop unused packages (#33850) · 1128622f
      Uladzimir Havenchyk authored
      * Drop redux-router
      
      * Drop react-element-to-jsx-string
      
      * Typo
      Unverified
      1128622f
  4. Sep 14, 2023
  5. Sep 13, 2023
  6. Sep 12, 2023
  7. Sep 11, 2023
  8. Sep 08, 2023
    • dpsutton's avatar
      Fix parameter mappings on dashboards (#33837) · 716e8b1f
      dpsutton authored
      when running an x-ray on tables, we were sending back the following
      parameter mappings:
      
      BEFORE with bug:
      ```clojure
      core=> (let [table (t2/select-one 'Table :id 1)]
               ;; products table
               (-> (automagic-analysis table {})
                   :ordered_cards first
                   (select-keys [:parameter_mappings :card])
                   (update-in [:card] #(select-keys % [:dataset_query]))))
      {:parameter_mappings ({:parameter_id "-1185138340",
                             :target [:dimension
                                      [:field
                                       "CREATED_AT"  ;; <----- field reference by name
                                       {:base-type :type/DateTime}]],
                             :card_id G__246876}
                            {:parameter_id "241800831",
                             :target [:dimension
                                      [:field
                                       "CATEGORY"    ;; <----- field reference by name
                                       {:base-type :type/Text}]],
                             :card_id G__246876}),
       :card {:dataset_query {:type :query,          ;; <----- mbql query
                              :database 1,
                              :query {:source-table 1,
                                      :breakout ([:field
                                                  64
                                                  {:temporal-unit :quarter-of-year}]),
                                      :aggregation (["count"])}}}}
      ```
      
      After this change we have the following parameter mappings which use ids
      as field references:
      
      ```clojure
      core=> (let [table (t2/select-one 'Table :id 1)]
                    ;; products table
                    (-> (automagic-analysis table {})
                        :ordered_cards first
                        (select-keys [:parameter_mappings :card])
                        (update-in [:card] #(select-keys % [:dataset_query]))))
      {:parameter_mappings ({:parameter_id "-1185138340",
                             :target [:dimension [:field 64 nil]], ;; <-- by id
                             :card_id G__186662}
                            {:parameter_id "241800831",
                             :target [:dimension [:field 58 nil]], ;; <-- by id
                             :card_id G__186662}),
       :card {:dataset_query {:type :query,
                              :database 1,
                              :query {:source-table 1,
                                      :breakout ([:field
                                                  64
                                                  {:temporal-unit :quarter-of-year}]),
                                      :aggregation (["count"])}}}}
      ```
      
      This change was introduced in our refactoring to support x-rays on
      models with commit message
      
      * metabase.automagic-dashboards.filters - Fix to build-fk-map so that
      parameters show up on model x-rays
      
      I'm not sure what the reasoning was but we can revisit it when we want
      to do some filters on models
      Unverified
      716e8b1f
    • Mark Bastian's avatar
      Automagic tests (#33732) · 50ed3b3f
      Mark Bastian authored
      
      * metabase.automagic-dashboards.core - Docs, cleanup, and destructuring for clarity
      metabase.api.search - Adding fix to realize search results
      metabase.automagic-dashboards.filters - Fix to build-fk-map so that parameters show up on model x-rays
      metabase.automagic-dashboards.populate - Fix typo
      metabase.api.search-test - Unit tests for search fix
      
      * Brought over tab saving of transient x-ray dashboard code to save-transient-dashboard!
      
      Added initial cut of tabbed x-ray generation from mapping over linked entities to the automagic-dashboards api
      
      * update signature
      
      we'll need some filtering criteria for the tabs. we don't just want an
      x-ray of orders, we want an x-ray of _Customer's orders_
      
      * Added query-filter to /model_index/:model-index-id/primary_key/:pk-id API
      
      * Fixed id propagation
      
      * clean up the logic a little bit
      
      * Intermediate step to trap bad generated queries
      
      * First stab at queries with joins for x-rays
      
      take a model, find joinable tables and create joins back to the model's
      underlying table so we can filter where pk=selected-id.
      
      ```clojure
      {:database_id 1,
       :database-id 1,
       :table_id 2,
       :dataset_query {:database 1,
                       :type :query,
                       :query {:source-table 2,
                               :where [:=
                                       [:field
                                        62
                                        {:join-alias "ORDERS__via__PRODUCT_ID"}]
                                       1],
                               :joins [{:alias "ORDERS__via__PRODUCT_ID",
                                        :fields :none,
                                        :strategy :left-join,
                                        :condition [:=
                                                    [:field
                                                     62
                                                     {:join-alias "ORDERS__via__PRODUCT_ID"}]
                                                    [:field 40 nil]],
                                        :source-table 1}]}}}
      ```
      
      Note the where clause and the join, but selecting `:fields :none` from
      the join. so it's
      
      ```sql
      select j.*
      from joinable j
      left join model m
      where m.id = <user-selection>
      ```
      
      But x-rays of these queries strip out our joins :(
      
      Here's what comes back in the automagic dashboard
      
      ```clojure
      {:type :query,
       :database 1,
       :query {:source-table 2,
               :filter [:and
                        [:=
                         [:field
                          62
                          nil]
                         1]],
               :breakout ([:field
                           41
                           {:temporal-unit :month}]),
               :aggregation (["avg"
                              [:field
                               39
                               nil]])}}
      ```
      
      It's a breakout by month of orders.created_at (field 41) aggregated by
      orders.quantity (field 39) where products.id (field 62 of table) =
      1. But there's no join to products any longer :(
      
      And there's this nice little comment
      
      ```clojure
      (defn- maybe-enrich-joins "Hack to shove back in joins when they get
      automagically stripped out by the question decomposition into metrics"
      ```
      
      So that's no great. More investigating to do
      
      * Added in `:source-field` for our x-ray tabs so that filters would succeed.
      
      * Merged fixes to filters.
      
      * Adding in entity x-ray dashboard title
      
      * Fixed entity x-ray description.
      
      * Added model-link card to each tab in the dynamically generated entity x-rays.
      
      * Adding min-width calculation for source model link card.
      
      * Adding tests for min-width calculation for source model link card.
      
      * Fixing import indentation
      
      * tests for x-rays on indexed models
      
      * Adding tests to metabase.api.automagic-dashboards-test to assert the existence of model link cards and meaningful dashboard names and descriptions.
      
      * include model_index_id in search results for indexed entity
      
      had the rest of the changes, just not the id of the model_index
      
      * use negative integers, not gensyms for tab-ids
      
      FE wants negative integers for ids that do not exist in the db yet. some
      of the cards and such still use gensym and that seems to be ok for now.
      
      * fix tabs on x-ray dashboard in FE
      
      * add x-ray button to `SearchResult` component
      
      * clean up styles for tabs in `AutomaticDashboardAppInner`
      
      * Added tests to understand some of the logic in `field-candidates.` The selection of a candidate is variable depending on the specification of the dimension, the field type, the table type, how the context is populated, etc. These tests attempt to illustrate some of the logic.
      
      * Adding tests in which multiple fields match to multiple dimensions.
      
      * Added tests for bind-dimensions and much of the logic it calls.
      
      * Removing `:transient_name` and `:transient_filters` from generated entity x-ray to ensure the right information is displayed on the generated dashboard.
      
      * Formatting
      
      * Formatting
      
      * Formatting
      
      * Formatting
      
      * Fixing quoted instance of Card
      
      * wslint
      
      * Hook for `metabase.api.automagic-dashboards-test/with-indexed-model`
      
      * wip
      
      * wslint
      
      * lint warnings on ns requires
      
      unused ns qp
      using a deprecated namespace so give an override
      
      * better error message for no linked entities
      
      they used to be in the let-404 so you would get a quite confusing error
      message. Now it's a 400 and will show "No linked entities" if you expand
      the error message. We still need to make this better. But this is an
      obvious improvement on a 404.
      
      * Adding default entity dashboard for when no linked entities are found.
      
      * fix search tests
      
      * call count is 16 now
      
      * Fixing unit test
      
      * Fixed the query filter in `metabase.api.automagic-dashboards` so that `create-linked-dashboard` doe not produce bad queries.
      
      * remove model index destructure
      
      * Assert that all query dashcards have the correct filter.
      
      We're no longer making joins back to the model's underlying
      table. Recognizing that we were joining on linked table's fk to the
      model's underlying table's pk and then searching where pk = <pk-value>,
      we can just filter where fk = <pk-value>, omit the join.
      
      So these tests just grab all of the linked tables and assert that one of
      those filters is found.
      
      eg, suppose a model based on products. the linked tables are orders and
      reviews. And rather than the queries:
      
      ```sql
      select o.*
      from orders o
      left join products p
      on p.id = o.product_id
      where p.id = <pk-value>
      ```
      
      we can just do
      
      ```sql
      select *
      from orders
      where product_id = <pk-value>
      ```
      
      And similar for reviews. And for each query in the dashboard we're
      looking for one of the following:
      
      ```clojure
      , #{[:= $orders.product_id 1] [:= $reviews.product_id 1]}
      ```
      
      * Intermediate stage of fixing our tests
      
      * Added missing `is` clauses to a few tests. This surfaced some minor formatting changes that would have broken the tests had they been working. Updated the tests to correspond to the changes (just has to do with pluralization).
      
      * Fixed untyped event and added mock search data.
      
      * Fixing entity x-rays for a single linked entity
      
      * Adding logic to provide only a single linked entity view for entity x-rays if only one is generated.
      
      * lint fix
      
      * add tests for 1 linked-table = 0 tabs case
      
      * Updated `create-linked-dashboard` with a threading macro for clarity and to be more clojuric.
      
      * split single test into three
      
      cam made a new linter to look for test forms over a certain
      size. There's no great way to run only a single testing form so this
      helps make things more atomic
      
      * More tests to understand bind-dimensions and the functions it depends on.
      
      * Added test for three column query linking all columns to the same underlying table.
      
      * Handle expression refs in indexed-models
      
      Custom columns look like the following:
      
      ```clojure
      {:expressions {"full-name" [:concat <first-name> <last-name>]}
      ```
      
      To index values, we need a sequence of primary key and the associated
      text value. So we select them from a nested query on the model. But the
      model's way to refer to an expression and queries _on_ the model are
      different. To the model, it's an expression. To queries based on the
      model, it's just another field.
      
      And have field refs in the result_metadata `[:expression
      "full-name"]`. But when selecting from a nested query, they are just
      string based fields: `[:field "full-name" {:base-type :type/Text}]`.
      
      old style query we issued when fetching values:
      
      ```clojure
      {:database 122
       :type :query
       :query {:source-table "card__1715"
               :breakout [[:field 488 {:base-type :type/Integer}]
                          [:expression "full name"]] ;; <-- expression
               :limit 5001}}
      ```
      
      new style after this change:
      
      ```clojure
      {:database 122
       :type :query
       :query {:source-table "card__1715"
               :breakout [[:field 488 {:base-type :type/Integer}]
                          [:field "full name" {:base-type :type/Text}]]
               :limit 5001}}
      ```
      
      * Normalize field references
      
      The schema was expecting valid mbql field refs (aka vectors and
      keywords) but was getting a list and string (`[:field 23 nil]`
      vs ("field" 23 nil)`). So normalize the field ref so we can handle the
      stuff over the wire
      
      this nice little bit of normalization lived in models.interface and
      comped two functions in mbql.normalize. A few places reused it so moved
      it to the correct spot.
      
      * Better error message in `fix-expression-refs`
      
      handles [:field ...] and [:expression ...] clauses. Seems unlikely that
      aggregations will flow through here as that's not a great way to label a
      pk. But i'll add support for that in a follow up
      
      * Move `normalize-field-ref` below definition of `normalize-tokens`
      
      `normalize-tokens` is `declare`d earlier, but we aren't using the var as
      a var, but in a def we derefence it. But that's nil as it hadn't been
      defined yet. Caused lots of failures downstream, including in cljs land
      
      ```clojure
      user=> (declare x)
      user=> (def y x) ;; <- the use in a def gets its current value
      user=> (def x 3) ;; <- and it's not reactive and backfilling
      user=> y
      ```
      
      * Added tests for `has-matches?` and `resolve-overloading`
      
      * Adding filter examples into the `resolve-overloading` and `has-matches"` tests.
      
      Filter and metric matching logic is identical, but these examples are added for completeness and illustration.
      
      * tests WIP trying to fix merge changes
      
      * Removing tap
      
      * Removing duplicate def
      
      * Added tests for card-candidates
      
      ---------
      
      Co-authored-by: default avatardan sutton <dan@dpsutton.com>
      Co-authored-by: default avatarEmmad Usmani <emmadusmani@berkeley.edu>
      Unverified
      50ed3b3f
    • Case Nelson's avatar
    • Jesse Devaney's avatar
      Refactor Archive App (#33601) · 6d19ba94
      Jesse Devaney authored
      * refactor use-list-select hook
      
      - toggleAll(items) felt unintuitive as some items could be selected while simultaneously unselecting others
        - switched to selectOnlyTheseItems(items) to be more explicit on what the function is doing
      - updated consumers of useListSelect to use the new API
      
      * convert to functional component
      
      * convert HoC ListSelect to hook useListSelect
      
      * convert redux connects to useSelectors
      
      * refactor ArchiveApp and improve types
      
      * remove unused eslint disable line
      
      * update useListSelect because of changes
      
      * convert ArchivedItem to TypeScript
      
      * refactor Search.loadList to useSearchListQuery
      
      * add E2E tests for archive page
      
      * refactor
      
      - remove dead code
      - refactor duplicated code
      
      * fix type error
      
      * fix variable usage
      
      * fix broken scroll update
      Unverified
      6d19ba94
    • Jeff Bruemmer's avatar
      update releases (#33834) · 6af5621e
      Jeff Bruemmer authored
      Unverified
      6af5621e
    • Uladzimir Havenchyk's avatar
    • Nemanja Glumac's avatar
      Add the official build for release workflow (#33362) · ca7d4341
      Nemanja Glumac authored
      * Add the official build for release workflow
      
      [ci skip]
      
      * Store full-length SHA-1 commit hash in an artifact
      
      * Trigger pre-release when the official build workflow finishes
      
      * Download the official uberjar instead of building it again
      
      * Adapt `check-commit` job to use the release artifact
      
      * Adapt `check-uberjar-health` job to use the release artifact
      
      * Adapt `run-sanity-check` job to use the release artifact
      
      * Adapt `containerize` job to use the release artifact
      
      * Adapt `verify-docker-pull` job to use the release artifact
      
      [ci skip]
      
      * Checkout the repo
      
      We need the folder structure to satisfy the JAR path.
      [ci skip]
      
      * Make `check-uberjar-healt` dependend on the commit check job
      
      * Fix commit-id file path
      
      [ci skip]
      
      * Fix `containerize` reference to the release artifact commit output
      
      [ci skip]
      
      * Fix `release-artifact` outputs
      
      [ci skip]
      Unverified
      ca7d4341
    • Kamil Mielnik's avatar
      Refactor useLeaveConfirmation hook to a component (#33801) · 45df944e
      Kamil Mielnik authored
      * Move useLeaveConfirmation hook to global hooks directory
      
      * Use useBeforeUnload in useLeaveConfirmation
      
      * Remove redundant custom onConfirm prop
      
      * Convert useLeaveConfirmation to TS
      
      * Fix router & route props in PermissionsPageLayout
      
      * Refactor useLeaveConfirmation into LeaveConfirmationModal
      
      * Move withRouter from PermissionsPageLayout to LeaveConfirmationModal
      
      * Remove redundant _.compose call
      
      * Sort props
      
      * Fix build
      - ./bin/i18n/update-translation-template did not recognize the syntax
      
      * Sort props
      Unverified
      45df944e
  9. Sep 07, 2023
Loading