Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Dec 07, 2023
    • Anton Kulyk's avatar
      9120c17c
    • shaun's avatar
      Fix settings jwt (#36189) · 83bf74cf
      shaun authored
      * fix types
      * swap unit test step order
      83bf74cf
    • Nicolò Pretto's avatar
      [Help link] feature branch (#36172) · f79a58ed
      Nicolò Pretto authored
      feat:: white labeling option for help link
      f79a58ed
    • Case Nelson's avatar
      [MLv2] drop-stage-if-empty (#36500) · 3281075f
      Case Nelson authored
      * [MLv2] drop-stage-if-empty
      
      * Addressing PR comments
      3281075f
    • Mark Bastian's avatar
      Apply column formatting to CSV exports (#36484) · 356c4986
      Mark Bastian authored
      * Apply column formatting to CSV exports
      
      This PR applies the same formatting logic to CSV exports as it does to pulse bodies (e.g. HTML).
      
      Formerly, there were two related formatting paths:
      - `metabase.query-processor.streaming.common/format-value`, which is from a protocol that takes an object and returns a string. It is what was used to export csv data. It applies no actual formatting, only converts objects to strings.
      - `metabase.pulse.render.body/get-format`, which builds a formatter from an optional time zone, column metadata, and visualization settings. This formatter takes a string and formats it. It was only used for rendering inline artifacts, such as embedded HTML in emails.
      
      The first function is insufficient to format row data as it is unaware of the column metadata and viz settings. We need to use that data everywhere data is exported in a uniform way.
      
      The solution is to lift `get-format` from `metabase.pulse.render.body` to a more common location (`metabase.pulse.render.common` in this PR step, but needs to be moved out of the pulse code to be a more shared concern) and use it everywhere artifacts are generated.
      
      For csv export, this was achieved as follows in `metabase.query-processor.streaming.csv`:
      
      ```clojure
      (defmethod qp.si/streaming-results-writer :csv
        [_ ^OutputStream os]
        (let [writer     (BufferedWriter. (OutputStreamWriter. os StandardCharsets/UTF_8))
              formatters (atom {})]
          (reify qp.si/StreamingResultsWriter
            (begin! [_ {{:keys [ordered-cols results_timezone]} :data} viz-settings]
              (swap! formatters (constantly (zipmap
                                              ordered-cols
                                              (map (fn [col]
                                                     (p.common/get-format results_timezone col viz-settings))
                                                   ordered-cols))))
              (csv/write-csv writer [(map (some-fn :display_name :name) ordered-cols)])
              (.flush writer))
      
            (write-row! [_ row _row-num cols {:keys [output-order]}]
              (let [[ordered-row
                     ordered-cols] (if output-order
                                     (let [row-v  (into [] row)
                                           cols-v (into [] cols)]
                                       [(for [i output-order] (row-v i))
                                        (for [i output-order] (cols-v i))])
                                     [row cols])]
                (csv/write-csv writer [(map (fn [c r]
                                              (let [formatter (@formatters c)]
                                                (formatter (common/format-value r))))
                                            ordered-cols ordered-row)])
                (.flush writer)))
      
            (finish! [_ _]
              ;; TODO -- not sure we need to flush both
              (.flush writer)
              (.flush os)
              (.close writer)))))
      ```
      
      The formatters for each column are build in the `begin!` function and then looked up in each `write-row!`.  The existing `format-value` is used to produce a string then passed into our looked up column formatter.
      
      Note that the new unit tests simulate a pulse and grab the provided temp files as attachments and analyzes those for correctness. This should work in a CI environment so long as the test process has permission to both write attachments to the temp directory and read those attachments back out. Also note that these tests can be slow (but not terribly so).
      
      Primary changes:
      - `metabase.email.messages` - fix spelling
      - `metabase.pulse.render.body` - move `get-format` out of this ns
      - `metabase.pulse.render.common` - move `get-format` into this ns
      - `metabase.query-processor.streaming.csv` - new logic to apply pulse renderer formatting to csv exports
      - `metabase.pulse.pulse-integration-test` - adding unit tests
      
      One TODO before a final commit of this PR is to move the `get-format` logic out of a pulse ns into something more general. Ultimately, it would be nice if this was a common capability used by both BE and FE.
      
      * Updated formatter state
      
      The rows in qp.si/StreamingResultsWriter are ordered, so there should be no need to do a lookup by col. We should just be able to map the ordered-formatters (using the same order as the cols) with the ordered row data.
      
      * Updating tests in `metabase.query-processor.streaming-test` to reflect new csv formatting.
      
      * Updated fomatter for tests and consistency
      
      This updates several tests (metabase.query-processor.streaming.csv-test) to reflect the new and correct behavior of using a common csv formatter as well as update the formatting code to correctly handle relational types and datetimes.
      
      * require fmt
      
      * Updating metabase.pulse.render.body-test to reflect `:type/DateTime` formatting.
      
      * Updating sqlite test
      
      * Updating report-timezone-test to reflect new CSV rendering
      
      * Fixing e2e test
      356c4986
    • Jerry Huang's avatar
    • Braden Shepherdson's avatar
      [MLv2] Unskip FE integration tests for automatic-insights drills (#36529) · 25ce6e4c
      Braden Shepherdson authored
      This was missed from #36443.
      
      Fixes #33558.
      25ce6e4c
    • metamben's avatar
      Enable converting simple value expressions from pMBQL to legacy (#36493) · e97a889f
      metamben authored
      Fixes #36459.
      
      Also makes sure that legacy to pMBQL works and that simple value expressions can be named.
      e97a889f
    • Anton Kulyk's avatar
      Fix dashboard filter width in edit mode (#36483) · 8b0fe5b6
      Anton Kulyk authored
      * Use `minWidth` instead of `width`
      
      * Reserve left padding for the settings icon
      8b0fe5b6
    • Gustavo Saiani's avatar
      Tweak code block in doc (#36501) · 79074fa7
      Gustavo Saiani authored
      79074fa7
    • Alexander Solovyov's avatar
  2. Dec 06, 2023
    • Noah Moss's avatar
    • Cam Saul's avatar
      Misc zoom-in-timeseries drill fixes (#36505) · b9f55626
      Cam Saul authored
      b9f55626
    • Braden Shepherdson's avatar
      [MLv2] Implement `automatic-insights` drill (#36443) · b95eb1a4
      Braden Shepherdson authored
      Automatic insights drills have some unusual conditions.
      This adds `metabase.lib.metadata/editable?` and checks it before
      returning any drills.
      
      On settings:
      In the app, `MetabaseSettings` is a global singleton and the settings
      are sometimes updated in place. In the JS testing environment several
      mock settings instances can exist at once, and the global singleton does
      not necessarily have the values we want for any given test.
      
      This PR makes `metabase.lib.metadata/setting` check for `describe` and
      `it` to see if we're in the testing environment, and to trust the
      metadata's `settings` in that case.
      b95eb1a4
    • Cam Saul's avatar
      e87c11e9
    • Cam Saul's avatar
    • Cam Saul's avatar
      Misc zoom-in-bins drill fixes (#36445) · 40b35743
      Cam Saul authored
      40b35743
    • Noah Moss's avatar
    • Cal Herries's avatar
      19e1f98d
    • Alexander Solovyov's avatar
    • Alexander Solovyov's avatar
      add Snyk workflow (#36349) · f2b7f78d
      Alexander Solovyov authored
      Resolves #35677
      f2b7f78d
    • Alexander Polyankin's avatar
      f8ec8b30
    • Kamil Mielnik's avatar
      Expressions in FilterPicker without legacy query (#36396) · 2dc72a8b
      Kamil Mielnik authored
      * Add expression-clause-for-legacy-expression
      
      Fixes #34830.
      
      * Add legacy-expression-for-expression-clause
      
      * Fix wrapper function name
      
      * Include ExpressionClause in Aggregatable type
      
      * Use Aggregatable type in aggregate function
      
      * Rename query to legacyQuery in Expressions (part 1)
      
      * Rename query to legacyQuery in Expressions (part 2)
      
      * Rename query to legacyQuery in Expressions (part 3)
      
      * Support MLv2 expressionClause in processSource and ExpressionWidget
      
      * Revert changes to ExpressionStep as it's out of scope of this task
      
      * Use new expressionClause in ExpressionWidget
      
      * Use onSelect instead of onSelectLegacy in handleExpressionChange
      
      * Remove onSelectLegacy from AggregationPicker
      
      * Use nullish coalescing operator
      
      * Assert new onChangeExpression argument in test
      
      * Assert new onChangeExpression argument in test
      
      * Update AggregationPicker tests
      
      * Replace toEqual + expect.objectContaining with toMatchObject
      
      * Add stageIndex to setup, use destructuring for onSelect arguments
      
      * Deal with awkward assertions
      
      * Use props in a conservative way
      
      * Replace legacyQuery.database() with query + metadata
      
      * Add a TODO comment
      
      * Add clause prop to AggregationPicker
      
      * Migrate clause name
      
      * Replace 3rd argument in onChangeExpression with onChangeExpressionClause
      
      * Use destructuring
      
      * Allow AggregationClause, drop expression from ExpressionEditorTextfield
      
      * Make withExpressionName work with AggregationClause
      
      * Rename expressionClause to clause
      
      * Update tests with new interface
      
      * Use overloading instead of generics
      
      * Add function body
      
      * Rename operator to clause
      
      * Revert "Use overloading instead of generics"
      
      This reverts commit 3953f85b8f63764cbb09825fa45f52d82efd7b71.
      
      * Fix tests failing due to useSelect usage in AggregationPicker
      
      * Omit aggregation options converting expressions to legacy
      
      Fixes #36120.
      
      * Remove temporary hack
      
      * Get rid of props spread
      
      * Migrate isExpressionEditorInitiallyOpen to MLv2
      
      * Omit aggregation options converting expressions to legacy
      
      Fixes #36120.
      
      * Normalize legacy expressions as MBQL expressions
      
      * Fix isExpressionEditorInitiallyOpen
      
      * Update expressionName signature
      
      * Pass props in ExpressionStep tests in a usual way
      
      * Drop a conditional statement
      
      * Bring back expression prop for backwards-compatibility
      
      * Update ExpressionWidget validation & tests
      
      * Bring back using expression in componentWillReceiveProps
      
      * Bring back removed assertion
      
      * Remove legacyQuery prop from AggregationPicker
      
      * Add a test case for isExpressionEditorInitiallyOpen (which uses Lib.expressionName)
      
      * Fix legacyQuery creation
      
      * Add assertion for expression name
      
      * Fix committing expression with done button
      
      * Improve assertions in tests
      
      * Make with-expression-name set the display-name of the clause
      
      Fixes #36167.
      
      This is needed to be able to set/change the display name of custom aggregation columns too.
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Unskip an e2e test
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Use displayInfo instead of displayName
      - see https://github.com/metabase/metabase/pull/36203#discussion_r1410496658
      
      * Deprecate displayName in favor of displayInfo
      - see https://metaboat.slack.com/archives/C0645JP1W81/p1701341786914219?thread_ts=1701335646.088359&cid=C0645JP1W81
      
      * Use clearer notation
      
      * Format code
      
      * Use displayInfo instead of expressionName in tests
      
      * Add isNamed attribute to ColumnDisplayInfo and ClauseDisplayInfo
      
      * Use displayInfo instead of expressionName in AggregationPicker
      
      * Drop expressionName
      
      * Drop redundant cast
      
      * Simplify isExpressionEditorInitiallyOpen interface
      
      * Use display-info with :named? instead of expression-name
      
      * Improve comment
      
      * Add :named? to the schema of display-info
      
      * Use conditional types for ExpressionWidget prop
      
      * Use getNotebookStep
      
      * Simplify condition
      
      * Simplify assertions
      
      * Use .lastCall
      
      * Remove isNamed attribute from ColumnDisplayInfo
      
      * Use .lastCall
      
      * Fix typing
      
      * Bring back legacyQuery prop to AggregationPicker
      
      * Fix isExpressionEditorInitiallyOpen for new clauses
      
      * Fix unit tests
      
      * Remove wrong assertion
      
      * Fix assertion
      
      * Trigger a change
      
      * Revert "Trigger a change"
      
      This reverts commit 254913dd85d7aa1059ca712e19e4e9f1e901dc8e.
      
      * Fix assertion
      
      * Allow FilterClause
      
      * Drop legacyFilter usage from FilterPicker, FilterStep & QuestionFilters
      
      * Update FilterPicker unit tests
      
      * Remove unused function
      
      * Fix types in unit test
      
      * Remove redundant waitFor
      
      * Update ColumnDisplayInfo type
      
      * Revert changes to ColumnDisplayInfo, avoid using semanticType & effectiveType attributes
      
      * Introduce NamedClause and CustomExpressionClause types
      
      * Simplify assertions
      
      * Remove casting from FilterPicker
      
      * Rename NamedClause to CustomNameClause
      
      * Exclude AggregationClause from FilterPicker's interfaces
      
      * Avoid casting using generics
      2dc72a8b
    • Denis Berezin's avatar
      Set embedding visual settings before initial render (#36095) · 2ffee750
      Denis Berezin authored
      * Move embedding settings prep before rendering
      
      * Revert not needed change
      
      * Add dynamic embedding settings for preview mode, add e2e tests for embedding settings
      
      * Refactor test, remove not needed code
      
      * Updates for e2e test based on code review
      2ffee750
    • Levente Kurusa's avatar
      team: add levex to BEC (#36434) · 18742132
      Levente Kurusa authored
      18742132
    • Mahatthana (Kelvin) Nomsawadi's avatar
      Fix click behavior link to dashboards/questions not using client router (#35975) · d4f85c24
      Mahatthana (Kelvin) Nomsawadi authored
      * Fix click behavior link to dashboards/questions not using client router
      
      * Make the code cleaner
      
      * Fix unit tests
      
      * Make API clearer
      
      * Address review: Handle case insensitive subpath
      
      * Add E2E tests
      
      * Fix failed E2E tests
      
      * Fix another fail E2E test
      
      * Add a test to ensure invalid URL won't break navigation
      
      * Add tests + ensure multiple level subpath works
      d4f85c24
  3. Dec 05, 2023
    • Cam Saul's avatar
    • Cam Saul's avatar
    • Alexander Polyankin's avatar
      562b0948
    • Mark Bastian's avatar
      Updating default `number-formatter` for percents (#36431) · 0521497a
      Mark Bastian authored
      * Updating default `number-formatter` for percents
      
      The number formatter used in some static viz rendering (e.g. tables) in `metabase.pulse.render.common/number-formatter` had logic to render only integer-valued percents for values between 1 and 100 and render two significant digits otherwise.
      
      The FE default formatter uses 2 significant digits consistently in `frontend/src/metabase/lib/formatting/numbers.tsx`:
      
      ```js
      const PRECISION_NUMBER_FORMATTER = d3.format(".2f");
      ```
      
      This change modifies `number-formatter` to consistenly use 2 significant digits for percentage types.
      
      Note that this does NOT apply to fields with custom formatting. Presently, custom column formatting does not appear to be applied for HTML tables at all for BE rendering while it is applied on the FE. This is a separate issue. This PR just brings the baseline behaviors based on typing into alignment.
      
      * Fixing formatting test
      0521497a
    • Jeff Bruemmer's avatar
      docs - hide when empty (#36427) · 19f8bc1d
      Jeff Bruemmer authored
      19f8bc1d
    • Nick Fitzpatrick's avatar
      Adding markdown support to search result descriptions (#36360) · 37d70168
      Nick Fitzpatrick authored
      * Adding markdown support to search result descriptions
      
      * adding e2e test
      37d70168
    • Jerry Huang's avatar
    • Braden Shepherdson's avatar
      [MLv2] Underlying records: show drills on clicks with no `:column` (#36319) · a0c3e90a
      Braden Shepherdson authored
      That fixes "chart legend" clicks and "pivot cell" clicks, which should
      show underlying records and automatic insights drills.
      
      Fixes #35343 and #35394.
      a0c3e90a
    • Nick Fitzpatrick's avatar
      Adding pagination to All Personal Collections page (#36255) · e1c4687d
      Nick Fitzpatrick authored
      * Adding pagination to All Personal Collections page
      
      * adding unit test
      
      * test adjustments
      e1c4687d
    • Oleg Gromov's avatar
      Fix card filter connected to a field not causing an update (#36206) · 2af32bbc
      Oleg Gromov authored
      * Rename DashboardHeaderView to match filename
      * Fix non updating cards on filter mapping to a field
      * Clean up DashboardApp tests a bit
      * Clean up Dashboard.jsx cruft
      * Add Dashboard componentDidUpdate "unit tests"
      * Simplify setup code as per feedback
      * Add test for changing dashboard prop in componentDidMount
      * Change constant names
      * Fix optional chaining in Dashboard
      2af32bbc
    • Ryan Laurie's avatar
      2aae0cdf
    • Luis Paolini's avatar
      Add Metabase version argument to Dockerfile (#36402) · 35892086
      Luis Paolini authored
      * Add version to Dockerfile
      
      When you want to build with a specific version, you need to pass it on the build args
      
      * Update Dockerfile
      35892086
    • Kamil Mielnik's avatar
      Expressions in AggregationPicker without legacy query (#36031) · 6e8e6f07
      Kamil Mielnik authored
      * Add expression-clause-for-legacy-expression
      
      Fixes #34830.
      
      * Add legacy-expression-for-expression-clause
      
      * Fix wrapper function name
      
      * Include ExpressionClause in Aggregatable type
      
      * Use Aggregatable type in aggregate function
      
      * Rename query to legacyQuery in Expressions (part 1)
      
      * Rename query to legacyQuery in Expressions (part 2)
      
      * Rename query to legacyQuery in Expressions (part 3)
      
      * Support MLv2 expressionClause in processSource and ExpressionWidget
      
      * Revert changes to ExpressionStep as it's out of scope of this task
      
      * Use new expressionClause in ExpressionWidget
      
      * Use onSelect instead of onSelectLegacy in handleExpressionChange
      
      * Remove onSelectLegacy from AggregationPicker
      
      * Use nullish coalescing operator
      
      * Assert new onChangeExpression argument in test
      
      * Assert new onChangeExpression argument in test
      
      * Update AggregationPicker tests
      
      * Replace toEqual + expect.objectContaining with toMatchObject
      
      * Add stageIndex to setup, use destructuring for onSelect arguments
      
      * Deal with awkward assertions
      
      * Use props in a conservative way
      
      * Replace legacyQuery.database() with query + metadata
      
      * Add a TODO comment
      
      * Add clause prop to AggregationPicker
      
      * Migrate clause name
      
      * Replace 3rd argument in onChangeExpression with onChangeExpressionClause
      
      * Use destructuring
      
      * Allow AggregationClause, drop expression from ExpressionEditorTextfield
      
      * Make withExpressionName work with AggregationClause
      
      * Rename expressionClause to clause
      
      * Update tests with new interface
      
      * Use overloading instead of generics
      
      * Add function body
      
      * Rename operator to clause
      
      * Revert "Use overloading instead of generics"
      
      This reverts commit 3953f85b8f63764cbb09825fa45f52d82efd7b71.
      
      * Fix tests failing due to useSelect usage in AggregationPicker
      
      * Omit aggregation options converting expressions to legacy
      
      Fixes #36120.
      
      * Remove temporary hack
      
      * Get rid of props spread
      
      * Migrate isExpressionEditorInitiallyOpen to MLv2
      
      * Omit aggregation options converting expressions to legacy
      
      Fixes #36120.
      
      * Normalize legacy expressions as MBQL expressions
      
      * Fix isExpressionEditorInitiallyOpen
      
      * Update expressionName signature
      
      * Pass props in ExpressionStep tests in a usual way
      
      * Drop a conditional statement
      
      * Bring back expression prop for backwards-compatibility
      
      * Update ExpressionWidget validation & tests
      
      * Bring back using expression in componentWillReceiveProps
      
      * Bring back removed assertion
      
      * Remove legacyQuery prop from AggregationPicker
      
      * Add a test case for isExpressionEditorInitiallyOpen (which uses Lib.expressionName)
      
      * Fix legacyQuery creation
      
      * Add assertion for expression name
      
      * Fix committing expression with done button
      
      * Improve assertions in tests
      
      * Make with-expression-name set the display-name of the clause
      
      Fixes #36167.
      
      This is needed to be able to set/change the display name of custom aggregation columns too.
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Unskip an e2e test
      
      * Add expression name assertion
      
      * Add expression name assertion
      
      * Use displayInfo instead of displayName
      - see https://github.com/metabase/metabase/pull/36203#discussion_r1410496658
      
      * Deprecate displayName in favor of displayInfo
      - see https://metaboat.slack.com/archives/C0645JP1W81/p1701341786914219?thread_ts=1701335646.088359&cid=C0645JP1W81
      
      
      
      * Use clearer notation
      
      * Format code
      
      * Use displayInfo instead of expressionName in tests
      
      * Add isNamed attribute to ColumnDisplayInfo and ClauseDisplayInfo
      
      * Use displayInfo instead of expressionName in AggregationPicker
      
      * Drop expressionName
      
      * Drop redundant cast
      
      * Simplify isExpressionEditorInitiallyOpen interface
      
      * Use display-info with :named? instead of expression-name
      
      * Improve comment
      
      * Add :named? to the schema of display-info
      
      * Use conditional types for ExpressionWidget prop
      
      * Use getNotebookStep
      
      * Simplify condition
      
      * Simplify assertions
      
      * Use .lastCall
      
      * Remove isNamed attribute from ColumnDisplayInfo
      
      * Use .lastCall
      
      * Fix typing
      
      * Bring back legacyQuery prop to AggregationPicker
      
      * Fix isExpressionEditorInitiallyOpen for new clauses
      
      * Fix unit tests
      
      * Remove wrong assertion
      
      * Fix assertion
      
      * Trigger a change
      
      * Revert "Trigger a change"
      
      This reverts commit 254913dd85d7aa1059ca712e19e4e9f1e901dc8e.
      
      * Fix assertion
      
      ---------
      
      Co-authored-by: default avatarTamás Benkő <tamas@metabase.com>
      6e8e6f07
    • Cam Saul's avatar
Loading