Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Jun 16, 2022
    • dpsutton's avatar
      Handle quarters in native queries (#23368) · 3530241c
      dpsutton authored
      MBQL goes through a different path. This is only for native
      queries. Also the diff is huge. Ignoring whitespace shows a very modest
      diff:
      
      ```diff
          "month"   {:unit-range month-range
                     :to-period  t/months}
      +   "quarter" {:unit-range relative-quarter-range
      +              :to-period  (comp t/months (partial * 3))}
          "year"    {:unit-range year-range
                     :to-period  t/years}})
      
      ...
      
         "past2months~"   {:end "2016-06-30", :start "2016-04-01"}
         "past13months"   {:end "2016-05-31", :start "2015-05-01"}
      +  "past2quarters"  {:end "2016-03-31", :start "2015-10-01"}
      +  "past2quarters~" {:end "2016-06-30", :start "2015-10-01"}
         "past1years"     {:end "2015-12-31", :start "2015-01-01"}
         "past1years~"    {:end "2016-12-31", :start "2015-01-01"}
      ```
      
      Helpful Testing Strategies
      --------------------------
      
      Sample DB
      =========
      
      `select id, created_at from orders where {{created_at}}`
      and set a field filter of type "Date Filter"
      
      Custom Table
      ============
      
      Create a table that has entries in the middle of each quarter.
      
      ```sql
      esting=# create table quarters (id serial primary key not null, description text, t timestamptz);
      CREATE TABLE
      testing=# insert into quarters (description, t) values ('Q1 2022', '2022-02-01'), ('Q2 2022', '2022-05-01'), ('Q3 2022', '2022-08-01'), ('Q4 2022', '2022-11-01');
      INSERT 0 4
      testing=# select * from quarters;
       id | description |           t
      ----+-------------+------------------------
        1 | Q1 2022     | 2022-02-01 00:00:00-06
        2 | Q2 2022     | 2022-05-01 00:00:00-05
        3 | Q3 2022     | 2022-08-01 00:00:00-05
        4 | Q4 2022     | 2022-11-01 00:00:00-05
      (4 rows)
      ```
      
      Before this change
      ------------------
      
      > Cannot invoke "clojure.lang.IFn.invoke(Object)" because "to_period" is null
      
      (note, if you cannot reproduce this its because you haven't gotten
      https://github.com/metabase/metabase/pull/23346 in your local version
      which ensured errors always appear as errors on the frontend. java 11
      has no message for NPE so the Frontend missed it was an error and
      displayed no results as if the query had succeeded)
      
      This was the case for the following scenarios:
      - "last1quarters"
      - "last1quarters~"
      - "thisquarter"
      - "next1quarters"
      - "next1quarters~"
      
      where the ~ means to include the current quarter.
      
      After this change
      -----------------
      
      Running the queries against the custom table I made (current time is Jun
      15, Q2)
      
      - "last1quarters": "Q1 2022" "February 1, 2022, 6:00 AM"
      - "last1quarters~": "Q1 2022" "February 1, 2022, 6:00 AM" | "Q2 2022" "May 1, 2022, 5:00 AM"
      - "thisquarter": "Q2 2022" "May 1, 2022, 5:00 AM"
      - "next1quarters" "Q3 2022" "August 1, 2022, 5:00 AM"
      - "next1quarters~": "Q2 2022" "May 1, 2022, 5:00 AM" | "Q3 2022" "August 1, 2022, 5:00 AM"
      
      And of course added tests into the matrix for the date parsing.
      3530241c
    • jkeys089's avatar
      improved support for Google Cloud SQL (#19302) · e8368d1d
      jkeys089 authored
      
      * improved support for Google Cloud SQL
      
      * upgrade `postgres-socket-factory` and add license overrides
      
      * fix license check
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      e8368d1d
    • Braden Shepherdson's avatar
      9a2d06e5
    • Dalton's avatar
      Add NumberInputWidget component (#23247) · 78f2799b
      Dalton authored
      * First pass at NumberWidget
      
      * Share styled components
      
      * Remove TokenField prop for now
      
      * Second pass
      
      * Add to ParameterValueWidget
      
      * Add placeholder text
      
      * Rename to NumberInputWidget
      
      * Only use new widget for field filter parameters for now
      
      * Fix placeholder
      
      * Fix button text
      
      * Fix placeholder text
      
      * Add unit tests
      
      * Fix type
      78f2799b
    • Dalton's avatar
      Refactor card parameter utils (#23063) · 5bdde140
      Dalton authored
      Fix unit tests
      
      Update name to match dashboard util fn name
      5bdde140
    • Dalton's avatar
      Refactor `metabase/parameters/utils/dashboards` functions to be less coupled to Fields (#22964) · 219910fd
      Dalton authored
      * refactor dashboard utils
      
      Fix e2e test
      
      * rmv unused arg
      219910fd
    • dpsutton's avatar
      Return non-zero output from BE i18n on error (#23373) · 47b7ac9e
      dpsutton authored
      Want to return non-zero on unrecognized forms so that CI can indicate
      when forms are added that cannot be parsed.
      
      And example of a completely valid form of `trs` that we cannot identify
      with this code is
      
      ```clojure
      ;; from driver/util.clj
      (-> "Cycle detected resolving dependent visible-if properties for driver {0}: {1}"
      
          (trs driver cyclic-props)
          (ex-info {:type               qp.error-type/driver
                    :driver             driver
                    :cyclic-visible-ifs cyclic-props})
          throw)
      ```
      
      The string literal is threaded into the `trs` macro, so it validates
      correctly but we cannot identify the literal in tooling while making the
      pot file.
      
      Now output of bin/i18n/update-translation-template would be the
      following:
      
      ```shell
      ❯ ./update-translation-template
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.pprint.js as it exceeds the max of 500KB.
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs-runtime/cljs.core.js as it exceeds the max of 500KB.
      [BABEL] Note: The code generator has deoptimised the styling of /Users/dan/projects/work/metabase/frontend/src/cljs/cljs.core.js as it exceeds the max of 500KB.
      ~/projects/work/metabase/bin/i18n ~/projects/work/metabase
      Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/17.0.1-zulu/zulu-17.jdk/Contents/Home
      SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
      SLF4J: Defaulting to no-operation (NOP) logger implementation
      SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
      Created pot file at  ../../locales/metabase-backend.pot
      Found 1396 forms for translations
      Grouped into 1313 distinct pot entries
      Found 1 forms that could not be analyzed
      {:file "metabase/driver/util.clj", :line 362, :original (trs driver cyclic-props), :message nil}
      
      ❯ echo $?
      1
      ```
      
      and we have an exit code of 1 so that
      https://github.com/metabase/metabase/blob/master/.github/workflows/i18n.yml
      will fail in CI.
      47b7ac9e
    • Mahatthana (Kelvin) Nomsawadi's avatar
    • Ryan Laurie's avatar
      Allow Chevron click on select button (#23343) · e36de071
      Ryan Laurie authored
      * allow chevron click
      e36de071
    • Alexander Polyankin's avatar
      Simplify pinned questions (#23352) · cfbd4fe9
      Alexander Polyankin authored
      cfbd4fe9
    • Benoit Vinay's avatar
      Test to remove Parameter (#23297) · 01c72355
      Benoit Vinay authored
      01c72355
    • Howon Lee's avatar
      JSON query in postgres now walks identifier tree if one encountered (fixes #22967) (#23278) · 9e8cdef2
      Howon Lee authored
      Pursuant to #22967.
      
      Previously the notion of the identifier in json-query in postgres assumed a singular identifier at the top-level of the Identifier record. This is not always the case in complicated binning scenarios - the identifier could also just comprise an entire tree of Identifier record maps with the actual Identifier we're looking to turn into the JSON query in some leaf somewhere.
      
      Therefore, the json-query's determination of what the identifier is now walks that identifier record tree and replaces the identifiers that have JSON field semantics with the reification of ToSql from json-query.
      
      Previous attempt at solution hacked together something at the json-query level, changing the reification, but that only worked for one level down, instead of just walking the Identifier tree and therefore getting stuff at arbitrary tree depth. And we do get nontrivial tree depth in the bucketing in #22967.
      9e8cdef2
    • Benoit Vinay's avatar
      Convert Action to TypeScript (#23299) · 46eeb243
      Benoit Vinay authored
      * Convert Action to TypeScript
      
      * Delete possible unused ActionClick
      
      * Misc in Action
      
      * Misc
      
      * Delete Action files
      46eeb243
  2. Jun 15, 2022
  3. Jun 14, 2022
  4. Jun 13, 2022
    • Ryan Laurie's avatar
      Slider Component Performance Improvements (#23236) · 518e12a6
      Ryan Laurie authored
      * make slider change less
      518e12a6
    • Ryan Laurie's avatar
      unbounce the checkbox (#23321) · 06331872
      Ryan Laurie authored
      06331872
    • Dalton's avatar
      Remove redundant ParameterFieldWidget logic (#23271) · da7582a2
      Dalton authored
      * Remove popover logic from ParameterFieldWidget
      
      * Support formatting array values
      
      * Fix isValid logic
      
      * Readd close popover logic
      
      * Fix various bugs/broken tests
      
      Fix formatting/remapping
      
      Fix text
      
      Fix unit test
      
      Fix text
      
      Fix placeholder
      
      Fix placeholder
      
      Fix ellipses
      
      Fix bug caused by the any type
      
      Fix date parameter value formatting
      
      Readd dashboard prop
      
      Fix e2e test selector
      da7582a2
    • adam-james's avatar
      Allow 'null' First and Last names for Users (#23154) · 14312b9e
      adam-james authored
      
      * Migration to allow 'null' first and last names for users
      
      This is part of improving how we handle user names, related to SSO, but we also have an opportunity to make login via
      email simpler as well -> just loosen the requirement for names.
      
      * When only last name is given, :common_name should not have a space
      
      * WIP making optional first/last names safe in the backend.
      
      Trying to fix up some assumptions about first/last name keys in backend implementations.
      
      * Only add `:common_name` key when non-nil
      
      * Adjust setup tests to pass if use first/last name are nil
      
      * Fix up setup tests to work with null first/last names.
      
      * User API endpoints altered to handle nil names
      
      * Remove name validation test since they can be nil now
      
      * Alter JWT/SAML tests for nil user names
      
      * Remove "unknown" default in SAML
      
      * Add tests to make sure users are updating appropriately
      
      * use good naming convention in local function
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      
      * Simplify truthy check in test
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      
      * Simplify truthy check in test
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      
      * Indentation fix
      
      * Fix up syntax issue from github merge.
      
      * Fix missed function name changes in test
      
      * Clean up how sets are built up in the PUT user/:id endpoint
      
      * Better implementation for update-user-name
      
      * Avoid relying on 'vals' since order of keys is not guaranteed
      
      * Fixing little things, clarification in a comment
      
      * I'm tired... missed an obvious thing here. oops
      
      * indentation and clarify some testing
      
      * Change post-select implementation slightly
      
      * expected status is now an optional arg no dynamic var binding needed
      
      * 'f' is not optional, so we take it with first, then args are rest
      
      * simplify destructuring
      
      Co-authored-by: default avatarCam Saul <1455846+camsaul@users.noreply.github.com>
      14312b9e
Loading