Compare commits

...

1530 Commits

Author SHA1 Message Date
jeff bruemmer
675a47d314 updated docs 2025-01-03 16:31:46 -05:00
jeff bruemmer
878a84389f add note about live api docs 2025-01-03 16:30:37 -05:00
Jeff Bruemmer
d053b2fe80 docs - separate google sign-in and ldap docs (#51746)
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2025-01-03 15:10:15 -05:00
Ryan Laurie
ae97cbde23 Enable N-parallelism for e2e tests (#51433) 2025-01-03 08:23:13 -07:00
Jeff Bruemmer
4eeccde961 Add link to support matrix (#51737) 2025-01-03 10:05:35 -05:00
Roman Abdulmanov
322b8958c8 Update urls (#51732) 2025-01-03 11:51:53 +00:00
Mahatthana (Kelvin) Nomsawadi
2ed72d106b Fix static embedding missing dark theme on some date widgets (#51661)
* Fix date widgets dark theme

* Update more outdated loki snapshots

* Add a story to theme date filters missing dark theme

* Theme relative current widget and co.

* Theme date exclude widget

* Theme relative date interval widget and co.

* Update more snapshots from border color change

* Fix comment on the wrong line

* Fix light theme story switching + mock relative date stories

* Review: Remove unused function arg

* Update snapshots that change once a year 🤦
2025-01-03 09:13:57 +00:00
Ryan Laurie
fe13ca6859 Happy new year e2e test fixes (#51720) 2025-01-02 14:31:29 -07:00
Uladzimir Havenchyk
5c011ed5ec chore: drop a duplicated test (#51653)
* chore: drop a duplicated test

* cleanup naming
2025-01-02 14:05:06 -07:00
Bruno Bergher
4bc96006af Workflow: Slack Notification for New Feature Requests (#51709)
Tells the PMs when new feature requests come in.
2025-01-02 16:41:59 +00:00
Braden Shepherdson
73fe6a603c [refs] Ensure all column-creating clauses have idents on read (#50100)
That is: aggregations, breakouts, expressions and joins.

Nothing is consuming these yet, but the BE populates them when reading cards.

MBQL changes
=============

These new `:ident`s have been present for new clauses for a few weeks, but now they'll be generated for existing queries on read.

The new idents are stable, including across serialization. They aren't written back until the card is saved again.

Backfilling
===========

Here's the constraints for generating idents for pre-existing clauses:

- If the same query exists across serdes instances, produce the same ident
- Globally unique, even if:
    - two cards have identical queries
    - two stages of the same card have identical `:count` aggregations.
    - a single stage has multiple aggregations of the same type
    - a single stage has duplicate breakouts with different time granularity
- Never change, even if the query does
    - mbql-lib assumes these are (in theory) randomly generated, and never examines or updates them.
    - If new clauses are added, they get random idents.
    - If clauses are removed, that's no problem.
    - If clauses are edited (eg. changing an expression name) then the BE *would* generate a new ident!
        - But when the card gets saved, the original ident with the original expression name is enshrined forever as the ident - it just needs to be unique!

The backfilled idents have this form:

```clojure
"${kind}_${entity_id of the card}@${stage-number}__${name or index}"
;; eg. 
"aggregation_ThisIsAValidNanoIdxxx@0__1"
"breakout_ThisIsAValidNanoIdxxx@1__1"
"expression_ThisIsAValidNanoIdxxx@0__exprname"
"join_ThisIsAValidNanoIdxxx@1__alias"
```
2024-12-31 16:47:03 +00:00
Ryan Laurie
e9d13a38c1 split up query stage e2e test file (#51583)
* split up query stage tests

# Conflicts:
#	e2e/test/scenarios/dashboard-filters-2/dashboard-filters-query-stages.cy.spec.ts

* update for merge to master

* fix
2024-12-31 09:34:09 -07:00
Alex Yarosh
dea02a4d22 Docs: bell icon - master version (#51696)
* alerts

* bell
2024-12-31 11:26:32 -05:00
Ngoc Khuat
84dc6f75ee toucan2 consistent model alias (#51660) 2024-12-31 05:35:35 +00:00
lbrdnk
8985d95122 Add test for external contribution (#51693) 2024-12-30 22:11:44 +03:00
Alexander Viala Bellander
263256f7ab Add M2M Oauth to Databricks Driver (#51476)
* Add M2M Oauth to Databricks Driver

* Add toggle for PAT/M2M Oauth

Introduces a 'Use Personal Access Token' toggle button which shows different UI components when setting up the connection. The implementation was inspired by @snoe in #51249

* Address feedback from @ibrdnk

Addresses the feedback related to #pullrequestreview-2515818008

* Default M2M, Add conditional Merge, Reduce whitespace

* Update docs/databases/connections/databricks.md

Co-authored-by: Jeff Bruemmer <jeffbruemmer@gmail.com>
2024-12-30 16:05:41 +01:00
Uladzimir Havenchyk
be4a57cf78 feat(QB): update view sql/hide sql button style (#51651)
* chore(QB): update view sql/hide sql button style

* update e2e tests
2024-12-28 12:37:44 +00:00
Noah Moss
68101f50f2 Ensure collections' effective_location is batch hydrated when hydrating effective_parent (#51673) 2024-12-27 15:08:34 +00:00
Oleksandr Yakushev
393308bc5c perf: Make registered? and initialized? checks faster for already initialized drivers (#51023) 2024-12-26 14:47:00 +00:00
Nemanja Glumac
4b64ef287b Remove the unused and deprecated fetch-mock-jest (#51663) 2024-12-26 14:43:52 +03:00
Alexander Polyankin
eb596a48f0 Use MonthPicker from mantine for dashboard parameters to enable selection of months in the future (#51645) 2024-12-24 16:49:15 -05:00
Oisin Coveney
0502dd8a8e Fix ChartSettingsPopover style/z-index issues (#51154) 2024-12-23 19:02:24 -08:00
Alexander Polyankin
670ee25906 Replace old DatePicker in dashboard & search parameters (#51596) 2024-12-23 22:09:21 +00:00
metamben
7dfe9d4cc4 Fix typo (#51638) 2024-12-23 21:38:21 +00:00
Aleksandr Lesnenko
5444d94a13 Fix glitching series on hover in Safari (#51611)
* nasty hack but works

* apply to safari only

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-12-23 15:32:44 -05:00
Aleksandr Lesnenko
97a47fe9db allow parametrized link cards (#51428) 2024-12-23 20:05:13 +00:00
Jeff Bruemmer
189703e895 docs - env vars in config files (#51642) 2024-12-23 14:14:18 -05:00
Oisin Coveney
c170d97352 Convert ChartsettingOrderedItems to match ChartSettingSelect (#51332) 2024-12-23 10:17:07 -08:00
Phoomparin Mano
1a8e6132b2 feat(sdk): make editable dashboard grid border color themeable (#51060) 2024-12-24 00:08:12 +07:00
Phoomparin Mano
4a9e296160 docs(sdk): fix initial parameter props name in dashboards (#51625) 2024-12-24 00:04:51 +07:00
Jeff Bruemmer
6ee87dcc9b docs - question in dashboards (#51366) 2024-12-23 10:45:13 -05:00
Romeo Van Snick
b7950cd10e Partial rollback of FieldValuesWidget to v50 (#51183)
* Reset FieldValuesWidget to v50 state

* Revert some changes in SingleSelectListField to v50

* Make onSearchChange optional

* Use RowValue instead of string

* Add test-ids to FieldValuesWidget inputs

* Add testing matrix for all parameter combinations

* Add filter matrix test to github workflow

* Fix unit test

* Render custom option value when it exists

* Fix e2e test

* Fix remove value helper

* Fix e2e test

* Render custom label on TokenField

* Update Loki Snapshots

* Use css colors for TokenFieldItem

* Make TokenField dark-mode aware

* Make TokenFieldItem dark-mode aware

* Update Loki Snapshots

* Fix e2e test after merge

* Add listbox role to tokenfield values

* Fix more e2e tests

* Fix e2e test for listbox

* Remove commented out code

* Fix e2e test

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-12-24 02:30:13 +11:00
Uladzimir Havenchyk
21e2b99ec6 chore: drop unused emotion components (#51598)
* chore: drop unused emotion components

* more cleanup
2024-12-23 13:59:31 +03:00
Uladzimir Havenchyk
72b3cc3f48 chore: remove not used index files (#51591)
* chore: remove unused files

* more files to drop

* fixup

* more files

* chore: remove not used index files
2024-12-23 13:59:19 +03:00
lbrdnk
aab7f5baee Fix method definitions (#51473) 2024-12-23 10:55:50 +01:00
Phoomparin Mano
0361bdd557 bump master to 53-nightly (#51575) 2024-12-23 05:57:35 +00:00
Alexander Solovyov
7c276e3bbf [serdes] extract tabId in click_behavior (#51588)
also, somewhat relatedly, create `elide-fk` function to skip pieces of data holding FKs to deleted targets
2024-12-21 10:07:23 +00:00
appleby
0b44617a5d Fix summarize-column and summarize-column-by-time drills for multi-stage queries (#51553)
* Fix summarize-column drill for multi-stage queries

* Fix the summarize-column-by-time drill for multi-stage queries
2024-12-20 17:19:01 -08:00
John Swanson
7ff5975436 Simple API for storing KV pairs per-user (#48376)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
2024-12-20 18:48:40 -05:00
Uladzimir Havenchyk
bcac621fa8 chore: replace global icon selector with local (#51566) 2024-12-21 01:12:17 +03:00
Noah Moss
bea199498e Batch query_execution, audit_log and view_log truncations (#51490) 2024-12-20 16:57:30 -05:00
Uladzimir Havenchyk
5583a5c29a chore: remove unused files (#51574) 2024-12-21 00:09:14 +03:00
Jeff Bruemmer
96b843e41c remove changelog toggle in release notes (#51479) 2024-12-20 15:35:45 -05:00
Oleksandr Yakushev
8b8147a807 ci: Fix be-tests stub (#51545) 2024-12-20 20:19:55 +00:00
lbrdnk
79b33141f7 Add debug logging for chain filter query (#51481)
* Add debug logging for chain filter query

* Comment
2024-12-20 20:51:25 +01:00
lbrdnk
28a1629790 Add description to metric API responses (#51448)
* Generate suggested_name on card read

* Add test

* Comment

* Naming and comment

* Use m/assoc-some
2024-12-20 20:51:14 +01:00
Sloan Sparger
f42b605299 [Cmd Palette] Do not show admin and settings links to users who do not have access (#50887)
* fixes showing admin links to not admins in the command palette

* updates calculation to take into account EE advanced permissions allowing certain users permissions to change settings who are not admins

* admin routes for non-admins

* fix unit tests

* actually fix unit tests

* adding checks for other permissions

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-12-20 15:45:40 -04:00
Alexander Polyankin
c2de5b5e5f Date picker cleanup for parameter changes (#51587)
* Remove canUseRelativeOffsets

* Remove canUseRelativeOffsets

* Types

* Types
2024-12-20 18:45:30 +00:00
Oleksandr Yakushev
6a3aa35832 Minor refactoring of cancellation-related code (#49815) 2024-12-20 19:22:54 +02:00
Oleksandr Yakushev
48ae90a5b1 ci: Only run driver tests when testing Databricks driver (#51543) 2024-12-20 18:23:09 +02:00
William
ff06e1b900 Pass uuids as strings to SQL Server (#51484)
Azure Synapse doesn't like it when you give it a uuid parameter, even though synapse does support uuids in general.
Converting those uuids to strings beforehand fixes this error, and regular SQL Server is also fine with that.
2024-12-20 09:48:55 -06:00
Nick Fitzpatrick
53af5593bd Adjust initialDashboardId calculation (#51291)
* adjust initialDashboardId calculation

* e2e adjustments

* unit test adjustment

* PR Feedback
2024-12-20 11:45:43 -04:00
Sloan Sparger
be1eac5e39 [Cards in Dashboards] Prevent dashboard from appearing in breadcrumbs when not on a DQ page (#51554)
* prevent dashboard from appearing in breadcrumbs when not on a DQ page

* updating unit test with location

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-12-20 11:43:22 -04:00
Aleksandr Lesnenko
718f667515 fix broken radio buttons in viz settings (#51558) 2024-12-20 15:42:47 +00:00
Noah Moss
4452359c58 Update migration to allow query_execution.parameterized to be null (#51549) 2024-12-20 10:41:22 -05:00
Raphael Krut-Landau
428b0c9f86 Show errors from backend in Create API key modal (#51395) 2024-12-20 15:36:54 +00:00
Nicolò Pretto
91ddc60070 add tests for support of xx-YY locales in embed/public-links (#51456)
* fix: add supports for xx-YY locales in embed/public-links

* Generate locales.json

* [WIP] Read locales.json

* wip FE implementation

* refactor + unit and sdk component tests

* fixes after the merge, plus tests and cleand up logic

* fix file name in string

* change FE logic to use locales from the instance settings

* revert json generation

* remove leftover comment

* add comment about the code to keep in sync

* migrate e2e tests for static/public to use #locale=de-CH so we test that
it's using the fallback logic

* fix kondo error
Co-authored-by: dpsutton <dan@dpsutton.com>

* fix unit test

* fix more jest tests

* cy.request -> cy.intercept

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-12-20 16:26:28 +01:00
Nicolò Pretto
bda324e42b fix(sdk): add supports for xx-YY locales in embed/public-links and sdk (#51002)
* fix: add supports for xx-YY locales in embed/public-links

* Generate locales.json

* [WIP] Read locales.json

* wip FE implementation

* refactor + unit and sdk component tests

* fixes after the merge, plus tests and cleand up logic

* fix file name in string

* change FE logic to use locales from the instance settings

* revert json generation

* remove leftover comment

* add comment about the code to keep in sync

* fix kondo error
Co-authored-by: dpsutton <dan@dpsutton.com>

* fix unit test

* fix more jest tests

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-12-20 15:11:08 +01:00
Alexander Solovyov
6fb5fdc8f4 [openapi] reduce amount of oneOf/allOf we generate in documentation (#51495) 2024-12-20 13:13:22 +00:00
Phoomparin Mano
53dee386d3 ci(sdk): make 52 the latest in release workflow (#51552) 2024-12-20 19:07:53 +07:00
Uladzimir Havenchyk
d4db9cd0e8 fix: show chevron icon in the bucket picker on hover (#51542)
* chore: rework pickers in querying folder to css modules

* more css

* more css

* more css

* fix typecheck

* fix ui

* fix ui

* drop unused code

* fix ui

* fix css

* fix unit test

* revert color changes

* fix join color

* fix showing chevron icon in the bucket picker

* address review

* oops
2024-12-20 14:54:56 +03:00
Phoomparin Mano
ec0ac2bf7a Fix non-legible text and icon colors in fullscreen dark mode (#51538) 2024-12-20 18:05:44 +07:00
Oleksandr Yakushev
963d308568 Bump Toucan2 version (#51547) 2024-12-20 00:35:52 +02:00
Aleksandr Lesnenko
f99b8baa5f show all columns in scatter tooltip by default (#51480)
* show all columns in scatter tooltip by default

* update e2e spec
2024-12-19 20:59:14 +00:00
Uladzimir Havenchyk
522910ec6b chore: rework querying steps to css modules (#51430)
* chore: rework pickers in querying folder to css modules

* more css

* more css

* more css

* fix typecheck

* fix ui

* fix ui

* drop unused code

* fix ui

* fix css

* fix unit test

* revert color changes

* fix join color
2024-12-19 23:25:07 +03:00
Noah Moss
bc4e2da39b Fix instance stats cypress test + ensure it runs in CI (#51531) 2024-12-19 15:19:52 -05:00
Aleksandr Lesnenko
9f01f0efa4 Fix pdf exports issues (#51491)
* fix horizontally trimmed content on short pages

* include filters

* update specs
2024-12-19 15:17:25 -05:00
Sloan Sparger
f29b68770f [Cards in Dashboards] Edit dashboard save changes modal adjustments (#51345)
* make making the change easy

* make easy change

* clean up

* pr feedback

* pr feedback
2024-12-19 14:05:27 -06:00
Sloan Sparger
f147c3710b [Clean-up] Allow collection clean up banner to be dismissible (#51434)
* allow collection clean up banner to be dismissable

* small change

* dismiss the banner if the user uses the clean up modal

* add test coverage
2024-12-19 14:03:04 -06:00
Aleksandr Lesnenko
a8634811a0 support parametrized iframe urls (#51374)
* support parametrized iframe urls

* spec

* copy fix
2024-12-19 14:27:42 -05:00
Nemanja Glumac
482f6bbff4 Try a band-aid fix for native editor e2e flakes (#51528) 2024-12-19 18:49:17 +00:00
Oisin Coveney
ec4192eb9d Convert ChartSettingSelect to Mantine (#50977) 2024-12-19 18:14:58 +00:00
Aleksandr Lesnenko
41bac38d80 quarantine flakes caused by problems with typing in the native editor (#51520) 2024-12-19 17:48:35 +00:00
Oleksandr Yakushev
cfe322223b perf: Add fastpaths to url? and email? predicates (#51522) 2024-12-19 19:24:55 +02:00
Alexander Polyankin
f314f6d56a Add more binning options for coordinates (#51472) 2024-12-19 17:16:52 +00:00
Abed Habli
4304b96ce2 docs: Updating "Export dashboard as PDF" (#51506)
* Updating "Export dashboard as PDF"

* Typo

* updating the screenshot
2024-12-19 18:15:24 +01:00
Sloan Sparger
56357db89f [Cards in Dashboards] Update in-dashboard question creation flow (#51246)
* revert previous solution and move code into question question picker

* convert QuestionPicker to typescript

* port to css module

* refine button styles

* fix some e2e

* fix last failing e2e

* fe implementation for sessions

* fix styles if only one button is showing

* user css va for border colors

* fix failing unit tests and move new unit tests into existing file i had not noticed

* fix lint
2024-12-19 10:02:28 -06:00
Ryan Laurie
b04cfa86a6 quarantine flaky native tests (#51510) 2024-12-19 14:51:16 +00:00
Nicolò Pretto
7a4d682dde fix(types): fix type error on textCard in static-dashboard.cy.spec.tsx (#51450) 2024-12-19 13:34:01 +01:00
Nicolò Pretto
83cbbd7e45 add sdk theme selector to storybook + split the storybook sdk config into its own folder (#51122)
* add sdk theme selector to storybook

* let's try to split the storybook
2024-12-19 13:29:57 +01:00
John Swanson
4e451b4692 fix error copy when trying to move card->dash (#51233) 2024-12-19 04:12:43 -08:00
Uladzimir Havenchyk
71735c6722 chore: rework pickers in querying folder to css modules (#51427)
* chore: rework pickers in querying folder to css modules

* more css

* fix ui

* fix ui

* drop unused code
2024-12-19 06:03:17 +00:00
Noah Moss
dd021f0862 Preemptive caching backend (#50816) 2024-12-18 20:04:54 -05:00
bryan
6c933f2d91 Don't crash for ignored status codes in embedding responses (#51408)
* short circuit tracking for ignored requests

- add fall-through for ignored embedding requests

* add test for ignored status codes

* remove cruft

* add logging for unknown clients or statuses

* Fix some e2e tests in custom-column and view-data (#51431)

* warn on reflection!

---------

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-18 22:23:56 +00:00
appleby
4cfbd67ce2 Revert to using secrets.GITHUB_TOKEN for the auto-approve PR step (#51413)
Using secrets.METABASE_AUTOMATION_USER_TOKEN causes the auto-approve PR step to fail with an error like

  Can not approve your own pull request

Revert to using secrets.GITHUB_TOKEN instead, which matches what the auto-backport.yml workflow does and what this
workflow did previously.
2024-12-18 10:51:38 -08:00
Alexander Polyankin
f024e79c85 Add field values e2e test (#51424) 2024-12-18 17:10:48 +00:00
Aleksandr Lesnenko
6d4b695b5f add percentages to sankey tooltip (#51193)
* add percentages to sankey tooltip

* another tooltip variant

* specs

* lint
2024-12-18 16:47:11 +00:00
Raphael Krut-Landau
500b0e6d06 Fix some e2e tests in custom-column and view-data (#51431) 2024-12-18 09:52:02 -05:00
Alexander Solovyov
8f49ab0dd0 [serdes] make logs and errors a bit more consistent (#51390) 2024-12-18 14:12:01 +00:00
Oleksandr Yakushev
aa8a386e34 ci: trim stacktrace of intentional exceptions thrown during testing (#51443) 2024-12-18 16:31:45 +03:00
Phoomparin Mano
00a087bb52 fix(sdk): update define function names in Next.js compat (#51071) 2024-12-18 20:21:44 +07:00
Abed Habli
41e4defd29 Typo (#51440) 2024-12-18 13:37:15 +01:00
Oisin Coveney
bb32a4111b Convert ChartSettingInputNumeric to Mantine (#51165) 2024-12-18 11:51:45 +00:00
Kamil Mielnik
94372d6fa6 Implement new EntityListLoader that uses RTK Query hooks (#51341)
* Add EntityListLoaderRtkQuery boilerplate

* Add loaded prop

* Add metadata prop to children

* Improve typing for entity selectors

* Add missing selector typing

* Adjust list loader

* Drop dispatchApiErrorEvent, entityAlias

* Add listName prop

* Conditionally use entityListLoaderRtkQuery

* Add transformResponse

* Enable new loader for database entity

* Update typing

* Add todo

* Remove actionCreators

* Update TODO

* Use loadListLegacy

* Fix condition

* Add dynamic reload* prop to children

* Handle onLoaded prop

* Reproduce isReloading behavior with isLoading

* Add support for reloadInterval prop

* Fix list state path when query is empty

* Migrate sample database endpoint

* Update type

* Simplify transformResponse

* Use modern syntax

* Type the wrapper

* Name the wrapper components

* Improve typing
2024-12-18 17:44:06 +07:00
Uladzimir Havenchyk
c29f2e382d chore: rework mix components to css modules (#51220)
* chore: rework mix components to css modules

* more css

* more css

* more css

* more css

* rework last pieces of emotion to css modules

* remove failing test

* address review

* fix view button styling

* fix view button styling

* drop not needed change
2024-12-18 09:26:09 +00:00
Uladzimir Havenchyk
084384db11 tests(jest): add ES module is-absolute-url to the transform ignore (#51438) 2024-12-18 11:49:30 +03:00
Jeff Bruemmer
e1a1e73128 lychee to lint doc links (#51422)
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-12-17 16:49:20 -05:00
Nick Fitzpatrick
a59eba3e63 Entity picker search dashboard questions (#51367)
* scoping search to dashboard questions, adding dashboard questions to everywhere search results in entity picker

* e2e tests
2024-12-17 17:36:24 -04:00
Jeff Bruemmer
685c36f599 docs - remove release page (#51410)
* remove release page

* links

* remove workflow
2024-12-17 13:51:54 -05:00
Raphael Krut-Landau
3d01b319e5 Test that we can go back from the notebook editor (#50972)
This PR builds on #50420 by adding an e2e test that the user can press the back button to return from the notebook editor to the homepage. Previously this was impossible due to a pop-under bug (#50971).
2024-12-17 13:21:49 -05:00
Raphael Krut-Landau
93a703a911 fix(sdk): Control stacking without distinct z-indexes (#49442)
This PR introduces a simple way of avoiding pop-under bugs:
* First, we **give all overlays the same z-index.** It's 200, above everything else. SDK users can change this value.
* Second, we **prevent eager portal rendering**. On master, overlays are appended to the DOM inside an empty div, called a "portal". This portal is appended on mount. It stays hidden until the overlay is opened. In this branch, we stop portals from rendering eagerly. Instead, portals are only appended when the overlay is opened, and removed when the overlay is closed. This way, the most recently opened overlay is always last in the DOM. 

Since the most recently opened overlay is last in the DOM, and since all overlays have the same z-index, the most recently opened overlay always appears on top.

This PR:
* closes #51256
* closes #45468
* closes #49466
* closes #50943
* closes #50971 
* provides a more robust solution for two issues that previously received a quick, "minimum viable fix": #45469 and #48256
* improves the health of the codebase by removing hacks
2024-12-17 12:48:14 -05:00
Nicolò Pretto
ec2f229fe1 fix(sdk): migrate to custom redux context to allow using the sdk on host apps that use redux (#51382)
* step1: add MetabaseReduxProvider and make our hooks + connect fn use it

step1: add MetabaseReduxProvider and make our hooks + connect fn use it

* step 2: run codemod to change the imports

step 2: run codemod to change the imports

* step 3: manual fixes

* step 4: e2e test for sdk
2024-12-17 18:37:54 +01:00
Chris Truter
f19101b970 Replace Search Index setting with a table (#51338) 2024-12-17 16:08:43 +00:00
Phoomparin Mano
cce25745a7 ci(sdk): skip flaky mantine styles test for sdk (#51404) 2024-12-17 22:40:56 +07:00
Denis Berezin
fd32386973 Migrate dashboard and question actions menus to Mantine (#51229) 2024-12-17 18:36:18 +03:00
Alexander Polyankin
5548e70d57 Avoid frequent setState calls in the add parameter popover in dashboards (#51373) 2024-12-17 10:28:28 -05:00
Alexander Solovyov
ea928cdb2c test to check ms/QueryVectorOf works (#51385) 2024-12-17 16:32:29 +02:00
Raphael Krut-Landau
7bfb4662d1 Add stories for overlays (#49501) 2024-12-17 09:29:10 -05:00
Ngoc Khuat
a238b9310f Send pulse asynchronously with a small pool size (#51380) 2024-12-17 13:38:38 +00:00
Nick Fitzpatrick
f9b87a3f6b adjusting webhook test response ui (#51043)
* adjusting webhook test response ui

* missed i18n, updating test to check for test response

* show response on error, not success

* parse the request as json response

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-12-17 08:52:22 -04:00
Uladzimir Havenchyk
7178d0fba9 deps: upgrade rspack (#51377) 2024-12-17 10:28:33 +00:00
Chris Truter
775feb1aa1 Add prometheus metric for search errors (#51357) 2024-12-17 12:19:14 +02:00
Kamil Mielnik
cc15ee649e Remove the old EntityObjectLoader and clean up (#51208)
* Add EntityObjectLoaderRtkQuery boilerplate

* Incorporate EntityType logic into the new component

* Improve comment

* Add childrenProps

* Move component into its own directory, extract types to a separate file

* Add entityObjectLoaderRtkQuery and temporary mappings

* Hook up the useGetQuery hook (tables only)

* Pass all the props to children

* Add Playground

* Gather more info in the Playground

* Integrate RTK with redux store

* Adjust props passed down

* Improve typing

* Make the request hook dynamic

* Add missing id in the query

* Handle fetchMetadata

* Change requestType to fetchType

* Add rtk mappings for databases in entity framework

* Use requestType to get request state path

* Enable new component everywhere

* Use legacy loader for entities without rtk mappings

* Improve comment

* Handle fetchMetadataAndForeignTables

* Remove unused function

* Handle reload and remove

* Add TODO

* Add transformResponse option and use it for fetchIdFields

* Format code

* Remove Playground

* Remove unused getUseGetListQuery

* Add rtk mapping for alerts

* Add rtk mapping for dashboards

* Add rtk mapping for groups

* Add rtk mapping for pulses

* Remove options

* Fix permissions tests

* Fix notifications tests

* Add rtk mapping for segments

* Use params instead of body
- It's leftover because this code got reverted after body -> params refactoring for GET endpoint has been merged to master

* Add rtk mapping for snippet collections

* Add TODO

* ESLint

* ESLint

* Update TODO

* Deprecate entity HOCs

* Update TODO

* Revert other entities for now

* Revert other entities for now

* Bring tables back

* Improve todos

* Add comment

* Improve comment

* Remove TODO

* Use reload param

* Remove properties prop

This was used to short-circuit and avoid triggering api calls if we already had an object with given attributes in cache.
With RTK query now managing the cache, we don't want to reproduce this behavior.

* Remove reloadInterval

This is used in EntityListLoader, not EntityObjectLoader

* Don't use setRequestPromise action

* Fix deprecations

* Format code

* Fix flake :(

* Try to fix flake

* Revert "Try to fix flake"

This reverts commit 6408a22a37.

* Try to fix flake

* Fix UseQuery type

* Implement useGetMetadataAndForeignTables

* Fix useMemo and move things down

* Fix typo

* Bring back original hack

* Move file

* Enable RTK for alerts

* Undeprecate a test

* Enable RTK for dashboards

* Port Segments to use new EntityObjectLoaderRtkQuery (#50635)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* [WIP] Port Groups to use new EntityObjectLoaderRtkQuery (#50631)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Fix failing test

* Enable RTK for dashboards

* Port Snippet collections to use new EntityObjectLoaderRtkQuery (#50636)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* Revert "Enable RTK for segments"

This reverts commit ef65fe78f3.

* Enable RTK for snippet collections

* Fix skipToken passing

* Enable RTK for dashboards

* Port Pulses to use new EntityObjectLoaderRtkQuery (#50633)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Fix hook usage

* Enable RTK for dashboards

* Port Fields to use new EntityObjectLoaderRtkQuery (#50639)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* Revert "Enable RTK for segments"

This reverts commit ef65fe78f3.

* Enable RTK for snippet collections

* Revert "Enable RTK for snippet collections"

This reverts commit e1439cb28b.

* Enable RTK for fields

* Account for skipToken

* Fix fetchFieldValues

* Optimize hooks

* Format code

* Fix loading state not kicking in during first render

* Rename

* Add comment

* Use consistent reference name for revisions

* Port Questions to use new EntityObjectLoaderRtkQuery (#50634)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Rename import

* Fix weirdness
- Apparently what makes the difference here is the lack of children render pattern ({childProps => <ComposedComponent {...childProps} />})

* Refactor

* Use isFetching instead of isLoading in EntityObjectLoaderRtkQuery, replace useEffect+useState with useMemo in SavedQuestionLoader

* Change order of HOCs to prevent loading state from redundantly kicking in

* Rename import

* [WIP] Port Persisted Models to use new EntityObjectLoaderRtkQuery (#50853)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Rename import

* Fix weirdness
- Apparently what makes the difference here is the lack of children render pattern ({childProps => <ComposedComponent {...childProps} />})

* Refactor

* Use isFetching instead of isLoading in EntityObjectLoaderRtkQuery, replace useEffect+useState with useMemo in SavedQuestionLoader

* Change order of HOCs to prevent loading state from redundantly kicking in

* Port persisted models

* Port schemas (#50854)

* Port snippets (#50855)

* Port timelines (#50858)

* Do TODOs

* Port timeline events (#50857)

* Port users (#50866)

* Port Collections to use new EntityObjectLoaderRtkQuery  (#50869)

* Port collections

* Fix imports

* Drop unused params

* Add missing property

* Fix collection not getting loaded

* Replace useCollectionQuery with useGetCollectionQuery

* Remove useCollectionQuery

* Format code

* Skip request on null id

* Revert "Remove useCollectionQuery"

This reverts commit 9b1068e611.

* Revert "Replace useCollectionQuery with useGetCollectionQuery"

This reverts commit 0c5ee660a3.

* Fix test

* Implement EntityName with RTK query

* git merge --squash 50323-port-other-entities

* Use entity getName selector

* Update comment

* Remove BaseEntity

* Improve typing

* git merge --squash 50323-port-other-entities

* Enable RTK for dashboards

* Deprecate the component

* Remove entityObjectLoader usage

* Remove old EntityObjectLoader and replace it with new one

* git merge --squash 51213-entity-loader
2024-12-17 07:48:52 +00:00
Ngoc Khuat
5a52987617 remove translation for slack error (#51375) 2024-12-17 06:29:49 +00:00
Tyler Plude
11f501e810 Make formatter integral? dependent on scale (#50609)
* Fix unexpected rounding in csv & json exports when column multiplier is non integral

* Fixing table unit test

* Adding WIP test

* Adding test case for validating new scaling logic is applied appropriately in exports

* Reverting id-or-name change and adjusting new scaling unit test

* Updating formatting to fix cljfmt in CI

* removing debug def

* Preserving integral behavior if scale is nil
2024-12-16 21:09:18 -08:00
Raphael Krut-Landau
e0a2a322ba Remove some console errors due to prop forwarding (#51358) 2024-12-16 18:30:57 -05:00
Raphael Krut-Landau
19d7f3d58a Deprecate the openNativeEditor helper in favor of the startNewNativeQuestion helper (#51109) 2024-12-16 16:42:19 -05:00
Sloan Sparger
fc85504079 [Cards in Dashboards] Reduce requests made for dashboards (#51084)
* reduce requests made by CollectionBreadcrumbs by using the dashboard on the question

* fix unit tests
2024-12-16 14:13:50 -06:00
github-automation-metabase
ef01a0f9f1 Update Readme version references and published npm version to 0.52.4-nightly (#51365) 2024-12-16 19:14:52 +00:00
Ryan Laurie
08b11e1dfa update release notes utm (#51353) 2024-12-16 12:06:00 -07:00
Braden Shepherdson
4cba79cdf1 [refs] Ignore :idents when comparing queries (#51349)
`query=` logic was returning false negatives when two queries were identical except for their `:ident`s.

This broke Metrics UI, for example, since it makes up a query based on the "old" and "new" metrics, and
compares those queries.

Now `:ident`s are ignored by `query=`, so two queries of the same shape are equal.
2024-12-16 13:26:45 -05:00
Nicolò Pretto
a21280000a simplify font config by not providing sans-serif fallback (#51343) 2024-12-16 19:04:42 +01:00
Phoomparin Mano
601c4f7412 ci(sdk): add package.json to sdk exports block (#51328) 2024-12-16 23:54:58 +07:00
Nick Fitzpatrick
7008d38317 Entity picker improvements (#50527)
* visial changes

* adding filter popover to collections tab

* proper key value

* filtering search results

* remove filtering on search, auto-focus search on modal open

* sweeping e2e adjustments

* Green e2e??

* adjusting unit test

* PR Feedback

* raffi feedback

* fixing shouldShowItem, adding max height

* expect-expect

* more e2e adjustments
2024-12-16 12:30:57 -04:00
Nick Fitzpatrick
e480527e92 PopoverWithRef, plus some other stuff (#49306)
* PopoverWithRef, plus some other stuff

* removing commented code

* I've done terrible things

* cleanup

* adding comments

* lets see what this breaks

* e2e adjustmnet

* removing unused component
2024-12-16 12:28:41 -04:00
Kamil Mielnik
e56e508989 Port EntityName to use RTK Query (#51052)
* Add EntityObjectLoaderRtkQuery boilerplate

* Incorporate EntityType logic into the new component

* Improve comment

* Add childrenProps

* Move component into its own directory, extract types to a separate file

* Add entityObjectLoaderRtkQuery and temporary mappings

* Hook up the useGetQuery hook (tables only)

* Pass all the props to children

* Add Playground

* Gather more info in the Playground

* Integrate RTK with redux store

* Adjust props passed down

* Improve typing

* Make the request hook dynamic

* Add missing id in the query

* Handle fetchMetadata

* Change requestType to fetchType

* Add rtk mappings for databases in entity framework

* Use requestType to get request state path

* Enable new component everywhere

* Use legacy loader for entities without rtk mappings

* Improve comment

* Handle fetchMetadataAndForeignTables

* Remove unused function

* Handle reload and remove

* Add TODO

* Add transformResponse option and use it for fetchIdFields

* Format code

* Remove Playground

* Remove unused getUseGetListQuery

* Add rtk mapping for alerts

* Add rtk mapping for dashboards

* Add rtk mapping for groups

* Add rtk mapping for pulses

* Remove options

* Fix permissions tests

* Fix notifications tests

* Add rtk mapping for segments

* Use params instead of body
- It's leftover because this code got reverted after body -> params refactoring for GET endpoint has been merged to master

* Add rtk mapping for snippet collections

* Add TODO

* ESLint

* ESLint

* Update TODO

* Deprecate entity HOCs

* Update TODO

* Revert other entities for now

* Revert other entities for now

* Bring tables back

* Improve todos

* Add comment

* Improve comment

* Remove TODO

* Use reload param

* Remove properties prop

This was used to short-circuit and avoid triggering api calls if we already had an object with given attributes in cache.
With RTK query now managing the cache, we don't want to reproduce this behavior.

* Remove reloadInterval

This is used in EntityListLoader, not EntityObjectLoader

* Don't use setRequestPromise action

* Fix deprecations

* Format code

* Fix flake :(

* Try to fix flake

* Revert "Try to fix flake"

This reverts commit 6408a22a37.

* Try to fix flake

* Fix UseQuery type

* Implement useGetMetadataAndForeignTables

* Fix useMemo and move things down

* Fix typo

* Bring back original hack

* Move file

* Enable RTK for alerts

* Undeprecate a test

* Enable RTK for dashboards

* Port Segments to use new EntityObjectLoaderRtkQuery (#50635)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* [WIP] Port Groups to use new EntityObjectLoaderRtkQuery (#50631)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Fix failing test

* Enable RTK for dashboards

* Port Snippet collections to use new EntityObjectLoaderRtkQuery (#50636)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* Revert "Enable RTK for segments"

This reverts commit ef65fe78f3.

* Enable RTK for snippet collections

* Fix skipToken passing

* Enable RTK for dashboards

* Port Pulses to use new EntityObjectLoaderRtkQuery (#50633)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Fix hook usage

* Enable RTK for dashboards

* Port Fields to use new EntityObjectLoaderRtkQuery (#50639)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* Revert "Enable RTK for segments"

This reverts commit ef65fe78f3.

* Enable RTK for snippet collections

* Revert "Enable RTK for snippet collections"

This reverts commit e1439cb28b.

* Enable RTK for fields

* Account for skipToken

* Fix fetchFieldValues

* Optimize hooks

* Format code

* Fix loading state not kicking in during first render

* Rename

* Add comment

* Use consistent reference name for revisions

* Port Questions to use new EntityObjectLoaderRtkQuery (#50634)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Rename import

* Fix weirdness
- Apparently what makes the difference here is the lack of children render pattern ({childProps => <ComposedComponent {...childProps} />})

* Refactor

* Use isFetching instead of isLoading in EntityObjectLoaderRtkQuery, replace useEffect+useState with useMemo in SavedQuestionLoader

* Change order of HOCs to prevent loading state from redundantly kicking in

* Rename import

* [WIP] Port Persisted Models to use new EntityObjectLoaderRtkQuery (#50853)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Rename import

* Fix weirdness
- Apparently what makes the difference here is the lack of children render pattern ({childProps => <ComposedComponent {...childProps} />})

* Refactor

* Use isFetching instead of isLoading in EntityObjectLoaderRtkQuery, replace useEffect+useState with useMemo in SavedQuestionLoader

* Change order of HOCs to prevent loading state from redundantly kicking in

* Port persisted models

* Port schemas (#50854)

* Port snippets (#50855)

* Port timelines (#50858)

* Do TODOs

* Port timeline events (#50857)

* Port users (#50866)

* Port Collections to use new EntityObjectLoaderRtkQuery  (#50869)

* Port collections

* Fix imports

* Drop unused params

* Add missing property

* Fix collection not getting loaded

* Replace useCollectionQuery with useGetCollectionQuery

* Remove useCollectionQuery

* Format code

* Skip request on null id

* Revert "Remove useCollectionQuery"

This reverts commit 9b1068e611.

* Revert "Replace useCollectionQuery with useGetCollectionQuery"

This reverts commit 0c5ee660a3.

* Fix test

* Implement EntityName with RTK query

* git merge --squash 50323-port-other-entities

* Use entity getName selector

* Update comment

* Remove BaseEntity

* Improve typing

* git merge --squash 50323-port-other-entities

* Enable RTK for dashboards

* Deprecate the component
2024-12-16 23:01:32 +07:00
Kamil Mielnik
38cc13c3d3 Fix actions loading (#51281)
* Fix flaky test

* Fix flake in all tests

* Use useGetActionQuery in ActionExecuteModal

* Remove use-action-query

* Remove Actions.load usage in ActionCreator

* Remove unused initialAction prop

* Remove redundant prop

* Use entityCompatibleQuery

* Update unit tests to account for RTK Query refetching

* Fix unit tests

* Fix unit tests

* Fix unit tests
2024-12-16 23:00:20 +07:00
Kamil Mielnik
bb854dbd50 Upgrade RTK from 2.3.0 to 2.5.0 (#51333) 2024-12-16 22:40:28 +07:00
Ryan Laurie
d619950925 Clean up hasBeenReleased checks (#51308)
* don't check for enterprise release tag anymore

* use oss tag for release channel tagging

* add error catcher

* don't trigger release log from tag job
2024-12-16 08:05:38 -07:00
Uladzimir Havenchyk
0fbb656080 fix(View Details): calculate row after vertical and horizontal scroll (#51302) 2024-12-16 14:56:15 +00:00
Nicolò Pretto
869efcea7a docs(sdk): document the compatibility layer for nextjs (#51173)
* wip nextjs compat docs

* explain how to do manual wrapping

* doocs

* better explanation of the index file

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Update docs/embedding/sdk/next-js.md

Co-authored-by: Phoomparin Mano <poom@metabase.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-16 15:06:05 +01:00
Demetrio
bf6759b08d Add basic auth on druid JDBC driver (#50905) 2024-12-16 14:18:14 +01:00
Nicolò Pretto
86b994e7a5 fix(sdk): wrap InteractiveDashboard with renderOnlyInSdkProvider (#51224) 2024-12-16 14:12:32 +01:00
Oisin Coveney
4bbd4cc2aa fix(sdk): Fix alignment of ColorSelector in SDK Chart Settings (#51000) 2024-12-16 13:01:25 +01:00
Kamil Mielnik
9dbfd5bc08 Remove entity.Loader (#51216)
* Get rid of enitity.Loader in PinnedQuestionLoader

* Set errorIcon

* Get rid of enitity.Loader in TargetClickMappings

* Remove duplication

* Get rid of enitity.Loader in LinkedField

* Convert metabase-lib/v1/metadata/utils/schema.js to TS

* Extract useGetSchemas

* Revert "Extract useGetSchemas"

This reverts commit 2271bd3aa7.

* Mark optional props as optional

* Properly handle skipToken

* Remove Schema.Loader from FieldMappingSelect
- This was added to fix metabase#19451 but seems no longer needed as the repro passes without it
- See 83f4097e87

* Update unit tests to use number as DatabaseId

* Extract DataSourceCrumbs and refactor it to TS

* Extract SourceDatasetBreadcrumbs and refactor it to TS

* Extract SourceQuestionBreadcrumbs and refactor it to TS

* Remove Questions.Loader from SourceQuestionBreadcrumbs

* Drop entity.Loader

* Update unit tests

* Drop checkNotNull usage
2024-12-16 10:15:53 +00:00
Chris Truter
2021f7daec Remove unnecessary transaction around query analysis (#51321) 2024-12-16 10:09:34 +00:00
Oleksandr Yakushev
6e72ffbb53 [ci] Actually test against different JDK versions (#51313) 2024-12-14 15:33:44 -05:00
appleby
da9d62a0e7 Fix distribution drill thru for multi-stage queries (#51247)
* Add missing -test suffix to zoom-in-timeseries test name

* Add missing -test suffix to underlying-records test name

* Fix distribution drill thru for multi-stage queries

Ensure the distribution drill thru is not returned by available-drill-thrus when a user clicks on an aggregation or
breakout column, even if there are additional query stages after the last aggregation / breakout stage.
2024-12-13 23:58:35 +00:00
Oleksandr Yakushev
912ee7b034 Bump c3p0 version (#51188) 2024-12-14 01:55:47 +02:00
Aleksandr Lesnenko
5bc378d9ca fix pie chart incorrect settings memoization (#51305) 2024-12-13 18:49:55 -05:00
Ryan Laurie
0e415e664c Just one Release (#51184)
* only create a single release for each release

* remove dead file

* little bug fixes

* update tests

* add link to metabase cloud in release notes

* remove checksums from release notes
2024-12-13 16:10:42 -07:00
Nathan Voxland
4df1c417a9 Don't compute a different hash key if they only differ on the order of values in a parameter (#51186)
Don't compute a different hash key if they only differ on the order of values in a parameter
2024-12-13 16:08:40 -06:00
Uladzimir Havenchyk
6f8ff73343 chore: cleanup query_builder nad querying folders from unused code (#51274) 2024-12-14 00:44:51 +03:00
Uladzimir Havenchyk
70c6be8670 chore: cleanup of unused styles and components (#51273) 2024-12-14 00:19:26 +03:00
Ryan Laurie
7ab0c413a4 pin to master (#51294) 2024-12-13 20:40:56 +00:00
Nick Fitzpatrick
ed61e82fa4 surface errors in move confirmation modal (#51239)
* surface errors in move confirmation modal

* woops...
2024-12-13 16:40:47 -04:00
appleby
bd36ca40cc Update underlying-records drill to use code in lib.drill-thru.common (#51254)
Some funcs were added to lib.drill-thru.common for the recent fix to the zoom-in.timeseries drill. Update the
underlying-records drill to use the common lib code rather than duplicating it.
2024-12-13 12:22:29 -08:00
Braden Shepherdson
2970dc54d5 [refs] Preserve :idents in replace-clause (#51251)
`replace-clause` is for editing an existing clause, which should
*preserve* its identity. But the new clause was getting its own
random ident which didn't match the original.

I've added tests for this, and fixed the `lib.remove-replace` logic to
make them pass.

Hat tip to Mike for catching this case!
2024-12-13 19:06:41 +00:00
William
24249e76da Implement cumulative aggregators in mongo (#51135)
Previously, cumulative aggregators were being done in clojure after the mongo query was finished.  However, this
didn't work on multi-step queries where the cumulative aggregator wasn't the last step (for example, do a cumulative
sum and then filter the result).  Implementing cumulative operators directly in mongo fixes this issue.
2024-12-13 18:48:22 +00:00
Raphael Krut-Landau
6059f92ca2 Update test to use revert icon (#50956)
We changed the time_history icon in this context to a revert icon in #46050 but never updated this test. This PR fixes that.
2024-12-13 12:58:16 -05:00
Oisin Coveney
4a0c62775f Convert ChartSettingInput to Mantine (#51162) 2024-12-13 18:06:43 +02:00
Oisin Coveney
f768b844c3 Convert ChartSettingsRadio to mantine (#51210) 2024-12-13 18:06:34 +02:00
Oisin Coveney
79817b4f15 Convert ChartSettingToggle to Mantine (#51161) 2024-12-13 18:05:55 +02:00
Aleksandr Lesnenko
b7a030022b prevent backport command from creating backports on open PRs (#51242) 2024-12-13 10:30:29 -05:00
Kyle Doherty
cd650bfd69 Update uberjar.yml to builde feature-visualizer (#51284)
Adds feature-visualizer to the branches for this workflow to help automate deployment to our staging env.
2024-12-13 10:17:09 -05:00
Kamil Mielnik
cd71625a45 npx browserslist@latest --update-db (#51280) 2024-12-13 14:38:58 +00:00
Chris Truter
2d01597302 Use pr-str so log data is parseable (#51275) 2024-12-13 15:12:39 +03:00
Oisin Coveney
afc1963a9b Convert ChartSettingSegmentedControl to Mantine (#50994) 2024-12-13 11:57:20 +02:00
Kamil Mielnik
08771ef685 Fix - Updating a filter via click behavior will not populate the field on actions (#51108)
* Fix #51020

* Add a repro for #51020

* Improve test name

* Update comment and naming

* Improve diff

* Add repro for when primary key is not called 'id'

* Update repro

* Drop prefetchesInitialValues & getValuesForUpdate

It's unclear what the real intention behind these two was, but it's clear that it made two differences:
(1) It decreased the probability of overwriting someone else's changes (if someone else saved them after we opened the form)
(2) It decreases the payload sent over the wire

(1) We can ignore this, as this problem is prevalent everywhere in our app
(2) This is negligible

Dropping these is simpler than enhancing getValuesForUpdate with extra logic for primary keys (and who knows what else)

* Break beforeEach into 2

* Remove no longer valid test
2024-12-13 15:18:15 +07:00
Uladzimir Havenchyk
4882239cd9 chore: rework view components to css modules (#51219)
* chore: rework view components to css modules

* fixup

* fix styling
2024-12-13 11:04:48 +03:00
Aleksandr Lesnenko
6fa8ff4779 Split dashboard PDF exports into pages (#49917)
* save only grid on fixed width dashboards

* split export pdf into pages

* trim dashboard export pdf into pages

* specs

* add padding to pdf pages

* dark mode
2024-12-13 03:53:56 +00:00
dpsutton
db1c4f3741 guard against a stage number in matching (#51262)
* guard against a stage number in matching

old:

`{"category":["dimension",["field",5,{"base-type":"type/Integer"}]]}`

new:

`{"state":["dimension",["field",48,{"base-type":"type/Text"}],{"stage-number":0}]}`

(comment
  (let [login-attributes {"state" "CA"}
        field-ids #{55 46 54 48 50 56 51 47 57 45 53 52 49}
        attribute_remappings {"state" [:dimension
                                       [:field
                                        48
                                        {:base-type :type/Text}]
                                        ;; this stage-number is optional. Newer versions have it since https://github.com/metabase/metabase/issues/46914
                                       {:stage-number 0}]}]
    (into {} (for [[k v] attribute_remappings
                   ;; get attribute that map to fields of the same table
                   :when (contains? field-ids
                                    (lib.util.match/match-one v [:dimension [:field field-id _]] field-id))]
               {k (get login-attributes k)})))
  )

* formatting fix
2024-12-12 20:54:42 -05:00
Alexander Polyankin
321c37ca1c Add e2e tests for if (#51245) 2024-12-13 01:28:51 +00:00
Raphael Krut-Landau
a0d13128dc Use the time_history icon to display when a question was last updated (#50952) 2024-12-12 18:58:11 -05:00
bryan
8c08ebbf3d update tracking for embedding-sdk-react and embedding-iframe x-metabase-clients (#51179)
* skip tracking non react-sdk x-metabase-clients

- Do not do promethus tracking for sdk.
- tracking ignores x-metabase-client headers when they're not == "embedding-sdk-react"

* cleanup indentation

* add prometheus tracking counters for iframe

* remedy 24h query execution inaccuracy
2024-12-12 22:03:32 +00:00
Nathan Voxland
d0137526c8 Allow config files to have literal values enclosed in {{{ ... }}} (#51129)
Allow config files to have literal values enclosed in {{{ ... }}}
2024-12-12 15:09:07 -06:00
John Swanson
f88e47c127 Fix autoplacement when a dashboard has empty tabs (#51180)
We were getting the `dashboard_tab_id` from the existing cards on the
first tab... but if no such card exists (the first tab is empty) then we
end up with a dashboard with tabs, but a card with
`dashboard_tab_id=null`, which doesn't show up.

This also fixes a bug in the revision history: we were publishing an
event for the dashboard being updated. The object was the updated
dashboard, but it had the old dashcards that we'd hydrated in order to
autoplace. We can dissoc the dashcards to ensure that the handler
hydrates them with the fresh, updated dashcards.
2024-12-12 11:51:36 -08:00
Alexander Polyankin
591599bf4e Add in and notIn custom expression functions (#51148) 2024-12-12 14:42:38 -05:00
Ryan Laurie
f5a22e7a3b fix-release-log (#51238) 2024-12-12 12:33:52 -07:00
Hervé Labas
83e55c8dce Update data.md (#51234)
Tiny typo
2024-12-12 18:35:12 +00:00
Phoomparin Mano
f9545b8740 Backport the webpack config from 51171 to master (#51212)
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-12-13 00:38:50 +07:00
Jeff Bruemmer
f7c5f1f2f5 note on static embeds (#51181) 2024-12-12 11:32:07 -05:00
Sloan Sparger
fb7ae7d97c [Cards in Dashboards] Fix no items appearing in personal collection (#51140)
* checks if there are dashboards in the personal collection to check if we should show items below

* adding e2e test

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-12-12 09:19:11 -06:00
Uladzimir Havenchyk
aae8d818ad chore: rework qb styles of view sidebars to css modules (#51136)
* chore: rework qb styles of view sidebars to css modules

* do not use text

* fix view sidebar styles

* naming

* more css

* more css

* fix color

* rework bucket button override

* rework modal right section content override

* Update frontend/src/metabase/query_builder/components/SidebarContent/SidebarContent.tsx

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* remove probably unused file

* change order

* pass color properly

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-12-12 18:17:18 +03:00
Sloan Sparger
b1de8b8bfd [Cards in Dashboards] Bug fix - Query builder breaks with DQ in root collection as init value (#51191)
* fixes error cases when initial question picker value is a DQ in a dashboard in the root collection

* fix type issue
2024-12-12 09:01:18 -06:00
Filip Hric
7ab2e5ecff Enable bug reporting (#50856)
* add bug report to command palette and profile menu

add bug report to command palette and profile menu

* refactor and update diagnostic window modal

* add analytics to track bug reporter modal activity

* add file id to to the upload-file method

* add the ability to collect browser information for diagnostic window

* implement feedback from PR comments

* Update frontend/src/metabase/components/ErrorPages/ErrorDiagnosticModal.tsx

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* implement feedback from PR comments #2

* rename "file a bug" to "report an issue"

* resolve conflict

* fix lint issues

* fix bad merge conflict resolution

* fix failing onboarding tests

---------

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-12 15:21:08 +01:00
Nick Fitzpatrick
e8ebd956f4 delete old dashcards when moving question from QB view (#51187) 2024-12-12 09:46:18 -04:00
Chris Truter
1200eb2f10 More logging around search index maintenance (#51206) 2024-12-12 13:12:13 +00:00
Jeff Bruemmer
70b4ad81e9 logo link (#51177) 2024-12-12 07:47:21 -05:00
Chris Truter
82f13b6742 Better diagnostic info when Search Index is not ready (#51201) 2024-12-12 11:34:37 +00:00
Nicolò Pretto
528222e7e2 docs(sdk): simpler documentation for building the sdk locally (#51064)
* wip: better documentation for developers that need to run the sdk
locally

* morning fixes

* remove developers-guide/sdk in favor of dev.md in the sdk folder

* add note about using the sdk with link to the docs

* fix mising word

* addressed feedback

* added notes about the envs for sdk e2e test
2024-12-12 11:59:51 +01:00
Nemanja Glumac
62caae9946 Prevent newly opened items from expanding outside viewport (#51008)
* Prevent newly opened items from expanding outside viewport

* Expand the unti test coverage

* Use the existing helper

* Change scroll view to center

This works better because it ensures that the top bar doesn't cover the element.

* Update frontend/src/metabase/home/components/Onboarding/Onboarding.tsx

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>

* Extract the `stopVideo` function

* Fix the type name

* Set the top scroll margin on the `main` element

---------

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-12-12 11:59:05 +01:00
Romeo Van Snick
a04af019b9 Update nanoid and path-to-regexp (#51198)
* Force nanoid onto 3.3.8

* Force path-to-regexp to 0.1.12
2024-12-12 20:55:39 +11:00
Phoomparin Mano
29b070c07a Manual backport workflow fixes from 51171 (#51196) 2024-12-12 15:56:24 +07:00
Ngoc Khuat
33e50fa799 Change migration added in #50735 from v52 to v53 (#51194) 2024-12-12 08:52:06 +00:00
Ryan Laurie
876eedc92a Make release log updates smarter (#49340)
* make release log updates smarter

* fix a bunch of stuff after testing
2024-12-11 17:18:35 -07:00
Braden Shepherdson
1d8541ca43 [refs] lib.convert preserves :idents through a round trip (#51133)
Closes #49682. Closes #49683.

Updates `lib.convert` and legacy MBQL normalization to allow
`:ident`s, and fixes some QP middleware and utils so they can
still match up refs correctly.

No user-visible impact.

Newly created queries will have `:ident`s generated for joins,
aggregations, etc. by the previous PR. This starts saving them
into appDBs. It is still acceptable to have missing idents at
this stage, including for new queries created without the lib.

Pre-existing clauses don't have refs added yet.


* Fix loading in segments

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-12-11 23:29:28 +00:00
Nick Fitzpatrick
53568b2570 removing broken assertion (#51182) 2024-12-11 22:26:01 +00:00
John Swanson
2ed4ad3d7c Lock revisions before adding more (#51158)
Our revision system has a race condition in the case of two concurrent requests to modify the same object. You can reproduce the exact issue here by opening two `psql` shells. In each one, run

```
begin;
insert into revision (model, model_id, user_id, timestamp, object, most_recent, metabase_version) values ('Dashboard', 1, 1, '2024-01-01T00:00:00Z', '{}', true, 'v1.0.0') returning id;
update revision set most_recent = false where model='Dashboard' and model_id = 10 and id != [[the id from above]];
```

after running all of the above, `commit` the transaction and note that **two** revisions are now marked as `most_recent`.

This is the way our revision system works: `t2/before-insert` sets `most_recent=true`, while `t2/after-insert` updates all the *other* revisions with `most_recent=false`.

The issue here is that when each transaction is running, it doesn't see
the uncommitted result of the other transaction (the new revision), so
the UPDATE does not set `most_recent` to `false` for either new
revision.

The solution here is to just select all existing `revision`s for this
model `FOR UPDATE`. This effectively locks the revisions for a single
entity, so we can't concurrently update revisions for the same entity.
2024-12-11 12:06:25 -08:00
Jeff Bruemmer
208deba6e6 docs - if alias (#51168) 2024-12-11 17:48:15 +00:00
Case Nelson
3f629276d8 Quiet snowflake logging (#51138)
It looks like snowflake introduced some very noisy logging in their
code.

9b7c9eb3e0 (diff-7859cac7243b3b9668df0770c96e264a1be2be06eefbbf7bba63904104028495L743)

This should reduce the noise and allow our code to handle and log the
exceptions.
2024-12-11 10:17:06 -07:00
Uladzimir Havenchyk
b06e6e9c34 chore: rework qb template tags to css modules (#51137)
* chore: rework qb template tags to css modules

* more css

* more css

* more css

* fix styles

* nobody uses less bottom padding

* Update frontend/src/metabase/query_builder/components/template_tags/TagEditorParamParts/TagEditorParam.module.css

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-12-11 16:03:39 +00:00
Sloan Sparger
e81c4137fc [Cards in Dashboards] Fix bulk move runtime error (#51146)
* fix runtime error caused by bulk moving dashboard questions where one question did not have an existing dashboard

* fix oopsie
2024-12-11 09:53:25 -06:00
Chris Truter
3f367ac9a3 Ignore interpolated expressions in query analysis (#51151) 2024-12-11 15:27:36 +00:00
github-automation-metabase
10986403a0 Add v0.51.8 to the list of releases (#51153)
* Add v0.51.8 to the list of releases

* ordering

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: jeff bruemmer <jeff.bruemmer@gmail.com>
2024-12-11 15:05:06 +00:00
Chris Truter
3b2fdbb676 Basic Search Index support for h2 (#51042) 2024-12-11 14:45:37 +00:00
Ngoc Khuat
9acb577c10 Fix alert condition text (#51117) 2024-12-11 19:46:54 +07:00
Alexander Solovyov
b62505f15b [search] track total search indexing time as prometheus metric (#51095) 2024-12-11 14:38:39 +03:00
Kamil Mielnik
ceacccd0b1 Port all entities to use new EntityObjectLoaderRtkQuery (#50623)
* Add EntityObjectLoaderRtkQuery boilerplate

* Incorporate EntityType logic into the new component

* Improve comment

* Add childrenProps

* Move component into its own directory, extract types to a separate file

* Add entityObjectLoaderRtkQuery and temporary mappings

* Hook up the useGetQuery hook (tables only)

* Pass all the props to children

* Add Playground

* Gather more info in the Playground

* Integrate RTK with redux store

* Adjust props passed down

* Improve typing

* Make the request hook dynamic

* Add missing id in the query

* Handle fetchMetadata

* Change requestType to fetchType

* Add rtk mappings for databases in entity framework

* Use requestType to get request state path

* Enable new component everywhere

* Use legacy loader for entities without rtk mappings

* Improve comment

* Handle fetchMetadataAndForeignTables

* Remove unused function

* Handle reload and remove

* Add TODO

* Add transformResponse option and use it for fetchIdFields

* Format code

* Remove Playground

* Remove unused getUseGetListQuery

* Add rtk mapping for alerts

* Add rtk mapping for dashboards

* Add rtk mapping for groups

* Add rtk mapping for pulses

* Remove options

* Fix permissions tests

* Fix notifications tests

* Add rtk mapping for segments

* Use params instead of body
- It's leftover because this code got reverted after body -> params refactoring for GET endpoint has been merged to master

* Add rtk mapping for snippet collections

* Add TODO

* ESLint

* ESLint

* Update TODO

* Deprecate entity HOCs

* Update TODO

* Revert other entities for now

* Revert other entities for now

* Bring tables back

* Improve todos

* Add comment

* Improve comment

* Remove TODO

* Use reload param

* Remove properties prop

This was used to short-circuit and avoid triggering api calls if we already had an object with given attributes in cache.
With RTK query now managing the cache, we don't want to reproduce this behavior.

* Remove reloadInterval

This is used in EntityListLoader, not EntityObjectLoader

* Don't use setRequestPromise action

* Fix deprecations

* Format code

* Fix flake :(

* Try to fix flake

* Revert "Try to fix flake"

This reverts commit 6408a22a37.

* Try to fix flake

* Fix UseQuery type

* Implement useGetMetadataAndForeignTables

* Fix useMemo and move things down

* Fix typo

* Bring back original hack

* Move file

* Enable RTK for alerts

* Undeprecate a test

* Enable RTK for dashboards

* Port Segments to use new EntityObjectLoaderRtkQuery (#50635)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* [WIP] Port Groups to use new EntityObjectLoaderRtkQuery (#50631)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Fix failing test

* Enable RTK for dashboards

* Port Snippet collections to use new EntityObjectLoaderRtkQuery (#50636)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* Revert "Enable RTK for segments"

This reverts commit ef65fe78f3.

* Enable RTK for snippet collections

* Fix skipToken passing

* Enable RTK for dashboards

* Port Pulses to use new EntityObjectLoaderRtkQuery (#50633)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Fix hook usage

* Enable RTK for dashboards

* Port Fields to use new EntityObjectLoaderRtkQuery (#50639)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Revert "Enable RTK for questions"

This reverts commit b9ad637ae0.

* Enable RTK for segments

* Revert "Enable RTK for segments"

This reverts commit ef65fe78f3.

* Enable RTK for snippet collections

* Revert "Enable RTK for snippet collections"

This reverts commit e1439cb28b.

* Enable RTK for fields

* Account for skipToken

* Fix fetchFieldValues

* Optimize hooks

* Format code

* Fix loading state not kicking in during first render

* Rename

* Add comment

* Use consistent reference name for revisions

* Port Questions to use new EntityObjectLoaderRtkQuery (#50634)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Rename import

* Fix weirdness
- Apparently what makes the difference here is the lack of children render pattern ({childProps => <ComposedComponent {...childProps} />})

* Refactor

* Use isFetching instead of isLoading in EntityObjectLoaderRtkQuery, replace useEffect+useState with useMemo in SavedQuestionLoader

* Change order of HOCs to prevent loading state from redundantly kicking in

* Rename import

* [WIP] Port Persisted Models to use new EntityObjectLoaderRtkQuery (#50853)

* Revert "Enable RTK for dashboards"

This reverts commit dd74f51b63.

* Enable RTK for groups

* Revert "Enable RTK for groups"

This reverts commit bbf6954cfa.

* Enable RTK for pulses

* Revert "Enable RTK for pulses"

This reverts commit cabcc7e297.

* Enable RTK for questions

* Rename import

* Fix weirdness
- Apparently what makes the difference here is the lack of children render pattern ({childProps => <ComposedComponent {...childProps} />})

* Refactor

* Use isFetching instead of isLoading in EntityObjectLoaderRtkQuery, replace useEffect+useState with useMemo in SavedQuestionLoader

* Change order of HOCs to prevent loading state from redundantly kicking in

* Port persisted models

* Port schemas (#50854)

* Port snippets (#50855)

* Port timelines (#50858)

* Do TODOs

* Port timeline events (#50857)

* Port users (#50866)

* Port Collections to use new EntityObjectLoaderRtkQuery  (#50869)

* Port collections

* Fix imports

* Drop unused params

* Add missing property

* Fix collection not getting loaded

* Replace useCollectionQuery with useGetCollectionQuery

* Remove useCollectionQuery

* Format code

* Skip request on null id

* Revert "Remove useCollectionQuery"

This reverts commit 9b1068e611.

* Revert "Replace useCollectionQuery with useGetCollectionQuery"

This reverts commit 0c5ee660a3.

* Fix test

* Extract dedicated providePermissionsGroupListQueryTags

* Format code

* Fix test setup
2024-12-11 09:50:10 +00:00
Kamil Mielnik
ce49352589 Remove EntityLink (#51044)
* Get rid of Database.Link usage in TableBrowser

* Fix browseDatabase typing

* Get rid of Collection.Link usage in DashboardMoveModal

* Get rid of Collection.Link usage in QuestionMoveToast

* Style links consistently

* Remove EntityLink

* Use database from the store if it's already there

* Remove filter

* Fix typo

* Use ts-pattern

* Bring spacing back

* Extract components for links

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-12-11 16:10:27 +07:00
Sloan Sparger
219ca91f6d Questions in Dashboards Milestone 1 (#47784)
* BE: Dashboard Questions

Setting this makes the card a "dashboard internal card" that should only
be used within a single dashboard, is moved along with the dashboard, etc.

prevent invalid inserts/updates

POST /api/card for dashboard internal cards

GET /api/collection/:id/items

Search

PUT /api/card/:id

WIP: last bits of card-in-dashboard API

Sticking point here is the copy, I think I need to do a small refactor
to make the code less hairy.

rm line

optionally show DQs for collection items

copying dashboards 🎉

wip

quick fix

Disallow moving dashboard questions & test archive

remove unused columns

fix argument order 🤦

serdes for dashboard questions

serialization baseline tests

Fix tests in `metabase.models.card`

Fix download exports test

Lint migrations file

cljfmt

cljfmt, again

the cljfmt job in CI doesn't run on this branch, it runs on the PR
branch merged with `origin/master` - which is nice, because it catches
cljfmt issues that would happen if you merged, but don't happen on your
branch, but also confusing, because it catches issues like
"metabase.api.common is never used", and then you stare at the file for
a while like "YES IT IS" before realizing what's going on.

migration to add idx for report_card.dashboard_id

don't rollback the `report_card.dashboard_id` bits

a couple missed API changes

- no DQs w/o DashboardCards in search

- no DQs in autocomplete

- fix check for "currently a dashboard question" in card validation

Fix some comments, clean up some existing code

Before, `cards-to-copy` returned just two lists of cards: those to
discard (no permissions) and those to copy. But `maybe-duplicate-cards!`
had some extra logic: if the card was a `model`, don't copy it, just
reference it.

I modified `cards-to-copy` to return three lists instead: cards to copy,
cards to discard, *and* cards to reference. This was initially just used
for making sure we copy Dashboard Questions instead of referencing them
- but I realized we could use the same for Models as well. I moved the
logic for models to `cards-to-copy` instead: if the card is a Model,
return it in the `reference` list instead of the `copy` list.

Fix commented-out test

cljfmt

Optionally include dashboard questions in search

Add a test for failing card name change

Opt. include dashboard questions for autocomplete

Update src/metabase/api/dashboard.clj

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

PR review response

lint migrations

quick impl of dashboard items

copied from collection items. should be firmed up for real going
forward. notable divergences:
- i'm not doing any limit/offset in the query
- i'm not including limit/offset in the response
- no reuse. just grabbed it to unblock nick

```
❯ http get "localhost:3000/api/dashboard/22/items" x-api-key:$API_KEY -pb
{
    "data": [
        {
            "archived": false,
            "archived_directly": false,
            "collection_id": 20,
            "collection_position": null,
            "collection_preview": true,
            "database_id": 48,
            "dataset_query": {
                "database": 48,
                "query": {
                    "source-table": 360
                },
                "type": "query"
            },
            "description": null,
            "display": "table",
            "entity_id": "_TmF-T7m_bBVxV_jfaNtM",
            "id": 192,
            "last-edit-info": {
                "email": "dan@metabase.com",
                "first_name": "dan",
                "id": 1,
                "last_name": "sutton",
                "timestamp": "2024-09-13T22:13:30.220311Z"
            },
            "last_used_at": "2024-10-01T17:48:36.128915Z",
            "model": "card",
            "moderated_status": null,
            "name": "Cynthia Example"
        }
    ],
    "models": [
        "card"
    ],
    "total": 1
}
```

contrast with collection items:

```
❯ http get "localhost:3000/api/collection/root/items?models=card&limit=1" x-api-key:$API_KEY -pb
{
    "data": [
        {
            "archived": false,
            "can_delete": false,
            "can_restore": false,
            "can_write": true,
            "collection_id": null,
            "collection_position": null,
            "collection_preview": true,
            "database_id": 4,
            "description": null,
            "display": "table",
            "entity_id": "e_jABu05u9nT9ocgfQWfZ",
            "fully_parameterized": true,
            "id": 143,
            "last-edit-info": {
                "email": "dan@metabase.com",
                "first_name": "dan",
                "id": 1,
                "last_name": "sutton",
                "timestamp": "2024-08-27T14:11:15.214254Z"
            },
            "last_used_at": "2024-08-27T14:11:27.138735Z",
            "location": null,
            "model": "card",
            "moderated_status": null,
            "name": "Collection + query on sleep question"
        }
    ],
    "limit": 1,
    "models": [
        "card"
    ],
    "offset": 0,
    "total": 13
}
```

Clean up last-edit-info and exclude archived cards

before: over-selecting, copy-paste function to clean it up.
after: reuse (bulk-aware) query that annotates with last-edit-info, ALSO
EXCLUDE CARDS

also condensed query a bit. was each field on a separate line for no
real reason.

`location` on dashboards

dashcards are still active for archived DQs

WIP: autoplace dashcards for dashboard cards

more wip for autoplacement

WIP for moving DQs

more WIP on moving DQs/autoplacement

delete old dashcards when moving to new dashboard

populate `here` on dashboards in coll items

reject moving card if in another dashboard

fix silly typo

allow optionally deleting old dashcards on move

WIP

add dashboard details to recents

untested wip

fix auto delete of old dashcards for move

Add another test for DQs getting unarchived

Fix dashboard details on recents, with a test

Archive and unarchive DQs when used/unused

including in revisions

Handle reversions containing unowned DQs

lint

Tests and fixes for dashboard items endpoint

remove stray #p

fix a test

Add more tests for DQs/reversions

Fix/update tests for updating DQs

Don't revert to dashcards with archived cards

This is the existing behavior, we should keep it.

lint

small fixes for recents tests

add more tests

Autoplace Dashboard Questions on creation

Improve autoplace to be like frontend

I'd hacked together something - this actually makes autoplacement work
the same way on the frontend and backend.

fix a couple tests

`delete_old_dashboards` as a query param

Fix autoplace for tabbed dashboards

and add a test

do not autoplace DQs when duplicating a dashboard

This was resulting in us accidentally creating two dashcards for a
duplicated DQ.

add effective location to collections on dash

add dashboard_count to (card) collection items

autoplace on unarchive, better error messages

Exclude DQs from dashboard if archived directly

DOH

workaround a bug with "changing" a type

Fix bug causing dashboard cards to be removed

small refactor autoplacing / removing dashcards

Create Dashboard revisions on autoplace/remove

When we modify Dashboard Questions, we autoplace or autoremove relevant
cards from the Dashboards involved. For example, we remove DashCards
from the old dashboard if we're moving to a new dashboard, and we
autoplace DashCards into the new dashboard.

When we do this, publish an event that the dashboard itself has changed.
This updates the revision history for the dashboard so that you can
revert correctly.

Note that when using the revision history, DQs will automatically be
archived or unarchived as necessary. So e.g. if you manually archive a
DQ, then go to the Dashboard and revert, the DQ will be auto-unarchived.
If you go to the dashboard and remove all cards for a DQ, the DQ will be
archived - if you then manually unarchive it, it'll be autoplaced on its
dashboard again.

Fix bug on card modification

The conditions here were wrong. Say you had a card on dashboard 1 that
was archived. If you specified `{:dashboard_id 1 :archived false}`, it
would be correctly autoplaced on the dashboard. But if you just
specified `{:archived false}`, the "new dashboard ID" is nil.

The logic here is pretty painful, because to figure out the resulting
value for something like `dashboard_id` we can't just get it from the
old version or the changes. Instead, we need to:

- check to see whether it's changing, then

- if it changed, use the version from the update, otherwise

- use the old version

The same is true for `archived`.

After we figure out the old dashboard_id, new dashboard_id, and whether
the card will end up archived or not, we can actually do the checks we
need:

- if we're ending up an unarchived card on a dashboard, autoplace

- if we're moving from one dashboard to another, or moving from a
dashboard to a collection (and the user told us to), auto-remove

offset/limits for dashboard items

Reuse some code between dashboard/collection items

Fix some failing tests in api.dashboard

I was getting stack overflow errors when running these tests. I followed
along with the demonstartion
[here](https://github.com/metabase/metabase/pull/43496) to fix.

cljfmt

add additional tests

Always delete dashcards when archiving a DQ

If we're archiving a DQ, let's delete the dashcards so this appears in
the revision history.

publish revision when autoplacing

Publish dashboard events when cards are autoplaced

new endpoint to get dashboards a card is in

allow moving to a dashboard deleting old dashcards

fix the migrations 😭

fix migration IDs

* work on dedicated dashboard question page

* wip on dashboard page for handling dashboard questions

* hacking linking to dashboard for question and books marks - does not handle navigating to the correct tab yet

* make it easier to change the dashboard_id for hacking

* misc. changes

* action menu and dashbcard action updates

* enables trashing dashboard questions from the dashboard view, enables undoing of that case, updates archive state for dedicated dashboard question page

* wip - mostly done creation flow

* wip

* add question directly on dashboard flow

* significant clean up of fe code, revert some wierd differences between base branch, allows selecting dashboard when duplicating a question

* type fixes

* clean up isDashboardQuestion checks, fixes bug where save question form name and description state would get cleared after selecting a dashboard from the picker, fixed bug where editing a dashboard question and choosing save as new question would only let you save it to the dashboard the original question was on

* implement bulk of team feedback

This commit accomplishes the following things:
- Updates copy of the dashboard/collection picker
- Fixes the tooltip copy for the add question button in the edit dashboard view
- Removes the ability to trash a dashboard question + dashboard view removes rather than trashes the question
- Adds option in dashboard edit view to add a native or notebook question

* prompt to save rather than discard changes when leaving a dashboard while editing to create a new question

* include dashboard questions in search results

* fix lint & kick CI

* type fixes

* fix unit tests

* two small fixes

* wip on failing e2e tests

* bulk e2e test fix

* fixed most tests worth fixing - leaving the ones that need to be replaced

* Dashboard Question as a source

* replace dashcard flow

* starting to update collection picker to treat dashboards as folders

* fix spelling mistake

* fix bad resolution and stop double adding newly created dashboard questions to their dashboards

* allow dashboards in collection picker

* remove checkbox to only clone dashboard w/o cards, fix collection id calculation for saving a question when defaults to a dashboard

* rough pass at allowing questions to be moved to, from, and between dashboards

* building state path with initial value as a dashboard

* simplify moving code and fix encountering BE error

* add confirm modals when moving a dashboard question to a collection or another dashboard, allow users to keep or remove dashcards for a dashboard question getting moved to a collection

* improve the breadcrumbs data consistency, fix bug in moving logic and dump user in edit state of dashboard when moving from collection to dashboard

* dynamic select button text

* Search showing available models

* hopefully this resolves some type sadness

* handle inconsistent state issues between latest question and query builder internal state

* default question picker to showing dashboards as folders

* silly type things

* disallow saving metrics | models | events to dashboards, added back ability to keep or remove dashboard ca
rds when moving a DQ to a collection, fixed dedicated DQ page not appearing archived after archiving the parent dashboard

* use currentData instead of data for collection breadcrumbs

* dashboards are not folders when they are empty

* fix moving question to Our Analytics, Update sidesheet question into for DQs, always allowed to select a dashboard for moving question

* confirm moving questions into dashboards

* trying to sort out types

* types are still a mess

* only regular questions can be moved into a dashboard

* adjusting some unit tests

* add e2e tests for dashboard questions

* should have happy linter and unit tests

* fix some type errors

* loading state

* e2e test fixes

* more fixed tests

* loading state message

* filter series options, fix create new collection logic

* fix some more e2e tests

* e2e test adjustments

* even more e2e tests fixes

* fix named export

* more e2e test fixes

* fixing some e2e stuff

* hopefully final e2e adjustments

* last failing e2e (for now)

* More BE: Dashboard Questions

add dashboard question dimension to stats

Handle series correctly

and test for them

Don't restore archived-directly questions

* unit test adjustments, linter changes

* obey the linter

* unit tests for new breadcumb functionality

* allow creating a question directly to a dashboard

* More BE: Dashboard Questions

use dashboard constants for default size

add missing sql clause

add dummmy alias to subquery

* more cards in dashboards e2e tests

* rebase whoopsie

* more tests

* fix types

* More BE: Dashboard Questions

include dashboard info on coll items & cards

include dashboard info in search

also modify the moderation info a bit, now all three endpoints return
the same shape for `dashboard` (if present):

```
{:id dashboard-id
 :name dashboard-name
 :moderation_status moderation-status-if-present}
```

Bulk endpoints for checking dashboards and moving

For now the move endpoint just runs everything in a transaction and
spits out an error if anything failed. I'd like to take more time to
think of the exact shape of the result we want in the case of an error,
even though I think ideally we should allow partial success.

* reproduce card-pocalypse

* adding dashboard link to search results

* more trash tests

* lint fixes

* fix crash when archiving dashboard with virtual cards

* add loading state to archive modal

* obey the clojure linter

* More BE: Dashboard Questions

cljfmt and fix tests

small test fix

* more e2e tests

* embedding tests

* type fix

* More BE: Dashboard Questions

two more small test fixes

more test fixes

* add sdk tests

* another test

* add series removal e2e test

* More BE: Dashboard Questions

yet another test 😭

work around old MariaDB limitations

* permission check and confirmation modal when moving cards into dashboards

* e2e adjustments

* add some missing tests

* prettier + rebase fixes

* fix search result bug

* Entity syncing when moving a question from a collection to a dashboard

* hello rebase hades

* gree dashboard-questions suite

* fix more e2e tests

* happy little test fixes

* Sloan Feedback

* fix move modal error swallowing

* fix embedding test

* fixes breadcrumbs for embedding, fixes associated failing tests, and updates some tests to account for reduction in # of requests

* fix embedding e2e tests

* Bryan's review response

* fix usage of `offset-paging`

* fix request count errors

* fix unit test

* finish feedback from FE code review

* CR response for Noah

* bad sloan

* no need for dashboards in ad hoc

* get the dash name from the question object

* fix migrations again

* fix test + kondo

* lint fix

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-12-10 13:51:37 -06:00
Braden Shepherdson
1770e0d228 Revert "[refs] lib.convert preserves :idents through a round trip (#50085)" (#51128)
This reverts commit 7c6b8bee37, #50085.
2024-12-10 19:41:23 +00:00
Nemanja Glumac
0cecef1c38 Dismissible "How to use Metabase" sidebar link (#50536)
* Add new user-level setting

* Add selector

* Make link dismissible from the sidebar

* Transfer the onboarding link to the main "gear" menu

* Add E2E test to cover the link dismissal behavior

* Add tests for the settings menu link

* Fix tests

* Provide useful comment in the e2e test

* Provide contextual explanations to translators
2024-12-10 19:36:50 +00:00
Jeff Bruemmer
4a47bd20f0 docs - api update (#51124)
* api docs

* intro
2024-12-10 18:55:26 +00:00
bryan
600e4aec03 Count and Categorize Public Views in query executions table (#51079)
* We need to look at the context field to categorize public views

* pull poll-unil into util ns

* fix comment typo

* add test

* update docstring

* remove true? call, it will return `true` on pass

* improve poll-until
2024-12-10 18:25:51 +00:00
Alexander Polyankin
c9b18c5fc6 Migrate legacy exclude date filters on read (#51014) 2024-12-10 17:33:04 +00:00
Uladzimir Havenchyk
d95746367e chore: rework qb expressions to css modules (#50864)
* chore: rework qb expressions to css modules

* use correct code for syntax

* use box instead of text

* replace text with box

* cleanup ts

* cleanup

* fix styles

* fix lint

* fix colors

* fix styles
2024-12-10 20:25:50 +03:00
appleby
1f8b62c4ea Fix the zoom-in.timeseries drill for multi-stage queries (#50970)
* Fix the zoom-in.timeseries drill for multi-stage queries

If no dimensions are provided to the zoom-in.timeseries drill, then attempt to find the matching dimension from the FE-provided row data instead, if present.

Related to https://github.com/metabase/metabase/issues/46932

* Only return zoom-in.timeseries drills for clicks on aggregated columns
2024-12-10 08:22:09 -08:00
Raphael Krut-Landau
6d4ea59746 Use Mantine's Portal not BodyComponent (#49494)
This PR removes the deprecated `BodyComponent` HOC in favor of Mantine's `Portal` component. This helps pave the way for https://github.com/metabase/metabase/pull/49442

### How to verify

1. Perform an action that triggers an undo toast (e.g., move a question into the trash)
2. Verify the undo toast appears correctly at the bottom of the screen
3. In a collection, drag and drop items to verify the drag preview renders correctly

### Testing

This change is covered by the following tests:
* `collections.cy.spec.js > "should be able to drag an item to the root collection (metabase#16498)"`
* `collection-pinned-overview.cy.spec.js:269: "should be able to pin a visualization by dragging it up"`

Note the following comment, however, which mentions the limitations of our drag-n-drop e2e tests:

(from https://github.com/metabase/metabase/blob/92d6150/e2e/test/scenarios/collections/collection-pinned-overview.cy.spec.js#L282-L289)
```
    // this test can give us some degree of confidence, but its effectiveness is limited
    // because we are manually firing events on the correct elements. It doesn't seem that there's
    // a way to actually simulate the raw user interaction of dragging a certain distance in cypress.
    // this will not guarantee that the drag and drop functionality will work in the real world, e.g
    // when our various drag + drop libraries start interfering with events on one another.
    // for example, this test would not have caught https://github.com/metabase/metabase/issues/30614
    // even libraries like https://github.com/dmtrKovalenko/cypress-real-events rely on firing events
    // on specific elements rather than truly simulating mouse movements across the screen
```
2024-12-10 11:12:32 -05:00
Alexander Polyankin
5607cb71c0 Move default filter parts to MBQL lib (#50957) 2024-12-10 16:08:11 +00:00
Jeff Bruemmer
99a1cdb660 docs - locale params (#51001)
* locale params

* formatting

* note on UI vs content

* interactive embedding

* language update

* plans blockquote

* asterisk
2024-12-10 10:58:35 -05:00
Alexander Polyankin
ebb3f14c39 Add :if as an alias to :case in the expression editor (#50702) 2024-12-10 15:15:21 +00:00
Braden Shepherdson
7c6b8bee37 [refs] lib.convert preserves :idents through a round trip (#50085)
Closes #49682. Closes #49683.

Updates `lib.convert` and legacy MBQL normalization to allow
`:ident`s, and fixes some QP middleware and utils so they can
still match up refs correctly.

No user-visible impact.

Newly created queries will have `:ident`s generated for joins,
aggregations, etc. by the previous query, and this will start
saving them into appDBs.

Pre-existing clauses don't have refs added yet.

* Fix loading in segments

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-12-10 15:04:21 +00:00
Roman Abdulmanov
41c73023b6 Add 52 as the release branch (#51113) 2024-12-10 18:50:22 +04:00
Alexander Polyankin
ad25f3c0eb Add :if mbql sugar function (#51069)
* Desugar if

* Add if to MBQL lib

* Add if to MBQL lib

* Add if to MBQL lib
2024-12-10 09:43:31 -05:00
Uladzimir Havenchyk
130f406b4f chore: migrate ViewHeader components to css modules (#50907)
* chore: migrate ViewHeader components to css modules

* fix typecheck

* cleanup styles

* more css

* fix styles

* more css

* more css

* fix css specificity

* fixup
2024-12-10 17:31:37 +03:00
Uladzimir Havenchyk
10f52f57ef chore: rework qb DatasetEditor styles to css modules (#50909)
* chore: rework qb DatasetEditor styles to css modules

* fix color

* fixup

* fix styles

* fix styles
2024-12-10 14:28:48 +00:00
Alexander Polyankin
ccd6b59b34 Do not match inner clauses with -filter-parts (#51089) 2024-12-10 08:43:37 -05:00
Chris Truter
faf82bd8d5 Track which search models are affected by deletes (#51096)
For now, we've decided not to trigger index updates when elements are deleted, due to the overhead that toucan2 would add.

We have the code to calculate what *should* be done, so we might as well keep it around in a test that documents these relationships. 

It's good to be mindful of the implications, and we could even use this information to do manual calls from the relevant deletion call sites.
2024-12-10 15:32:11 +02:00
Nemanja Glumac
cb71e0e908 Fix the "invite" screenshot (#51098) 2024-12-10 14:20:44 +01:00
Oisin Coveney
b88e7431b6 feat(sdk): Modify Interactive Question Layout (#50152) 2024-12-10 14:27:47 +02:00
Ngoc Khuat
0c4d8284b0 [Notification] insert and replace instead of truncate (#50735) 2024-12-10 12:14:35 +00:00
lbrdnk
a96a840c78 Avoid logging stacktrace in streaming (#51053)
* Avoid logging trace

* Demote log to warning
2024-12-10 09:59:56 +00:00
Uladzimir Havenchyk
84f6a327fa chore: rework dataref styles to css modules (#50911)
* chore: rework dataref to css modules

* fix pane

* fix styles

* fixup

* fix styles

* fix styles

* Update frontend/src/metabase/query_builder/components/SidebarContent/SidebarContent.tsx

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* rename questionid to NodeListItemId

* fix color

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-12-10 12:47:13 +03:00
Kamil Mielnik
4904ae048f Replace Actions API handlers in entities with RTK Query (#50936)
* Add list/create/update/delete to actions api

* Add api mappings in entity framework

* Port actions to RTK

* Remove old api mappings

* Fix a test

* Fix test

* Fix test

* Fix test

* Fix method

* Fix types

* Define request types

* Remove ActionsApi.create

* Fix deleting actions

* Fix invalidation

* Fix invalidation

* Remove redundant spreads

* Remove type attribute from UpdateActionRequest
2024-12-10 09:04:48 +00:00
github-automation-metabase
115d77dfbe Add v0.52.2 to the list of releases (#51085)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-12-09 19:33:05 -05:00
Jeff Bruemmer
a1aff9440f note on public links (#51081) 2024-12-09 17:15:04 -05:00
Jeff Bruemmer
f3edd784f0 docs - generate config file (#44444) 2024-12-09 20:37:12 +00:00
Phoomparin Mano
c40657ff3a feat(sdk): use metabase type prefix and re-export types (#50862) 2024-12-10 02:33:15 +07:00
Nathan Voxland
110079b65b If multiple limit or offset arguments are passed, only use the 1st one (#50964)
If multiple limit or offset arguments are passed, only use the 1st one
2024-12-09 13:25:30 -06:00
Phoomparin Mano
fba8aab8ac feat(sdk): combine title props in interactive question (#50660) 2024-12-10 01:23:30 +07:00
William
f256f2d2eb Nested joins ignore temporal units (#50962)
The underlying issue is that nest-query/nest-expression included temporal units when copying over joined fields into the nested query. This caused both the nested query and the parent query to include the "extract the unit from the date" code. In cases where the extraction didn't change the type, this duplication wasn't a big deal. However, for temporal units like hour-of-day, the first extraction changed the type of the field from date to string, and then the second extraction broke.  This change ensures that the inner query doesn't try to extract temporal units, which should avoid the duplicate extractions.
2024-12-09 18:15:08 +00:00
Phoomparin Mano
9f3e0bc68a feat(sdk): move non-auth config options to provider (#50585)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-12-10 00:44:43 +07:00
Phoomparin Mano
5313e018e8 feat(sdk): support sql parameters in interactive questions (#50728) 2024-12-09 23:43:19 +07:00
Nicolò Pretto
c0eab4452e feat(sdk): next sdk compatibility layer (#50230)
* wip next sdk compat

* better code generation, dts works

* Last line of file should end in a newline character

* feat(sdk): make MetabaseProvider not break ssr

* aUpdate enterprise/frontend/src/embedding-sdk/package.template.json

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* address pr comments

* refactor(sdk): use relative paths when fixing d.ts files

* make types work on moduleResolution: node

* add loading text

* fix(sdk): #50736 make sure we don't break the host app if a sdk
component is rendered outside of the provider for a render

* fix: this should make types work for real?

* self review fixes

* update test for PublicComponentWrapper

* Update enterprise/frontend/src/embedding-sdk/components/private/PublicComponentWrapper/PublicComponentWrapper.tsx

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* remove unused component

* eslint-disable-next-line for MetabaseProvider

* list tsx as dependency

* /next -> /nextjs

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-12-09 17:12:27 +01:00
Nicolò Pretto
179554e564 feat(sdk): detect if session.id is not a string (#50890)
* feat(sdk): detect if session.id is not a string

* use yup, also validate exp as we use it
2024-12-09 16:27:37 +01:00
Phoomparin Mano
dbd60f5c47 feat(sdk): use public-facing question type in event handlers (#50867)
* introduce public metabase question type

* revise internal question type

* update stories

* use public question type in dashboard card plugins

* add tests for transforming question properties

* add tests for question description

* re-export the MetabaseQuestion type

* fix lint imports

* change publicQuestion to sdkQuestion

* name cannot be null if the card is present
2024-12-09 18:21:10 +07:00
Oisin Coveney
59c5690bd6 Add story for QuestionSettings (#50998) 2024-12-09 08:22:44 +00:00
Mahatthana (Kelvin) Nomsawadi
5197e318d7 Fix embed loader not translated with #locale (#50841)
* Fix embed loader not translated with #locale

* Fix unit tests

* Add E2E tests

* Fix a case where the lcoale is failed to load

* Simplify conditions in `LocaleProvider`

Co-authored-by: Nicolò Pretto <info@npretto.com>

* Make E2E tests faster

Co-authored-by: Nicolò Pretto <info@npretto.com>

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-12-09 01:50:41 +00:00
Mahatthana (Kelvin) Nomsawadi
fbe206dfba Make Loki's embedding scroll stories more resilient (#50991) 2024-12-09 01:50:29 +00:00
Oleksandr Yakushev
168bd09275 Bump Malli version (#51022) 2024-12-08 22:17:50 +02:00
Cam Saul
41b212a654 [Backend modularization] metabase.server.core and metabase.request.core API namespaces; update Kondo (#50839)
* WIP

* metabase.request.cookies namespace

* Server API namespace

* `metabase.server` => `metabase.server.instance`

* Reformat code

* Revert indentation changes

* Unrevert comment

* Oops delete moved file

* Don't be lazy CAM!!!

* Add TODO

* Please cljfmt

* Bump Kondo version to fix metadata ignores in namespaces being ignored

* Update Kondo and enable a few more linters

* Update Clojure linux install script location

* Ok so apparently the old URL does work

* Make sure things live in the right places

* Why do I always have to clean up other people's messes

* Fix formatting

* People need to knocc it off with writing slow tests

* Fix another test that took 45 SECONDS

* Fix Kondo warning
2024-12-07 09:35:13 +00:00
Case Nelson
b2fade6394 feat: Introduce describe-indexes (#49982)
* feat: Introduce describe-indexes

Fixes: #49981

Introduce a faster sync with describe-indexes that follows describe-fields
and describe-fks to allow for a database wide sync step rather per table
describe-table-indexes.

Implement for psotgres

* Fix formatting

* Add tests

* Update src/metabase/driver.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Update src/metabase/driver.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Address PR review

* Fix null schema check

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-12-06 21:31:36 +00:00
metamben
8f93e5550d Support FE display functions for during function (#50965)
* Support FE display functions for during function

Fixes #50942
2024-12-06 21:00:47 +00:00
Ryan Laurie
c3c2e8ee18 pin webhook tester to v1 (#51007) 2024-12-06 12:34:39 -07:00
Aleksandr Lesnenko
b03d6f7e2b Fix missing tooltip on waterfall total bar (#50917)
* fix scatter chart tooltip shows irrelevant info

* remove outdated spec as we always show the tooltip_column setting

* fix missing tooltip on the total bar on waterfall charts
2024-12-06 12:40:14 -05:00
Alexander Polyankin
da0397c091 Move specific date filter parts to MBQL lib (#50953) 2024-12-06 10:42:59 -05:00
Chris Truter
47200643e1 Fix race between jobs accessing the search index (#50990) 2024-12-06 17:08:06 +02:00
Chris Truter
6c22043070 Encapsulate default models to search (#50938) 2024-12-06 15:07:00 +00:00
Chris Truter
34401cccab Fix rollback to version 50 with null query_field values (#50982) 2024-12-06 14:59:33 +00:00
Aleksandr Lesnenko
e80c600db5 Render negative values on PieChart (#50837)
* fix pie chart ignores negative values

* fix incorrect handling of zero only values

* fix rebase
2024-12-06 13:30:34 +00:00
Chris Truter
3d6c90698b Improve queue test and add more buffering (#50980) 2024-12-06 12:31:06 +00:00
Denis Berezin
7b4c298126 chore: Move alerts and pulse components to notifications domain (#50929) 2024-12-06 14:39:45 +03:00
Mahatthana (Kelvin) Nomsawadi
631947bfb8 Streamline embed flow when embedding is off (#50842)
* Always show embed sharing option for admins (#50513)

* Always render the public link option

This is possible because metabase#50504

* Always render the embed option

* Fix unit tests

* Fix E2E tests

* Correct test semantic

* Hide Embed option for non-admins

* New Embed modal (#50580)

* Open "Compare options" in a new tab

* Add an external link icon to interactive embed option when it should

* Add disabled state to SDK

* Add a disable state to static and interactive embedding

* Add interactive embedding disabled state

* Implement disabled link

* Prepare folder for testing

* Fix tests and add SDK tests

* Add interactive embedding tests

* Correct test desribe block levels

* Add static embedding tests

* Add premium interactive embedding tests

* Add enterprise tests (EE without tokens)

* Fix the rest of the failed unit tests

* Update E2E tests

* Fix a case where OSS see disabled interactive embedding

This should be impossible as interactive embedding isn't available on
OSS, so we should not display the disabled state.

* Address review

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Address review

Co-Authored-by: Poom poom@poom.dev

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Update Interactive Embedding Admin Settings page (#50693)

* Add a quick start link to interactive embedding settings page

* Update UTM tags for interactive embedding card

* Don't show interactive embedding option as enabled on OSS

* Fix unit tests

* Add a new test

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-12-06 10:26:41 +00:00
Uladzimir Havenchyk
6ce8344c90 chore: rework DataSelector styles to css modules (#50912)
* chore: rework DataSelector to css modules

* fix imports

* revert changes

* fix styles

* fix styles

* fix styles

* fix styles

* use upper case

* address review

* add missing files

* one more entry
2024-12-06 13:07:49 +03:00
Aleksandr Lesnenko
6d83cb2b60 fix scatter chart tooltip (#50889)
* fix scatter chart tooltip shows irrelevant info

* remove outdated spec as we always show the tooltip_column setting
2024-12-05 20:53:33 -05:00
Jeff Bruemmer
9f4327cf87 update env vars (#50963) 2024-12-05 22:56:10 +00:00
bryan
989bb6ff23 New and improved Examples collection (#50829)
* fix the script, and add the new edn

* make the migrations run in the proper order

* it works (needs cleanup)

* remove broken binning

- These bins rely on fingerprinting for the custom Age column

- The fingerprinting for that custom column are not properly exported in
serialization, hence do not get loaded into metabase, causing binning by
Age to fail.

* cleanup / linting

* cleanup

* update migration test ids to test

* realign test name to check for to see if sample content was created

* remove Product collection + move Examples into root

* update collection_ids for the content too

* remove click behavior for 'Revenue goal for this quarter'

* Apply suggestions from code review

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>

* for the sample collection is_sample should be true

* Drop CreateInternalUserNoOp

* typo

* update migration comments

* 2 small fixes

* fix data perms for example coll

* add a comment so we don't have 2 blank lines in a row

---------

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-12-05 15:33:20 -07:00
William
82c39bb942 Make postgres enums not error when using :is-empty/:not-empty (#50914) 2024-12-05 22:23:31 +00:00
github-automation-metabase
bcd41db9ad Add v0.50.35 to the list of releases (#50835) 2024-12-05 22:19:25 +00:00
dpsutton
a135e609e8 Include explicit require to c.t.build.tasks.uber (#50941)
Fixes https://github.com/metabase/metabase/issues/50940

Build sometimes fails with

```clojure
      Compiling namespaces [metabase.driver.sqlserver]
{:via
 [{:type clojure.lang.ExceptionInfo,
   :message
   "Running build steps for Enterprise Edition version UNKNOWN: version, translations, frontend, licenses, drivers, uberjar",
   :data {},
   :at [metabuild_common.steps$do_step invokeStatic "steps.clj" 90]}
  {:type clojure.lang.ExceptionInfo,
   :message "Building all drivers in parallel (:ee edition)",
   :data {},
   :at [metabuild_common.steps$do_step invokeStatic "steps.clj" 90]}
  {:type java.util.concurrent.ExecutionException,
   :message "clojure.lang.ExceptionInfo: Build driver :databricks (edition = :ee, options = nil) {}",
   :at [java.util.concurrent.FutureTask report "FutureTask.java" 122]}
  {:type clojure.lang.ExceptionInfo,
   :message "Build driver :databricks (edition = :ee, options = nil)",
   :data {},
   :at [metabuild_common.steps$do_step invokeStatic "steps.clj" 90]}
  {:type clojure.lang.ExceptionInfo,
   :message
   "Write :databricks :ee uberjar -> /home/runner/work/metabase/metabase/resources/modules/databricks.metabase-driver.jar",
   :data {},
   :at [metabuild_common.steps$do_step invokeStatic "steps.clj" 90]}
  {:type java.lang.IllegalStateException,
   :message "Attempting to call unbound fn: #'clojure.tools.build.tasks.uber/uber",
   :at [clojure.lang.Var$Unbound throwArity "Var.java" 47]}],
 :trace
 [[clojure.lang.Var$Unbound throwArity "Var.java" 47]
  [clojure.lang.AFn invoke "AFn.java" 32]
  [clojure.lang.Var invoke "Var.java" 386]
  [clojure.tools.build.api$uber invokeStatic "api.clj" 511]
  [clojure.tools.build.api$uber invoke "api.clj" 439]
  [build_drivers.create_uberjar$create_uberjar_BANG_$fn__4951 invoke "create_uberjar.clj" 82]
  [metabuild_common.steps$do_step invokeStatic "steps.clj" 87]
  [metabuild_common.steps$do_step invoke "steps.clj" 81]
  [build_drivers.create_uberjar$create_uberjar_BANG_ invokeStatic "create_uberjar.clj" 80]
  [build_drivers.create_uberjar$create_uberjar_BANG_ invoke "create_uberjar.clj" 77]
  [build_drivers.build_driver$build_driver_BANG_$fn__6636 invoke "build_driver.clj" 37]
  [metabuild_common.steps$do_step invokeStatic "steps.clj" 87]
  [metabuild_common.steps$do_step invoke "steps.clj" 81]
  [build_drivers.build_driver$build_driver_BANG_ invokeStatic "build_driver.clj" 33]
  [build_drivers.build_driver$build_driver_BANG_ invoke "build_driver.clj" 17]
  [build_drivers.build_driver$build_driver_BANG_ invokeStatic "build_driver.clj" 24]
  [build_drivers.build_driver$build_driver_BANG_ invoke "build_driver.clj" 17]
  [build_drivers$build_drivers_BANG_$fn__6657$fn__6658 invoke "build_drivers.clj" 31]
  [clojure.core$pmap$fn__8582$fn__8583 invoke "core.clj" 7169]
  [clojure.core$binding_conveyor_fn$fn__5842 invoke "core.clj" 2047]
  [clojure.lang.AFn call "AFn.java" 18]
  [java.util.concurrent.FutureTask run "FutureTask.java" 264]
  [java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1128]
  [java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 628]
  [java.lang.Thread run "Thread.java" 829]],
 :cause "Attempting to call unbound fn: #'clojure.tools.build.tasks.uber/uber"}
```

Seems that pmap-ing over the tasks hits a race condition with how the api works

```clojure
(defn uber
  [params]
  (assert-required "uber" params [:class-dir :uber-file])
  (assert-specs "uber" params
    :class-dir ::specs/path
    :uber-file ::specs/path)
  ((requiring-resolve 'clojure.tools.build.tasks.uber/uber) params))
```

So we just require `clojure.tools.build.tasks.uber` so that the
namespace is compiled and ready.
2024-12-05 13:37:56 -06:00
metamben
c2504f4e99 Support desugaring during function (#50903) 2024-12-05 22:31:22 +03:00
Alexander Polyankin
fd0cafeb7b [FE] Move exclude date filter parts to MBQL lib (#50888) 2024-12-05 14:20:52 -05:00
Aleksandr Lesnenko
3e1f18a9cf sankey static viz integration test (#50793) 2024-12-05 12:59:01 -05:00
lbrdnk
89faa64681 Add binning to display name (#50531)
Add binning to display name similarly as done with bucketing.
---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-12-05 17:28:38 +00:00
Oleksandr Yakushev
8e68606eb4 [xlsx-export] Refactor postprocess namespace with perf/concat (#50170) 2024-12-05 18:53:28 +02:00
Chris Truter
26e8f86868 Fix edge cases in New Search around model filtering (#50937) 2024-12-05 15:56:57 +00:00
Nicolò Pretto
4c27ad5fa3 fix(sdk): remove Error.captureStackTrace as it errors on firefox (#50773)
firefox
2024-12-05 15:38:45 +01:00
Oisin Coveney
2c76bd4a92 Migrate favicon logic to mantine hook (#50878) 2024-12-05 16:17:34 +02:00
Chris Truter
8692d9e000 Keep support for the old search engine name (#50876) 2024-12-05 07:31:39 +00:00
Romeo Van Snick
02e80cf2ae Loki flake: make delays configurable independently (#50806)
* Add delay helper

* Remove delays in storybook

* Use skippable delay in ListField and SingleSelectListField

* Use skippable delay in ExplicitSize

* Remove waitTimeContext in storybook

* Remove waitTimeContext altogether

* Add documentation to delay

* Remove all context references in ExplicitSize

* Update flaky snapshots
2024-12-05 11:58:46 +11:00
Case Nelson
6f1f0c02ed fix: Qualify postgres enums outside public schema (#50900)
Fixes: #50771

The new sync process failed to qualify enums outside public and
therefore failed to properly type them in database_type. This could
either result in matching the wrong type if there was a conflict or not
being typed as an enum.
2024-12-04 14:33:49 -07:00
github-automation-metabase
3be2611784 Add v0.52.1 to the list of releases (#50906) 2024-12-04 16:11:56 -05:00
github-automation-metabase
5b3278831c Add v0.51.7 to the list of releases (#50899) 2024-12-04 15:49:13 -05:00
Case Nelson
c592413341 test: syncing views against all drivers (#50236)
* test: see which drivers pass these tests

* Fix build

* Change test to use standard dataset, add initial implementation for bigquery

* Use fully qualified names for views

* Don't use transactions for databricks

* Make drop table only if exists, fix describe-index in mongo for views

* don't sync system.views

* Fix oracle drop-views, disable non-syncing views

* Use metabase-instance to find the table, this is important because redshift and oracle munge table name

* Fix oracle tests

* Fix oracle views

* Fix formatting

* Fix snowflake qualified components

* Change tests to opt out

* Fix sqlsserver

* Fix postgres test

* Disable h2 describe views test

* Address review
2024-12-04 19:43:25 +00:00
metamben
98e0fce497 Deserialize metrics as cards (#50807) 2024-12-04 19:38:33 +00:00
Jeff Bruemmer
88d5b7bc17 docs - verified content (#50885) 2024-12-04 19:31:28 +00:00
Ryan Laurie
ad3fc72b03 Use global e2e helper import (#50156) 2024-12-04 18:17:10 +00:00
Alexander Polyankin
51b73954e1 Move time filter parts to MBQL lib (#50765) 2024-12-04 12:14:14 -05:00
William
85ce744a2b Applying the underlying records filter to a query with a join display… (#50802)
Applying the underlying records filter to a query with a join displays fields from the join
2024-12-04 17:11:27 +00:00
Phoomparin Mano
33915469e3 feat(sdk): add style and className to static dashboards (#50860)
* add style and className to static dashboards

* unify props for static and interactive
2024-12-05 00:01:38 +07:00
Alexander Polyankin
b85e236113 sql-field-filter-types.cy.spec.js flakes (#50881)
* sql-field-filter-types.cy.spec.js flakes

* sql-field-filter-types.cy.spec.js flakes
2024-12-04 16:43:00 +00:00
Uladzimir Havenchyk
32d8726ac9 chore: drop unused CSS (#50861) 2024-12-04 16:24:50 +00:00
Chris Truter
72f70ade32 Finish deprecating old search module namespace (#50852) 2024-12-04 15:32:32 +00:00
Alexander Polyankin
80cd4f3c80 Move filter-parts to MBQL lib (#50752) 2024-12-04 10:29:24 -05:00
Chris Truter
2e73064e94 [search] replace experimental flag with engine choice (#50850) 2024-12-04 16:08:21 +03:00
Nemanja Glumac
e1f2fb96c3 Trial Banner (#49344)
* Add trial banner

* Use the semantic "warning" color for background

* Simplify the "reappearance" logic

* Refine the banner logic

- Pass the bare minimum information (expiry timestamp) to the `TrialBanner`
- Take timezones into account
- Introduce utilities
- Add unit tests

* Update the remaining tests

* Clean up

* Unbreak my `defsetting` 🎶

* Add comments

* Defer var assignment

* Fix failing tests 🤦

* Adjust the types in order to match `master`

* Move the logic up to the parent component

* Convert the `index` component to TS

* Fix typo in the JSDoc

* Fix another typo

* Make the return statement more readable

* Remove redundant test
2024-12-04 12:49:53 +00:00
Alexander Solovyov
9006696ee3 [serdes] do not require prefix when passing entity ids to export (#50786) 2024-12-04 14:04:53 +02:00
Ngoc Khuat
727246d3b1 fix persist model error email (#50843) 2024-12-04 16:16:00 +07:00
Ngoc Khuat
5e6851a8c3 Add more logs for sending notification (#50836) 2024-12-04 10:38:53 +02:00
Raphael Krut-Landau
83f0c60fea Show /api/search errors in Browse models and Browse metrics (#50713) 2024-12-04 00:00:51 -05:00
Nick Fitzpatrick
414048fba0 Properly handle other users personal collections in collection picker (#50605)
* Properly handle other users personal collections in collection picker

* fixing types and unit test
2024-12-03 22:43:23 -04:00
Romeo Van Snick
2b1c6958c0 Split ACE editor into separate component (#50258)
* Move modals out of resizable area

* Split off ace editor from NativeQueryEditor

* Query for selection target in AceEditor

* Rename editor ref

* Add custom type for selection range

* Move more items into shared types file

* Add shared interface for editors

* Add shared Editor wrapper

* Add SQL colors in core/colors.module.css

* Allow importing global css with .global.css

* Move ace styles to AceEditor.global.css

* Fix Range type

* Fix Ace editor tests

* Scope the ace editor styles

* Remove EditorRoot styled component

* Use parent wrapper instead of classname on editor

* Remove ace editor styles from global styles

* Remove custom ace styles from embedding sdk

* Move NativeQueryEditor styles to css modules

* Fix styles for notebook sql preview

* Remove unused props

* Remove unused variable warnings

* Remove width prop

* Rename openDataReferenceAtQuestion and make it optional

* Rename setNativeEditorSelectedRange and make it optional

* Move selection popover logic out of AceEditor

* Make autocompleteResultsFn optional

* Make cardAutocompleteResultsFn optional

* Remove fetchQuestion prop

* Remove nativeEditorSelectedText prop

* Make props explicit

* Make onChange optional

* Set editor height

* Use Editor in NotebookNativePreview

* Remove cardAutocompleteResultsFn and autocompleteResultsFn props from Editor

* Remove unused snippetCollections prop

* Add missing native-query-autocomplete-match-style setting

* Remove snippets from Editor props

* Resize ace editor on load

* Add custom snippets wrapper

* Flatter completer styles

* Add container class to autocomplete popover

* Fix flex size for editor

* Fix AceEditor types

* Flatten ace styles

* Avoid hard-coded color

* Set height and width on editor

* Flatten ace wrapper

* Do not call api with empty prefix

* Add helpers to target native editor

* Use nativeQueryEditor in action helper

* Use nativeQueryEditor in ad hoc helper

* Remove ace_* references from tests

* Align nativeEditor helpers

* Revert "Align nativeEditor helpers"

This reverts commit e629aecb18.

* Move focusNativeEditor to native editor helpers

* Use focusNativeEditor where applicable

* Remove ace_editor references in test

* Fix test

* Remove references to native-query-editor testid in test

* Remove duplicate test assertion

* Fix nesting in css

* Use font-family from variable

* Use default module.css with :global instead of custom .global.css file

* Move AceEditor into subdirectory

* Fix import path

* More strongly type native-query-autocomplete-match-style

* Remove duplicate default

* Rename EditorHandle to EditorRef

* Add more specificity to ace syntax overwrites

* Simplify EditorRef

* Remove HOC

* Do not perform visibility check inside nativeEditor helper

* Explicitly assert elements are visible

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Fix formatting issue

* Add highlight for identifier

* Improve gutter cell

* Use relative imports for helpers

* Focus editor before typing

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-12-04 12:59:10 +11:00
Noah Moss
590951cacb Ensure user count is fetched within token status memoization (#50813) 2024-12-03 23:18:58 +00:00
Phoomparin Mano
35ec452c6c feat(sdk): rename prop names to be clear and explicit (#50656)
* rename onClose to onCancel

* rename questionHeight to drillThroughQuestionHeight

* rename showVisualizationSelector to withVisualizationSelector

* rename parameter value props

* doc updates for parameter values

* rename the chart type selector prop

* document the withChartTypeSelector prop
2024-12-04 05:19:40 +07:00
Jeff Bruemmer
63ce443b49 docs - commands (#50784) 2024-12-03 17:03:59 -05:00
Nemanja Glumac
44dd5df5da Onboarding checklist - misc. follow ups (#50579)
* Fix the help link

* Update data stack image

* Fix the link appearance
2024-12-03 21:55:27 +00:00
Sloan Sparger
4e8404d3b7 [Clean up] Hide clean up UI in sample collections (#50760)
* hides clean up ui on sample collections

* commit unsaved changes

* pr feedback
2024-12-03 15:51:10 -06:00
Uladzimir Havenchyk
33ff237b59 fix(ObjectDetail): do not show popup when click on View More (#50745) 2024-12-04 00:15:38 +03:00
Nick Fitzpatrick
703638cd10 removing the 'can_write' requirement for selecting things via the question picker (#50783) 2024-12-03 16:21:31 -04:00
Uladzimir Havenchyk
142306a3f7 fix: do not show popup when click on View More (#50745) 2024-12-03 19:47:45 +00:00
Uladzimir Havenchyk
9401a0ba6f fix: do not show popup when click on View More (#50745) 2024-12-03 19:47:31 +00:00
github-actions[bot]
b4aa704be6 Update Translations for v52.1 (#50534)
* Add new strings for v52.0

* Update translations

---------

Co-authored-by: github-actions <github-actions@github.com>
2024-12-03 19:20:18 +00:00
Nemanja Glumac
f5e63b4001 Introduce the non-admin Onboarding Checklist (#50516)
* Add new selectors

* Adjust the onboarding checklist for non-admins

* Add unit tests for non-admins

* Rename the control knob

* Fix the forgotten test

* Stop guarding the route for admins only

* Translate `alt` tags

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* Translate `alt` tags

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* Add e2e coverage for non-admins

* Refine selectors

* Improve the route guard

* Increase E2E coverage for route guards

---------

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-12-03 19:23:38 +01:00
Nicolò Pretto
2d9d447492 fix(sdk): introduce .mb-wrapper to scope down our css (#50466)
* add tests for css rules not scoped to the sdk

* fix(sdk): adds mb-wrapper class and scope css to it

* fix typo

* add .mb-wrapper to the body on storybook
diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
index 52a0d45125d..a4b3a86f4a5 100644
--- a/.storybook/preview.tsx
+++ b/.storybook/preview.tsx
@@ -42,15 +42,20 @@ const globalStyles = css`
 export const decorators = isEmbeddingSDK
   ? [] // No decorators for Embedding SDK stories, as we want to simulate real use cases
   : [
-      renderStory => (
-        <EmotionCacheProvider>
-          <ThemeProvider>
-            <Global styles={globalStyles} />
-            <CssVariables />
-            {renderStory()}
-          </ThemeProvider>
-        </EmotionCacheProvider>
-      ),
+      renderStory => {
+        if (!document.body.classList.contains("mb-wrapper")) {
+          document.body.classList.add("mb-wrapper");
+        }
+        return (
+          <EmotionCacheProvider>
+            <ThemeProvider>
+              <Global styles={globalStyles} />
+              <CssVariables />
+              {renderStory()}
+            </ThemeProvider>
+          </EmotionCacheProvider>
+        );
+      },
     ];

 function CssVariables() {
2024-12-03 18:19:50 +01:00
Aleksandr Lesnenko
0f9bb8045b fix narrow ordinal line charts have no tooltip (#50715) 2024-12-03 17:02:01 +00:00
Noah Moss
aa0a444be4 Remove memoization of active user counts setting (#50779) 2024-12-03 16:27:53 +00:00
Aleksandr Lesnenko
c7e8d6cae5 Address feedback on Sankey (#50611)
* do not show column selection error on empty datasets

* add more specs to chart-definition logic

* fix entry nodes tooltip and click behavior values

* fix nodes formatting

* do not show sankey data settings on dashboards

* do not initiallt open sankey data columns selects

* hide sankey tooltip on scroll

* drop incorrect types

* set sankey node limit

* prevent clicks on edges close tooltips on native sankey questions

* tweak copy

* update sankey spec according to fixes

* revert changed settings behavior

* fix unit specs
2024-12-03 10:20:24 -05:00
dpsutton
16117c6423 Fix logging with conflict handlers (#50723)
* Fix logging with conflict handlers

Information:
https://github.com/seancorfield/depstar
https://github.com/seancorfield/build-uber-log4j2-handler

Gist is that log4j needs all of it's plugin files merged into one
file. Lots of
`META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat`
files become one.

In our jar currently it is 3247 bytes. In older good jars it is 28463
bytes.

Before:

```
❯ MB_JETTY_PORT=3006 java -jar before.jar
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
2024-12-02T03:58:45.591114Z main ERROR Unrecognized format specifier [d]
2024-12-02T03:58:45.592271Z main ERROR Unrecognized conversion specifier [d] starting at position 16 in conversion pattern.
2024-12-02T03:58:45.592893Z main ERROR Unrecognized format specifier [thread]
2024-12-02T03:58:45.592989Z main ERROR Unrecognized conversion specifier [thread] starting at position 25 in conversion pattern.
2024-12-02T03:58:45.593101Z main ERROR Unrecognized format specifier [level]
2024-12-02T03:58:45.593187Z main ERROR Unrecognized conversion specifier [level] starting at position 35 in conversion pattern.
2024-12-02T03:58:45.593291Z main ERROR Unrecognized format specifier [logger]
2024-12-02T03:58:45.593375Z main ERROR Unrecognized conversion specifier [logger] starting at position 47 in conversion pattern.
2024-12-02T03:58:45.593459Z main ERROR Unrecognized format specifier [msg]
2024-12-02T03:58:45.593541Z main ERROR Unrecognized conversion specifier [msg] starting at position 54 in conversion pattern.
2024-12-02T03:58:45.593628Z main ERROR Unrecognized format specifier [n]
2024-12-02T03:58:45.593710Z main ERROR Unrecognized conversion specifier [n] starting at position 56 in conversion pattern.
2024-12-02T03:58:45.603389Z main ERROR Reconfiguration failed: No configuration found for 'Default' at 'null' in 'null'
WARNING: infinite? already refers to: #'clojure.core/infinite? in namespace: kixi.stats.core, being replaced by: #'kixi.stats.math/infinite?

UPDATE SUMMARY
Run:                        436
Previously run:               0
Filtered out:                52
-------------------------------
Total change sets:          488

FILTERED CHANGE SETS SUMMARY
DBMS mismatch:               52
```

And now after:

```
❯ MB_JETTY_PORT=3007 java -jar after.jar
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
2024-12-01 21:58:49,892 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
2024-12-01 21:58:51,121 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. 🔓
 For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
2024-12-01 21:58:51,591 WARN db.env :: WARNING: Using Metabase with an H2 application database is not recommended for production deployments. For production deployments, we highly recommend using Postgres, MySQL, or MariaDB instead. If you decide to continue to use H2, please be sure to back up the database file regularly. For more information, see https://metabase.com/docs/latest/operations-guide/migrating-from-h2.html
WARNING: infinite? already refers to: #'clojure.core/infinite? in namespace: kixi.stats.core, being replaced by: #'kixi.stats.math/infinite?
2024-12-01 21:58:54,353 INFO driver.impl :: Registered abstract driver :sql  🚚
2024-12-01 21:58:54,375 INFO driver.impl :: Registered abstract driver :sql-jdbc (parents: [:sql]) 🚚
2024-12-01 21:58:54,379 INFO metabase.util :: Load driver :sql-jdbc took 7.3 ms
2024-12-01 21:58:54,379 INFO driver.impl :: Registered driver :h2 (parents: [:sql-jdbc]) 🚚
2024-12-01 21:58:54,525 INFO driver.impl :: Registered driver :mysql (parents: [:sql-jdbc]) 🚚
2024-12-01 21:58:54,543 INFO driver.impl :: Registered driver :postgres (parents: [:sql-jdbc]) 🚚
2024-12-01 21:58:54,642 INFO util.namespaces :: Loading namespace: metabase.notification.payload.impl.alert
2024-12-01 21:58:54,646 INFO util.namespaces :: Loading namespace: metabase.notification.payload.impl.dashboard-subscription
2024-12-01 21:58:54,648 INFO util.namespaces :: Loading namespace: metabase.notification.payload.impl.system-event
2024-12-01 21:58:54,655 INFO util.namespaces :: Loading namespace: metabase.channel.impl.email
2024-12-01 21:58:54,663 INFO util.namespaces :: Loading namespace: metabase.channel.impl.http
2024-12-01 21:58:54,667 INFO util.namespaces :: Loading namespace: metabase.channel.impl.slack
2024-12-01 21:58:55,520 INFO metabase.core ::
Metabase v0.52.1-SNAPSHOT (3e7a8a4)

Copyright © 2024 Metabase, Inc.

Metabase Enterprise Edition extensions are NOT PRESENT.
2024-12-01 21:58:55,522 INFO metabase.core :: Starting Metabase in STANDALONE mode
2024-12-01 21:58:55,550 INFO metabase.server :: Launching Embedded Jetty Webserver with config:
 {:port 3007}
```

* formatting fix
2024-12-03 10:08:26 -05:00
adam-james
18bfb20523 Pivot Exports Can Handle nil in Breakout Col, and Multiple Cols of the Same Aggregation Type (#50672)
* Pivot Exports Can Handle `nil` in Breakout Col, and Multiple Cols of the Same Aggregation Type

Fixes #50551

If a pivot table has several measures configured, they might both use the same kind of
aggregation (eg. 'sum'). Previously, this would lead to columns with the same name preventing the pivot-measures from
properly making it through the export post processing. Now, the correct aliased/deduped name is used and all columns
can be properly included in the pivot export.

Also fixes the case where a breakout column (pivot-row) contains `nil` values, which caused the pivot export to
fail. Now, all nil values are grouped and handled appropriately.

* when pivot is disabled, header should still be included

* min and max don't default to 0, add a test for the aggregations
2024-12-03 06:40:59 -08:00
Nemanja Glumac
bf184ac3da Fix a (native-ace-editor) flake 30039 (#50774) 2024-12-03 13:36:21 +01:00
Ngoc Khuat
37acc7e854 [Notification] Rename notification types (#50768)
- notification/alert -> notification/card
- notification/dashboard-subscription -> notification/dashboard
2024-12-03 10:24:23 +00:00
Kamil Mielnik
e2a8d43ed5 Implement new EntityObjectLoaderRtkQuery that uses RTK Query hooks (#44523)
* Add EntityObjectLoaderRtkQuery boilerplate

* Incorporate EntityType logic into the new component

* Improve comment

* Add childrenProps

* Move component into its own directory, extract types to a separate file

* Add entityObjectLoaderRtkQuery and temporary mappings

* Hook up the useGetQuery hook (tables only)

* Pass all the props to children

* Add Playground

* Gather more info in the Playground

* Integrate RTK with redux store

* Adjust props passed down

* Improve typing

* Make the request hook dynamic

* Add missing id in the query

* Handle fetchMetadata

* Change requestType to fetchType

* Add rtk mappings for databases in entity framework

* Use requestType to get request state path

* Enable new component everywhere

* Use legacy loader for entities without rtk mappings

* Improve comment

* Handle fetchMetadataAndForeignTables

* Remove unused function

* Handle reload and remove

* Add TODO

* Add transformResponse option and use it for fetchIdFields

* Format code

* Remove Playground

* Remove unused getUseGetListQuery

* Add rtk mapping for alerts

* Add rtk mapping for dashboards

* Add rtk mapping for groups

* Add rtk mapping for pulses

* Remove options

* Fix permissions tests

* Fix notifications tests

* Add rtk mapping for segments

* Use params instead of body
- It's leftover because this code got reverted after body -> params refactoring for GET endpoint has been merged to master

* Add rtk mapping for snippet collections

* Add TODO

* ESLint

* ESLint

* Update TODO

* Deprecate entity HOCs

* Update TODO

* Revert other entities for now

* Revert other entities for now

* Bring tables back

* Improve todos

* Add comment

* Improve comment

* Remove TODO

* Use reload param

* Remove properties prop

This was used to short-circuit and avoid triggering api calls if we already had an object with given attributes in cache.
With RTK query now managing the cache, we don't want to reproduce this behavior.

* Remove reloadInterval

This is used in EntityListLoader, not EntityObjectLoader

* Don't use setRequestPromise action

* Fix deprecations

* Format code

* Fix flake :(

* Try to fix flake

* Revert "Try to fix flake"

This reverts commit 6408a22a37.

* Try to fix flake

* Fix UseQuery type

* Implement useGetMetadataAndForeignTables

* Fix useMemo and move things down

* Fix typo

* Bring back original hack

* Move file

* Add comment
2024-12-03 08:28:55 +00:00
Raphael Krut-Landau
07ee64373f Make e2e tests of embedding and sql filters date-invariant (#50737) 2024-12-02 23:20:03 -05:00
Nathan Voxland
c63bfcf186 Added nvoxland to team config files (#50761) 2024-12-02 17:03:39 -06:00
William
499553cc74 Add wzimrin to teams and github-slack-map (#50756) 2024-12-02 14:38:28 -06:00
Jeff Bruemmer
8e95128018 update chart list (#50743) 2024-12-02 15:02:03 -05:00
Alex Yarosh
1470cb1abe docs: serialization clarification (#50601)
* serialization clarification

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-12-02 15:01:46 -05:00
Alexander Polyankin
68f645545d Partially fix flaky native e2e tests (#50710) 2024-12-02 12:21:59 -05:00
Samy Djemaï
caadb4cfd6 docs: fix log4j configurationFile arg path for docker command (#38121) 2024-12-02 09:06:09 -05:00
Chris Truter
0cd2032a35 Fix Quartz rescheduling with multiple triggers (#50707) 2024-12-02 11:27:39 +02:00
Ngoc Khuat
b26eca90b9 Deprecate alert and pulse apis (#50453) 2024-12-02 05:32:45 +00:00
Chris Truter
3e7a8a4e48 Fix NPE on search model calculation, and improve testing story (#50717) 2024-11-30 22:24:55 +03:00
Aleksandr Lesnenko
d5b09bc9e0 fix loki-update label is not removed after the job (#50607)
* fix loki-update label is not removed after the job

* Update Loki Snapshots

* Update Loki Snapshots

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-11-30 04:10:51 +00:00
Gustavo Saiani
8b8bbc66a4 Include in-page-promo in embedding docs pages (#50359) 2024-11-30 01:40:11 +00:00
Denis Berezin
299b698cd4 Migrate Slack channel picker field to use mantine autocomplete (#50661)
* Migrate Slack channel picker field to use mantine autocomplete

* Fix limit size

* Fix limit size
2024-11-30 00:20:09 +03:00
Phoomparin Mano
0c8b9a133b Cache static assets without hash length restriction (#50703)
* match against any hexadecimal bundle name

* add e2e tests skeleton

* Support display-name for ISO get-day-of-week exclusion expressions (#50606)

* Support display-name for ISO get-day-of-week exclusion expressions

Fixes #50574

* Fix light theme embeddings has different text colors (#50678)

* add cache-control tests

* support local runs

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-29 17:35:22 -03:00
Alexander Polyankin
fa6f4762cc Fix custom expressions with multiple arguments - contains, does-not-contain, starts-with, ends-with (#50480)
* adjustMultiArgOptions

* adjustMultiArgOptions

* Fix options

* Fix options

* Add a comment

* Fix tests

* Fix tests

* Add tests

* Tests

* Add tests

* Add tests

* Add tests
2024-11-29 15:30:53 -05:00
Phoomparin Mano
6e407f15aa feat(sdk): add withChartTypeSelector prop to InteractiveQuestion (#50664)
* add withVisualizationSelector prop

* add tests

* add to docs

* use default layout in tests

* only use custom layout when needed

* make withChartTypeSelector false by default
2024-11-30 03:23:01 +07:00
Aleksandr Lesnenko
167b1b6f87 update token status types (#50669) 2024-11-29 15:11:57 -05:00
metamben
e105de0219 Support extraction expressions in filter-args-display-name (#50694)
Fixes #50670
2024-11-29 20:04:58 +00:00
Phoomparin Mano
87b60ba547 feat(sdk): use string types for specifying entity ids instead of internal nanoid type (#50663) 2024-11-30 02:48:58 +07:00
Chris Truter
fd0954aeb7 Improve Search Index clean-up and re-enable some tests (#50687) 2024-11-29 18:25:49 +00:00
Alexander Solovyov
755256a800 top-level LICENSE conflicts with other files breaking uberjar build (#50691) 2024-11-29 18:17:13 +00:00
Braden Shepherdson
29428b7c80 [dev] Add dev.portal/diff->, drop-in -> that sends diffs to Portal (#50470)
Adds `dev.portal/diff->`, a drop-in replacement for `->` that `tap>`s
a diff at each stage. (With the metadata for Portal to default to diff viewer)

I found myself wanting this several times while debugging the refs overhaul.
2024-11-29 17:55:06 +00:00
github-automation-metabase
5d7ac6573a Add v0.51.6 to the list of releases (#50640)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-11-29 12:49:36 -05:00
Alexander Solovyov
81c0389fe9 return better errors when request contains malformed JSON (#50629) 2024-11-29 20:42:18 +03:00
Braden Shepherdson
6f1d9cbdd3 [refs] Generate idents for new clauses in MBQL lib (#50083)
Specifically, for expressions, aggregations, breakouts, and joins.
Adds MBQL lib unit tests for this behaviour.

Currently these idents are discarded during `lib.convert` and don't
survive a round trip to legacy. That will come with a later change.
2024-11-29 11:56:07 -05:00
Alexander Polyankin
3159eda4dc Old data picker in notebook for embedding (#50535) 2024-11-29 10:49:47 -05:00
github-automation-metabase
7030df04e8 Update Readme version references and published npm version to 0.52.3-nightly (#50696) 2024-11-29 15:42:12 +00:00
Chris Truter
1ab92fde40 Extra Search Rankers for exact matches and things you own (#50684) 2024-11-29 15:27:49 +00:00
Mahatthana (Kelvin) Nomsawadi
3e0b03e8fd Fix light theme embeddings has different text colors (#50678) 2024-11-29 14:22:37 +00:00
metamben
b403648472 Support display-name for ISO get-day-of-week exclusion expressions (#50606)
* Support display-name for ISO get-day-of-week exclusion expressions

Fixes #50574
2024-11-29 16:26:37 +03:00
Alexander Solovyov
84b0948e60 rename team, acquire Denis :) (#50682) 2024-11-29 15:53:48 +03:00
Alexander Solovyov
bb6428e537 update all that updates (#50642) 2024-11-29 15:48:24 +03:00
Oleksandr Yakushev
7368fb1de1 Introduce metabase.util.json to encapsulate usage of the underlying JSON library (#50353)
* Add metabase.util.json

* Replace direct Cheshire usage with metabase.util.json

* Add cheshire namespaces to :discouraged-namespaces in Kondo
2024-11-29 12:10:42 +00:00
Chris Truter
fe8f1f9a9d Use separate indexes for different versions (#50620)
This protects against us trying to read or write from an incompatible search index. In particular it prevents existing instances from being switched over to an incompatible table during an HA upgrade or downgrade.

~~It doesn't yet get rid of the needless re-initialization, but that will be a fast follow.~~ It breaks up the jobs so that we won't reindex on startup unless necessary.
2024-11-29 12:04:56 +02:00
Chris Truter
7a52063c5c Take default Search weights from Stats (#50674) 2024-11-29 09:06:55 +00:00
Chris Truter
b4e22eb6b0 Keep Search Index metadata sync'd via setting (#50581)
See https://www.notion.so/metabase/Search-Index-Maintenance-14b69354c9018047b670cbba1c3be50d

This ensures that when one instance starts or finishes reindexing, the other instances pick up and switch to the same tables.

Note: this does not stop blowing away the currently active table on deployment yet, we need to have a notion of version for that first.
2024-11-29 10:59:53 +02:00
Chris Truter
8f41692cb0 Avoid renaming Search Index tables (#50573)
This also avoids a brittle song and dance with non-authoritative atoms in the background. Now we juggle authoritative atoms all the time 😄
2024-11-29 09:45:42 +02:00
Denis Berezin
43092b1d2a Fix slack post recurrence field label (#50666) 2024-11-29 01:23:35 +03:00
appleby
bd3542401a Enable underlying-records drill in table viz for multi-stage queries (#50556)
* Enable underlying-records drill in table viz for multi-stage queries

* Fix e2e test

* Add tests for underyling-records drill for multi-stage queries

* Review feedback: filterv not-empty etc

* Review feedback: add a breakout-only query to drill-thru canned-queries
2024-11-28 13:53:31 -08:00
Aleksandr Lesnenko
9cc1a46c8a simplify use-license (#50613)
* simplify use-license

* rip moment
2024-11-28 14:14:36 -05:00
Phoomparin Mano
69958ce424 ci(sdk): remove unreliable loading indicator e2e for create question (#50555) 2024-11-28 23:30:31 +07:00
Alexander Solovyov
138560b595 skip META-INF/LICENSE since it conflicts with other licenses on MacOS (#50638) 2024-11-28 14:46:58 +00:00
Aleksandr Lesnenko
dda69aa5f8 Sankey polish (#50550)
* do not show column selection error on empty datasets

* persist default sankey column settings when saving

* add more specs to chart-definition logic

* more specs
2024-11-28 08:21:43 -05:00
Alexander Solovyov
6838a0793b update bigquery and netty (#50588) 2024-11-28 10:23:16 +03:00
adam-james
c45ea5c5ef Table Column Ordering Should Not Prevent Pivot Exports (#50599)
* Table Column Ordering Should Not Prevent Pivot Exports

Prior, when viz-settings existed for table column ordering, or if some columns were hidden in a regular table viz, the
pivot export could fail.

Now, if a pivot table is being exported, the table column sorting is properly ignored and the pivot export should work.

* address feedback
2024-11-28 02:36:16 +00:00
Denis Berezin
41dca76232 Fix issue with cypress config for e2e cross version tests (#50592) 2024-11-27 19:35:25 +00:00
Phoomparin Mano
8c2b6e8945 feat(sdk): make tooltips themeable (#50457)
* add background-inverse color mapping

* add tooltip themes

* tooltip theming

* apply to echarts tooltip

* update tooltip default color

* update tooltip defaults

* add sdk color mapping

* add additional theme colors

* add echarts tooltip story

* add loki tests

* remove background-inverse theme color option

* add to docs

* use ChartTooltipRoot for story and update loki snapshot

* update secondaryTextColor docstring

* fix unit tests
2024-11-27 18:38:29 +00:00
Phoomparin Mano
90979e9abd fix(sdk): entity picker theming fixes (#50449)
* use css variables for skeleton background color

* apply theme to folder color

* replace theme.white with themeColor

* use name of folder chevron color

* add background-inverse color mapping

* Revert "add background-inverse color mapping"

This reverts commit d0b546c583.

* avoid overriding folder chevron color in emotion

* use Mantine style overrides for NavLink
2024-11-28 00:27:12 +07:00
adam-james
f6aafc34b6 Backend Dependency Bump (#46309)
Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-11-27 17:13:04 +00:00
Chris Truter
0c964fe87c Fix CSV upload when materialized views are present (#50557)
Fixes https://github.com/metabase/metabase/issues/50501
2024-11-27 19:05:57 +02:00
Cam Saul
c6e9700797 Fix building with Java 11 and stop using Depstar (#50062) 2024-11-27 18:32:43 +03:00
Jeff Bruemmer
cab4af2e02 docs - notes on transparent embeds (#50377) 2024-11-27 14:58:26 +00:00
metamben
51d6ba5b6c Implement ISO day of week extraction (#50475)
* Implement ISO day of week extraction

Fixes #50424
2024-11-27 16:18:50 +03:00
Denis Berezin
1686e8a692 feat(sdk): Add cross-version e2e tests using a published SDK package (#50423) 2024-11-27 15:45:32 +03:00
Nicolò Pretto
fb0cf744e7 fix(sdk): make modals use the correct portal (#50565)
---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-27 13:32:09 +01:00
Chris Truter
89dbffbee5 Basic test for search reindexing (#50560) 2024-11-27 11:23:31 +00:00
lbrdnk
201a2ebee4 [Databricks] Add catalog validation into can-connect? implementation (#50468)
* Add catalog validation in can-connect? implementation

* Remove redundant let

* Adjust description

* Update modules/drivers/databricks/src/metabase/driver/databricks.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-11-27 11:06:09 +01:00
Chris Truter
134702499b Enable New Search by default (#50520) 2024-11-27 06:36:23 +00:00
Chris Truter
b8c2c4b14d Send separate events for CSV appending and replacing (#50525) 2024-11-27 08:07:27 +02:00
Aleksandr Lesnenko
8d380fe7d1 temporarily hiding group into other (#50511)
* temporarily hiding group into other

* hide group into other

* remove assertions related to group into other

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-11-26 20:38:03 -05:00
Tyler Plude
0e7c6effa8 Adding .png version of no_results.svg to fix #49012 (#50426)
* Adding .png version of no_results.svg to fix #49012

* Adjusting text color to  to match existing color scheme

* Removing old unused no results assets; adding new png version of no_results.svg at matching resolution to pulse_no_results@2x.png

* Fixing namespace import cycle
2024-11-26 15:04:43 -08:00
Case Nelson
4ed8196c6d fix: snowflake allow setting schema to use (#50528)
Fixes: #50422

Although we passed additional-options through subname in url parameters
to DriverManager, we were also passing `:schema nil` as connection property.
2024-11-26 21:46:55 +00:00
Ryan Laurie
e118f02238 Fix embedding test build (#50542) 2024-11-26 14:40:41 -07:00
Jeff Bruemmer
1cfb805d94 docs - add expressions to list (#50473) 2024-11-26 15:52:41 -05:00
Jeff Bruemmer
af37dadef4 docs - Sankey (#50524) 2024-11-26 20:50:50 +00:00
adam-james
6780a67b53 Pivot Export Aggregations Improved and Won't Error (#50380)
* Pivot Export Aggregations Improved and Won't Error

Fixes #50207

WIP

- Totals now have appropriate aggregation implementation
- Totals for different row and column partial paths could collide before (eg. if a pivot-col value was equal to the
- measure idx), now the paths are unique and will not collide, causing errors

* add a test

* multiple measures need to have the correct order in each row

* clean up, add some comments explaining totals paths

* fix tests

* add test to show add-rows working correctly after :rows-part :cols-part added
2024-11-26 19:54:51 +00:00
bryan
26190d82c3 remove pivot-grouping row and columns in tandem (#50476)
* remove pivot-grouping row and columns in tandem

* add pivot card scalar test for csvs and xlsx.

* improve test feedback

* add a 'todo' for pivoted json exports

* indent
2024-11-26 12:32:24 -07:00
bryan
f1ee606e3a update our bug report template placeholder (#50519)
- so the placeholder matches the expected input
2024-11-26 12:32:15 -07:00
Chris Truter
79ca4f498a Restructure Search Module (#50471) 2024-11-26 18:25:21 +00:00
Alexander Polyankin
f584ab658d Use DataSelector in Field remapping options and delete unused legacy MBQL code (#50458) 2024-11-26 17:28:13 +00:00
Kamil Mielnik
202322f93d Add stage-number parameter to NativeParameterDimensionTarget (#50494)
* Add stage-number parameter to NativeParameterDimensionTarget

* Update unit test

* Recognize native query dimension parameters with stage-number

* Update test setup

---------

Co-authored-by: Tamás Benkő <tamas@metabase.com>
2024-11-26 16:48:21 +00:00
Alexander Polyankin
b7ab04d726 Use relative-time-interval in the QP for parameters (#50417) 2024-11-26 16:37:38 +00:00
Ryan Laurie
cfff2e84d4 Extend milestone setter timeout (#50515) 2024-11-26 16:11:09 +00:00
Mahatthana (Kelvin) Nomsawadi
ee23a50124 Disable ?locale on static embeds/public links (#50391)
* Disable `?locale` on static embeds/public links

* Fix E2E tests

* Add a new line for consistency
2024-11-26 15:13:36 +00:00
Alberto Perdomo
a4363903c1 Update links for SDK npm so they actually point to the npm page (#50499)
* Update link to SDK npm page

* Update link to SDK npm page
2024-11-26 15:02:05 +00:00
Chris Truter
ce5f60b7ca Enable New Search tests in CI (#50386) 2024-11-26 14:50:12 +00:00
Aleksandr Lesnenko
948bd56469 fix inability to select breakout dimension before metric (#50433) 2024-11-26 09:38:32 -05:00
github-automation-metabase
b90620b0d9 Add v0.51.5 to the list of releases (#50507)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-11-26 09:04:44 -05:00
Alexander Polyankin
87a28bab93 Fix pivot collapsed rows with legacy viz settings (#50410) 2024-11-25 19:31:36 -05:00
Romeo Van Snick
54a356a60a Replace postcss-nesting with postcss-nested (#50437)
* Add postcss-nested

* Use postcss-nested over postcss-nesting
2024-11-26 09:11:40 +11:00
Chris Truter
162437a227 Delete Hybrid Index Search (#50444) 2024-11-25 19:47:51 +00:00
Phoomparin Mano
7828b5e291 fix(sdk): show loader right after visualizing in notebook editor for the first time (#50411)
* show sdk loading state when visualizing for the first time

* rename to isQueryResultLoading

* check for loading indicator

* add notes on slow 3G
2024-11-26 02:37:57 +07:00
Aleksandr Lesnenko
095f1a1a74 sankey chart visual tests (#49457)
* sankey visual specs, polish

* Update Loki Snapshots

* improve type

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-11-25 18:04:13 +00:00
John Swanson
25bab869a4 Don't dissoc :id in before-update (#50375)
* Don't dissoc `:id` in `before-update`

There seems to be a nasty footgun in toucan2 here.

Say you're executing an `update!` command on a set of IDs, e.g.:

```
(t2/update! :model/Card :id [:in 1 2] {:view_count 1})
```

This works if:

- both cards 1 and 2 have `view_count=1` already

- both cards 1 and 2 have `view_count!=1`

However.

If one of the two cards has `view_count=1` and another has a different
view_count, then (if the `before-update` method doesn't have the primary
key attached) Toucan emits a call to update *every card in the
database*, without a where clause at all.
2024-11-25 08:26:59 -08:00
Mahatthana (Kelvin) Nomsawadi
c7e0bc4cf8 docs(sdk): Manually update chaneglog for master (#50447)
* Manually update chaneglog for master

* Update more changelog entry

Co-authored-by: Nicolò Pretto <info@npretto.com>

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-11-25 14:10:51 +00:00
Alberto Perdomo
62333310e3 Update npm packages from 1.xx.y to 0.xx.y (#50409) 2024-11-25 09:54:08 +00:00
Romeo Van Snick
5f86ebe6ee Simplify epic template to allow for easier editing (#50248)
* Simplify epic template to require easier editing

* Remove superflouous 'if any'

* Rename engineering doc to technical design doc

* Add link for testing plan

* Remove feature branch sentence
2024-11-25 14:38:41 +11:00
Denis Berezin
075163202f feat(sdk): migrate existing sdk tests to cypress component testing
* feat(sdk): migrate existing sdk tests to cypress component testing

* Self review
2024-11-23 10:05:05 +00:00
Cam Saul
d436dafd2c CI: Create dummy successful jobs for skipped driver jobs (#50432)
* Trigger CI tests

* Add dummy job generator

* [DO NOT MERGE] Remove driver test config from the list of backend changes

* Add missing runs-on

* Avoid too much nesting

* Revert changes to file paths and README
2024-11-22 23:39:39 +00:00
Kamil Mielnik
6694870932 [Epic] Show columns from all stages in the dashboard filters (#47167)
* FE - Allow to use in dashboard filters both pre- and post- last aggregation columns (#46670)

* Extract getFilterStageIndexes

* Update comment

* Include 2 last stages in filterable columns in getParameterColumns

* Move getJoinQueryHelpers to test-helpers

* Add basic query creation

* Add breakout columns

* Make tableName optional

* Implement 1-stage test, refactor assertions

* Rename

* Move filter utils up

* Use getGroupItems and appendStageIfAggregated in getFilterableColums

* Introduce Lib.filterGroups

* Revert "Introduce Lib.filterGroups"

This reverts commit 5f8b2d098e.

* Don't reuse getGroupItems or appendStageIfAggregated

* Move getFilterStageIndexes out of Lib

* Format code

* Revert types move

* Revert functions move

* Improve diff

* Group dashcard mapping options

* Adjust existing getParameterColumns usages (except unit tests)

* Remove redundant call

* Fix filtering

* Update unit tests

* Format code, remove TODO

* Add stage index assertions

* Add model test for 1-stage query

* Add partial boilerplate for 2-stage query

* Add a 2-stage case

* Add a 2-stage case for model

* Update unit test

* Fix click behavior mapping

* Remove duplicated functions

* Remove complex return type

* Move appendStageIfAggregated and getFilterStageIndexes to metabase-lib/filter.ts

* Re-group columns based on stage index instead of using ML-returned references for comparison

* Add new options to dimension types

* Use the new stage-number option

* Rename appendStageIfSummarized to ensureFilterStage and add explanatory comment

* Remove duplicated ensureFilterStage after merge

* FE - e2e - Cover dashboard filters with tests (#46958)

* Extract getFilterStageIndexes

* Update comment

* Include 2 last stages in filterable columns in getParameterColumns

* Move getJoinQueryHelpers to test-helpers

* Add basic query creation

* Add breakout columns

* Make tableName optional

* Implement 1-stage test, refactor assertions

* Rename

* Move filter utils up

* Use getGroupItems and appendStageIfAggregated in getFilterableColums

* Introduce Lib.filterGroups

* Revert "Introduce Lib.filterGroups"

This reverts commit 5f8b2d098e.

* Don't reuse getGroupItems or appendStageIfAggregated

* Move getFilterStageIndexes out of Lib

* Format code

* Revert types move

* Revert functions move

* Improve diff

* Group dashcard mapping options

* Adjust existing getParameterColumns usages (except unit tests)

* Remove redundant call

* Fix filtering

* Update unit tests

* Format code, remove TODO

* Add stage index assertions

* Add model test for 1-stage query

* Add partial boilerplate for 2-stage query

* Add a 2-stage case

* Add a 2-stage case for model

* Update unit test

* Fix click behavior mapping

* Remove duplicated functions

* Remove complex return type

* Remove unused @ts-expect-error directive
- use createQuestionAndDashboard helper instead of command
- sort imports

* Add boilerplate for query stages test suite

* Add createDashboard

* Try out the new function

* Organize code

* Add descriptions

* Move visitDashboard call out of createDashboard

* Move appendStageIfAggregated and getFilterStageIndexes to metabase-lib/filter.ts

* Re-group columns based on stage index instead of using ML-returned references for comparison

* Add boilerplate for base questions

* Add assertions for mapping options

* Simplify verifyDashcardMappingOptions interface

* Add assertions for all types of parameters

* Update test name

* Format code

* Add new options to dimension types

* Use the new stage-number option

* Add Q2 creation

* Introduce helper constants

* Rename appendStageIfSummarized to ensureFilterStage and add explanatory comment

* Add cases for models

* Extract subroutines

* Add Q3

* Extract createQ2Query and createQ3Query

* Extract createQ1uery, remove createM1

* Optimize verifyPopoverMappingOptions

* Add more assertions

* Add model assertions

* Add tooltip assertion

* Break large functions down

* Restructure tests to prevent memory-related crashes

* Refactor

* Update comment

* Update comment

* Remove createQ1

* Remove createQ2, createQ3

* Refactor

* Refactor

* Comment out failing assertions

* Add Q3 assertions

* Add Q3 assertions

* Add comment

* Introduce createAndVisitDashboardWithQueryMatrix

* Add Q4

* Fix assertions

* Add repro tags

* Add comment

* De-hardcode indexes

* Add Q5-Q8

* Rename

* Add Q5

* Add Q6

* Add Q7 & Q8

* Add Q9

* Fix structure

* Reuse Lib.ensureFilterStage

* Fix unit of time parameters

* Support explicit and implicit stage numbers for temporal-unit params

* Extend test with temporal unit parameter with stage number

* Update unit tests

* Let stage-path handle nil (default) stage-number

---------

Co-authored-by: Tamás Benkő <tamas@metabase.com>

* Allow filtering on columns from all stages in dashboards (#48254)

* Allow filtering on columns from all stages in dashboards

* Update tests

* Clean up

* Update unit tests

* Distinguish multiple "Summaries" column groups in dashboard filter mapping (#48261)

* Allow filtering on columns from all stages in dashboards

* Update tests

* Clean up

* Update unit tests

* Distinguish multiple "Summaries" column groups

* Fix imports

* Remove redundant attribute

* Update import

* Allow filter params targeting native stages (#48379)

* Move filters on nested native stages to parent stage in expand-mbql-params

Similar to the existing handling in move-join-condition-to-source-query.

This fixes filter params that directly target a native stage with a non-negative :stage-number, e.g. when applying
dashboard filters to a card where the card query is native.

Fixes #48258

* Add test for filter params explicitly targeting nested native queries

* FE - e2e - Cover dashboard drills with tests (#48289)

* Allow filtering on columns from all stages in dashboards

* Update tests

* Clean up

* Update unit tests

* Distinguish multiple "Summaries" column groups

* Fix imports

* Remove redundant attribute

* Fix type

* Add a test

* Add a test

* Reduce flakiness

* Fix race conditions with last_used_param_values
- see https://metaboat.slack.com/archives/C010L1Z4F9S/p1727947712609579

* Add a temporary workaround

* Fix name

* Fix applying parameters in Question

* Revert "Fix type"

This reverts commit 67f6778d50.

* Rename and reorder tests

* Add more tests

* Update tests to avoid hitting https://github.com/metabase/metabase/issues/46774

* Add Q8 tests and fix tests for Q9

* Update assertions

* Update assertions because of https://github.com/metabase/metabase/issues/48339

* Improve test names

* Add test

* Skip failing test

* Add more tests

* Add test

* Remove redundant code

* Remove invalid cases

* Add test

* Add tests

* Add more assertions

* Add more assertions

* Add assertions

* Add assertions

* Use helper functions

* Use helper functions

* Nest helpers consistently throughout the file

* Decrease flakiness

* Revert "Add a temporary workaround"

This reverts commit 48ed8770d6.

* Add a temporary workaround

* Add tests

* Add assertions

* Add tests

* Update unit tests

* Make temporary workaround safer

* Add TODOs to github links

* Extract a function to improve readability

* Simplify getParametersMappedToDashcard

* Fix failing tests by calling Lib.ensureFilterStage in the correct place and properly identifying the originalQuestion so that Question.prototype.isDirtyComparedTo returns expected result

* Remove redundant code

* Quick dirty fix to run in CI

* Format code

* Format code

* Update unit tests

* Fix test setup

* Revert "Remove redundant code"

This reverts commit 35b47a10f2.

* Use Lib.areLegacyQueriesEqual

* Create a new e2e test group: dashboard-filters-2 (#48610)

* Allow filtering on columns from all stages in dashboards

* Update tests

* Clean up

* Update unit tests

* Distinguish multiple "Summaries" column groups

* Fix imports

* Remove redundant attribute

* Fix type

* Add a test

* Add a test

* Reduce flakiness

* Fix race conditions with last_used_param_values
- see https://metaboat.slack.com/archives/C010L1Z4F9S/p1727947712609579

* Add a temporary workaround

* Fix name

* Fix applying parameters in Question

* Revert "Fix type"

This reverts commit 67f6778d50.

* Rename and reorder tests

* Add more tests

* Update tests to avoid hitting https://github.com/metabase/metabase/issues/46774

* Add Q8 tests and fix tests for Q9

* Update assertions

* Update assertions because of https://github.com/metabase/metabase/issues/48339

* Improve test names

* Add test

* Skip failing test

* Add more tests

* Add test

* Remove redundant code

* Remove invalid cases

* Add test

* Add tests

* Add more assertions

* Add more assertions

* Add assertions

* Add assertions

* Use helper functions

* Use helper functions

* Nest helpers consistently throughout the file

* Decrease flakiness

* Revert "Add a temporary workaround"

This reverts commit 48ed8770d6.

* Add a temporary workaround

* Add tests

* Add assertions

* Add tests

* Update unit tests

* Make temporary workaround safer

* Add TODOs to github links

* Extract a function to improve readability

* Simplify getParametersMappedToDashcard

* Fix failing tests by calling Lib.ensureFilterStage in the correct place and properly identifying the originalQuestion so that Question.prototype.isDirtyComparedTo returns expected result

* Remove redundant code

* Quick dirty fix to run in CI

* Format code

* Format code

* Update unit tests

* Fix test setup

* Create a new e2e test group because the old one was timing out in CI

* Add the group to GH action

* Revert "Remove redundant code"

This reverts commit 35b47a10f2.

* Use Lib.areLegacyQueriesEqual

* FE - e2e - Cover combination of unit of time parameter + non-last-stage filters with tests (#48726)

* Add JSDoc for entityPickerModalItem

* Add addToDashboard parameter to saveQuestion

* Add JSDoc for saveQuestion

* Fix import

* Add a test reproducing the bug

* Try to fix unit of time parameters

* Fix wrong stage-index for temporal unit parameters on composed ad hoc questions

* Fix ad-hoc question naming when there is an empty extra filter stage

* Fix unit tests

* FE - Do not add extra filtering stage for pivot tables (#48975)

* Avoid using Lib.ensureFilterStage for pivoted questions

* Fix unit test setup

* Add tests for pivot tables

* Optimize tests

* Test filter modal

* Revert redundant changes

* [WIP] Dashboard filter columns be fixes (#48906)

* Revert "Add a temporary workaround"

This reverts commit 4ea374870d.

* Fix some of the issues and unskip some of the E2E tests

* Acknowledge that metrics are transparent

* Fix breakouts by the same column with different temporal-units

* Use non-negative stageIndex for temporal unit parameters

* Add stage if there is an explicit reference to stage after the last

Instead of duplicating the ensure-filter-stage logic, just check if there is a parameter referencing the filter
stage (which is always one after the last in the query). If there is such a reference, add that stage.

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Require only breakouts when adding new stage in ensure-filter-stage (#49067)

* Only require breakouts when adding new stage in ensure-filter-stage

Previously, this function required both breakouts and aggregations.

Closes #48339

* Update e2e tests after changes to Lib.ensureFilterStage

This resolves all-but-one of the TODOs related to #49339

Related to #49022

* Implementing parameter_mappings migration (#49256)

* FE - e2e - Update tests after `Lib.ensureFilterStage` changes (#49222)

* Unskip #19744 repro

* Remove sanity checks

* Update comment

* Fix typo

* Remove invalid test

* Ignore pivoted "table" viz and and inline Question.prototype.isPivoted

* Remove test for pivoted table

* FE - e2e - Click behavior (#49239)

* Unskip #19744 repro

* Remove sanity checks

* Update comment

* Fix typo

* Remove invalid test

* Ignore pivoted "table" viz and and inline Question.prototype.isPivoted

* Remove test for pivoted table

* Add a test

* Disable columns from non-last stage in click behavior

* Finish the test

* Refactor

* FE - e2e - Cover public & embedded dashboards with tests  (#49280)

* Add test for public dashboard

* Add test for embedded dashboard

* Add comment

* Add test for 2nd stage column

* Add test for 2nd stage aggregation column

* Add test for 2nd stage breakout column

* Add assertions for models

* Handle no auto-pivoting of ad-hoc questions from drill thrus

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>

* Add missing test setup

* Address some review comments (#49429)

* FE - Show columns from all stages in click behavior (target question)  (#48828)

* Add JSDoc for entityPickerModalItem

* Add addToDashboard parameter to saveQuestion

* Add JSDoc for saveQuestion

* Fix import

* Add a test reproducing the bug

* Try to fix unit of time parameters

* Fix wrong stage-index for temporal unit parameters on composed ad hoc questions

* Fix ad-hoc question naming when there is an empty extra filter stage

* Fix unit tests

* Fix non-unique keys

* Add stage-number to click behavior dimension target

* Call Lib.ensureFilteringStage in click behavior

* Use describeEE because click behavior tests use setTokenFeatures("all")

* Stop testing implementation details

* Stop testing implementation details

* Stop testing implementation details

* Modernize test and make it less flaky

* Address flake source

* Fix SAMPLE_DB_ID

* Unskip repro for #19744

* Add a test

* Update test name

* Introduce verifyNotebookQuery

* Use verifyNotebookQuery

* Use verifyNotebookQuery

* Move verifyNotebookQuery to helpers

* Assert items count in verifyNotebookQuery

* Extract helper functions

* Rename helpers

* Refactor

* Consistent comments

* Extract verifyVizTypeIsLine

* Add scrollIntoView calls for extra safety

* Add TODO

* Use verifyNotebookQuery

* Make stages optional

* Add createMultiStageQuery

* Remove redundant scrollIntoView calls
- We don't need them because the assertions are not using "be.visible"

* Improve test setup

* Add more assertions

* Add more assertions

* Add basic join support to verifyNotebookJoins

* Unnest code

* Implement join assertions

* Implement expressions and sort assertions

* Simplify code

* Add commented-out assertions

* Yes, it is correct
- it's stageIndex which sourceColumn comes from in sourceQuery

* Conditionally apply filter stage

* Allow mapping to all stages in click behavior

* Remove redundant argument

* Simplify diff

* Simplify diff

* Update test setup

* Remove TODO related to metabase#49282
- Closes #49282

* Support fetching param values on filter stage (#50120)

* Support fetching param values on filter stage

Fixes #48613

* Fix temporal-unit-parameters

* Enrich dimension targets in click_behavior with stage-numbers (#49911)

* Enrich dimension targets in click_behavior with stage-numbers

Fixes #49110

* Add missing stage-number

* Remove changeSynchronousBatchUpdateSetting references

* Update assertions to include time bucket

* Use mbql.u/legacy-last-stage-number in metabase.query-processor.card

---------

Co-authored-by: Tamás Benkő <tamas@metabase.com>
Co-authored-by: appleby <86076+appleby@users.noreply.github.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-11-23 01:49:10 +03:00
Noah Moss
e9f6c507db Check download perms recursively on referenced card-ids (#50307) 2024-11-22 22:27:09 +00:00
Sloan Sparger
50585b3189 Allow questions to run if there's an invalid loading-message setting value (#50419)
* prevent the UI from breaking if there is an invalid enum value set by MB_LOADING_MESSAGE

* add test case

* add enum validation on backend

* oops - fix set-value-of-type! call

---------

Co-authored-by: Noah Moss <noahbmoss@gmail.com>
2024-11-22 16:21:24 -06:00
Sloan Sparger
a14e5f75bf [Clean Up] Show alert with 3 month stale content rather than 6 (#50376)
* make the collection clean up alert show if content 3 months stale, rather than 6

* make test more robust
2024-11-22 16:09:53 -06:00
Jeff Bruemmer
e23bd004e2 sdk readme (#50372) 2024-11-22 22:06:47 +00:00
metamben
7393892bff Normalize :temporal_units in action, card, and dashboard entries (#50418)
* Normalize :temporal_units in action, card, and dashboard entries

Fixes #50371
2024-11-22 23:56:25 +03:00
Aleksandr Lesnenko
a9841dad20 sankey chart (#46245)
* sankey prototype

* formatting, tooltips

* layout, formatting

* handle invalid settings

* use metabase color palette

* add missing data for click behavior, hovers, add clicks support

* smart sankey default columns selection

* check more columns

* fix tooltip shows incorrect values for nodes

* polish, specs

* extend the viz settings type with sankey settings

* add isSensible to SankeyChart

* specs on sankey default columns computation

* import correct column predicates

* revert outdated changes in graph.js

* sankey colors

* format values in sankey tooltip

* change default sankey edge color to source

* increase the default size of sankey dashboard cards

* improve error messages

* use echarts option to hide overlapping labels

* increase padding

* click behavior, tooltip values

* fixes

* fix rebase: getFriendlyName got removed

* layout, labels

* polish

* remove non-existing viz type

* update spec

* polish
2024-11-22 12:52:09 -05:00
Nemanja Glumac
ed00dfd3ce Document null vs undefined setting type (#39223)
* Document `null` vs `undefined` setting type

* Improve the comment
2024-11-22 18:40:55 +01:00
Alexander Polyankin
65bdbe6e04 Migrate segment editor to MBQL lib (#50311) 2024-11-22 15:35:34 +00:00
Phoomparin Mano
5317db6d60 fix(sdk): summarize sdk component crashes with stage index errors (#50400)
* use -1 for stage index for breakout and aggregation list

* add e2e tests

* remove sum of total in e2e

* use test id matcher

* add issue to e2e name

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* move stageIndex to a separate variable

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-11-22 22:15:52 +07:00
Alexander Polyankin
b378247ca2 Remove metabot v2 (#50384) 2024-11-22 09:27:54 -05:00
Chris Truter
7232d91a4e A single spae (#50405) 2024-11-22 17:18:56 +03:00
Ngoc Khuat
77fb4fceb6 Search ingestion test (cont) (#50399) 2024-11-22 16:09:35 +02:00
Ngoc Khuat
43a7c3f641 Search index EE ranker tests (#50342) 2024-11-22 14:06:10 +00:00
Ngoc Khuat
092a4fb63a Card ingestion test (#50388) 2024-11-22 17:33:05 +07:00
Cam Saul
ac9ba610ba 🏎️ 🚀 Partition Postgres CI jobs; shave 10 minutes off of CI 🏎️ 🚀 (#48699)
* Partition Postgres jobs (alternate approach)

* Make sure we're still testing SSL

* Improved Postgres job naming
2024-11-22 12:19:31 +02:00
Nemanja Glumac
8b1ffdf094 Unify (app) banners (#50356)
* Unify banners

* Fix and update unit tests
2024-11-22 10:45:33 +01:00
Chris Truter
6be94ca238 Provide a generic way to override search filter defaults (#50389) 2024-11-22 12:04:22 +03:00
Filip Hric
9f00d56275 add capability for sending bug reports (#49875)
* add capability for sending bug reports

* fix typing, linting and testing errors

* fix failures in unit and e2e tests

* fix ts error

* add bug report RTK

* move MB_BUG_REPORT_ENABLED handling to backend

* move bug reporter setting to global settings

* fix type errors

* fix bug-report-enabled setting visibility

* add options map to slack postMessage funcion

* fix failing tests

* fix post-chat-message handling

* fix type error

* rename bug reporting setting
2024-11-22 09:31:07 +01:00
Mahatthana (Kelvin) Nomsawadi
d96814e204 Improve SDK release job title (#50318) 2024-11-22 05:36:10 +00:00
Chris Truter
515111f761 Fix weight fallback, and fix the reason tests didn't run (#50370) 2024-11-22 05:02:48 +00:00
Jeff Bruemmer
d8843159f6 remove note on quotes 2024-11-21 18:43:10 -05:00
Nemanja Glumac
e96c532f8c Center the content of the "Onboarding" page (#50368) 2024-11-21 23:22:15 +01:00
Nemanja Glumac
106686bca9 Update videos for the "Onboarding" page (#50367) 2024-11-21 23:21:57 +01:00
Nick Fitzpatrick
b8c549b938 updating @reduxjs/toolkit (#50354)
* updating @reduxjs/toolkit

* kick ci

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-11-21 16:55:27 -04:00
metamben
bd3fa8c064 Prevent coercion after nesting for all fields with coercion-strategy (#50289)
Fixes #48721
2024-11-21 23:21:49 +03:00
Sloan Sparger
b350934a12 [Trash] Track items being moved to trash (#49248)
* track items being moved to trash

* fix spelling

* fix unit tests
2024-11-21 14:01:24 -06:00
Aleksandr Lesnenko
bcc0b566b1 hide pivoted exports under env var (#50347)
* hide pivoted exports under env var

* only export pivoted when the env var is true

Also added tests to confirm.

* must specify :export for public settings

* spec

* change setting to :internal since it's only via env var

* use correct visibility add setting to settings.yaml for serialization

---------

Co-authored-by: Adam James <adam.vermeer2@gmail.com>
2024-11-21 11:48:47 -08:00
Jeff Bruemmer
53d97cc29c docs - note about metrics permissions (#50352)
* note about metrics permissions

* clarify viewing and editing

* clollection
2024-11-21 13:54:55 -05:00
John Swanson
401d7dbc38 Fix broken migration on MySQL 8.0.17 (#50350)
On MySQL 8.0.17, the following is prohibited:

```
WITH RECURSIVE MyRecursiveCTE (...) AS
(
  SELECT ... FROM bar UNION ALL
  SELECT ... FROM bar JOIN MyRecursiveCTE ON ...
)
```

Instead, you need to do:

```
WITH RECURSIVE MyRecursiveCTE (...) AS
(
  SELECT ... FROM bar UNION ALL
  SELECT ... FROM MyRecursiveCTE JOIN bar ON ...
)
```

Basically, just putting the CTE on the left vs. the right side of the
join (which is exactly equivalent under the hood) fixes the issue.

I can't actually find any documentation of this change, but it seems
that sometime between MySQL 8.0.17 and MySQL 8.0.33, MySQL started
allowing this, perhaps just an optimization where it now notices the
equivalence and does the right thing.

I originally tested this on what I believed was the oldest version of
MySQL we supported, but didn't read carefully enough. We recommend
8.0.33 or higher here:

https://www.metabase.com/docs/latest/databases/connections/mysql

But that's not for the AppDB - for that, we recommend 8.0.17 or higher.
2024-11-21 10:26:20 -08:00
Alexander Solovyov
df2e240446 [search] metrics in logs and exported to prometheus (#50339) 2024-11-21 17:40:46 +00:00
Sloan Sparger
5300031161 [Auto Clean-up] Add alert prompting admins to clean up a collection (#48381)
* add alert to prompt admins to clean up a collection

* clean up

* pr feedback

* fix i18n issue

* copy changes
2024-11-21 11:20:43 -06:00
Hervé Labas
02039eebb9 Add metrics support in diagnostics dialog (#50329)
* Add metrics support in diagnostics dialog
* Update unit test
2024-11-21 16:45:35 +00:00
Chris Truter
bc59e29174 Search Index: allow weight overrides per context (#50338) 2024-11-21 16:24:26 +00:00
Nemanja Glumac
f2d207df03 Do not show PaymentBanner on hosted instances (#50337)
* Do not show `PaymentBanner` on hosted instances

* Add test for the missing token status
2024-11-21 15:18:59 +00:00
Nicolò Pretto
e655081bc6 fix padding on published embeds list (#50268)
* fix padding on published embeds list

* add border to public links shared list to be consistent with embeds
2024-11-21 16:16:17 +01:00
Ngoc Khuat
7d76ab179f More search index ranker test (#50314) 2024-11-21 14:40:40 +00:00
John Swanson
2f8a7c697e Fix serdes of missing cards in click behavior (#50108)
* Fix serdes of missing cards in click behavior

When exporting a dashboard, we export its dashcards, including cards
referenced inside its viz_settings.

The problem is that viz_settings might have references to
now-nonexistent cards.

This is an initial stab at cleaning up the problem, specifically for
click behavior. If Dashboard D has Dashcard DC, which has a
click-behavior that links to Card C, then when we collect the
descendants of D, we'll include a reference to C - even if C has been
deleted.

So this makes two changes: first, when calculating the descendants of a
dashcard, don't include links to cards that don't exist. And, when
exporting the click behavior, remove the whole thing entirely if the
card it points to doesn't exist.
2024-11-21 05:23:07 -08:00
Chris Truter
21aff9dc7a Search Index refactor: calculate model rank on the fly (#50330)
Make model ranking dynamic, so that:

1. We can experiment with it on-the-fly in Stats.
2. We can make it context dependent in future.
2024-11-21 14:27:46 +02:00
Ngoc Khuat
80b7dcbb29 Channel test return error response (#50254) 2024-11-21 12:23:15 +00:00
Phoomparin Mano
5f6b9ecb17 fix(sdk): entity picker's hover and accent colors are not mappable via sdk theming (#50299)
* add stories for dark theme

* add dark theme editor stories

* add entity picker colors

* add editor-only picker

* remove redundant story wrapper for dark theme stories

* add theme keys to docs

* add warning message
2024-11-21 19:01:10 +07:00
github-automation-metabase
3990a6ea06 Update Readme version references and published npm version to 0.52.2-nightly (#50326) 2024-11-21 11:06:57 +00:00
Mahatthana (Kelvin) Nomsawadi
f1e738fc34 ci(sdk): Fix can't build SDK from master (#50319)
* Prevent tests file from being imported when building SDK

* Exclude more test files from SDK build
2024-11-21 10:49:31 +00:00
Ngoc Khuat
8513bc970a Handlebars helper ⚒️ (#50004) 2024-11-21 10:46:37 +00:00
Chris Truter
66e2910241 Basic Search Index Ranker tests (#50275) 2024-11-21 09:19:09 +00:00
Mahatthana (Kelvin) Nomsawadi
69802d15ec Put #locale under pro plan (#50219)
* Put `#locale` behind the feature flag

* Prepare folder structure for unit testing

* Refactor: extract a setup function as a shared util

* Add #locale tests

* Add all tests

* Prepare folder structure for unit testing

* Refactor: extract a setup function as a shared util

* Add locale tests

* Add all questions tests

* Fix failed E2E

* Tidy up questions tests

* Tidy up dashboards tests

* Fix test name typo

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-11-21 08:52:10 +00:00
Phoomparin Mano
3f2f855cd0 fix(sdk): emit typescript files in the embedding cli when in a typescript project (#50278)
* emit typescript when in a typescript project

* also check dependencies for typescript dep
2024-11-21 15:21:39 +07:00
Romeo Van Snick
79858b9fa2 Allow searching a single select list picker (#49739)
* Allow searching a single select list picker

* Fix unit tests

* Add repro for 49642

* Remove selection when searching

* Rename parameter to value because it does not need to be a prefix

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Simplify loading state for ListField

* Use same DEBOUNCE_FILTER_TIME in ListField

* Don't rely on waitTimeContext in test

* Fix lint

* Add initialization state for filter widget

* Update Loki Snapshots

* Update Loki Snapshots

* Allow picking other values when selecting a single value dropdown value

* Add comment about initialization

* Use setup in test

* Update Loki Snapshots

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-11-21 15:53:31 +11:00
Ngoc Khuat
918925ad60 Handlebars reloadable templates (#49950) 2024-11-21 10:06:00 +07:00
bryan
379cf342d3 actually return values from getHidden (#50295)
* actually return values from getHidden

- Arrow functions with {}'s do not implicitly return!

* boolean fiddling
2024-11-20 21:28:28 +00:00
Phoomparin Mano
64219be813 fix(sdk): fix wrong e2e import path causing ci failure (#50297) 2024-11-20 20:22:13 +00:00
Phoomparin Mano
43ffbf0b24 fix(sdk): cli suggests a relative import path with reminder message (#50276)
* update suggested import path

* update suggested import path

* add small tests for import paths

* update comments

* clarify the import path message

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-21 02:55:14 +07:00
Phoomparin Mano
5fb95767da feat(sdk): revamp CreateQuestion and create question behaviour (#50088)
* revamp the create question component

* docs updates

* add stories and update styles

* prevent switching to visualization when it is not ready

* ensure CreateQuestion works in flex parents

* add basic e2e tests for CreateQuestion

* ensure that switching between editor and visualization works

* use the save button for the disabled state

* update the question title when the question is saved

* implement updating questions in place

* rename replaceQuestion

* make CreateQuestion props all optional

* add background color to modal header

* hide the save button if question is dirty

* hide save button instead of disabling per design feedback

* update e2e tests

* revert e2e helpers

* add title update assertions

* whitespace changes
2024-11-21 01:11:56 +07:00
github-actions[bot]
1ac47c7425 Update Translations for v51.5 (#50163)
* Add new strings for v51.4

* Update translations

* kick ci

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-11-20 10:45:17 -07:00
Tyler Plude
b4f057ab47 adding Tyler to DashViz team (#50181) 2024-11-20 09:36:58 -08:00
Roman Abdulmanov
3a5a7f385e Updated codeowners (#50285) 2024-11-20 17:24:39 +00:00
Jeff Bruemmer
3e3f408c09 fix links (#50282) 2024-11-20 12:06:14 -05:00
Ngoc Khuat
0002f20c6d skip connection check when creating/updating channel (#49661)
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-11-20 16:00:40 +00:00
Roman Abdulmanov
e96e46015d Bug triage fix (#50271) 2024-11-20 15:53:03 +00:00
Alberto Perdomo
55a4540329 Sdk update react next versions (#50222)
* Update versions in SDK introduction

* SDK - Update next-js versions

* Tweak wording about React versions

* Tweak Next.js versions

* Bump node version to 20

* Bump node version to 20
2024-11-20 14:58:40 +00:00
Kamil Mielnik
12f85cbb79 Fix - Notebook expression editor autocomplete issues (#49949)
* Allow navigating with arrow up/down between lines in expression editor

* Do not hijack up/down arrow keys for autocomplete suggestions navigation when there's only 1 suggestion

* Add explanatory comments

* Convert tokenizer to TS

* Add a test

* Format code

* Add basic test case

* Fix a deprecation

* Handle incomplete bracket identifier tokens

* Shorten code

* Add comment

* Fix suggestion not always getting selected

* Fix computation

* Fix types

* Update comment

* Add repros for #49882

* Add repro

* Fix comment

* Deprecate a HOC

* Update assertion

* Remove _.compose and default export

* Fix types in ExplicitSize

* Fix typing in ExpressionEditorTextfield

* Fix types

* Fix error handling

* Fix showing errors when expression is invalid

* Do not submit null expressions

* Fix typing

* Update assertion

* Fix flaky test

* Fix filter

* Decrease flakiness

* Fix crashing

* Add comment

* Fix incomplete bracket idenfitiers

* Fix type

* Improve typing

* Add an explanatory comment
2024-11-20 19:10:41 +07:00
Chris Truter
fbd2a24d0a Rank based on when the current user last viewed the item (#50224)
* Rank based on when the current user last viewed the item

* Fix tests
2024-11-20 13:02:43 +03:00
Mahatthana (Kelvin) Nomsawadi
9ed2c3a26f Quarantine the flaky assertions (#50198)
* Refactor: Speed up E2E tests by not relying on UI

* Quarantine flaky E2E assertions
2024-11-20 06:46:58 +00:00
Romeo Van Snick
e900711e8d Render table header when dataset is empty (#50136)
* Allow TableInteractive to render it's own empty message

* Pass renderEmptyMessage to visualization in model editor

* Add reproduction for #37300

* Use double equals ofr null check

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-11-20 09:22:19 +11:00
Romeo Van Snick
9bd17d26f7 Do not show values initially when single select search does not have a filter value (#49577)
* Do not show values initially when single select search does not have a filter

* Add repro for 49577

* Reword test case

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

* Fix e2e test

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-11-20 09:22:00 +11:00
appleby
23cc30fe17 Prevent an exception in api.table/batch-fetch-card-query-metadatas when cards is empty (#50115)
* Don't try to fetch dbs for zero cards in api.table/batch-fetch-card-query-metadatas

Closes #48461

Ensure we don't throw an exception by attempting to fetch the Databases associated with potentially-deleted card ids in
api.table/batch-fetch-card-query-metadatas.

In particular, this ensures we don't generate an exception if the user does the following

1. Create a card "Source Card"
2. Create another card "Derived Card" with a :source-table of "Source Card"
3. Add Derived Card to a dashboard
4. Permanently delete (not just archive) the Source Card

* Add test for virtual-table query-metadata with deleted source card

* Add test for dataset query_metadata with deleted source card

* Add test for dashboard query-metadata with deleted source card

* Add test for card query-metadata with deleted source card

* Add metabase.api.test-util and use it in query-metadata-with-deleted-card tests

* Replace copy/pasted debug helpers with select-query-metadata-keys-for-debugging
2024-11-19 14:09:17 -08:00
Uladzimir Havenchyk
47d81c46bc chore: forbid legacyQuery usage with eslint (#50141)
* chore: forbid legacyQuery usage with eslint

* fixup

* fixup
2024-11-20 00:41:45 +03:00
Jeff Bruemmer
6895e51d4e add doc alias for generating docs (#47156) 2024-11-19 16:07:11 -05:00
Phoomparin Mano
5bbb9f847a feat(sdk): ability to render question layout when drilling down in interactive dashboard (#50017)
* allow passing custom views to underlying ad-hoc questions

* update readme docs

* accept component instead

* tweak layout story

* update docs

* add e2e tests

* cleanup tests

* remove incorrect tests

* simplify tests

* rename prop to renderDrillThroughQuestion and update docs

* swap docs order

* add missing marker

* clarify drill-through naming

* replace dead links
2024-11-20 03:00:35 +07:00
Jeff Bruemmer
893e297e0d onboarding checklist copy (#49570) 2024-11-19 19:11:22 +00:00
Chris Truter
1ecd0da57f Experimental search tweaks #2 (#50214) 2024-11-19 18:48:02 +00:00
Aleksandr Lesnenko
aa140ef998 Make iframe dashcards more permissive (#50177)
* allow more iframe attributes

* make iframe sandbox more permissive

* update spec
2024-11-19 13:46:08 -05:00
github-automation-metabase
c7bb60c811 Add v0.51.4 to the list of releases (#50189)
* Add v0.51.4 to the list of releases

* add 50.34

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2024-11-19 18:28:04 +00:00
Uladzimir Havenchyk
824545546a ci: attempt to fix trivy rate limit issue (#50225) 2024-11-19 17:51:25 +00:00
metamben
e2522f4fa7 Fix model conversion (#50215) 2024-11-19 16:39:35 +00:00
Chris Truter
5be9510069 For new search, default to excluding other people's collections (#50146) 2024-11-19 16:05:46 +00:00
Jeff Bruemmer
731497f63f docs - note on offset and rows (#50171) 2024-11-19 15:56:35 +00:00
Roman Abdulmanov
0b09b76ace bug triage fix (#50213) 2024-11-19 09:53:09 -05:00
Roman Abdulmanov
52d223d44b bug triage fix (#50210) 2024-11-19 14:43:03 +00:00
Phoomparin Mano
964d31ec8d fix(sdk): trigger save handler on question create when using SaveQuestionForm (#50137)
* trigger save handlers on question create

* add skeleton example stories for save forms

* update storybook stories

* add tests for saving questions

* docs update

* add createCard assertions

* rollback docs
2024-11-19 20:46:29 +07:00
Kamil Mielnik
409c93833f Fix flaky e2e tests by using synchronous-batch-updates: true by default (#50143)
* Use synchronous-batch-updates: true by default in e2e tests

* Remove changeSynchronousBatchUpdateSetting
2024-11-19 18:30:51 +07:00
Kamil Mielnik
06fef3905a Fix - Remove clause button shrinks in the notebook editor (#50150)
* Fix #50128

* Add repro for #50128
2024-11-19 18:21:00 +07:00
Nicolò Pretto
3f77c0c480 fix(sdk): handle relative urls for metabaseInstance in loading maps (#50135)
* fix(sdk): handle relative urls for metabaseInstance in loading maps

* addTrailingSlash  -> ensureTrailingSlash

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-19 12:00:58 +01:00
Chris Truter
17bb910200 Various tweaks for experimental search (#50142) 2024-11-19 08:22:14 +00:00
Nicolò Pretto
ceba6e407c feat(sdk): detect mismatch between sdk version and mb version (#50032)
* feat(sdk): detect mismatch between sdk version and mb version

* refactor: log utils to print the big headers

* Update enterprise/frontend/src/embedding-sdk/lib/version-utils.unit.spec.ts

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* refactor: call -> callArguments

* add link to the docs

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-19 09:08:15 +01:00
Oisin Coveney
077236f2da Separate view from data for question titles (#50129) 2024-11-19 08:27:53 +02:00
Ngoc Khuat
667c3f93ef [Notification] Seed notifications on startup instead of using migrations 🌱 (#50127) 2024-11-19 10:00:48 +07:00
Ryan Laurie
320f0907cc Fix auto-translate locales file path (#50164) 2024-11-18 14:31:31 -07:00
Ryan Laurie
1a421b3ad5 Add Hungarian language support (#50165) 2024-11-18 14:30:49 -07:00
Aleksandr Lesnenko
42013c4e1d Fix pie chart legend issues (#50116)
* remove LegendVertical logic that preserves legend width

* memoize pie legend items

* prevent pie from jumping when toggle legend

* fix responsive legend logic, cleanup

* drop hyphens from the pie legend (#29597)

* eliminate flickering on render due to not having dimensions

* shortcut

* specs

* test vertical layout has no hyphens

* setup func

* set explicit showLegend=true default
2024-11-18 15:04:32 -05:00
Oleksandr Yakushev
1ab3e4e9d6 perf: Improve the performance of pivoted XLSX export (#50117)
* [xlsx-export] Cache the custom datetime formatter

* [xlsx-export] Optimize functions in m.q_p.pivot.postprocess

* cljfmt

---------

Co-authored-by: Adam James <adam.vermeer2@gmail.com>
2024-11-18 11:54:37 -08:00
Cam Saul
0c442b6222 Revert remaining broken JAR path (#50162) 2024-11-18 15:34:46 -03:00
Ryan Laurie
4ab6c6eb42 Update slack settings urls (#50042) 2024-11-18 10:19:56 -07:00
Jeff Bruemmer
2be5130e7c docs - sdk cli guide (#50098) 2024-11-18 11:06:02 -05:00
Nick Fitzpatrick
21ae344b09 search result order (#50048) 2024-11-18 11:33:45 -04:00
Nicolò Pretto
b3a46a7791 refactor(sdk): use ignore flag instead of mounted ref (#50069)
* Revert "fix(sdk): put a bandage on the flashing error on static question in strict mode (#49659)"

This reverts commit c57b3a38e0.

* refactor(sdk): use ignore flag instead of mounted ref
2024-11-18 16:27:25 +01:00
Chris Truter
ab60efa430 Make fulltext the default if its enabled (#50144) 2024-11-18 15:25:08 +00:00
Kamil Mielnik
d291c1509e Fix flaky x-rays test (#50131)
* Fix flaky test

* Add extra assertion

* Reset hover state

* Change order of assertions
2024-11-18 21:55:06 +07:00
lbrdnk
5203a15cdc Add temporal unit to display name (#48946)
* Add temporal unit to display name

* Remove temporal unit adjustments from FE

* formatColumn to displayNameForColumn

* Factor out getFriendlyName

* Adjust BE tests

* Add require

* Adjust FE unit tests

* Adjust temporal-unit-parameters.cy.spec.js

* Adjust dashboard-reproductions.cy.spec

* Convert formatColumn occurrence

* Adjust legacy display name logic generation

After `getFriendlyName` was removed from FE, capitalization
of display name should happen here. Logic is similar, should
be adjusted prior merging the PR.

* Adjust embedding-linked-filters.cy.spec.js

* Adjust joins-reproductions.cy.spec.js

* Adjust metrics-editing.cy.spec.js

* Adjust timelines-question.cy.spec.js

* Adjust offset.cy.spec.ts

* TMP Avoid duplication of temporal unit in display name in MLv2 code

* Probably FE fix: add default temporal bucket only if not present

* WIP Add ends-with-temporal-unit? function

Current strategy is to add temporal units to display names if same is not already present

* Adjust display-name-method :metadata/column

Append TU to display name only if different to what's already present

* Adjust FE: show temporal unit that's present on field instead of default on hover on QueryColumnPicker element

* Return also temporal-unit from visible-columns

* Enable tempora-unit to be returned from previous-stage-or-source-visible-columns

* WIP Adjust multi breakout multi stage e2e multiple-column-breakouts.cy.spec

* Adjust multiple-column-breakouts.cy.spec.ts

* It was not a bug.

* Revert changes in _BaseBucketPickerPopover

* Restore temporal-unit for next stages removal in stage.cljc

* Add inherent-temporal-unit

* Adjust display name temporal bucket logic

* Rename to inherited-temporal-unit

* Shutdown too broad display name capitalization

* Eastwood

* Adjust pivot-rows-order-test

* Adjust pivot-non-numeric-values-in-aggregations

* Adjust inherent to inherited

* Rename to inherited

* Add inherent-temporal-unit only to returned-columns

* Update e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js

* Update e2e/test/scenarios/question/multiple-column-breakouts.cy.spec.ts

* Update consistent-date-formatting-test

* Update dashboard/x-rays.cy.spec.js

* Update waterfall.cy.spec.js

* Return month default for default inherited-temporal-unit

* Update reproductions-3.cy.spec.js

* Update downloads/downloads.cy.spec.js

* Update legend.cy.spec.js

* Update pie_chart.cy.spec.js

* Update click-behavior.cy.spec.js

* Update embedding-linked-filters.cy.spec.js

* Return QueryColumnPicker's condition to original state

* Remove reundant export

* Update e2e/test/scenarios/question/multiple-column-breakouts.cy.spec.ts

* Comment

* Update nested.cy.spec.js

* Update e2e/test/scenarios/sharing/sharing-reproductions.cy.spec.js

* Adjust to TS types

* Adjust for cljfmt

* Capitalize

* Add propagation tests

* Add inherited-temporal-unit propagation for expressions

* Add default inherited-temporal-unit test cases

* Add qp temporal-bucket-test ns

* Simplify default unit logic

* Comment

* Use NULL_DISPLAY_VALUE

* Comment

* Comment

* Comment

* Comment

* Comment

* Comment

* Remove redundant code (for now)

* Update comments

* Comment

* Restore way too daring simplification

* cljfmt

* Adjust capitalize

* Update comment

* Update test

* Address remarks in tests

* Update test

* Address remarks

* typo
2024-11-18 14:49:18 +01:00
Uladzimir Havenchyk
552cf921ff fix: respect click behavior on public dashboards (#50067)
* fix: pass noop as navigateToNewCardFromDashboard from public or embedded dashboard

* add e2e test

* rework a fix
2024-11-18 14:21:43 +03:00
Romeo Van Snick
c8aa0a5420 Fix button group breaking (#50064)
* Use Flex instead of Group for items in button

* Allow column picker to stretch to match the height of the element

* Fix height of data picker buttons

* Make sure the whole button is clickable

* Add e2e test for metabase/metabase#50038

* Use correct id for issue in e2e test

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-11-18 21:54:42 +11:00
Chris Truter
ef09cc16c3 Normalize view count scores by p90 for corresponding model (#50126) 2024-11-18 10:02:11 +00:00
Kamil Mielnik
17887dcd2c Fix flaky test (#50077) 2024-11-18 15:11:12 +07:00
Nicolò Pretto
7951b71137 fix(49537): remove position relative from echarts tooltip container (#49964)
* attempt to fix 49537 by removing position relative from the tooltip
container

* Make echart tooltip container cover all iframe area

* Update the E2E test

* Update loki snapshots from CI

* Re-enable echarts tooltip assertion.

I couldn't find a better way to fail these assertions on the previous
version of the code, but these assertions are better than nothing.

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-18 06:02:03 +00:00
Oleksandr Yakushev
7d8f8a889b Bump Toucan dependency (#49962) 2024-11-16 12:37:39 +02:00
Case Nelson
1ea5557754 fix: Sync postgres materialized view fields (#50102)
* fix: Sync postgres materialized view fields

Fixes: #49912

* Disable test for redshift

* Fix formatting
2024-11-15 23:09:19 +00:00
adam-james
520db04167 XLSX Pivot Export - Initialize Pivot Table with Small Area Ref (#50060)
* XLSX Pivot Export - Initialize Pivot Table with Small Area Ref

This PR changes the native pivot export so that we first initialize the pivot table with an area ref that's only the
first 2 rows. Prior, I used `AreaReference/GetWholecolumn` which had the side effect of using lots of memory.

I think this is related to how the Pivot Table's Cache is built up as you add rows/cols to the pivot definition. So,
if you keep the area ref only as wide as the number of columns in the raw data, and just 2 rows, then the cache can
stay small.

After adding row/column data to the pivot table, you can then modify the area ref to be all rows in the relevant
columns (`A:E` for example).

This keeps the pivot-table object much smaller in size.

* need the extra xml schemas to get this to work

I'd like to try find a way around including this extra dep, it's a 13mb jar (ish), and I think that's a little bigger
than I'd like

* oops, didnt mean to have this in

* Add test for pivot table initialization being fast and lean on memory

* remove time based assertion, add comments in impl

* cljfmt

* fix test

* Pesky little whitespace

---------

Co-authored-by: Oleksandr Yakushev <alex@bytopia.org>
2024-11-15 21:54:47 +00:00
Noah Moss
09483a66d3 Unify TTLs for token check caching, simplify some code (#49916) 2024-11-15 21:41:57 +00:00
Noah Moss
b9bc8c1c21 Make sure the query to fetch result_metadata for native sandboxes doesn't use the streaming results handler (#50049) 2024-11-15 21:09:42 +00:00
adam-james
4d5aa8053a XLSX Pivot Exports Now Use The Sort Settings from Viz Settings (#50099)
* XLSX Pivot Exports Now Use The Sort Settings from Viz Settings

Prior to this PR, the xlsx pivot exports worked correctly except for the fact that no sorting (ascending or
descending) was applied to the pivot rows or columns. Now, those settings are used when they exist.

* only try to set sort when a correct setting exists

* add ooxml-full dep for correct classes

* Update src/metabase/query_processor/streaming/xlsx.clj

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

---------

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-11-15 20:39:54 +00:00
Noah Moss
ed893e19b2 Merge login_attributes when updating existing users via config file (#50050) 2024-11-15 15:31:13 -05:00
Case Nelson
bc3c54b6b1 fix: MYSQL filter database with dbname in sync (#50091)
Fixes: #50072

When we `describe-fields` we are passing db details, but sometimes we
have the database name in `dbname` rather than in `db` depending on the
connection specs and possibly environment. So we check for both now.
2024-11-15 11:13:00 -07:00
Dennis Schridde
13eb9ae2f1 Omit database details from H2 dump when is_attached_dwh (#50036)
== Goal ==

Hide attached DWH database details from anyone incl. admins:
* Do not show them in the UI
* Do not permit to change them
* Do not serialize them
  - This is what we're adding for H2 snapshots (dumps) with this PR.

The aim is that customers cannot gain access to (parts of) credentials,
and they cannot break a feature they are paying for by changing
connection details.

== Implementation ==

In 592360c9fa I wrongly understood that
database details would be omitted when dumping to H2, but this is only
true for dumping H2 databases.

Fix this by omitting database details also when dumping databases with
`is_attached_dwh` set.

== How to test ==

To prepare, download a H2 JAR matching the H2 version used by Metabase:
```
wget https://repo1.maven.org/maven2/com/h2database/h2/2.1.214/h2-2.1.214.jar
```

If the H2 version does not match, you will get an error when trying to
open the H2 shell:
```
Exception in thread "main" org.h2.jdbc.JdbcSQLNonTransientConnectionException: Unsupported database file version or invalid file header in file "[REDACTED]" [90048-232]
```

=== New behaviour ===

Setting the `is_attached_dwh` field hides the database details from H2 dumps:

1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases.
   - In addition to the fields you would normally set, also set
     `is_attached_dwh: true`.
   - This also works when adding this flag to a database that previously
     did not have this flag set.
2. Start your Metabase instance.
3. Run `${metabase} dump-to-h2 ./dump-file-h2` to create the H2 snapshot file.
4. Run `java -cp h2-2.1.214.jar org.h2.tools.Shell -url "jdbc:h2:file:./dump-file-h2;ifexists=true"` to open a H2 shell.
5. Verify that `SELECT name,details FROM metabase_database;` shows `{}` for the database you added in step 1

=== Original behaviour ===

Behaviour without setting the `is_attached_dwh` field is unchanged:

1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases.
   - Only set the fields you would normally set.  Do not set
     `is_attached_dwh` (or set it to `false`).
2. Start your Metabase instance.
3. Run `${metabase} dump-to-h2 ./dump-file-h2` to create the H2 snapshot file.
4. Run `java -cp h2-2.1.214.jar org.h2.tools.Shell -url "jdbc:h2:file:./dump-file-h2;ifexists=true"` to open a H2 shell.
5. Verify that `SELECT name,details FROM metabase_database;` shows a non-empty object (i.e. not `{}`) for the database you added in step 1

Fixes: 592360c9fa
Closes: https://github.com/metabase/harbormaster/issues/5526
2024-11-15 18:12:10 +01:00
Nicolò Pretto
6c0d44d1ca fix(sdk): remove `Cannot update a component XX while rendering a (#50078)
* fix(sdk): remove `Cannot update a component XX while rendering a
different component` error

* test(sdk): introduce jest test to make sure api.basename is set before
loading the locale
2024-11-15 16:54:03 +01:00
Uladzimir Havenchyk
5475a123b8 ci: revert old jar path (#50081) 2024-11-15 08:16:13 -07:00
Chris Truter
e85e79c80d Search Index recency ranker to use last-viewed-at (#50071) 2024-11-15 13:31:11 +00:00
Mahatthana (Kelvin) Nomsawadi
4a63f1aff6 Make SDK Next JS docs clearer (#50068)
* Update doc on Next JS examples

* Make comments consistent and remove typos

* Address review

Co-Authored-by: Poom poom@poom.dev

* Address review

Co-authored-by: Nicolò Pretto <info@npretto.com>

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-11-15 13:19:59 +00:00
Nicolò Pretto
dd068ca4bd enforce key prop on tooltip row in echarts tooltip (#50045) 2024-11-15 12:38:27 +01:00
Chris Truter
86f2266739 Search clean-up: separate permissions and logical filters (#50046) 2024-11-15 12:35:05 +02:00
Aleksandr Lesnenko
9fb6328cfb fix hiding incorrect y-axis on hover (#49920)
* fix hiding incorrect y-axis on hover

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-11-14 17:32:42 -05:00
Jeff Bruemmer
07dfbc2b2d note on downloads (#50055) 2024-11-14 15:55:18 -05:00
Abed Habli
f767715a72 Typo (#50043) 2024-11-14 15:38:52 -05:00
Cam Saul
ee3ccf1432 Use Java 17 to run the EE extras build steps (#50051) 2024-11-14 12:38:08 -08:00
Oisin Coveney
f49c703daf Add multi-step popover for default view components (#50018) 2024-11-14 22:35:03 +02:00
Noah Moss
290165d966 Make sure block perm enforcement allows native queries if powering a sandbox (#49974) 2024-11-14 10:08:48 -05:00
dpsutton
113d75ce93 sync the attached datawarehouse (#49970)
* sync the attached datawarehouse

requires either "sync_db" true or a table name

it will error
```shell
❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' x-metabase-apikey:apikey -pb
Must provide `sync_db` or a `table_name` to sync
```

It will sync the db when sync_db is true [NOTE: this is outdated. now just omitting the table name will sync the db]
```shell
❯ echo '{"synchronous?": true, "sync_db": true}' | http post 'localhost:3000/api/notify/db/attached_datawarehouse' x-metabase-apikey:apikey -pb
{
    "success": true
}
```

It will sync existing tables
```shell
❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=existing schema_name=public x-metabase-apikey:apikey -pb
{
    "success": true
}
```

it will error if it cannot find a table
```shell
❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=new schema_name=public x-metabase-apikey:apikey -pb
{
    "cause": "Unable to identify table 'public.new'",
    "data": {
        "schema_name": "public",
        "status-code": 404,
        "table_name": "new"
    },
    "message": "Unable to identify table 'public.new'",
    "schema_name": "public",
    "table_name": "new",
    "trace": [],
    "via": [
        {
            "data": {
                "schema_name": "public",
                "status-code": 404,
                "table_name": "new"
            },
            "message": "Unable to identify table 'public.new'",
            "type": "clojure.lang.ExceptionInfo"
        }
    ]
}
```

if i create that table
```sql
attached=# create table new (id int);
CREATE TABLE
```

it will then find and sync it

```shell
❯ http post 'localhost:3000/api/notify/db/attached_datawarehouse' table_name=new schema_name=public x-metabase-apikey:apikey -pb
{
    "success": true
}
```

* formatting

* Tests for attached datawarehouse

* PR nits

typo in `thorw` -> `throw`
comment explaining why `find-and-sync-new-table` is always sync
gensym the db name in test
remove a binding for a fn `sync!` that's only called once
test `{:sync_db true}` syncs the whole db

* stupid formatting 🦾

* Use absence of table_name as indicator to sync database
2024-11-14 08:07:39 -06:00
Mahatthana (Kelvin) Nomsawadi
bffdfada3d Translate more strings on static embed with #locale (#49868)
* Fix smartscalar texts to use user locale

* Fix Pie chart texts to use user locale

* Fix line chart tooltip texts to use user locale

* Add trend chart assertions

* Add pie chart assertions

* Add line chart other series tooltip assertions

* Update frontend/src/metabase/visualizations/echarts/pie/constants.ts

Co-authored-by: Nicolò Pretto <info@npretto.com>

* Fix failed E2E tests

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-11-14 12:56:11 +00:00
Nicolò Pretto
f707115294 fix(sdk): sdk version wrapped in quotes (#50014) 2024-11-14 13:53:05 +01:00
Chris Truter
87e3b95b1b Search clean-up: consolidate Filter specifications (#50019) 2024-11-14 12:49:16 +00:00
Uladzimir Havenchyk
87204effb2 ci: fix path to the jar file (#49965)
* ci: attempt to avoid rate trivy rate limit and fix jar path

* drop trivy related changes
2024-11-14 12:47:42 +00:00
Oisin Coveney
4761766738 fix(sdk): Split useSummarizeQuery into specialized hooks (#49841) 2024-11-14 12:21:18 +00:00
Uladzimir Havenchyk
e27d304930 update cross-spawn for dependabot (#50021) 2024-11-14 11:37:26 +00:00
Mahatthana (Kelvin) Nomsawadi
94ac40e640 ci(sdk): Fix some backports aren't included in the changelog (#49926) 2024-11-14 09:55:34 +00:00
Chris Truter
70ea4a0ab0 Fix query building for related updates (#50001) 2024-11-14 11:02:11 +02:00
Phoomparin Mano
aaedddf828 feat(sdk): add background-disabled color (#49900)
* add background-disabled color

* expect background-disabled to be mapped in tests
2024-11-14 14:35:56 +07:00
Chris Truter
4aaa13a857 Add user type visibility options to new search engine (#49951) 2024-11-14 09:33:33 +02:00
Case Nelson
9ae02bef47 fix: bigquery all parameterized types (#49914)
Fixes: #49913

In #49786 we handled parameterized STRING types like `STRING(255)`

Here we add handling for the other other types https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#parameterized_data_types

`BIGDECIMAL` and `DECIMAL` are aliases for `BIGNUMERIC` and `NUMERIC`
https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#parameterized_decimal_type
2024-11-13 15:52:03 -07:00
Cam Saul
200c69373d Don't hardcode Linux/x64 arch in Docker base image (#49979) 2024-11-13 22:39:05 +00:00
adam-james
00737e9910 Apply Column Sort To Pivot Sections (#49802)
* Apply Column Sort To Pivot Sections

Fixes #49437

This PR fixes the dataset API so that column sorts (ascending/descending settings on pivot-rows and pivot-cols) are
properly parsed and passed through the QP.

After that, I've also modified the post processor to use the sort orders properly in pivoted exports.

* println debugging :)

* fixing a few tests

* fix a few more tests
2024-11-13 13:58:01 -08:00
github-automation-metabase
473c4cd89e Add v0.50.33 to the list of releases (#49869) 2024-11-13 16:24:17 -05:00
Ryan Laurie
39f8f6a6ea Fix having to specify platform when pulling docker from ARM (#49976)
* revert (most of) #48910

* remove test code

* fix conflict
2024-11-13 12:50:58 -07:00
Cam Saul
4418173684 Revert CI uberjar build Java version from 21 to 11 (#49975) 2024-11-13 21:30:57 +03:00
Nicolò Pretto
85161494a9 feat(sdk): use Alert component for SDKError (#49895)
* wip: Alert component for SDKError

* use the alert component for the default sdk error component

* fix tests

* update e2e
2024-11-13 17:52:59 +01:00
Chris Truter
d0020aae8c Disable nice-to-have tests that work locally, but fail in CI (#49963) 2024-11-13 15:55:48 +00:00
Chris Truter
0434d5ad87 Optimize search index updates using delayed batches (#49899) 2024-11-13 15:01:59 +00:00
Chris Truter
e150fafa85 Basic API to twiddle with search weights (#49866) 2024-11-13 12:56:57 +00:00
Chris Truter
a31ff2e5d8 Fix search query issue with trailing quotation mark (#49933) 2024-11-13 12:11:45 +00:00
Kamil Mielnik
03af173dbc Fix flaky models metadata test (#49665)
* Fix flaky models metadata test

* Improve hack
2024-11-13 10:06:37 +03:00
Mahatthana (Kelvin) Nomsawadi
1204554eea ci(sdk): [master] Prevent SDK from being upgraded unintentionally (#49883)
* Update workflow on master

* [DEBUG] Disable steps for testing

* Add alberto as a reviewer

* [DEBUG] modify the branch name for testing

* Revert "[DEBUG] modify the branch name for testing"

This reverts commit 7d5d8bf802.

* Revert "[DEBUG] Disable steps for testing"

This reverts commit a8662c9e8b.
2024-11-13 03:34:01 +00:00
Cam Saul
b1ad9a1a30 Switch to Java 21 (#48854)
* Try snowflake 3.19.0

* Deafault to java 21 for drivers

* Trigger CI

* Try running things with --add-opens to see if it solves our problems

* Fix `update-view-dashboard-timestamp-test`

* Try snowflake 3.19.0

* Deafault to java 21 for drivers

* Try running things with --add-opens to see if it solves our problems

* Fix `update-view-dashboard-timestamp-test`

* Update deps.edn

* Switch to Java 21

* Docker image needs to use --add-opens option

* Add note about change to Java 21 to driver changelog

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
2024-11-12 20:06:32 +00:00
Phoomparin Mano
69f6527edd feat(sdk): expose FilterPicker querying component (#49768)
* add filter picker skeleton

* add filter picker skeleton

* add picker in popover use case

* reuse FilterColumnPicker

* add question filter logic

* remove fixed width from popover

* add onClose handler

* add e2e test skeleton

* contain FilterBar in Box in story

* add a test for adding filters

* update e2e tests

* add filter picker to the docs

* inline props and functions

* update the props
2024-11-13 03:00:12 +07:00
Aleksandr Lesnenko
8eb105c7d6 update subscription checkboxes (#49805)
* update subscription checkboxes

* update spec
2024-11-12 19:42:12 +00:00
Chris Truter
db0f9119fc Keep search index updated (#49666) 2024-11-12 16:38:47 +00:00
Noah Moss
00dd363bcc Add a force parameter to permission graph endpoints to bypass revision number check (#49856) 2024-11-12 10:25:59 -05:00
Noah Moss
8fc9892750 Clarify cache API permissions and add tests (#49804) 2024-11-12 10:25:47 -05:00
Jeff Bruemmer
a9819e8cac docs - sdk revisions (#49855) 2024-11-12 10:22:08 -05:00
Oisin Coveney
d2d95df948 fix(sdk): Convert jwtProviderUri to authProviderUri (#49843) 2024-11-12 15:00:30 +02:00
Romeo Van Snick
c2735f6dbb Allow changing the limit using just the html input arrows (#49818)
* Allow using the arrow buttons to change the limit value

* Add a min prop to the number input

* Use base-10

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Ensure number is integer

* Add issue name to unit test

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-11-12 11:43:42 +00:00
Romeo Van Snick
d8ef4d3818 Use ParameterValueWidget for default value picker in native parameter settings (#49578)
* Use ParameterValueWidget for default value picker in native parameter settings

* Fix e2e test

* Fix native filter tests

* Fix e2e test

* Fix e2e test

* Add repro for #44665

* Assert that filter values are shown in the popover.

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-11-12 22:37:32 +11:00
Nicolò Pretto
8c6c93c724 skip json() -> JSON.stringify and just forward the text (#49792) 2024-11-12 11:36:43 +01:00
Ngoc Khuat
a6a1e56a12 Handlebars follow up (#49837) 2024-11-12 15:23:20 +07:00
Chris Truter
1baecd8b52 Implement enterprise search rankers in the database (#49861) 2024-11-12 08:19:51 +00:00
Oisin Coveney
6f0d3aac8d Remove some styled components in Summarize (#49836) 2024-11-12 09:38:38 +02:00
Kamil Mielnik
90d88fa634 Fix flaky homepage xrays test (#49765)
* Fix flaky test

* Add a comment
2024-11-12 17:52:37 +11:00
Chris Truter
a5a03934d6 Fix some CLJ formatting (#49860) 2024-11-12 06:13:57 +00:00
Chris Truter
09ee5aa2e8 Prefer search results with higher view counts (#49842) 2024-11-11 21:35:33 +00:00
Luis Paolini
7d6d88969b Make delete-all-field-values-for-database a subquery (#49835)
* Fixes https://github.com/metabase/metabase/issues/33037

* Align query and fix the linter
2024-11-11 18:13:41 -03:00
Luiz Arakaki
f9447d7435 fix dashboard filter required (#49627) 2024-11-11 16:24:33 -03:00
Jeff Bruemmer
dffe10a284 browse databases (#49850) 2024-11-11 13:47:25 -05:00
github-automation-metabase
02e50c2771 Add v0.51.3 to the list of releases (#49844)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-11-11 12:15:33 -05:00
Chris Truter
ec3091f6da Fulltext Search in Postgres (#49421) 2024-11-11 15:24:04 +00:00
Braden Shepherdson
c73fd9e67c [testing] Add appending stages to the query generators (#49567)
This also cleans up the testing to check everything more carefully,
and to expect the right things across multiple stages.

(This is a bit tricky since the order-bys get removed when the stage
gets aggregated, because the columns they were using are now gone.)
2024-11-11 15:08:49 +00:00
lbrdnk
4850a85b7c Map Oracle DATE to type/DateTime (#49592)
* Map Oracle DATE to type/DateTime

* Modify test

* Add test
2024-11-11 15:11:04 +01:00
Ngoc Khuat
f1cf4abbc7 [Notification] Convert all mustaches emails to handlebars (#49759) 2024-11-11 19:30:19 +07:00
Kamil Mielnik
dbf9bfffca Fix flaky notebook test (#49771)
* Fix flaky test

* Bring back waiting

* Decrease flakiness
2024-11-11 18:11:20 +11:00
Kamil Mielnik
fb1e407f46 Fix flaky alert tests (#49673)
* Fix flaky tests

* Fix flaky tests
2024-11-11 18:10:27 +11:00
Kamil Mielnik
3f9ac93432 Fix flaky test (#49758) 2024-11-11 18:10:01 +11:00
Ngoc Khuat
5da6fb67a1 [Notification] Handlebars 👴 (#49645) 2024-11-11 11:12:08 +07:00
Nemanja Glumac
f9efc2127d Make "Add database" more prominent (#49678)
* Remove dead code from browse models page

* Use the grid to control the gap

* Implement "Add database" button

* Add basic unit tests

* Make sure the feature works when there are no databases

* Add analytics to the db list

* Add "Add database" button to the sidebar

* Add E2E Snowplow tests

* Add unit tests

* Deal with authentication in each beforeEeach separately

* Add Snowplow E2E test for a database card

* Slightly tweak the title line height
2024-11-09 13:25:59 +01:00
Chris Truter
e5f93b0772 Deprecate scores from search API response (#49653)
Search currently returns a detailed list of the scores for each item, which is pretty hefty, and the type is also coupled to the current rankers, which will change in future. 

Removing from the type to start to just validate that nothing uses it.

Best to just not model this. Going to see about just removing it from the BE as well, and put in some other way to debug. Worst case an opt-in query parameter.
2024-11-09 09:32:02 +02:00
appleby
2aadf71ea6 Enable debugUnreturnedConnectionStackTraces in data-warehouse-connection-pool-properties (#49456)
* Add blurb from C3P0 docs to comment for unreturnedConnectionTimeout

* Enable debugUnreturnedConnectionStackTraces in data-warehouse-connection-pool-properties

Closes #47981

* Add defsetting for jdbc-data-warehouse-debug-unreturned-connection-stack-traces

And only enable debugUnreturnedConnectionStackTraces in the C3P0 config if the setting is enabled. There is some
memory cost to enabling the setting, and since maxPoolSize is user-configurable, it seems safer to disable
debugUnreturnedConnectionStackTraces by default.

* Add metabase.logger/level-enabled?

* Log a warning if C3P0 logs are not configured correctly to log stack traces

Log a warning if the user enables the jdbc-data-warehouse-debug-unreturned-connection-stack-traces but does not raise
the log level for the com.mchange package to INFO or higher.

* Add docs for MB_JDBC_DATA_WAREHOUSE_DEBUG_UNRETURNED_CONNECTION_STACK_TRACES

* Improve markdown docs for MB_JDBC_DATA_WAREHOUSE_DEBUG_UNRETURNED_CONNECTION_STACK_TRACES

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-08 14:23:32 -08:00
Case Nelson
a2a4e7a56c fix: Handle bigquery string(255) in sync (#49800)
Fixes: #49786
2024-11-08 21:59:31 +00:00
adam-james
63ca4c1744 Keep Pivoted Option works in Subscriptions (#49559)
* Keep Pivoted Option works in Subscriptions

Fixes: #49525

Even though the user could toggle 'Keep data pivoted` in the Sharing Sidebar UI, the setting was not being propagated
to the backend, so attachments would not be pivoted.

* add a cypress test

* add viz settings to get the pivot working

* fix for linter

* remove eslint ignore

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-11-08 21:06:23 +00:00
Braden Shepherdson
bb0c4a9c48 [testing] Add explicit joins to the query generators (#49566)
I had to add `only-safe-columns` to filter out columns with known issues
in current pMBQL. In particular, implicitly joining on a column which
appears twice (eg. because of a double- or self-join) is ambiguous with
classic `:field` refs, and will cause errors.

There's a `:dynamic` var to re-enable all the columns for tests that are
only exercising new `:column` refs.
2024-11-08 20:49:40 +00:00
Jeff Bruemmer
f9ac943512 docs - add notes on oracle connection (#49795)
* add notes on oracle connection

* edit
2024-11-08 19:48:50 +00:00
Oleksandr Yakushev
7a16dce71e Disable connection reuse for requests that serve streaming responses (#49773)
* Revert "[streaming-response] Use HttpEndpoint.isOpen() instead of reading a byte from TCP socket (#49460)"

This reverts commit 060baf0ce4.

* Disable connection reuse for requests that serve streaming responses
2024-11-08 19:39:40 +00:00
Noah Moss
0d67c7c918 Enforce collection perms on native source-card IDs instead of requiring native query perms (#49364) 2024-11-08 13:58:14 -05:00
Alex Yarosh
d189040aec docs: update links to learn (#49789)
* docs: update links to learn

* bad replace

* Update docs/exploration-and-organization/events-and-timelines.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-08 13:32:38 -05:00
Braden Shepherdson
ad97273959 [testing] Add order-by to the generative testing for queries (#49565)
This introduces a reusable `weighted-choice` function and a "weight"
system for the various steps. `:order-by` should be more rare than
filters, etc., `:limit` and `:append-stage` should be more rare still.
2024-11-08 18:05:05 +00:00
Luis Paolini
34827169dd Bump Oracle driver (#49430)
* Bump Oracle driver

Move to ojdbc11

* Update modules/drivers/oracle/deps.edn

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>

---------

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-11-08 14:41:19 -03:00
Braden Shepherdson
a66a69e425 [testing] Add a few basic expressions to the generators (#49564)
Adds basic expressions to the query generators.

There's a lot more to do to robustly generate realistic expressions! But
this is enough to make expressions exist on queries, which then get
consumed as inputs to filters etc.
2024-11-08 11:35:33 -05:00
Ryan Laurie
4b7141f979 Prep for enabling multi-arch docker builds + Java 21 (#48910)
* build on java 21

* update docker image

* update test

* more using 21

* back to 11 for build

* update docker command

* update containerization

* update docker actions

* revert dockerfile change

* update other docker action versions

* use release commit for containerization
2024-11-08 09:27:47 -07:00
Jeff Bruemmer
1233547f77 remove cube driver from list of community drivers (#49780) 2024-11-08 15:38:00 +00:00
Mahatthana (Kelvin) Nomsawadi
02b09153ba Do not pollute SDK users window object (#49770) 2024-11-08 14:32:39 +00:00
Phoomparin Mano
df321012c3 fix(sdk): generated cli components has inconsistent styles after the style leak fix (#49723) 2024-11-08 21:30:16 +07:00
dpsutton
9d013a5f2d Revert "Remove old MB_API_KEY setting (#48592)" (#49507)
* Revert "Remove old `MB_API_KEY` setting (#48592)"

This reverts commit 187e9508a9.

* preserve metadata of the wrapped handler
2024-11-08 06:24:57 -08:00
Kamil Mielnik
88b03e22cd Remove @flaky tag from no longer flaking tests (#49608)
* Remove @flaky tag

* Unskip test and remove @flaky tag

* Remove @flaky tag

* Remove @flaky tag

* Revert "Remove @flaky tag"

This reverts commit 08c57add88.
2024-11-08 18:31:49 +07:00
Kamil Mielnik
946afe2916 Fix flaky 25885 repro (#49753) 2024-11-08 18:31:25 +07:00
Phoomparin Mano
6c8edfa7d3 feat(sdk): deprecate the ModifyQuestion component (#49747) 2024-11-08 10:02:06 +00:00
Kamil Mielnik
8d8ae87899 Fix flaky native query drill test (#49745)
* Try to fix flake

* See if timeout is necessary

* Revert "See if timeout is necessary"

This reverts commit 181f3c5e63.

* Revert change for coordinates filter
2024-11-08 09:52:19 +00:00
Kamil Mielnik
1eb307a55e Remove sandboxes tests from flaky jail (#49656)
* Remove @flaky tag

* Make workaround test pass

* Disable workaround test

* Uncomment and unquarantine the workaround test

* Disable normal test for now

* Revert "Disable normal test for now"

This reverts commit 68fa2175a7.

* Bring back quarantine

* Update comment
2024-11-08 16:46:09 +07:00
Phoomparin Mano
1b7c16c9e8 docs(sdk): fix dead link in sdk quickstart (#49749) 2024-11-08 16:17:55 +07:00
Mahatthana (Kelvin) Nomsawadi
57d786df8b Support localization in static embeds (#49441)
* Correct embedding hash options type semantically

* Pass `X-Metabase-Locale` to embed downloads

* wip locale header middleware

* Allow smart scalar text to be translated

* Stop using global variable

* Add more details to embedding types

* Extend the E2E util type and correct some properties types

* Add e2e test

* Fix dashboard name

* Add a test for static embed question

* Make a type name follows a convention

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* Fix failed E2E tests due to missing default values

* Fix public embed not working with `?locale` anymore

* Revert "wip locale header middleware"

This reverts commit 83d8d1358c.

* Preserve locale when in the `as-admin` macro is used

Motivating issue:

```shell
❯ http get 'http://localhost:3000/api/embed/dashboard/eyJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjEyfSwicGFyYW1zIjp7fX0.QZ-tEWpgJeSMUuaPfuH6_VQwM2yXNMcuureWCtHsszU/dashcard/162/card/124' x-metabase-locale:fr -pb | jq '.data|.cols|map(.display_name)'
[
  "State",
  "Count"
]
```

I'm running a query that has aggregated columns and it is returning the
untranslated. Note that these are computed and dynamically given a
display name.

```clojure
(case tag
  :count     (i18n/tru "Count")
  :cum-count (i18n/tru "Cumulative count"))
```

The problem is that we run embedding things as admin. And that gets the
current user, which in embed and public spaces is nil, and so binds a
nil to user-locale, which defaults to english when translating.

After:

```
❯ http get 'http://localhost:3000/api/embed/dashboard/eyJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjEyfSwicGFyYW1zIjp7fX0.QZ-tEWpgJeSMUuaPfuH6_VQwM2yXNMcuureWCtHsszU/dashcard/162/card/124' x-metabase-locale:fr -pb | jq '.data|.cols|map(.display_name)'
[
  "State",
  "Nombre de lignes"
]

❯ http get 'http://localhost:3000/api/embed/dashboard/eyJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjEyfSwicGFyYW1zIjp7fX0.QZ-tEWpgJeSMUuaPfuH6_VQwM2yXNMcuureWCtHsszU/dashcard/162/card/124' x-metabase-locale:zh -pb | jq '.data|.cols|map(.display_name)'
[
  "State",
  "行数"
]

❯ http get 'http://localhost:3000/api/embed/dashboard/eyJhbGciOiJIUzI1NiJ9.eyJyZXNvdXJjZSI6eyJkYXNoYm9hcmQiOjEyfSwicGFyYW1zIjp7fX0.QZ-tEWpgJeSMUuaPfuH6_VQwM2yXNMcuureWCtHsszU/dashcard/162/card/124' x-metabase-locale:es -pb | jq '.data|.cols|map(.display_name)'
[
  "State",
  "Contar"
]
```

This is fetching a dashboard's card which is a query of orders grouped
by created at month, sum of total.

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
Co-authored-by: dan sutton <dan@dpsutton.com>
2024-11-08 08:09:28 +00:00
Romeo Van Snick
cd68d42db7 Handle touch start capture as well as mouse down for popover (#49465)
* Handle touch start capture as well as mouse down for popover

* Also stop event propagation for touch events on menu item
2024-11-08 14:59:20 +11:00
Ngoc Khuat
f340a3aecb [Notification] Send notification options (#49576) 2024-11-08 02:31:43 +00:00
Raphael Krut-Landau
c4868c667e Fix label and link on authentication upsell card (#49707)
Closes #49534
2024-11-07 18:18:33 -05:00
Alexander Solovyov
5331d3816f redshift defines "text" as varchar(255) and we want it to be way longer (#49710) 2024-11-07 20:49:17 +00:00
Jeff Bruemmer
7348161cc4 docs - notes on database browser (#49726)
* notes on database browser

* typo
2024-11-07 20:36:20 +00:00
Raphael Krut-Landau
75d2498163 Ensure that correct error messages show up in the Edit user modal (#48966) 2024-11-07 10:35:10 -05:00
Raphael Krut-Landau
7ffdac9257 Remove withFeatures from renderWithProviders (#49137) 2024-11-07 10:34:52 -05:00
Jeff Bruemmer
96f9898d40 link fix (#49700) 2024-11-07 10:28:10 -05:00
Nicolò Pretto
c57b3a38e0 fix(sdk): put a bandage on the flashing error on static question in strict mode (#49659) 2024-11-07 16:19:38 +01:00
Luis Paolini
df23ed88ce Note about apsaradb (#49675)
* note about apsaradb

* Update docs/installation-and-operation/configuring-application-database.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-07 12:02:18 -03:00
Alex Yarosh
809d568858 docs: remove nested queires admin setting (#49699)
* docs: remove nested queries setting

* docs: remove mention of nested query setting
2024-11-07 09:59:31 -05:00
Alex Yarosh
ab5f9266e0 docs: contact support to change cloud env var (#49555)
* docs: cloud environment variables

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-07 09:59:18 -05:00
Nemanja Glumac
dd50957580 Re-introduce "Upload CSV" button for instances with DWH attached (#49545)
* Move the upload CSV button to the main nav bar

* Remove the old `SidebarOnboardingSection`

* Remove obsolete unit tests

* Rework E2E tests

* Add some spacing around the button

* Fix E2E test

* Break `MainNavbar` unit test down

* Expand unit tests

* Update E2E tests

* Fix E2E test failure

* Move JSDoc where it belongs

* Provide context for translators

* Simplify the condition
2024-11-07 15:50:20 +01:00
Oisin Coveney
652fafea3c fix(sdk): Fix visualization default size (#49672) 2024-11-07 16:30:49 +02:00
Oisin Coveney
a4828dc9e2 feat(sdk): Add chart settings to InteractiveQuestion (#49167) 2024-11-07 16:13:44 +02:00
github-automation-metabase
1815b5248f Update Readme version references and published npm version to 1.52.1 (#49674) 2024-11-07 13:45:54 +00:00
Ngoc Khuat
977429c46f Email throttling config (#49477) 2024-11-07 12:25:00 +00:00
Kamil Mielnik
6bf6a5de38 Fix - Values from the returned rows not present in the visualization are interpolable in the URL but don't have values (#49530)
* Fix #46318

* Add repro for #46318

* Move setup to beforeEach
2024-11-07 15:54:50 +07:00
adam-james
63151f4e23 Filter out Empty Rows from Pivot Exports (#49512)
* Pivot Measures Order Used in Pivot Exports

Fixes #48442

A pivot table can have any number of measures, and the user can order these by dragging in the UI. Before this PR,
that order was ignored and measures would alway be in index order, which is confusing for any user who needs the
measures to be displayed in a particular order, especially if they've re-ordered them in the pivot viz settings UI.

A test has been added to check that measure order is used.

A few minor changes to the pivot qp and post-processor
 - measure indices are looked up in the pivot qp and added in viz-settings order
 - the pivot measures are only added if the qp has not already added them.
 - pivot-opts Malli spec has been made in the namespace, adjusted to allow `nil` as a valid pivot-opts output, and
 used in relevant functions

* address review points.

* add a rows order test

* Filter out Empty Rows from Pivot Exports

Fixes #49353

The linked issue is not actually related to pivot export size but is instead related to the 'Min of Created At: Month'
aggregation; the default aggregation function was `+`, so it broke when the date string was encountered.

That was fixed.

As I was trynig to keep the export small if possible, I noticed that in some cases empty rows are appended, so I added
the filter so that if a pivot row's values are completely empty, it doesn't add it.

Finally, this PR also adds the 'sub section totals' which I noticed were missing from the exports. This comes up when
you have 3+ pivot-rows configured, so you can see the subtotals for the first pivot row and the subtotals nested
within those sections for the second pivot row, and so on.

* add test for non-numeric values

* Make sure the new name refs match on aggregations not just breakouts

* cljfmt
2024-11-06 22:20:52 +00:00
Noah Moss
3953460236 Make sure a new table gets table-level block if any other tables have table-level block (#49509) 2024-11-06 17:13:00 -05:00
Ryan Laurie
ce19393b37 Fix auto-release artifact name collision (#49626) 2024-11-06 13:02:34 -07:00
Ryan Laurie
1a921a831a Push metabot to stats (#49554)
* push metabot to stats

* use metabot tag instead
2024-11-06 11:33:12 -07:00
Phoomparin Mano
dba17e6c36 feat(sdk): small usability improvements for embedding cli (#49591)
* move the database prompt to the very beginning

* ability to use sample database for cli

* print username and password in console

* no tenancy isolation as a default option

* highlight sample credentials file

* update credential log messages

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* continue without tenancy isolation

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-06 23:50:20 +07:00
Alexander Solovyov
012e0c5f78 [serdes] meaningful API status codes (#49610)
previously import would return 200 w/o regard if it was successful or not

fixes #49602
2024-11-06 16:18:54 +00:00
Alexander Polyankin
240634d336 Fix :pivot-measures with column names (#49575)
* Fix :pivot-measures with column names

* Fix the test

* Update src/metabase/query_processor/pivot.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Add a test

* Add a test

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-11-06 15:46:58 +00:00
Kamil Mielnik
17c271d87f Fix flaky #31274 repro (#49601)
* Remove @flaky tag

* Fix flake

* Refactor

* Use getDashboardCard

* Shorten text

* Fix flake

* Revert previous changes

* Revert "Revert previous changes"

This reverts commit 16b56f268e.

* Fix flake
2024-11-06 15:44:34 +00:00
Kamil Mielnik
f6b8e1e8a3 Fix flaky datamodel test (#49583)
* Remove @flaky tag

* Fix flake

* Try typing delay instead

* Improve comment

* Bring back original solution
2024-11-06 15:32:35 +00:00
Luis Paolini
ebf8bb9215 Add static embedding iframe resizer package license note (#49609)
* Update static embedding iframe resizer

* Update docs/embedding/static-embedding.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-06 18:19:37 +03:00
Jeff Bruemmer
35d89b052e docs - sdk edits (#49480) 2024-11-06 09:35:37 -05:00
Nicolò Pretto
8766bfa37e fix type errors that appear on the mantine branch (#49590)
Co-Authored-by: Poom poom@poom.dev
2024-11-06 15:25:18 +01:00
Braden Shepherdson
46191072d0 [testing] Add filters to random query generators (#49448)
Adds filters to generative testing for queries.

There's a lot of new code here, but don't panic, it's quite straightforward:
generating filter values, in the right shapes for various filter expressions.
2024-11-06 09:18:27 -05:00
Uladzimir Havenchyk
82728422c3 convert qb actions to ts (#48611) 2024-11-06 14:36:14 +03:00
Oisin Coveney
d477b55947 Convert Embedding icon hook to CSS and use semantic colors (#49478) 2024-11-06 08:26:21 +00:00
Nicolò Pretto
6452cd3c17 feat(sdk): refactor the auth code to provide better error messages (#49214)
* refactor + more specific auth errors

* fix linting issues

* make tests pass, again

* make test pass for real?

* continues the refactor and hopefully makes tests pass

* try to simplify the logic a little bit more

* also logs to the console for the edge case of invalid session

* remove setLoginStatus

* fix typo

* fix debug line that should have been commented

* remove dead code

* remove test for code that doesnt exist

* address feedback from PR

* update test copy

* Update enterprise/frontend/src/embedding-sdk/store/auth.ts

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* Update enterprise/frontend/src/embedding-sdk/store/auth.ts

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* update copy for site settings error

* ex -> exception

* Update enterprise/frontend/src/embedding-sdk/store/auth.ts

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* Update enterprise/frontend/src/embedding-sdk/store/auth.ts

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* update tests to use the updated copy + small typos

* refactor: use jest spy on to check for console.error
Co-authored-by: "Mahatthana (Kelvin) Nomsawadi" <me@bboykelvin.dev>

* use full error message in test

* renamed response to session

* mock implementation of console.log

* fix(49482): don't create a new store on each MetabaseProvider render (#49492)

* fix(49482): don't create a new store on each MetabaseProvider render

* remove store prop as it seems to not be used

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-06 09:15:32 +01:00
Ngoc Khuat
3e33ab4cb9 [Notification] Pulse clean up 2 (#49519) 2024-11-06 15:10:05 +07:00
Ngoc Khuat
a0598e466a [Notification] Pulse clean up (#49419) 2024-11-06 05:14:02 +00:00
Ngoc Khuat
34ec746983 [Notification] Soft migrate dashsub and alert to notification (#49210) 2024-11-06 03:20:40 +00:00
github-automation-metabase
00d5c7178b Add v0.50.32 to the list of releases (#49568)
* Add v0.50.32 to the list of releases

* Update releases.md

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2024-11-06 01:32:18 +00:00
Jeff Bruemmer
71520bcc23 prettier formatting (#49551) 2024-11-05 16:56:30 -05:00
Alexander Polyankin
632e138681 Use column names instead of field refs for pivot viz settings (#49414) 2024-11-05 20:05:39 +00:00
metamben
b0eb248971 Check only :stages of the result of metric resolution in the QP (#49506)
The query can contain all kinds of things, in particular the whole original query in the case of pivot questions, so
we should check only the part that actually gets resolved by the middleware.
2024-11-05 19:06:14 +00:00
Case Nelson
e8e77d643e perf: Implement faster sync methods for mysql (#49011)
* perf: Implement faster sync methods for postgres

Fixes #48575

Pulls work from redshift into the common postgres driver.

* Fix tests and formatting

* Move nested-field-column sync to sync functions so describe-fields will also get them

* Fix test

* Fix test

* Remove fixed safety test

* Add test specific database-supports feature for pk metadata

* Fix test

* perf: faster mysql sync with describe-fields

Fixes: #49010

* Adrress PR feedback

* Fix tests

* Fix test

* Add nil table-schema

* Don't use subselect for field-comment

* Fix quoting weird identifiers

* Make format string inline

* Update src/metabase/driver/mysql.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Update src/metabase/driver/mysql.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Fix tests

* Fix database-type

* Fix tests

* Fix test

* Fix tests

* Exclude mysql table_schema

* Handle tinyInt1IsBit

* Fix test

* Only get one db at a time

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-11-05 09:26:00 -07:00
Denis Berezin
839b713f50 feat(sdk): Allow to hide columns in CollectionBrowser (#49449)
* Add possibility to hide columns in CollectionBrowser

* Add tests

* Review fixes

* Fix e2e
2024-11-05 19:23:14 +03:00
Luis Paolini
f1a6b53f5a Correct Azure SAML (#49349)
* Correct Azure SAML

* Update saml-azure.md

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-11-05 13:19:03 -03:00
Braden Shepherdson
5dd1cca580 [util] Add u.time/local-date, local-time and local-date-time (#49445)
These are helpful for creating literal dates and times in a
cross-platform way. Useful for generating queries, in particular for
expression and filter values.
2024-11-05 14:20:03 +00:00
Ryan Laurie
11324019e3 Add base color palette (#49356)
* add base color palette

* add some more comments

* fix formatting and color copy-pasta errors

* ignore existing bad base color usage

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-11-05 06:50:21 -07:00
Denis Berezin
9f49d1aa14 feat(sdk): Add isOpen prop to control CreateDashboardModal visibility (#49452)
* Add isOpen prop to control CreateDashboardModal

* Add props to storybook
2024-11-05 16:45:08 +03:00
Braden Shepherdson
fddd02bdc1 [MBQL lib] Match implicitly joined refs with multiple paths (#49446)
The ref (usually) contains enough information to unambiguously find the
matching implictly-joined column, even if there are several FKs that
could join the target table.

The remaining ambiguous case is if the *same* FK column exists
multiple times - current MBQL uses raw field IDs for the FK field, so it
can't distinguish between eg. an FK in the main table and the one from a
self-join.
2024-11-05 08:44:43 -05:00
Luis Paolini
13bc2e1b65 Update api-changelog.md (#49495)
Added https://github.com/metabase/metabase/pull/49206 to the changelog (missed that on the PR)
2024-11-05 08:35:23 -05:00
Denis Berezin
4dce302c1a Add a note about multiple dashboards (#49451) 2024-11-05 15:33:39 +03:00
Chris Truter
7991f9619e Update Macaw to 0.2.24 and set its run mode (#49337) 2024-11-05 12:59:37 +02:00
Kamil Mielnik
8ed623adf8 Update saveDashboard helper to wait for the GET /api/dashboard/:id (#49522)
* Update saveDashboard helper to wait for the GET /api/dashboard/:id request
- update aliases to be unique so that they don't interfere with aliases used in tests

* Remove no longer needed intercept + wait
2024-11-05 17:48:11 +07:00
Romeo Van Snick
c1862eeada Fixed width filters (#49464)
* Fix dirty yarn.lock

* Use fix width popover for filter pickers

* Add e2e test to reproduce #49321

* Do not rely on implementation width for test
2024-11-05 21:36:32 +11:00
Oleksandr Yakushev
060baf0ce4 [streaming-response] Use HttpEndpoint.isOpen() instead of reading a byte from TCP socket (#49460)
* [streaming-response] Use HttpEndpoint.isOpen() instead of reading a byte from TCP socket

* Comment out cancellation test
2024-11-05 11:50:15 +02:00
Romeo Van Snick
518e79b8fb Fix missing question type for metrics (#49489)
* Fix missing question type for metrics

* Add e2e test to reproduce #49454
2024-11-05 18:32:43 +11:00
Romeo Van Snick
e840233a4f Add custom selectionchange handler (#49511) 2024-11-05 18:00:10 +11:00
Kamil Mielnik
924c6d3153 Fix flaky #16559 repro (#49472)
* Fix flaky #16559 repro

* Wait for getCollections

* Clean up helper

* Wait for cardQuery before saving the dashboard
2024-11-04 23:41:50 -05:00
Case Nelson
516f03f510 fix: tests for clickhouse development (#49347) 2024-11-04 15:42:51 -07:00
github-automation-metabase
bd0a008013 Add v0.51.2 to the list of releases (#49510)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-11-04 17:35:19 -05:00
Ryan Laurie
6bffd075d7 Remove daisy-chaining from pre-release tests (#49093)
* only tag nightly on the current version

* add release channel setting to publish job

* clean up release workflow

* remove code from something else

* reduce depth of the release process stack

* update build job too

* remove dead arg
2024-11-04 14:31:09 -07:00
adam-james
e005f7bb76 Pivot Measures Order Used in Pivot Exports (#49367)
* Pivot Measures Order Used in Pivot Exports

Fixes #48442

A pivot table can have any number of measures, and the user can order these by dragging in the UI. Before this PR,
that order was ignored and measures would alway be in index order, which is confusing for any user who needs the
measures to be displayed in a particular order, especially if they've re-ordered them in the pivot viz settings UI.

A test has been added to check that measure order is used.

A few minor changes to the pivot qp and post-processor
 - measure indices are looked up in the pivot qp and added in viz-settings order
 - the pivot measures are only added if the qp has not already added them.
 - pivot-opts Malli spec has been made in the namespace, adjusted to allow `nil` as a valid pivot-opts output, and
 used in relevant functions

* address review points.

* add a rows order test
2024-11-04 20:23:08 +00:00
Ryan Laurie
89ad60ae1a Add release channel option to publish job (#48633)
* only tag nightly on the current version

* add release channel setting to publish job

* clean up release workflow

* remove code from something else

* fix step title
2024-11-04 12:42:11 -07:00
Braden Shepherdson
d82015eb22 [testing] Add breakouts to random query generators (#49413)
Also fix a bug in `lib.breakout/existing-breakouts` that treated
breakouts on duplicate columns from different joins as existing, even
though they're not.
2024-11-04 13:02:43 -05:00
Alex Yarosh
bfe568e8a1 remove case workaround (#49490) 2024-11-04 11:31:06 -05:00
Kamil Mielnik
1923709c5f Fix flaky custom column test (#49476)
* Fix flaky custom column test

* Fix flaky custom column test
2024-11-04 15:15:26 +00:00
Oisin Coveney
4162c2f0a4 Memoize useChartSettingsSections variables (#49470) 2024-11-04 16:33:19 +02:00
Phoomparin Mano
de559f49d6 feat(sdk): ability to enforce the destination collection to save to and hide the collection picker (#49251)
* add ability to hide the collection picker

* add save options

* make sure collectionId is fresh

* update sdk question form component

* make collectionId accept null

* apply saveOptions to sdk components

* revert to use initialCollectionId as context name

* target the correct collection id

* add e2e tests

* update e2e tests

* move into within

* update test

* remove collectionId from default args

* revert e2e of hide columns

* make e2e helper more generic

* use saveToCollectionId prop to save to a specific collection

* update e2e tests

* update comment formatting

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* clean up leftover changes from an earlier version

* readme update

* indicate that saveToCollectionId is only applicable to static questions

* revert QuestionEditor.isSaveEnabled defaults

* update comment format

* remove unused initialCollectionId prop

* experiment: try to fix failing custom-columns e2e

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-11-04 20:49:13 +07:00
Romeo Van Snick
089fb7000c Assume question is dirty when edited from notebook (#49428)
* Consider a modified question dirty as well

* Add e2e tests for 48829
2024-11-04 22:10:55 +11:00
Oisin Coveney
d5377880e4 Move section logic to hook (#49334) 2024-11-04 11:20:57 +02:00
Romeo Van Snick
403c260eca Fix dirty yarn.lock (#49463) 2024-11-04 07:08:32 +00:00
Nick Fitzpatrick
06dd8dcffb Adding moderated status to entity picker (#49404)
* Adding moderated status to entity picker

* adjusting verified icon size

* size adjustments

* e2e test adjustments

* removing verified model icon

* fixing e2e test

* unit test

* unit test adjustment
2024-11-03 20:54:23 -04:00
Nick Fitzpatrick
4a6c1d268e Dashboard verifications (#48956)
* Adding moderation status to Dashboards

* react sins

* verification coll: subselect on card + dashboard

* fix the 3 failing BE tests

* add an api test for dashboard verification

* verified dashboards are never stale

* e2e tests

* code cleanup

* unit test and e2e test cleanup

* PR Feedback

* backend test fixes

* Nick shouldn't touch clojure

* type fix

* indent

* fix last 2 BE tests

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
2024-11-01 19:39:22 -06:00
Romeo Van Snick
896c516d98 Use list picker when searching a single value (#49323)
* WIP: use list picker when searching a single value

* Add test case for multi vs non-multi search fields

* Update loki snapshots

* Add special case to test for multiautocomplete filter

* Use single select value in test

* Add test for using list picker

* Explicitly make sure elements are visible

* Do not use list selector when search is disabled

* Add margin to multi autocomplete dropdown

* Update loki snapshots

* Update loki snapshots
2024-11-01 22:33:51 +00:00
Noah Moss
9cfc06eff2 Make sure metrics migration populates all permissions fields (#49443) 2024-11-01 21:19:28 +00:00
Alex Yarosh
afeeab14aa update custom expressions limitations (#49447) 2024-11-01 16:22:13 -04:00
Braden Shepherdson
972ef2b8a1 [MBQL lib] Relax schema to avoid spammy normalization warnings (#49190)
In particular, this allows for a nearly-blank query without its
`:database` set.
2024-11-01 19:45:07 +00:00
Raphael Krut-Landau
db82ec7146 Simplify the "Edit segment"/"Retire segment" actions and modal (#48998) 2024-11-01 12:26:16 -04:00
Raphael Krut-Landau
9fcfc5b5e7 Remove dead code: FullPageModal (#49184) 2024-11-01 12:25:38 -04:00
Raphael Krut-Landau
6742879b84 Give the command palette a higher z-index (#49387) 2024-11-01 12:25:19 -04:00
dpsutton
f1fc4f3ac9 bump snowflake driver version (#47997)
* bump snowflake for java 17+

* Update modules/drivers/snowflake/deps.edn

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>

* Update deps.edn

---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-11-01 12:44:14 -03:00
Case Nelson
5bbafa83f5 fix: add UserAgentEntry to databricks connection (#49361)
* fix: add UserAgentEntry to databricks connection

Fixes: #49350

* Add test

* Fix formatting
2024-11-01 09:08:52 -06:00
Denis Berezin
5879f90bfa fix(sdk): Fix interactive dashboard scroll in fullscreen mode (#49366)
* Fix scroll for EditableDashboard in fullscreen mode

* Fix scroll for InteractiveDashboard in fullscreen mode

* Display fullscreen control to dashboards by default

* Fix issue with public shared questions empty footer
2024-11-01 14:34:11 +03:00
Romeo Van Snick
ff0aa11054 Add yarn.lock change for elliptic 6.6.0 (#49424) 2024-11-01 11:25:23 +00:00
Romeo Van Snick
47a87dee16 Revert "Avoid native editor autocomplete suggestions flicker (#45136)" (#49417)
This reverts commit fedd146699.
2024-11-01 05:40:48 +00:00
Romeo Van Snick
7e3ddd69c3 Set elliptic to ^6.6.0 (#49383) 2024-11-01 03:27:59 +00:00
Braden Shepherdson
039046a8e4 [QP] Update breakouts in :order-by when setting time granularity (#49403)
Previously these were omitted, and it caused invalid SQL to be
generated, since the ORDER BY (time unit not updated) and GROUP BY
(time unit updated) did not line up.

Fixes #49263.
2024-10-31 19:41:00 +00:00
Braden Shepherdson
74ff7169c4 [testing] "Random walk" query generation (#49124)
Lays the foundation for a weighted probability approach to generating infinite sequences of valid queries.

Only has aggregations so far, but we can expand it to filters, breakouts, order-by, removals etc. etc. in later PRs.
2024-10-31 19:40:09 +00:00
Kamil Mielnik
50a1cdbbe9 Fix flaky #34574 repro (#49382)
* Fix flaky #34574 repro

* Format code

* Add a wait

* Decrease flakiness

* Fix flake

* Update comment
2024-10-31 19:37:28 +00:00
Kamil Mielnik
a4d50c7482 Fix flaky public links tests (#49392)
* Fix flaky test

* Fix flaky test
2024-10-31 18:51:29 +00:00
Denis Berezin
cf934f928d fix(sdk): pin iframe-resizer version to avoid excess logs for sdk cli (#49312) 2024-10-31 18:38:37 +00:00
lbrdnk
f40dc5f25e Adjust dependent dashboard cards (#49308)
* [WIP] Adjust dependent dashboard cards

* Use transducer to make it less hairy (?)

* Looks better now

* Exception handling and log

* Throw away indices

* Add mapping deletion

* Avoid redundant db roundtrips

* Add test

* Update update-mapping

* Docstring

* Docstrings

* Format

* Comment

* comment

* Shutdown deletion

* Adjust update generationcode

* Add tests

* Comment

* Remove deletion completely for now

* Use transaction

* Update test

* Comment

* Update src/metabase/models/card.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Update src/metabase/models/card.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Update src/metabase/models/card.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Format and parens

* Address remaining remarks

* cljfmt

* Update src/metabase/models/card.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Address review remarks

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-10-31 18:49:22 +01:00
lbrdnk
6923ccb0fb [Databricks] Use system's information schema during sync (#48950)
* Use system schema

* Use data only from selected catalog

* Adjust tests

* Update modules/drivers/databricks/test/metabase/driver/databricks_test.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Comments

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-10-31 17:50:42 +01:00
Oleksandr Yakushev
741b1bd4e7 [date-2] Extend fastpath fo date parsing for ms-including ISO timestamps (#49203) 2024-10-31 18:35:26 +02:00
Jeff Bruemmer
537228e1d5 docs - SDK readme (#49253) 2024-10-31 12:18:58 -04:00
Nick Fitzpatrick
54ec54b75c change command palette to use moderation icon from ee (#49224) 2024-10-31 12:52:51 -03:00
Raphael Krut-Landau
91a7e4d910 Remove a 10-second wait from an e2e test (mini-PR) (#49120) 2024-10-31 11:06:59 -04:00
Kamil Mielnik
5ad318b006 Fix flaky #25374 repros (#49379)
* Fix flaky 25374-3 test

* Fix flaky 25374-4 test

* Fix race conditions

* Decrease flakiness

* Fix wrong param

* Bullet-proofing
2024-10-31 14:40:49 +00:00
Mahatthana (Kelvin) Nomsawadi
c7231ee7d0 Update fullscreen dashboard filter on dark theme (#49343)
* Update fullscreen dashboard filter on dark theme

* Use the latest base color name

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-10-31 14:08:30 +00:00
Alexander Polyankin
c01d67df0e Allow boolean functions in custom columns (#49129) 2024-10-31 10:04:57 -04:00
Jeff Bruemmer
516ac41f95 docs - remove databricks community driver (#49386) 2024-10-31 13:45:03 +00:00
Luis Paolini
d50fb86a2b Add table_id in the database fields endpoint (#49206)
Fixes https://github.com/metabase/metabase/issues/14437
2024-10-31 10:07:42 -03:00
Alexander Polyankin
83f0efc8c3 Fix relative date time FE i18n issues (#49241)
* Fix relative date time FE i18n issues

* Fix an issue
2024-10-31 09:02:54 -04:00
Kamil Mielnik
e3d1b619ee Fix - Tab key does not change focus in expression editor (#49342)
* Fix #49036

* Add explanatory comments

* Improve comment

* Improve comment

* Update comment

* Add repro for #49036

* Exclude custom Shift + Tab handling
2024-10-31 19:59:25 +07:00
Nicolò Pretto
31b8daf1b3 docs(sdk): remove extra duplicated line (#49380) 2024-10-31 07:30:18 -04:00
Romeo Van Snick
08cf3417c0 Update http-proxy-middleware to ^2.0.7 (#49369) 2024-10-31 21:43:46 +11:00
Romeo Van Snick
ad8ba4bdcf Update markdown-to-jsx (#49370) 2024-10-31 21:37:43 +11:00
Romeo Van Snick
c56ec99934 Update elliptic to ^6.6.0 (#49371) 2024-10-31 21:37:31 +11:00
Romeo Van Snick
fedd146699 Avoid native editor autocomplete suggestions flicker (#45136)
* Manually remove bad matches when preparing results for ACE

* Do two-phase autocompletion

* Allow single-character completions

* Add test for flickering autocomplete results

* Fix autocomplete tests

* Simplify autocomplete helpers

* Handle empty results in autocomplete

* Fix e2e test
2024-10-31 20:48:15 +11:00
Noah Moss
216d887955 Skip model persistence for users using connection impersonation (#49185) 2024-10-30 17:39:51 -04:00
Case Nelson
318e448959 perf: Implement faster sync methods for postgres (#48576)
* perf: Implement faster sync methods for postgres

Fixes #48575

Pulls work from redshift into the common postgres driver.

* Fix tests and formatting

* Move nested-field-column sync to sync functions so describe-fields will also get them

* Fix test

* Fix test

* Remove fixed safety test

* Add test specific database-supports feature for pk metadata

* Fix test

* Adrress PR feedback

* Fix test

* Don't use subselect for field-comment

* Fix quoting weird identifiers

* Make format string inline
2024-10-30 14:24:39 -06:00
Oleksandr Yakushev
9ab8d426c3 [redshift] Disable legacy parsing implementation for Redshift driver (#49205) 2024-10-30 12:53:18 -07:00
Oleksandr Yakushev
38a9eb3a72 [qp] Convert timestamps to strings as the last post-processing step (#49209) 2024-10-30 12:52:21 -07:00
Noah Moss
6f7a54ad31 Add MB_NOT_BEHIND_PROXY env var to explicitly skip using X-Forwarded-For header (#49302) 2024-10-30 15:44:03 -04:00
Jeff Bruemmer
3fa450e20e docs - note on databricks legacy catalogs (#49354) 2024-10-30 14:17:35 -04:00
Denis Berezin
548a9a7433 fix(sdk): Editable dashboard should not overlap content below it (#49293)
* fix(sdk): Editable dashboard should not overlap content below it

* Add sizing note
2024-10-30 20:54:36 +03:00
Nemanja Glumac
35d99ba88b tech: Refactor and improve AppBanner (#49273)
* Remove unused component

* Remove extra space

* Remove cross-component dependency on the `Banner`

* Use named export

* Convert the Banner to TS

* Make `ReadOnlyBanner` use `Banner` under the hood

* Add test id to the banner

* Simplify render method and tests

* Add the missing test for ReadOnly banner

* Avoid using special ASCII characters for the common apostrophe

* Remove E2E spec

* Use `Banner` for `DatabaseInfoField`

* Use colors defined in the theme

* Remove the dependency on the `Banner` component again!

* Add a comment

* Use pattern matching
2024-10-30 12:35:04 +00:00
Oisin Coveney
a122a6b7cc Move ChartSettings to Dashboard and Question variants (#49220) 2024-10-30 13:20:50 +01:00
Oleksandr Yakushev
14433723a8 [insights] Ensure that timestamps aren't converted to ratios (#49204) 2024-10-30 12:00:35 +00:00
Nicolò Pretto
842f3f358f fix: make cards the same height in the share modal (#49298) 2024-10-30 09:34:31 +01:00
Mahatthana (Kelvin) Nomsawadi
53518074ff Update static embed card copy to avoid confusion (#49268)
* Update static embed card copy to avoid confusion

* Fix E2E tests

* Fix unit tests

* Update the copy inside static embed modal
2024-10-30 07:04:52 +00:00
lbrdnk
19680bf09b Select only compatible fields from idFields (Mongo specific) (#49262)
* Select only compatible fields from idFields

* Use isComparableWith to filter target fields

* Remove filter-comparable-fields

* Add test
2024-10-30 02:35:58 +01:00
adam-james
d23d7a3a03 Mongo objects should download as JSON, not EDN (#49255)
* Mongo objects should download as JSON, not EDN

Fixes #48198

Prior to this change, object columns (base or effective type of :type/Dictionary) were just formatted with `(str
value)` which results in a csv or json download containing EDN formatted objects.

This is a bug because we present object column values as json in the app, so the expected formatting of the download
should match this.

The formatter function now takes this type into account. As well, since this is a type of formatting that should be
always applied (even when format_rows is false), the function is modified to unconditionally apply the json/encode
formatting to dictionary types when encountered.

* add a test

* add proper condition to test

* card-download should be public

* uncomment json encoding formatter

* set-cell! should keep encoded json string for Objects

I think this is the correct change; I don't really understand the reason for wrapping, encoding, decoding, and then
string-ing that value. Maybe I'm missing something.

* Adjusted xlsx Object set-cell! implementation

* forgot the not... inverted
2024-10-29 17:09:51 -07:00
Romeo Van Snick
32cb5b785b Avoid overwriting text on snippet insertion in some cases (#49213)
* Update cursor position when selection changes

* Add reproduction for #33640

* Revert "Add reproduction for #33640"

This reverts commit 573f6320f5.

We cannot reproduce the bug with tests, so having a test is useless.
2024-10-30 10:15:01 +11:00
Jeff Bruemmer
d053ef08e9 docs - postgres auth providers (#49311) 2024-10-29 21:23:42 +00:00
Nick Fitzpatrick
8f3a30c5a5 fix broken css rule, remove description from field table (#49286)
* fix broken css rule, remove description from field table

* adding back description
2024-10-29 17:02:40 -03:00
Alex Yarosh
3ed6cb81f8 docs: clarify downloading results in static embedding (#49294)
* docs: clarify downloading results in embedding

* docs: static params table description

* format

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-29 14:14:01 -04:00
bryan
c3f9a20ea8 is-hosted and ag-mode are mutex (#49259) 2024-10-29 17:26:45 +00:00
Raphael Krut-Landau
16a4ac4aae In sidesheets, show correct sources for a model (#49119) 2024-10-29 11:05:40 -04:00
Jeff Bruemmer
a223f819c7 docs - add load-sample-content (#49284) 2024-10-29 14:18:28 +00:00
Noah Moss
28b0e3c5b5 Fix logic for deployment-model in stats ping (#49260) 2024-10-29 10:15:26 -04:00
Nicolò Pretto
32f9d0f2cf test(sdk): remove setupEnterprisePlugins from test setup as we don't (#49271)
have them in the real codebase + to remove warnings from test output
2024-10-29 13:12:54 +00:00
Oisin Coveney
58dab8c9fa Convert QB to typescript (#49035) 2024-10-29 13:00:39 +00:00
Romeo Van Snick
98cdc6dcc8 Remove dirty question overlay when an error occurred (#49217)
* Add reproduction for #12586

* Do not show the dirty overlay when an error occurred

* Fix tests that rely on dirty overlay

* Add issue tag to test case

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-10-29 11:43:14 +00:00
Romeo Van Snick
617d21025f Avoid filter popover overflow (#49211)
* Add max-height to the click actions popover to prevent overflow and infinite scroll

* Add reproduction for #48851

* Update reproduction to speed it up

* Use existing helper for table header click

* Add max height to string filter picker

* Revert "Add max-height to the click actions popover to prevent overflow and infinite scroll"

This reverts commit 166478d892.
2024-10-29 20:27:47 +11:00
Oisin Coveney
70904e8cd9 fix(sdk): Improve InteractiveQuestion chart selector (#48837) 2024-10-29 11:03:29 +02:00
Aleksandr Lesnenko
9b4d3d2b2e Add grey color accent (#49130)
* add grey accent color

* fix pie chart color assignment

* specs

* update grey accent

* update colors

* grey -> gray 🦅
2024-10-29 02:28:50 +00:00
bryan
abc35fe8b6 never show the ai section in AG (#49199)
- AG instances cannot connect to open ai
2024-10-29 01:05:19 +00:00
John Swanson
b465d938bb Items in the audit collection are not cleaned up (#49247)
The audit collection is a bit weird. Users have permissions on the
collection but even superusers don't actually have write permissions on
the elements within it.

For now, I'm just excluding anything in the audit collection from the
"stale" endpoint, so we won't suggest cleaning these up, but I wonder if
maybe there's a cleaner way here. It feels weird to fake permissions
like this.

Fixes https://github.com/metabase/metabase/issues/49164
2024-10-28 14:01:23 -07:00
Nemanja Glumac
b35755f9e0 Better Onboarding: Introduce "Admin onboarding checklist" (#48898)
* Add new route

* Add the navigation link

* Guard the route

* Add first pass of the page structure

* Add the bottom section

* Add placeholder dummy YT videos

* Add images

* Track checklist being opened

* Track checklist item expanded

* Track checklist item CTA clicked

* PoC: Stop the video on accordion change

* Use actual onboarding videos

* Fix missing unique `key` prop

* Final content tweaks

* Override the accordion styles defined in the `theme`

* Use predefined t-shirt sizes where possible

* Update copy

* Conditionally display the example dashboard CTA

* Add very basic unit test coverage

* Show onboarding link to new instances only

* Remember the last position in the onboarding

* Fix the mock settings types

* Scroll last opened item into view

* Properly display docs links

* Another accordion style override

* Add tests for the Onboarding page contents

* Add E2E Snowplow tests

* Conditionally display xray item contents based on settings

* Split tests

* Make sure items scroll into view when expanded

* Do not show example question CTA if example dashboard doesn't exist

* Allow YT videos to play in fullscreen

* Add comments about the example question

* Update rules for when we show the onboarding nav link

* Test the conditional documentation links display

* Reduce E2E test flakiness
2024-10-28 20:58:02 +01:00
Phoomparin Mano
3ea2530ca8 docs(sdk): add loading and error states to docs (#49246)
* document loader and error states

* document loader and error states in the docs

* revert changes to README.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-29 02:00:47 +07:00
Jeff Bruemmer
e2036b6142 samples sync (#49237) 2024-10-28 12:45:06 -04:00
Mahatthana (Kelvin) Nomsawadi
6a3fe64e3f Update instruction on running SDK built with master (#49240) 2024-10-28 16:02:30 +00:00
Aleksandr Lesnenko
1bb08949d2 Fix sunburst color assignment that causes pie chart crashing (#49183)
* pie chart crashes when light or dark accents of instance colors overriden

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-10-28 10:13:24 -04:00
Alexander Polyankin
006dbdecde E2E test for "Custom click behavior on a pivot table will go always to tab 1 on a destination dashboard with several tabs" (#49187)
* Add tests

* Add tests

* Add tests
2024-10-28 09:52:20 -04:00
Alexander Polyankin
372cbd3e5d Invert exclude filter checkbox state (#49178) 2024-10-28 09:52:05 -04:00
Alexander Polyankin
81e57dedae Fix adding a time in legacy date picker (#49121)
* Fix adding a time in legacy date picker

* Fix the test
2024-10-28 09:51:16 -04:00
Oisin Coveney
7d4bfaaee6 Convert ChartSettingsButton to mantine (#49171) 2024-10-28 15:34:03 +02:00
Phoomparin Mano
a22441d500 test(sdk): assert abort calls on static question unmount (#49197) 2024-10-28 20:25:01 +07:00
Kamil Mielnik
ec6c0880d0 Introduce verifyNotebookQuery e2e util (#49216)
* Add verifyNotebookQuery helper

* Use describeEE

* Fix DB id

* Refactor test

* Refactor tests

* Introduce customizeLinkText helper

* Use verifyNotebookQuery

* Fix test setup
2024-10-28 19:35:01 +07:00
Oisin Coveney
0532b7b1dc Move view styled components to corresponding component folders (#49140) 2024-10-28 11:23:39 +02:00
Aleksandr Lesnenko
727731bb13 Fix pie invalid other percentages (#49068)
* fix invalid pie other slice percentage label

* fix invalid percentages of grouped into other rows

* spec

* spec

* Update Loki Snapshots

* Update Loki Snapshots

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-10-25 22:01:08 +00:00
Noah Moss
6d7bc0684c Ensure we clean up model persistence table when model or DB is permanently deleted (#49112)
Co-authored-by: bryan <bryan.maass@gmail.com>
2024-10-25 21:15:52 +00:00
Alex Yarosh
0c40e7562f docs: minor 51 notes (#49191)
* minor 51 notes

* Update docs/questions/sharing/visualizations/line-bar-and-area-charts.md

* link

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* review

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-25 20:47:22 +00:00
Aleksandr Lesnenko
a85f7507b3 temporary disable csp in cypress (#49186) 2024-10-25 20:06:21 +00:00
Jeff Bruemmer
5929e66476 docs - sdk updates (#49173) 2024-10-25 12:48:19 -04:00
Mahatthana (Kelvin) Nomsawadi
d616baf693 Fix static embed card download when param has accentuation (#49157)
* Fix static embed card download when param has accentuation

* Fix E2E util type

* Add a dashboard E2E test

* test question download with params

* Fix some names regarding tests

* Fix failed E2E tests
2024-10-25 17:27:18 +01:00
dpsutton
0a455d9a68 Fix csp directives for embed previews (#49155)
* Fix csp directives for embed previews

We set content security directives to allow for iframes on
dashboards. This list did not include 'self' so we can't actually host
an iframe pointing at our, well, self.

Embed previews work by just embedding an iframe with the dashboard and
this breaks if we don't allow iframes from our self.

* e2e test

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-10-25 16:17:29 +00:00
Alexander Polyankin
e20c00b155 Fix actions without parameters (#49125)
* Fix actions without parameters

* Update frontend/src/metabase/actions/components/ActionViz/ActionDashcardSettings.unit.spec.tsx

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-10-25 16:10:34 +00:00
Chris Truter
c6683ce7a0 Analyze tables for compound queries (#49144)
### Description

This PR updates Macaw to the latest version, which exposes a new analyzer which handles compound queries.

It also finishes the migration to using tagged-union result maps consistently across all the interfaces.

This should also remove the atrociously verbose analysis error messages in CI.
2024-10-25 16:18:09 +02:00
Phoomparin Mano
6a927deefb fix(sdk): support hiding columns in InteractiveQuestion (#49013)
* investigate hide columns

* add update viz settings in the sdk

* cleanup implementation

* add storybook for interactive question

* use the question callback to update viz settings

* remove onUpdateVisualizationSettings

* revert change to onUpdateVisualizationSettings

* add click action behaviour

* fix misspelling

* add onUpdateQuestion mock function

* add unit test for click action behaviour

* add e2e test for hiding question column header
2024-10-25 20:36:07 +07:00
Chris Truter
f022ed8198 Consistent error handling for both NQA interfaces (#49023)
This standards on a "just maps" approach to returning disabled, disallowed, or failed query analysis. This is as opposed to the hodgepodge approach of significant `nil`, untagged unions with keywords, and exceptions.

Essentially we have a classic "either" style tagged union, where `:error` is the tag.
2024-10-25 15:30:55 +02:00
Nicolò Pretto
d7e56b2641 test(sdk): add tests for auth flow (#49108)
* test(sdk): add tests for auth flow

* make the fetch token fn return something that will pass the validations
we'll add in the next project

* waitForRequest helper + add expects for card endpoints on api key test
2024-10-25 12:13:46 +00:00
Nicolò Pretto
9a455d6332 use default line height in the embedding homepage (#49114) 2024-10-25 13:58:02 +02:00
Oisin Coveney
ea8328f2bb Split View components into multiple files (#49034) 2024-10-25 09:09:48 +03:00
Phoomparin Mano
2fd311c521 fix(sdk): static question should cancel requests on component unmount (#48808)
* cancel request on unmount in static question

* use deferred promise

* remove logs

* alias cancelled to deferred.promise

* extract useLoadStaticQuestion hook

* add tests for request cancellation

* change updateQuestion method

* add sanity check with fetchMock
2024-10-25 05:54:27 +00:00
bryan
cca66d443c AG housekeeping (#49047)
* upgrades is-airgapped? defn to defsetting airgap-enabled

- uses the airgap-enabled settings value to remove Cloud section in
  SettingsEditor
- "Metabase Enterprise Airgap" -> "Enterprise Airgap"

* hide still need help section in airgap mode

* move flag checking into selectors

* fe lint

* ts type check

* use optional chaining and nullish coalescing

* hide StillNeedHelp in ag mode

* adding airgap-enabled to createMockSettings

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-10-24 19:19:28 -06:00
lbrdnk
0c90ddfa09 [Databricks] Use Sparksql formatting in prettify-native-form for Databricks (#49053)
* Format databricks as spark in prettify-native-form

* Add test to be generalized in follow up
2024-10-24 23:56:19 +03:00
Phoomparin Mano
e99c67a153 fix(sdk): ability to save questions in interactive question (#48866)
* implement saving questions in interactive question

* close modal on create question

* add e2e test for saving questions
2024-10-24 20:49:38 +00:00
Nick Fitzpatrick
ae92d2817f Update X-ray to use rtk query (#49113)
* Update X-ray to use rtk query

* PR feedback
2024-10-24 16:54:08 -03:00
Jeff Bruemmer
bf10c9b6fc links (#49127) 2024-10-24 19:40:03 +00:00
Jeff Bruemmer
82cf05cea8 docs - links 51.1 (#49122) 2024-10-24 15:10:36 -04:00
Alexander Polyankin
82c4a949d0 Fix date formatting of parameter values with time (#49046)
* Fix date formatting of parameter values with time

* Update frontend/src/metabase/parameters/utils/date-formatting.ts

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Adjust E2E test

* Fix tests

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-10-24 13:11:05 -04:00
Jeff Bruemmer
a94d58fc52 docs - embedded analytics sdk (#48530) 2024-10-24 12:59:31 -04:00
Alexander Polyankin
c6ac90b483 Fix boolean parameter parsing from query string in dashboards (#49052)
* Fix boolean parameter parsing from query string in dashboards

* Adjust E2E test

* Adjust E2E test

* Adjust E2E test

* Update e2e/test/scenarios/filters-reproductions/dashboard-filters-reproductions.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Update e2e/test/scenarios/filters-reproductions/dashboard-filters-reproductions.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-10-24 15:37:15 +00:00
Alexander Polyankin
16181dce67 Make it possible to remove a broken target when there are no options available (#49041) 2024-10-24 10:51:51 -04:00
Alexander Polyankin
0a1eca6b25 Remove myself from CODENOTIFY (#49045) 2024-10-24 10:51:42 -04:00
Chris Truter
1c01afcbcb Restrict native query table permissions to MySQL and PostgreSQL (#49078) 2024-10-24 13:58:19 +00:00
Oisin Coveney
5294948e6a Convert ChartSettings to a functional component (#48994) 2024-10-24 16:57:14 +03:00
Mahatthana (Kelvin) Nomsawadi
9ae3c870c0 Fix deployment failure (#49085) 2024-10-24 12:56:44 +01:00
Denis Berezin
df158d8896 fix(sdk): remove runtime error on aggregated question drill (#49064) 2024-10-24 14:20:38 +03:00
Mahatthana (Kelvin) Nomsawadi
df31f565bc Automate npm dist-tags (#48982)
* Remove outdated comment

* Add logic for automating npm dist tags

* Fix deprecated GitHub action output command

* Update .github/workflows/release-embedding-sdk.yml

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* Add comment and correct 51 dist tag

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-10-24 10:13:33 +01:00
Anthony Lio
5c198037de feat(api-openapi): favors Scalar for open api documentation (#48199) 2024-10-24 11:57:39 +03:00
Mahatthana (Kelvin) Nomsawadi
b7e1ef6f4f Remove changelog not released on master (#48985) 2024-10-24 09:20:47 +01:00
Alexander Solovyov
b96f55194c remove Tim from team.json (#49071) 2024-10-24 14:02:03 +07:00
Aleksandr Lesnenko
b94da7585b enable pivot exports by default (#48859) 2024-10-24 02:19:44 +00:00
github-automation-metabase
7c0023fe1a Add v0.51.1 to the list of releases (#49058)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-10-23 22:01:27 +00:00
Alex Yarosh
94f582662e docs: pie and sunburst (#49056)
* pie charts

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-23 17:12:15 -04:00
Nick Fitzpatrick
c9bfb047ea Alert isValid check only looks at configured channels (#48485)
* converting UpdateAlertModalContent and CreateAlertModalContent to functional

* lint stuff

* e2e adjustments:

* type and e2e adjustments
2024-10-23 18:03:21 -03:00
Noah Moss
94081aeadd Expose model persistence refresh icon when model is still in creating state (#48961)
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-10-23 15:15:24 -04:00
Aleksandr Lesnenko
7d61485bc8 Add allowed iframe host setting (#48805)
* add allowed iframe host setting wip

* use allowed-iframe-hosts setting in the CSP header

* add a test for the frame-src csp directive

* Update allowed-iframe-hosts setting definition

* Add error state for forbidden iframe url domains

* Move out iframe e2e test suite

* Add e2e test

* Update error message in view mode

* Fix unit tests

* Update setting on the admin page

* Update error state

* Add links to error states

* Update docs links

* Update link anchors

* Add default allowed hosts to public setting

* Update allowed domain check logic

* Fix default value display in admin page

* Don't update setting without changes

* Update error message spacing

* correct the parsing of allowed-hosts string for CSP header entries

* fix test

* fix not handling wildcard ports

* Fix failing e2e test

* Fix subdomain test

* address review

 - the parse-allowed-iframe-hosts fn is now memoized
 - a * entry is handled and doesn't produce a weird *:* entry
 - no more try/catch, errors in parsing will be logged but the list returns all valid entries
 - when www. is encountered, an entry including www. is added
 - trailing / is 'cleaned' and the entry is used as if there was no trailing /

* Fixup test for expecting a few more frame sources

* indentation fix for linter 🥲

* Fix type error

---------

Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
Co-authored-by: dan sutton <dan@dpsutton.com>
2024-10-23 12:46:02 -05:00
Jeff Bruemmer
988514f03c metabase analytics to usage analytics (#48195) 2024-10-23 17:33:41 +00:00
Oleksandr Yakushev
434703431f Bump Methodical version (#49037) 2024-10-23 20:24:26 +03:00
Aleksandr Lesnenko
bcf0a42f9a fix pie chart crashes when small (#49038) 2024-10-23 16:44:56 +00:00
Nicolò Pretto
5d81bdc44d embedding homepage v2 (#49027)
* ui implementation of new emb homepage, tests will come later

* change padding of the last card to be consistent with the top one

* update beta badge spacing

* update tests

* fix stories type error

* use quick-start for url

* update HomeContent tests

* update events + related e2e

* Update frontend/src/metabase/home/components/EmbedHomepage/StaticEmbedContent.tsx
2024-10-23 16:41:15 +00:00
John Swanson
3a05e07fe1 Do not create personal collections for API keys (#48638)
* Do not create personal collections for API keys

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-10-23 09:36:56 -07:00
Alexander Solovyov
d4bfd14d6f logs should not be translated (#49033) 2024-10-23 16:08:48 +00:00
Anton Kulyk
dbdef76e63 Allow grouping bar chart series into "Other" category (#48265)
* Add `graph.max_categories` viz setting

* Allow grouping series into "other" category

* Add tooltip

* Toggle "other" series visibility

* WIP: new implementation for `graph.series_order`

* Remove not used function

* Make "other" series a regular `SeriesModel`

* Fix stacked bar charts

* Remove colors from "other" tooltip

* Sort "other" tooltip values

* Update `graph.max_categories` setting

- negative number validation
- 0 value turns off grouping

* Fix Loki test

* Add basic loki test

* Add loki test for stacked chart

* Add loki test for stacked normalized chart

* slight refactor of series_order setting

* Add screenshots

* Handle different kinds of aggregations for "other"

* Handle different aggregation kinds in tooltips

* Add `graph.other_series_aggregation_fn` viz setting

* Fix type errors

* Fix unit tests

* settings ui

* remove sorting by value to match series order setting, other color

* hide grouped series controls

* Add e2e test

* Update screenshots

* Fix incorrect series grouping for stacked charts

* group series into other settings

* Update e2e test to work with new viz settings

* Disable drills for the "Other" series

* fix max_categories setting popover positioning

* fix total row has misaligned columns on other series values

* Remove redundant `click({ force: true })`

* Rename aggregation fn viz setting

* Move aggregation fn setting to the popover

* WIP

* Update popover

* Fix `it.only`

* Fix legend sync issue

* Disable "Other" category by default (temporary)

* Enable aggregation fn picker for MBQL queries (temporary)

* Move "Other" category summary to a tooltip row

* Add `graph.max_categories_enabled` to viz settings type

* Reuse already computed "Other" value in tooltips

* Add null check

* Fix series length check

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-10-23 16:58:07 +01:00
appleby
f537c80069 Give more specific name to metricsv2 prometheus metrics (#49001)
This is to allow for the possibiliy of adding more metricsv2 usage and error metrics in the future while still
distinguishing the source of the errors.
2024-10-23 08:10:41 -07:00
Chris Truter
f9e6dfc686 Analyze native tables more conservatively by default (#48990)
### Description

This is a low level step towards applying table-level permissions to native queries.

It replaces the more generic and powerful `:ast-walker-1` analyzer with the more conservative `:basic-select` version we recently landed. The advantage of this version is that it protects against dynamic table references and false negatives due to masking.
2024-10-23 16:30:52 +02:00
Oleksandr Yakushev
3bf8ba58e5 Bump HoneySQL version (#48602) 2024-10-23 17:00:18 +03:00
Chris Truter
e3158b0bdc Restrict inferred encodings for Uploads (#49024) 2024-10-23 13:58:01 +02:00
Braden Shepherdson
d03df1309d [QP] Fix query caching for pivot queries (#48962)
This was throwing errors trying to `nippy/freeze!` an Atom.

That was because in certain circumstances a pMBQL query can end up in
`(:json_query metadata)` for a query, and those can contain an atom
due to `metabase.lib.cache` and both `CachedMetadataProvider` and
`InvocationTracker`.

I added `lib.query/serializable` as a single location to strip out
anything that isn't serializable, such as atoms. (And the entire
`:lib/metadata`, which is a wasted effort to serialize.)
2024-10-23 07:40:26 -04:00
Ngoc Khuat
bdc9c5a943 mention that send-invite is deprecated in v51 api change log (#49018) 2024-10-23 07:49:20 +02:00
Oisin Coveney
313f13f9aa Use useSelector and useDispatch in ChartSettingsSidebar (#48986) 2024-10-23 08:21:20 +03:00
Ngoc Khuat
f573f9dddc [Notification] Rework APIs for better modularization (#48876) 2024-10-23 11:08:11 +07:00
Ngoc Khuat
5752a704cc remove POST /api/user/:id/send_invite (#48976) 2024-10-23 10:23:32 +07:00
Alex Yarosh
6805734db4 docs: cumulative changes (#49009)
* cumulative changes

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-22 23:06:29 +00:00
Nemanja Glumac
ef4dd69a8d Add use-temp-storage hook (#48987)
* Add `use-temp-storage` hook

* Remove try/catch

* Add reducer

* Add tests

* Use RTK to create a new slice and reducer
2024-10-22 22:00:53 +00:00
bryan
23338803f9 fix grouped metrics + add some safety to it (#48995) 2024-10-22 12:50:23 -06:00
Aleksandr Lesnenko
cf2dd2c997 fix pie chart labels are hidden when they should not be (#48918)
* improve pie-sunburst chart labels visibility algo

* specs, docs

* Update Loki Snapshots

* handle big arcs > PI with small inner cord

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-10-22 18:20:49 +00:00
Alexander Polyankin
a0025d0df9 Fix native query preview for mongo (#48960)
* Fix native query preview for mongo

* Add tests

* Add tests

* Do not rely on join identity
2024-10-22 18:06:47 +00:00
appleby
5df7d88d78 Do not localize c3p0 metric descriptions (#48957)
Remove localization for some additional metrics that were missed in 2882692b.
2024-10-22 10:37:25 -07:00
Jeff Bruemmer
4be3342175 sidesheets and exports (#48963) 2024-10-22 13:10:52 -04:00
Alexander Polyankin
6deb7b700c Reset join condition state when the rhs table changes (#48951) 2024-10-22 12:33:39 -04:00
Kyle Doherty
80af6c8616 Add athena and databricks logos for engines + setup flow (#48959)
* add athena and databricks logos + update paths

* Add fallback for `druid-jdbc`

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-10-22 11:55:32 -04:00
Romeo Van Snick
0cf6d56e61 Show "view-only" badge when the question is not editable (#48791)
* Fix reference in deprecation notice

* Add lock_filled icon

* Add view-only tag to the question header for questions with hidden source tables

* Simplify the useHasHiddenSourceTables helper

* Add typings to useHasHiddenSourceTables

* Show 'view-only' badge when the question is not editable

* Set up card endpoints

* Add test for hidden tables

* Add e2e test for View-only tag

* Add visibilityType to TableDisplayInfo

* Use unfiltered table display info to determine which tables are hidden

* Rename util to hooks

* Use rem for border-radius

* Sign in in beforeEach

* Add tests for more visibility types

* Fix unit tests

* Remove empty file

* Add test for unavailable cards

* Remove unnecessary card endpoint

* Add unit test for inaccessible card

* Move ViewOnlyTag to it's own file

* Add more unit tests for ViewOnly tag

* Use MBQL to create queryies where possible
2024-10-22 17:47:31 +02:00
Oisin Coveney
a1eeb98175 Change errors for JWT to accommodate SDK (#48875) 2024-10-22 18:25:49 +03:00
github-automation-metabase
1c9e93f917 Add v0.50.31 to the list of releases (#48981)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-10-22 13:42:43 +00:00
Oisin Coveney
221a498a1f Convert Visualization Settings Actions to TS (#48941) 2024-10-22 16:22:29 +03:00
Alexander Solovyov
25683917bb drop explicit dep on commons-fileupload (#48972)
it's been long ago that Ring has been updated to depend on org.apache.commons/commons-fileupload2-core
2024-10-22 06:16:55 -03:00
Luis Paolini
d4c49a85af Bump ring-core and ring-jetty-adapter (#48947)
There was a new version that supports jetty 11.0.24 https://github.com/ring-clojure/ring/blob/master/CHANGELOG.md
2024-10-22 10:06:47 +03:00
Romeo Van Snick
09f5a72ffe Popover timing tweaks (#48888)
* Increase the size of the overlay spacer

* Increase the delay of the popover opening

* Hard-code the popover delays

* Remove delay props from info components

* Fix unit test

* Shorten popover timeout to 500ms

* Make popover delay configurable again

* Increase openDelay for header info
2024-10-22 08:32:14 +02:00
adam-james
290845ef8c Fix a Couple bugs related to pivot exports (#48867)
* Fix a Couple bugs related to pivot exports

 - pivot-grouping value, when not an int (in the case of Oracle dbs), would cause exports to contain zero rows. This
 fixes that
 - json formatted/unformatted for the dataset API endpoints (unsaved questions) was not being used, so all exports
 were formatted

* json and csv use (int group) to check row inclusion

* grouping change fix tests

* json formatted/unformatted test

* xlsx formatters are correct when pivot-grouping col is removed

* cljfmt

* fix up failing tests

* fix test

* Update src/metabase/api/dataset.clj
2024-10-22 02:46:56 +00:00
Aleksandr Lesnenko
001e0886b4 tweak sunburst chart styles (#48421)
* tweak sunburst chart styles

* Update Loki Snapshots

* Update Loki Snapshots

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-10-22 01:56:14 +00:00
Ryan Laurie
4dc135ac95 Disable github actions running on a cron for forks (#48967)
* dont run release log on forks

* dont run cron actions on forks at all
2024-10-21 17:06:41 -06:00
Jeff Bruemmer
d1d4d7131d docs - various (#48958) 2024-10-21 17:34:44 -04:00
Oisin Coveney
7d87d7cf49 Split View into components (#48929) 2024-10-21 23:06:55 +03:00
Case Nelson
c712c35cb5 fix: bigquery repeated records should not expose nested fields (#48860) 2024-10-21 13:42:55 -06:00
Alexander Polyankin
78d29c9b06 Reset the question's viz settings when converting to a model (#48939)
* Reset the question's viz settings when converting to a model

* Update e2e/test/scenarios/models/reproductions.cy.spec.ts

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Test model metadata

* Test model metadata

* Test model metadata

* Test model metadata

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-10-21 18:39:26 +00:00
Kamil Mielnik
afcb2b472d Fix - Actions are broken in 50.30 when Models are based on SQL (#48927)
* Fix #48878 by avoiding to use entity framework which can serve incomplete card objects

* Make sure canWrite is a boolean

* Remove redundant optional chaining

* Add repro for #48878

* Optimize

* Improve comment

* Fix test setup
2024-10-21 15:11:21 +00:00
Mahatthana (Kelvin) Nomsawadi
1b833d29fd Automate SDK release version numbers (#48838)
* Automate npm version

* Make troubleshooting SDK release process easier

* Fix quote situation

* Allow deploying SDK to different branches at the same time

Because they won't be in conflict with each other

* Make checkout a bit faster

* Remove unnecessary console.log

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* Tidy up `jq` command

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* Tidy up multiple GitHub actions summary log

Co-authored-by: Phoomparin Mano <poom@metabase.com>

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-10-21 16:03:01 +01:00
Romeo Van Snick
a31dd8bd70 Add utm params to doc link in expression editor (#48852)
* Add helper to add utm params to url

* Add utm param to getDocsUrl

* Allow passing utm to docs url

* Add utm parameters to expression widget docs url

* Add useUrlWithUtm hook

* Make more utm props optional

* Use the utm hook and docs hook instead of adding utm tags manually to urls

* Simplify getDocsUrl

* Update unit tests for expression editor to contain utm params

* Only add parameters if they have a value

* Fix unit test

* Fix unit test

* Simplify docs url

* Use useDocsUrl on embedding page

* Use named arguments in useDocsUrl
2024-10-21 16:26:08 +02:00
Chris Truter
34a15cbab6 Bump HoneySQL to 2.6.1161 (#48252) 2024-10-21 16:16:22 +02:00
Ryan Laurie
b261643a8f Make metabot centered again (#48912) 2024-10-21 07:54:44 -06:00
Alexander Polyankin
ac2552fbbb Hide time inputs in the date picker when the column does not support date+time filters (#48818) 2024-10-21 09:52:50 -04:00
Oleksandr Yakushev
53813b94d7 Bump Toucan2 version (#48919) 2024-10-21 16:18:58 +03:00
Alexander Solovyov
bb397f792f upgrade jetty to 11.0.24 to mitigate DoS vulnerability (#48819)
https://github.com/jetty/jetty.project/security/advisories/GHSA-g8m5-722r-8whq
2024-10-21 12:17:30 +00:00
Nicolò Pretto
7be52702e4 run prettier on sdk readme (#48905)
* run prettier on sdk readme

* fix code snippets so that prettier can format them

* put back the empty new line on the package.json
2024-10-21 09:43:06 +00:00
Cam Saul
c92e8c993f Modularize metabase.pulse; add metabase.pulse.core API namespace (#48640)
* Modularize metabase.pulse; add metabase.pulse.core API namespace

* Rename metabase.pulse.send-test

* Split email result attachment stuff into its own namespace

* Update dashboard-subscription-test

* Allow metabase.email.result-attachment externally... for now

* More code cleanup

* Decouple models.card and email.messages

* Decouple models.collection and metabase.email.messages

* Hopefully the last fix 🔧

* Fix #48647 🙁

* Fix event handler

* :render/text, not :pulse/text

* Test fixes 🔧

* Test fix 🔧

* RESPECT the modules

* Remove unused namespace
2024-10-18 17:10:52 -07:00
Uladzimir Havenchyk
716fc312d3 fix react warnings (#48564) 2024-10-18 22:20:34 +00:00
bryan
1d1951136a More grouped metrics data (#48900)
* Adds query_executions_by_source_24h and entity_id_translations_last_24h

- add docstring

* clear eid translation count in stats-post-cleanup

* remove ->> with after? it's confusing

* dissoc the right path
2024-10-18 21:51:40 +00:00
Kyle Doherty
a249c0bc37 remove deprecated button from stories (#48909) 2024-10-18 20:46:16 +00:00
Nicolò Pretto
aa72eb83ae feat(sdk): defineEmbeddingSdkConfig to make typing easier (#48879)
* defineEmbeddingSdkConfig to make typing easier when the config is created outside of the jsx

* also add defineEmbeddingSdkTheme, move them to index.ts as i don't have a good name for what file to put them into :shrugs:

* updated the readme to use the defineXXX functions
2024-10-18 20:12:38 +02:00
Uladzimir Havenchyk
6a0b46e54d rework ChartSettings to typescript (#48877)
* rework ChartSettings to typescript

* lint
2024-10-18 17:48:10 +00:00
appleby
2882692b71 Do not localize prometheus metric descriptions (#48896) 2024-10-18 10:34:36 -07:00
Aleksandr Lesnenko
619202e3d4 Adds export description when unformatted option is selected (#48869)
* hide formatted export description when unformatted

* add unformatted copy
2024-10-18 12:38:07 -04:00
Dennis Schridde
ab604f2972 Self-heal database sync triggers (#48882)
== Behaviour without this fix ==

See #48881

== Behaviour with this fix ==

1. Metabase starts with an empty application database, and a config file
   containing configuration for a connected database
3. By the time it reaches "INFO metabase.task :: Task scheduler started",
   `qrtz_triggers` contains `metabase.task.sync-and-analyze.trigger.1`
   (sample DB) and `metabase.task.sync-and-analyze.trigger.2` (DB from
   config file)

Closes: https://github.com/metabase/metabase/issues/48881
Co-authored-by: Noah Moss <noah@metabase.com>
2024-10-18 17:43:11 +02:00
lbrdnk
63a3b4b3f5 Use case expression type inference logic similar to annotate middleware in MLv2 (#47902)
* Use type date for case expression when there are Date and DateTime args

* Use logic for getting case expr type from annotate middleware

* Add e2e test

* Add bigquery test

* Update test

* cljfmt and comment

* Adjust e2e test
2024-10-18 17:41:41 +02:00
Anton Kulyk
2cf1486f76 Optimize pie charts rendering with many rows (#48670) 2024-10-18 16:26:44 +01:00
Dennis Schridde
c1cdce9698 Reduce cache TTL for billing info from 5h to 5min (#48762)
Store API can handle higher load and customers might want to see
changes earlier.

Fixes: cc28ee6041
2024-10-18 16:31:10 +02:00
Nick Fitzpatrick
b853f9d0e0 Fixing broken Configure Slack links (#48758)
* cleaning up links, adjusting tests

* guard rails

* linter fix
2024-10-18 10:54:07 -03:00
Aleksandr Lesnenko
5dab3610bf filter out virtual cards when creating a subscription (#48861) 2024-10-18 09:01:03 -04:00
Oisin Coveney
405ed53baa fix(sdk): Change QuestionEditor tab name to 'Editor' (#48821) 2024-10-18 10:23:28 +03:00
Phoomparin Mano
d91bbcd489 fix(sdk): reduce visual artifacts on PDF/PNG exports on custom sdk themes (#48645)
* debug pdf export styling

* apply sdk theme background overrides

* add overflow override

* tweak style overrides

* move WithThemeBackground outside of data-metabase-theme selector

* move EmbedFrame css rule up

* remove fallback mb-color-background
2024-10-17 23:46:22 +00:00
Phoomparin Mano
9ffc1851ea fix(sdk): fix defaultProps react error (#48764)
* remove defaultProps from Modal

* bump patch version of react-markdown

* fix isOpen prop
2024-10-17 23:26:02 +00:00
Phoomparin Mano
f481cad337 fix(sdk): hide downloads by default (#48755)
* hide downloads by default in the sdk

* update readme to reflect withDownloads prop

* update readme formatting

* update tests
2024-10-17 22:53:14 +00:00
Noah Moss
6db1495263 Track SCIM users + API response success/error counts (#48702) 2024-10-17 18:23:34 -04:00
Nick Fitzpatrick
6ccadee046 adding webhook counter to AlertListItem (#48853)
* adding webhook counter to AlertListItem

* PR feedback
2024-10-17 16:08:06 -03:00
lbrdnk
e094c38bfe Splice expression into appropriate stage during v2 metric expansion (#48800)
* Fix expression stage

* Add test

* Parallel test

* Adjust test

* Adjust test
2024-10-17 21:06:40 +02:00
lbrdnk
eefd754357 Use name from metric aggregation after preprocessing (#48705)
* Use metric's aggregation :name

* Add test
2024-10-17 19:02:53 +03:00
Alexander Polyankin
fe8642dad5 Fix question header when the original question is a native query (#48815) 2024-10-17 11:58:30 -04:00
Case Nelson
7925599ed3 fix: Always cast json number types as decimal (#48648)
* fix: Always cast json number types as decimal

Fixes #48507

* Fix tests

* Fix tests

* Fix test
2024-10-17 09:34:05 -06:00
Mahatthana (Kelvin) Nomsawadi
4fb45165d5 Prepare SDK npm version for release version number automation (#48839) 2024-10-17 16:22:14 +01:00
Alexander Polyankin
c42d411cab Hide the toggle all checkbox when there are no search results (#48817) 2024-10-17 09:52:50 -04:00
Kamil Mielnik
816a1c11bb Add missing key prop to components and elements used inside jt (#48825) 2024-10-17 20:46:00 +07:00
metamben
f47eafd36f Support resolving names in source-metadata by ID (#48765)
Fixes #48639
2024-10-17 16:37:56 +03:00
Alexander Solovyov
004848ae9d [serdes] check full export for escaping cards (#48521) 2024-10-17 09:26:49 -04:00
github-automation-metabase
af760c29fc Update Readme version references and published npm version to 0.1.40 (#48827) 2024-10-17 11:57:51 +00:00
dpsutton
deac5cbcc7 Let non-admins see tables in recents (#48769)
* Let non-admins see tables in recents

```shell
❯ http get "localhost:3000/api/activity/recents?context=views" Cookie:"metabase.SESSION=ba..3d" -pb
{
    "recents": [
        {
            "can_write": false,
            "database": {
                "id": 6,
                "initial_sync_status": "complete",
                "name": "pg restaurants"
            },
            "description": null,
            "display_name": "Restaurants",
            "id": 112,
            "model": "table",
            "name": "restaurants",
            "table_schema": "public",
            "timestamp": "2024-10-15T22:11:39.412100Z"
        },
        {
            "can_write": false,
            "database": {
                "id": 6,
                "initial_sync_status": "complete",
                "name": "pg restaurants"
            },
            "description": null,
            "display_name": "Reviews",
            "id": 110,
            "model": "table",
            "name": "reviews",
            "table_schema": "public",
            "timestamp": "2024-10-15T19:53:19.999445Z"
        }
    ]
}
```

We were getting permissions of a "fake" table. Instead, let the db
select it and get the proper stuff. Worked for admins because
mi/can-read? is presumably always true for tables, and worked in tests
because we mocked mi/can-read?

* bump ci
2024-10-16 15:41:04 -05:00
appleby
00100b1cb5 Add a new prometheus metrics in m.qp.middleware.metrics/adjust (#48598)
* Add new promethues counter for :metabase-metrics/adjust-errors

To record errors in metabase.query-processor.middleware.metrics/adjust

* Add prometheus metrics test to metrics middleware tests

* Also inc :metabase-metrics/adjust-errors when throwing an exception

* Make splice-compatible-metrics private

It doesn't seem to be used outside of metabase.query-processor.middleware.metrics.

* Add test for :metabase-metrics/adjust-errors when exception is thrown

* Move inc-and-throw! helper into metabase.analytics.prometheus

* Add inc-and-throw! test to prometheus tests

* Rename inc-test to inc!-test and use approx= and metric-value helpers

* Add try/catch to metrics adjust and record metric errors in a single place

Record promethues metrics in a single place in metabase.query-processor.middleware.metrics and ensure we record
failures for any exception throw.

* Improve testing description string

* Rename :metabase-metrics/adjust-errors to :metabase-query-processor/metrics-errors

* Move metrics adjustment try/catch into a new helper

This ensures we count all exceptions generated by adjust-metric-stages.

* Add new prometheus metric to count number of MB metrics seen by the QP

This new metric is intended to count the number of metrics that the query processor metrics middleware sees and
attempts to adjust.

* Add more metrics metrics tests

- Ensure that queries with no metrics do not incremement either counter
- Ensure that successful calls to adjust do not increment the error counter
- Ensure that exceptions throw from other libs also increment the error counter

* Rename test to adjust-prometheus-metrics-test and add helper to reduce code dup

* If no metrics are found immediately return query in metrics middleware adjust

Don't attempt to adjust query if we don't find any :metric clauses.

* Appease cljfmt

* Improve metric description

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Improve epsilon test in approx=

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Remove adjust-metric-stages-counting-errors

This function was an attempt to avoid double-counting errors, but probably not worth the effort.

See

https://github.com/metabase/metabase/pull/48598#discussion_r1800197964
https://github.com/metabase/metabase/pull/48598#discussion_r1800200421

* Count metrics directly when mocking prometheus/inc!

Based on PR feedback here:

https://github.com/metabase/metabase/pull/48598#discussion_r1800207674

* Remove prometheus/inc-and-throw!

Value prop was always questionable, but now that it's only called from a single place, just remove it and inline the
call to prometheus/inc!. Easy to add back later if it proves generally useful.

PR discussion thread

https://github.com/metabase/metabase/pull/48598#discussion_r1799728596

* Rename match-one-metric to find-first-metric

https://github.com/metabase/metabase/pull/48598#discussion_r1803321025

* Rename :metabase-query-processor/metrics-errors to metric-errors

https://github.com/metabase/metabase/pull/48598#discussion_r1803313818

* Throw an exception rather than logging a warning if we fail to adjust a metric

https://github.com/metabase/metabase/pull/48598#discussion_r1803328482

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-10-16 20:06:43 +00:00
bryan
94496eb579 SDK embedding prometheus (#48578)
* add prometheus tracking for sdk-embedding

* indentation

* improve track-sdk-response api

* register :metabase-sdk/response-{ok,error} + test

* avoid cyclic dependency whe nusing prometheus

fixes:
[ /metabase/api/common ]
<- /metabase/models/setting
<- /metabase/analytics/settings
<- /metabase/analytics/prometheus
<- /metabase/analytics/sdk
<- /metabase/models/view_log
<- /metabase/events/schema
<- /metabase/events
<- [ /metabase/api/common ]
<- /metabase/public_settings/premium_features
<- /metabase/auth_provider
<- /metabase/driver
<- /dev/debug_qp
<- /dev

* nix dependency: events.schema --> models.view-log

- make them both read context from view-log-impl instead

* cljfmt
2024-10-16 18:00:20 +00:00
bryan
e878691190 keywords aren't allowed anywhere but the top level (#48802) 2024-10-16 16:20:55 +00:00
Chris Truter
29bbf6faf0 Expose more basic table analysis from Macaw (#48264) 2024-10-16 16:20:08 +01:00
metamben
7e13d9bec5 Set :lib/source-uuid from the field ref, not from column metadata (#48472) 2024-10-16 18:05:10 +03:00
github-automation-metabase
0fb1063d1a Update Readme version references and published npm version to 0.1.39 (#48799) 2024-10-16 14:55:28 +00:00
Oisin Coveney
e883cdfffc Convert dashcardData dashboard reducers to TS (#48679) 2024-10-16 17:07:55 +03:00
Mahatthana (Kelvin) Nomsawadi
6a01238f67 Remove the uberjar build process from SDK release workflow (#48729) 2024-10-16 14:10:53 +01:00
Noah Moss
6ca8939993 Ensure new fields in permissions table are set properly for Examples collection (#48746) 2024-10-16 09:09:59 -04:00
Nicolò Pretto
302a994654 embedding-sdk:dev: --watch that makes "fixed" dts (#48574)
* faster --watch command for the sdk

* apparently we want an empty line at the end of jsons, but prettier removes it?

* format tasks.json with prettier 😕

* vscods tasks, move watch task from webpack config to the fixup script

* cleanup webpack config

* adds clean + waits for dist folder when not existing

* minimal doc for the sdk commands
2024-10-16 15:05:32 +02:00
Anton Kulyk
31622ad3b3 Fix flaky x-ray test (#48786)
* Don't assert dynamic value

* Restart CI
2024-10-16 12:38:13 +00:00
Mahatthana (Kelvin) Nomsawadi
534e679ef3 Fix hidden files not uploading as GitHub Actions artifacts (#48779) 2024-10-16 08:50:30 +00:00
Alexander Solovyov
b607af0849 make sure all top-level API paths are present in OpenAPI doc (#48718) 2024-10-16 10:32:24 +03:00
Mahatthana (Kelvin) Nomsawadi
344dba38df Do not open sidesheets on SDK (#48630)
* Don't open sidesheet on SDK dashboards

* Add E2E test

* Fix `className` not passed

* Fix unit tests

* Fix E2E tests
2024-10-16 08:22:14 +01:00
Ngoc Khuat
73d13e8019 [Notification] Cron trigger (#48719) 2024-10-16 04:15:22 +00:00
Raphael Krut-Landau
d4def48591 Add insights link (or tab) to question and dashboard sidesheets (#48283) 2024-10-15 20:09:27 -04:00
github-automation-metabase
595f302e3d Add v0.50.30 to the list of releases (#48766)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-10-15 22:31:28 +00:00
bryan
e5c181bdc3 Adds missing schemas + data for metrics to snowplow stats ping (#48476)
* adds data + schema for metrics stats ping

* remove comment

* annotate todos

* fill in the rest of the metrics values

- and add defaults

* fix some definitions + use a single timestamp

* shuffle stuff around to appease the namespace linter

- we aren't reaching into the api API, so the linter is more of a
  formality here.

* update docstring

* fix jsonschema, maybe

* review responses

- revert changes to 1-0-0
- add metrics section to new file: 1-0-1
- bump ::instance_stats to "1-0-1"
- add tags into 1-0-1
- make the code return tags (empty for now until we know what to tag things.)

- also fix test that broke from shuffling settings around

* remove a footgun

* add tags to metrics,

add grouped_metrics to jsonschema 1-0-1

format 1-0-1

* indent

* cljfmt

* version should match filename

* update instance stats 1-0-1 schema

* require `tags` in grouped_metric + snowcat comment

* fix formatting noise

* update schema to make it valid

* remove grouped_metrics from instance_stats schema

* cljfmt appeasement

* unbin cache_num_queries_cached value

- alphabetize metrics generation

* we can now guarantee metric values will be ints

* jsonschema for instance_uuid, settings, and grouped_metrics

* add analytics_uuid and make it required

* lint + alphabetize instance stats json schema

* update setting key type

- add maxLength to some strings

* lint jsonschema

- Add description to setting.items.tags
- add maxLength, and {min,max}imum to setting.items.value

* Bump instance stats to 2-0-0

- remove analytics_uuid string length == 36 check
- adds assertion to ensure required fields are set (and it passes)
- adds info for embedding settings

* adds a grouped-metric to stats ping

- adds length info to the schema to pass jsonschema linting

* cljfmt
2024-10-15 14:47:12 -06:00
Aleksandr Lesnenko
8e950e8c1c use simple_event schema to track iframe card creation (#48739) 2024-10-15 14:44:48 -04:00
Anton Kulyk
54b141c724 Fix maps visualization crashing on x-rays (#48742)
* Add default value for `hiddenIndices`

* Add e2e test
2024-10-15 19:26:47 +01:00
Uladzimir Havenchyk
880119e76b fix circular deps in query_builder/components (#48604)
* fix circular deps in query_builder/components

* js -> ts
2024-10-15 16:22:38 +00:00
adam-james
8d52a03f0a Incremental Pivot Processing for Exports (#46995)
* Incremental Pivot Processing for Exports

WIP

Fixes pivot exports for CSV and xlsx.

The CSV export should use less memory by incrementally building up the data structure and aggregating necessary row
data right away, so the memory overhead becomes only as large as the total pivot result.

In cases where the pivot rows/cols do combine into many many columns and rows, this can still be a large set of data,
but it should behave much better now in most cases.

The Excel export is a little more straightforward: create the export rows in the same fashion, streaming one row at a
time, and just post-process the sheet to add the pivot table in one shot at the end.

* WIP adding row totals.

* aggregate totals as rows are added

Row, column, section, and grand totals are all aggregated as each row is added.
This means the final step of building pivot output becomes just an exercise of lookups/arrangement, no further
aggregation is needed.

* CSV pivot works per-row, export respects formatting

This is a big step forward; we don't need to hold the entire dataset in memory, we instead aggregate a row's data into
the pivot datastructure, which only holds onto:

- unique values for each pivot-row in a sorted set
- unique values for each pivot-col in a sorted set
- grand total for each measure N values, where N is number of measures, ususally 1 or 2
- row totals for each combination of each pivot-row * N measures
- col totals for each combination of each pivot-col * N measures
- totals for each 'section', determined by unique values of first pivot-row * N measures
- values for each measure in every 'cell'; Row Combos * Col Combos * N Measures

So, there can still be a decent amount of data to store; but it will never hold onto all of the 'raw rows' from the
dataset.

We can never completely guarantee that Row Combos * Col Combos * N Measures remains small, but two things let us move
forward anyway:

- there's now visible feedback in the app that the download is running (or if it's failed)
- Pivot table utility diminishes rapidly with huge output anyway; users still need to curate/set up their data
- effectively to improve the table's utility, so we can assume that a slow-to-download pivot table is also slow to
- use/less effective, and will likely be something the user doesn't want (as often).

* some test fixes

* now, if we export 'raw pivot rows', they don't show pivot-grouping

and they also don't include the 'extra' rows for totals/subtotals/grand totals (any row with pivot-grouping > 0).

This means that now the non-pivot version of a pivot table export will match what a user sees if they change the viz
to a regular table.

* remove old test

* re-incorporate some changes from master

* fix csv for non-pivots due to oversight in my changes

This is just a temporary change, I think I should clean up this bit of the code a little, I can probably make it a
little more readable and use some cleaner logic regarding if the rows are 'raw pivot rows' or not.

* start moving format_rows to POST bod, add pivot_results too

There's still wiring work to do, but this starts to add format_rows and pivot_results to POST body for the various API
endpoints. Also modify tests to improve coverage/consistency across downloads and alerts/subscriptions.

The tests will not pass on this commit, but fixes will be incoming

* native pivot tables in xlsx

* add precondition to pass migration linter

* try to get migrations fixed

* pasing pivot-results through api and attachments

* fix tests for format_rows in BODY vs query param

* tests!

* might have the tests all fixed now

* the pivoted export now respects col/row totals settings

* add test coverage for public questions and dashboards

* col and row totals work as expected

* build-pivot refactor for clarity

* docstring change + tiny refactor in helper fn

* see if dashcard download works with format_rows

* csv pivot handles nil values

* pass format_rows and pivot_results in :params not :body

* fix some other tests

* pivot-grouping col filtered out of xlsx

* pivot-grouping-col removed for all rows

* configurable pivot exports and attachments (#47880)

* exports fe

* specs

* ui

* specs

* format/unformatted now works for xlsx

* format test changes for xlsx formatting

* embedding endpoints accept pivot_results

* cljfmt and eslint fix

* empty

* embedding test should have formatting defaulted to true

* embed test fixes

* Use `Chip` for export settings widget

* downloads e2e test fix

* fix public download limit test

* public card download defaults

* fix public download defaults in some tests

* Fix visual test

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-10-15 09:16:02 -07:00
Aleksandr Lesnenko
ba06b99e2c fix iframe dashcards crash subscriptions (#48589)
* fix iframe dashcards crash subscriptions

* add a test to ensure iframes are filtered out of subscriptions

---------

Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
2024-10-15 14:21:20 +00:00
Romeo Van Snick
b8997a1efd Remove "Replace or save question" UI when saving and edited question from a metric (#48669)
* Remove 'Save as new question' toggle when saving questions from editing a metrics' ad-hoc question

* Allow visitQuestion to work for metrics

* Use visitQuestion in metric test

* Add test for #48555 (showing the 'Save as new?' ui for metrics)

* Add issue info to repro

* Use visitMetric, visitModel and visitQuestion helpers in createQuestion

* Move check to make it more clear what the save ui does

* Use cy.button for Done button

* Remove unnecessary .within

* Sign in as normal user

* Add missing dataset alias
2024-10-15 15:45:48 +02:00
Uladzimir Havenchyk
caf4284014 chore: more another flaky test to jail (#48677) 2024-10-15 14:35:33 +03:00
Kamil Mielnik
46af3b4c07 Refactor remaining e2e API commands to TS helper functions (#48672)
* Refactor createDashboardWithQuestions, createQuestionAndAddToDashboard and editDashboardCard to TS function helpers

* Fix createNativeQuestionAndDashboard that got out of sync
2024-10-15 10:22:47 +00:00
Ngoc Khuat
1a2a9c8132 [Notification] Task history and retry (#48437) 2024-10-15 10:06:08 +00:00
Nicolò Pretto
dcb843bf9a fix flaky test on embed share behaviour snowplow events (#48665)
* increase time tolerance to make tests less flaky on ci when CPU is under heavy load

* Update e2e/test/scenarios/sharing/public-sharing-embed-button-behavior.cy.spec.js

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-10-15 08:14:00 +00:00
Romeo Van Snick
86ff88a113 Change Metrics and Summaries copy (#48451)
* Rename Common Metrics to Metrics

* Rename Basic Metrics to Summaries

* Update chill mode button copy to 'Add a summary or metric'

* Rename 'Pick the metric you want to see' button to include summary

* Fix type in test

* Rename Summaries to Basic functions

* Fix test

* Undo cross-version test changes
2024-10-15 09:42:56 +02:00
Ngoc Khuat
a1d8face34 [Notification] Migrate emails (#48392)
* [Notification] Migrate user invited email (#48215)

* [Notification] Migrate alert create email (#48292)

* [Notification] Migrate slack token error email (#48333)
2024-10-15 03:16:18 +00:00
Raphael Krut-Landau
188ad3f074 Show dashboard tab entity ids in dashboard info sidesheet (#48385) 2024-10-14 22:42:52 -04:00
metamben
71c506a4fd Implement inactive field removal (#48636)
* Implement inactive field removal
2024-10-14 22:21:33 +00:00
lbrdnk
9b5ecc0530 Use information_schema as a basis for describe-database in Databricks driver (#48585)
* Use information_schema for describe-database

* Unrelated fix: set dynamic-dataset-loading defaults to true

* cljfmt

* Fix test
2024-10-14 21:31:18 +00:00
Raphael Krut-Landau
3fcdf9d593 Add missing newline (#48704) 2024-10-14 23:45:59 +03:00
Raphael Krut-Landau
84330bf3d1 In question sidesheet, improve the 'Based on' section (#48315) 2024-10-14 15:00:08 -04:00
Uladzimir Havenchyk
c5ac891d2a fix: calculate row for object details correctly (#48673) 2024-10-14 17:35:32 +00:00
bryan
fc64d930f2 jwt token gen to be gated by enable-embedding-sdk (#48637) 2024-10-14 17:20:55 +00:00
Cam Saul
6024bf019c Collapse metabase.shared.* namespaces (#48646)
* Collapse `metabase.shared.*` namespaces

* Fix Kondo warnings

* Does updating the stories-data keys fix the failing tests?

* Appease msgcat

* Appease msgcat

* Fix typo

* Make the build happy

* Appease fslint
2024-10-14 10:06:10 -07:00
Romeo Van Snick
3b4a578689 Enforce empty line before it and describe (#48628)
* Add eslint-plugin-jest-formatting

* Turn on jest formatting for unit.spec and cy.spec files

* Fix e2e test formatting

* Fix unit test formatting

* Fix formatting in frontend/test

* Remove commented out code

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Fix more files

* Fix more lint

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-10-14 15:36:36 +00:00
Kamil Mielnik
464902f886 Fix flaky dashcards test (#48676)
* Revert "fix flakiness during resize (#48556)"

This reverts commit 03b6584bda.

* Move .should call up to fix flaky test

* Use consistent naming
2024-10-14 22:12:38 +07:00
Romeo Van Snick
c172fe43ee Do not save metric viz settings to metric (#48609)
* Add repro for #44171

* Do not save viz settings for metrics

* Lowercase description

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

* Rename variable to be more descriptive

* Use visitDashboard

* Fix typo in excludeVisualisationSettings

* Check the request does not contain visualization_settings too

* Allow visitQuestion to work for metrics

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-10-14 14:18:27 +00:00
Uladzimir Havenchyk
6007bccaaf deps: upgrade cookie package (#48661) 2024-10-14 16:40:56 +03:00
John Swanson
187e9508a9 Remove old MB_API_KEY setting (#48592)
* Remove `MB_API_KEY` env var

A bit awkwardly, we never set `:deprecated` on the setting before. We
can retroactively deprecate this as of v50.

I'm keeping the setting purely to emit the warning message on startup.
2024-10-14 04:57:34 -07:00
John Swanson
8aa3342e6f version and channel query params for version info (#48616)
* version and channel query params for version info

https://github.com/metabase/metabase/issues/48615

* omit blanks from query params for version info
2024-10-14 04:56:49 -07:00
Kamil Mielnik
bd318208f9 Update markdown link that has been moved (#48663)
* Update GitHub link that has been moved

* Get rid of a failing link
2024-10-14 18:18:05 +07:00
Oisin Coveney
a288c15e57 feat(sdk): Add chart viz selection for InteractiveQuestion (#47744) 2024-10-14 09:07:35 +00:00
Alexander Solovyov
cd2cd950d0 [ParseSQL] log less warnings/errors (#48614)
Two reasons: it's very noisy, and the feature is not very user-visible, so does not make a lot of sense yet
2024-10-14 08:15:06 +00:00
Cam Saul
4a509927d7 🏎️ SHAVE 16 MINUTES OFF OF MYSQL TESTS IN CI 🏎️ (#48489)
* Experimental: try splitting MySQL test jobs into 4 partitions intstead of 2

* user-http-request should make sure users are initialized

* Fix MySQL deadlocks in tests

* Bump init timeout to 90 seconds

* Fix metabase.api.session-test/logout-test
2024-10-14 10:50:29 +03:00
Alexander Polyankin
980291218d Add e2e tests for native query drills (#48503) 2024-10-12 02:46:27 +00:00
Jeff Bruemmer
b1c644f9a4 docs - collection cleaning (#48241) 2024-10-11 21:37:02 +00:00
Noah Moss
d1798f1051 Use saved card metadata to filter fields in query metadata for sandboxed tables (#48577) 2024-10-11 20:52:39 +00:00
Oisin Coveney
5e57ffccdb Convert loadingDashboards redux actions to TS (#48456) 2024-10-11 19:26:30 +03:00
Romeo Van Snick
cbbb11be4e Create metric button and docs link in empty state (#48468)
* Add 'Create metric' button to empty metrics page

* Add e2e test for 'Create metric' button

* Remove duplicate main on Browse page

* Add docs link

* Split off common test for BrowseMetrics

* Add whitespace

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Use cy.button

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Hide Create metric button when the user does not have data access

* Use findByText for link

* Add test for hiding the 'Create metric' button when the user does not have data access

* Fix unit tests

* Improve copy

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Add whitespace

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Add explanatory comment for enterprise

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-10-11 16:31:53 +02:00
Nick Fitzpatrick
a207b5c02b adding snowplow event for archiving stale items (#48586)
* adding snowplow event for archiving stale items

* adding total_items_archived to cleanup events
2024-10-11 11:21:46 -03:00
Uladzimir Havenchyk
39df704f51 upgrade rspack and swc (#48558) 2024-10-11 17:13:30 +03:00
Mahatthana (Kelvin) Nomsawadi
a03ea880e1 docs(sdk): Add a guide on how to use the SDK with Next.js (#48569)
* Add Next.js to SDK readme

* Fix typo
2024-10-11 15:02:08 +01:00
github-automation-metabase
74a14bba68 Add v0.50.29 to the list of releases (#48600)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-10-11 09:52:06 -04:00
Romeo Van Snick
2880304fd8 Repro: App crashes when editing custom expression referencing metric when dependent metadata is not loaded (#48560)
* Add repro for #47058

* Delay the response and test for the actual metric button

* Move setup to before and find summarize block using helper

* Use beforeEach
2024-10-11 12:22:56 +02:00
Abed Habli
068d5536fa Document MySQL row limit issue with Vitess (#48568)
* Write Vitess limitation for row limits in MySQL databases

* Update docs/databases/connections/mysql.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-11 11:58:50 +02:00
Ngoc Khuat
989f595dfc keep the keys in send-pulse task history underscored (#48601) 2024-10-11 09:32:56 +00:00
Oisin Coveney
09c57642c6 Migrate dashboard embed endpoints to RTK (#48444) 2024-10-11 10:53:52 +03:00
Ryan Laurie
e4192dd585 Remove duplicated lines from release workflow (#48599) 2024-10-10 18:47:10 -06:00
Ryan Laurie
5dc06d13d8 Make beta releases play nicer (#48596)
* fix last release detection to support pre-releases

* better base commit detection for release log

* disable auto nightly tag due to race condition
2024-10-10 18:28:00 -06:00
appleby
c16d05a018 Relax concat args to allow any ExpressionArg (#48506)
* Relax the arg types to ExpressionArg for concat expressions in the legacy schema

Relax the arg types to ExpressionArg for concat since many DBs allow to concatenate non-string types. This also aligns
with the corresponding MLv2 schema and with the reference docs we publish.

Fixes #39439

* Add nested concat schema tests

* Add nested-concat query-processor tests
2024-10-10 16:52:43 -07:00
Nick Fitzpatrick
0cec8d7d2b 48049 error diagnostic command palette (#48544)
* Moving diagnostic state to redux, adding CP action

* changing key binding

* adding e2e test

* adjusting e2e test

* type adjustment
2024-10-10 20:43:36 +00:00
dpsutton
2410012a5f Always startup prometheus metrics (#48547)
* Always startup prometheus metrics

previously only started up when a port was provided

```
MB_PROMETHEUS_SERVER_PORT=9191 java -jar metabase.jar
```

But these counters are useful to be included in anonymous stats. So
let's start up the collectors and then we can get their values like:

```clojure
prometheus=> (dotimes [_ 500] (inc :metabase-email/messages))
nil
;; prometheus/value is iapetos.core/value here
prometheus=> (-> system :registry :metabase-email/messages prometheus/value)
501.0
```

* rename `metabase.analytics.prometheus/inc` to `inc!`

it side effects a value and now no longer shadows `clojure.core/inc` so
we're all happy
2024-10-10 15:39:42 -05:00
Alexander Polyankin
3fe1ef7cb6 Select all changes for dashboards (#48531) 2024-10-10 19:17:22 +00:00
Uladzimir Havenchyk
03b6584bda fix flakiness during resize (#48556)
* fix flakiness during resize

* keep error message
2024-10-10 16:15:47 +00:00
Oisin Coveney
63425f5b66 Rename ResizeObserver variable to prevent global clash (#48563) 2024-10-10 14:15:28 +00:00
Oisin Coveney
fd0987b26f Fix types on dashboard API, and add types for dashboard redux (#48399) 2024-10-10 14:10:46 +03:00
Nicolò Pretto
d6314cc476 don't set enable-embedding and setup-embedding-autoenabled in /setup (#48517)
* don't set enable-embedding and setup-embedding-autoenabled in setup actions + cleanup

* update jest test

* shouldn't expect the secret key to be there either 🙃
2024-10-10 09:29:48 +02:00
Nicolò Pretto
29a24980f1 Point to a solution when the "Unknown premium setting xxx" is shown during tests (#48526) 2024-10-10 09:29:37 +02:00
Ngoc Khuat
fc43d3cd7f [Notification] System event notification (#47857)
* [Notification] Notification and subscription (#47707)

* [Notification] Notification and subscription (#47707)

* [Notification] Handlers + recipients (#47759)

* [Notification] Channel template table and model (#47782)

* [Notification] Render system event emails (#47859)

* [Notification] Strict type for channel template and notification recipient (#47910)

* [Notification] Event hydration (#47953)

* [Notification] Send asynchronously (#48200)
2024-10-10 09:12:57 +03:00
Cal Herries
6324f9481f Lean on DB queries for describe-table for Mongo (#46598)
This PR reimplements driver/describe-table for MongoDB. Before we would query a sample of documents from a collection and analyse them in Clojure. Instead, we now now execute a query that does a similar aggregation, but most of the calculation is done in the Mongo database.

Based on a few tests the performance is slightly slower when the collection contains small or deeply nested documents but much faster for large ones. But the main difference is in memory usage. This uses very little memory in the Metabase instance because all of the aggregation is done in the database.


Nested fields are a naturally recursive problem but here we unroll potential recursions to a `max-depth` number of queries that look for nesting at each depth level.

* ~ use DB to describe the table

* ~ optimize root query

* ~ nested-level-query works and gets objects too

* + root query gets objects too

* + driver/describe-table :mongo works

* ~ remove old implementation

* Various fixes for faster sync

Upgraded driver to 5.2.0
Updated data load to insert many rather than 1 row at a time.
Dropped max-depth to 7, see comment.

---------

Co-authored-by: Case Nelson <case@metabase.com>
2024-10-09 16:07:39 -06:00
Jeff Bruemmer
10fc583f40 docs - add time grouping (#47930) 2024-10-09 21:15:39 +00:00
Jeff Bruemmer
9e6c8a0595 docs - snowflake connection update (#47780)
* account v host snowflake connection

* add screenshot
2024-10-09 17:04:02 -04:00
Jeff Bruemmer
53d7fc7e22 docs - user provisioning with SCIM (#48411) 2024-10-09 16:19:52 -04:00
appleby
01a9255def Do not ignore-errors in pprint-native-query-with-best-strategy (#48246)
Return a description of the Exception that occurred instead.

This is helpful for debugging if query->raw-native-query throws an exception.
2024-10-09 12:34:11 -07:00
appleby
5ce94838a4 Add some more examples to db querying docstrings in dev.clj (#48248) 2024-10-09 12:33:50 -07:00
appleby
8f112be58c Remove duplicate is-clause? fn (#48423)
* Move mbql.u/{mbql-clause?,is-clause?,check-clause} to schema.helpers

And remove duplicate definitions.

Closes #39333

* Fix docstring of schema.helpers.mbql-clause?

This func is apparently no longer used by code in `normalize`, which has it's own local def.
2024-10-09 12:31:54 -07:00
github-automation-metabase
0f3497726f Update Readme version references and published npm version to 0.1.38 (#48535) 2024-10-09 19:20:25 +00:00
Alex Yarosh
d68fbb3acb docs: add a clarification about disabling password logins (#48532)
* add a clarification to sso docs

* rephrase

* Update docs/people-and-groups/authenticating-with-saml.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-09 19:18:24 +00:00
Nemanja Glumac
35a5df38a1 [MS2] Better Onboarding UX: Expanded CSV upload permissions (#48475)
* Use more granular permissions

* Simplify the "upload spreadsheet" button logic

* Simplify the "add database" button logic

* Go back to using the existing `databases` prop

* Conditionally display `UploadInput`

* Refine `canUpload` logic

* Reduce prop drilling

* Make visual logic more "reader-friendly"

* Fix and expand tests

* Pass down the existing prop `hasDataAccess`

* Remove the Metabase "learn" link

* Move sub-components out of the render
2024-10-09 17:29:38 +00:00
Phoomparin Mano
000dfe1bf4 fix(sdk): allow CLI to check React version without installing and allow continuing setup if React is missing (#48491)
* check sdk version via package.json and allow continuing setup

* make package version checks more flexible
2024-10-09 23:21:06 +07:00
Jeff Bruemmer
e423bc34f8 update api and env var docs (#48414) 2024-10-09 14:38:58 +00:00
Alexander Polyankin
51cecaf448 Remove source hacks for native query drills (#48482) 2024-10-09 10:19:56 -04:00
Noah Moss
4a1327283b Ensure that features in stats ping can only be enabled if available (#48493) 2024-10-09 09:23:00 -04:00
Romeo Van Snick
1b28389c80 Metrics empty copy (#48449)
* Update copy on metrics page

* Update copy in empty metric builder

* Fix e2e test
2024-10-09 09:12:22 +00:00
Oisin Coveney
77cb69f88e fix(sdk): Attempt to fix resize observer issues (#48227) 2024-10-09 08:40:29 +00:00
Chris Truter
89e9200331 Ensure we realize row before putting it on queue (#48446) 2024-10-09 09:51:07 +07:00
Alexander Polyankin
16044dbcb6 Remove "Draw box to filter" from grid maps for native queries (#48463) 2024-10-08 18:31:19 -04:00
Aleksandr Lesnenko
291384d1f0 add iframe dashcards tracking (#48382)
* track iframe creation

* Update Loki Snapshots

* Update frontend/src/metabase/visualizations/visualizations/IFrameViz/utils.unit.spec.ts

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-10-08 21:48:09 +00:00
dpsutton
5fd75e0d06 Ensure the temp directory exists (#48488)
https://github.com/metabase/metabase/issues/41919#issuecomment-2400542908

This issue goes away in 5.3.1 of apache poi. Seems like they have a
yearly release cadence so we can ensure this exists for the time being
and then remove this when we can bump to 5.3.1

```diff
index b763a1ffdf..c87992c935 100644
--- a/deps.edn
+++ b/deps.edn
@@ -122,7 +122,7 @@
   {:mvn/version "2.23.1"}             ; allows the slf4j2 API to work with log4j 2
   org.apache.logging.log4j/log4j-layout-template-json
   {:mvn/version "2.23.1"}             ; allows the custom json logging format
-  org.apache.poi/poi                        {:mvn/version "5.2.5"}              ; Work with Office documents (e.g. Excel spreadsheets) -- newer version than one specified by Docjure
+  org.apache.poi/poi                        {:mvn/version "5.3.1"}              ; Work with Office documents (e.g. Excel spreadsheets) -- newer version than one specified by Docjure
   org.apache.poi/poi-ooxml                  {:mvn/version "5.2.5"
                                              :exclusions  [org.bouncycastle/bcpkix-jdk15on
                                                            org.bouncycastle/bcprov-jdk15on]}
```
2024-10-08 16:17:37 -05:00
Aleksandr Lesnenko
c6b0b2b722 isomorphic viz settings computation (#47963)
* isomorphic viz settings computation

* stories

* drop duplicated static formatter

* drop formatValue from the renderingContext

* clean up

* stories

* fix static charts stories

* clean up mocked env

* update sunburst formatters

* no longer injecting formatValue

* exclude modules without name

* Update Loki Snapshots

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-10-08 16:29:18 -04:00
Ryan Laurie
62861cc74f Update Settings Copy to kick Ci + fix milestone setting bug (#48486)
* update setting copy

* update settings context strings

* fix milestone check
2024-10-08 14:22:47 -06:00
Cam Saul
b817282924 🏎️🚀 🏎️🚀 🏎️🚀 Test partitioning for MySQL: shave ~5 minutes off of CI runs 🏎️🚀🏎️🚀 🏎️🚀 (#48422)
* SQUASH!

* Add another sanity checc

* Another test fix attempt

* Appease Kondo
2024-10-08 12:11:27 -07:00
Nick Fitzpatrick
372d529bee Collection of UI updates to the alert modal (#48431)
* collection of UI updates to the alert modal

* remiving unused es lint directive

* adding tag to cypress test
2024-10-08 15:47:37 -03:00
github-automation-metabase
9df336d051 Update Readme version references and published npm version to 1.51.0 (#48483) 2024-10-08 18:21:01 +00:00
Alex Yarosh
cdea683a7a fix links (#48478) 2024-10-08 13:51:20 -04:00
Nemanja Glumac
662bf17c92 [MS1] Better Onboarding: Educational Section in the Main Sidebar (#48369)
* [MS 1.1] Better Onboarding via First-Time UX (#48202)

* Add new `learn` icon

* Add initial visual elements WIP

* Add a menu WIP

* Use named export instead of a named one

* Encapsulate the menu item logic

* Redo the styling

* Add todo notes

* Get rid of the `style` prop where possible

* Fix CSS logic for the container

* Collapse section when the sidebar is closed

* Use Mantine prop instead of the `style`

* Fix the translation issue

* Collapse section completely when the sidebar is closed

* Remove hard coded color reference from SVG

* Simplify element positioning

* Collapse sidebar when closed

* Fix E2E tests unscoped selectors

* Rename props

* Extract `SidebarOnboardingSection` logic into a separate component

* Allow only admins to add data

* Remove "Add your own data" button

* Simplify menuitem component

* Add initial unit tests

* Use predefined vars for the CSV button subtitle

* Show Upload CSV modal

* Enable file uploads

* Improve file organization

* Tidy up types

* Add analytics

* Remove "Upload CSV" button from the sidebar

* Fix "unmocked GET request"

* Make menu usable on small screens

* Make sure sidebar is scrollable
2024-10-08 19:40:56 +02:00
appleby
1f733b9849 Fix typo in devguide (#48247) 2024-10-08 11:16:51 -06:00
Chris Truter
20cfb42399 Require explicit flag to calculate available_models for search (#48133)
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-10-08 18:46:03 +02:00
Alexander Polyankin
3a0a96909a Fix query_metadata not including metadata for native queries (#48459)
* Fix query_metadata not including native queries

* Fix query_metadata not including native queries

* fix tests
2024-10-08 16:43:34 +00:00
Nicolò Pretto
173227ae9f update embedding homepage now that we don't auto-enable embedding (#48455)
* update embedding homepage now that we don't auto-enable embedding

* more cleanup and a test "Enable interactive embedding"
2024-10-08 17:47:49 +02:00
Alexander Polyankin
4aa67506aa Native query drill (#48232) 2024-10-08 14:49:59 +00:00
Ryan Laurie
2ec9fdb178 Update release channel settings copy (#48425)
* update release channel copy

* update e2e tests
2024-10-08 07:49:03 -06:00
Raphael Krut-Landau
0b7bf918c4 Mock audit info requests (#48432)
This PR
* mocks audit requests in tests of `DashboardInfoSidebar` and `QuestionInfoSidebar` (these tests were flaking)
* introduces a helper, `setupAuditEndpoints`, to facilitate this in the future
* uses the helper in one other place where audit requests were getting mocked
2024-10-08 08:58:28 -04:00
Nicolò Pretto
537ba4172e SDK launch in core app (#48107)
Co-authored-by: Oisin Coveney <oisin@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: bryan <bryan.maass@gmail.com>
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-10-08 15:40:42 +03:00
Alexander Polyankin
f03e6d8caa Default to = operator when Filtering on this field is set to A list of all values or Search box (#48412) 2024-10-08 08:19:56 -04:00
lbrdnk
724958737d [Databricks] Address initial remarks (#48377)
* Address initial remarks

* Extract hive-like to separate module and set it as dependency

* Remove hive-like also from spark
2024-10-08 09:16:04 +00:00
Phoomparin Mano
74be2dcce5 fix(sdk): update utm tags in embedding sdk cli (#48419) 2024-10-08 15:55:38 +07:00
Kamil Mielnik
f6aab536e0 [Epic] Search in selection in entity picker (#47755)
* Maintain selected folder state in Entity Picker (#47309)

* Keep tabs mounted

* Rename TablePicker onChange to onItemSelect to match QuestionPicker and also call it for folders

* Inline small functions

* Remove unused type

* Rename

* Remove TODOs

* Remove duplication

* Reduce diff

* Rename

* Lift state from TabsView

* Remove redundant callback

* Store folder state in DataPickerModal

* Refactor computing tabs

* Consolidate search tab definition with recents tab definition

* Simplify computeInitialTab interface

* Extract RECENTS_CONTEXT

* Store tab state in DataPickerModal

* Propagate initial tab state

* Fix a flicker

* Keep tab state in EntityPickerModal

* Fix typing computeInitialTab

* Remove Notebook prefix

* Pass onItemSelect to individual tabs from EntityPickerModal

* Auto select folder

* Fix types

* Adjust remaining tabs definitions to use render

* Adjust tabs definitions to use render in tests

* Fix inverted condition

* Fix TS error

* Fix types

* Rename EntityTab to EntityPickerTab, TabId to EntityPickerTabId

* Rename EntityTabRenderProps to EntityPickerTabRenderProps

* Separate tab models from tab ids

* ESLint

* ESLint

* Recognize folders inside EntityPickerModal

* Add missing prop

* Remove console.log

* Simplify handleFolderSelect

* Revert changes that will go to a different PR

* Fix unit tests

* Refactor

* Remove keepMounted prop

* Fix type

* Remove useMemo from tabs computation (#47505)

* Extract getTabs for DataPickerModal

* Extract getTabs for EntityPickerModal

* Add explicit return type

* Revert "Add explicit return type"

This reverts commit feb3f58c3c.

* Revert "Extract getTabs for EntityPickerModal"

This reverts commit 4e875a1fc1.

* Revert "Extract getTabs for DataPickerModal"

This reverts commit cdda8ea185.

* Remove useMemo

* Maintain tab state in Entity Picker (#47794)

* Store picker path state in data picker modal

* Adjust remaining QuestionPicker usages

* Store collection picker state

* Use dedicated onPathChange prop

* Store dashboard picker state

* Improve naming

* Fix unit tests

* Remove accidental code

* Return to previously opened tab when search input is cleared in Entity Picker (#47798)

* Restore previous tab when clearing search input

* Add a unit test for new behavior

* Update comment

* Don't use effect

* Add more tests

* Reduce diff

* Fix flakes

* Change search input placeholder depending on selected folder & tab in Entity Picker (#47801)

* Make TabFolderState generic, pass folder to EntityPickerSearchInput

* Simplify interface

* Extract getSearchInputPlaceholder

* Reduce diff

* Remove TODO

* Implement it

* Shorten code

* Reduce diff

* Use database to scope search if there's only 1 schema

* Add scoped search in the Search tab in Entity Picker (#47839)

* Cleanup entity picker search types (#48098)

* Add e2e tests for local search in the entity picker (#48122)

* Sync the value back into selectedItem when it changes

* Await element

* Handle empty tabs

* Pick everywhere tab

* Click Everywhere in unit tests

* Use deep equality to sync value

* Sync back the path value to the dashboard too

* Run test as admin to avoid (unrelated) permissions issues

* Filter scoped results too

* Fix post-merge issues

* Fix type issues

* Fix null scoped search results

* Sign in as admin to appease the tests

* Use useDeepCompareEffect when syncing back state

* Add default value for searchResultFilter to avoid double condition

* Avoid using useEffect to sync selectedItem

* Avoid overwriting path in useEnsureCollectionSelected

* Fix e2e test

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-10-08 08:05:08 +00:00
Oisin Coveney
9f50306f2a Removes unneeded query parameters (#48401) 2024-10-08 06:36:12 +00:00
Cam Saul
cd4d764632 🏎️🚀🏎️🚀 🏎️🚀 SHAVE 7 MINUTES OFF OF NON-CORE DRIVER TEST RUNS IN CI 🏎️🚀🏎️🚀 🏎️🚀 (#47681)
* Parallel driver tests PoC

* Set fail-fast to false for now

* Try splitting up non-driver tests to see how broken tests are

* Whoops fix plain BE tests

* Ok nvm I'll test this in another branch

* Fix fail-fast

* Experiment with the improved Hawk split logic

* Fix some broken/flaky tests

* Experiment: try splitting MySQL 8 tests into FOUR jobs

* Divide other Postgres and MySQL tests up and use num-partitions = 2

* Another test fix 🔧

* Flaky test fix 🔧

* Try making more stuff fast

* Make athena fast??

* Fix a few more things

* Test fixes? 🔧

* Fix configs

* Fix Mongo job syntax

* Fix busted test from #46942

* Fix Mongo config again

* wait-for-port needs to specify shell I guess

* More cleanup

* await-port can't have a timeout-minutes I guess

* Let's only parallelize MySQL for now.

* Cleanup action

* Cleanup wait-for-port action

* Fix another flaky test

* NOW driver tests will be FAST

* Need to mark driver tests too

* Fix wrong tag

* Use Hawk 1.0.5

* Fix busted metabase.public-settings-test/landing-page-setting-test

* Fix busted `metabase.api.database-test/get-database-test` etc. (hopefully)

* Fix busted `metabase.sync.sync-metadata.fields-test/sync-fks-and-fields-test` for Oracle

* Maybe this fixed `metabase.query-processor.middleware.permissions-test/e2e-ignore-user-supplied-perms-test` maybe not

* Fix busted metabase.api.dashboard-test/dependent-metadata-test because endpoint had differemt sort order than test

* Ok my test fix did not work

* Fix metabase.sync.sync-metadata.fields-test/sync-fks-and-fields-test for Redshift

* Better test name

* More test fixes 🔧

* Schema fix

* PR feedback

* Split off test partitioning into separate PR

* Fix failing Oracle tests

* Another round of test fixes, hopefully

* Fix failing Redshift tests

* Maybe the last round of test fixes

* Fix Oracle

* Fix stray line
2024-10-08 04:32:12 +00:00
Alexander Polyankin
cffae16871 Select All follow-ups (QB) (#48405) 2024-10-07 18:46:47 -04:00
Jeff Bruemmer
4a6700f2ce docs - metrics v2 (#47872) 2024-10-07 14:54:32 -04:00
metamben
de50ba7164 Implement better partitioning and sorting in window functions (#48028)
Implement better partitioning and sorting in window functions
2024-10-07 18:36:58 +00:00
Alexander Polyankin
39ba5b866d Allow Box props in Icon (#48398) 2024-10-07 17:25:52 +00:00
Alex Yarosh
6bcd9acf05 docs: gauge chart (#48269)
* gauge

* progress addition

* alternatives

* update link

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-07 16:34:16 +00:00
Raphael Krut-Landau
e0984e2a85 Fix unit tests in CollectionInfoSidebar (#48403) 2024-10-07 16:29:16 +00:00
Case Nelson
eaabfa7929 feat: move auth providers behind ee token (#48245)
* feat: move auth providers behind ee token

Fixes #48235

Introduces new premium feature `database-auth-providers`.
Moves fetch-auth behind defenterprise - oss will always return an empty
map.
Add metabase.util.http to test outbound http requests.

* Fix broken refs

* Drop defmethod as adhoc overrides aren't desirable outside ee

* Drop unessary require

* Fix token and tests

* Fix tests

* Fix formatting

* Fix var cast exception

* Fix connection test

* Move test to ee namespace

* Move more tests behind enterprise

* Fix checked-section hiding
2024-10-07 10:13:26 -06:00
Vamsi Peri
d6eeaf1ec6 Update team.json remove Emmad (#48397) 2024-10-07 09:21:23 -05:00
Jeff Bruemmer
0988835652 docs - iframe cards (#48375) 2024-10-07 10:02:00 -04:00
Ryan Laurie
217597420a Hide entity ids when an instance has serialization disabled (#48327)
* look I did a clojure!

* only show entity ids when serialization is enabled

* update tests

* ok fine typescript

* fix test
2024-10-07 07:56:59 -06:00
Ryan Laurie
b5954d603f Update pre-release version nomenclature (#48357)
* support for pre-release suffixes

* handle milestones better

* update prerelease function in github action

* update zero coalescing
2024-10-07 07:41:35 -06:00
Ngoc Khuat
7c3f18ddca Further improved send pulse log (#48342) 2024-10-07 04:05:42 +00:00
Raphael Krut-Landau
4fa5aa7299 Collection sidesheets (#48082) 2024-10-05 17:12:23 -04:00
Emmad Usmani
2fb8287acc sunburst click behavior e2e test (#48367)
* sunburst click behavior e2e test

* await error text before going back
2024-10-05 21:03:53 +00:00
Aleksandr Lesnenko
55a42c7e80 hide dashcard actions when editing iframe card content (#48314)
* hide dashcard actions when editing iframe card content

* spec

* renaming

* check if viz supports previewing
2024-10-05 02:37:19 +00:00
Ryan Laurie
4e343c1da5 Add Release Channel selection in-product (#48126)
* add update channels in product

* support for changing release notes to show beta and nightly info

* dont export setting

* obey the linter and add tests

* export setting

* update e2e tests

* clojure magic

* clojure-foo

* better localization

* sorry mr linter

* add more tests 💪
2024-10-04 22:02:31 +00:00
Jeff Bruemmer
313fde9879 docs - databricks (#48365) 2024-10-04 14:36:24 -04:00
Aleksandr Lesnenko
4cfabbecc1 fix incorrect handling of offset-based timezones (#48329)
* fix incorrect handling of offset-based timezones

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-10-04 16:18:36 +00:00
Nick Fitzpatrick
e5fcbc4b3f RC -> beta (#48346) 2024-10-04 12:15:26 -03:00
Alex Yarosh
154e62921d remove unnecessary hash links (#48331) 2024-10-04 10:47:23 -04:00
Emmad Usmani
d4f9a2045c sunburst improvements (#48316)
* sunburst improvements

* fix dimension picker styles

* simplify styles

* update e2e test

* add loki specs

* add missing newlines
2024-10-04 07:41:01 -07:00
Jeff Bruemmer
7ed9dbd34d docs - image updates (#48274) 2024-10-04 09:13:57 -04:00
Raphael Krut-Landau
2451a779ab Tiny edit to metric copy (#48328) 2024-10-04 06:59:48 -04:00
Ngoc Khuat
2603f2402e Do not clear http channels when sending pulse (#48330) 2024-10-04 09:46:19 +00:00
Oisin Coveney
3c16a1bdb0 Add API endpoints for public + embedded entities (#48290) 2024-10-04 10:30:20 +03:00
Ryan Laurie
40ed53ef8e Fix root collection links in sidebars (#48263)
* fix root collection links in sidebars

* use collection url function
2024-10-03 22:09:41 +00:00
Jeff Bruemmer
aee56f5892 docs - saml page edits and SLO (#47261) 2024-10-03 20:47:56 +00:00
Nick Fitzpatrick
dbb6df1814 guard database create route (#48308) 2024-10-03 17:31:39 -03:00
Oreon Lothamer
b1493c27c0 add security-events: write to uberjar permissions (#48320) 2024-10-03 10:21:01 -10:00
Luiz Arakaki
f256171055 tweak the copy of CC and BCC setting (#48272) 2024-10-03 13:53:08 -05:00
lbrdnk
a44015ae4c Use context for field id computation while hydrating dashbaord (#47820)
* Use context for field id computation while hydrating dashbaord

* Update docstring

* Fix target

* Update lookup

* Fix param-target usage

* Unskip e2e

* Bind *param-id-context* in public dashboard compputation

* Fix context update

* Fix field-ids->param-field-values-ignoring-current-user

* Add tests

* Comments

* cljfmt

* Update field-ids->param-field-values-ignoring-current-user

* Update src/metabase/models/params.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Update src/metabase/models/params.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Use atom instead of volatile!

* Avoid dynamic function var

* Update src/metabase/models/params.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Address remarks

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-10-03 20:49:29 +02:00
Luiz Arakaki
205f2239bd allow embedding external content on dashboards (#47994)
* embed cards

* safety

* rename params

* review, renaming

* min and default size of iframe cards

* move ml auto to parent

* use truncate

* spec failures

* empty state

* consistent iFrame copy

* renaming, no fe tracking

* iframe copy

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-10-03 16:09:43 +00:00
Aleksandr Lesnenko
0d27f8749c tweak area-focus-blur-styles (#48282) 2024-10-03 11:05:28 -04:00
Nicolò Pretto
70a8ab70a8 feat(sdk): support locale prop on MetabaseProvider (#47569)
* wip locale header middleware

* wip fe code for the locale provider for both public/static and sdk

* clean up code

* move api.baseurl assignment outside of useEffect to make it work on first render

* e2e test for locale

* Revert "wip locale header middleware"

This reverts commit c215eac3f8.

* remove public/static code as we want to focus on the sdk

* adds docs for `X-Metabase-Locale` header and for why we don't use I18NApi.locale

* Update frontend/src/metabase/lib/api.js

* doc: explain why we have the unused state
2024-10-03 16:28:08 +02:00
Nick Fitzpatrick
fd615bf20a Add isLoadingTabs prop to EntityPicker (#47447)
* isLoadingTabs

* skeleton loading state

* adjusting skeleton colors

* maz color tweak

---------

Co-authored-by: Maz Ameli <maz@metabase.com>
2024-10-03 10:56:57 -03:00
Romeo Van Snick
65841e8440 Edit metric and model links (#48231)
* Update the labels for the Edit question action for models and metrics

* Use the metric and model editor by default

* Add e2e tests for metric and model cards

* Remove console.log

* Add extra mode for editing metrics or models

* Use slug to do exact match of path

* Rename editor mode to query

* Rename as param to mode
2024-10-03 13:34:46 +00:00
Uladzimir Havenchyk
ed3ce1e618 fix a warning about outdated meta tag (#47915) 2024-10-03 13:23:11 +00:00
Kamil Mielnik
bb24220a1e Fix redundant isSmallAppBar prop warning (#48287) 2024-10-03 16:04:43 +03:00
Chris Truter
9e09a6d1da Fix appending to models with existing non-ascii columns (#48237) 2024-10-03 10:06:57 +00:00
Ngoc Khuat
24232c6736 add more logging for sending pulse (#48286) 2024-10-03 08:16:29 +00:00
appleby
e2b74d79f6 Add tests for exporting self-joined renamed columns (#48244)
* Add BE test for exporting self-joined renamed columns
* Add e2e test for exporting self-joined renamed columns

See also

- Not renamed fields in a same table join inherit the renamed name in exports #48046
- backport: Support both name & field ref-based column keys in viz settings on read and upgrade on write #48243
2024-10-02 16:53:19 -07:00
Ryan Laurie
a8f48df215 Batch Add Milestones to new release branch (#48250)
* add action to batch process release branch milestones

* top level await workaround

* add more logging

* cleanup
2024-10-02 16:47:43 -06:00
Emmad Usmani
61e610b3b9 add sunburst to pie chart (#47208)
* add sunburst to pie chart

* fix type errors

* consider all slice percent values for formatting percent on chart

* fix lint error

* refactor nested functions outside of parent

* create and use getArrayFromMapValues helper

* fix bug with percent significant digits

* improve color picker

* fix total visibility in small dashcards

* fix missing field remappings

* use aggregated value for click behavior

* update minimum slice percentage logic

* fix total text truncation

* remove colors from tooltip for middle and outer slices

* update e2e spec

* update snapshot

* update ring setting titles

* address feedback

* update comment
2024-10-02 22:39:18 +00:00
Case Nelson
3fd17081b2 fix: bigquery more resilient querying (#48175)
* fix: bigquery more resilient querying

Inline some function calls to make it easier to track what's happening.

Make sure that cancellation during the initial query and subsequent page
fetches are handled properly. Explicitly throw when cancelled.

Only retry queries if bigquery says they are retryable.

Try to cancel the BigQuery job if an exception or cancellation occurs.

* Add comment explaining execution flow

* Bump bigquery deps

* Bump biquery dependencies

* Fix tests

* Fix formatting
2024-10-03 00:46:48 +03:00
Aleksandr Lesnenko
5faa6f367a rename number of decimal places setting (#48273) 2024-10-02 20:46:09 +00:00
Jeff Bruemmer
a1093dd15a docs - webhooks draft (#48239) 2024-10-02 16:31:34 -04:00
Emmad Usmani
7764892c86 fix aggressive legend truncation (#48207)
* fix aggressive legend truncation

* add e2e test

* revert LegendVertical changes

* update legendTitles calculation in PieChart

* restore size prop in LegendVertical

* fix e2e test
2024-10-02 20:19:23 +00:00
github-automation-metabase
825e19b83e Add v0.50.28 to the list of releases (#48270)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-10-02 14:16:40 -04:00
Oreon Lothamer
23c85cf032 build ee-extra docker image (#47960) 2024-10-02 07:55:40 -10:00
Nick Fitzpatrick
ae8f28abac adding swag button (#48155)
* adding swag button

* adding unit tests

* updating copy and colors

* adjusting rc version detection

* adding t-shirt icon. Updating gradient and copy

* final adjustments

* I can't spell
2024-10-02 14:45:03 -03:00
github-automation-metabase
7821f9829f Update Readme version references and published npm version to 0.1.37 (#48268) 2024-10-02 17:44:20 +00:00
Alberto Perdomo
10e8b58506 docs(sdk): Improvements to SDK readme (#47711)
* Improvements to SDK readme

* Add live demo site to SDK readme

* Remove suggested workarounds for SSR

* Use - for bullets for consistency

* Remove Loom

* Update enterprise/frontend/src/embedding-sdk/README.md

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-10-02 16:36:50 +00:00
Nicolò Pretto
67fc1c91b5 fix(sdk): fix zindex issues after switch to portals (#48256)
* fix(sdk): fix zindex issues after switch to portals

* Target portal to a different root than popovers and co

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-10-02 15:55:32 +02:00
Arkadi Yaroslavtsev
66f8f30c21 Removing nemanja from querying (#48255) 2024-10-02 06:46:42 -04:00
Romeo Van Snick
3a3785d27b Disable value column on Browse metrics page (#48217)
* Remove value column from Browse metrics page

* Remove tests for metric values

* Fix markdown test
2024-10-02 09:11:40 +02:00
Ryan Laurie
670ec10011 Add alternative release channel info to version-info.json (#48153)
* allow updating version-info with other channel info

* polish + tests

* found the version swallower
2024-10-01 17:40:24 -06:00
Emmad Usmani
b85167704d fix pie chart e2e test flake (#48212) 2024-10-01 19:45:18 +00:00
Alex Yarosh
bc96b28870 [docs] Trash (#43049)
* trash

* Trash update

* review comments

* link

* why are you complaining

* text to tables

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* review comments

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-10-01 14:37:35 -04:00
Alex Yarosh
f39c331ddc docs: JWT groups with environment variables (#48240)
* docs: JWT groups with env vars

* typo
2024-10-01 14:30:52 -04:00
Oleksandr Yakushev
f14bfd4ad3 perf: Do fewer moderation_reviews queries when fetching recent views (#48169) 2024-10-01 19:59:59 +03:00
Uladzimir Havenchyk
46a91cc4f6 fix: allow aggregation removal from qb sidebar (#48230) 2024-10-01 19:47:08 +03:00
Emmad Usmani
e46b627347 fix uncentered pie chart (#48179) 2024-10-01 09:29:29 -07:00
Romeo Van Snick
21fb561ea5 List metrics in native editor data reference (#48191)
* Add metrics to table pane

* Add test for metric in data reference sidebar

* Clean up other reference tests

* Add test for when the table has no metrics

* Use helper for sidebar header title

* Rename sidebar to create distinction from existing helper
2024-10-01 18:20:42 +02:00
Chris Truter
4b278779ac Future-proof CSV uploads from next HoneySQL upgrade (#48220) 2024-10-01 18:05:20 +02:00
Nicolò Pretto
abe04bc24e fix(sdk): modal pushing content below when opened (#48216)
* fix(sdk): modal pushing content below when opened

* render the portal below the content so we don't need the zIndex

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-10-01 17:39:31 +02:00
Nicolò Pretto
9861c417ad fix: wrap Filter by this value in t (#48226) 2024-10-01 14:15:32 +00:00
Oisin Coveney
c5f27d495f Merge remote-tracking branch 'origin/fix(sdk)/fix-react-17-and-resize-observer' 2024-10-01 16:52:08 +03:00
Raphael Krut-Landau
24c5e69d8a fix: Don't show error page when command palette documentation link is clicked (#47862) 2024-10-01 09:41:59 -04:00
Uladzimir Havenchyk
896af8a312 add eslint plugin for storybook (#48206)
* add eslint plugin for storybook

* fixup

* fixup

* fixup
2024-10-01 16:16:02 +03:00
Oisin Coveney
e8756d9d9d revert scalar change for this branch 2024-10-01 16:10:10 +03:00
Oisin Coveney
b105525834 Move changes to another brnach 2024-10-01 16:09:14 +03:00
Noah Moss
424134263f Sync DBs in a future when initializing MB from config file (#48176) 2024-10-01 09:01:45 -04:00
Oisin Coveney
8b984479e9 Merge branch 'master' into fix(sdk)/fix-react-17-and-resize-observer 2024-10-01 15:52:00 +03:00
Oisin Coveney
62ca675b3a make sure that themes are respected 2024-10-01 15:51:48 +03:00
Oisin Coveney
33fb74e083 Attempt a fix at font size scaling 2024-10-01 14:27:09 +03:00
Chris Truter
b28aa417be Upload test fixes for drivers without auto mb-id (#48194) 2024-10-01 10:18:41 +00:00
Romeo Van Snick
012408eb2a Show "New metric" command panel (#48201)
* Add 'New metric' action to command palette

* Add test for 'New metric' in command palette
2024-10-01 11:21:57 +02:00
Romeo Van Snick
e98c0e38bc Browse cleanup (#48136)
* Simplify browse components imports

* Move metrics-related browse components to separate folder

* Move models related browse components to separate subdir

* Split up browse/test-utils

* Move schemas related browse code to separate folder

* Move databases related browse code to separate folder

* Move tables related browse code to separate folder

* Fix import paths

* Avoid drilling into metric module

* Avoid drilling into models module

* Move enterprise tests for browse models

* Format comments

* Remove unused sortModelsByVerification plugin helper

* Support skipToken in useFetchModels

* Simplify models content verification

* Fix filter button query

* Do not filter recent models if there are no verified models

* Use filterButton helper everywhere

* Fixup comment

* Use new var-style color
2024-10-01 11:15:02 +02:00
Nicolò Pretto
688b9ad95d fix(sdk): decrease specificity of css reset in embedding sdk (#48193) 2024-10-01 09:46:34 +02:00
Romeo Van Snick
3716a0a51b Await dashcard query when editing to fix flake (#48181)
* Await dashcard query when editing

* Reload to fix flake

* Reset filters to fix flake

* Await dashcard query when editing

* Wait for query

* WIP

* Hard-visit dashboard

* Split up test to avoid navigation issues
2024-10-01 08:34:01 +02:00
Chris Truter
7420aa6065 Fix search test flake (#48187) 2024-10-01 06:07:07 +00:00
Kamil Mielnik
2c3b5838c6 Fix - metrics do not work with offset in custom expressions (#48188)
* Allow using metrics with offset in custom expressions

* Unskip and update repro
2024-10-01 12:35:36 +07:00
Jeff Bruemmer
a5466e05c6 Update WebhookChannelEdit.tsx (#48211) 2024-10-01 08:27:00 +07:00
Noah Moss
76d8b61867 Fix shape of metadata in Snowplow stats ping to conform to new schema (#48205) 2024-09-30 20:22:15 -04:00
Vamsi Peri
8ab526f2e9 Add GreptimeDB to the list of community drivers (#48214) 2024-09-30 21:54:56 +00:00
John Swanson
0ef2052fb9 Do not cache all token check failures (#48147)
* Do not cache all token check failures

We want to cache token checks to avoid an issue where we repeatedly ask
the store "hey, is this token valid?? is this token valid?? is this
token valid??" for the same token.

However, transient errors can also occur. For example, maybe a network
issue causes the HTTP request to fail entirely. In this case, if we
cache the result, the user needs to restart metabase (or wait 5 minutes
until the cache is cleared) before they can attempt to validate their
token again.

This PR moves the cache logic deeper into the stack. We want to cache
"successful" responses from the store API - cases where the store has
told us categorically that the token is or is not valid. We don't want
or need to cache other things that might happen. Maybe your token isn't
the right length - we can recalculate that, it's ok. Maybe you get a 503
error from the Store - we should let you retry. Maybe your network is
having issues and you can't contact the Store at all - again, we should
let you retry.

The one potential issue I see here is that if the store goes down, we'll
massively increase the number of requests we send to the store,
potentially making it harder to recover. If this is a concern, I can add
a circuit breaker: if we repeatedly get errors back from the store, back
off and stop making requests for a while.

* Add a circuit breaker to store API requests

In the pathological case where the store goes down for >5 minutes, the
cache will expire and all instances everywhere will start repeatedly
making requests for token validation at once. This might make recovering
from an outage more difficult.

This adds a circuit breaker around the API request. If the call
repeatedly throws (5XX errors, socket timeouts, etc.) then we'll pause
for 1 minute, during which time all calls to token validation will
immediately fail without making any request to the API.

After one minute, we'll allow one request through to the API. If it
succeeds, we'll go back to normal operation. Otherwise, we'll wait
another minute.
2024-09-30 14:22:12 -07:00
Noah Moss
1dd41ef5d0 Fix timezone comparisons in failing execution stats test (#48204) 2024-09-30 20:52:16 +00:00
Nicolò Pretto
dcc33cebdf updateSetting e2e typed helper (#48161)
* putSetting helper

* change all usages of cy.request("PUT" "api/setting/..." to putSetting(...) in e2e tests

* Update e2e/support/helpers/api/putSetting.ts

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Update e2e/support/helpers/api/putSetting.ts

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* sort exports

* putSetting -> updateSetting as per PR suggestion

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-09-30 17:17:29 +02:00
Romeo Van Snick
474b137abb Disable "Compare to the past" UI components (#48134)
* Temporarily disable compare to the past ui components

* Temporarily disable compare to the past tests

* Skip Compare to past unit tests
2024-09-30 16:35:06 +02:00
Luiz Arakaki
e8307b280e Rename Metabase analytics to Usage analytics and other small fixes (#48151)
* rename usage analytics and few fixes

* update e2e tests

* update some other strings too

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-09-30 11:25:23 -03:00
Uladzimir Havenchyk
268b6c48ad refactor: rework stories from MDX to MDX + CSF (#48054)
* refactor: rework stories from MDX to MDX + CSF

* short syntax

* fix or bypass typescript errors

* fix leftovers

* cleanup leftovers

* convert js stories to tsx

* restore some comments

* fix linting
2024-09-30 15:25:07 +03:00
Noah Moss
e12e36044e Fix non-bool value in CSV upload availability check for stats ping (#48167) 2024-09-27 19:38:05 +00:00
Braden Shepherdson
e8deecc58f [QP] Don't attach :temporal-unit :default to every temporal clause (#48085)
This was old logic to support certain drivers (eg. pre-JDBC Druid) and
isn't required for most. It's perfectly sound to filter or even break
out on a datetime column without bucketing.

Adds a new `:temporal/requires-default-unit` driver feature, and enables it only for the legacy Druid driver.

Fixes #47341
2024-09-27 13:38:06 -04:00
Nicolò Pretto
93cd63aca9 test(sdk): test that "Custom" fonts work with the sdk (#48160) 2024-09-27 17:08:20 +02:00
Romeo Van Snick
974ee22073 Reset the dashboard parameter when setting the default value (#48089)
* Reset the dashboard parameter when setting the default value

* Fix test for filter default

* Add test for setting parameters when editing the defaults

* Use plain dispatch

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

* Use cy.log instead of comments

* Use icon selector

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-09-27 14:51:17 +00:00
adam-james
3dfcb3d561 Pivot Options are Properly Calculated for Questions based on Models with Joins (#47830)
Fixes 46575

Creating a Pivot Table Question that is based off of a model that has at least one column derived from a join failed
to display row totals.

This is because the pivot-options map was being mis-calculated; not all column indices were correctly found/passed in
to the :pivot-rows or :pivot-cols keys, causing the pivot query not to compute all necessary data.

Here, I just modify the :lib/source key of the columns whose source is a card (as determined by the existence of
:lib/card-id). The columns being checked will all have :source/breakout, which caused, in the issue's repro example,
the "NAME" column to be missed. If it instead has :lib/source :source/card, the logic inside
`lib/find-matching-column` works.
2024-09-27 14:38:53 +00:00
Ryan Laurie
015d6521cd Pass credentials to nightly build tag workflow (#48159) 2024-09-27 06:21:34 -06:00
lbrdnk
22260b7334 Temporarily fix hive-like dependency (#48148) 2024-09-27 13:46:08 +02:00
Ryan Laurie
4040b9d23f 🏳️ Realign description inputs (#48152) 2024-09-27 03:38:07 -06:00
Oisin Coveney
a387bc6d7b Convert ChartType components to Mantine (#47745) 2024-09-27 12:06:24 +03:00
Chris Truter
847a3230e5 Fix edge cases where uploads munged display names (#48149) 2024-09-27 10:30:35 +03:00
Chris Truter
1f95447352 Periodically recreate the search index (#48137) 2024-09-27 05:15:18 +00:00
Nicolò Pretto
ed24366ea9 fix(sdk): remove ts limitation on custom fonts + some minimal e2e tests for the fonts (#48071)
* IS_EMBEDDING_SDK_BUILD -> IS_EMBEDDING_SDK to keep things simple, as we already have that name in other places

* don't load metabase css in sdk stories

* first two stories

* make the store not a global "singleton" anymore

* basic test for font-family styles in the SDK

* allow any custom font in theme.fontFamily as we actually support it

* fix tests using hardcoded default font family
2024-09-26 18:53:00 +02:00
Ryan Laurie
d489654cba Add additional dashboard info to sidesheet (#48078)
* create dashboard settings sidebar

* only show settings to dashboard editors

* add dashboard details

* update localization

* fix merged type

* fix mixed-up creation and editing
2024-09-26 09:09:32 -06:00
lbrdnk
c04928d5b6 Databricks JDBC driver (#42263)
* Databricks JDBC driver base

* Add databricks CI job

* WIP data loading -- it works, further cleanup needed

* Cleanup

* Implement ->honeysql to enable data loading

* Hardcode catalog job var

* Implement driver methods and update tests

* Derive hive instead of sql-jdbc

* Cleanup leftovers after deriving hive

* Run databricks tests on push

* Cleanp and enable set-timezone

* Disable database creation by tests

* Add Databricks to broken drivers for timezone tests

* Exclude Databricks from test

* Enable have-select-privilege?-test

* Restore sql-jdbc-drivers-using-default-describe-table-or-fields-impl post rebase

* Restore joined-date-filter-test

* Adjust to work with dataset definition tests

* Adjust alternative date tests

* Remove leftover reflecttion warning set

* Update test exts

* cljfmt vscode

* Add databricks to kondo drivers

* Update metabase-plugin.yaml

* Update databricks_jdbc.clj

* Rework test extensions

* Update general data loading code to work with Databricks

* Reset tests to orig

* Use DateTimeWithLocalTZ for TIMESTAMP database type

* Convert to LocalDateTime for set-parameter

* Update test extensions field-base-type->sql-tyoe

* Update database-type->base-type

* Enable creation of time columns in test data even though not supported

* Fix typo

* Update tests

* Udpate tests

* Update drivers.yml

* Disable dynamic dataset loading tests

* Adjust the iso-8601-text-fields-should-be-queryable-date-test

* Update load-data/row-xform

* Add time type exception to test

* Update test data loading and enable test

* Whitespace

* Enable all driver jobs

* Update comment

* Make catalog mandatory

* Remove comment

* Remove log level from spec generation

* Update sql.qp/datetime-diff

* Update read-column-thunk

* Remove comment

* Simplify date-time->results-local-date-time

* Update comment

* Move definitions

* Update test extension types mapping

* Remove now obsolete ddl/insert-rows-honeysql-form implementation

* Update sql-jdbc.conn/connection-details->spec for perturb-db-details

* Update load-data/do-insert!

* Remove ssh tunnel from driver as tests do not work with it

* Update test

* Promote ::dynamic-dataset-loading to :test/dynamic-dataset-loading and modify corresponding tests

* Adjust to broken TIMESTAMP_NTZ sync

* Update read-column-thunk to return timestamps always in Z

* Comment

* Disable tests for dynamic datasets

* Return spark jobs into drivers.yml

* Update Databricks CI catalog

* Remove vscode cljfmt tweak

* Update iso-8601-text-fields-expected-rows

* Update datetime-diff

* Formatting

* cljfmt

* Add placeholder test

* Remove comment

* cljfmt

* Use EnableArrow=0 connection param

* Remove comment

* Comment

* Update tests

* cljfmt

* Update driver's deps.edn

* Update tests

* Implement alternative `describe-table`

* WIP Workaround for timestamp_ntz sync, will be thrown away probably

* Update metabase-plugin.yaml with schema filters

* Update driver to use schema filters and remove now redundant sync implemnetations

* Update tests

* Update tests extensions

* Update test

* Add feature flags for fast sync

* Implement describe-fields

* Implement describe-fks-sql

* Enable fast sync features

* Use full_data_type

* Comment

* Add exception for timestamp_ntz columns to new sync code

* Implement db-default-timezone

* Add timestamp_ntz ignored test

* Add db-default-timezone-test

* Fix typo

* Update setReadOnly

* Add comment on setAutoCommit

* Update chunk-size

* Add timezone-in-set-and-read-functions-test

* Drop Athena from driver exceptions

* Use set/intersection instead of a filter

* Add explicit fast-sync tests

* Update describe-fields-sql and add comment

* Add preprocess-additional-options

* Add leading semicolon test

* Disable dataset creation and update comment

* Rename driver to `databricks`

* Use old secret names

* Fix wrongly copied hsql list

* Temporarily allow database creation

* Add *allow-database-deletion*

* Temporarily allow database creation

* Disable database creation

* cljfmt

* cljfmt
2024-09-26 16:22:20 +02:00
Chris Truter
e1d68af3aa Reorganize search namespaces to isolate legacy code (#48108) 2024-09-26 10:50:26 +00:00
Oisin Coveney
1ab2ce5948 use shim check for shimming 2024-09-26 13:08:58 +03:00
Oleksandr Yakushev
402ddc7e58 perf: Improve the performance of /api/collection/tree when there are many collections (#48026)
* perf: Faster is-trash? for collections

* perf: Faster annotate-collections and collections->tree

* perf: Optimize path generation in collection->tree
2024-09-26 12:19:26 +03:00
Oleksandr Yakushev
3ced541f50 perf: Use vectors to iterate over all user permissions (#48025) 2024-09-26 12:19:03 +03:00
Noah Moss
2173e65974 Migrate stats ping to Snowplow (#47823)
Co-authored-by: Thomas Schmidt <thomas@metabase.com>
2024-09-25 15:34:23 -04:00
Ryan Laurie
3624863eb4 invalidate channels html as well (#48120) 2024-09-25 13:28:06 -06:00
John Swanson
7e00dc3216 Require :encryption for string settings (#48067)
* Require `:encryption` for string settings

For settings that are not typed as JSON, CSV, or strings, encryption now
defaults to `:no` (*except* if you have
explicitly marked your setting as `:sensitive?` - these will default to
`:when-encryption-key-set`).

I went through all our settings and provided what I think are reasonable
values here. I tried to be conservative - when I wasn't sure whether a
stored setting was sensitive, I kept it as encrypted. For example, the
`ldap-port` setting is probably non-sensitive but theoretically someone
could be using a weird port for security-by-obscurity, so I kept that
encrypted.

* Change possible values for `:encryption`

`:maybe` was confusing: let's be more explicit that the value will be
encrypted `:when-encryption-key-set` to make it obvious what actually
turns encryption on and off.
2024-09-25 12:26:21 -07:00
Nick Fitzpatrick
35e7d3a842 Query Validator e2e updates (#48093)
* test with disabled query analysis and feature disabled in token

* types

* useSetting
2024-09-25 15:46:56 -03:00
Nemanja Glumac
635ad3a4e0 Pre fill non-sensitive user information during setup for hosted instances (#48019)
* Pre-fill cloud user info from search params

* Autofocus password field for hosted instances

* Add tests

* Parse setup user info and store it immediatelly

* Autofocus password input field for hosted instances

* Add e2e reproduction

* Fix the user info

* Fix unit test
2024-09-25 19:03:09 +02:00
Anton Kulyk
dddf499a36 Additional tooltip metrics for waterfall and scatter charts (#48088) 2024-09-25 17:50:26 +01:00
Ryan Laurie
77fc050915 Only update version info for latest tag (for now) (#48096)
* only update version info for latest tag (for now)

* add another safety check
2024-09-25 10:45:06 -06:00
Ryan Laurie
ba5b982008 Automatically tag automatic releases as nightly (#48101)
* auto tag nightly releases

* update dependencies
2024-09-25 10:44:35 -06:00
Ryan Laurie
c28f288d27 Fix release log generation 😅 (#48091)
* fix release log generation

* proper github actions type casts
2024-09-25 10:44:16 -06:00
Oisin Coveney
d5ff47ef60 feat(sdk): Filter DataPicker models for CreateQuestion (#47542) 2024-09-25 16:30:01 +00:00
Sloan Sparger
d2ca54511e [Permissions] PR Feedback for 47630 (#48116) 2024-09-25 11:23:11 -05:00
Oisin Coveney
c20874b131 Merge branch 'fix(sdk)/fix-react-17-and-resize-observer' of github.com:metabase/metabase into fix(sdk)/fix-react-17-and-resize-observer 2024-09-25 18:40:39 +03:00
Oisin Coveney
015a176b08 Just get the major release number and check that in actual places 2024-09-25 18:39:21 +03:00
Oisin Coveney
983593ef44 Update resize-observer.ts 2024-09-25 17:59:23 +03:00
Oisin Coveney
66772671c1 Update check-version.unit.spec.ts 2024-09-25 17:58:48 +03:00
github-automation-metabase
2e2e99d7a9 Add v0.50.27 to the list of releases (#48102)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-09-25 10:57:19 -04:00
Oisin Coveney
b1a7b8bc57 Merge branch 'master' into fix(sdk)/fix-react-17-and-resize-observer 2024-09-25 17:55:43 +03:00
Jeff Bruemmer
74e03ef850 docs - update notice for community drivers (#48111) 2024-09-25 10:55:41 -04:00
Sloan Sparger
0cab39b680 display warning that native query access is restricted if a table or schema is set to blocked (#47630) 2024-09-25 09:54:57 -05:00
Oisin Coveney
026adec1ea First attempt at a fix 2024-09-25 16:43:14 +03:00
lbrdnk
0857356df9 Remove CLJS_SRC_PATH_DEV from ignored watch dirs (#48063) 2024-09-25 09:50:41 +03:00
Alexander Polyankin
957f616709 Make select all/none search-aware (#48086)
* Fix cancelling of editing of a metric

* Fixes

* Fixes

* Fixes
2024-09-24 16:43:45 -04:00
Case Nelson
1e45098d6f Bump redshift driver (#47957) 2024-09-24 12:46:44 -06:00
Case Nelson
1186871dd7 feat: BigQuery Faster Sync (#48027)
* feat: BigQuery Faster Sync

Use describe-fields for much faster big-query sync.

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-09-24 12:45:53 -06:00
Ryan Laurie
f8a5a30d79 Separate Releasing from "Latest" release determination (#47868)
* Support manual release channels

s3 tag

fix check

generate matrix

generate matrix

add git tagging

channel observability

version info update

handle some edge cases

* remove testing code

* update unit tests

* support rollout percentage for  latest channel

* update rollout onlyh

* update unit tests

* address review comments
2024-09-24 11:14:00 -06:00
Alexander Polyankin
13d8dabd06 Fix cancelling of editing of a metric (#48081) 2024-09-24 16:45:10 +00:00
Romeo Van Snick
7ffdd99787 Verified metrics (#47886)
* Support skipToken in useFetchMetrics

* WIP

* Add user setting for verified metrics

* Add verified metrics to the VERIFIED_CONTENT plugin

* Use metric plugins for verified metrics

* Move helpers down

* Do not filter for verified metrics if there are none, regardless of user setting

* Add label to filter button

* Revalidate search when card gets (un-)verified

* Add e2e test for verified metrics

* Avoid checking for verified metrics on when content-verification is not enabled

* Fix broken test

* Simplify content verification plugin structure for metrics

* Add content moderation types and API helpers

* Update content moderation plugin to make use of the moderation api in metabase/api

* Fix lint

* Fix missing list tag

* Store verified metric filter preference

* Move all helpers to the bottom

* Ensure the user setting gets updated when chaning the filter

* Add comment about component similarity

* Undo changes to embedding-sdk
2024-09-24 16:44:30 +00:00
Romeo Van Snick
9d36cc1487 Reset filters in dashboard click action (#48075)
* Use default values for parameters in dashboard filters when used from click action

* Add test for setting non-specified parameters to default in dashboard accessed via click action
2024-09-24 18:23:59 +02:00
Chris Truter
5639635553 Speed up minimal Postgres fulltext search (#48053) 2024-09-24 16:49:21 +03:00
Ryan Laurie
35d4611ca9 Dashboard Settings Sidebar + Enhance Dashboard Info Sidebar (#47905)
* create dashboard settings sidebar

* update e2e tests

fix

* only show settings to dashboard editors

* update copy

* update e2e test

* fix types

* update tests for new copy

* fix import
2024-09-24 13:16:20 +00:00
Chris Truter
7f45d2d2e4 Another fix to avoid dynamic scope in search (#48052) 2024-09-24 09:25:07 +00:00
Ryan Laurie
011335a8ec Sidesheet Polish 🇵🇱 (#47935)
* size and padding fixes

* linkify and align stuff in question details

* reorganize and divide question overflow menu

* hide history for analytics content

* fix verification icon alignment

* whoopsie lets commit all the files

* fix css file name
2024-09-23 22:04:41 -06:00
Sloan Sparger
af906decec [E2E] Remove the default-ee spec (#47162)
* removes the default-ee snapshot in favor for a blockUserGroupPermissions util

* commit default-ee removal i forgot, replace default strings with undefined

* fix oopsie

* fixes failures for not removing enough permissions for tests in sandboxes.cy.spec.js

* rename var
2024-09-23 16:27:54 -05:00
lbrdnk
5b61229dc2 Downgrade gh runner image for sqlserver 2017 job (#48060) 2024-09-23 21:00:50 +00:00
Nemanja Glumac
e6f80ff0a6 Remove unused var card-or-throw (#48057) 2024-09-23 18:12:00 +02:00
Nicolò Pretto
ac1a651dd5 make expectGoodSnowplowEvent output an informative error (#48044) 2024-09-23 09:49:03 +02:00
Nicolò Pretto
3069da5d05 reduce logs in cypress tests by checking before removing folder (#48043) 2024-09-23 09:47:56 +02:00
Sloan Sparger
e66aad3481 [E2E] Improve + Fix tests that use sandboxing (#46465)
* fixes some tests where data permissions were overwriting sandboxing permissions, makes assertions in tests where sandboxing user is used but the test also passes if you were to sign in as the normal user, fixes one test that sandboxes the wrong table for the test

* do not push - wip changes

* add assertions to that network requests are provided sandboxed data, fix faulty test in dashboard-filters-source.cy.spec.js

* use helpers to clean up parts of pagination assertions

* rename assertDatasetIsSandboxed to assertDatasetReqIsSandboxed

* adds assertions on api response data

* clean up

* fix typo

* refactor helper to be easier to follow

* golfing

* pr feedback

* fix

* fix
2024-09-20 11:16:46 -05:00
Chris Truter
48aad35c79 Tweak some sheet around CSV uploads (#48000)
* Return the table id from csv upload (as a header)

* Add date format that google sheets uses

* Smuggle id

* done?

* comment

* with empty h2 db

* dashing

* fix flaky test

* Parse the correct date class

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-09-20 15:15:04 +02:00
Filip Hric
84d13d180c Add snowplow to e2e docs (#47765)
* add snowplow mention to e2e docs

* tweak new snowplow doc page to be more in line with old section

* Update docs/developers-guide/e2e-tests.md

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-09-20 12:50:40 +02:00
Ryan Laurie
1869c83f39 Admin webapp owns the ui lib now (#48030) 2024-09-19 15:04:34 -06:00
Chris Truter
775d9c941d Some polish around experiment search (#47986) 2024-09-18 18:56:15 +03:00
Uladzimir Havenchyk
7251ee1203 update jspdf (#47969) 2024-09-18 09:05:08 +00:00
Chris Truter
f7b482c6a9 Minimal search using only index (#47918) 2024-09-17 23:46:17 +00:00
Aleksandr Lesnenko
43a7ce0630 echarts viz ergonomic tweaks (#47980) 2024-09-17 21:10:21 +00:00
adam-james
23595c1255 Pivot Exports/Downloads Should Not include pivot-grouping or 'Extra' Rows (#47832)
* Pivot Exports/Downloads Should Not include pivot-grouping or 'Extra' Rows

Fixes 46561

When downloading a pivot table's data, a column 'pivot-grouping' is included as well as 'extra' rows that correspond
to various totals in the table.

This PR removes the pivot-grouping column and any of these 'extra' rows from the downloads/exports.

* fix xlsx

* Fix csv

* fix json

* add test and fix some failing tests

* fmt

* Update src/metabase/query_processor/streaming/csv.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* static viz table renders filter out pivot-grouping

* address review feedback

* add some comments to try explain the changes

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-09-17 19:26:30 +00:00
amardatar
44806ac67c Fix text alignment for dashboard text card (#47540) 2024-09-17 20:31:02 +02:00
github-automation-metabase
e4bd821058 Add v0.50.26 to the list of releases (#47970)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-09-17 11:03:32 -05:00
Alex Yarosh
ff683759ef docs: make password resetting instructions more prominent (#47958)
* make resetting instructions more prominent

* link
2024-09-17 13:00:49 -03:00
Uladzimir Havenchyk
a5c0f91c9f bypass race condition to avoid flakiness in click behaviour test (#47917)
* increase timeout to fix flakiness

* add more timeout

* timeout

* WIP

* bypass race condition
2024-09-17 15:36:34 +03:00
Case Nelson
85857aeb61 fix: snowflake compile day trunc to timestamp_ltz (#47874)
Fixes #47426

Date operations return values based on the timestamp offset rather than
the session/db timezone. Converting to `timestamp_ltz` first ensures
that we get predictable results.

In the test, it is important that database timezone matches
report_timezone so that post-processing gives proper results.
2024-09-16 16:03:49 -06:00
metamben
1174d9cc9e Fix ordering by the accumulated column (#47875) 2024-09-14 02:15:11 +03:00
metamben
d8786ffc63 Ensure :effective-type for columns from an aggregation in a card (#47936)
* Ensure :effective-type for columns from an aggregation in a card

Fixes #47184

* Synchronize effective-type with the base-type on override

When :base-type in the column metadata is overridden with the :base-type in the field ref, set it as :effective-type
too.  If :effective-type is also set in the field ref, it wins.
2024-09-14 01:15:32 +03:00
Phoomparin Mano
c7bd308b55 feat(sdk): add visual cues in sdk around evaluation usage and feature flags (#47821)
* add license problem hook

* add warning banner

* style cue component

* update cue component

* report issue to console

* report issue to console

* use sdk loader for pre-initialization

* extract print problem method

* use non-standard shadows

* add unit tests

* prevent console log spam during tests

* mock the embedding token feature

* mock the embedding token feature by default

* add more test cases

* add test case

* add test cases

* increase popover z-index

* simplify test setup

* simplify test setup

* do not load individual component when a license error happens

* move SdkLicenseProblemDisplay component out

* replace colors with color-mix

* replace colors with color-mix

* make the text unthemed to ensure legibility

* hard-code colors to prevent them from being themed

* hard-code colors to prevent them from being themed

* update border styles

* make the chevron unthemed

* unset console text color

* only set stroke on errors

* optimistic query settings

* document the sdk license condition

* remove redundant condition

* add notes on api keys always being allowed on localhost

* move the no auth method message to warning component

* rename sdk license problem to usage problem

* add eslint rule for stories

* rename sdk license problem to usage problem

* move sdk usage problem display out of the init controller

* specify fallback font if instance is down or CORS error

* add comments on conditions pending on the CORS PR

* add notes on non-localhost checks

* make test ids constant

* add test case for neither provided

* fix types

* address code reviews

* pass `embedding-sdk` flag in `token-features`

* address code review

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* remove appName from console logs

* rename embedding-sdk to embedding_sdk

* add the embedding_sdk premium token feature

* do not setup enterprise plugin in sdk test

* do not localize visual cue messages

* fix unit test in setup-sdk-auth

* rename tests

* remove unused eslint-disable

* enable embedding_sdk premium feature for sdk unit tests

* revert security_test.clj to use embedding instead of embedding-sdk

* remove unneeded test

* changes to support the style leak fixes

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-09-14 03:18:55 +07:00
Alexander Polyankin
50b88711bf Add Select all to dashboard parameters (#47897) 2024-09-13 16:17:04 -04:00
appleby
16e31051b0 Revert to non-truncating mbql.u/unique-name-generator in annotate-native-cols (#47866)
* Rollback to legacy unique-name-generator in annotate-native-cols

* Add native query long column alias test to nested queries tests

* Add native query long column alias test to dataset api tests

* Add native query long column alias test to models e2e tests

* Move limit into inner native query

* PR suggestion: simplify lambda argslist

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* PR suggestion: remove unnecessary mt/with-temp-copy-of-db

* Tweak test name

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-09-13 18:58:04 +00:00
Uladzimir Havenchyk
ea233941c2 add more e2e tests for offset feature (#47628)
* add offset e2e tests

* mark test not flaky

* add basic tests

* add more tests

* WIP

* working version

* cleanup

* oops

* improve naming

* fix test

* improve formatting

* update comment and ts

* add a test for metric

* space

* update tests and create a new issue

* add one more test

* re-enable test

* make imports consistent

* rewrite tests to put data through UI
2024-09-13 20:23:32 +03:00
Nicolò Pretto
e07e28ee1f first iteration to scope sdk styles to our components (#47764)
* first iteration to scope sdk styles to our components

* basic css reset for buttons

* clean up duplicated css

* make sdk components use instance font if no font is passed

* cleanin up and remove defaultProps not needed

* fix tests

* adds EMBEDDING_SDK_PORTAL_CONTAINER_ELEMENT_ID

* Update enterprise/frontend/src/embedding-sdk/components/public/MetabaseProvider.tsx

* Update enterprise/frontend/src/embedding-sdk/components/public/MetabaseProvider.tsx

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* fix import

* prettier --write

* we don't need theme.fontFamily, added a comment

* rename EMBEDDING_SDK_PORTAL_CONTAINER_ELEMENT_ID to EMBEDDING_SDK_PORTAL_ROOT_ELEMENT_ID

* fix unit test

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-09-13 19:16:20 +02:00
Ryan Laurie
677afd795e Dashboard Info Sidebar (#47893)
* Dashboard Info Sidebar

* e2e test updates

* add unit tests

* e2e test updates

* fix e2e tests

* fix more e2e tests

* update back behavior
2024-09-13 17:11:05 +00:00
Alex Yarosh
e11b3a7717 docs: multiline export (#47925)
* multiline export

* Update docs/installation-and-operation/serialization.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-09-13 16:02:37 +00:00
Alex Yarosh
72d0152953 docs: progress bar docs (#47792)
* progress bar

* rephrase

* better word

* streamline the article

* rename image

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-09-13 15:57:23 +00:00
Nick Fitzpatrick
3751b96761 correctly parse collection id, update path state on handleNewDashboard (#47318) 2024-09-13 09:24:17 -06:00
dpsutton
1addcc198a Controlled upgrades (#47877)
* Initial commit of controlled upgrades

- new setting upgrade-threshold (`MB_UPGRADE_THRESHOLD`)
  number 0-100
- conditionally removing latest from upgrade checks

AS OF RIGHT NOW IT ALWAYS REMOVES the latest.
Should help FE make this optional

* dumb mistake

* handle no latest version info

* implement and basic test

* More tests, refactor name

* more tests

* cljfmt does not like commas in source code.

* Just move site-uuid to the declaration and don't declare it

nothing is sacred in the settings order. no reason. i think i was just
trying to minimize the diff, which a dumb and ignoble goal.

* add context strings

* update unit tests

* use display version

* Have upgrade threshold include current major version

hopefully helps rotate people from early to late, and late to early
across major versions. Idea from sanya and quite nice!

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-09-13 09:58:35 -05:00
Aleksandr Lesnenko
24235d2b67 Fix pie rows settings include filtered out values (#47879)
* dedupe a bit

* remove pie row settings for values not from dataset

* remove unnecessary filtering

* series -> rows

* extend spec

* feedback
2024-09-13 14:32:50 +00:00
Uladzimir Havenchyk
54ffe92a6b fix broken test about resizing column by readonly user (#47916)
* fix broken test about resizing column by readonly user

* Update e2e/test/scenarios/question/saved.cy.spec.js

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-09-13 16:58:27 +03:00
Alexander Solovyov
49cfe35881 [serdes] field name is only unique in combination with parent_id (#47808)
so we need to account for that in serialization paths, storage
paths and when exporting/importing foreign keys
2024-09-13 09:32:26 +03:00
Ryan Laurie
0d70e9b002 More question details in sidebar (#47705)
* more detailed question info

small styling updates

refine styling to match designs

update more e2e test

remove some changes

small styling updates

more question details

more question details

DateTime to typescript

test updates

type updates

export fix

fixes

* Icon Updates

* consolidate styles

* test updates

* address review comments
2024-09-12 20:36:18 +00:00
Ryan Laurie
059b2ce10e Remove more metabse settings (#47510)
* remove more metabse settings

* fix missing update for latest version check

* test updates

* fix setting selectors
2024-09-12 12:38:58 -06:00
Ryan Laurie
10775a08ed cleanup data reference tooltips (#47747)
* cleanup data reference tooltips

* update test
2024-09-12 12:38:46 -06:00
Alexander Polyankin
344faf7fcf Add Select all in ListValuePicker (#47865)
* Unify FilterPickerForm

* Unify FilterPickerForm

* Add Select all in ListValuePicker

* Layout changes

* Layout changes

* Add tests

* Add tests

* Revert "Unify FilterPickerForm"

This reverts commit a7dfe8848d.

* Revert "Unify FilterPickerForm"

This reverts commit 8f002b8721.
2024-09-12 18:37:18 +00:00
Phoomparin Mano
381c321ace fix(sdk): remove the unknown premium feature console warnings (#47885)
* remove the unknown premium feature warning

* remove ee-plugins from sdk

* remove ee-overrides from sdk
2024-09-13 00:39:30 +07:00
Nicolò Pretto
b8073ded7d update prettier so we can use satisfies (#47858) 2024-09-12 18:22:06 +02:00
Romeo Van Snick
6b06a99367 Show temporal metric value on browse metrics table (#47814)
* Render values for temporal metrics

* Render data as rich

* Add tests for temporal metric

* Add TODO about isDate

* Check for errors in dataset

* Add unit test for timeseries dataset

* Add check for rows earlier

* Group tests better

* Add e2e test for metrics with no value

* Add test for metric with error
2024-09-12 18:11:56 +02:00
Chris Truter
d5af9a22f4 Basic batching for search index population (#47892) 2024-09-12 15:49:20 +00:00
Alexander Polyankin
8486a9f9c8 Allow filtering on all stages in the QB (#47818) 2024-09-12 11:03:04 -04:00
Alexander Polyankin
2c60164c8b Fix empty header in BooleanFilterPicker (#47889) 2024-09-12 14:55:18 +00:00
Chris Truter
2de9801625 Include completions of the final word in fulltext search (#47848) 2024-09-12 16:51:26 +02:00
Chris Truter
f9eab41bf2 Basic search index management (#47846) 2024-09-12 12:02:18 +00:00
Alexander Solovyov
0064a6aac7 store user_parameter_value asynchronously (#47719) 2024-09-11 17:57:13 +03:00
Jeff Bruemmer
d908592d02 remove firebolt link (#47852) 2024-09-11 10:25:31 -04:00
John Swanson
0c4a3f8a93 Fix some minor collections issues (#47472)
* Fix some minor collections issues

- explicitly provide access to the trash to all users, in the same way
we provide access to personal collections. Due to migration order, we
don't necessarily have a permissions row with the correct `perm_type`,
`perm_value`, and `collection_id` for the Trash collection. That's ok -
we don't actually move things to the Trash, so there isn't any
item where `collection_id=$trash.id` - but this may affect things like
effective ancestors for children of the trash. Let's be explicit about
the permissions that users have.

- replace a case where we manually calculated effective location and
then got the parent_id with just hydrating `:effective_parent`. This is
more efficient.

- replace the simple hydration method for `effective-location-path` with
a batched hydration method that fetches `visible-collection-ids` *once*
and then uses it to figure out the effective location path for each
collection passed.
2024-09-11 07:20:24 -07:00
Jeff Bruemmer
655b38dd2e update api docs (#47851) 2024-09-11 10:12:16 -04:00
Cam Saul
3beb7fbea2 Misc. API auto-generated documentation fixes. (#47827) 2024-09-11 09:23:14 -04:00
Raphael Krut-Landau
0833bebbac ci(admin/performance): Test several caching strategies and methods (#45231)
This PR tests that the user can assign any of three cache invalidation strategies ("duration", "adaptive", and "don't cache") to dashboards and questions. The tests check that the following things are true:
* These strategies can be applied directly (via the sidebar)
* Dashboards and questions can inherit their caching strategy from the database that underlies them
* Dashboards and questions can inherit their caching strategy from the instance-wide default policy
* When a question inside a dashboard has been assigned a strategy, this is overridden by the strategy assigned to the dashboard.

What these tests do not examine:
* the schedule strategy
* the minimum query duration
* edge-case strategies, such as very long durations or very large values for the adaptive strategy multiplier

These may be addressed in follow-up work.

Closes #45355
2024-09-11 08:57:29 -04:00
Mahatthana (Kelvin) Nomsawadi
e5ce416141 Retry the assertion until it's true (#47845) 2024-09-11 12:28:26 +00:00
Romeo Van Snick
e45836b85d Always show metrics and models in menu (#47723)
* Alway render models and metrics links

* Remove useHasMetrics and useHasModels helpers'

* Update metrics test for metrics in sidebar

* Fix unit test

* Fix e2e tests
2024-09-11 09:24:25 +02:00
Aleksandr Lesnenko
1baad2a18c fix static visualizations dashcard settings merging (#47789)
* fix static visualizations dashcard settings merging

* cleanup, fix types

* drop an empty file
2024-09-11 04:04:26 +00:00
github-automation-metabase
1b785b2d6c Add v0.50.25 to the list of releases (#47822)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-09-10 23:51:33 +00:00
metamben
e38ddceca8 Enable named aggregations in offset expressions (#47783)
Fixes #47735
2024-09-11 01:34:46 +03:00
John Swanson
15291292c4 Move stale endpoint to /ee/stale/${collection-id} (#47188)
* Move stale endpoint to /ee/stale/${collection-id}

It's an enterprise-only endpoint, so it makes sense to put the whole
thing under enterprise.

* refactors ui to use ee stale endpoint

lint fixes, change endpoint location

fix failure e2e test

* Fix endpoint location

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-09-10 14:36:12 -07:00
John Swanson
e3c94e4a1b Don't encrypt site-locale (#47731)
* Don't encrypt `site-locale`

* Fix test for `site-locale`

The previous test required encryption. Theoretically the referenced
error just depends on the fact that something is logged during the
process of getting the value, so I reworked it to depend on that
directly rather than triggering it through an encryption key rotation.
2024-09-10 12:29:24 -07:00
Alexander Polyankin
73829ade32 Remove FE hacks for empty display names for column groups (#47812) 2024-09-10 18:39:09 +00:00
Alexander Polyankin
4427ae5d6f Remove column group singularization (#47805) 2024-09-10 13:41:05 -04:00
Romeo Van Snick
6b563b2d30 Show Scalar metric value on Browse metrics page (#47685)
* Add metric actions

* Fix dot menu width

* Refetch card when it's being (un-)bookmarked

* Add tests for metric dot menu

* Make sure bookmarked metric appears in sidebar

* Make sure restoring a metric works

* Add more tests for readonly users

* Use non-root collection for metric test

* Render Scalar metric values

* Add tooltip

* Render Scalar metric value using formatValue

* Move isMetricScalar and getMetricValue to utils

* Add e2e tests for scalar metric values

* Fix unit tests

* Add card query endpoint to metabase/api

* Use card query from api instead of question loader

* Add test for non-numeric scalar metric

* Move providesCardQueryTag to utils

* Use skipToken for query

* Clean up getDatasetScalarValueForMetric
2024-09-10 18:47:38 +02:00
Chris Truter
5830d8dc94 Tidy up CSV encoding detection (#47809) 2024-09-10 17:28:05 +01:00
Chris Truter
56d2164015 Introduce Postgres-only search index (#47752) 2024-09-10 16:12:47 +00:00
Chris Truter
05ec3b33fc Basic character set handling (#47799) 2024-09-10 14:49:43 +00:00
Alexander Polyankin
a8305b6272 Extract MetricEditor component from DatasetEditor (#47774) 2024-09-10 14:24:47 +00:00
Romeo Van Snick
6685b249cd Metrics dot menu (#47391)
* Add metric actions

* Fix dot menu width

* Refetch card when it's being (un-)bookmarked

* Add tests for metric dot menu

* Make sure bookmarked metric appears in sidebar

* Make sure restoring a metric works

* Add more tests for readonly users

* Use non-root collection for metric test
2024-09-10 16:14:02 +02:00
Aleksandr Lesnenko
82b13c2530 show additional columns in the tooltip (#47700)
* show additional columns in the tooltip

* specs, tweaks

* drop stack dependency

* handle invalid columns

* change copy
2024-09-09 21:59:40 +00:00
Braden Shepherdson
6e290bc6c7 [QP] Correctly handle :lib/internal-remap columns in :result_metadata (#47587)
Fixes #45938.

Remapping is handled at the top level of the query, and should be
ignored for inner queries. This PR hides it from `results_metadata` on
source queries.

It also fixes the interaction with `large-int-id` logic to make big
integers JS-safe.
2024-09-09 19:48:46 +00:00
Oleksandr Yakushev
635f04d95f perf: Use more efficient query validation when the argument is valid (#47724) 2024-09-09 19:32:03 +00:00
Ryan Laurie
b797ea4f03 Question Info + Settings Sidesheets (#47157)
* Question Settings Sidesheet (#47699)
2024-09-09 12:24:49 -06:00
metamben
18e669c046 Convey cancelation info when the client closes the connection (#47740)
Fixes #4755
2024-09-09 20:23:55 +03:00
Anton Kulyk
41b4b6872d Toggle series visibility from chart legend (pie charts) (#47581)
* Add series visibility props to `ChartWithLegend`

* Mark pie slices as visible or hidden

* Don't let to hide the last visible slice

* Add space between legend dot and title

* Fix legend dot outer circle is clipped by overflow

* Use `ChartSettingSeriesOrder` for `pie.rows` setting

* Actually hide slices and exclude from total calc

* Don't show "0%" next to hidden slice legend items

* Hide the "Other" slice

* Make overflow slices popover interactive

* Fix hover

* Fix incorrect visibility state in legend popover

* Add e2e test

* Remove debug stuff

* Fix hover and drill issues with slice index calc

* Fix `pie.rows` ordering bug

* Revert "Fix hover and drill issues with slice index calc"

This reverts commit f104aaa584.

* Fix hover and drill issues with slice index calc (2)

`dataIndex` based approach

* Use a special data key for the "Other" slice

* Fixed viewport size in legend e2e test

* Fix jumping legend width

* Fix dot and label vertical alignment

* Rework pie e2e test

* Fix legend dot and label alignment
2024-09-09 17:37:11 +01:00
Emmad Usmani
c1b850ef61 handle errors without crashing in SliceNameWidget (#47729)
* handle errors without crashing in SliceNameWidget

* add test
2024-09-09 16:31:13 +00:00
Case Nelson
07dd373f35 fix: bigquery add null checks to result processing (#47590)
* fix: bigquery add null checks to result processing

Fixes #47339

On the related issue there are different stacktraces indicating
likely sources of null pointer exceptions.

1. `.getNextPage` is likely returning a nil value. I was unable to reproduce this but one thing I did notice is that `hasNextPage` is recommended over checking `.getNextPageToken`. Added nil handling around `page` possibly being nil.

2. `cancel-chan` may be triggered before processing begins and such `execute-bigquery` would pass nil as a TableResult to the initial reducer. Testing if cancel-chan happens at just the right moment would be too flaky for CI testing but I was able to reproduce this locally and is fixed by the nil handling added.

3. `cancel-chan` may be triggered during query processing. This is covered by a test now.

* Check hasNextPage in test:

* Add test for null getNextPage

* Fix cljfmt
2024-09-09 09:47:27 -06:00
github-automation-metabase
7e228527c9 Update Readme version references and published npm version to 0.1.36 (#47762) 2024-09-09 11:42:56 +00:00
Phoomparin Mano
4d9b144b6d fix(sdk): remove usage of legacy query in static question (#47727)
* remove legacy queries from static question in sdk

* remove second query argument

* remove the databaseSupportsPivotTables check from isSensible
2024-09-09 18:21:17 +07:00
Anton Kulyk
6cca5fb344 Recalculate "graph.metrics" and "graph.dimensions" if empty (#47692)
* Add repro

* Update `isValid` check for metrics and dimensions

* Fix unit test
2024-09-09 11:43:28 +01:00
Phoomparin Mano
4333267824 feat(sdk): add the create question component demo to the cli (#47348) 2024-09-09 16:48:24 +07:00
Romeo Van Snick
d566fae9d3 Browse metrics page (#47277)
* Add custom image for empty metrics

* Add useFetchMetrics helper

* Copy browse models page to metrics page

* Add route for browse metrics page

* Add useHasMetrics hook

* Add link to browse metrics page to the sidebar

* Simplify MetricsTable component

* Render description markdown in table too

* Add unit tests for browse metrics page

* Remove custom padding

* Fix line height of markdown cell

* Add e2e tests for browse page

* Fix metrics sorting

* Fix types

* Fix column widths and cell padding

* Typo

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Remove name check

* Simplify alphabet

* Remove resetSnowplow

* Use helper to get metric in table

* Use MouseEvent from React directly

* Use --mb-color-icon-primary

* Test ellipsification of description

* Simplify useHasMetrics

* Move useHasMetrics MainNavBar

* Merge sortMetrics and sortModels into sortCards

* Fix metric default description

* Extract SidebarSkeleton to a separate component

* Test sorting via Collection too

* Use ModelTableRow to fix cursor

* Share more components between ModelsTable and MetricsTable

* Use the same simplified structure in ModelsTable as for MetricsTable

* Render block-level elements as inline so ellipsis detection works

* Pick better testid for metric name

* Remove delay

* Avoid type specificty error in sortCards

* Add test for not opening in new tab

* Remove useFetchMetrics defaults

* Fix unit test import

* Test meta-click with cypress

* Add comment on inline markdown elements

* Use model-name test id

* Use correct colors for icon

* Remove delay from browse models page too

* Make meta key in test platform-dependent

* Fix hover color on metrics table

* Add focus styling for celss in the models and metrics table

* Use MarkdownPreview for table cells

* Define --mb-color-icon-primary

* Make the collection link take up the whole height of the cell

* Remove tabIndex from table rows

* Rename ModelsTable.module.css to BrowseTable.module.css

* Rename CardsTable to BrowseTable

* Remove single module.css class in favor of styled components

* Allow customising allowed elements

* Allow forcing all markdown on one line

* Render bold and italics in markdown descriptions and move content onto one line

* Fix legacy tooltip in test

* Make sure getValueForSorting returns a string

* Remove empty file

* Remove icon for metrics in the table

* Remove else statement.

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

* Remove async findBy where possible

* Add github issue link for TODO item

* Disambiguate between getMetricDescription type

* Be explicit with sortModelOrMetric

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-09-09 11:39:23 +02:00
Alexander Solovyov
fd6e2f11e2 [serdes] api: better error when archive looks weird (#47721) 2024-09-09 10:59:41 +03:00
Oisin Coveney
fc73743631 fix(sdk): Fix entity ID logic to use the correct status (#47748)
* Fix entity ID status

* bump ci

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
2024-09-07 04:24:44 +00:00
Oisin Coveney
836bb7d025 Split ChartType components into files (#47737) 2024-09-06 23:18:31 +00:00
Noah Moss
da106c7217 Fix admin override for public actions (#47717) 2024-09-06 17:14:05 -04:00
Ryan Laurie
ad6775b3e6 Basic Sidesheet Components (#47100)
* Basic Sidesheet Components

* sidesheet samples and storybook stories

* add unit tests and fix more imports

* small styling updates

* small styling updates

* fix tests

* Update frontend/src/metabase/common/components/Sidesheet/SidesheetCard.tsx

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* fix type problem

---------

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-09-06 14:53:20 -06:00
github-automation-metabase
df0ccc8649 Update Readme version references and published npm version to 0.1.35 (#47738) 2024-09-06 20:51:36 +00:00
Noah Moss
346e30b2cd Simplify backend Snowplow API in preparation for migrating stats ping to Snowplow (#47687) 2024-09-06 20:49:21 +00:00
Alexander Polyankin
842c2107e5 Hide temporal comparisons in the notebook editor for metrics (#47732) 2024-09-06 20:40:14 +00:00
Oisin Coveney
387db2abcd fix(sdk): Use modal instead of hacky form for saving questions (#47448) 2024-09-06 13:16:48 -07:00
Alexander Polyankin
38dcee804c Add docs url to the metric editor (#47702)
* Add metric sidebar

* Add tests

* Rename ResizableNotebook to DatasetNotebook

* Add tests

* Add tests

* Add tests

* Add tests
2024-09-06 13:49:01 -04:00
bryan
d284a70301 fix test: make sure there is a db and perm group (#47728) 2024-09-06 17:39:34 +00:00
Nicolò Pretto
2835164939 fix(sdk): default font not working (#47712)
* fix(sdk) default font on not working

* fix initial state for the sdk
2024-09-06 17:40:32 +02:00
Ryan Laurie
eb9dca9b44 Reduce frequency of release status messages (#47722)
* reduce release status messages

* fix comment
2024-09-06 08:03:19 -06:00
Alexander Solovyov
5cc1dbfe2c [serdes] option to dump full stacktraces on errors (#47676) 2024-09-06 16:25:38 +03:00
Ryan Laurie
e86ef791ef Fix Transparent disabled state on mantine switch label (#47677)
* make custom disabled state more specific than transparent style

* make it less nesty
2024-09-06 07:12:08 -06:00
Oleksandr Yakushev
45ed2c6f57 perf: Optimize some query processor functions (#47658)
* perf: [metabase.util.performance] Faster mapv for small collections

* perf: Optimize some query processor functions
2024-09-06 15:22:21 +03:00
Chris Truter
6c11dc6e2f Fix missed spots still using dynamic user vars for search (#47709)
* Fix miss

* Another spot, plus clean up
2024-09-06 12:16:58 +02:00
Mahatthana (Kelvin) Nomsawadi
e9db88131f Always allow localhost:* on CORS (#47663)
* Always allow localhost:* on CORS

* Use `embedding-app-origin-sdk` method for the headers

* Fix BE code formatting

* Fix BE formatting
2024-09-06 08:55:07 +00:00
Alexander Solovyov
b1a36a05dd clojure 1.12.0 (#47708) 2024-09-06 08:40:32 +00:00
Oisin Coveney
8ba6a7da11 Add CardDisplayType type to narrow values for charts (#47543) 2024-09-05 14:51:49 -07:00
Jeff Bruemmer
42394d2737 update api docs (#47703) 2024-09-05 16:56:19 -04:00
Alexander Polyankin
3fd01b63e6 New can-run/can-save restrictions for metrics (#47626) 2024-09-05 20:54:13 +00:00
John Swanson
87a08b9d15 Add a quick test for perms on timeline API (#47636)
We had a security issue where it was possible to query timelines without
having the requisite permissions on the collection. This test checks to
make sure this doesn't happen again.
2024-09-05 13:16:24 -07:00
Alexander Polyankin
f0ac75a392 Metrics notebook step restrictions (#47368) 2024-09-05 15:23:49 -04:00
adam-james
8a02e75ffd Catch Errors in Download process and only write error message (#47482)
* walk the error to remove any visualization settings

Thanks Dan for the patch, this approach is nice because it doesn't require changing all 3 streaming-response-writer
implementations (json csv and xlsx). It keeps behaviour basically the same, but just cleans up the output to not
include potentially sensitive column/dataset details.

* add a test that confirms json/csv errors are cleaned

* walk the error to remove any visualization settings

Thanks Dan for the patch, this approach is nice because it doesn't require changing all 3 streaming-response-writer
implementations (json csv and xlsx). It keeps behaviour basically the same, but just cleans up the output to not
include potentially sensitive column/dataset details.

* add a test that confirms json/csv errors are cleaned

* fix dataset error test

* cljfmt

* try to be a little more surgical with what we take out of the error

* formatting again, oops

* pass export format, only modify the obj for file exports

In the case of errors being saved to files, the obj is a map with a :status :failed key assoc'd by the qp somewhere
along the way. The format-exception cond branch is not used in this case, so we can't rely on modifying
`format-exception` to just dissoc ex-data.

Instead, I've kept the obj modification, but it excludes the query and the preprocessed keys, which are the only 2
keys where we see :viz-settings. This doesn't eliminate the problem of needing to exclude other keys in the future,
but it does improve the surface area - the query and viz settings are the most likely candidates for holding
potentially sensitive info.

I'd prefer to stick with this solution, as we can get a fix for the security concern in quicker, and perhaps a
non-security bug can be opened regarding the most correct way to indicate errors to users whose downloads have failed.

* keep format-exception the same

* cleaner passing of export-format to write-error!
2024-09-05 11:57:53 -07:00
Alexander Polyankin
6c87abd0fa Revert multiple inheritance with SnowflakeVariant (#47680) 2024-09-05 14:21:29 -04:00
metamben
05e02e511d Support field remapping in pivot queries (#47592)
* Support field remapping in pivot queries

* Generate breakouts without inversions
2024-09-05 20:55:48 +03:00
Oleksandr Yakushev
8eb25e5b14 perf: Miscellaneous card rendering improvements (#47679)
* perf: Optimize reading rows into vectors in JDBC driver

* perf: Use direct interop when computing with-time-zone-same-instant
2024-09-05 20:25:48 +03:00
Phoomparin Mano
d74fbe95ed fix(sdk): fix typescript type references to embedding-sdk not resolving (#47659)
* replace plain embedding-sdk imports

* fix direct module imports
2024-09-05 23:48:47 +07:00
Cam Saul
db9ca5ec1e Use :description instead of :doc/message for Malli docstrings (#47643) 2024-09-05 07:31:28 -07:00
Cam Saul
3febfbf4c1 Fix LSP for defendpoint (#47641) 2024-09-05 07:31:13 -07:00
Oleksandr Yakushev
bf67dbf911 [insights] Simplify args to simple-linear-regresion (#47665) 2024-09-05 14:28:08 +00:00
Jeff Bruemmer
2af9fff059 docs - embedding params edits (#47635) 2024-09-05 09:52:56 -04:00
Nicolò Pretto
f7a7fe7ee5 newsletter-toggle-clicked event (#47410)
* newsletter-toggle-clicked event

* use ValidateEvent,

* rename event -> simple_event and trackEvent -> trackSimpleEvent

* use the renamed trackSimpleEvent function
2024-09-05 15:06:16 +02:00
Chris Truter
efba19516b Fix query type and respect user parameters in search (#47631) 2024-09-05 13:05:49 +00:00
Ngoc Khuat
73ac543318 Dashboard subscriptions and alerts should exclude archived cards (#47650) 2024-09-05 12:55:29 +00:00
Dennis Schridde
7ff0ab3dff Revert "Hide upload config when data warehouse is attached" (#47611)
The way this was implemented, it also hid the section for management
of uploaded CSV files.  Further, admins might want to intentionally
switch from uploading to the data warehouse provided by Metabase to
one of their own.

This reverts commit fbaf58ad03.

References: https://github.com/metabase/harbormaster/issues/5121
References: https://metaboat.slack.com/archives/C032LFJFANL/p1725296255637989
2024-09-05 14:45:08 +02:00
Alexander Solovyov
5e3fd29ff4 [serdes] improve dir detection (#47653) 2024-09-05 14:58:35 +03:00
Oleksandr Yakushev
28a737bc23 perf: Add more timeseries insights optimizations (#47651)
* perf: [insights] Optimize last-2 allocations

* perf: [insights] Optimize best-fit allocations when creating validation sample

* perf: [insights] Optimize simple-linear-regression
2024-09-05 09:50:33 +00:00
Tim Macdonald
458669de81 Use i18n-appropriate string interpolation for card copying (#47652)
Come to find out languages like Turkish put the `X` first in "Copy of
`X`"
2024-09-05 08:32:29 +00:00
Cam Saul
7c25508a76 API endpoint dox generation should resolve schemas from the registry (#47634)
* API endpoint dox generation should resolve schemas from the registry #46799

* Update Kondo config

* Fix formatting
2024-09-05 09:36:01 +02:00
Romeo Van Snick
4732fbe3f4 Rename 'Date Filter' to 'All Options' in field filters (#47553)
* Rename 'Date Filter' to 'All Options' in field filters

* Fix i18n test
2024-09-05 09:26:06 +02:00
Aleksandr Lesnenko
798c81a7f4 fix hidden pivot table scroll bar in QB (#47629)
* fix hidden pivot table scroll bar in QB

* Update Loki Snapshots

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-09-04 21:52:52 -04:00
appleby
03aff86409 Store ::nil markers in CachedMetadataProvider for failed lookups (#47589)
* Fix typo in MetadataProvider docstring

* Fix typo in caching-test: s/Second/Third/

* Store ::nil markers in CachedMetadataProvider for failed lookups

Store ::nil markers in CachedMetadataProvider for any ids for which the wrapped/uncached upstream provider fails to return
metadatas. This prevents repeatedly querying the uncached-provider for ids that don't exist.

The downside is that if the uncached-provider suddenly starts returning metadata for an id that previously did not
exist, we won't pick up on it, but the assumption here is that this is no different / worse than cache invalidation
for existing ids that happen to change after we cache them.

* PR suggestion: remove unnecessary test assertion
2024-09-04 19:20:26 -06:00
Cam Saul
495106ffef Bump Kondo version to 2024.08.29 (#47418)
* Bump Kondo version to 2024.08.29

* Fix Kondo warnings from new version of Kondo

* Fix failing tests because schema was broken
2024-09-05 00:22:42 +00:00
Alex Yarosh
69d61c2c25 docs: clarify cumulative aggregations (#47545)
* cumulative aggregations

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* cumulative articles

* consolidate cumsum and cumcount articlesa

* links

* remove previews

* sort clarification

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* link

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-09-04 19:56:57 -04:00
bryan
6305e59edc Entity id translation analytics (#47432)
* tracking entity id translation

* add total and more tests

* indentation

* realign the last test
2024-09-04 22:48:19 +00:00
Case Nelson
b46a6592e7 fix: sqlserver handle uniqueidentifier uuids (#47544)
* fix: sqlserver handle uniqueidentifier uuids

Fixes #46148

Include sqlserver in `uuid-type` handling as its `uniqueidentifier` type
stores uuids.

* Don't be so precise with varchar size

* Add seam for drivers to cast to text type

* Fix arg order
2024-09-04 16:31:26 -06:00
Emmad Usmani
d74acdaa0e remove static viz import from pie chart option (#47159) 2024-09-04 18:49:23 +00:00
Nicolò Pretto
9f706d5433 rename event -> simple_event and trackEvent -> trackSimpleEvent (#47608)
* rename event -> simple_event and trackEvent -> trackSimpleEvent

* add empty line at the end of the file

Co-authored-by: Thomas Schmidt <thomas@metabase.com>

---------

Co-authored-by: Thomas Schmidt <thomas@metabase.com>
2024-09-04 19:16:02 +02:00
Uladzimir Havenchyk
7287a346ff clean output folder to avoid bloating (#47609) 2024-09-04 19:23:11 +03:00
Alexander Polyankin
f0c6f55951 Fix :selected? property of visible-columns (CLJS only) (#47618)
* Fix visible-columns :selected? flag

* Add comment

* Add comment

* Add comment

* Add comment

* Update src/metabase/lib/js.cljs

Co-authored-by: Braden Shepherdson <braden@metabase.com>

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-09-04 16:15:52 +00:00
Ryan Laurie
a25f953dc3 Pass string auto param to ee-extra (#47623) 2024-09-04 10:11:36 -06:00
Nick Fitzpatrick
e62bf9b493 Notifications Followup (#47453) 2024-09-04 09:51:28 -06:00
Aleksandr Lesnenko
c86e4b3fa3 fix time series with gaps stacked bar charts crash when enabling all labels (#47599) 2024-09-04 10:23:24 -04:00
Mahatthana (Kelvin) Nomsawadi
063023140b Update default locked parameter value (#47607)
* Add E2E tests

* Default locked parameter value to `[]`

* Fix unit tests
2024-09-04 14:35:19 +01:00
Alexander Solovyov
240f93c3fa add more stuff to migrations doc (#47605) 2024-09-04 14:06:16 +03:00
Uladzimir Havenchyk
71f208f11a upgrade webpack to address security issue (#47585) 2024-09-04 11:41:11 +03:00
github-automation-metabase
94a909059f Add v0.50.24 to the list of releases (#47591)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-09-03 19:27:03 -04:00
Alex Yarosh
0435633e70 pro callout (#47593) 2024-09-03 17:51:40 -04:00
Oisin Coveney
e99815024b fix(sdk): Add onSave behavior to QuestionEditor (#47538) 2024-09-03 14:39:47 -07:00
Oisin Coveney
f186deb2d1 Remove phantom tooltips when there is no label on tooltip (#47539) 2024-09-03 14:39:29 -07:00
Uladzimir Havenchyk
4dda4801c9 upgrade micromatch to address security issue (#47571) 2024-09-03 21:57:02 +03:00
Noah Moss
ff08864b07 Don't update updated_at when setting last_used_at on a card (#47574) 2024-09-03 18:18:31 +00:00
Alexander Polyankin
88fc1aa8f4 [FE] Allow multiple breakouts for a column (#46776) 2024-09-03 18:02:10 +00:00
Jeff Bruemmer
dd19282fe7 Update partner-and-community-drivers.md (#47577) 2024-09-03 13:29:49 -04:00
github-automation-metabase
7fee2ecfde Add v0.49.25 to the list of releases (#47572)
* Add v0.49.25 to the list of releases

* Update releases.md

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2024-09-03 16:53:35 +00:00
Braden Shepherdson
9053d6fe2b [MBQL lib] Allow temporal bucketing of Date(Time) expressions (#47427)
Fixes #47341.

### Description

The QP now supports temporal bucketing of custom expressions, but that has
not been surfaced in the UI until now.

### How to verify

Describe the steps to verify that the changes are working as expected.

1. Use a database other than H2, since it doesn't support time zones.
1. New question -> Anything with a DateTime column
1. Create a custom expression like `convertTimezone([Date Column], "America/New_York", "UTC")`
1. Break out by that expression

The temporal bucketing should work in the UI and in the query results, save properly, etc.
2024-09-03 15:27:55 +00:00
Anton Kulyk
57fe9712b3 Toggle series visibility from chart legend (cartesian charts) (#47089)
* Move current click handler to legend title

* Add `onToggleSeriesVisibility` prop to `Legend`

* Update `LegendItemDot` component

* Update `LegendItemTitle`

* Toggle series visibility

* Fix hover effect

* Don't let to hide the last visible series

* Add `visible` property to `BaseSeriesModel`

* Fix dangling split axis label when hiding a series

* Update `graph.series_order` viz setting widget

* Fix can't toggle series visibility from legend popover

* Fix legend dot clipped by `overflow: hidden`

* Fix eslint error

* Fix legend popover scroll

* Add unit tests

* Add e2e tests

* Fix show/hide series for scatter charts

* Default `LegendItemDot` to visible state

* Only apply legend dot hover effect if there's a click handler

* Don't allow to remove the last series in `ChartSettingSeriesOrder`

* Fix tooltip performance drop

* Fix e2e tests around `series_order` viz setting widget

* Use `text-medium` for outer circle background

* Update dot style

* tweak inner circle color

* Update copy

* Use div instead of button if can't toggle visibility

* Fix legend layout issue

* Don't show trendlines for hidden series

* Fix missing prop value

* Disable visibility toggle outside of dashboard/qb view

* Add public dashboard test

* Add tooltip footer e2e helpers

* Fix chart tooltip shows hidden series data

---------

Co-authored-by: Kyle Doherty <5248953+kdoh@users.noreply.github.com>
2024-09-03 16:01:10 +01:00
Dennis Schridde
57b91425d5 Fix migration ID of metabase_database.is_attached_dwh for backport (#47517)
This migration is supposed to be backported to v50 and thus needs a v50
migration ID.  Since v51.2024-08-27T00:00:00 was already applied to dev
instances, we set `preConditions[].onFail = "MARK_RAN"`, so that if the
table is already present, the backdated migration does not fail.  See
the discussion on PR #47419 for more details.

This will not need an (automatic) backport, since I will include it in
PR #47419.

Fixes: 592360c9fa
References: https://github.com/metabase/metabase/pull/47419#discussion_r1738929516
2024-09-03 15:21:14 +02:00
Ryan Laurie
7592b715b3 Refine 'last' version logic (#47512)
* refine 'last' version logic

* better comment placement
2024-09-03 07:09:03 -06:00
Alexander Solovyov
a359852b4b [serdes] reveal exception causes (#47551)
I still don't want users' eyes to bleed looking at (unnecessary?) stacktraces, but we need to be able to see exception
causes to determine what is going wrong

references #47520
2024-09-03 11:23:00 +00:00
Cal Herries
0af1d7494b Use app DB for query execution metrics (#46586) 2024-09-03 10:14:52 +03:00
metamben
8ba9687dac Implement a simple greedy approximation for dedupe-joins (#47529)
* Implement a simple greedy approximation for dedupe-joins
2024-09-02 22:34:09 +00:00
Oisin Coveney
0693980e9a Remove drilled props from ViewFooter components (#47213) 2024-09-02 11:51:20 -07:00
Oisin Coveney
c2b7cc9e80 feat(sdk): Use stable IDs in SDK components (#47210)
Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-09-02 11:10:03 -07:00
Oisin Coveney
0711fba1b0 fix(sdk): Add toggle for saving questions (#47442) 2024-09-02 17:59:06 +00:00
appleby
d7ddb63b49 Disallow duplicate order-by clauses in ::lib.schema.order-by/order-bys (#47489)
* Move query-processor.util/remove-lib-uuids to lib.schema.util

This function will soon be needed in lib.schema.util in order to implement distinct order-by clause schema checking.

This function feels like it should live in lib.util instead of lib.schema.util, but that would create the following
circular import dependency since lib.util indirectly requires stuff from lib.schema.util:

  lib.schema.util -> lib.util -> lib.schema.util

* Don't create queries with duplicate order-bys in remove_replace_test.cljc

Otherwise, theses tests would fail soon when we add update the order-by schema to reject duplicates.

* Declare lib.order-by/order-bys to return ::lib.schema.order-by/order-bys

Previously it inlined the schema instead.

* Disallow duplicate order-by clauses in ::lib.schema.order-by/order-bys

Fixes: 39384
2024-09-02 09:45:02 -06:00
Noah Moss
0aac6b9e93 Use consistent approach for disabling permission checks in QP to fix sandboxing error in downloads (#47481) 2024-09-02 14:54:22 +00:00
Noah Moss
1560728f0a Use table name in inactive table error if user has access to it (#47484) 2024-09-02 09:14:39 -04:00
Anton Kulyk
25c2269023 Followup on "Fix crash when navigating between bookmarked dashboards" (#47400)
* Add repro test for #47170

* Use type guard when checking for cancelled request

* Export `isObject` type guard

* Avoid type casting

* Update e2e test
2024-09-02 11:32:31 +00:00
github-automation-metabase
5b25578e8a Update Readme version references and published npm version to 0.1.34 (#47508) 2024-09-02 11:03:11 +00:00
Chris Truter
cbaaa08a0f Use original display name for fields in uploaded tables (#47303) 2024-09-02 10:53:42 +00:00
Chris Truter
ed9bddf0c8 Use function arguments rather than a dynamic var (#47469) 2024-09-02 11:57:18 +02:00
Phoomparin Mano
d29aa557ea feat(sdk): improve license, mock server and post-install for embedding cli (#47229)
* ask for tenancy isolation columns

* deny all permissions for all users group

* create new collections

* add jwt group mappings

* add the permissions step

* add multi-tenancy message in helper text format

* add permission graph

* wire together permissions

* use schema permissions

* use fields from table metadata from query_metadata

* add tenancy field reference

* remove log messages

* deny access to unsandboxed tables

* make permission graph more explicit

* deny access to sample database for customer groups

* add unit test for permission graph

* split permission groups and sandboxes

* jwt settings and hard-coded user attributes

* handle errors when updating sso mappings

* add express api and user switcher

* only fallback to api keys when license is invalid

* add util to sample tenancy column values

* conditional BASE_SSO_API imports

* improve embedding error message

* setup jwt configuration after license step

* setup permissions at the last step

* add missing import

* update steps that requires license

* fix incorrect imports

* add missing useContext

* handle permission update error

* remove tenancyIsolationEnabled field

* add tenancy column sampling

* differentiate tenancy column query error

* rename tenancyColumnValues to tenantIds

* assign sampled tenant ids to user attributes

* add tenant ids

* define collection permissions

* reference sandboxing group by name

* update snippet to be same as the README

* extract ask for tenancy columns to a separate step

* use the customer_id attribute

* query the table query metadata at origin

* append tables correctly

* improve error handling in table scanning

* add retry logic to metadata fetching

* only query metadata for selected fields

* fix race condition with retry

* update loading state and retries

* update comments on jwt license

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* filter the target table by id

* highlight last selected tenant column

* use breakout to get list of ids

* temporary workaround to reload the whole page

* update row value types

* update row value types

* ask if they want to setup a pro license

* post-installation improvements for cli

* block non-selected tables

* remove the source-field from sandboxing

* use the fk_target_field_id as instead of target.id

* update unit test

* add learn more message

* install mock server dependencies

* fix post-setup step formatting

* fix text wrapping

* skip tenancy columns and permissions if token is not provided

* only show the server dir step when license is enabled

* skip permission setup if there is no tenancy column

* remove source-field as we only reference our own column

* add runIf flag to skip steps

* remove the gitignore mention as this is automatic

* configure permission if there are some tenancy columns

* make native permission types more strict

* add notice about setting up local mb instance

* support multiple tenancy columns

* map the tenancy column name as the user attribute

* add component import guide

* fix deprecated punycode in node-fetch

* warn on unsampled tables

* show helper text on tenancy columns

* allow sampling repeated tenant

* add instruction to change directory into mock server

* align the learn more message

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-09-02 16:44:37 +07:00
Chris Truter
12e9f8161a Indicate which column is used in reference validator sort test (#47441) 2024-09-02 09:02:03 +00:00
Alexander Solovyov
85dea40f61 [serdes] fix grammar mistakes in the doc (#47499) 2024-09-02 11:59:53 +03:00
Tim Macdonald
3286bdce35 Upgrade Macaw to 0.2.10 (#47498)
Includes https://github.com/metabase/macaw/pull/97, which will prevent
some false positives
2024-09-02 08:49:51 +00:00
Alexander Solovyov
9d20e3c2cd [serdes] a bit more valuable ns docstring (#47445)
fixes #46039
2024-09-02 11:09:23 +03:00
Oleksandr Yakushev
19a3e637e7 perf: Optimize insights and fingerprinting of time series (#47414)
* perf: Use optimized stats functions for computing insights

* perf: Rewrite fingerprinters/with-error-handling to not generate closures

* fix: Don't reuse global-fingerprinter object
2024-08-31 12:56:36 +03:00
adam-james
6e1f3851a3 Bugfix part2 snowflake variants in attachments 46981 (#47488)
* Snowflake Variant cols should also work in attachments

A previous PR fixed the snowflake variant bug by using a try/catch aroung the global-type-settings function.
I realized there was a second codepath using the same function and it gets used in xlsx attachment code, so I've made
the change there as well to prevent the same error in attachments.

* add a test to confirm the viz-settings-for-col function doesn't throw
2024-08-31 05:57:29 +00:00
Uladzimir Havenchyk
1b2dcb7195 ci: put failing tests into e2e job summary (#47134)
* ci: put failing tests into e2e job summary

* cleanup
2024-08-30 22:28:43 +00:00
Uladzimir Havenchyk
0e514b4549 fix prepare-containers action (#47480) 2024-08-31 00:52:48 +03:00
Noah Moss
128039b1dc Disallow connection impersonation roles which are not single strings (#47474) 2024-08-30 19:16:33 +00:00
John Swanson
096b496849 Query ref validation: fix non-deterministic sort (#47449)
... and the associated flaky test!
2024-08-30 12:08:11 -07:00
Ryan Laurie
30b08dd108 Remove MetabaseSettings.docsUrl() (#47433)
* add useDocsUrl hook and update lint rule

* remove all uses of MetabaseSettings.docsUrl

* update tests

* revert non-docsurl change
2024-08-30 12:42:22 -06:00
Noah Moss
088f6d4ea5 Allow group deletion via SCIM (#47416) 2024-08-30 14:00:35 -04:00
Raphael Krut-Landau
b8cfe19736 fix(admin/performance): Don't show tooltip on default policy (#47319) 2024-08-30 13:55:48 -04:00
Jeff Bruemmer
f9354a384d docs - update API docs (#47471) 2024-08-30 17:25:34 +00:00
adam-james
0677d95bdc Snowflake Variant Type should not prevent downloads or attachments (#47434)
* Snowflake Variant Type should not prevent downloads or attachments

Fixes #46981

The :type/SnowflakeVariant key matches 2 methods in `metabase.query-processor.streaming.common/global-type-settings`.

In this case, it seems that the variant type can be any type, so we shouldn't try to guess anything here, except if
the user has provided a :semantic_type, which we can use.

Otherwise, we'll keep going without formatting details about the variant column, which is likely fine already, as it
should result in strings in the export/attachments.

* add a test
2024-08-30 09:12:42 -07:00
Case Nelson
f06643c286 fix: bigquery handle local date params as date (#47423)
Fixes #30602

We were overriding localdate in bigquery driver to produce
offsetdatetimes for no apparent reason. This causes a number of problems
when dealing with date type columns.
2024-08-30 10:09:30 -06:00
Case Nelson
0931ccec8c Bigquery verify bignumeric fingerprint and bin (#47381)
* Bigquery verify bignumeric fingerprint and bin

Fixes #28573

Field values must be scanned.

In 45.3, these fields were not being fingerprinted properly. (tag `v1.45.3`)
In a 45 point release that appears to have been fixed. (branch `release-x.45.x`)
Confirmed fixed in master, adding test

* cljfmt
2024-08-30 10:08:48 -06:00
github-automation-metabase
6bd7859201 Update Readme version references and published npm version to 0.1.33 (#47466) 2024-08-30 15:58:12 +00:00
Braden Shepherdson
bef93ce0b4 [QP, debug] Fix preprocessing diffs in Portal (#47154)
The Portal diff view wants `[before after]` pairs of the original data,
not the three-part output of `clojure.data/diff`. This fixes the
`qp.debug/debug>` output from the preprocessing middleware to emit
correct diffs.

Also, since the diffs are not useful when the query is converted between
legacy and pMBQL, this also attaches the *converted* input query to the
output query's Clojure metadata, and this converted value is used as the
basis for the diff.
2024-08-30 14:51:23 +00:00
Aleksandr Lesnenko
730a2657b4 fix trend lines scaling (#47361)
* fix trend lines scaling
2024-08-30 14:50:45 +00:00
Chris Truter
d3aba662ce Trigger BE tests when test_resources are updated (#47455) 2024-08-30 17:39:31 +03:00
metamben
0ef7e4bcfd Check joins in lib.metadata/editable? (#47421) 2024-08-30 17:01:52 +03:00
Chris Truter
550f9c36d7 Add serialization baseline for Channel (#47451) 2024-08-30 20:32:23 +07:00
Chris Truter
cf5c932f21 Update serialization fixtures to track new database field (#47446) 2024-08-30 13:21:08 +03:00
Oisin Coveney
976de66801 Remove ButtonBar (#47212) 2024-08-30 13:12:09 +03:00
Tim Macdonald
7d34ca123b Use published version of Hawk (#47440) 2024-08-30 09:31:04 +00:00
Chris Truter
312a46bd43 Add test against serialization YAML format changing (#47349) 2024-08-30 11:57:14 +03:00
Oleksandr Yakushev
1e78f8bd2d perf: Perform string->datetime conversion once during timeseries insights (#47424) 2024-08-30 10:09:22 +03:00
Ngoc Khuat
d897f2016f [notification] webhook for alert (#45201)
* [notification] New method: `channel/can-connect?` (#44955)

* [notification] Channel APIs (#45207)

* [notification] namespaced channel type (#45527)

* [Notification] Render alert for http channel (#45545)

* [notification] Add channel description (#45840)

* [notification] update API to enable http channels for alert (#45839)

* [Notification] Remove channel details for users without write perms (#46034)

* [Notification] Serdes channel (#46031)

* [Notification] Update http details schema (#45960)

* [Notification] Deactivate channels will delete PulseChannel (#46115)

* [Notification] audit log for channel create and update (#46113)

* [Notification] Disallow undefined key for http channel details (#46712)

* [Notification] Handle channel name conflicts (#46818)

* Webhooks Admin Section (#46194)

* [notification] Fix test pulse endpoint does not work properly for http channels (#46474) (#47050)

* [Notification] Fix unable to update multiple channels per type (#47111)

* [Notification] Record Task History when pulse sends channel message (#46218)

* Enabling Webhook Alerts (#47022)

* [Notification] fix cyclic deps (#47379)

* [notification] channel serdes spec (#47386)

Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
2024-08-30 04:54:01 +00:00
Aleksandr Lesnenko
0ccc471c7b fix formatting null values adds prefix and suffix (#47435) 2024-08-29 23:21:35 -04:00
bryan
05c2fb221d Realign migration ids (#47367)
* move migration in release to match master

* add column if not exists
2024-08-29 22:46:06 +00:00
bryan
b0dbb38e74 Static embed dashboard and question endpoints (#47270)
* entity id translation + tests

* add api level test

* simplify definition of eid-table->model + add test

* update tests to take keywords

* improve comment

* generate the eid-table->model map

* delete now-obsolete test

* make it work in oss

* put the resulting response into a key, so we can add more information later

* formatting

* use model names without the model/ prefix as keys

* Creates list of `api/model->db-model`

- update keys for util/entity_id request
- update shape of util/entity_id response
- add test for not-found eids

* formatting

* Respond to code review feedback

* entity-ids work on /embed/{card,dashboard}* routes

* make entity id translation work for all tokens

* Merge branch 'static-embed-dashboard-and-question-endpoints' of github.com:metabase/metabase into static-embed-dashboard-and-question-endpoints

* massage schema. add tons of tests

* decode more eids

* test alignment

* don't require ns inside of itself :think:

* make the test functions to create tokens better

* bring back `dashboard-url`

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-29 16:09:11 -06:00
github-automation-metabase
b644dcca22 Add v0.50.23 to the list of releases (#47422)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-29 17:15:21 -04:00
Nick Fitzpatrick
b7349ec5f6 Query validator FE (#47098)
* Query Validator FE

* collection path, unit tests

* wrapping feature with token flag

* updating util function, adding row type

* updating session_test.clj

* type adjustment

* fixing other table sorting

* Empty state, clean up utils

* unit test adjustment

* e2e adjustment
2024-08-29 16:20:54 -03:00
Ryan Laurie
2b25fcab13 Milestone Check Perms Fix (for real this time) 😅 (#47401)
* another attempt at perms fix

* try again

* try manual graphql auth

* try with global env

* Try setting defaults in graphql

* try some more things

* use my own graphql instance

* one more test

* remove test code

* remove rogue curly brace
2024-08-29 13:08:26 -06:00
Dennis Schridde
592360c9fa Hide attached DWH database details (#47247)
== Goal ==

Hide attached DWH database details from anyone incl. admins:
* Do not show them in the UI
* Do not permit to change them
* Do not serialize them

The aim is that customers cannot gain access to (parts of) credentials,
and they cannot break a feature they are paying for by changing
connection details.

== Implementation ==

The Metabase backend already contains provisions in the implementation
of `metabase.models.interface/to-json` for `:model/Database` to hide the
`details` of the database in HTTP responses, if the user lacks write
permission on the database.  We utilize this by adding an
`is_attached_dwh` column to the `database` table and rejecting
`metabase.models.interface/can-write?` when this flag is enabled.  In
the "admin" UI, we show a replacement text instead of the edit form when
the flag is set.  (It might be correct to show this whenever `details`
is absent.  See below for possible follow-up work.)

However, several sections of the frontend code expected the `details`
field to always be present.  In order to make `details` optional, as the
backend seems to handle it, we fix the respective code to treat this
case in the way that appears appropriate in the context.

Database details are already generally excluded from H2 dump snapshots
(see `metabase.cmd.copy/*copy-h2-database-details*`), thus nothing
changes there.

== How to test ==

=== New behaviour ===

Setting the `is_attached_dwh` field hides the database details:

1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases.
   - In addition to the fields you would normally set, also set
     `is_attached_dwh: true`.
   - This also works when adding this flag to a database that previously
     did not have this flag set.
2. Start your Metabase instance.
3. Verify the database shows up in the "admin" section
   (`/admin/databases`).
4. Verify that clicking the database to see its details only reveals
   "This database cannot be modified."
5. Verify that responses from the backend do not include a `details`
   field for this database.

=== Original behaviour ===

Behaviour without setting the `is_attached_dwh` field is unchanged:

1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases.
   - Only set the fields you would normally set.  Do not set
     `is_attached_dwh` (or set it to `false`).
2. Start your Metabase instance.
3. Verify the database shows up in the "admin" section
   (`/admin/databases`).
4. Verify that clicking the database to see its details only reveal the
   regular edit form, showing connection fields like `host`, `user`,
   etc. with the values you configured.

== How this will be rolled out ==

1. Upgrade existing Metabase Cloud instances with data warehouse to a
   Metabase version that supports `is_attached_dwh`.
2. Set `is_attached_dwh` in the database section of the config file for
   Metabase Cloud instances with a data warehouse.

== Possible follow-up work ==

In https://github.com/metabase/metabase/issues/25715, absent
`database.details` was identified as a bug.  Since then, `details` was
made `NOT NULL` in the application database, so this bug can no longer
occur.  However, today backend responses can be missing the `details`
field, if the current user lacks write permission to the database
setting (see above).  Fully re-evaluating the fix to #25715 in this
context is outside the scope of this PR.

Closes: https://github.com/metabase/harbormaster/issues/5051
2024-08-29 19:36:53 +02:00
Cam Saul
7fb88340d4 Update Kondo to 2024.08.01 and add deps.edn aliases to run from the JVM (#47370)
* Add `clojure -M:kondo` and `clojure -M:kondo:kondo/all` and bump version

* Fix Kondo errors

* Fix Kondo+LSP issues with `defendpoint`, `defenterprise`, etc.

* Use replace-deps instead of deps for speed

* Ok apparently maybe we do need to copy configs when we run Kondo on CI

* Oops `./bin/kondo.sh` should not try to use `clj-kondo`

* Remove references to GA driver folders
2024-08-29 10:24:33 -07:00
Noah Moss
f148925047 Migrate Tooltip in FormField to mantine to fix z-index issue (#47314) 2024-08-29 16:57:26 +00:00
Luiz Arakaki
bbe366ea94 Update instance_analytics for 50 major release (#47323)
This updates the instance analytics YAMLs:
- v50.22
- fixes several fk-target-field-id references
2024-08-29 16:51:06 +00:00
John Swanson
b0d9bc53c4 Fixup backported migrations (#47398)
These migrations will be backported to v49.

Three changes:

- update IDs/locations of the migrations to v49 vs v51

- add one preCondition (when adding the foreign key constraint)

- add `onFail: MARK_RAN` to the index preconditions. I forgot this
before, so it blows up when the precondition doesn't hold.
2024-08-29 09:05:58 -07:00
Ryan Laurie
268268b08d Flake Jail Update (#47407) 2024-08-29 15:58:08 +00:00
Emmad Usmani
0139fd780d allow re-ordering and re-naming pie chart slices (#46607)
* allow re-ordering and re-naming pie chart slices

* aggregate rows with same dimension value

* show warning when dimension has unaggregated values

* change colors from sidebar

* implement renaming

* styles for slice name widget

* handle numeric slice keys for binned values relative dates etc

* implement slice disabling

* remove old colors setting

* implement merging new and removing existing rows from query results

* fix formatting bugs

* port settings to static viz

* fix bug with unaggregated data

* address todos

* add loki test

* fix measure column settings widget erroring

* fix settings sidebar crashing

* add e2e tests

* update snapshots

* fix pie_chart.cy.spec.js CI-only flakes

* fix #21504 repro failure

* fix click action value

* use nestedSettings instead of seriesSettings

* fix settings sidebar crashing

* fix row with 0 key not being draggable

* fix flaky test

* filter other slices from sidebar
2024-08-29 15:57:36 +00:00
Ryan Laurie
badd7d0803 Combine filter header buttons (#46984)
* combine filter header buttons

* refined styling

* unit tests

* another import conflict

* omg another one

* remove double border for filter button

* use vars and update imports
2024-08-29 09:45:22 -06:00
Thomas Schmidt
5edd793d5b Minor schema fixes before pushing to Snowcat Cloud (#47403) 2024-08-29 17:38:10 +02:00
Thomas Schmidt
6becc1a78f Add new generic analytics event and bring types to trackSchemaEvent (#46972) 2024-08-29 15:35:53 +00:00
dpsutton
3f8317ad5b Increase log level to INFO from error (#47397)
* Increase log level to INFO from error

Closes #47396

logs before:
```
2024-08-29 08:37:03,836 INFO db.liquibase :: Checking if Database has unrun migrations...
2024-08-29 08:37:04,045 INFO db.liquibase :: Database has unrun migrations. Checking if migration lock is taken...
2024-08-29 08:37:04,047 INFO db.liquibase :: No migration lock found.
2024-08-29 08:37:04,047 INFO db.liquibase :: Migration lock acquired.
2024-08-29 08:37:04,167 INFO db.liquibase :: Running 83 migrations ...
```

logs after:

```
2024-08-29 08:39:45,019 INFO db.liquibase :: Running 83 migrations ...
...
2024-08-29 08:39:45,166 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:00::calherries ran successfully in 0ms
2024-08-29 08:39:45,182 INFO liquibase.changelog :: Columns is_defective_duplicate(boolean) added to metabase_field
2024-08-29 08:39:45,182 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:01::calherries ran successfully in 14ms
2024-08-29 08:39:45,199 INFO liquibase.changelog :: Custom SQL executed
2024-08-29 08:39:45,200 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:02::calherries ran successfully in 16ms
2024-08-29 08:39:45,202 INFO liquibase.changelog :: Foreign key fk_field_parent_ref_field_id dropped
2024-08-29 08:39:45,202 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:03::calherries ran successfully in 1ms
2024-08-29 08:39:45,204 INFO liquibase.changelog :: Foreign key constraint added to metabase_field (parent_id)
2024-08-29 08:39:45,205 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:04::calherries ran successfully in 2ms
...
```

* empty commit to bump CI
2024-08-29 11:20:19 -04:00
Ngoc Khuat
9adbbb9a57 Fix failed to backfill cache config due to number overflow (#47390)
* handle cache config overflowed

* fix root too

* do not comment out test

* make cljfmt happy

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-08-29 11:09:25 -04:00
Noah Moss
37162aa2fa Exclude inactive tables from the perms cache, and block queries over inactive tables in the QP (#47363) 2024-08-29 10:48:48 -04:00
metamben
f2ef2de94b Make metric metadata keep the metric's name (#47313)
* Make metric metadata keep the metric's name

This is a fix for the problem reported in #40355, which is fixed separately for v50 and backported to v49.

* Patch broken test

* Normalize dataset-query

* Normalize legacy queries only
2024-08-29 17:25:43 +03:00
Ryan Laurie
9fdc1f9f01 Add Malay Language Support (#47138) 2024-08-29 14:17:28 +00:00
Ryan Laurie
a8599337a4 Update milestone check workflow (#47377) 2024-08-29 07:39:19 -06:00
Nicolò Pretto
76b0a3f513 locale query string support on public links and static embeds (#47186)
* keep locale in url query params

* e2e tests

* ugly fix for the missing baseUrl error

* applies suggestion from Kelvin to make code more demure

* Update e2e/test/scenarios/sharing/public-question.cy.spec.js

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>

* remove it.skip added by mistake

* sort imports

* handle native question/ SyncedParametersList too

* shorter and more accurate comment 😅

* Update e2e/support/helpers/e2e-embedding-helpers.js

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

---------

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-08-29 15:14:41 +02:00
Alexander Solovyov
66df724997 update slack-web-api in release helper (#47385) 2024-08-29 13:20:01 +03:00
Alexander Solovyov
036513db84 update aws-java-sdk-core: brings in new jackson with fixed vulnerability (#47384) 2024-08-29 13:05:19 +03:00
Ngoc Khuat
5d4d797d44 Fix formatting on master (#47382) 2024-08-29 07:15:11 +00:00
Ngoc Khuat
1ccdce4c90 Record field usage (again) (#46704) 2024-08-29 04:20:52 +00:00
metamben
b6602d562c Support multiple bucketings of a column in nested queries (#47362)
* Support multiple bucketings of a column in nested queries

Fixes #46644

* Fix e2e test
2024-08-29 01:41:07 +03:00
Chris Truter
f49407fcbd Fix CSV uploads for non-ASCII headers (#47297) 2024-08-28 21:59:58 +00:00
Nick Fitzpatrick
0352066fe3 Adding schema name to recents, search results in CP (#47255)
* Adding schema name to recents, search results in CP

* adding unit test

* fixup tests + clarify recent item schema

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
2024-08-28 15:17:41 -03:00
Nick Fitzpatrick
5626216aea Support ctrl + click on command palette links again (#47328)
* remove prevent default on CP links

* unit flakes?
2024-08-28 15:17:24 -03:00
Noah Moss
f5eecf02e7 Populate permission cache only for one DB at a time (#47332) 2024-08-28 14:16:50 -04:00
Phoomparin Mano
41b7f329aa feat(sdk): generate sample Express.js api and user switcher components via cli (#47060)
* ask for tenancy isolation columns

* deny all permissions for all users group

* create new collections

* add jwt group mappings

* add the permissions step

* add multi-tenancy message in helper text format

* add permission graph

* wire together permissions

* use schema permissions

* use fields from table metadata from query_metadata

* add tenancy field reference

* remove log messages

* deny access to unsandboxed tables

* make permission graph more explicit

* deny access to sample database for customer groups

* add unit test for permission graph

* split permission groups and sandboxes

* jwt settings and hard-coded user attributes

* handle errors when updating sso mappings

* add express api and user switcher

* only fallback to api keys when license is invalid

* add util to sample tenancy column values

* conditional BASE_SSO_API imports

* improve embedding error message

* setup jwt configuration after license step

* setup permissions at the last step

* add missing import

* update steps that requires license

* fix incorrect imports

* add missing useContext

* handle permission update error

* remove tenancyIsolationEnabled field

* add tenancy column sampling

* differentiate tenancy column query error

* rename tenancyColumnValues to tenantIds

* assign sampled tenant ids to user attributes

* add tenant ids

* define collection permissions

* reference sandboxing group by name

* update snippet to be same as the README

* extract ask for tenancy columns to a separate step

* use the customer_id attribute

* query the table query metadata at origin

* append tables correctly

* improve error handling in table scanning

* add retry logic to metadata fetching

* only query metadata for selected fields

* fix race condition with retry

* update loading state and retries

* update comments on jwt license

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* filter the target table by id

* highlight last selected tenant column

* use breakout to get list of ids

* temporary workaround to reload the whole page

* update row value types

* update row value types

* block non-selected tables

* remove the source-field from sandboxing

* use the fk_target_field_id as instead of target.id

* update unit test

* remove source-field as we only reference our own column

* make native permission types more strict

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-29 00:05:10 +07:00
Phoomparin Mano
c574c09dd7 feat(sdk): setup permissions and sandboxing for embedding cli (#46857)
* ask for tenancy isolation columns

* deny all permissions for all users group

* create new collections

* add jwt group mappings

* add the permissions step

* add multi-tenancy message in helper text format

* add permission graph

* wire together permissions

* use schema permissions

* use fields from table metadata from query_metadata

* add tenancy field reference

* remove log messages

* deny access to unsandboxed tables

* make permission graph more explicit

* deny access to sample database for customer groups

* add unit test for permission graph

* split permission groups and sandboxes

* jwt settings and hard-coded user attributes

* handle errors when updating sso mappings

* add util to sample tenancy column values

* improve embedding error message

* setup jwt configuration after license step

* setup permissions at the last step

* handle permission update error

* add tenancy column sampling

* differentiate tenancy column query error

* rename tenancyColumnValues to tenantIds

* define collection permissions

* reference sandboxing group by name

* extract ask for tenancy columns to a separate step

* query the table query metadata at origin

* append tables correctly

* improve error handling in table scanning

* add retry logic to metadata fetching

* only query metadata for selected fields

* fix race condition with retry

* update loading state and retries

* filter the target table by id

* highlight last selected tenant column

* use breakout to get list of ids

* update row value types

* block non-selected tables

* remove the source-field from sandboxing

* use the fk_target_field_id as instead of target.id

* update unit test

* remove source-field as we only reference our own column

* make native permission types more strict

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-28 23:13:58 +07:00
Ryan Laurie
68f3d1b782 Quieter Patch Releases (#47356) 2024-08-28 10:12:47 -06:00
Anton Kulyk
48749a2eff Fix crash when navigating between bookmarked dashboards (#47311) 2024-08-28 16:00:33 +00:00
Oisin Coveney
5ec1821711 Split and convert ViewFooter elements to TS (#47126) 2024-08-28 18:45:03 +03:00
lbrdnk
bd2d8479d9 Revert "Add :legacy/merge-indents? to .cljfmt.edn (#47345)" (#47357)
This reverts commit 3759c8d46a.
2024-08-28 15:32:41 +00:00
Raphael Krut-Landau
ca29573958 fix(admin/performance): Ensure that the strategy form is not considered dirty if the user changes an empty field to that field's default value, or vice versa (#46543) 2024-08-28 10:10:03 -04:00
lbrdnk
3759c8d46a Add :legacy/merge-indents? to .cljfmt.edn (#47345) 2024-08-28 15:54:31 +02:00
Braden Shepherdson
cb222495ce [QP] Return datetimes in SQL Server, even with date-sized truncation (#47248)
Previously, truncating a `:type/DateTime` column by `:month` or `:day`
would return a `:type/Date`, which subtly broke the query.

In particular, if you try to order-by the breakout column `Created At (month)`
then it would not get de-duplicated, causing a SQL error about conflicting
ORDER BY clauses.

Fixes #46992.
2024-08-28 09:18:09 -04:00
Uladzimir Havenchyk
d50d19021e replace webpack with Rspack for the main app (#46366) 2024-08-28 12:22:28 +03:00
Alexander Polyankin
1cf14d8c83 Add isDateOrDateTime and fix isTemporal and isDateWithoutTime usages (#47250) 2024-08-27 22:30:26 -04:00
Aleksandr Lesnenko
d4e284eb85 fix stacked row tooltip shows null values (#47333) 2024-08-28 01:59:53 +00:00
Jeff Bruemmer
533711e014 docs - clarify caching doc (#47330)
* clarify caching doc

* edit
2024-08-27 21:16:09 +00:00
John Swanson
8a7cc88512 Speed up calculation of effective_ancestors (#47324)
Previously, `visible-collection-ids` was effectively "free" in that we'd
cached `collection-id->collection` for *all* collections, within a
single request, and then locally filtered it for permissions without
needing to hit the database again.

To be honest, there is probably a better fix for this - we're repeatedly
calling `visible-collection-ids` when we probably could just save a
single copy of it and use it when calculating the effective location of
every collection.

However, this is a very quick and low-risk fix, and I want to prioritize
getting this done, and then we can improve it later.

Locally, I copied down the database from stats and timed the
`/api/search?model_ancestors=true` endpoint.

Before my "speedup" PR (https://github.com/metabase/metabase/pull/46942)
it took ~7 seconds to return results.

After my "speedup" PR, it took ~15s to return results. :grimace:

With this change, it takes 818ms to return results. 🎉
2024-08-27 20:56:40 +00:00
Alexander Polyankin
e144032025 Summarize step changes for metrics (#47200) 2024-08-27 19:25:49 +00:00
appleby
52284e622b Ensure that CI checks fail if cljs tests fail (#47192)
* Fix typo in expression-clause-normalization-test

s/time-interval/relative-time-interval/

* Add missing table-id to card def to fix failing legacy-ref-test

* Ensure that if yarn test-cljs fails it fails the CI checks

When configured to autorun, the command

   shadow-cljs compile test

will exit success even if test failures occur in the node test. See

   https://github.com/thheller/shadow-cljs/issues/425

In order to ensure our CI checks fail when cljs tests fail, we need to invoke
node directly. To prevent running the tests twice, remove `:autorun true` from
the `:test` target in shadow-cljs.edn.
2024-08-27 19:15:50 +00:00
Raphael Krut-Landau
5880661213 fix(questions + admin/performance): Improve Clear cache button text and question refresh button tooltip (#46791) 2024-08-27 14:16:43 -04:00
Jeff Bruemmer
7046722c5c docs - notes on public links (#47315) 2024-08-27 17:31:00 +00:00
appleby
458084407e zoom-in-timeseries-drill: do not include :hour and :minute for DATE columns (#46997)
* zoom-in-timeseries-drill: do not include :hour and :minute for DATE columns

When the user attempts to drill through a DATE column, we should not return :hour or :minute drill throughs from
available-drill-thrus. Previously we did, which resulted in an error being displayed when the user attempted to select
them.

Modify next-breakout-unit in zoom_in_timeseries.cljc to not return :hour or :minute units for :type/Date columns,
which prevents these from being returned by available-drill-thrus, which prevents them appearing in UI context menus.

* Use lib.temporal-bucket/available-temporal-buckets

Per review feedback, use lib.temporal-bucket/available-temporal-buckets to get the valid-current-units in
metabase.lib.drill-thru.zoom-in-timeseries.

* Do not construct zipmap just to lookup the next unit

Rather than constructing a zipmap from `valid-current-units', which requires iterating over the seq twice, just
traverse the seq once and return the next item in the seq (if any).

Constructing a zipmap made sense in the old code because it was constructed once from static data and used many times
for lookup. In the new version, the vec of `valid-current-units` is dynamic and dependent on the type of the breakout.

* PR suggestion: use threading macro rather than nested sexps

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* PR suggestion: use threading macro rather than transducer / eduction

* PR suggestion: reduce boilerplate in zoom-in-timeseries tests

Reduce code dup by looping over aggregation and bucketing options rather than having a separate deftest for each.

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
Fixes #39366
2024-08-27 17:27:47 +00:00
Nicolò Pretto
e441f1d58c poc of using loki to test png/pdf exports (#45650)
* use loki to test png exports on questions

* try to put the img in the body to see if it fixes the scrollbar issues in ci

* fix linting issues

* let's try again in ci

* Attempt to make CI wait before taking a snapshot for downloaded PNGs

* Use the snapshots from CI for PNG downloads

* pdf export test thanks to kelvin suggestion about just testing the png

* refactored the code to extract a util function

* remove pdf tests as they broke in ci 🤷

* Update frontend/src/metabase/env.ts

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* Update frontend/src/metabase/lib/loki-utils.ts

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-08-27 18:09:52 +02:00
John Swanson
f749c695a4 oops: enable relevant feature before a test (#40973) 2024-08-27 08:55:57 -07:00
Tim Macdonald
e9a28c250f Disable query analysis queueing for query changes in prod (#47231)
Analyze queries synchronously on save
2024-08-27 14:38:53 +00:00
Chris Truter
c5912a5286 Delete old serialization extension points and fallbacks (WIP) (#47273) 2024-08-27 14:00:22 +00:00
Luis Paolini
9fe5a85e91 Bump MS SQL Driver to 12.8.1 (#47264)
Lotsa fixes for this
2024-08-27 10:47:27 -03:00
bryan
339ff2433d Entity id translation service (#47094)
* entity id translation + tests

* add api level test

* simplify definition of eid-table->model + add test

* update tests to take keywords

* improve comment

* generate the eid-table->model map

* delete now-obsolete test

* make it work in oss

* put the resulting response into a key, so we can add more information later

* formatting

* use model names without the model/ prefix as keys

* Creates list of `api/model->db-model`

- update keys for util/entity_id request
- update shape of util/entity_id response
- add test for not-found eids

* formatting

* Respond to code review feedback

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-27 13:45:42 +00:00
github-automation-metabase
6e191b74e3 Add v0.49.24 to the list of releases (#47300) 2024-08-27 09:30:44 -04:00
github-automation-metabase
3a60853f38 Add v0.50.22 to the list of releases (#47275)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-27 09:17:17 -04:00
Ngoc Khuat
73e9a8a3b9 Fix flaky test update-db-to-never-scan-values-on-demand-test (#47295) 2024-08-27 12:16:05 +00:00
Chris Truter
2ba5c4d93e Stop serializing LegacyMetric (#47268) 2024-08-27 11:11:09 +00:00
Uladzimir Havenchyk
de7ff21dfd add uladzimirdev to querying team (#47298) 2024-08-27 11:05:05 +00:00
Chris Truter
ebf18f35b2 Use Serialization spec for Collection (#47240) 2024-08-27 11:05:57 +02:00
Chris Truter
b7cac603ae More logging around serialization error (#47278) 2024-08-27 08:52:44 +00:00
Kamil Mielnik
ccd3b577fb Refactor e2e helpers and commands to TypeScript function helpers (#47237)
* Convert e2e-custom-column-helpers to TS

* Refactor createTimeline, createTimelineEvent & createTimelineWithEvents to TS

* Fix circular imports
2024-08-27 08:36:11 +00:00
appleby
c73c198a7b Remove failing assertion in CLJS diagnose-expression-test (#47271)
Failing after changes in 13983247ee

Per slack conversation, ok to disable:

https://metaboat.slack.com/archives/C013N8XL286/p1724711461313089?thread_ts=1724414568.662469&cid=C013N8XL286
2024-08-27 00:37:18 +00:00
Chris Truter
f984a3e039 Track query analysis failures (#47216) 2024-08-26 23:35:01 +00:00
John Swanson
da2a0a1b7c Don't encrypt boolean settings (by default) (#47179)
* Don't encrypt boolean settings (by default)

We have tooling to disable encryption on settings even when the
`MB_ENCRYPTION_SECRET_KEY` is set. Turn it on by default for all boolean
settings, which don't need to be encrypted.

I also optimized the code that decrypts settings on startup because I
didn't want to delay startup if someone had set a bunch of boolean
settings. With 20 set, the old version added about 200+ ms to startup,
about 10ms per boolean setting, whether or not it was encrypted or in
the DB already. The optimized version selects all the never-encrypt
values from the database at once (a bit silly, but we also just exclude
raw `true` and `false` values so we don't bother checking them) and
updates them if they're encrypted - this adds ~40ms to startup with 20
encrypted boolean settings (about 2ms per boolean setting) and ~5ms to
startup on subsequent runs, when no encrypted values are in the DB.
2024-08-26 22:48:04 +00:00
Braden Shepherdson
13983247ee [MBQL lib] Disable expression type checking entirely (#47245)
This testing is too strict to support some legitimate use cases that
have no workaround at present. We can bring back this type-checking
eventually, once it's possible to correctly express things like
automatic coercion of strings to numbers in `SUM` aggregations.

Fixes #44431.
2024-08-26 17:44:18 -04:00
Uladzimir Havenchyk
f28ea99c64 fix import order in the files with disabled rules (#47217)
* fix import order in the files with disabled rules

* remove hack

* minor
2024-08-26 23:36:56 +03:00
Jeff Bruemmer
42caad57a3 docs - locale for static and public links (#47194) 2024-08-26 16:34:33 -04:00
Alex Yarosh
e8904acf4b docs: serialization clarification (#45480)
* serialization clarification

* Update docs/installation-and-operation/serialization.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Update docs/installation-and-operation/serialization.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Update docs/installation-and-operation/serialization.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Update docs/installation-and-operation/serialization.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-26 16:23:23 -04:00
Paul Leclercq
db21f7ed40 Docs: migrate down using docker compose command (#39497)
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-08-26 12:54:35 -07:00
Daksh Shah
aceaac27c8 Update upgrade instructions for Azure (#38638) 2024-08-26 12:52:39 -07:00
Bruno Ferreira
151334aac1 Adds missing glue:GetCatalogImportStatus (#41388)
Seems that `glue:GetCatalogImportStatus` is also needed for the integration with Amazon Athena because there's multiple AccessDenied on cloudtrail if this permission is missing:
```
{
    "eventVersion": "1.09",
    "userIdentity": {
        "type": "IAMUser",
        "principalId": "***********************",
        "arn": "arn:aws:iam::*************:user/metabase",
        "accountId": "**********************",
        "accessKeyId": "*******************",
        "userName": "metabase"
    },
    "eventTime": "2024-04-11T08:29:00Z",
    "eventSource": "glue.amazonaws.com",
    "eventName": "GetCatalogImportStatus",
    "awsRegion": "eu-west-1",
    "sourceIPAddress": "***********",
    "userAgent": "DriverVersion/02.00.35.1001/JDBCVersion/4.2/PluginName/IAM, aws-sdk-java/1.12.339 Linux/5.10.213-201.855.amzn2.x86_64 OpenJDK_64-Bit_Server_VM/11.0.22+7 java/11.0.22 clojure/1.11.1 vendor/Eclipse_Adoptium cfg/retry-mode/legacy",
    "errorCode": "AccessDenied",
    "errorMessage": "An unknown error occurred",
    "requestParameters": null,
    "responseElements": null,
    "requestID": "*************************************",
    "eventID": "*************************************",
    "readOnly": true,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "*************************************",
    "eventCategory": "Management",
    "tlsDetails": {
        "tlsVersion": "TLSv1.3",
        "cipherSuite": "TLS_AES_128_GCM_SHA256",
        "clientProvidedHostHeader": "glue.eu-west-1.amazonaws.com"
    }
}
```
2024-08-26 12:52:18 -07:00
Tony-metabase
565f70c7e7 Update appearance.md (#36538)
* Update appearance.md

Adding information about how colors are selected by Metabase because there is the confusion that the order in which you select colors is the order you get on the chart

* Update appearance.md

Removed code reference and tried to simplify the context

* Update docs/configuring-metabase/appearance.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-26 12:50:56 -07:00
İbrahim Gurses
7a5133398c Add Peaka community driver link to documentation (#44152)
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-08-26 12:48:30 -07:00
Raphael Krut-Landau
45d8be7ef1 fix(dashboard): In dashboard value source modal, after closing question picker modal, don't also close the first modal (#47242) 2024-08-26 15:33:33 -04:00
John Swanson
af6d6e7fe4 Much better collection permission performance (#46942)
There are a few separate changes here:

- Migrations: add and populate indexed columns perm_value, perm_type, and collection_id to permissions

These fields allows us to efficiently run queries based on collection permissions in the DB without string manipulation. Keeping the table as permissions allows us to do this migration in-place. Note that in some cases collections may have been deleted from the database without deleting the associated permissions row (since there was no foreign key before). We need to be defensive here: if we have a permissions row without a corresponding collection, delete the row before running the rest of the migration.

- Write perm_value, perm_type, and collection_id for new collection permissions

A very simple before-insert method sets these fields before a collection permission is written to the DB.

- Replace collection/permissions-set->visible-collection-ids and collection/visible-collection-ids->honeysql-filter-clause with collection/honeysql-filter-clause

Previously, just about everywhere we used permissions-set->visible-collection-ids, what we were essentially doing was an in-app join: select all the collection IDs you have permission on, then convert it to a SQL clause like WHERE collection_id IN ( all of those collection IDs).

Replace both of these with honeysql-filter-clause, which uses the new fields we added to permissions above to construct a honeysql filter representing "all the collections I have permissions on", without needing to round-trip them to the application and back to the DB.

Of course, we can then write a function visible-collection-ids, which uses honeysql-filter-clause, for those cases where we do actually need the whole bunch in the application (we use this, for example, when constructing the effective-location for a collection).

I also added one more toggle to the VisibilityConfig that's passed into the honeysql-filter-clause (and used to be passed to permissions-set->visible-collection-ids), allowing you to select only the effective children of some collection.
2024-08-26 12:06:29 -07:00
metamben
8b1f884059 Support dashboard filters targeting multiple stages in QP (#46935)
* [MBQL lib] Map dashboard filters to last stage w/aggregations

Originally we used the last stage's columns for dashboard filters, but
then if you eg. use a custom expression to clean up the results of the
aggregation, then you can't filter at the most useful spot - before the
aggregations.

Fixes #19744. Related to #26244, #33958.

* Add stage-number option to the dimension not to the field

* Remove FE changes

* Support negative stage numbers

* Add tests for multi-stage parameter expansion

* Specify schema for dimension options

* Fix legacy MBQL schema

* Append stage when running cards with top level summary

* Fix schema

* Only ensure filter stage when the parameters say it's used

* Implement ensure-filter-stage

* Format clj

* Add ensure-filter-stage test

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-08-26 20:16:00 +03:00
Raphael Krut-Landau
118e713d82 Fix error message in Create API Key modal (#47161) 2024-08-26 12:15:19 -04:00
Alexander Solovyov
879195def7 [serdes] query action depends on stuff in its dataset_query (#47220) 2024-08-26 17:59:39 +02:00
Noah Moss
0dd4013dc0 Use more precise query contexts when recording execution of public downloads (#47201) 2024-08-26 11:27:05 -04:00
John Swanson
1926bf93cb Re-add creator to query validation API (#47183) 2024-08-26 07:50:28 -07:00
Alexander Polyankin
84e5008bc8 Remove unneeded index.ts files in querying (#47190) 2024-08-26 14:13:52 +00:00
lbrdnk
b75577b529 Fix DateTimeRange substitution for open ranges (#47175)
* Fix DateTimeRange substitution for open ranges

* Add E2E repro for #47172

* cljfmt

* Add test for datetime column

* Update range boundary for open range

* Update test names

* Apply suggestions from code review

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Fix e2e

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-08-26 14:51:45 +02:00
lbrdnk
ed509b5306 Add database type adjustments to server side generated temporal values (#47039)
* Add database type adjustments to server side generated temporal values

* Speculative base type change

* Infer timezone only from _actual_ user, not global user level

* Set timezone for actual user in test extensions

* Add test case

* Update type info generation

* Adjust server side relative datetime

* Update src/metabase/driver/sql/query_processor.clj

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Fix base type logic

* Fix typo

* Fix formatting

* Update user name handling

* cljfmt

* Address review comments

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-08-26 12:36:15 +02:00
Chris Truter
61ca125c7e Add logging catch around query analysis worker (#47206) 2024-08-26 10:25:16 +00:00
github-automation-metabase
2bb3eedecb Update Readme version references and published npm version to 0.1.32 (#47174)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-08-26 07:23:57 +00:00
Alexander Solovyov
9b614cabda [serdes] a few improvements, instance_analytics cleanup script (#47136) 2024-08-24 05:04:00 +00:00
Cam Saul
d2034416e0 Fix mu/fn and mu/defn support for map schemas on key-value args (#47153)
* Fix #46846

* Don't use `-v` to check if script has arg since it doesn't work on all bash versions

* Fix typo
2024-08-23 17:25:23 -06:00
Aleksandr Lesnenko
b30af986d3 fix echarts tooltip positioning (#47202) 2024-08-23 22:27:00 +00:00
Case Nelson
25d30ca9aa feat: BigQuery nested fields (#47106)
* feat: BigQuery nested fields

Updates dataset definitions to allow `nested-fields`

Adds the `::sql.qp/nfc-path` to include nfc-path in the field
identifier.

* Add bigquery to nested-fields feature. Rework geographical-tips to allow adding to bigquery

* Parse RECORD type into maps

* Fix tests

* Fix tests

* Fix formatting

* Handle arrays of records

* Fix formatting

* Conditionally add nested-fields

* Fix test

* Update docs/developers-guide/driver-changelog.md

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Update docs/developers-guide/driver-changelog.md

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

* Update modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-08-23 22:05:17 +00:00
metamben
001b8890d7 Strip expression metadata for field expression (#47155)
* Strip expression metadata for field expression

Fixes #44940.
2024-08-23 21:30:29 +00:00
Sloan Sparger
83fea34fb8 [Permissions] Data permissions graph utils reorganization (#47023)
* reorganizes data-permissions.ts to be a folder split by a file per concern, moves some logic out into other utils files where it makes sense

* pr feedback and fix lints
2024-08-23 14:07:13 -05:00
Raphael Krut-Landau
af24dd9110 feat(admin/performance): In Admin / Performance, add a tab where you can manage the caching policies of dashboards and questions (#42990)
Closes #42567
2024-08-23 14:57:54 -04:00
Alexander Polyankin
17bff867ce Fix issues with column matching for multiple breakouts of the same column (#46979)
* Fix binning matching

* Add tests

* Add tests

* Add tests

* typo

* Update src/metabase/lib/equality.cljc

Co-authored-by: Braden Shepherdson <braden@metabase.com>

* Fix alignment

* Fix alignment

* Update src/metabase/lib/js.cljs

Co-authored-by: Braden Shepherdson <braden@metabase.com>

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-08-23 17:21:46 +00:00
Nick Fitzpatrick
839717c961 Fix padding prop on Mantine Modals (#46900)
* move default modal padding to general modal component

* small adjustments. Using base modal where apropriate

* shame
2024-08-23 11:57:52 -03:00
Raphael Krut-Landau
da829723b9 fix(browse): Remove some dead code (#46861) 2024-08-23 10:25:11 -04:00
Chris Truter
0d50f7b1e6 Lower logging level for query analysis (#47178) 2024-08-23 14:00:50 +00:00
Alexander Polyankin
7e879221af Add subfolders in metabase/querying (#47160)
* Add subfolders in querying

* Add subfolders in querying

* Add subfolders in querying

* Remove FilterContent

* Remove FilterContent

* Remove FilterContent

* Remove FilterContent

* Remove FilterContent
2024-08-23 09:39:47 -04:00
Ngoc Khuat
42dc5239db [serialization] extract subtree should hydrate entities (#47171) 2024-08-23 12:59:02 +00:00
Jeff Bruemmer
e9c4972229 update env vars (#47072) 2024-08-23 12:49:11 +00:00
Mahatthana (Kelvin) Nomsawadi
d6a938f131 Update UTM tags in static embed modal links (#47116)
* Update interactive embedding CTA UTM tags

* Make the UTM tags more readable

* Update static embed doc UTM tags

* Update static embed appearance customization doc UTM tags

* Update font upsell UTM tags

* Update tests

* Fix wrong upgrade URL

* Update tests
2024-08-23 13:31:26 +01:00
Phoomparin Mano
852ddc274a fix(sdk): apply the default viz height only in visualization view (#47169)
* only use viz height for visualization view

* move the default viz height fallback

* default to full-height if height is zero or unavailable

* remove test wrapper
2024-08-23 18:56:35 +07:00
Oleksandr Yakushev
743ae09aca perf: [insights] Use direct conversions in ->millis-from-epoch to avoid clojure.java-time overhead (#47145) 2024-08-23 09:53:08 +03:00
Oleksandr Yakushev
4935863049 perf: [date-2.parse] Add a fastpath for timestamps that are likely ISO instants (#47143) 2024-08-23 05:55:31 +00:00
Jeff Bruemmer
65b3ef01d4 docs - api docs update (#46373) 2024-08-22 19:07:33 -04:00
Nick Fitzpatrick
e10bf5f950 extending table component features (#47030)
* extending table component features

* adding unit tests

* PR Feedback

* PR Feedback

* unit test adjustment
2024-08-22 15:31:43 -03:00
Noah Moss
3685eb4b2a Properly detect when Snowflake is using a local key file when expanding connection properties (#46348) 2024-08-22 14:08:21 -04:00
bryan
6eecf77e7d recents updates to better support metrics (#47032)
* recents updates to better support metrics

allows updating metric views through the API
improves parent_collection calculation

* add 2 tests for metrics
2024-08-22 17:48:02 +00:00
Cam Saul
31f209f33e Cljfmt config part 4 (#47047) 2024-08-22 16:24:16 +00:00
Aleksandr Lesnenko
418a20fd70 fix pivot table overflow (#47102)
* fix pivot tables overflow & edit styles

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-22 15:55:47 +00:00
Romeo Van Snick
8dd2eeefff Simplify finding metrics in Summarize (#46887)
* Use global search for aggregation picker

* Add names to aggregation picker items so they can be searched

* Render info icon metric descriptions

* Add unit tests for global aggregation picker search

* Add test for searching metrics

* Add a test for metrics descriptions

* Sort metrics

* Fix e2e test

* Use Flex from metabase/ui

* Handle markdown in metric description

* Add test for sorted metrics

* Update Markdown styling in metric description

* Fix clojure formatting

* Test for markdown in the Metric description

* Fix lint

* Fix test for markdown

* Use simpler equality test

* Fix overflow in test
2024-08-22 16:35:03 +02:00
John Swanson
5c0800aca4 Don't allow viewing a timeline without coll perms (#46863)
If we don't have access to the collection, we shouldn't have access to
the timelines.
2024-08-22 06:38:04 -07:00
Alexander Solovyov
35d73f950f [serdes] extract result_metadata.fk_target_field_id (#47122) 2024-08-22 16:24:24 +03:00
Chris Truter
5944b20bfb Bump macaw to 0.2.6 (#47119) 2024-08-22 13:05:48 +00:00
Alexander Solovyov
372fd8d9b3 [serdes] keep nulls in export when there are nulls in the db (#47121)
this retains previous behavior
2024-08-22 13:05:30 +00:00
Ngoc Khuat
22a80f2cb2 Fix n+1 when getting field values for dashboard (#47113) 2024-08-22 12:49:54 +00:00
Uladzimir Havenchyk
88ac0ed7c1 handle warnings from reselect about broken selectors rules (#47076)
* handle reselect warnings about wrong usage of selectors

* return stable references

* add a comment

* address excellent review
2024-08-22 11:22:41 +00:00
Chris Truter
0030c91580 Add support for pipe separator in CSVs (#47114) 2024-08-22 11:09:01 +00:00
Mahatthana (Kelvin) Nomsawadi
b3c72d9cec Fix iframe resizer not working (#47115) 2024-08-22 11:49:02 +01:00
Kamil Mielnik
6a5faa8bac Fix SchemaItem type (#47068) 2024-08-22 07:21:22 +00:00
bryan
00ff56e8ee Ensure blocked tables downgrade into blocked dbs (#47093)
* tests ensure blocked tables downgrade > blocked db

* implement the blocked table -> blocked db rollback

- move/add tests for it
2024-08-21 19:22:38 -06:00
adam-james
8bed390b6e Add missing day in :minute timestamp formatter (#47104) 2024-08-21 22:48:05 +00:00
Nemanja Glumac
a4e55cf4c9 Repro #42773: "-modified" suffix briefly shown in a model's name input during creation (#47103) 2024-08-21 21:52:10 +00:00
Noah Moss
c985f362fc Make sure we insert special segmented permission paths for sandboxed tables on downgrade to 49 (#47085) 2024-08-21 17:43:38 -04:00
Vamsi Peri
1fe4c5c176 removing cal (#47096) 2024-08-21 22:25:10 +02:00
Roman Abdulmanov
74e9d6971f Add notification about closed Epics (#47099) 2024-08-21 22:24:09 +02:00
Cam Saul
80813cb5de Cljfmt config part 3 (#47046)
* Cljfmt config part 2

* Part 3 WIP

* Part 3 WIP

* Part 3 WIP

* Part 3 WIP

* Part 3 WIP

* Use fork with https://github.com/weavejester/cljfmt/pull/348 and https://github.com/weavejester/cljfmt/pull/350

* Backport updated config and linter fork from part 3

* Update formatting

* Reformat

* Fix bad indentation from #47064
2024-08-21 19:27:08 +00:00
Ryan Laurie
3964d71e02 Create Question and Dashboard Sharing Menu (#46593)
* QuestionAlertWidget to FC + TS

* update e2e tests

* use regular alert for unsubscribes

* Create Question and Dashboard Sharing Menu

* Handle some edge cases

* top notch unit tests

* more testing and tweaking

* fix imports

* more tests

* add alerts to question sharing menu

* add tests for alerts

* update e2e tests

* use Oisin's toolbarbutton

* fix rebase

* prompt to save before sharing questions

* show prompt to set up notification channels

* fix import

* update tests and hide on notebook screen

* fixes

* clean up pulse types

* update e2e tests

* fix a bunch more tests

* more e2e test fixes

* maybe green now? 🤞

* last one 🥺

* design updates

* make channel setup modal nicer

* simpler component props

* lint fix

* lint fixes
2024-08-21 19:08:54 +00:00
metamben
cb12f351b6 Prevent metrics from being returned for inaccessible collections (#46994) 2024-08-21 21:45:52 +03:00
Mahatthana (Kelvin) Nomsawadi
ccec5ce938 Fix docker-compose not available on Mac (#47054) 2024-08-21 19:06:34 +01:00
Alex Yarosh
b7a867ab49 docs: Update MongoDB Atlas connection instructions (#47088)
* mongodb connection

* mongodb connection info

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-21 17:39:35 +00:00
Cam Saul
457392bd3b Cljfmt config part 2 (#47035)
* Cljfmt config part 2

* Backport updated config and linter fork from part 3

* Update formatting
2024-08-21 17:29:41 +00:00
Oisin Coveney
0a6d0a1928 feat(sdk): Edit Question (#46894) 2024-08-21 18:15:53 +03:00
Chris Truter
9e08c3e949 Improve Query Analysis sweeper scheduling (#47064) 2024-08-21 15:15:19 +00:00
Jeff Bruemmer
0ec737a7c6 docs - blocked at table level (#46937)
* blocked at table level

* edits

* note on sql questions
2024-08-21 11:12:31 -04:00
Uladzimir Havenchyk
ae0359f7f8 dx: forbid imports from storybook testing-library outside stories (#47056) 2024-08-21 17:55:31 +03:00
github-automation-metabase
47b8b4cbbf Add v0.50.21 to the list of releases (#47073)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-21 10:53:00 -04:00
Oisin Coveney
6d52d18be5 fix(#46893) - Sharing popover in query builder view should be next to button (#47065) 2024-08-21 17:36:12 +03:00
Luis Paolini
d275c0bb53 Bump presto driver to v288 (#47071) 2024-08-21 11:28:50 -03:00
Nicolò Pretto
270db4c6e3 bump onboarding version to 1.3.0 (#47055) 2024-08-21 16:23:17 +02:00
Alexander Polyankin
9108dd750c Rearrange buttons in the dashboard editing panel (#46809) 2024-08-21 09:31:39 -04:00
Chris Truter
468bed10cc Strip model cache tables from query analysis (#47063) 2024-08-21 12:17:50 +00:00
Roman Abdulmanov
a6116b85b4 Add notification about closed Epics (#47062) 2024-08-21 12:38:33 +01:00
Nicolò Pretto
8132d87efa skip analytics opt out step for people on cloud (#46965)
* poc of removing data usage step for the tech plan

* pretend it's not cloud if hasAddedPaidPlanInPreviousStep is true

* split the jest tests files to simulate pro cloud, pro selfhosted and starter cloud scenarios
2024-08-21 12:57:42 +02:00
Phoomparin Mano
4453abb13a feat(sdk): embedding cli opens the metabase store to get trial token and applies the license (#46810)
* open metabase store to get trial token

* remove license env from instance setup as we provide the license key later

* activate metabase license

* fix password field missing

* fix formatting for generated component files message

* activate license key

* add missing auth options for postgres

* add function to print with padding

* prevent infinite loop and update section representation

* show the activate license error in red

* rename variable
2024-08-21 17:36:53 +07:00
Chris Truter
1b9a267551 Bump Macaw to 0.2.3 and improve logging (#47031) 2024-08-21 10:20:19 +00:00
Nemanja Glumac
75629e969e Include collection path in the app bar for metrics (#47051) 2024-08-21 11:23:06 +02:00
Romeo Van Snick
63c074d2a2 Allow editing the breakout bin from the compare aggregation picker and provide presets (#46844)
* Add offset presets

* Render OffsetPresets initially

* Add BucketInput

* Render BucketInput and do not rely on referential equality for Lib.Bucket

* Make sure the currently selected bucket shows in the presets

* Lift label into CompareAggregations

* Fix spacing of label

* Fix labels based on comparison type

* Use Switch for include current period

* Include current bucket in CurrentPeriodInput label

* Fix unit tests

* Add more unit tests for CompareAggregations

* Update e2e test for column compare to handle presets

* Group offset tests

* Add tests for moving average

* Add tests to verify changing the bucket works

* Fix type

* Make sure temporal columns are buckatable before picking them

* Make getPreferredPresets more clear

* Add test for temporal expression column

* Fix lint
2024-08-21 11:11:42 +02:00
Alexander Solovyov
62fdd015f9 [serdes] move Action to using spec (#46973) 2024-08-21 11:33:33 +03:00
Mahatthana (Kelvin) Nomsawadi
f07084aa80 Improve text contrast in object detail in static embed (#46968)
* Theme object detail texts

* Add loki tests
2024-08-21 09:24:43 +01:00
Nicolò Pretto
d3777b3ed8 fix padding on setup completed step when on cloud (#47021) 2024-08-21 09:41:06 +02:00
Alexander Solovyov
c5e85d17b1 [serdes] move most of the models over to using spec (#46966) 2024-08-21 09:49:38 +03:00
Aleksandr Lesnenko
b259818634 hide echarts tooltip on scroll (#46996)
* hide echarts tooltip on scroll

* lint
2024-08-21 03:59:45 +00:00
Aleksandr Lesnenko
b8a88121c0 fix echarts tooltip issues (#46946)
* fix echarts tooltip issues

* fix types

* use another merge-ref package
2024-08-20 22:30:24 -04:00
Alex Yarosh
cba3922ddf clean up Azure AD references (#47041) 2024-08-20 19:05:15 -04:00
Alex Yarosh
1a7fec770c docs: bring back code highlighting (#47029)
* highlight 1

* highlight 2
2024-08-20 16:02:22 -04:00
Uladzimir Havenchyk
16291a0f99 fix: upgrade elliptic to resolve security issues (#47014) 2024-08-20 22:31:13 +03:00
Nemanja Glumac
ed8de16f26 refactor: Simplify question data source (#46989)
* Split utils from `QuestionDataSource`

* Do the computation inside the component

* Compute query only once

* Fix imports order
2024-08-20 21:22:48 +02:00
Cam Saul
ef42d3067c Update cljfmt config and add to GH Actions (#46998)
* Cljfmt

* Fix new GH action
2024-08-20 18:23:16 +00:00
Uladzimir Havenchyk
9c75ad629f remove pnpm lockfile (#47024) 2024-08-20 20:42:49 +03:00
lbrdnk
a556e1cd8e Update later stage stale references on clause removal (#46926)
* Add update-stale-references and test

* Update test
2024-08-20 18:18:01 +02:00
Uladzimir Havenchyk
92d615073a refactor: sort import members inside destructuring (#47009)
* refactor: sort import members inside destructuring

* Show an error message when the temporal unit is not applicable to a dashboard card (#46983)

* Fix tests

* Add tests

* Add tests

* Fix types

* Fix types

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-08-20 17:29:08 +03:00
Jeff Bruemmer
a5fe34ef23 docs - locked filter note (#46940) 2024-08-20 08:54:41 -04:00
Uladzimir Havenchyk
eb43ebfbd0 hide terminal-report logs from console (#46891)
* hide terminal-report logs from console

* disable html output from testing-library-dom

* revert failing code
2024-08-20 15:50:22 +03:00
Nicolò Pretto
e0a0734c62 make the newsletter signup a checkbox instead of a button (#46783)
* make the newsletter signup a checkbox instead of a button

* update copy on unit test

* fix describe nesting

* update the ui to be like the design

* make tests use userEvent.click to avoid warning about missing act

* use the subscribeToNewsletter function

* add basic e2e test for newsletter subscription

* move wait to the end of the test to see if it passes in ci

* remove async to see if it fixes the issue

* trying to mock the response

* make it clear why we're mocking the response

* use getUserEmail as suggested by Sloan

* inline var a suggested on code review
2024-08-20 14:28:39 +02:00
Nemanja Glumac
49db9a9b77 Fix 46221: Wrong collection shown in ad-hoc model-based questions (#47008)
* Remove `Collections` entity loader

* Load collections directly within the component

* Add E2E repro for #46221
2024-08-20 14:15:13 +02:00
Alexander Polyankin
fff6e35c3e Show an error message when the temporal unit is not applicable to a dashboard card (#46983)
* Fix tests

* Add tests

* Add tests

* Fix types

* Fix types
2024-08-20 07:49:10 -04:00
Nemanja Glumac
07c1e2549a Remove extra bottom margin from summarized ad-hoc question (#46993) 2024-08-20 09:01:19 +02:00
Cam Saul
ee25e763e3 Test defn/defmacro exclamation point linter should also use :parallel/disallowed (#46943)
* Kondo Config cleanup

* Restore warnings for with-log-messages-for-level until #28827 is merged

* Updated clojure.test hooks

* Fix kondo warning

* Test defn/defmacro exclamation point linter should also use :parallel/disallowed (part 1)

* WIP

* Time for me to learn to spell

* Finish the cleanup

* Remove code I was typing as an example

* Fix renamed var

* Fix the SAML tests

* Fix Kondo warning
2024-08-20 12:10:08 +07:00
Nemanja Glumac
bcb10910e3 tech: Delete old analytics code (#46986) 2024-08-20 00:41:33 +02:00
bryan
2bbcf745c8 Add no-access table-level and schema-level permission (#46542)
* allow `:blocked` to be saved for table level perms

* Adds 2 tests for table level blocked permission settings

- N.B. these are NOT ENFORCED YET

* update test that asserted we cannot set block on tables (we can)

* WIP: Pairing on making perms checking less wild

* cleanup, update docs, and add a test for view-data perm only

- Added a test where we have data permissions, but not create query, and
  I think it is failing when we have create query and blocked data
  permissions.
- renamed some functions from check-x -> has-x? since they return a
  value instead of throwing now

* Revert "WIP: Pairing on making perms checking less wild"

Keep the same behavior, but stick with the saner flow control

This reverts commit 63bcb5b401138555a081378574b15d6506469e60.

* update docs

* update test to be passing

- TODO: make sure it's correct w.r.t. perm settings

* Allow schema level blocked setting in permgraph

* remove invalid test cases

- continue to have a forcing function to test newly added perms

* conform function output

* ensure a single blocked table blocks native queries to its DB

* update error message

- we now catch this error in `metabase.models.query.permissions/has-perm-for-query?`

* we now check for data permissions to process query for card

* add more explanation to what we are testing

- to help see why it fails on CI and passes locally

* remove excess `def`

* Add test for table-level data X collection perms

- update test found to be in-error

* update param values qp permission check style

* set view-data and create-query explicitly

* set viewdata and createquery explicitly in qp test

* Respond to review comments (which fixes a case)

* setting a table to blocked: leave other tables the same

* [Permissions] Add "No access" schema/table permission (#46509)

* first pass

* refactors downgrading native permission logic and updates calculation so that "No access" downgrades native permissions to "No"

* stub for permissions help info on table block

* modal changes wip, updates downgrading create queries permissions to all happen at a single call site

* clean up, sandboxing modal copy changes, removes rekoke/limit access modal changes to make the diff smaller and move code to a seperate PR

* updates permissions help section to contain the final copy

* sandboxing copy fix and remove modal that was dropped from requirements

* adds blocked at the schema level, updates no access copy to blocked, updates permissions help section to contain new blocked and schema level changes

* fixes failed unit and e2e tests after sandboxing copy changes

* improve the block e2e test to include table blocking

* fixes failing blocked test, fixes other schemas create queries permissions getting correct with one schema was droped to blocked view data access, fixes a bug that prevents the save bar from going away when all permissions for group are set to the default values

* clean up

* remove color changes

* prevents parent being set to blocked preventing edits for children entities

* add new hasPermissionValueInSubgraph fn, adds modal to warn users we have to upgrade the view data permissions when they upgrade create queries permissions when a child entity is set to blocked

* adds test coverage for new modal

* removes unused function, adds new updateEntityPermission fn to help consolidate some logic elsewhere

* unit test fix and type fix

* most pr feedback

* updates the confirmation modal copy when changing a parent entity that contains a child with blocked permissions and/or sandboxed children, adds test coverage for that, adds test coverage for permission view data column not appearing in oss

* type fix

* [Permissions] Add e2e test coverage for blocked permissions enforcements (#46663)

* adds test coverage for enforcement of blocked permissions

* moves tests around based on pr feedback

* copy changes

* adds fix to make sure that blocked permissions are not removed from sibling tables that have the create queries permissions upgraded (#46854)

* Fix table name lookup for dbs w/ 1 schema per db

* add test for blank schema identifiers

* Refine sandboxed user perms for query builder access (#46939)

* Refine sandboxed user perms for query builder access

- Limit create-queries permissions to unblocked tables only
- Check user permissions for each table before granting query builder access
- Prevent querying of blocked joined tables from query builder for sandboxed users

* Adjust permissions for sandboxed users

- Grant view-data permissions only for unblocked tables
- Revert create-queries permissions to all tables in sandbox
- Remove unnecessary intermediate variable

* when sandboxing we no longer grant unrestricted view perms for blocked tables

* Update enterprise/backend/src/metabase_enterprise/sandbox/query_processor/middleware/row_level_restrictions.clj

remove blank line

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

* - make coalesce-test exhaustive (except for sandbox)

* Update enterprise/backend/src/metabase_enterprise/sandbox/query_processor/middleware/row_level_restrictions.clj

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

* t2/select ... -> database/table-id->database-id

* update comment

* [Permissions] Prevent "Granular" option in DB View Data options from changing permissions to unrestricted (#46976)

* fix

* adds back most of the code and limits it to only happen with impersonations, updates test to handle differing logic between the two flows

* removes test that is not longer needed

* more sandbox join table perms tests

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-08-19 16:33:43 -05:00
Mahatthana (Kelvin) Nomsawadi
668b6f36ed Update outdated loki snapshots (#46950)
* Update outdated loki snapshots

* Update the line snapshot using the one from CI

* try bumping the timeout to reduce flake

* Revert the linechart snapshot since it's still flaking

* skip the flaking story for themed line chart

* skip the flaking story for line chart

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Phoomparin Mano <phoomparin@gmail.com>
2024-08-19 14:41:30 -06:00
Oleksandr Yakushev
ce972eea52 perf: Remove redundant fetching of field values during DB sync (#46674) 2024-08-19 23:16:34 +03:00
Alex Yarosh
7cb5c14421 docs: special field filter syntax (#46982)
* field filter syntax

* Update docs/questions/native-editor/sql-parameters.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-19 19:36:27 +00:00
Nemanja Glumac
2899046d8c tech: Remove the last GoogleAnalytics tracking bits and references (#46980)
* Remove simple references to `trackStructEvent`

* Remove `withAnalytics` entities helper

* Remove `trackLoginSSO`

* Remove auth trackers

* Remove permissions trackers

* Remove performance trackers

* Remove settings trackers

* Remove pulse trackers

* Remove undo trackers

* Remove click actions trackers

* Remove `trackStructEvent`

* Remove GoogleAnalytics from the server security middleware

* Remove GoogleAnalytics from Kondo config

* Fix type failures

* Revert "Remove GoogleAnalytics from Kondo config"

This reverts commit 363557c44f.
2024-08-19 17:25:44 +00:00
John Swanson
57e1a4fba0 Allow missing Content-type header on GeoJSON (#46920)
If the content-type header is missing entirely, let it through. We're
not trying to be overly restrictive here, just prohibit things that are
clearly not GeoJSON.

Fixes https://github.com/metabase/metabase/issues/46918
2024-08-19 08:53:06 -07:00
github-actions[bot]
7bbf91fdb4 Update Translations for v50.21 (#46609)
* Add new strings for v50.20

* update translations for 50.21

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-08-19 15:44:40 +00:00
lbrdnk
4b31f83c03 Throw reasonable error when incompatible temporal unit is used in time unit parameter (#46525)
* Throw reasonable error when incompatible temporal unit is used in time unit param

* Remove redundant function

* Add :curated flag to catch exceptions

* Update test/metabase/query_processor_test/date_bucketing_test.clj

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>

* Address review remarks

* Update test

* Make vars private

---------

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-08-19 17:28:40 +02:00
Ryan Laurie
c78b46d62b Remove unnecessary calls to /api/collection (#46752)
* use ee api to find custom reports collection

* remove deprecated hook

* fix race condition

* add unit tests

* fix circular dependency

* fix unit tests

* another plugin strategy
2024-08-19 14:48:54 +00:00
Kamil Mielnik
65ac2f18ca Remove unused @ts-expect-error directive (#46959)
- use createQuestionAndDashboard helper instead of command
- sort imports
2024-08-19 11:58:08 +00:00
Chris Truter
df1b106f52 Simple util to measure allocations for single-threaded code (#46951) 2024-08-19 10:41:43 +00:00
Kamil Mielnik
2aad9b407b Refactor e2e JavaScript API commands to TypeScript function helpers (#46934)
* Remove unused file

* Refactor getCurrentUser command to a TS function util

* Refactor createAlert command to a TS function util

* Refactor createModerationReview command to a TS function util

* Reuse createModerationReview

* Refactor createPulse command to a TS function util

* Remove references to deleted files

* Improve typing
2024-08-19 09:14:31 +00:00
Cam Saul
23725b4e9d Misc Kondo Config cleanup (#46907)
* Kondo Config cleanup

* Restore warnings for with-log-messages-for-level until #28827 is merged

* Updated clojure.test hooks

* Fix kondo warning

* Time for me to learn to spell
2024-08-16 16:48:13 -07:00
dpsutton
5e70671108 Include missing opts arg for transform->nested (#46944)
was missing from the call.

Also had to disable hooks to commit:

```
✖ clj-kondo --config ./.clj-kondo/config.edn --config-dir ./.clj-kondo --parallel --lint:
metabase/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj:458:20: warning: Unresolved var: ts/extract-one
metabase/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj:1691:8: warning: Unresolved var: mbc/ensure-audit-db-installed!
metabase/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj:1757:18: warning: Unresolved var: ts/create!
linting took 247ms, errors: 0, warnings: 3
error Command failed with exit code 1.
```
2024-08-16 16:47:39 -06:00
Aleksandr Lesnenko
c6141aa747 use echarts tooltip (#46359)
* use ECharts tooltip on cartesian charts

* fix tooltip lag when changing hovered series

* facelift tooltip

* fix static viz crashes due to tooltip option

* facelift

* pie chart echarts tooltip

* facelift

* facelift

* facelift

* tweaks

* e2e specs

* return back the pie other slices tooltip

* more specs

* specs

* fix pie total

* fix tooltip overflow

* fix specs

* fix infinite rerender in embedding mode for charts that have warnings

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-16 11:39:07 -04:00
Alexander Solovyov
3b0e3a6b9c [serdes] extract-nested instead of relying on hydration (#46912) 2024-08-16 15:36:31 +00:00
Cam Saul
d959430ab9 Beautiful log message capturing ⭐ 😻 (#28827)
* Beautiful log message capturing ⭐ 😻

* Don't have log.cljs try to load log.capture, don't know how to make that work

* Remove restriction against use in parallel tests

* Fix tests using invalid syntax

* Port legacy tests

* Make this stuff work with Cljs

* Fix bad syntax

* Convert usages of old version of with-log-messages-for-level to new version

* Update other stuff to use the updated macro

* Fix stuff

* Fix Cljs tests

* Fix world's largest test

* Appease Kondo

* Fix comment

* ClojureScript: only emit capture code in dev builds
2024-08-16 17:17:45 +03:00
github-automation-metabase
d48bfdb7f7 Update Readme version references and published npm version to 0.1.31 (#46931) 2024-08-16 14:14:32 +00:00
Oleksandr Yakushev
6b9b5d9836 Fix warnings/errors in memoized-supports? when SnakeHatingMap is passed as database (#46868) 2024-08-16 16:50:08 +03:00
Jeff Bruemmer
4bc9b1fbaa docs - notes on memory usage (#46156)
* notes on memory usage

* typo

* Update observability-with-prometheus.md

* Update running.md

* update link

---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
2024-08-16 08:34:49 -05:00
Roman Abdulmanov
62e7619798 Update team.json (#46922) 2024-08-16 14:15:28 +01:00
Denis Berezin
b9ba40d88a feat(sdk): Add CreateDashboardModal component and hook (#46802) 2024-08-16 13:10:59 +00:00
Nemanja Glumac
9c887592be MS4: E2E sandboxing test coverage for "Link to the data source from notebook" project (#46903)
* Add sandboxing E2E tests

* Fix types

* Ignore TS error for now
2024-08-16 11:55:47 +00:00
Oisin Coveney
8394213df0 feat(sdk): Create Question (#46618) 2024-08-16 14:17:57 +03:00
Ngoc Khuat
147985f1a3 no top level trs (#46911) 2024-08-16 10:11:48 +00:00
Anton Kulyk
8272ac4760 Fix public dashboards are cut when printing (#46829)
* Fix public dashboards are cut when printing

* Add comment
2024-08-16 10:18:13 +01:00
Uladzimir Havenchyk
0f306ca5eb fix CSP error in prod (#46890) 2024-08-16 11:42:29 +03:00
Chris Truter
28e5fac967 Put a band-aid around flake with spec generator (#46762) 2024-08-16 10:08:10 +02:00
Ngoc Khuat
015ca44ea5 Fix unable to send pulse with multi-series (#46908) 2024-08-16 13:59:10 +07:00
Oleksandr Yakushev
2c3a214f31 perf: Optimize CSV exporting (#45757)
* perf: Use more efficient iteration and formatting in CSV export

* perf: Replace clojure.data.csv functions with more efficient implementations

* fix: Fix formatting for integer numbers in scientific notation
2024-08-15 22:24:27 +00:00
bryan
a43b09cdfe skip some troubleshooting stats when hosted (#46749)
* skip some troubleshooting stats when hosted

* fix typo

* just skip "system-info" and "app db details"
2024-08-15 19:16:18 +00:00
Chris Truter
10ecdd7ccf Remove double prefix (#46884) 2024-08-15 19:28:53 +02:00
Uladzimir Havenchyk
606a163086 ci: enable cypress-terminal-report only at CI (#46866)
* disable cypress-terminal-report locally

* one more check

* cleanup
2024-08-15 20:26:04 +03:00
Alex Yarosh
d842fad9b3 docs: concat clarification (#46851)
* concat

* we fixed this!

* format

* links

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-15 12:06:11 -04:00
7780 changed files with 571747 additions and 298231 deletions

View File

@@ -1,49 +1,215 @@
;; -*- comment-column: 100; -*-
{:config-paths ["macros" "src"]
:linters
{:aliased-namespace-symbol {:level :warning}
:invalid-arity {:skip-args [metabase.lib.util.match/match]} ; TODO (cam): can we fix these?
{
;;
;; enabled optional linters (these are disabled by default)
;;
:aliased-namespace-symbol {:level :warning}
:case-symbol-test {:level :warning}
:condition-always-true {:level :warning}
:def-fn {:level :warning}
:dynamic-var-not-earmuffed {:level :warning}
:equals-expected-position {:level :warning, :only-in-test-assertion true}
:keyword-binding {:level :warning}
:main-without-gen-class {:level :warning}
:minus-one {:level :warning}
:misplaced-docstring {:level :warning}
:missing-body-in-when {:level :warning}
:missing-docstring {:level :warning}
:missing-else-branch {:level :warning}
:namespace-name-mismatch {:level :warning}
:non-arg-vec-return-type-hint {:level :warning}
:plus-one {:level :warning}
:reduce-without-init {:level :warning}
:redundant-call {:level :warning}
:redundant-fn-wrapper {:level :warning}
:refer-all {:level :warning, :exclude [clojure.test]}
:self-requiring-namespace {:level :warning}
:single-key-in {:level :warning}
:unsorted-imports {:level :warning}
:unsorted-required-namespaces {:level :warning}
:unused-referred-var {:exclude {compojure.core [GET DELETE POST PUT]}}
:unused-alias {:level :warning}
:use {:level :warning}
:warn-on-reflection {:level :warning}
:metabase/defsetting-must-specify-export {:level :warning}
:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests {:level :warning}
:metabase/mbql-query-first-arg {:level :warning}
:metabase/missing-test-expr-requires-in-cljs {:level :warning}
:metabase/require-shape-checker {:level :warning}
:metabase/test-helpers-use-non-thread-safe-functions {:level :warning}
:metabase/validate-deftest {:level :warning}
:metabase/validate-logging {:level :warning}
;;
;; other disabled-by-default linters it would be nice to enable soon
;;
;; TODO (cam): most of these either have a ton of things that need to be fixed or cause issues
;; with [[metabase.lib.util.match/match]] and friends -- we need to write a custom hook for those macros so Kondo
;; can understand them.
#_:docstring-leading-trailing-whitespace
#_:equals-false
#_:equals-true
#_:used-underscored-binding
;;
;; disabled linters
;;
:unexpected-recur {:level :off} ; TODO (cam): I think we just need to tell it how to handle MBQL match and we can enable this?
:used-underscored-binding {:level :off} ; false positives: see https://github.com/clj-kondo/clj-kondo/issues/2152
:redundant-ignore {:level :off} ; lots of false positives, see https://github.com/clj-kondo/clj-kondo/issues/2414
:unexpected-recur {:level :off} ; TODO (cam): I think we just need to tell it how to handle MBQL match and we can enable this?
;;
;; TODO (cam): here are some more linters we should experiment with enabling -- some might be useful.
;; globally-enabled custom linters
;;
:metabase/defsetting-must-specify-export {:level :warning}
:metabase/mbql-query-first-arg {:level :warning}
:metabase/missing-test-expr-requires-in-cljs {:level :warning}
:metabase/require-shape-checker {:level :warning}
:metabase/test-helpers-use-non-thread-safe-functions {:level :warning}
:metabase/validate-logging {:level :warning}
:metabase/validate-mb-driver-tests {:level :warning}
:metabase/validate-mb-once {:level :warning}
:metabase/validate-deftest
{:level :warning
;; calling these functions will result in an error in tests marked `^:parallel`
;;
;; TODO -- these should all be made thread safe if possible or renamed so they end in `!`. Then we can remove them
;; from this list because by default anything ending in `!` is considered to be thread-unsafe
:parallel/unsafe
#{clojure.core/alter-var-root
clojure.core/with-redefs
clojure.core/with-redefs-fn
metabase.actions.test-util/with-actions
metabase.actions.test-util/with-actions-disabled
metabase.actions.test-util/with-actions-enabled
metabase.actions.test-util/with-actions-test-data
metabase.actions.test-util/with-actions-test-data-and-actions-enabled
metabase.actions.test-util/with-actions-test-data-tables
metabase.analytics.snowplow-test/with-fake-snowplow-collector
metabase.email-test/with-expected-messages
metabase.email-test/with-fake-inbox
metabase.test.data.users/with-group
metabase.test.data.users/with-group-for-user
metabase.test.data/with-empty-h2-app-db
metabase.test.util.log/with-log-level
metabase.test.util.misc/with-single-admin-user
metabase.test.util/with-all-users-permission
metabase.test.util/with-discarded-collections-perms-changes
metabase.test.util/with-env-keys-renamed-by
metabase.test.util/with-locale
metabase.test.util/with-model-cleanup
metabase.test.util/with-non-admin-groups-no-root-collection-for-namespace-perms
metabase.test.util/with-non-admin-groups-no-root-collection-perms
metabase.test.util/with-temp-env-var-value
metabase.test.util/with-temp-vals-in-db
metabase.test.util/with-temporary-raw-setting-values
metabase.test.util/with-temporary-setting-values
metabase.test.util/with-user-in-groups
metabase.test/with-actions
metabase.test/with-actions-disabled
metabase.test/with-actions-enabled
metabase.test/with-actions-test-data
metabase.test/with-actions-test-data-and-actions-enabled
metabase.test/with-actions-test-data-tables
metabase.test/with-all-users-permission
metabase.test/with-discarded-collections-perms-changes
metabase.test/with-empty-h2-app-db
metabase.test/with-env-keys-renamed-by
metabase.test/with-expected-messages
metabase.test/with-fake-inbox
metabase.test/with-group
metabase.test/with-group-for-user
metabase.test/with-locale
metabase.test/with-log-level
metabase.test/with-model-cleanup
metabase.test/with-non-admin-groups-no-root-collection-for-namespace-perms
metabase.test/with-non-admin-groups-no-root-collection-perms
metabase.test/with-single-admin-user
metabase.test/with-temp-env-var-value
metabase.test/with-temp-vals-in-db
metabase.test/with-temporary-raw-setting-values
metabase.test/with-temporary-setting-values
metabase.test/with-user-in-groups}
;; these functions are allowed in `^:parallel` tests even tho they end in `!`
:parallel/safe
#{clojure.core/assoc!
clojure.core/compare-and-set!
clojure.core/conj!
clojure.core/disj!
clojure.core/dissoc!
clojure.core/persistent!
clojure.core/pop!
clojure.core/reset!
clojure.core/reset-vals!
clojure.core/run!
clojure.core/swap!
clojure.core/swap-vals!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.core.async/<!
clojure.core.async/<!!
clojure.core.async/>!
clojure.core.async/>!!
clojure.core.async/alt!
clojure.core.async/alt!!
clojure.core.async/alts!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/ioc-alts!
clojure.core.async/offer!
clojure.core.async/onto-chan!
clojure.core.async/onto-chan!!
clojure.core.async/poll!
clojure.core.async/put!
clojure.core.async/take!
clojure.core.async/to-chan!
clojure.core.async/to-chan!!
metabase.channel.core/send!
metabase.driver.sql-jdbc.execute/execute-prepared-statement!
metabase.models.notification/create-notification!
metabase.pulse.send/send-pulse!
metabase.query-processor.store/store-database!
;; Safe in tests, where we typically use a private, temporary index per thread.
metabase.search.core/reindex!
metabase.util/run-count!
next.jdbc/execute!}}
:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests
{:level :warning
:max-length 180}
;; this is not enabled here, it is enabled below only for specific namespaces.
:metabase/disallow-hardcoded-driver-names-in-tests
;; don't include `:h2` since that will probably lead to a mountain of tests where we are specifically testing
;; middleware or compilation behavior with just H2 since it's the default.
{:drivers #{ ;; core drivers
#_:h2
:postgres
:mysql
;; module drivers
:athena
:bigquery-cloud-sdk
:databricks
:druid
:druid-jdbc
:googleanalytics
:hive-like
:mongo
:oracle
:presto-jdbc
:redshift
:snowflake
:sparksql
:sqlite
:sqlserver
:vertica}}
;;
;; misc config for built-in linters
;;
;; :docstring-leading-trailing-whitespace {:level :warning}
;; :docstring-no-summary {:level :warning}
;; :shadowed-var {:level :warning}
;; :def-fn {:level :warning}
:invalid-arity {:skip-args [metabase.lib.util.match/match]} ; TODO (cam): can we fix these?
:refer-all {:level :warning, :exclude [clojure.test]}
:unused-referred-var {:exclude {compojure.core [GET DELETE POST PUT]}}
:unresolved-symbol
{:exclude
@@ -113,6 +279,7 @@
:discouraged-namespace
{camel-snake-kebab.core {:message "CSK is not Turkish-safe, use the versions in metabase.util instead."}
cheshire.core {:message "Use metabase.util.json instead of cheshire.core directly."}
clojure.tools.logging {:message "Use metabase.util.log instead of clojure.tools.logging directly"}
grouper.core {:message "Use metabase.util.grouper instead of grouper.core"}
honeysql.core {:message "Use Honey SQL 2. Honey SQL 1 is removed as a dependency in Metabase 49+."}
@@ -151,7 +318,7 @@
metabase.analytics #{metabase.analytics.prometheus
metabase.analytics.snowplow
metabase.analytics.stats
metabase.analytics.sdk} ; TODO -- consolidate these into a real API namespace.
metabase.analytics.sdk} ; TODO -- consolidate these into a real API namespace.
metabase.analyze #{metabase.analyze}
metabase.api #{metabase.api.common
metabase.api.dataset
@@ -163,7 +330,9 @@
metabase.audit #{metabase.audit}
metabase.bootstrap #{metabase.bootstrap}
metabase.cmd #{} ; there are no namespaces here since you shouldn't be using this in any other module.
metabase.channel #{metabase.channel.core}
metabase.channel #{metabase.channel.core
metabase.channel.render.core
metabase.channel.template.core}
metabase.config #{metabase.config}
metabase.core #{metabase.core.initialization-status} ; TODO -- only namespace used outside of EE, this probably belongs in `metabase.server` anyway since that's the only place it's used.
metabase.db #{metabase.db
@@ -172,7 +341,8 @@
metabase.db.setup} ; TODO these are only calling `metabase.db.setup/setup-db!` and there's a slightly different version in `metabase.db`
metabase.driver :any ; TODO -- 19 namespaces!!!! CRY
metabase.email #{metabase.email
metabase.email.messages} ; TODO -- consolidate these into a real API namespace.
metabase.email.messages
metabase.email.result-attachment} ; TODO -- consolidate these into a real API namespace.
metabase.embed #{metabase.embed.settings}
metabase.events #{metabase.events}
metabase.formatter #{metabase.formatter}
@@ -190,47 +360,38 @@
metabase.metabot #{metabase.metabot}
metabase.models :any ; TODO -- scream, 62 namespaces used elsewhere, but to be fair a lot of these don't *need* to be required.
metabase.moderation #{metabase.moderation}
metabase.notification #{metabase.notification.core
metabase.notification.payload.core}
metabase.permissions #{metabase.permissions.util} ; TODO -- this is currently the only namespace in this module. Give it a real API namespace?
metabase.plugins #{metabase.plugins
metabase.plugins.classloader} ; TODO -- not 100% sure the classloader belongs here
metabase.public-settings #{metabase.public-settings
metabase.public-settings.premium-features}
metabase.pulse #{metabase.pulse
metabase.pulse.markdown
metabase.pulse.parameters
metabase.pulse.preview
metabase.pulse.render
metabase.pulse.render.image-bundle
metabase.pulse.render.js-svg
metabase.pulse.render.style} ; TODO -- consolidate these into a real API namespace.
metabase.pulse #{metabase.pulse.core}
metabase.query-processor :any ; TODO omg scream, 29 namespaces used outside of the module. WHAT THE HECC
metabase.query-analysis #{metabase.query-analysis
metabase.query-analysis.failure-map}
metabase.related #{metabase.related}
metabase.request #{metabase.request.core}
metabase.sample-data #{metabase.sample-data}
metabase.search #{metabase.search}
metabase.server #{metabase.server
metabase.server.handler
metabase.server.middleware.auth
metabase.server.middleware.exceptions
metabase.search #{metabase.search.core
;; Need to expose this submodule, to break circular dependencies with models.
metabase.search.spec}
metabase.server #{metabase.server.core
;;
;; TODO FIXME -- this is loaded for side effects since it contains the JSON
;; encoder logic for stuff like `java.time` classes. As a
;; result, [[metabase.models.setting]] (and thus the `metabase.models` module)
;; has to depend on the `metabase.server` module...we should create either a new
;; `metabase.json` or `metabase.encoders` module for stuff like this to live. Or
;; maybe it just belongs in a generic `metabase.config` module.
metabase.server.middleware.json
metabase.server.middleware.misc
metabase.server.middleware.offset-paging
metabase.server.middleware.session
metabase.server.protocols
metabase.server.request.util} ; TODO -- consolidate these into a real API namespace.
;;
;; TODO -- we can't make this part of [[metabase.server.core]] YET because it
;; causes circular dependencies. Maybe in the future once we tease apart more of
;; the modules tangle we can.
metabase.server.protocols}
metabase.setup #{metabase.setup}
metabase.shared #{metabase.shared.dashboards.constants
metabase.shared.formatting.constants
metabase.shared.formatting.date
metabase.shared.formatting.numbers
metabase.shared.models.visualization-settings
metabase.shared.parameters.parameters
metabase.shared.util.currency
metabase.shared.util.i18n
metabase.shared.util.internal.time-common
metabase.shared.util.namespaces
metabase.shared.util.time} ; TODO -- consolidate these into a real API namespace.
metabase.sync #{metabase.sync
metabase.sync.analyze
metabase.sync.concurrent
@@ -242,7 +403,10 @@
metabase.sync.util} ; TODO -- consolidate these into a real API namespace.
metabase.task #{metabase.task
metabase.task.index-values
metabase.task.persist-refresh} ; TODO -- consolidate these into a real API namespace.
metabase.task.persist-refresh
;; We need to expose this to the metabase.search module.
;; Ideally, it would just live inside that module.
metabase.task.search-index} ; TODO -- consolidate these into a real API namespace.
metabase.troubleshooting #{metabase.troubleshooting}
metabase.types #{metabase.types}
metabase.upload #{metabase.upload}
@@ -265,7 +429,7 @@
metabase.api :any
metabase.async :any
metabase.audit :any
metabase.auth-provider #{metabase.util}
metabase.auth-provider #{metabase.util metabase.public-settings}
metabase.bootstrap #{}
metabase.cmd :any
metabase.compatibility :any
@@ -286,6 +450,7 @@
metabase.metabot :any
metabase.models :any
metabase.moderation :any
metabase.notification :any
metabase.permissions :any
metabase.plugins :any
metabase.public-settings :any
@@ -300,17 +465,20 @@
metabase.util}
metabase.query-processor :any
metabase.related :any
metabase.request #{metabase.config
metabase.models
metabase.public-settings
metabase.util}
metabase.sample-data :any
metabase.search :any
metabase.server :any
metabase.setup :any
metabase.shared :any
metabase.sync :any
metabase.task :any
metabase.troubleshooting :any
metabase.types #{metabase.util}
metabase.upload :any
metabase.util :any
metabase.util :any ; TODO -- this should probably be #{}
metabase.xrays :any}
;; namespaces matching these patterns (with `re-find`) are excluded from the module linter. Since regex literals
@@ -319,11 +487,11 @@
;; this is mostly intended for excluding test namespaces or those rare 'glue' namespaces that glue multiple modules
;; together, e.g. `metabase.lib.metadata.jvm`.
:ignored-namespace-patterns
#{"-test$" ; anything ending in `-test`
"test[-.]util" ; anything that contains `test.util` or `test-util`
"test\\.impl" ; anything that contains `test.impl`
"^metabase\\.test" ; anything starting with `metabase.test`
"^metabase\\.http-client$"}} ; `metabase.http-client` which is a test-only namespace despite its name.
#{"-test$" ; anything ending in `-test`
"test[-.]util" ; anything that contains `test.util` or `test-util`
"test\\.impl" ; anything that contains `test.impl`
"^metabase\\.test" ; anything starting with `metabase.test`
"^metabase\\.http-client$"}} ; `metabase.http-client` which is a test-only namespace despite its name.
:consistent-alias
{:aliases
@@ -348,16 +516,11 @@
clojure.tools.namespace.parse ns.parse
colorize.core colorize
environ.core env
hf.depstar.api depstar
hiccup.core hiccup
hiccup.util hiccup.util
honey.sql sql
honey.sql.helpers sql.helpers
honeysql.core hsql
honeysql.format hformat
honeysql.helpers hh
honeysql.types htypes
java-time t
java-time.api t
macaw.core macaw
malli.core mc
malli.error me
@@ -372,6 +535,8 @@
metabase-enterprise.test met
metabase.analytics.sdk sdk
metabase.analytics.stats stats
metabase.analysis.native-query-analyzer nqa
metabase.analysis.native-query-analyzer.parameter-substitution nqa.sub
metabase.analyze.query-results qr
metabase.analyze.classifiers.category classifiers.category
metabase.analyze.classifiers.core classifiers
@@ -426,6 +591,7 @@
metabase.api.util api.util
metabase.async.streaming-response.thread-pool thread-pool
metabase.channel.core channel
metabase.channel.render.core channel.render
metabase.cmd.copy.h2 copy.h2
metabase.config config
metabase.config.file config.file
@@ -465,6 +631,7 @@
metabase.driver.sql-jdbc.test-util sql-jdbc.tu
metabase.driver.sql.parameters.substitute sql.params.substitute
metabase.driver.sql.parameters.substitution sql.params.substitution
metabase.eid-translation eid-translation
metabase.email-test et
metabase.email.messages messages
metabase.formatter formatter
@@ -480,6 +647,7 @@
metabase.models.collection collection
metabase.models.collection.graph graph
metabase.models.collection-permission-graph-revision c-perm-revision
metabase.models.channel models.channel
metabase.models.dashboard-card dashboard-card
metabase.models.database database
metabase.models.dependency dependency
@@ -487,26 +655,26 @@
metabase.models.interface mi
metabase.models.moderation-review moderation-review
metabase.models.native-query-snippet native-query-snippet
metabase.models.notification models.notification
metabase.models.params params
metabase.models.permissions perms
metabase.models.permissions-group perms-group
metabase.models.permissions-group-membership perms-group-membership
metabase.models.permissions-revision perms-revision
metabase.models.permissions.parse perms-parse
metabase.models.pulse pulse
metabase.models.pulse models.pulse
metabase.models.pulse-channel pulse-channel
metabase.models.pulse-channel-recipient pulse-channel-recipient
metabase.models.query.permissions query-perms
metabase.models.setting.cache setting.cache
metabase.models.timeline timeline
metabase.models.timeline-event timeline-event
metabase.analysis.native-query-analyzer nqa
metabase.analysis.native-query-analyzer.parameter-substitution nqa.sub
metabase.notification.core notification
metabase.notification.test-util notification.tu
metabase.plugins.initialize plugins.init
metabase.public-settings public-settings
metabase.public-settings.premium-features premium-features
metabase.pulse pulse ; NB some conflicts with metabase.models.pulse
metabase.pulse.markdown markdown
metabase.pulse.core pulse
metabase.pulse.render render
metabase.pulse.render.body body
metabase.pulse.render.style style
@@ -537,26 +705,16 @@
metabase.query-processor.timezone qp.timezone
metabase.query-processor.util qp.util
metabase.related related
metabase.request.core request
metabase.search.config search.config
metabase.search.filter search.filter
metabase.search.util search.util
metabase.search.scoring scoring
metabase.server.middleware.auth mw.auth
metabase.server.middleware.browser-cookie mw.browser-cookie
metabase.server.middleware.exceptions mw.exceptions
metabase.server.middleware.json mw.json
metabase.server.middleware.log mw.log
metabase.server.middleware.misc mw.misc
metabase.server.middleware.offset-paging mw.offset-paging
metabase.server.middleware.security mw.security
metabase.server.middleware.session mw.session
metabase.server.middleware.ssl mw.ssl
metabase.server.request.util req.util
metabase.search.in-place.filter search.in-place.filter
metabase.search.in-place.util search.util
metabase.search.in-place.scoring scoring
metabase.server.core server
metabase.server.protocols server.protocols
metabase.shared.util shared.u
metabase.shared.util.currency currency
metabase.sync.analyze.fingerprint sync.fingerprint
metabase.sync.field-values field-values
metabase.sync.field-values sync.field-values
metabase.sync.interface i
metabase.sync.schedules sync.schedules
metabase.sync.sync-metadata.fields.our-metadata fields.our-metadata
@@ -576,6 +734,7 @@
metabase.test.util.timezone test.tz
metabase.timeseries-query-processor-test.util tqpt
metabase.util.cron u.cron
metabase.util.currency currency
metabase.util.date-2 u.date
metabase.util.date-2.common u.date.common
metabase.util.date-2.parse u.date.parse
@@ -592,6 +751,7 @@
metabase.util.macros u.macros
metabase.util.malli mu
metabase.util.malli.schema ms
metabase.util.markdown markdown
metabase.util.password u.password
metabase.util.schema su
metabase.util.ui-logic ui-logic
@@ -610,114 +770,117 @@
toucan.models models}}}
:lint-as
{cljs.cache/defcache clojure.core/deftype
clojure.core.cache/defcache clojure.core/deftype
clojure.core.logic/defne clj-kondo.lint-as/def-catch-all
clojure.test.check.clojure-test/defspec clojure.test/deftest
clojurewerkz.quartzite.jobs/defjob clojure.core/defn
honeysql.helpers/defhelper clj-kondo.lint-as/def-catch-all
honeysql.util/defalias clojure.core/def
metabase-enterprise.serialization.test-util/with-random-dump-dir clojure.core/let
metabase-enterprise.serialization.test-util/with-dbs clojure.core/fn
metabase.actions.test-util/with-actions clojure.core/let
metabase.api.common/let-404 clojure.core/let
metabase.api.common/defroutes clojure.core/def
metabase.api.search-test/do-test-users clojure.core/let
metabase.async.api-response-test/with-response clojure.core/let
metabase.dashboard-subscription-test/with-dashboard-sub-for-card clojure.core/let
metabase.db.custom-migrations/define-migration clj-kondo.lint-as/def-catch-all
metabase.db.custom-migrations/define-reversible-migration clj-kondo.lint-as/def-catch-all
metabase.db.data-migrations/defmigration clojure.core/def
metabase.db.liquibase/with-liquibase clojure.core/let
metabase.db.schema-migrations-test.impl/with-temp-empty-app-db clojure.core/let
metabase.driver.mongo.query-processor/mongo-let clojure.core/let
metabase.driver.mongo.connection/with-mongo-client clojure.core/let
metabase.driver.mongo.connection/with-mongo-database clojure.core/let
metabase.driver.sql-jdbc.actions/with-jdbc-transaction clojure.core/let
metabase.driver.sql-jdbc.connection/with-connection-spec-for-testing-connection clojure.core/let
metabase.driver.sql-jdbc.execute.diagnostic/capturing-diagnostic-info clojure.core/fn
metabase.integrations.ldap/with-ldap-connection clojure.core/fn
metabase.models.collection-test/with-collection-in-location clojure.core/let
metabase.models.json-migration/def-json-migration clj-kondo.lint-as/def-catch-all
metabase.models.setting.multi-setting/define-multi-setting clojure.core/def
metabase.models.setting/defsetting clj-kondo.lint-as/def-catch-all
metabase.public-settings.premium-features/defenterprise-schema clj-kondo.lint-as/def-catch-all
metabase.public-settings.premium-features/define-premium-feature clojure.core/def
metabase.pulse-test/with-pulse-for-card clojure.core/let
metabase.query-processor.error-type/deferror clojure.core/def
metabase.query-processor.setup/with-qp-setup clojure.core/let
metabase.query-processor.middleware.cache.impl/with-reducible-deserialized-results clojure.core/let
metabase.query-processor.middleware.process-userland-query-test/with-query-execution clojure.core/let
metabase.query-processor-test.pipeline-queries-test/pmbql-query clojure.core/->
metabase.query-processor-test.pipeline-queries-test/run-pmbql-query clojure.core/->
metabase.shared.util.namespaces/import-fns potemkin/import-vars
metabase.sync.util/sum-for clojure.core/for
metabase.sync.util/with-emoji-progress-bar clojure.core/let
metabase.test.data.interface/defdataset clojure.core/def
metabase.test.data.interface/defdataset-edn clojure.core/def
metabase.test/defdataset clojure.core/def
metabase.test/let-url clojure.core/let
metabase.test/with-actions clojure.core/let
metabase.test/with-open-channels clojure.core/let
metabase.test/with-single-admin-user clojure.core/fn
metabase.test/with-temp-dir clojure.core/let
metabase.test/with-temp-empty-app-db clojure.core/let
metabase.test/with-temp-file clojure.core/let
metabase.test/with-user-in-groups clojure.core/let
metabase.test/with-grouper-batches! clojure.core/fn
metabase.upload-test/with-upload-table! clojure.core/let
metabase.util.files/with-open-path-to-resource clojure.core/let
metabase.util.malli.defn/defn schema.core/defn
metabase.util.malli.defn/defn- schema.core/defn
metabase.util.malli.fn/fn schema.core/fn
metabase.util.malli/defmethod schema.core/defmethod
metabase.util.malli/defn schema.core/defn
metabase.util.malli/defn- schema.core/defn
metabase.util.malli/fn schema.core/fn
metabase.util.ssh/with-ssh-tunnel clojure.core/let
metabase.xrays.domain-entities.malli/defn schema.core/defn
monger.operators/defoperator clojure.core/def
potemkin.types/defprotocol+ clojure.core/defprotocol
potemkin.types/defrecord+ clojure.core/defrecord
potemkin.types/deftype+ clojure.core/deftype
potemkin/defprotocol+ clojure.core/defprotocol
potemkin/defrecord+ clojure.core/defrecord
potemkin/deftype+ clojure.core/deftype
toucan.db/with-call-counting clojure.core/fn
toucan2.core/with-call-count clojure.core/fn}
{cljs.cache/defcache clojure.core/deftype
clojure.core.cache/defcache clojure.core/deftype
clojure.core.logic/defne clj-kondo.lint-as/def-catch-all
clojure.test.check.clojure-test/defspec clojure.test/deftest
clojurewerkz.quartzite.jobs/defjob clojure.core/defn
metabase-enterprise.serialization.test-util/with-dbs clojure.core/fn
metabase-enterprise.serialization.test-util/with-random-dump-dir clojure.core/let
metabase.actions.test-util/with-actions clojure.core/let
metabase.api.common/defroutes clojure.core/def
metabase.api.common/let-404 clojure.core/let
metabase.api.search-test/do-test-users clojure.core/let
metabase.async.api-response-test/with-response clojure.core/let
metabase.dashboard-subscription-test/with-dashboard-sub-for-card clojure.core/let
metabase.channel.impl.http-test/with-captured-http-requests clojure.core/fn
metabase.channel.impl.http-test/with-server clojure.core/let
metabase.db.custom-migrations/define-migration clj-kondo.lint-as/def-catch-all
metabase.db.custom-migrations/define-reversible-migration clj-kondo.lint-as/def-catch-all
metabase.db.data-migrations/defmigration clojure.core/def
metabase.db.liquibase/with-liquibase clojure.core/let
metabase.db.schema-migrations-test.impl/with-temp-empty-app-db clojure.core/let
metabase.driver.mongo.connection/with-mongo-client clojure.core/let
metabase.driver.mongo.connection/with-mongo-database clojure.core/let
metabase.driver.mongo.query-processor/mongo-let clojure.core/let
metabase.driver.sql-jdbc.actions/with-jdbc-transaction clojure.core/let
metabase.driver.sql-jdbc.connection/with-connection-spec-for-testing-connection clojure.core/let
metabase.driver.sql-jdbc.execute.diagnostic/capturing-diagnostic-info clojure.core/fn
metabase.integrations.ldap/with-ldap-connection clojure.core/fn
metabase.models.collection-test/with-collection-in-location clojure.core/let
metabase.models.json-migration/def-json-migration clj-kondo.lint-as/def-catch-all
metabase.models.setting.multi-setting/define-multi-setting clojure.core/def
metabase.models.setting/defsetting clj-kondo.lint-as/def-catch-all
metabase.public-settings.premium-features/defenterprise-schema clj-kondo.lint-as/def-catch-all
metabase.public-settings.premium-features/define-premium-feature clojure.core/def
metabase.pulse.send-test/with-pulse-for-card clojure.core/let
metabase.query-processor-test.pipeline-queries-test/pmbql-query clojure.core/->
metabase.query-processor-test.pipeline-queries-test/run-pmbql-query clojure.core/->
metabase.query-processor.error-type/deferror clojure.core/def
metabase.query-processor.middleware.cache.impl/with-reducible-deserialized-results clojure.core/let
metabase.query-processor.middleware.process-userland-query-test/with-query-execution! clojure.core/let
metabase.query-processor.setup/with-qp-setup clojure.core/let
metabase.sync.util/sum-for clojure.core/for
metabase.sync.util/with-emoji-progress-bar clojure.core/let
metabase.test.data.interface/defdataset clojure.core/def
metabase.test.data.interface/defdataset-edn clojure.core/def
metabase.test/defdataset clojure.core/def
metabase.test/let-url clojure.core/let
metabase.test/with-actions clojure.core/let
metabase.test/with-grouper-batches! clojure.core/fn
metabase.test/with-open-channels clojure.core/let
metabase.test/with-single-admin-user clojure.core/fn
metabase.test/with-temp-dir clojure.core/let
metabase.test/with-temp-empty-app-db clojure.core/let
metabase.test/with-temp-file clojure.core/let
metabase.test/with-user-in-groups clojure.core/let
metabase.upload-test/with-upload-table! clojure.core/let
metabase.util.files/with-open-path-to-resource clojure.core/let
metabase.util.malli.defn/defn schema.core/defn
metabase.util.malli.defn/defn- schema.core/defn
metabase.util.malli.fn/fn schema.core/fn
metabase.util.malli/defmethod schema.core/defmethod
metabase.util.malli/defn schema.core/defn
metabase.util.malli/defn- schema.core/defn
metabase.util.malli/fn schema.core/fn
metabase.util.namespaces/import-fns potemkin/import-vars
metabase.util.ssh/with-ssh-tunnel clojure.core/let
metabase.xrays.domain-entities.malli/defn schema.core/defn
metabuild-common.core/with-open-jar-file-system clojure.core/let
metabuild-common.files/with-open-jar-file-system clojure.core/let
monger.operators/defoperator clojure.core/def
potemkin.types/defprotocol+ clojure.core/defprotocol
potemkin.types/defrecord+ clojure.core/defrecord
potemkin.types/deftype+ clojure.core/deftype
potemkin/defprotocol+ clojure.core/defprotocol
potemkin/defrecord+ clojure.core/defrecord
potemkin/deftype+ clojure.core/deftype
toucan.db/with-call-counting clojure.core/fn
toucan2.core/with-call-count clojure.core/fn}
:hooks
{:analyze-call
{clojure.core/ns hooks.clojure.core/lint-ns
cljs.test/deftest hooks.clojure.test/deftest
{cljs.test/deftest hooks.clojure.test/deftest
cljs.test/is hooks.clojure.test/is
cljs.test/use-fixtures hooks.clojure.test/use-fixtures
clojure.core/ns hooks.clojure.core/lint-ns
clojure.test/deftest hooks.clojure.test/deftest
clojure.test/is hooks.clojure.test/is
clojure.test/use-fixtures hooks.clojure.test/use-fixtures
metabase-enterprise.cache.config-test/with-temp-persist-models hooks.common/with-seven-bindings
metabase-enterprise.advanced-permissions.models.permissions.application-permissions-test/with-new-group-and-current-graph hooks.common/with-two-top-level-bindings
metabase-enterprise.audit-app.pages-test/with-temp-objects hooks.common/with-one-binding
metabase-enterprise.cache.config-test/with-temp-persist-models hooks.common/with-seven-bindings
metabase-enterprise.serialization.test-util/with-temp-dpc hooks.toucan2.tools.with-temp/with-temp
metabase.analytics.prometheus-test/with-prometheus-system hooks.common/with-two-bindings
metabase.api.automagic-dashboards-test/with-indexed-model hooks.metabase.api.automagic-dashboards-test/with-indexed-model
metabase.api.alert-test/with-alert-in-collection hooks.common/with-four-bindings
metabase.api.card-test/with-persistence-setup hooks.common/with-one-top-level-binding
metabase.analytics.prometheus-test/with-prometheus-system! hooks.common/with-two-bindings
metabase.api.alert-test/with-alert-in-collection! hooks.common/with-four-bindings
metabase.api.automagic-dashboards-test/with-indexed-model! hooks.metabase.api.automagic-dashboards-test/with-indexed-model!
metabase.api.card-test/with-card-param-values-fixtures hooks.common/let-one-with-optional-value
metabase.api.card-test/with-persistence-setup! hooks.common/with-one-top-level-binding
metabase.api.card-test/with-temp-native-card! hooks.common/with-two-bindings
metabase.api.card-test/with-temp-native-card-with-params! hooks.common/with-two-bindings
metabase.api.collection-test/with-french-user-and-personal-collection hooks.common/with-two-top-level-bindings
metabase.api.collection-test/with-french-user-and-personal-collection! hooks.common/with-two-top-level-bindings
metabase.api.common/defendpoint hooks.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async hooks.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async-schema hooks.metabase.api.common/defendpoint
metabase.api.common.internal-test/with-jetty-server hooks.common/with-one-binding
metabase.api.dashboard-test/with-chain-filter-fixtures hooks.common/let-one-with-optional-value
metabase.api.dashboard-test/with-simple-dashboard-with-tabs hooks.common/with-one-binding
metabase.api.card-test/with-card-param-values-fixtures hooks.common/let-one-with-optional-value
metabase.api.embed-test/do-response-formats hooks.common/with-two-bindings
metabase.api.embed-test/with-chain-filter-fixtures hooks.common/let-one-with-optional-value
metabase.api.embed-test/with-chain-filter-fixtures! hooks.common/let-one-with-optional-value
metabase.api.embed-test/with-temp-card hooks.common/let-one-with-optional-value
metabase.api.embed-test/with-temp-dashcard hooks.common/let-one-with-optional-value
metabase.api.persist-test/with-setup hooks.common/with-one-top-level-binding
metabase.api.public-test/with-required-param-card hooks.common/with-one-binding
metabase.api.persist-test/with-setup! hooks.common/with-one-top-level-binding
metabase.api.public-test/with-required-param-card! hooks.common/with-one-binding
metabase.api.public-test/with-temp-public-card hooks.common/let-one-with-optional-value
metabase.api.public-test/with-temp-public-dashboard hooks.common/let-one-with-optional-value
metabase.api.public-test/with-temp-public-dashboard-and-card hooks.common/with-three-bindings
@@ -725,33 +888,42 @@
metabase.api.search-test/with-search-items-in-root-collection hooks.common/do*
metabase.api.user-test/with-temp-user-email hooks.common/with-one-binding
metabase.async.streaming-response-test/with-start-execution-chan hooks.common/with-one-binding
metabase.db.schema-migrations-test.impl/test-migrations hooks.metabase.db.schema-migrations-test.impl/test-migrations
metabase.channel.template.handlebars-test/with-temp-template! hooks.common/with-vec-first-binding
metabase.channel.template.handlebars-helper/defhelper hooks.metabase.channel.template.handlebars-helper/defhelper
metabase.dashboard-subscription-test/with-link-card-fixture-for-dashboard hooks.common/let-second
metabase.db.schema-migrations-test.impl/test-migrations hooks.metabase.db.schema-migrations-test.impl/test-migrations
metabase.driver.bigquery-cloud-sdk-test/calculate-bird-scarcity hooks.metabase.query-processor-test.expressions-test/calculate-bird-scarcity
metabase.driver.oracle-test/with-temp-user hooks.common/let-one-with-optional-value
metabase.driver/register! hooks.metabase.driver/register!
metabase.legacy-mbql.schema.macros/defclause hooks.metabase.legacy-mbql.schemas.macros/defclause
metabase.lib.schema.mbql-clause/define-mbql-clause hooks.metabase.lib.schema.mbql-clause/define-mbql-clause
metabase.lib.schema.mbql-clause/define-catn-mbql-clause hooks.metabase.lib.schema.mbql-clause/define-mbql-clause
metabase.lib.schema.mbql-clause/define-mbql-clause hooks.metabase.lib.schema.mbql-clause/define-mbql-clause
metabase.lib.schema.mbql-clause/define-tuple-mbql-clause hooks.metabase.lib.schema.mbql-clause/define-mbql-clause
metabase.lib.test-util.macros/$ids hooks.metabase.test.data/$ids
metabase.lib.test-util.macros/mbql-query hooks.metabase.test.data/mbql-query
metabase.lib.test-util.macros/with-testing-against-standard-queries hooks.metabase.lib.test-util.macros/with-testing-against-standard-queries
metabase.models.collection-test/with-collection-hierarchy hooks.common/let-one-with-optional-value
metabase.models.collection-test/with-collection-hierarchy! hooks.common/let-one-with-optional-value
metabase.models.collection-test/with-personal-and-impersonal-collections hooks.common/with-two-bindings
metabase.models.dashboard-test/with-dash-in-collection hooks.common/with-three-bindings
metabase.models.dashboard-tab-test/with-dashtab-in-personal-collection hooks.common/with-one-top-level-binding
metabase.models.interface/define-simple-hydration-method hooks.metabase.models.interface/define-hydration-method
metabase.models.dashboard-test/with-dash-in-collection! hooks.common/with-three-bindings
metabase.models.interface/define-batched-hydration-method hooks.metabase.models.interface/define-hydration-method
metabase.models.pulse-test/with-dashboard-subscription-in-collection hooks.common/with-four-bindings
metabase.models.pulse-test/with-pulse-in-collection hooks.common/with-four-bindings
metabase.models.interface/define-simple-hydration-method hooks.metabase.models.interface/define-hydration-method
metabase.models.pulse-test/with-dashboard-subscription-in-collection! hooks.common/with-four-bindings
metabase.models.pulse-test/with-pulse-in-collection! hooks.common/with-four-bindings
metabase.models.setting.multi-setting/define-multi-setting hooks.metabase.models.setting/define-multi-setting
metabase.models.setting/defsetting hooks.metabase.models.setting/defsetting
metabase.public-settings.premium-features/defenterprise hooks.metabase.public-settings.premium-features/defenterprise
metabase.pulse.test-util/checkins-query-card hooks.metabase.test.data/$ids
metabase.query-processor-test.expressions-test/calculate-bird-scarcity hooks.metabase.query-processor-test.expressions-test/calculate-bird-scarcity
metabase.query-processor-test.filter-test/count-with-filter-clause hooks.metabase.test.data/$ids
metabase.query-processor.middleware.cache-test/with-mock-cache hooks.common/with-two-bindings
metabase.query-processor.middleware.cache-test/with-mock-cache! hooks.common/with-two-bindings
metabase.request.core/with-current-request hooks.common/with-used-first-arg
metabase.request.core/with-current-user hooks.common/with-used-first-arg
metabase.request.core/with-limit-and-offset hooks.common/with-used-first-two-args
metabase.sample-data-test/with-temp-sample-database-db hooks.common/with-one-binding
metabase.stale-test/with-stale-items hooks.toucan2.tools.with-temp/with-temp
metabase.test.data.datasets/test-driver hooks.metabase.test.data.datasets/test-driver
metabase.test.data.datasets/test-drivers hooks.metabase.test.data.datasets/test-drivers
metabase.test.data.users/with-group hooks.common/let-one-with-optional-value
metabase.test.data/$ids hooks.metabase.test.data/$ids
metabase.test.data/dataset hooks.metabase.test.data/dataset
@@ -759,7 +931,6 @@
metabase.test.data/run-mbql-query hooks.metabase.test.data/mbql-query
metabase.test.util.async/with-open-channels hooks.common/let-with-optional-value-for-last-binding
metabase.test.util.log/with-log-level hooks.common/with-ignored-first-arg
metabase.test.util.log/with-log-messages-for-level hooks.common/with-ignored-first-arg
metabase.test.util/discard-setting-changes hooks.common/with-ignored-first-arg
metabase.test.util/with-column-remappings hooks.common/with-ignored-first-arg
metabase.test.util/with-non-admin-groups-no-root-collection-perms hooks.common/do*
@@ -770,70 +941,72 @@
metabase.test/discard-setting-changes hooks.common/with-ignored-first-arg
metabase.test/mbql-query hooks.metabase.test.data/mbql-query
metabase.test/query hooks.metabase.test.data/mbql-query
metabase.test/test-drivers hooks.common/do*
metabase.test/run-mbql-query hooks.metabase.test.data/mbql-query
metabase.test/test-driver hooks.metabase.test.data.datasets/test-driver
metabase.test/test-drivers hooks.metabase.test.data.datasets/test-drivers
metabase.test/with-column-remappings hooks.common/with-ignored-first-arg
metabase.test/with-group hooks.common/let-one-with-optional-value
metabase.test/with-log-level hooks.common/with-ignored-first-arg
metabase.test/with-log-messages-for-level hooks.common/with-ignored-first-arg
metabase.test/with-log-messages-for-level hooks.metabase.util.log.capture/with-log-messages-for-level
metabase.test/with-non-admin-groups-no-root-collection-perms hooks.common/do*
metabase.test/with-temp hooks.toucan2.tools.with-temp/with-temp
metabase.stale-test/with-stale-items hooks.toucan2.tools.with-temp/with-temp
metabase.test/with-temp-file hooks.metabase.test.util/with-temp-file
metabase.test/with-temporary-setting-values hooks.metabase.test.util/with-temporary-setting-values
metabase.util/format-color hooks.metabase.util/format-color
metabase.util.log/trace hooks.metabase.util.log/info
metabase.util.log/tracef hooks.metabase.util.log/infof
metabase.util.log.capture/with-log-messages-for-level hooks.metabase.util.log.capture/with-log-messages-for-level
metabase.util.log/debug hooks.metabase.util.log/info
metabase.util.log/debugf hooks.metabase.util.log/infof
metabase.util.log/info hooks.metabase.util.log/info
metabase.util.log/infof hooks.metabase.util.log/infof
metabase.util.log/warn hooks.metabase.util.log/info
metabase.util.log/warnf hooks.metabase.util.log/infof
metabase.util.log/error hooks.metabase.util.log/info
metabase.util.log/errorf hooks.metabase.util.log/infof
metabase.util.log/fatal hooks.metabase.util.log/info
metabase.util.log/fatalf hooks.metabase.util.log/infof
metabase.util.malli.registry/def hooks.metabase.util.malli.registry/def}
metabase.util.log/info hooks.metabase.util.log/info
metabase.util.log/infof hooks.metabase.util.log/infof
metabase.util.log/trace hooks.metabase.util.log/info
metabase.util.log/tracef hooks.metabase.util.log/infof
metabase.util.log/warn hooks.metabase.util.log/info
metabase.util.log/warnf hooks.metabase.util.log/infof
metabase.util.malli.registry/def hooks.metabase.util.malli.registry/def
metabase.util/case-enum hooks.metabase.util/case-enum
metabase.util/format-color hooks.metabase.util/format-color}
:macroexpand
{clojurewerkz.quartzite.jobs/build macros.quartz/build-job
clojurewerkz.quartzite.schedule.cron/schedule macros.quartz/schedule
clojurewerkz.quartzite.schedule.simple/schedule macros.quartz/simple-schedule
clojurewerkz.quartzite.triggers/build macros.quartz/build-trigger
metabase-enterprise.sandbox.test-util/with-gtaps! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.sandbox.test-util/with-gtaps-for-user! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.serialization.test-util/with-world macros.metabase-enterprise.serialization.test-util/with-world
metabase-enterprise.test/with-gtaps! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.test/with-gtaps-for-user! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.advanced-permissions.api.util-test/with-impersonations! macros.metabase-enterprise.advanced-permissions.api.util-test/with-impersonations!
metabase-enterprise.query-reference-validation.api-test/with-test-setup macros.metabase-enterprise.query-reference-validation.api-test/with-test-setup
metabase.api.card-test/with-ordered-items macros.metabase.api.card-test/with-ordered-items
metabase.api.collection-test/with-collection-hierarchy macros.metabase.api.collection-test/with-collection-hierarchy
metabase.api.collection-test/with-some-children-of-collection macros.metabase.api.collection-test/with-some-children-of-collection
metabase.api.common/define-routes macros.metabase.api.common/define-routes
metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing macros.metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing
metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing macros.metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing
metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing macros.metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing
metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing macros.metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing
metabase.lib.filter/deffilter macros.metabase.lib.filter/deffilter
metabase.lib.common/defop macros.metabase.lib.common/defop
metabase.models.params.chain-filter-test/chain-filter macros.metabase.models.params.chain-filter-test/chain-filter
metabase.models.params.chain-filter-test/chain-filter-search macros.metabase.models.params.chain-filter-test/chain-filter
metabase.models.query-analysis-test/with-test-setup macros.metabase.models.query-analysis-test/with-test-setup
metabase.models.user-test/with-groups macros.metabase.models.user-test/with-groups
metabase.query-processor.streaming/streaming-response macros.metabase.query-processor.streaming/streaming-response
metabase.related-test/with-world macros.metabase.related-test/with-world
metabase.shared.util.namespaces/import-fn macros.metabase.shared.util.namespaces/import-fn
metabase.task.setup.query-analysis-setup/with-test-setup! macros.metabase.task.setup.query-analysis-setup/with-test-setup!
metabase.test.data.users/with-group-for-user macros.metabase.test.data.users/with-group-for-user
metabase.test.util/with-temp-env-var-value! macros.metabase.test.util/with-temp-env-var-value!
metabase.test.util/with-temporary-raw-setting-values macros.metabase.test.util/with-temporary-raw-setting-values
metabase.test/with-group-for-user macros.metabase.test.data.users/with-group-for-user
metabase.test/with-persistence-enabled macros.metabase.test.persistence/with-persistence-enabled
metabase.test/with-temp-env-var-value! macros.metabase.test.util/with-temp-env-var-value!
metabase.test/with-temporary-raw-setting-values macros.metabase.test.util/with-temporary-raw-setting-values
metabase.xrays.domain-entities.malli/define-getters-and-setters macros.metabase.xrays.domain-entities.malli/define-getters-and-setters}}
{clojurewerkz.quartzite.jobs/build macros.quartz/build-job
clojurewerkz.quartzite.schedule.cron/schedule macros.quartz/schedule
clojurewerkz.quartzite.schedule.simple/schedule macros.quartz/simple-schedule
clojurewerkz.quartzite.triggers/build macros.quartz/build-trigger
metabase-enterprise.sandbox.test-util/with-gtaps! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.sandbox.test-util/with-gtaps-for-user! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.serialization.test-util/with-world macros.metabase-enterprise.serialization.test-util/with-world
metabase-enterprise.test/with-gtaps! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.test/with-gtaps-for-user! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.advanced-permissions.api.util-test/with-impersonations! macros.metabase-enterprise.advanced-permissions.api.util-test/with-impersonations!
metabase-enterprise.query-reference-validation.api-test/with-test-setup! macros.metabase-enterprise.query-reference-validation.api-test/with-test-setup!
metabase.api.card-test/with-ordered-items macros.metabase.api.card-test/with-ordered-items
metabase.api.collection-test/with-collection-hierarchy! macros.metabase.api.collection-test/with-collection-hierarchy!
metabase.api.collection-test/with-some-children-of-collection! macros.metabase.api.collection-test/with-some-children-of-collection!
metabase.api.common/define-routes macros.metabase.api.common/define-routes
metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing! macros.metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing!
metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing! macros.metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing!
metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing! macros.metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing!
metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing! macros.metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing!
metabase.lib.filter/deffilter macros.metabase.lib.filter/deffilter
metabase.lib.common/defop macros.metabase.lib.common/defop
metabase.models.params.chain-filter-test/chain-filter macros.metabase.models.params.chain-filter-test/chain-filter
metabase.models.params.chain-filter-test/chain-filter-search macros.metabase.models.params.chain-filter-test/chain-filter
metabase.models.query-analysis-test/with-test-setup macros.metabase.models.query-analysis-test/with-test-setup
metabase.models.user-test/with-groups macros.metabase.models.user-test/with-groups
metabase.query-processor.streaming/streaming-response macros.metabase.query-processor.streaming/streaming-response
metabase.related-test/with-world macros.metabase.related-test/with-world
metabase.task.setup.query-analysis-setup/with-test-setup! macros.metabase.task.setup.query-analysis-setup/with-test-setup!
metabase.test.data.users/with-group-for-user macros.metabase.test.data.users/with-group-for-user
metabase.test.util/with-temp-env-var-value! macros.metabase.test.util/with-temp-env-var-value!
metabase.test.util/with-temporary-raw-setting-values macros.metabase.test.util/with-temporary-raw-setting-values
metabase.test/with-group-for-user macros.metabase.test.data.users/with-group-for-user
metabase.test/with-persistence-enabled! macros.metabase.test.persistence/with-persistence-enabled!
metabase.test/with-temp-env-var-value! macros.metabase.test.util/with-temp-env-var-value!
metabase.test/with-temporary-raw-setting-values macros.metabase.test.util/with-temporary-raw-setting-values
metabase.util.namespaces/import-fn macros.metabase.util.namespaces/import-fn
metabase.xrays.domain-entities.malli/define-getters-and-setters macros.metabase.xrays.domain-entities.malli/define-getters-and-setters}}
:config-in-comment
{:linters {:unresolved-symbol {:level :off}}}

View File

@@ -1,7 +1,7 @@
(ns macros.metabase.api.collection-test
(:require [macros.common]))
(defmacro with-collection-hierarchy [bindings & body]
(defmacro with-collection-hierarchy! [bindings & body]
`(let [~(macros.common/ignore-unused 'a) nil
~(macros.common/ignore-unused 'b) nil
~(macros.common/ignore-unused 'c) nil
@@ -12,6 +12,6 @@
~bindings
~@body))
(defmacro with-some-children-of-collection [collection-or-id-or-nil & body]
(defmacro with-some-children-of-collection! [collection-or-id-or-nil & body]
`(let [~(macros.common/ignore-unused '&ids) ~collection-or-id-or-nil]
~@body))

View File

@@ -1,11 +1,11 @@
(ns macros.metabase.api.embed-test)
(defmacro with-embedding-enabled-and-temp-card-referencing
(defmacro with-embedding-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-embedding-enabled-and-temp-dashcard-referencing
(defmacro with-embedding-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil

View File

@@ -1,11 +1,11 @@
(ns macros.metabase.api.public-test)
(defmacro with-sharing-enabled-and-temp-card-referencing
(defmacro with-sharing-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-sharing-enabled-and-temp-dashcard-referencing
(defmacro with-sharing-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil

View File

@@ -1,8 +0,0 @@
(ns macros.metabase.shared.util.namespaces)
(defmacro import-fn
"Kondo macro replacement for [[metabase.shared.util.namespaces/import-fn]]."
([sym]
`(def ~(-> sym name symbol) "docstring" ~sym))
([sym name]
`(def ~name "docstring" ~sym)))

View File

@@ -8,5 +8,6 @@
~(macros.common/ignore-unused 'c2) 2
~(macros.common/ignore-unused 'c3) 3
~(macros.common/ignore-unused 'c4) 4
~(macros.common/ignore-unused 'arch) 5]
~(macros.common/ignore-unused 'archived) 5
~(macros.common/ignore-unused 'invalid) 6]
~@body))

View File

@@ -1,5 +1,5 @@
(ns macros.metabase.test.persistence)
(defmacro with-persistence-enabled [[persist-fn-sym] & body]
(defmacro with-persistence-enabled! [[persist-fn-sym] & body]
`(clojure.core/let [~persist-fn-sym (fn [])]
~@body))

View File

@@ -0,0 +1,8 @@
(ns macros.metabase.util.namespaces)
(defmacro import-fn
"Kondo macro replacement for [[metabase.util.namespaces/import-fn]]."
([sym]
`(def ~(-> sym name symbol) "docstring" ~sym))
([sym name]
`(def ~name "docstring" ~sym)))

View File

@@ -1,7 +1,7 @@
(ns macros.metabase-enterprise.query-reference-validation.api-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
(defmacro with-test-setup! [& body]
`(let [~(macros.common/ignore-unused 'card-1) 1
~(macros.common/ignore-unused 'card-2) 2
~(macros.common/ignore-unused 'card-3) 3

View File

@@ -1,10 +1,11 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.set :as set]
[clojure.string :as str]
[hooks.common]))
;;; TODO -- seems silly to maintain different blacklists and whitelists here than we use for the deftest `^:parallel`
;;; checker... those lists live in the Clj Kondo config file
(def ^:private symbols-allowed-in-fns-not-ending-in-an-exclamation-point
'#{;; these toucan methods might actually set global values if it's used outside of a transaction,
;; but since mt/with-temp runs in a transaction, so we'll ignore them in this case.
@@ -84,15 +85,14 @@
metabase.models.permissions/update-data-perms-graph!
metabase.models.permissions/update-group-permissions!
metabase.models.persisted-info/ready-database!
metabase.models.revision/revert!
metabase.models.setting-test/test-user-local-allowed-setting!
metabase.models.setting-test/test-user-local-only-setting!
metabase.models.setting.cache/restore-cache!
metabase.models.setting/set!
metabase.models.setting/validate-settings-formatting!
metabase.permissions.test-util/with-restored-perms!
metabase.pulse/send-notifications!
metabase.pulse/send-pulse!
metabase.pulse.send/send-notifications!
metabase.pulse.send/send-pulse!
metabase.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
@@ -139,23 +139,34 @@
[s]
(str/ends-with? s "!"))
(defn- explicitly-safe? [qualified-symbol]
(contains? symbols-allowed-in-fns-not-ending-in-an-exclamation-point qualified-symbol))
(defn- explicitly-unsafe? [config qualified-symbol]
(contains? (get-in config [:linters :metabase/validate-deftest :parallel/unsafe]) qualified-symbol))
(defn- unsafe? [config qualified-symbol]
(and (or (end-with-exclamation? qualified-symbol)
(explicitly-unsafe? config qualified-symbol))
(not (explicitly-safe? qualified-symbol))))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node}]
[{[defn-or-defmacro form-name] :children, :as node} config]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
(f form)
(doseq [child (:children form)]
(walk f child)))]
(walk (fn [form]
(walk f child)))
(check-node [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(when (and (not (contains? symbols-allowed-in-fns-not-ending-in-an-exclamation-point qualified-symbol))
(end-with-exclamation? qualified-symbol))
(hooks/reg-finding! (assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`."
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))
node))
(when (unsafe? config qualified-symbol)
(hooks/reg-finding!
(assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`. [:metabase/test-helpers-use-non-thread-safe-functions]"
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))]
(walk check-node node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
@@ -163,36 +174,36 @@
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang]}]
[{:keys [node cljc lang config]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node))
(non-thread-safe-form-should-end-with-exclamation* node config))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
@@ -227,11 +238,12 @@
(cond
(hooks/vector-node? node)
;; propagate the metadata attached to this vector in case there's a `:clj-kondo/ignore` form.
(vary-meta (first (:children node)) (partial merge (meta require-node) (meta node)))
(let [symbol-node (first (:children node))]
(hooks.common/merge-ignored-linters symbol-node require-node node))
;; this should also be dead code since we require requires to be vectors
(hooks/token-node? node)
(vary-meta node (partial merge (meta require-node)))
(hooks.common/merge-ignored-linters node require-node)
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
@@ -283,8 +295,7 @@
ns-form-node->require-node
require-node->namespace-symb-nodes)]
(doseq [node required-namespace-symb-nodes
:let [clj-kondo-ignore (some-> (meta node) :clj-kondo/ignore hooks/sexpr set)]
:when (not (contains? clj-kondo-ignore :metabase/ns-module-checker))
:when (not (contains? (hooks.common/ignored-linters node) :metabase/ns-module-checker))
:let [required-namespace (hooks/sexpr node)
required-module (module required-namespace)]
;; ignore stuff not in a module i.e. non-Metabase stuff.

View File

@@ -4,114 +4,7 @@
[clojure.string :as str]
[hooks.common]))
(def ^:private disallowed-parallel-forms
"Things you should not be allowed to use inside parallel tests. Besides these, anything ending in `!` not whitelisted
in [[allowed-parallel-forms]] is not allowed."
'#{clojure.core/alter-var-root
clojure.core/with-redefs
clojure.core/with-redefs-fn
metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.sandbox.test-util/with-gtaps-for-user!
metabase-enterprise.sandbox.test-util/with-user-attributes
metabase-enterprise.test/with-gtaps!
metabase-enterprise.test/with-gtaps-for-user!
metabase-enterprise.test/with-user-attributes
metabase.actions.test-util/with-actions
metabase.actions.test-util/with-actions-disabled
metabase.actions.test-util/with-actions-enabled
metabase.actions.test-util/with-actions-test-data
metabase.actions.test-util/with-actions-test-data-and-actions-enabled
metabase.actions.test-util/with-actions-test-data-tables
metabase.analytics.snowplow-test/with-fake-snowplow-collector
metabase.email-test/with-expected-messages
metabase.email-test/with-fake-inbox
metabase.test.data.users/with-group
metabase.test.data.users/with-group-for-user
metabase.test.persistence/with-persistence-enabled
metabase.test.util.log/with-log-level
metabase.test.util.log/with-log-messages-for-level
metabase.test.util.misc/with-single-admin-user
metabase.test.util/with-all-users-permission
metabase.test.util/with-discarded-collections-perms-changes
metabase.test.util/with-env-keys-renamed-by
metabase.test.util/with-locale
metabase.test.util/with-non-admin-groups-no-root-collection-for-namespace-perms
metabase.test.util/with-non-admin-groups-no-root-collection-perms
metabase.test.util/with-temp-env-var-value
metabase.test.util/with-temp-vals-in-db
metabase.test.util/with-temporary-raw-setting-values
metabase.test.util/with-temporary-setting-values
metabase.test.util/with-user-in-groups
metabase.test/with-actions
metabase.test/with-actions-disabled
metabase.test/with-actions-enabled
metabase.test/with-actions-test-data
metabase.test/with-actions-test-data-and-actions-enabled
metabase.test/with-actions-test-data-tables
metabase.test/with-all-users-permission
metabase.test/with-discarded-collections-perms-changes
metabase.test/with-env-keys-renamed-by
metabase.test/with-expected-messages
metabase.test/with-fake-inbox
metabase.test/with-group
metabase.test/with-group-for-user
metabase.test/with-locale
metabase.test/with-log-level
metabase.test/with-log-messages-for-level
metabase.test/with-non-admin-groups-no-root-collection-for-namespace-perms
metabase.test/with-non-admin-groups-no-root-collection-perms
metabase.test/with-persistence-enabled
metabase.test/with-single-admin-user
metabase.test/with-temp-env-var-value
metabase.test/with-temp-vals-in-db
metabase.test/with-temporary-raw-setting-values
metabase.test/with-temporary-setting-values
metabase.test/with-user-in-groups})
;;; TODO -- we should disallow `metabase.test/user-http-request` with any method other than `:get`
(def ^:private allowed-parallel-forms
"These fns are destructive, but are probably fine inside ^:parallel tests because it usually means you're doing
something to an atom or something like that."
'#{clojure.core/assoc!
clojure.core/compare-and-set!
clojure.core/conj!
clojure.core/disj!
clojure.core/dissoc!
clojure.core/persistent!
clojure.core/pop!
clojure.core/reset!
clojure.core/reset-vals!
clojure.core/run!
clojure.core/swap!
clojure.core/swap-vals!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.core.async/<!
clojure.core.async/<!!
clojure.core.async/>!
clojure.core.async/>!!
clojure.core.async/alt!
clojure.core.async/alt!!
clojure.core.async/alts!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/ioc-alts!
clojure.core.async/offer!
clojure.core.async/onto-chan!
clojure.core.async/onto-chan!!
clojure.core.async/poll!
clojure.core.async/put!
clojure.core.async/take!
clojure.core.async/to-chan!
clojure.core.async/to-chan!!
metabase.driver.sql-jdbc.execute/execute-prepared-statement!
metabase.pulse/send-pulse!
metabase.query-processor.store/store-database!
next.jdbc/execute!})
(defn- warn-about-disallowed-parallel-forms [form]
(defn- warn-about-disallowed-parallel-forms [form config]
(letfn [(error! [form message]
(hooks/reg-finding! (assoc (meta form)
:message message
@@ -119,12 +12,12 @@
(f [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(cond
(disallowed-parallel-forms qualified-symbol)
(error! form (format "%s is not allowed inside a ^:parallel test or test fixture" qualified-symbol))
(contains? (:parallel/unsafe config) qualified-symbol)
(error! form (format "%s is not allowed inside a ^:parallel test or test fixture [:metabase/validate-deftest]" qualified-symbol))
(and (not (allowed-parallel-forms qualified-symbol))
(and (not (contains? (:parallel/safe config) qualified-symbol))
(str/ends-with? (name qualified-symbol) "!"))
(error! form (format "destructive functions like %s are not allowed inside a ^:parallel test or test fixture. If this should be allowed, add it to the whitelist in .clj-kondo/hooks/clojure/test.clj"
(error! form (format "destructive functions like %s are not allowed inside a ^:parallel test or test fixture. If this should be allowed, add it to the whitelist in the Kondo config file [:metabase/validate-deftest]"
qualified-symbol)))))
(walk [form]
(f form)
@@ -135,7 +28,7 @@
(defn- deftest-check-parallel
"1. Check if test is marked ^:parallel / ^:synchronized correctly
2. Make sure disallowed forms are not used in ^:parallel tests"
[{[_ test-name & body] :children, :as _node}]
[{[_ test-name & body] :children, :as _node} config]
(let [test-metadata (:meta test-name)
metadata-sexprs (map hooks/sexpr test-metadata)
combined-metadata (transduce
@@ -152,9 +45,9 @@
(hooks/reg-finding! (assoc (meta test-name)
:message "Test should not be marked both ^:parallel and ^:synchronized"
:type :metabase/validate-deftest)))
;; only when the custom `:metabase/deftest-not-marked-parallel` is enabled: complain if tests are not explicitly
;; marked `^:parallel` or `^:synchronized`. This is mostly to encourage people to mark everything `^:parallel` in
;; places like `metabase.lib` tests unless there is a really good reason not to.
;; only when the custom `:metabase/deftest-not-marked-parallel-or-synchronized` is enabled: complain if tests are
;; not explicitly marked `^:parallel` or `^:synchronized`. This is mostly to encourage people to mark everything
;; `^:parallel` in places like `metabase.lib` tests unless there is a really good reason not to.
(when-not (or parallel? synchronized?)
(hooks/reg-finding!
(assoc (meta test-name)
@@ -162,59 +55,31 @@
:type :metabase/deftest-not-marked-parallel-or-synchronized)))
(when parallel?
(doseq [form body]
(warn-about-disallowed-parallel-forms form)))))
(def ^:private number-of-lines-for-a-test-to-be-considered-horrifically-long
200)
(warn-about-disallowed-parallel-forms form config)))))
(defn- deftest-check-not-horrifically-long
[node]
[node {:keys [max-length], :as _config}]
(let [{:keys [row end-row]} (meta node)]
(when (and row end-row)
(let [num-lines (- end-row row)]
(when (>= num-lines number-of-lines-for-a-test-to-be-considered-horrifically-long)
(when (and max-length
(>= num-lines max-length))
(hooks/reg-finding! (assoc (meta node)
:message (str (format "This test is horrifically long, it's %d lines! 😱 " num-lines)
"Do you really want to try to debug it if it fails? 💀 "
"Split it up into smaller tests! 🥰")
:type :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests)))))))
;;; don't include `:h2` since that will probably lead to a mountain of tests where we are specifically testing
;;; middleware or compilation behavior with just H2 since it's the default.
(def driver-keywords
#{;; core drivers
#_:h2
:postgres
:mysql
;; module drivers
:athena
:bigquery-cloud-sdk
:druid
:druid-jdbc
:googleanalytics
:mongo
:oracle
:presto-jdbc
:redshift
:snowflake
:sparksql
:sqlite
:sqlserver
:vertica})
(defn- ignore? [node error-type]
(when-let [ignores (some-> node meta :clj-kondo/ignore hooks/sexpr)]
(when-let [ignores (cond
(coll? ignores) (set ignores)
(keyword? ignores) #{ignores})]
(contains? ignores error-type))))
(contains? (hooks.common/ignored-linters node) error-type))
(defn deftest-check-no-driver-keywords [node]
(defn deftest-check-no-driver-keywords [node {:keys [drivers], :as _config}]
;; fail fast after we see the first error, where we see one hardcoded driver name there are likely several more and we
;; don't need multiple warnings for a single test.
(letfn [(f [node]
(when (and (hooks/keyword-node? node)
(driver-keywords (hooks/sexpr node)))
(set? drivers)
(contains? drivers (hooks/sexpr node)))
(hooks/reg-finding! (assoc (meta node)
:message (format "Do not hardcode driver name %s in driver tests! [:metabase/disallow-hardcoded-driver-names-in-tests]"
(hooks/sexpr node))
@@ -237,14 +102,14 @@
(:children node))))]
(walk node)))
(defn deftest [{:keys [node cljc lang]}]
(defn deftest [{:keys [node cljc lang config]}]
;; run [[deftest-check-parallel]] only once... if this is a `.cljc` file only run it for the `:clj` analysis, no point
;; in running it twice.
(when (or (not cljc)
(= lang :clj))
(deftest-check-parallel node))
(deftest-check-not-horrifically-long node)
(deftest-check-no-driver-keywords node)
(deftest-check-parallel node (get-in config [:linters :metabase/validate-deftest])))
(deftest-check-not-horrifically-long node (get-in config [:linters :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]))
(deftest-check-no-driver-keywords node (get-in config [:linters :metabase/disallow-hardcoded-driver-names-in-tests]))
{:node node})
;;; this is a hacky way to determine whether these namespaces are required in the `ns` form or not... basically `:ns`
@@ -286,6 +151,6 @@
(warn-about-missing-test-expr-requires-in-cljs node))
{:node node})
(defn use-fixtures [{:keys [node]}]
(warn-about-disallowed-parallel-forms node)
(defn use-fixtures [{:keys [node config]}]
(warn-about-disallowed-parallel-forms node config)
{:node node})

View File

@@ -1,7 +1,8 @@
(ns hooks.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
[clojure.pprint]
[clojure.set :as set]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
@@ -9,10 +10,83 @@
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-node)))))
;;; Kondo stores information about ignored linters as rewrite-clj forms matching how they are specified in the code, so
;;; either
;;;
;;; <vector-node [<token-node :discouraged-namespace>]>
;;;
;;; or
;;;
;;; <token-node :discouraged-namespace>
;;;
;;; these are stored in
;;;
;;; (-> node meta :clj-kondo/ignore :linters).
;;;
;;; These are not a convenient shape(s) to work with, so the next few functions abstract that shape out and work with a
;;; set of keywords like
;;;
;;; #{:discouraged-namespace}
;;;
;;; instead.
(defn- unwrap-ignored-linters [linters]
(cond
(or (hooks/vector-node? linters)
(hooks/list-node? linters))
(into #{}
(map hooks/sexpr)
(:children linters))
(hooks/keyword-node? linters)
#{(hooks/sexpr linters)}
(and (set? linters)
(every? keyword? linters))
linters
(and (sequential? linters)
(every? keyword? linters))
(into #{} linters)
(keyword? linters)
#{linters}))
(defn- wrap-ignored-linters [linters]
(hooks/vector-node (mapv hooks/keyword-node linters)))
(defn ignored-linters
"Return a set of keywords all ignored linters associated with a node by looking at its metadata."
[node]
(or (some-> node meta :clj-kondo/ignore :linters unwrap-ignored-linters)
;; deal with the old pre-2024.09 shape mentioned in https://github.com/clj-kondo/clj-kondo/issues/2414
(some-> node :meta first hooks/sexpr :clj-kondo/ignore unwrap-ignored-linters)))
(defn update-ignored-linters
"Update the `:clj-kondo/ignore` linters in `node`'s metadata. `linters` should be a set of keywords."
[node f & args]
(letfn [(apply-f [linters]
(apply f linters args))
(update-linters [linters]
(-> (or (unwrap-ignored-linters linters)
#{})
apply-f
wrap-ignored-linters))]
(vary-meta node update-in [:clj-kondo/ignore :linters] update-linters)))
(defn merge-ignored-linters
"Merge the ignored linters from `source-nodes` into `node`. You can use this to propagate
ignored linters from parent nodes to child nodes."
[node & source-nodes]
(if-let [linters (not-empty (transduce (map ignored-linters) set/union #{} source-nodes))]
(update-ignored-linters node set/union linters)
node))
;;; This stuff is to help debug hooks. Trace a function and it will pretty-print the before & after sexprs.
;;;
;;; (hooks.common/trace #'calculate-bird-scarcity)
#_{:clj-kondo/ignore [:discouraged-var]}
(defn- trace* [f]
{:pre [(fn? f)]}
(fn traced-fn [node]
@@ -42,13 +116,14 @@
;;;; Common hook definitions
(defn do*
"This is the same idea as [[clojure.core/do]] but doesn't cause Kondo to complain about redundant dos or unused values."
"This is the same idea as [[clojure.core/do]] but doesn't cause Kondo to complain about redundant dos or unused
values."
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(update-ignored-linters (hooks/token-node 'do) conj :redundant-do)
(for [arg args]
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(update-ignored-linters arg conj :unused-value))))
(with-meta (meta node)))]
{:node node*}))
@@ -288,8 +363,8 @@
(-> (hooks/vector-node
[(hooks/vector-node (map :model binding-infos))
(-> (hooks/list-node (list* (hooks/token-node `let)
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(with-meta (meta body)))])
(with-meta (meta body)))))
@@ -364,14 +439,58 @@
where the first arg should be linted and appear to be used."
[{{[_ arg & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
{:node node*}))
(defn node->qualified-symbol [node]
(defn with-used-first-two-args
"For macros like
(with-limit-and-offset limit offset
...)
=>
(let [_123 limit
[_456 offset]
...)
where the first arg should be linted and appear to be used."
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_")) x
(hooks/token-node (gensym "_")) y])
body))]
{:node node*}))
(defn with-vec-first-binding
"For macros like
(with-temp-file [binding \"temp.txt\" \"content\"]
(slurp binding))
=>
(let [binding nil]
(slurp binding))
where the first arg is a vector of bindings."
[{{[_ {[x & _args] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn node->qualified-symbol
"If the node is a symbol, return it as a qualified symbol if it's not already. Otherwise return nil."
[node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
@@ -381,8 +500,8 @@
(and resolved (:ns resolved))
(symbol (name (:ns resolved)) (name (:name resolved)))
;; if it wasn't resolved but is still qualified it's probably using the full namespace name rather than an
;; alias.
;; if it wasn't resolved but is still qualified it's probably using the full namespace name rather than an
;; alias.
(qualified-symbol? sexpr)
sexpr)))))
;; some symbols like `*count/Integer` aren't resolvable.
@@ -407,3 +526,12 @@
;; should be 1
(format-string-specifier-count "%-02d"))
(defn add-lsp-ignore-unused-public-var-metadata
"Add
^{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
metadata to a node to suppress LSP warnings."
[node]
(update-ignored-linters node conj :clojure-lsp/unused-public-var))

View File

@@ -4,8 +4,8 @@
(comment
(def input (hooks/parse-string
"(with-indexed-model [{:keys [model model-index model-index-value]}
{:query :some-query}]
"(with-indexed-model! [{:keys [model model-index model-index-value]}
{:query :some-query}]
:foo :bar :body)"))
(println (hooks/sexpr input))
@@ -13,12 +13,12 @@
(let [f (load-file ".clj-kondo/hooks/metabase/api/automagic_dashboards_test.clj")]
(f {:node input})))
(defn with-indexed-model
(defn with-indexed-model!
[{node :node}]
(let [[_macro-call binding-and-query-info & body] (:children node)
[binding query-info] (:children binding-and-query-info)
node* (hooks/list-node
[(hooks/token-node 'do-with-testing-model)
[(hooks/token-node 'do-with-indexed-model!)
query-info
(hooks/list-node
(list* (hooks/token-node 'fn)

View File

@@ -1,7 +1,8 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]))
[clojure.string :as str]
[hooks.common]))
(defn route-fn-name
"route fn hook"
@@ -15,31 +16,17 @@
[arg]
(letfn [(update-defendpoint [node]
(let [[_defendpoint method route & body] (:children node)]
(api/list-node
(list
(api/token-node 'do)
(api/token-node (symbol "compojure.core" (str (api/sexpr method))))
(-> (api/list-node
(-> (api/list-node
(list
(api/token-node 'do)
(-> (api/token-node (symbol "compojure.core" (str (api/sexpr method))))
(with-meta (meta method)))
(api/list-node
(list*
(api/token-node 'clojure.core/defn)
(api/token-node (route-fn-name (api/sexpr method) (api/sexpr route)))
body))
(with-meta (meta node)))))))]
(-> (api/token-node (route-fn-name (api/sexpr method) (api/sexpr route)))
(with-meta (meta route)))
body))))
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)))]
(update arg :node update-defendpoint)))
(comment
(-> {:node (-> '(api/defendpoint POST "/:id/copy"
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*)))))
pr-str
api/parse-string)}
defendpoint
:node
api/sexpr))

View File

@@ -0,0 +1,25 @@
(ns hooks.metabase.channel.template.handlebars-helper
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn defhelper
"defhelper hook"
[{:keys [node]}]
(let [[_ helper-name description argvec & body] (:children node)
helper-fn-name (symbol (str (hooks/sexpr helper-name) "*"))]
{:node (-> (hooks/list-node
(list (hooks/token-node 'do)
(hooks/list-node
(list (hooks/token-node 'defn)
(hooks/token-node helper-fn-name)
description
argvec
(hooks/list-node body)))
(hooks/list-node
(list (hooks/token-node 'defn)
helper-name
description
argvec
(hooks/list-node body)))))
(with-meta (meta node)))}))

View File

@@ -4,9 +4,9 @@
(defn with-testing-against-standard-queries [{{[_ & args] :children} :node}]
(let [[query-sym & body] args
node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[query-sym (hooks/token-node 'nil)])
body))]
(list*
(hooks/token-node 'let)
(hooks/vector-node
[query-sym (hooks/token-node 'nil)])
body))]
{:node node*}))

View File

@@ -1,5 +1,7 @@
(ns hooks.metabase.models.interface
(:require [clj-kondo.hooks-api :as hooks]))
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn define-hydration-method
"This is used for both [[metabase.models.interface/define-simple-hydration-method]] and
@@ -14,5 +16,6 @@
(hooks/token-node 'defn)
fn-name
fn-tail))))
(with-meta (update (meta node) :clj-kondo/ignore #(hooks/vector-node (cons :clojure-lsp/unused-public-var (:children %))))))]
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)]
{:node node}))

View File

@@ -21,6 +21,7 @@
database-enable-actions
deprecation-notice-version
dismissed-custom-dashboard-toast
dismissed-onboarding-sidebar-link
email-configured?
email-from-address
email-from-name
@@ -161,6 +162,7 @@
token-features
token-status
toucan-name
trial-banner-dismissal-timestamp
uncached-setting
user-visibility
version
@@ -181,12 +183,13 @@
setter-node (-> (list
(hooks/token-node 'defn)
(with-meta
(hooks/token-node (symbol (str (hooks/sexpr setting-name) \!)))
(meta setting-name))
(hooks/token-node (symbol (str (hooks/sexpr setting-name) \!)))
(meta setting-name))
(hooks/string-node "Docstring.")
(hooks/vector-node [(hooks/token-node '_value-or-nil)]))
hooks/list-node
(with-meta (update (meta node) :clj-kondo/ignore #(hooks/vector-node (cons :clojure-lsp/unused-public-var (:children %))))))]
(with-meta (meta node))
common/add-lsp-ignore-unused-public-var-metadata)]
(when (nil? (second (drop-while (comp not #{[:k :export?]} first) options-list)))
(when-not (contains? ignored-implicit-export? (:value setting-name))
@@ -242,14 +245,14 @@
(comment
(defn- defsetting* [form]
(hooks/sexpr
(:node
(defsetting
{:node
(hooks/parse-string
(with-out-str
#_{:clj-kondo/ignore [:unresolved-namespace]}
(clojure.pprint/pprint
form)))}))))
(:node
(defsetting
{:node
(hooks/parse-string
(with-out-str
#_{:clj-kondo/ignore [:unresolved-namespace]}
(clojure.pprint/pprint
form)))}))))
(defn x []
(defsetting*

View File

@@ -1,6 +1,7 @@
(ns hooks.metabase.public-settings.premium-features
(:require
[clj-kondo.hooks-api :as hooks]))
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn defenterprise [{node :node}]
(let [[_defenterprise fn-name & args] (:children node)
@@ -26,7 +27,8 @@
fn-name
docstring))
fn-tail))
(with-meta (update (meta node) :clj-kondo/ignore #(hooks/vector-node (cons :clojure-lsp/unused-public-var (:children %))))))))}))
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)))}))
(comment
(defn- defenterprise* [form]

View File

@@ -0,0 +1,58 @@
(ns hooks.metabase.test.data.datasets
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.set :as set]
[hooks.common]))
(defn- only-core-drivers?
"Whether we're for sure only testing against the 'core' drivers that are also app DB types: `:postgres`, `:mysql`, or
`:h2`. Tests like these are ok to mark `:mb/once` or `:mb/driver-tests` since we always run the full test suite
against app DB drivers anyway."
[node]
(let [drivers (hooks/sexpr (second (:children node)))
drivers (cond
(keyword? drivers) #{drivers}
(set? drivers) drivers
:else nil)]
(when drivers
(empty? (set/difference drivers #{:h2 :mysql :postgres})))))
(defn- validate-mb-once [x]
(when (:mb/once (meta (:ns x)))
(hooks/reg-finding!
(assoc (meta (:ns x))
:message (str "You should not use test-driver or test-drivers in a namespace marked ^:mb/once"
" [:metabase/validate-mb-once]")
:type :metabase/validate-mb-once))))
(defn- validate-mb-driver-tests [x]
(when-not (:mb/driver-tests (meta (:ns x)))
(hooks/reg-finding!
(assoc (meta (:ns x))
:message (str "Namespaces that run driver tests (test-driver or test-drivers) should be marked"
" ^:mb/driver-tests [:metabase/validate-mb-driver-tests]")
:type :metabase/validate-mb-driver-tests))))
(defn- validate-ns-tags [x]
(when-not (only-core-drivers? (:node x))
(validate-mb-once x)
(validate-mb-driver-tests x)))
(defn test-drivers [x]
(validate-ns-tags x)
(letfn [(update-node [node]
(let [[test-drivers drivers-expr & body] (:children node)]
(-> (hooks/list-node
(list*
(hooks/token-node 'do)
test-drivers
(-> drivers-expr
(hooks.common/update-ignored-linters conj :unused-value))
body))
(with-meta (meta node)))))]
(update x :node update-node)))
(defn test-driver
"We can use the same hook for `test-driver` as we use for `test-drivers`."
[x]
(test-drivers x))

View File

@@ -27,11 +27,11 @@
(hooks/vector-node (into []
(mapcat (fn [[setting-name v]]
(concat
[(with-meta (hooks/token-node '_) (meta setting-name)) v]
[(with-meta (hooks/token-node '_) (meta setting-name)) v]
;; if the setting name is namespace-qualified add a `_`
;; entry for it too.
(when (namespaced-symbol-node? setting-name)
[(with-meta (hooks/token-node '_) (meta setting-name)) setting-name]))))
(when (namespaced-symbol-node? setting-name)
[(with-meta (hooks/token-node '_) (meta setting-name)) setting-name]))))
(partition 2 (:children bindings))))
bindings)]
{:node (-> (list*

View File

@@ -15,3 +15,17 @@
actual-arg-count)
:type :format))))))
x)
(defn case-enum
"Lint `(case-enum ...)` like `(condp = ...)`."
[x]
(letfn [(update-node [node]
(let [[_case-enum x & more] (:children node)]
(-> (api/list-node
(list*
(api/token-node 'clojure.core/condp)
(api/token-node 'clojure.core/=)
x
more))
(with-meta (meta node)))))]
(update x :node update-node)))

View File

@@ -109,8 +109,6 @@
actual-arg-count)
:type :metabase/validate-logging)))))
(defn infof
"Valid logf, debugf, etc."
[{:keys [node], :as x}]

View File

@@ -0,0 +1,26 @@
(ns hooks.metabase.util.log.capture
(:require
[clj-kondo.hooks-api :as api]))
(defn with-log-messages-for-level [x]
(letfn [(update-binding [[lhs-node _rhs-node]]
[lhs-node (api/list-node
(list
(api/token-node 'clojure.core/fn)
(api/vector-node [])))])
(update-bindings [bindings-node]
(-> (api/vector-node
(into []
(comp (partition-all 2)
(mapcat update-binding))
(:children bindings-node)))
(with-meta (meta bindings-node))))
(update-node [node]
(let [[_with-log-messages-for-level bindings & body] (:children node)]
(-> (api/list-node
(list*
(api/token-node 'clojure.core/let)
(update-bindings bindings)
body))
(with-meta (meta node)))))]
(update x :node update-node)))

View File

@@ -0,0 +1,54 @@
(ns hooks.clojure.core-test
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.test :refer :all]
[hooks.clojure.core]))
(deftest module-checker-allowed-modules-test
(let [findings (atom [])]
(with-redefs [hooks/reg-finding! (fn [node]
(swap! findings conj node))]
(hooks.clojure.core/lint-ns
{:node (hooks/parse-string "
(ns metabase.api.search
(:require
[metabase.request.core :as request]
[metabase.task :as task]))")
:config '{:linters {:metabase/ns-module-checker {:allowed-modules {metabase.api #{metabase.request}}
:api-namespaces {metabase.request #{metabase.request.core}}}}}})
(is (=? [{:message (str "Module metabase.task should not be used in the metabase.api module."
" [:metabase/ns-module-checker :allowed-modules metabase.api]")
:type :metabase/ns-module-checker}]
@findings)))))
(deftest module-checker-api-namespaces-test
(let [findings (atom [])]
(with-redefs [hooks/reg-finding! (fn [node]
(swap! findings conj node))]
(hooks.clojure.core/lint-ns
{:node (hooks/parse-string "
(ns metabase.api.search
(:require
[metabase.search.config :as search.config]
[metabase.search.core :as search]))")
:config '{:linters {:metabase/ns-module-checker {:allowed-modules {metabase.api #{metabase.search}}
:api-namespaces {metabase.search #{metabase.search.core}}}}}})
(is (=? [{:message (str "Namespace metabase.search.config is not an allowed external API namespace for the"
" metabase.search module. [:metabase/ns-module-checker :api-namespaces metabase.search]")
:type :metabase/ns-module-checker}]
@findings)))))
(deftest module-checker-api-namespaces-ignore-test
(let [findings (atom [])]
(with-redefs [hooks/reg-finding! (fn [node]
(swap! findings conj node))]
(hooks.clojure.core/lint-ns
{:node (hooks/parse-string "
(ns metabase.api.search
(:require
^{:clj-kondo/ignore [:metabase/ns-module-checker]}
[metabase.search.config :as search.config]
[metabase.search.core :as search]))")
:config '{:linters {:metabase/ns-module-checker {:allowed-modules {metabase.api #{metabase.search}}
:api-namespaces {metabase.search #{metabase.search.core}}}}}})
(is (empty? @findings)))))

View File

@@ -2,7 +2,7 @@
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.java.io :as io]
[clojure.edn :as edn]
[clojure.test :refer :all]
[hooks.clojure.test]))
@@ -14,10 +14,14 @@
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(hooks.clojure.test/deftest {:node (api/parse-string form)})
(hooks.clojure.test/deftest {:node (api/parse-string form)
:config {:linters
{:metabase/disallow-hardcoded-driver-names-in-tests
{:drivers
#{:athena}}}}})
(mapv :message @(:findings clj-kondo.impl.utils/*ctx*))))
(deftest disallow-hardcoded-driver-names-in-tests-test
(deftest ^:parallel disallow-hardcoded-driver-names-in-tests-test
(is (= []
(deftest-warnings
"(mt/test-drivers (mt/normal-drivers)
@@ -35,10 +39,17 @@
(when-not (= driver/*driver* :athena)
(do-something)))")))))
(deftest check-driver-keywords-test
(deftest ^:parallel check-driver-keywords-test
(testing "Make sure we keep hooks.clojure.test/driver-keywords up to date"
(doseq [^java.io.File file (.listFiles (io/file "modules/drivers"))
:when (.isDirectory file)
:let [driver (keyword (.getName file))]]
(is (contains? hooks.clojure.test/driver-keywords driver)
(format "hooks.clojure.test/driver-keywords should contain %s, please add it" driver)))))
(let [driver-keywords (-> (slurp ".clj-kondo/config.edn")
edn/read-string
(get-in [:linters :metabase/disallow-hardcoded-driver-names-in-tests :drivers]))
driver-modules (->> (slurp "modules/drivers/deps.edn")
edn/read-string
:deps
vals
(keep (comp keyword :local/root))
(into #{}))]
(doseq [driver driver-modules]
(is (contains? driver-keywords driver)
(format "hooks.clojure.test/driver-keywords should contain %s, please add it" driver))))))

View File

@@ -5,6 +5,35 @@
[clojure.test :refer :all]
[hooks.common]))
(deftest ^:parallel ignored-linters-test
(doseq [ignored [":metabase/ns-module-checker"
"[:metabase/ns-module-checker]"
"(:metabase/ns-module-checker)"]
prefix ["#_"
"^"]
:let [s (format "%s{:clj-kondo/ignore %s} [metabase.search.config :as search.config]"
prefix
ignored)]]
(testing (pr-str s)
(is (= #{:metabase/ns-module-checker}
(hooks.common/ignored-linters (api/parse-string s)))))))
(deftest ^:parallel merge-ignored-linters-test
(let [node-1 (api/parse-string "#_{:clj-kondo/ignore [:a]} [:a]")
node-2 (api/parse-string "#_{:clj-kondo/ignore [:b]} [:b]")
node-3 (api/parse-string "#_{:clj-kondo/ignore [:c]} [:c]")
node-1' (hooks.common/merge-ignored-linters node-1 node-2 node-3)]
(is (= #{:a :b :c}
(hooks.common/ignored-linters node-1')))
(testing "Updated metadata should match the shape Kondo expects"
(is (=? {:clj-kondo/ignore {:linters api/vector-node?}}
(meta node-1')))
(let [children (-> node-1' meta :clj-kondo/ignore :linters :children)]
(is (= (count children) 3))
(is (every? api/keyword-node? children))
(is (= [:a :b :c]
(sort (map api/sexpr children))))))))
(deftest ^:parallel node->qualified-symbol-test
(binding [clj-kondo.impl.utils/*ctx* {:namespaces (atom nil)}]
(is (= 'metabase.util.i18n/tru

View File

@@ -0,0 +1,35 @@
(ns hooks.metabase.api.common-test
(:require
[clj-kondo.hooks-api :as api]
[clojure.test :refer :all]
[hooks.metabase.api.common]))
(deftest ^:parallel defendpoint-test
(is (= '(do
compojure.core/POST
(clojure.core/defn
POST_:id_copy
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*))))))
(-> {:node (-> '(api/defendpoint POST "/:id/copy"
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*)))))
pr-str
api/parse-string)}
hooks.metabase.api.common/defendpoint
:node
api/sexpr))))

View File

@@ -0,0 +1,19 @@
(ns hooks.metabase.util.log.capture-test
(:require
[clj-kondo.hooks-api :as api]
[clojure.test :refer :all]
[hooks.metabase.util.log.capture]))
(deftest ^:parallel with-log-messages-for-level-test
(is (= '(clojure.core/let [messages-1 (clojure.core/fn [])
messages-2 (clojure.core/fn [])]
(concat (messages-1)
(messages-2)))
(-> (hooks.metabase.util.log.capture/with-log-messages-for-level
{:node (-> '(with-log-messages-for-level [messages-1 [my.namespace :debug]
messages-2 :info]
(concat (messages-1) (messages-2)))
pr-str
api/parse-string)})
:node
api/sexpr))))

View File

@@ -1,31 +1,348 @@
;; https://github.com/weavejester/cljfmt/blob/master/cljfmt/resources/cljfmt/indents/clojure.clj
{:extra-indents
{auto-parse [[:inner 0]]
cond-> [[:inner 0]]
check [[:inner 0]]
deferred-tru [[:inner 0]]
defprotocol+ [[:block 1] [:inner 1]]
potemkin/defprotocol+ [[:block 1] [:inner 1]]
let-404 [[:block 1]]
metabase.legacy-mbql.util/match-one [[:inner 0]]
merge-with [[:inner 0]]
metabase.test/dataset [[:inner 0]]
metabase.test/formatted-rows [[:inner 0]]
metabase.test/mbql-query [[:inner 0]]
metabase.test/test-drivers [[:inner 0]]
metabase.test/with-temporary-setting-values [[:block 1]]
;; If we just treat these as functions we can ignore this, despite some files not being consistent
;metabase.models.permissions/set-has-full-permissions-for-set? [[:inner 0]]
;metabase.models.permissions/set-has-full-permissions? [[:inner 0]]
;metabase.models.permissions/set-has-partial-permissions? [[:inner 0]]
metabase.models.permissions/set-has-partial-permissions-for-set? [[:inner 0]]
publish-event! [[:block 1]]
metabase.query-processor.streaming/streaming-response [[:inner 0]]
metabase.util/prog1 [[:inner 0]]
metabase.util/select-keys-when [[:inner 0]]
;; This supports a lot of existing formatting, but these are functions so the
;; existing formatting is probably wrong.
;toucan2.core/select [[:inner 0]]
;toucan2.core/update! [[:inner 0]]
}
:sort-ns-references? true}
;; Cljfmt config. See https://github.com/weavejester/cljfmt#formatting-options
{:sort-ns-references?
true
:function-arguments-indentation
:community
:parallel?
true
:paths
["src"
"test"
"enterprise/backend"
"bin/build"
"bin/lint-migrations-file"
"bin/release-list"
"modules/drivers"
".clj-kondo/src"
".clj-kondo/test"
#_"dev"]
;; See https://github.com/weavejester/cljfmt/blob/master/cljfmt/resources/cljfmt/indents/clojure.clj for the default
;; definitions
;;
;; [[:block 0]]
;; ^ number of special args
;;
;; `:block` indentation means format with all arguments indented 2 spaces except for the 'special' arguments which
;; normally are supposed to go on the first line. e.g. `let` gets [[:block 1]] because it has one 'special' arg.
;;
;; [[:inner 0]]
;; ^ depth
;; [[:inner 2 0]]
;; ^ argument index to restrict this rule to
;;
;; `:inner` indentation is like `:defn` indentation. `[[:inner 0]]` (default for `defn`) means all arguments at depth
;; zero get indented 2 spaces if not on the first line regardless of number of elements on the first line.
:extra-indents
{;; clojure.core stuff
fn* [[:inner 0]]
let* [[:block 1]]
with-meta [[:default]]
;; library stuff. Libraries that specify their own `:style/indent` specs are included in the section after this
;; since it is generated automatically.
clojure.core.logic/fresh [[:block 1]]
clojure.core.logic/matcha [[:block 1]]
clojure.core.logic/run [[:block 2]]
clojure.core.match/match [[:block 1]]
clojure.test.check.properties/for-all [[:block 1]]
clojure.test.check.properties/for-all* [[:block 1]]
clojure.test.check/quick-check [[:block 1]]
clojure.tools.macro/macrolet [[:block 1] [:inner 2 0]]
clojurewerkz.quartzite.jobs/build [[:default]]
clojurewerkz.quartzite.jobs/with-description [[:default]]
clojurewerkz.quartzite.jobs/with-identity [[:default]]
clojurewerkz.quartzite.schedule.cron/schedule [[:default]]
clojurewerkz.quartzite.schedule.cron/with-misfire-handling-instruction-do-nothing [[:default]]
clojurewerkz.quartzite.triggers/build [[:default]]
clojurewerkz.quartzite.triggers/with-description [[:default]]
clojurewerkz.quartzite.triggers/with-identity [[:default]]
clojurewerkz.quartzite.triggers/with-priority [[:default]]
clojurewerkz.quartzite.triggers/with-schedule [[:default]]
def-map-type [[:block 2] [:inner 1]]
defprotocol+ [[:block 1] [:inner 1]]
defrecord+ [[:block 2] [:inner 1]]
deftype+ [[:block 2] [:inner 1]]
net.cgrand.macrovich/case [[:block 0]]
potemkin.namespaces/import-vars [[:default]]
potemkin.types/def-map-type [[:block 2] [:inner 1]]
potemkin.types/defprotocol+ [[:block 1] [:inner 1]]
potemkin.types/defrecord+ [[:block 2] [:inner 1]]
potemkin.types/deftype+ [[:block 2] [:inner 1]]
potemkin/def-map-type [[:block 2] [:inner 1]]
potemkin/defprotocol+ [[:block 1] [:inner 1]]
potemkin/defrecord+ [[:block 2] [:inner 1]]
potemkin/deftype+ [[:block 2] [:inner 1]]
potemkin/import-vars [[:default]]
taoensso.nippy/extend-freeze [[:inner 0]]
taoensso.nippy/extend-thaw [[:inner 0]]
throttle.core/with-throttling [[:block 1]]
;; the rest of the stuff in this list is generated automatically based on `:style/indent` specs
;; by running [[dev.generate-cljfmt-config/specs]]... use that code to update this list
metabase-enterprise.advanced-permissions.api.util-test/with-impersonations! [[:inner 0]]
metabase-enterprise.cache.config-test/with-temp-persist-models [[:block 1]]
metabase-enterprise.sandbox.test-util/with-gtaps! [[:inner 0]]
metabase-enterprise.sandbox.test-util/with-gtaps-for-user! [[:inner 0]]
metabase-enterprise.sandbox.test-util/with-user-attributes [[:block 2]]
metabase-enterprise.serialization.test-util/with-dbs [[:inner 0]]
metabase-enterprise.serialization.test-util/with-random-dump-dir [[:block 1]]
metabase-enterprise.serialization.test-util/with-world [[:block 0]]
metabase-enterprise.sso.integrations.jwt-test/with-users-with-email-deleted [[:block 1]]
metabase-enterprise.test/with-gtaps! [[:inner 0]]
metabase-enterprise.test/with-gtaps-for-user! [[:inner 0]]
metabase-enterprise.test/with-user-attributes [[:block 2]]
metabase.actions-test/with-actions-test-data-and-actions-permissively-enabled [[:block 0]]
metabase.actions.test-util/with-actions [[:block 1]]
metabase.actions.test-util/with-actions-disabled [[:block 0]]
metabase.actions.test-util/with-actions-enabled [[:block 0]]
metabase.actions.test-util/with-actions-test-data [[:inner 0]]
metabase.actions.test-util/with-actions-test-data-and-actions-enabled [[:block 0]]
metabase.actions.test-util/with-actions-test-data-tables [[:block 1]]
metabase.actions.test-util/with-empty-db [[:inner 0]]
metabase.actions.test-util/with-temp-test-data [[:inner 0]]
metabase.api.alert-test/with-alert-in-collection [[:block 1]]
metabase.api.card-test/with-cards-in-readable-collection [[:block 1]]
metabase.api.card-test/with-cards-in-writeable-collection [[:block 1]]
metabase.api.card-test/with-ordered-items [[:inner 0]]
metabase.api.card-test/with-temp-native-card! [[:block 1]]
metabase.api.card-test/with-temp-native-card-with-params! [[:block 1]]
metabase.api.collection-test/with-collection-hierarchy [[:block 1]]
metabase.api.collection-test/with-french-user-and-personal-collection [[:block 2]]
metabase.api.collection-test/with-some-children-of-collection [[:block 1]]
metabase.api.common/check [[:default]]
metabase.api.common/define-routes [[:block 0]]
metabase.api.common/let-404 [[:block 1]]
metabase.api.common.internal/auto-coerce [[:block 1]]
metabase.api.common.internal/auto-parse [[:block 1]]
metabase.api.common.internal-test/no-route-regexes [[:block 0]]
metabase.api.embed-test/do-response-formats [[:block 1]]
metabase.api.embed-test/with-embedding-enabled-and-new-secret-key [[:block 0]]
metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing [[:block 3]]
metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing [[:block 3]]
metabase.api.embed-test/with-new-secret-key [[:block 0]]
metabase.api.embed-test/with-temp-card [[:block 1]]
metabase.api.embed-test/with-temp-dashcard [[:block 1]]
metabase.api.preview-embed-test/with-embedding-enabled-and-new-secret-key [[:block 0]]
metabase.api.preview-embed-test/with-new-secret-key [[:block 0]]
metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing [[:block 3]]
metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing [[:block 3]]
metabase.api.public-test/with-temp-public-card [[:block 1]]
metabase.api.public-test/with-temp-public-dashboard [[:block 1]]
metabase.api.public-test/with-temp-public-dashboard-and-card [[:block 1]]
metabase.api.search-test/do-test-users [[:block 1]]
metabase.api.session/http-401-on-error [[:block 0]]
metabase.async.streaming-response/streaming-response [[:block 2]]
metabase.async.streaming-response-test/with-streaming-response-thread-pool [[:block 0]]
metabase.async.streaming-response-test/with-test-driver-db! [[:block 0]]
metabase.async.util/cancelable-thread [[:block 0]]
metabase.cmd.copy/step [[:block 1]]
metabase.cmd.copy/with-connection-rollback-only [[:block 1]]
metabase.cmd.copy/with-disabled-db-constraints [[:block 2]]
metabase.config/build-type-case [[:block 0]]
metabase.dashboard-subscription-test/with-link-card-fixture-for-dashboard [[:block 2]]
metabase.db.liquibase/with-liquibase [[:block 1]]
metabase.db.liquibase/with-scope-locked [[:block 1]]
metabase.db.schema-migrations-test.impl/test-migrations [[:block 2]]
metabase.db/with-application-db [[:inner 0]]
metabase.driver.bigquery-cloud-sdk.query-processor/with-temporal-type [[:default]]
metabase.driver.druid.client/DELETE [[:default]]
metabase.driver.druid.client/GET [[:default]]
metabase.driver.druid.client/POST [[:default]]
metabase.driver.druid.query-processor-test/druid-query [[:block 0]]
metabase.driver.druid.query-processor-test/druid-query-returning-rows [[:block 0]]
metabase.driver.mongo.query-processor/mongo-let [[:block 1]]
metabase.driver.sql-jdbc.actions/with-jdbc-transaction [[:block 1]]
metabase.driver.sql-jdbc.connection/with-connection-spec-for-testing-connection [[:block 1]]
metabase.driver.sql-jdbc.execute.diagnostic/capturing-diagnostic-info [[:block 1]]
metabase.driver.sql.query-processor/apply-top-level-clause [[:default]]
metabase.driver/with-driver [[:block 1]]
metabase.lib.binning/with-binning [[:default]]
metabase.lib.core/with-binning [[:default]]
metabase.lib.core/with-join-alias [[:default]]
metabase.lib.core/with-join-conditions [[:default]]
metabase.lib.join/with-join-alias [[:default]]
metabase.lib.join/with-join-conditions [[:default]]
metabase.lib.test-util.macros/$ids [[:inner 0]]
metabase.lib.test-util.macros/mbql-query [[:inner 0]]
metabase.lib.util.match/match [[:inner 0]]
metabase.lib.util.match/match-one [[:inner 0]]
metabase.lib.util.match/replace [[:inner 0]]
metabase.lib.util.match/replace-in [[:inner 0]]
metabase.models.collection-test/with-collection-hierarchy [[:block 1]]
metabase.models.collection-test/with-current-user-perms-for-collections [[:block 1]]
metabase.models.collection-test/with-personal-and-impersonal-collections [[:block 1]]
metabase.models.dashboard-test/with-dash-in-collection [[:inner 0]]
metabase.models.interface/define-batched-hydration-method [[:inner 0]]
metabase.models.interface/define-simple-hydration-method [[:inner 0]]
metabase.models.params.chain-filter-test/with-clean-field-values-for-field [[:block 1]]
metabase.models.params.chain-filter-test/with-fk-field-to-field-remapping [[:block 0]]
metabase.models.params.chain-filter-test/with-human-readable-values-remapping [[:block 0]]
metabase.models.pulse-test/with-dashboard-subscription-in-collection [[:block 1]]
metabase.models.pulse-test/with-pulse-in-collection [[:inner 0]]
metabase.models.setting/defsetting [[:block 1]]
metabase.models.setting.multi-setting/define-multi-setting [[:inner 0]]
metabase.models.task-history/with-task-history [[:block 1]]
metabase.query-processor-test.pipeline-queries-test/pmbql-query [[:block 1]]
metabase.query-processor-test.pipeline-queries-test/run-pmbql-query [[:block 1]]
metabase.query-processor.debug/debug> [[:block 0]]
metabase.query-processor.error-type/deferror [[:block 1]]
metabase.query-processor.middleware.cache-backend.interface/with-cached-results [[:block 4]]
metabase.query-processor.middleware.process-userland-query-test/with-query-execution [[:block 1]]
metabase.query-processor.store/cached [[:block 1]]
metabase.query-processor.store/with-metadata-provider [[:inner 0]]
metabase.query-processor.streaming/streaming-response [[:block 1]]
metabase.query-processor.test-util/format-rows-by [[:default]]
metabase.request.core/as-admin [[:block 0]]
metabase.request.core/with-current-request [[:inner 0]]
metabase.request.core/with-current-user [[:inner 0]]
metabase.request.core/with-limit-and-offset [[:inner 0]]
metabase.request.session/as-admin [[:block 0]]
metabase.request.session/with-current-user [[:inner 0]]
metabase.sample-data-test/with-temp-sample-database-db [[:block 1]]
metabase.server.middleware.session/as-admin [[:block 0]]
metabase.server.middleware.session/with-current-user [[:inner 0]]
metabase.sync.fetch-metadata/log-if-error [[:block 1]]
metabase.sync.sync-metadata.fields-test/with-test-db [[:block 0]]
metabase.sync.util/do-with-start-and-finish-debug-logging [[:default]]
metabase.sync.util/sum-for [[:block 1]]
metabase.sync.util/sync-operation [[:block 3]]
metabase.sync.util/with-db-logging-disabled [[:default]]
metabase.sync.util/with-duplicate-ops-prevented [[:default]]
metabase.sync.util/with-emoji-progress-bar [[:block 1]]
metabase.sync.util/with-error-handling [[:block 1]]
metabase.sync.util/with-start-and-finish-logging [[:default]]
metabase.sync.util/with-start-and-finish-logging* [[:default]]
metabase.sync.util/with-sync-events [[:default]]
metabase.test/$ids [[:inner 0]]
metabase.test/as-admin [[:inner 0]]
metabase.test/dataset [[:inner 0]]
metabase.test/discard-setting-changes [[:block 1]]
metabase.test/format-rows-by [[:default]]
metabase.test/let-url [[:block 1]]
metabase.test/mbql-query [[:inner 0]]
metabase.test/native-query [[:block 0]]
metabase.test/query [[:block 1]]
metabase.test/run-mbql-query [[:inner 0]]
metabase.test/test-driver [[:inner 0]]
metabase.test/test-drivers [[:inner 0]]
metabase.test/test-helpers-set-global-values! [[:block 0]]
metabase.test/throw-if-called! [[:block 1]]
metabase.test/with-actions [[:block 1]]
metabase.test/with-actions-disabled [[:block 0]]
metabase.test/with-actions-enabled [[:block 0]]
metabase.test/with-actions-test-data [[:inner 0]]
metabase.test/with-actions-test-data-and-actions-enabled [[:block 0]]
metabase.test/with-actions-test-data-tables [[:block 1]]
metabase.test/with-additional-premium-features [[:block 1]]
metabase.test/with-current-user [[:inner 0]]
metabase.test/with-driver [[:block 1]]
metabase.test/with-empty-db [[:inner 0]]
metabase.test/with-empty-h2-app-db [[:block 0]]
metabase.test/with-metadata-provider [[:inner 0]]
metabase.test/with-premium-features [[:block 1]]
metabase.test/with-temp [[:inner 0]]
metabase.test/with-temp-copy-of-db [[:block 0]]
metabase.test/with-temp-scheduler [[:block 0]]
metabase.test/with-temp-test-data [[:inner 0]]
metabase.test/with-temp-vals-in-db [[:block 3]]
metabase.test/with-test-user [[:inner 0]]
metabase.test/with-user-in-groups [[:inner 0]]
metabase.test.data/$ids [[:inner 0]]
metabase.test.data/dataset [[:inner 0]]
metabase.test.data/mbql-query [[:inner 0]]
metabase.test.data/native-query [[:block 0]]
metabase.test.data/query [[:block 1]]
metabase.test.data/run-mbql-query [[:inner 0]]
metabase.test.data/with-empty-h2-app-db [[:block 0]]
metabase.test.data/with-temp-copy-of-db [[:block 0]]
metabase.test.data.datasets/test-driver [[:inner 0]]
metabase.test.data.datasets/test-drivers [[:inner 0]]
metabase.test.data.one-off-dbs/with-blank-db [[:block 0]]
metabase.test.data.one-off-dbs/with-blueberries-db [[:block 0]]
metabase.test.data.users/with-test-user [[:inner 0]]
metabase.test.util/discard-setting-changes [[:block 1]]
metabase.test.util/let-url [[:block 1]]
metabase.test.util/throw-if-called! [[:block 1]]
metabase.test.util/with-temp-scheduler [[:block 0]]
metabase.test.util/with-temp-vals-in-db [[:block 3]]
metabase.test.util/with-user-in-groups [[:inner 0]]
metabase.test.util.public-settings/with-additional-premium-features [[:block 1]]
metabase.test.util.public-settings/with-premium-features [[:block 1]]
metabase.test.util.thread-local/test-helpers-set-global-values! [[:block 0]]
metabase.timeseries-query-processor-test.util/test-timeseries-drivers [[:block 0]]
metabase.timeseries-query-processor-test/run-mbql-query [[:inner 0]]
metabase.upload-test/with-upload-table! [[:inner 0]]
metabase.upload.types/with-currency [[:default]]
metabase.upload.types/with-parens [[:default]]
metabase.util/auto-retry [[:block 1]]
metabase.util/case-enum [[:block 1]]
metabase.util/ignore-exceptions [[:block 0]]
metabase.util/or-with [[:block 1]]
metabase.util/profile [[:block 1]]
metabase.util/prog1 [[:inner 0]]
metabase.util/varargs [[:inner 0]]
metabase.util/with-us-locale [[:block 0]]
metabase.util.date-2/with-time-zone-same-instant [[:default]]
metabase.util.encryption-test/with-secret-key [[:block 1]]
metabase.util.honey-sql-2/with-database-type-info [[:default]]
metabase.util.i18n/deferred-trs [[:default]]
metabase.util.i18n/deferred-tru [[:default]]
metabase.util.i18n/trs [[:default]]
metabase.util.i18n/trsn [[:default]]
metabase.util.i18n/tru [[:default]]
metabase.util.i18n/trun [[:default]]
metabase.util.jvm/auto-retry [[:block 1]]
metabase.util.jvm/varargs [[:block 1]]
metabase.util.jvm/with-us-locale [[:block 0]]
metabase.util.malli/disable-enforcement [[:block 0]]
metabase.util.malli/with [[:default]]
metabase.util.malli/with-api-error-message [[:default]]
metabase.util.namespaces/import-fns [[:default]]
metabuild-common.core/exit-when-finished-nonzero-on-exception [[:block 0]]
metabuild-common.core/step [[:block 1]]
metabuild-common.entrypoint/exit-when-finished-nonzero-on-exception [[:block 0]]
metabuild-common.steps/step [[:block 1]]
methodical.core/defmethod [[:inner 0]]
methodical.core/defmulti [[:inner 0]]
methodical.core/with-dispatcher [[:default]]
methodical.core/with-method-table [[:default]]
methodical.core/with-prefers [[:default]]
methodical.interface/with-dispatcher [[:default]]
methodical.interface/with-method-table [[:default]]
methodical.interface/with-prefers [[:default]]
methodical.macros/defmethod [[:inner 0]]
methodical.macros/defmulti [[:inner 0]]
saml20-clj.sp.response/validate-confirmation-datas [[:block 1]]
toucan2.connection/with-transaction [[:block 1]]
toucan2.core/build [[:block 0]]
toucan2.core/compile [[:block 0]]
toucan2.core/debug [[:block 0]]
toucan2.core/define-after-insert [[:inner 0]]
toucan2.core/define-after-select [[:inner 0]]
toucan2.core/define-after-update [[:inner 0]]
toucan2.core/define-before-delete [[:inner 0]]
toucan2.core/define-before-insert [[:inner 0]]
toucan2.core/define-before-select [[:inner 0]]
toucan2.core/define-default-fields [[:inner 0]]
toucan2.core/define-named-query [[:block 1]]
toucan2.core/deftransforms [[:block 1]]
toucan2.core/with-transaction [[:block 1]]
toucan2.tools.after/define-after-impl [[:default]]
toucan2.tools.after-insert/define-after-insert [[:inner 0]]
toucan2.tools.after-select/define-after-select [[:inner 0]]
toucan2.tools.after-update/define-after-update [[:inner 0]]
toucan2.tools.before-delete/define-before-delete [[:inner 0]]
toucan2.tools.before-insert/define-before-insert [[:inner 0]]
toucan2.tools.before-select/define-before-select [[:inner 0]]
toucan2.tools.compile/build [[:block 0]]
toucan2.tools.compile/compile [[:block 0]]
toucan2.tools.compile/resolved [[:block 0]]
toucan2.tools.debug/debug [[:block 0]]
toucan2.tools.default-fields/define-default-fields [[:inner 0]]
toucan2.tools.named-query/define-named-query [[:block 1]]
toucan2.tools.simple-out-transform/define-out-transform [[:inner 0]]
toucan2.tools.transformed/deftransforms [[:block 1]]
toucan2.tools.with-temp/with-temp [[:inner 0]]
toucan2.util/try-with-error-context [[:inner 0]]}}

View File

@@ -20,68 +20,67 @@
(clojure-mode
;; Specify which arg is the docstring for certain macros
;; (Add more as needed)
(eval . (put 'defendpoint-schema 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'define-premium-feature 'clojure-doc-string-elt 2))
(eval . (put 'api/defendpoint-schema 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'defsetting 'clojure-doc-string-elt 2))
(eval . (put 'setting/defsetting 'clojure-doc-string-elt 2))
(eval . (put 's/defn 'clojure-doc-string-elt 2))
(eval . (put 'p.types/defprotocol+ 'clojure-doc-string-elt 2))
(eval . (put 'methodical/defmethod 'clojure-doc-string-elt 3))
(eval . (put 'methodical/defmulti 'clojure-doc-string-elt 2))
(eval . (put 'mi/define-simple-hydration-method 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint-schema 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'define-premium-feature 'clojure-doc-string-elt 2))
(eval . (put 'api/defendpoint-schema 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'defsetting 'clojure-doc-string-elt 2))
(eval . (put 'setting/defsetting 'clojure-doc-string-elt 2))
(eval . (put 's/defn 'clojure-doc-string-elt 2))
(eval . (put 'p.types/defprotocol+ 'clojure-doc-string-elt 2))
(eval . (put 'methodical/defmethod 'clojure-doc-string-elt 3))
(eval . (put 'methodical/defmulti 'clojure-doc-string-elt 2))
(eval . (put 'mi/define-simple-hydration-method 'clojure-doc-string-elt 3))
(eval . (put 'mi/define-batched-hydration-method 'clojure-doc-string-elt 3))
(eval . (put 'mr/def 'clojure-doc-string-elt 2))
(eval . (put 'mu/defn 'clojure-doc-string-elt 2))
(eval . (put 'mr/def 'clojure-doc-string-elt 2))
(eval . (put 'mu/defn 'clojure-doc-string-elt 2))
;; Define custom indentation for functions inside metabase.
;; This list isn't complete; add more forms as we come across them.
;;
;; `put-clojure-indent' is a safe-local-eval-function, so use a bunch of calls to that
;; instead of one call to `define-clojure-indent'
(eval . (put-clojure-indent 'api/let-404 1))
(eval . (put-clojure-indent 'c/step 1))
(eval . (put-clojure-indent 'impl/test-migrations 2))
(eval . (put-clojure-indent 'let-404 0))
(eval . (put-clojure-indent 'lib.schema.match/match 1))
(eval . (put-clojure-indent 'lib.schema.match/match-one 1))
(eval . (put-clojure-indent 'lib.schema.match/replace 1))
(eval . (put-clojure-indent 'lib.schema.match/replace-in 2))
(eval . (put-clojure-indent 'lib.util.match/replace 1))
(eval . (put-clojure-indent 'macros/case 0))
(eval . (put-clojure-indent 'match 1))
(eval . (put-clojure-indent 'mi/define-methods '(:form)))
(eval . (put-clojure-indent 'mt/dataset 1))
(eval . (put-clojure-indent 'mt/format-rows-by 1))
(eval . (put-clojure-indent 'mt/query 1))
(eval . (put-clojure-indent 'mt/test-driver 1))
(eval . (put-clojure-indent 'mt/test-drivers 1))
(eval . (put-clojure-indent 'mt/with-anaphora 1))
(eval . (put-clojure-indent 'prop/for-all 1))
(eval . (put-clojure-indent 'api/let-404 1))
(eval . (put-clojure-indent 'c/step 1))
(eval . (put-clojure-indent 'impl/test-migrations 2))
(eval . (put-clojure-indent 'let-404 0))
(eval . (put-clojure-indent 'lib.schema.match/match '(:defn)))
(eval . (put-clojure-indent 'lib.schema.match/match-one '(:defn)))
(eval . (put-clojure-indent 'lib.schema.match/replace '(:defn)))
(eval . (put-clojure-indent 'lib.schema.match/replace-in '(:defn)))
(eval . (put-clojure-indent 'lib.util.match/replace '(:defn)))
(eval . (put-clojure-indent 'macros/case 0))
(eval . (put-clojure-indent 'match 1))
(eval . (put-clojure-indent 'mt/dataset 1))
(eval . (put-clojure-indent 'mt/format-rows-by '(:form)))
(eval . (put-clojure-indent 'mt/query 1))
(eval . (put-clojure-indent 'mt/test-driver 1))
(eval . (put-clojure-indent 'mt/test-drivers 1))
(eval . (put-clojure-indent 'mt/with-anaphora 1))
(eval . (put-clojure-indent 'prop/for-all 1))
(eval . (put-clojure-indent 'qp.streaming/streaming-response 1))
(eval . (put-clojure-indent 'tc/quick-check 1))
(eval . (put-clojure-indent 'u/profile 1))
(eval . (put-clojure-indent 'u/prog1 1))
(eval . (put-clojure-indent 'u/select-keys-when 1))
(eval . (put-clojure-indent 'with-meta '(:form)))
(eval . (put-clojure-indent 'tc/quick-check 1))
(eval . (put-clojure-indent 'u/profile 1))
(eval . (put-clojure-indent 'u/prog1 1))
(eval . (put-clojure-indent 'u/select-keys-when '(:form)))
(eval . (put-clojure-indent 'with-meta '(:form)))
;; these ones have to be done with `define-clojure-indent' for now because of upstream bug
;; https://github.com/clojure-emacs/clojure-mode/issues/600 once that's resolved we should use `put-clojure-indent'
;; instead. Please don't add new entries unless they don't work with `put-clojure-indent'
(eval . (define-clojure-indent
(l/matcha '(1 (:defn)))
(l/matche '(1 (:defn)))
(l/matcha '(1 (:defn)))
(l/matche '(1 (:defn)))
(p.types/def-abstract-type '(1 (:defn)))
(p.types/defprotocol+ '(1 (:defn)))
(p.types/defrecord+ '(2 nil nil (:defn)))
(p.types/deftype+ '(2 nil nil (:defn)))
(p/def-map-type '(2 nil nil (:defn)))
(p/defprotocol+ '(1 (:defn)))
(p/defrecord+ '(2 nil nil (:defn)))
(p/deftype+ '(2 nil nil (:defn)))
(tools.macro/macrolet '(1 ((:defn)) :form))))
(p.types/defprotocol+ '(1 (:defn)))
(p.types/defrecord+ '(2 nil nil (:defn)))
(p.types/deftype+ '(2 nil nil (:defn)))
(p/def-map-type '(2 nil nil (:defn)))
(p/defprotocol+ '(1 (:defn)))
(p/defrecord+ '(2 nil nil (:defn)))
(p/deftype+ '(2 nil nil (:defn)))
(tools.macro/macrolet '(1 ((:defn)) :form))))
(cider-clojure-cli-aliases . "dev:drivers:drivers-dev:ee:ee-dev:user")
(clojure-indent-style . always-align)
(cljr-favor-prefix-notation . nil)

View File

@@ -62,6 +62,13 @@ module.exports = {
warnOnUnassignedImports: false,
},
],
"sort-imports": [
"error",
{
// allows this rule to work with import/order
ignoreDeclarationSort: true,
},
],
"no-console": [2, { allow: ["warn", "error", "errorBuffer"] }],
"react/no-is-mounted": 2,
"react/prefer-es6-class": 2,
@@ -135,6 +142,7 @@ module.exports = {
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:depend/recommended",
"plugin:storybook/recommended",
],
settings: {
"import/internal-regex": "^metabase/|^metabase-lib/",
@@ -227,8 +235,9 @@ module.exports = {
"plugin:jest/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react",
"plugin:jest-formatting/recommended",
],
plugins: ["jest", "jest-dom", "testing-library"],
plugins: ["jest", "jest-dom", "testing-library", "jest-formatting"],
files: [
"*.unit.spec.ts",
"*.unit.spec.tsx",
@@ -239,5 +248,41 @@ module.exports = {
"jest/valid-title": ["error", { ignoreTypeOfDescribeName: true }],
},
},
{
// Enable jest formatting for cypress tests too, the plugin logic just works
extends: ["plugin:jest-formatting/recommended"],
files: ["*.cy.spec.ts", "*.cy.spec.js"],
},
{
files: ["frontend/src/**/*"],
rules: {
"no-restricted-syntax": [
"error",
{
selector: "Literal[value=/mb-base-color-/]",
message:
"You may not use base colors in the application, use semantic colors instead. (see colors.module.css)",
},
],
},
},
{
files: ["frontend/src/metabase/**/*"],
rules: {
"no-restricted-syntax": [
"error",
{
selector: "Literal[value=/mb-base-color-/]",
message:
"You may not use base colors in the application, use semantic colors instead. (see colors.module.css)",
},
{
selector:
"CallExpression[callee.property.name='legacyQuery'] > ObjectExpression > Property[key.name='useStructuredQuery'][value.value=true]",
message: "StructuredQuery usage is forbidden. Use MLv2",
},
],
},
},
],
};

6
.github/CODEOWNERS vendored
View File

@@ -1,14 +1,12 @@
# Before changing this file, make sure you have read how we use it:
# https://www.notion.so/metabase/Pull-Request-Code-Review-Guide-374f05df889748b69d67af753f9bc9b8?pvs=4#36550c04ceab40b5a8b8bee6264b090c
# TL;DR: if @camsaul hasn't been involved you're probably doing it wrong
src/metabase @camsaul
modules @camsaul
enterprise/backend @camsaul
enterprise/backend/src/metabase_enterprise/advanced_permissions @noahmoss
enterprise/backend/src/metabase_enterprise/audit_app @noahmoss
enterprise/backend/src/metabase_enterprise/sso @noahmoss
enterprise/backend/src/metabase_enterprise/task/truncate_audit_table.clj @noahmoss
enterprise/backend/src/metabase_enterprise/internal_user.clj @noahmoss
frontend/src/metabase/ui @metabase/core-frontend-admin-webapp
src/metabase/**/*permissions* @noahmoss
src/metabase/integrations @noahmoss
snowplow/* @metabase/data

View File

@@ -66,12 +66,13 @@ body:
Copy and paste the JSON from `Admin -> Troubleshooting`.
_This will be automatically formatted into code, so no need for backticks._
placeholder: |
- Your browser and the version: (e.g., Chrome 52.1, Firefox 48.0, Safari 11.1, …)
- Your operating system: (e.g., OS X 10.10, Windows 10.1809, Ubuntu 16.04, …)
- Your databases: (e.g, MySQL, Postgres, MongoDB, …)
- Metabase version: (e.g., 0.19.3)
- Metabase hosting environment: (e.g., Elastic Beanstalk, Docker, Heroku, Jar-file on Ubuntu, …)
- Metabase internal database: (e.g., H2 (default), Postgres or MySQL)
{"browser-info": {
"language": "en-US",
"platform": "MacIntel",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"vendor": "Google Inc."},
"metabase-info": {
"databases": [ "postgres",...
render: JSON
validations:
required: true

View File

@@ -5,20 +5,19 @@ about: This issue is used to track a feature/project that may span several days
and manage work.
title: "[Epic] Title"
labels: ".Epic"
---
**Links**
- product doc: _link to product doc_
- eng doc: _link to technical design doc, if any_
- feature branch: `branch-name` _this should be the feature branch where this work will be done in. PRs will be delivered against this branch_
- issue links: _related issues if any_
### Links
**Implementation Plan**
- [product doc](LINK_TO_PRODUCT_DOC)
- [technical design doc](LINK_TO_TECHNICAL_DESIGN_DOC)
- [testing plan](LINK_TO_TESTING_PLAN)
- feature branch: `BRANCH_NAME`
- issue links: _related issues, if any_
### Implementation Plan
***Milestone 1***
_insert tasklist here_
***Milestone 2***
```[tasklist]
#### Milestone 1
- [ ] _Add tasks here_
```

15
.github/actions/await-port/action.yml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Wait for localhost port to be ready
inputs:
port:
required: true
runs:
using: composite
steps:
- name: Wait for port ${{ inputs.port }} to be ready
shell: bash
run: |
while ! nc -z localhost ${{ inputs.port }}; do
sleep 0.1;
done

View File

@@ -1,70 +0,0 @@
name: Build E2E Matrix
description: Build and output a custom matrix for E2E tests.
outputs:
matrix:
description: Parameterized matrix in JSON format
value: ${{ steps.matrix.outputs.result }}
runs:
using: "composite"
steps:
- uses: actions/github-script@v7
id: matrix
with:
script: | # js
const java = 11;
const defaultRunner = "ubuntu-22.04";
const defaultOptions = {
"java-version": java,
runner: defaultRunner,
edition: "ee",
context: "folder"
};
const testSets = [
["actions", {} ],
["admin", {} ],
["admin-2", {} ],
["binning", {} ],
["collections", {} ],
["custom-column", {} ],
["dashboard", {} ],
["dashboard-cards", {} ],
["dashboard-filters", {} ],
["embedding", {} ],
["embedding-sdk", { context: "embedding-sdk" } ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],
["metrics", {} ],
["models", {} ],
["native", {} ],
["native-filters", {} ],
["onboarding", {} ],
["organization", {} ],
["permissions", {} ],
["question", {} ],
["question-reproductions", {} ],
["search", {}],
["sharing", {} ],
["visualizations-charts", {} ],
["visualizations-tabular", {} ],
["oss-subset", { edition: 'oss', context: "special" } ],
["slow", { context: "special" } ],
["flaky", { context: "special" } ],
["mongo", { context: "qa-database" } ],
];
const config = testSets.map(([name, specialOptions]) => {
return {
...defaultOptions,
...specialOptions,
name,
}
});
const matrix = { include: config };
return matrix;

View File

@@ -0,0 +1,132 @@
name: Build ee-extra
description: Build Metabase Enterprise Edition with extra features
inputs:
java-version:
required: true
# build with Java 11 since that's still officially what we target as a minimum and we don't want Java >11 bytecode
# sneaking in.
default: 11
iam-role:
description: "The IAM role to assume"
required: true
runs:
using: composite
steps:
- name: Prepare Java
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
- name: Reveal its original version.properties
run: jar xf ./bin/docker/metabase.jar version.properties && cat version.properties
shell: bash
- name: get major version
id: major_version
run: echo "major_version=$(cat version.properties | grep 'tag=' | cut -d'.' -f2)" >> $GITHUB_OUTPUT
shell: bash
- name: get drivers registry
run: |
curl -OL https://raw.githubusercontent.com/metabase/metabase-registry/main/registry.yaml
shell: bash
- uses: actions/setup-node@v4
with:
node-version: lts/Hydrogen # 18.x.x
- run: rm package.json && npm install yaml
shell: bash
- name: parse drivers registry
uses: actions/github-script@v7
id: drivers_registry
with:
script: | # js
const { parse } = require('yaml');
const fs = require('fs');
const registry = parse(fs.readFileSync('registry.yaml', 'utf8'));
const drivers = registry.drivers;
const majorVersion = '${{ steps.major_version.outputs.major_version }}';
const getDriverUrl = (driverName) => {
const driver = drivers.find(driver => driver.name === driverName);
if (!driver) {
throw new Error(`Driver ${driverName} not found in the registry`);
}
const driverUrl = driver.versions[majorVersion] ?? driver.versions.default;
if (!driverUrl) {
throw new Error(`Driver ${driverName} version ${majorVersion} not found in the registry`);
}
return driverUrl;
};
const extraDrivers = {
firebolt: getDriverUrl('firebolt'),
starburst: getDriverUrl('starburst'),
exasol: getDriverUrl('exasol'),
exasol_jdbc: drivers.find(d => d.name === 'exasol').deps[0],
clickhouse: getDriverUrl('clickhouse'),
ocient: getDriverUrl('ocient'),
materialize: getDriverUrl('materialize'),
};
console.log(extraDrivers);
return extraDrivers;
- name: Download Firebolt driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).firebolt }}
working-directory: modules
shell: bash
- name: Download Starburst driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).starburst }}
shell: bash
working-directory: modules
- name: Download Exasol driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).exasol }}
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).exasol_jdbc }}
shell: bash
working-directory: modules
- name: Download Clickhouse driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).clickhouse }}
shell: bash
working-directory: modules
- name: Download Ocient driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).ocient }}
shell: bash
working-directory: modules
- name: Download Materialize driver
run: |
curl -OL ${{ fromJson(steps.drivers_registry.outputs.result).materialize }}
shell: bash
working-directory: modules
- name: Bundle additional drivers into the Uberjar
run: jar uf bin/docker/metabase.jar modules/*.jar
shell: bash
- name: Launch uberjar
run: >-
java --add-opens java.base/java.nio=ALL-UNNAMED -jar ./bin/docker/metabase.jar &
shell: bash
- name: Wait for Metabase to start
run: while ! curl 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
shell: bash
- name: Kill the java process
run: pkill -f metabase.jar
shell: bash
- name: configure aws credentials
if: ${{ github.ref_name == 'master' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ inputs.iam-role }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
if: ${{ github.ref_name == 'master' }}
uses: aws-actions/amazon-ecr-login@v2

View File

@@ -10,24 +10,27 @@ inputs:
maildev:
description: Maildev container
required: true
default: 'false'
default: false
openldap:
description: OpenLDAP container
required: true
default: 'false'
default: false
postgres:
description: Postgres container
required: true
default: 'false'
default: false
mysql:
description: MySQL container
required: true
default: 'false'
default: false
mongo:
description: Mongo container
required: true
default: 'false'
default: false
webhook:
description: Webhook tester container
required: false
default: false
runs:
using: "composite"
@@ -84,4 +87,11 @@ runs:
while ! nc -z localhost 27004; do sleep 1; done &&
echo -e "${G}Mongo is up and running!"
fi
if ${{ inputs.webhook }}; then
echo -e "${Y}Starting webhook test container..." &&
docker run -d -p 9080:8080/tcp tarampampam/webhook-tester:1.1.0 serve --create-session 00000000-0000-0000-0000-000000000000 &&
while ! nc -z localhost 9080; do sleep 1; done &&
echo -e "${G}Webhook tester is up and running!"
fi
shell: bash

View File

@@ -2,10 +2,10 @@ name: Prepare back-end environment
inputs:
java-version:
required: true
default: '11'
default: '21'
clojure-version:
required: true
default: '1.11.1.1262'
default: '1.12.0.1488'
m2-cache-key:
description: 'Key to cache M2 packages from Maven Central'
required: true

View File

@@ -5,9 +5,9 @@
files:
# migrations related files
'resources/migrations/**':
- team:core-backend-components
- team:core-workflows
'src/metabase/db/custom_migrations.clj':
- team:core-backend-components
- team:core-workflows
options:
ignore_draft: true

View File

@@ -80,6 +80,7 @@ backend_specs: &backend_specs
- "modules/drivers/*/test/**"
- "test_config/**"
- "dev/**"
- "test_resources/**"
backend_all: &backend_all
- *default

View File

@@ -0,0 +1,110 @@
const fs = require("fs");
const logger = { debug: console.debug, error: console.error };
const collectTestsByType = ({ type, suite, path, cache = [] }) => {
logger.debug(`Collecting tests of type ${type}`);
const localCache = cache;
const { [type]: typeList, suites, tests } = suite;
for (const uuid of typeList) {
const foundTestByUuid = tests.find(test => test.uuid === uuid);
if (!foundTestByUuid) {
logger.error(`Test with uuid ${uuid} not found`);
throw new Error(`Test with uuid ${uuid} not found`);
}
logger.debug(`Found test with uuid ${uuid}`);
foundTestByUuid.path = path;
localCache.push({ path, ...foundTestByUuid });
}
for (const subSuite of suites) {
collectTestsByType({
type,
suite: subSuite,
path: subSuite.file || path,
cache: localCache,
});
}
return localCache;
};
const extractTestResultsInfo = ({ results, stats }) => {
logger.debug("Extracting test results information");
const testType = "failures";
const failedTests = results.flatMap(result =>
collectTestsByType({
type: testType,
suite: result,
path: result.file,
}),
);
logger.debug("Finished extracting test results information");
return {
failedTests,
};
};
function parseReport() {
const content = fs.readFileSync(
"./cypress/reports/cypress-test-report.json",
"utf-8",
);
const data = JSON.parse(content);
return extractTestResultsInfo(data).failedTests.map(test => ({
title: test.fullTitle,
error: test.err?.message,
path: test.path,
}));
}
exports.parseReport = parseReport;
const groupTestsByPath = report => {
return report.reduce((acc, item) => {
if (!acc[item.path]) {
acc[item.path] = [];
}
acc[item.path].push(item);
return acc;
}, {});
};
function formatSummary(report) {
const failedTestsByPath = groupTestsByPath(report);
let summary = "### Failed Tests Summary\n\n";
for (const [path, tests] of Object.entries(failedTestsByPath)) {
summary += `| ${path} |\n`;
summary += "| :--- |\n";
tests.forEach(test => {
summary += `| ${test.title}`;
summary += "<p></p>"; // adds extra space after title
summary += `<details>`;
summary += "<summary>❌ ";
summary += `<code>${truncateError(test.error)}</code>`;
summary += "</summary>";
summary += `<pre>${test.error}</pre>`.replaceAll("\n", "<br>");
summary += `</details> |\n`;
});
}
return summary;
}
function truncateError(error, maxLength = 100) {
if (error.length <= maxLength) return error;
return error.replaceAll("\n", "").substring(0, maxLength) + "...";
}
exports.formatSummary = formatSummary;

View File

@@ -10,9 +10,9 @@ export PATH="$PATH:$JAVA_HOME/bin"
which java
# install clojure version needed for Metabase
curl -O https://download.clojure.org/install/linux-install-1.11.0.1100.sh
chmod +x linux-install-1.11.0.1100.sh
./linux-install-1.11.0.1100.sh
curl -O https://download.clojure.org/install/linux-install-1.12.0.1488.sh
chmod +x linux-install-1.12.0.1488.sh
./linux-install-1.12.0.1488.sh
RESOURCES_DIR=/app/source/resources

45
.github/team.json vendored
View File

@@ -1,40 +1,43 @@
{
"teams": [
{
"name": "Querying Components",
"label": ".Team/QueryingComponents",
"name": "Querying",
"label": ".Team/Querying",
"projectUrl": "https://github.com/orgs/metabase/projects/97/views/1",
"members": [
"ranquild",
"kamilmielnik",
"nemanjaglumac",
"romeovs"
"romeovs",
"bshepherdson",
"metamben",
"lbrdnk",
"appleby",
"uladzimirdev",
"wzimrin"
]
},
{
"name": "Drivers",
"label": ".Team/Drivers",
"members": ["snoe"]
},
{
"name": "Embedding",
"label": ".Team/Embedding",
"projectUrl": "https://github.com/orgs/metabase/projects/88/views/1",
"members": ["WiNloSt", "deniskaber", "oisincoveney", "npretto", "heypoom"]
"members": ["WiNloSt", "oisincoveney", "npretto", "heypoom"]
},
{
"name": "BEC",
"label": ".Team/BackendComponents",
"name": "Workflows",
"label": ".Team/Workflows",
"projectUrl": "https://github.com/orgs/metabase/projects/50/views/1",
"members": [
"tsmacdonald",
"qnkhuat",
"calherries",
"piranha",
"crisptrutski"
"crisptrutski",
"deniskaber"
]
},
{
"name": "Query Processor",
"label": ".Team/QueryProcessor",
"projectUrl": "https://github.com/orgs/metabase/projects/83/views/8",
"members": ["camsaul", "snoe", "bshepherdson", "metamben", "lbrdnk", "appleby"]
},
{
"name": "Admin Webapp",
"label": ".Team/AdminWebapp",
@@ -45,7 +48,8 @@
"johnswanson",
"rafpaf",
"sloansparger",
"iethree"
"iethree",
"nvoxland"
]
},
{
@@ -53,17 +57,16 @@
"label": ".Team/DashViz",
"members": [
"alxnddr",
"EmmadUsmani",
"JesseSDevaney",
"kulyk",
"adam-james-v"
"adam-james-v",
"tsplude"
]
},
{
"name": "DevEx",
"label": ".Team/DevEx",
"members": [
"uladzimirdev"
"camsaul"
]
}
]

View File

@@ -7,6 +7,8 @@ on:
jobs:
be-linter-cloverage:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:

View File

@@ -12,9 +12,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
env:
CLJ_KONDO_VERSION: "2023.09.07"
jobs:
files-changed:
name: Check which files changed
@@ -70,23 +67,12 @@ jobs:
(needs.files-changed.outputs.backend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true')
runs-on: ubuntu-22.04
timeout-minutes: 10
env:
DOWNLOAD_URL: https://github.com/clj-kondo/clj-kondo/releases/download
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'kondo'
- name: Install clj-kondo
run: |
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256
cat clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256 >> SHA256sum.txt
echo " clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip" >> SHA256sum.txt
sha256sum -c SHA256sum.txt
unzip -d /usr/local/bin clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
- run: clj-kondo --version
- name: Run clj-kondo
run: ./bin/kondo.sh
@@ -168,6 +154,7 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: be-tests
java-version: "${{ matrix.java-version }}"
# Depending on which files changed, we might either have to build static-viz
# from scratch or download the previously built artifact
- name: Build static-viz frontend
@@ -182,12 +169,6 @@ jobs:
- name: Run tests
id: run-java-tests
if: matrix.java-version != 21
run: clojure -X:dev:ci:test:${{ matrix.edition }}:${{ matrix.edition }}-dev
- name: If using Java 21, only run tests on `master`
id: run-java-tests-21
if: matrix.java-version == 21 && github.ref_name == 'master'
run: clojure -X:dev:ci:test:${{ matrix.edition }}:${{ matrix.edition }}-dev
- name: Upload Test Results
@@ -214,9 +195,9 @@ jobs:
fail-on-error: false
be-tests-stub:
needs: [be-tests]
needs: [files-changed, static-viz-files-changed, be-tests]
if: |
!cancelled() &&
always() &&
github.event.pull_request.draft == false && needs.be-tests.result == 'skipped'
runs-on: ubuntu-22.04
name: be-tests-java-${{ matrix.java-version }}-${{ matrix.edition }}
@@ -268,3 +249,18 @@ jobs:
steps:
- run: |
echo "Didn't run due to conditional filtering"
be-cljfmt:
needs: [files-changed]
if: |
!cancelled() && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'cljfmt'
- name: Run cljfmt
run: clojure -T:cljfmt check

View File

@@ -6,25 +6,50 @@ on:
types: [created]
jobs:
check_pull_request_state:
name: Checks whether the PR has been merged
if: github.event.issue.pull_request && contains(github.event.comment.body, '@metabase-bot backport')
runs-on: ubuntu-22.04
outputs:
canBackport: ${{ steps.check_pull_request_state.outputs.result }}
steps:
- uses: actions/github-script@v7
id: check_pull_request_state
with:
script: |
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.issue.number
});
const canBackport = pullRequest.state === "closed"
if (!canBackport) {
await github.rest.issues.createComment({
issue_number: context.payload.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "The backport command can only be used after the pull request has been merged. Please wait until the PR is merged before attempting to backport."
});
}
return canBackport
create_pull_request:
name: Creates a pull request
if: contains(github.event.comment.body, '@metabase-bot backport')
needs: [check_pull_request_state]
if: needs.check_pull_request_state.outputs.canBackport == 'true'
runs-on: ubuntu-22.04
steps:
- uses: tibdex/github-app-token@v2.1.0
id: generate-token
with:
app_id: ${{ secrets.METABASE_BOT_APP_ID }}
private_key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
name: Cherry-pick commits and create PR
with:
fetch-depth: 0
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Verify Membership
id: verify-membership
uses: ./.github/actions/verify-membership
with:
github_token: ${{ steps.generate-token.outputs.token }}
github_token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
organization_name: metabase
username: ${{ github.event.comment.user.login }}
- run: |
@@ -110,23 +135,50 @@ jobs:
if [ -n "${SQUASHED_COMMIT}" ]; then
echo "found commit ${SQUASHED_COMMIT}"
git cherry-pick ${SQUASHED_COMMIT}
else
echo "probably a PR wasn't merged with Squash And Merge button, searching again"
SQUASHED_COMMIT=$(env -i git log ${ORIGINAL_BASE_REF} --grep="#${ORIGINAL_PULL_REQUEST_NUMBER}" --format="%H")
if [ -n "${SQUASHED_COMMIT}" ]; then
echo "found commit ${SQUASHED_COMMIT}"
git cherry-pick ${SQUASHED_COMMIT}
else
echo "No squashed commit found for PR #${ORIGINAL_PULL_REQUEST_NUMBER}"
exit 1
fi
fi
else
echo "PR has not been merged, copying all commits"
git cherry-pick ${ORIGINAL_BASE_SHA}..${ORIGINAL_HEAD_SHA}
echo "The PR has not been merged"
exit 1
fi
git cherry-pick ${SQUASHED_COMMIT} || true
CONFLICTS=$(git ls-files -u | wc -l)
if [ "$CONFLICTS" -gt 0 ]; then
git cherry-pick --abort
echo "Could not cherry pick because of a conflict"
echo "has-conflicts=true" >> $GITHUB_OUTPUT
# Add a shell script for resolving conflicts
echo "git reset HEAD~1" > ./backport.sh
echo "rm ./backport.sh" >> ./backport.sh
echo "git cherry-pick ${SQUASHED_COMMIT}" >> ./backport.sh
echo "echo 'Resolve conflicts and force push this branch'" >> ./backport.sh
chmod +x ./backport.sh
git add ./backport.sh
git commit -m "Add backport resolution script"
PR_BODY=$(cat <<-END
#${ORIGINAL_PULL_REQUEST_NUMBER}
> [!IMPORTANT]
> Manual conflict resolution is required.
Checkout the branch and run \`./backport.sh\` script. Force push your changes after cherry-picking.
END
)
else
echo "has-conflicts=false" >> $GITHUB_OUTPUT
PR_BODY="#${ORIGINAL_PULL_REQUEST_NUMBER}"
fi
git push origin "${BACKPORT_BRANCH}" --force-with-lease
@@ -134,12 +186,14 @@ jobs:
if [[ $(gh pr list --base "${TARGET_BRANCH}" --head "${BACKPORT_BRANCH}" -s "open") ]]; then
echo "PR already exists"
else
BACKPORT_PR_URL=$(gh pr create --base "${TARGET_BRANCH}" --head "${BACKPORT_BRANCH}" --label "was-backported" --assignee "${GITHUB_ACTOR}" --title "🤖 backported \"${ORIGINAL_TITLE}\"" --body "#${ORIGINAL_PULL_REQUEST_NUMBER}")
BACKPORT_PR_URL=$(gh pr create --base "${TARGET_BRANCH}" --head "${BACKPORT_BRANCH}" --label "was-backported" --assignee "${GITHUB_ACTOR}" --title "🤖 backported \"${ORIGINAL_TITLE}\"" --body "${PR_BODY}")
BACKPORT_PR_NUMBER=${BACKPORT_PR_URL##*/}
echo "backport_pr_number=$BACKPORT_PR_NUMBER" >> $GITHUB_OUTPUT
echo "New PR has been created"
fi
git checkout master
env:
ORIGINAL_TITLE: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.title }}
ORIGINAL_BASE_REF: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.base.ref }}
@@ -151,18 +205,25 @@ jobs:
BACKPORT_BRANCH: ${{ fromJson(steps.branch_info.outputs.result).backportBranch }}
START_SHA: ${{ fromJson(steps.branch_info.outputs.result).startSha }}
END_SHA: ${{ fromJson(steps.branch_info.outputs.result).endSha }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Auto approve backport PR
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'false' }}
uses: juliangruber/approve-pull-request-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.create_backport_pull_request.outputs.backport_pr_number }}
- name: Enable Pull Request Automerge
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'false' }}
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ steps.generate-token.outputs.token }}
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
pull-request-number: ${{ steps.create_backport_pull_request.outputs.backport_pr_number }}
merge-method: squash
- uses: ./.github/actions/notify-pull-request
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'true' }}
with:
include-log: false
message: Manual conflict resolution is required
notify_when_failed:
runs-on: ubuntu-22.04

View File

@@ -3,14 +3,13 @@ name: Bugs Slack Notification
on:
issues:
types:
- opened
- labeled
jobs:
on-issue-opened:
on-issue-labeled:
runs-on: ubuntu-22.04
timeout-minutes: 5
if: |
contains(github.event.issue.labels.*.name, '.Needs Triage') &&
contains(github.event.issue.labels.*.name, 'Type:Bug')
github.event.label.name == '.Needs Triage' && contains(github.event.issue.labels.*.name, 'Type:Bug')
steps:
- name: Setting title
uses: actions/github-script@v7
@@ -34,7 +33,7 @@ jobs:
- name: Send the issue ${{ github.event.issue.number }} to Slack
id: slack
if: steps.check_labels.outputs.has_team_label == 'false'
uses: slackapi/slack-github-action@v1.23.0
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{

View File

@@ -100,21 +100,14 @@ jobs:
oss: getCanonicalVersion(version, 'oss'),
};
const ossReleased = await hasBeenReleased({
const released = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.oss,
});
const eeReleased = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.ee,
});
if (ossReleased || eeReleased) {
if (released) {
throw new Error("This version has already been released!", version);
}
@@ -243,24 +236,11 @@ jobs:
./COMMIT-ID
./SHA256.sum
trigger-tests:
needs: [build-uberjar-for-release]
permissions:
actions: write
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: trigger pre-release testing
uses: actions/github-script@v7
with:
script: | # js
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'pre-release.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
}
});
run-pre-release-tests:
name: Run pre-release tests for ${{ inputs.version }}
needs: build-uberjar-for-release
uses: ./.github/workflows/pre-release.yml
secrets: inherit
with:
commit: ${{ inputs.commit }}
version: ${{ inputs.version }}

View File

@@ -1,16 +1,24 @@
name: Automatically set milestone
run-name: Set milestone for ${{ github.event.head_commit.message }}
run-name: Set milestone for ${{ github.event.head_commit.message || inputs.version }}
on:
push:
branches:
- release-x.**
workflow_dispatch:
inputs:
version:
description: 'Major version number (e.g. 52, 78, 109)'
type: number
required: true
jobs:
set-milestone:
name: Automatically set milestone
runs-on: ubuntu-22.04
timeout-minutes: 5
timeout-minutes: 30
env:
isNewReleaseBranch: ${{ github.event_name == 'workflow_dispatch' }}
permissions:
pull-requests: write
issues: write
@@ -19,10 +27,13 @@ jobs:
- uses: actions/checkout@v4
with:
sparse-checkout: release
fetch-depth: ${{ env.isNewReleaseBranch == 'false' && 3 || 0 }} # we need the full history to get all the commit messages
ref: master # we want the logic from master, even though we're triggering on a release branch
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- uses: actions/github-script@v7
if: ${{ env.isNewReleaseBranch == 'false' }}
name: Set milestone for single commit
with:
script: | # js
const { setMilestoneForCommits } = require('${{ github.workspace }}/release/dist/index.cjs');
@@ -39,3 +50,36 @@ jobs:
branchName,
commitMessages: [commitMessage],
});
- name: Get commit messages for release branch
if: ${{ env.isNewReleaseBranch == 'true' }}
run: |
npm i -g tsx
tsx release/src/release-branch-commits.ts ${{ inputs.version }} > commit-messages.json
- uses: actions/github-script@v7
if: ${{ env.isNewReleaseBranch == 'true' }}
name: Set milestones for new release branch
env:
# this token has a higher rate limit than the default token, and
# we will need it for this workflow to work
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
with:
script: | # js
const { setMilestoneForCommits } = require('${{ github.workspace }}/release/dist/index.cjs');
const commitMessages = require('${{ github.workspace }}/commit-messages.json');
const owner = context.repo.owner;
const repo = context.repo.repo;
const versionNumber = context.payload.inputs.version;
const branchName = `release-x.${versionNumber}.x`;
console.log(`Found ${commitMessages.length} new commits for ${branchName}`);
await setMilestoneForCommits({
github,
owner,
repo,
branchName,
commitMessages: commitMessages,
ignoreExistingMilestones: true,
});

View File

@@ -1,18 +0,0 @@
name: Lint doc Markdown links
on:
push:
paths:
- docs/**
pull_request:
paths:
- docs/**
jobs:
markdown-link-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Lint doc links
run: yarn run docs-lint-links

View File

@@ -49,7 +49,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-athena-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -82,7 +83,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-bigquery-cloud-sdk-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -116,7 +118,42 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-druid-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-databricks-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: databricks
MB_DATABRICKS_TEST_HOST: ${{ secrets.MB_DATABRICKS_JDBC_TEST_HOST }}
MB_DATABRICKS_TEST_HTTP_PATH: ${{ secrets.MB_DATABRICKS_JDBC_TEST_HTTP_PATH }}
MB_DATABRICKS_TEST_TOKEN: ${{ secrets.MB_DATABRICKS_JDBC_TEST_TOKEN }}
MB_DATABRICKS_TEST_CATALOG: 'metabase_ci'
MB_DATABRICKS_TEST_CLIENT_ID: ${{ secrets.MB_DATABRICKS_JDBC_TEST_CLIENT_ID }}
MB_DATABRICKS_TEST_OAUTH_SECRET: ${{ secrets.MB_DATABRICKS_JDBC_TEST_OAUTH_SECRET }}
steps:
- uses: actions/checkout@v4
- name: Test Databricks driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-databricks-ee'
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -150,7 +187,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-druid-jdbc-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -168,6 +206,10 @@ jobs:
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
partition-index: [0, 1, 2, 3]
env:
CI: 'true'
DRIVERS: mysql
@@ -188,6 +230,9 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mariadb-10-2-ee'
test-args: >-
:partition/total 4
:partition/index ${{ matrix.partition-index }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -205,6 +250,10 @@ jobs:
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
partition-index: [0, 1, 2, 3]
env:
CI: 'true'
DRIVERS: mysql
@@ -225,6 +274,9 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mariadb-latest-ee'
test-args: >-
:partition/total 4
:partition/index ${{ matrix.partition-index }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -258,7 +310,9 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-4-4-ee'
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
test-args: >-
:exclude-tags [:mongo-sharded-cluster-tests]
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -285,9 +339,19 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Spin up Mongo docker container
run: docker run -d -p 27017:27017 --name metamongo metabase/qa-databases:mongo-sample-4.4 mongod --dbpath /data/db2/ --tlsMode requireTLS --tlsCertificateKeyFile /etc/mongo/metamongo.pem --tlsCAFile /etc/mongo/metaca.crt
- name: Wait until the port 27017 is ready
run: while ! nc -z localhost 27017; do sleep 1; done
run: >-
docker run -d
-p 27017:27017
--name metamongo
metabase/qa-databases:mongo-sample-4.4
mongod
--dbpath /data/db2/
--tlsMode requireTLS
--tlsCertificateKeyFile /etc/mongo/metamongo.pem
--tlsCAFile /etc/mongo/metaca.crt
- uses: ./.github/actions/await-port
with:
port: 27017
timeout-minutes: 5
- name: Make SSL certificates for Mongo available
run: |
@@ -299,12 +363,13 @@ jobs:
curl https://raw.githubusercontent.com/metabase/metabase-qa/master/dbs/mongo/certificates/metaca.crt \
-o ./test_resources/ssl/mongo/metaca.crt
- name: Test MongoDB SSL driver (4.4)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-4-4-ee'
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
test-args: >-
:exclude-tags [:mongo-sharded-cluster-tests]
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -338,7 +403,9 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-5-0-ee'
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
test-args: >-
:exclude-tags [:mongo-sharded-cluster-tests]
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -365,9 +432,19 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Spin up Mongo docker container
run: docker run -d -p 27017:27017 --name metamongo metabase/qa-databases:mongo-sample-5.0 mongod --dbpath /data/db2/ --tlsMode requireTLS --tlsCertificateKeyFile /etc/mongo/metamongo.pem --tlsCAFile /etc/mongo/metaca.crt
- name: Wait until the port 27017 is ready
run: while ! nc -z localhost 27017; do sleep 1; done
run: >-
docker run -d
-p 27017:27017
--name metamongo
metabase/qa-databases:mongo-sample-5.0
mongod
--dbpath /data/db2/
--tlsMode requireTLS
--tlsCertificateKeyFile /etc/mongo/metamongo.pem
--tlsCAFile /etc/mongo/metaca.crt
- uses: ./.github/actions/await-port
with:
port: 27017
timeout-minutes: 5
- name: Make SSL certificates for Mongo available
run: |
@@ -379,12 +456,13 @@ jobs:
curl https://raw.githubusercontent.com/metabase/metabase-qa/master/dbs/mongo/certificates/metaca.crt \
-o ./test_resources/ssl/mongo/metaca.crt
- name: Test MongoDB SSL driver (5.0)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-5-0-ee'
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
test-args: >-
:exclude-tags [:mongo-sharded-cluster-tests]
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -421,7 +499,9 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-latest-ee'
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
test-args: >-
:exclude-tags [:mongo-sharded-cluster-tests]
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -471,6 +551,10 @@ jobs:
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
partition-index: [0, 1, 2, 3]
env:
CI: 'true'
DRIVERS: mysql
@@ -491,12 +575,30 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mysql-8-0-ee'
test-args: >-
:partition/total 4
:partition/index ${{ matrix.partition-index }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-mysql-latest-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
partition-index: [0, 1, 2, 3]
env:
CI: 'true'
DRIVERS: mysql
@@ -532,6 +634,9 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mysql-latest-ee'
test-args: >-
:partition/total 4
:partition/index ${{ matrix.partition-index }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -569,7 +674,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-oracle-18-4-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -616,7 +722,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-oracle-21-3-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -634,6 +741,28 @@ jobs:
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
version:
- name: Postgres 12.x
junit-name: postgres-ee
docker-image: postgres:12-alpine
env:
enable-ssl-tests: 'false'
- name: Postgres Latest
junit-name: postgres-latest-ee
docker-image: postgres:latest
env:
enable-ssl-tests: 'true'
job:
- name: Driver Tests
test-args: >-
:only-tags [:mb/driver-tests]
- name: App DB Tests
test-args: >-
:exclude-tags [:mb/driver-tests]
name: Test ${{ matrix.version.name }} (${{ matrix.job.name }})
env:
CI: 'true'
DRIVERS: postgres
@@ -643,9 +772,13 @@ jobs:
MB_DB_DBNAME: mb_test
MB_DB_USER: mb_test
MB_POSTGRESQL_TEST_USER: mb_test
# SSL tests are only enabled for the postgres-latest job.
MB_POSTGRES_SSL_TEST_SSL: ${{ matrix.version.env.enable-ssl-tests }}
MB_POSTGRES_SSL_TEST_SSL_MODE: verify-full
MB_POSTGRES_SSL_TEST_SSL_ROOT_CERT_PATH: 'test-resources/certificates/us-east-2-bundle.pem'
services:
postgres:
image: postgres:12-alpine
image: ${{ matrix.version.docker-image }}
ports:
- "5432:5432"
env:
@@ -653,55 +786,24 @@ jobs:
POSTGRES_DB: mb_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- name: Test Postgres driver (12)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-postgres-ee'
be-tests-postgres-latest-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: postgres
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
MB_POSTGRESQL_TEST_USER: circle_test
MB_POSTGRES_SSL_TEST_SSL: true
MB_POSTGRES_SSL_TEST_SSL_MODE: verify-full
MB_POSTGRES_SSL_TEST_SSL_ROOT_CERT_PATH: 'test-resources/certificates/us-east-2-bundle.pem'
services:
postgres:
image: circleci/postgres:latest
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- name: Test Postgres driver (latest)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-postgres-latest-ee'
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
- uses: actions/checkout@v4
- name: Test ${{ matrix.version.name }} (${{ matrix.job.name }})
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-${{ matrix.version.junit-name }}'
test-args: >-
${{ matrix.job.test-args }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-presto-jdbc-ee:
needs: files-changed
@@ -728,30 +830,37 @@ jobs:
JAVA_TOOL_OPTIONS: "-Xmx2g"
steps:
- uses: actions/checkout@v4
- name: Wait for port ${{ env.MB_PRESTO_JDBC_TEST_PORT }} to be ready
run: while ! nc -z localhost ${{ env.MB_PRESTO_JDBC_TEST_PORT }}; do sleep 0.1; done
timeout-minutes: 15
- uses: ./.github/actions/await-port
with:
port: ${{ env.MB_PRESTO_JDBC_TEST_PORT }}
timeout-minutes: 5
- name: Create temp cacerts file based on bundled JDK one
run: cp $JAVA_HOME/lib/security/cacerts /tmp/cacerts-with-presto-ssl.jks
- name: Capture Presto server self signed CA
run: |
while [[ ! -s /tmp/presto-ssl-ca.pem ]];
do echo "Waiting to capture SSL CA" \
while [[ ! -s /tmp/presto-ssl-ca.pem ]]; do
echo "Waiting to capture SSL CA" \
&& openssl s_client -connect localhost:8443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/presto-ssl-ca.pem \
&& sleep 1; done
&& sleep 1;
done
- name: Convert Presto CA from PEM to DER
run: openssl x509 -outform der -in /tmp/presto-ssl-ca.pem -out /tmp/presto-ssl-ca.der
- name: Add write permission on cacerts file
run: chmod u+w /tmp/cacerts-with-presto-ssl.jks
- name: Import Presto CA into temp cacerts file
run: |
keytool -noprompt -import -alias presto -keystore /tmp/cacerts-with-presto-ssl.jks \
-storepass changeit -file /tmp/presto-ssl-ca.der -trustcacerts
run: >-
keytool -noprompt -import
-alias presto
-keystore /tmp/cacerts-with-presto-ssl.jks
-storepass changeit
-file /tmp/presto-ssl-ca.der
-trustcacerts
- name: Test Presto JDBC driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-presto-jdbc-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -782,7 +891,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-redshift-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -820,7 +930,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-snowflake-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -852,7 +963,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-sparksql-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -879,7 +991,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-sqlite-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -895,7 +1008,7 @@ jobs:
be-tests-sqlserver-2017-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
timeout-minutes: 90
env:
CI: 'true'
@@ -918,7 +1031,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-sqlserver-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -957,7 +1071,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-sqlserver-2022-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -991,7 +1106,8 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-vertica-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: >-
:only-tags [:mb/driver-tests]
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -1003,3 +1119,41 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
# Dummy job generator to spit out fake runs for matrix jobs we skipped. See
# https://github.com/orgs/community/discussions/9141 and
# https://metaboat.slack.com/archives/C0669P4AF9N/p1732315370301059
be-driver-tests-skipped-stub:
needs: files-changed
if: |
!cancelled() &&
(github.event.pull_request.draft == true ||
needs.files-changed.outputs.backend_all == 'false')
strategy:
matrix:
job:
- "Test Postgres 12.x (App DB Tests)"
- "Test Postgres 12.x (Driver Tests)"
- "Test Postgres Latest (App DB Tests)"
- "Test Postgres Latest (Driver Tests)"
- "be-tests-mariadb-10-2-ee (0)"
- "be-tests-mariadb-10-2-ee (1)"
- "be-tests-mariadb-10-2-ee (2)"
- "be-tests-mariadb-10-2-ee (3)"
- "be-tests-mariadb-latest-ee (0)"
- "be-tests-mariadb-latest-ee (1)"
- "be-tests-mariadb-latest-ee (2)"
- "be-tests-mariadb-latest-ee (3)"
- "be-tests-mysql-8-0-ee (0)"
- "be-tests-mysql-8-0-ee (1)"
- "be-tests-mysql-8-0-ee (2)"
- "be-tests-mysql-8-0-ee (3)"
- "be-tests-mysql-latest-ee (0)"
- "be-tests-mysql-latest-ee (1)"
- "be-tests-mysql-latest-ee (2)"
- "be-tests-mysql-latest-ee (3)"
name: ${{ matrix.job }}
runs-on: ubuntu-22.04
steps:
- run: >-
echo 'Skipping job due to conditional filtering'

View File

@@ -0,0 +1,250 @@
name: E2E Cross-version Component Tests for Embedding SDK
on:
push:
branches:
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- "release-**"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
e2e_all: ${{ steps.changes.outputs.e2e_all }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
# if this is a test on a release branch, we need to check the build requirements
get-build-requirements:
if: |
!cancelled()
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
java_version: ${{ fromJson(steps.dependencies.outputs.result).java_version }}
node_version: ${{ fromJson(steps.dependencies.outputs.result).node_version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get build dependencies
uses: actions/github-script@v7
id: dependencies
with:
script: | # js
const {
getBuildRequirements,
getVersionFromReleaseBranch,
} = require('${{ github.workspace }}/release/dist/index.cjs');
const targetBranchName = '${{ github.base_ref || github.ref }}';
const version = getVersionFromReleaseBranch(targetBranchName);
const requirements = getBuildRequirements(version);
return {
java_version: requirements.java,
node_version: requirements.node,
};
build:
needs: [files-changed, get-build-requirements]
if: |
!cancelled() &&
github.event.pull_request.draft == false
runs-on: ubuntu-22.04
timeout-minutes: 25
env:
MB_EDITION: ee
INTERACTIVE: false
# make sure that builds on release branches get licenses, because we use them for releases
SKIP_LICENSES: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
with:
node-version: "${{ needs.get-build-requirements.outputs.node_version }}"
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
java-version: "${{ needs.get-build-requirements.outputs.java_version || 11 }}"
- name: Build uberjar with ./bin/build.sh
run: ./bin/build.sh
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
resolve-sdk-version:
if: |
!cancelled()
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
sdk_version: ${{ fromJson(steps.dependencies.outputs.result).sdk_version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get latest SDK release for this branch
uses: actions/github-script@v7
id: dependencies
with:
script: | # js
const { getSdkVersionFromReleaseBranchName } = require('${{ github.workspace }}/release/dist/index.cjs');
const branchName = '${{ github.base_ref || github.ref }}';
const sdk_version = await getSdkVersionFromReleaseBranchName({
github,
owner: context.repo.owner,
repo: context.repo.repo,
branchName,
});
return {
sdk_version,
};
e2e-tests:
needs: [get-build-requirements, build, resolve-sdk-version]
if: |
!cancelled() && needs.build.result == 'success'
runs-on: ubuntu-22.04
timeout-minutes: 45
name: e2e-tests-embedding-sdk
env:
MB_EDITION: ee
DISPLAY: ""
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()`
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")`
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_PULL_REQUEST_ID: ${{ github.event.pull_request.number || '' }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message || github.event.head.sha }}
TZ: US/Pacific # to make node match the instance tz
CYPRESS_CI: true
steps:
- uses: actions/checkout@v4
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Needed to omit newly added tests for functionality that is not yet released
- name: Sparse checkout tests from SDK release commit
uses: actions/checkout@v4
with:
ref: embedding-sdk-${{ needs.resolve-sdk-version.outputs.sdk_version }}
path: sdk-release-e2e
sparse-checkout: e2e
- name: Move tests from the release commit into the repo
run: |
rm -rf ./e2e/support/helpers/*
mv ./sdk-release-e2e/e2e/support/helpers/* ./e2e/support/helpers
rm -rf ./e2e/test-component/*
mv ./sdk-release-e2e/e2e/test-component/* ./e2e/test-component
shell: bash
- name: Retrieve uberjar artifact for ee
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK ${{ needs.get-build-requirements.outputs.java_version || 11 }}
uses: actions/setup-java@v4
with:
java-version: ${{ needs.get-build-requirements.outputs.java_version || 11 }}
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Install Embedding SDK package v${{ needs.resolve-sdk-version.outputs.sdk_version }}
run: yarn add @metabase/embedding-sdk-react@${{ needs.resolve-sdk-version.outputs.sdk_version }}
- name: Run E2E tests for Embedding SDK
run: yarn run test-cypress-run-component-sdk --browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit
output-name: e2e-embedding-sdk
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-recording-embedding-sdk-cross-version
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
- name: Publish Summary
if: failure()
uses: actions/github-script@v7
with:
script: | #js
const {
parseReport,
formatSummary
} = require("./.github/scripts/handle-mochawesome-report.js");
const report = parseReport();
const summary = formatSummary(report);
await core.summary.addRaw(summary).write();
e2e-tests-skipped-stub:
needs: [e2e-tests]
if: |
!cancelled() &&
needs.e2e-tests.result == 'skipped'
runs-on: ubuntu-22.04
timeout-minutes: 5
name: e2e-component-tests-embedding-sdk-cross-version
steps:
- run: |
echo "Didn't run due to conditional filtering"

View File

@@ -0,0 +1,212 @@
name: E2E Component Tests for Embedding SDK
on:
push:
branches:
- "master"
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
e2e_all: ${{ steps.changes.outputs.e2e_all }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
# if this is a test on a release branch, we need to check the build requirements
get-build-requirements:
if: |
!cancelled() &&
contains(github.base_ref || github.ref, 'release-x')
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
java_version: ${{ fromJson(steps.dependencies.outputs.result).java_version }}
node_version: ${{ fromJson(steps.dependencies.outputs.result).node_version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get build dependencies
uses: actions/github-script@v7
id: dependencies
with:
script: | # js
const {
getBuildRequirements,
getVersionFromReleaseBranch,
} = require('${{ github.workspace }}/release/dist/index.cjs');
const targetBranchName = '${{ github.base_ref || github.ref }}';
const version = getVersionFromReleaseBranch(targetBranchName);
const requirements = getBuildRequirements(version);
return {
java_version: requirements.java,
node_version: requirements.node,
};
build:
needs: [files-changed, get-build-requirements]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
needs.files-changed.outputs.e2e_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 25
env:
MB_EDITION: ee
INTERACTIVE: false
# make sure that builds on release branches get licenses, because we use them for releases
SKIP_LICENSES: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
with:
node-version: "${{ needs.get-build-requirements.outputs.node_version }}"
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
java-version: "${{ needs.get-build-requirements.outputs.java_version || 11 }}"
- name: Build uberjar with ./bin/build.sh
run: ./bin/build.sh
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
e2e-tests:
needs: [get-build-requirements, build]
if: |
!cancelled() && needs.build.result == 'success'
runs-on: ubuntu-22.04
timeout-minutes: 45
name: e2e-tests-embedding-sdk
env:
MB_EDITION: ee
DISPLAY: ""
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()`
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")`
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_PULL_REQUEST_ID: ${{ github.event.pull_request.number || '' }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message || github.event.head.sha }}
TZ: US/Pacific # to make node match the instance tz
CYPRESS_CI: true
steps:
- uses: actions/checkout@v4
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Retrieve uberjar artifact for ee
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK ${{ needs.get-build-requirements.outputs.java_version || 11 }}
uses: actions/setup-java@v4
with:
java-version: ${{ needs.get-build-requirements.outputs.java_version || 11 }}
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs
shell: bash
- name: Build Embedding SDK package
run: yarn build-embedding-sdk
- name: Run E2E tests for Embedding SDK
run: yarn run test-cypress-run-component-sdk --browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit
output-name: e2e-embedding-sdk
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-recording-embedding-sdk-latest
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
- name: Publish Summary
if: failure()
uses: actions/github-script@v7
with:
script: | #js
const {
parseReport,
formatSummary
} = require("./.github/scripts/handle-mochawesome-report.js");
const report = parseReport();
const summary = formatSummary(report);
await core.summary.addRaw(summary).write();
e2e-tests-skipped-stub:
needs: [e2e-tests]
if: |
!cancelled() &&
needs.e2e-tests.result == 'skipped'
runs-on: ubuntu-22.04
timeout-minutes: 5
name: e2e-component-tests-embedding-sdk
steps:
- run: |
echo "Didn't run due to conditional filtering"

View File

@@ -9,6 +9,8 @@ on:
jobs:
files-changed:
name: Check which files changed
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:

View File

@@ -0,0 +1,91 @@
name: E2E Matrix Builder
on:
workflow_call:
inputs:
chunks:
required: true
type: number
default: 30
outputs:
matrix:
value: ${{ jobs.build-matrix.outputs.matrix }}
jobs:
build-matrix:
runs-on: ubuntu-22.04
timeout-minutes: 5
outputs:
matrix: ${{ steps.matrix.outputs.config }}
steps:
- uses: actions/setup-node@v3
with:
node-version: '20.x'
- uses: actions/checkout@v4
with:
sparse-checkout: e2e
- name: get test file names
id: test-files
shell: bash
run: |
echo "::set-output name=filenames::$(find e2e/test/scenarios -name '*.cy.spec.*' | tr '\n' ',')"
- run: yarn add underscore
- uses: actions/github-script@v7
id: matrix
with:
script: | # js
const _ = require('underscore');
const java = 21;
const defaultRunner = "ubuntu-22.04";
// these are special and shouldn't be chunked out arbitrarily
const blacklist = [
"/embedding-sdk/",
"/cross-version/"
];
const defaultOptions = {
"java-version": java,
runner: defaultRunner,
specs: "./e2e/test/scenarios/**/*.cy.spec.*",
edition: "ee",
};
const specialTests = [
{ name: "embedding-sdk", specs: "./e2e/test/scenarios/embedding-sdk/**.cy.spec.*" },
{ name: "oss-subset", edition: 'oss', tags: "@OSS" },
{ name: "slow", tags: "@slow" },
{ name: "mongo", tags: "@mongo" },
];
const fileNames = "${{ steps.test-files.outputs.filenames }}"
.split(",")
.filter(Boolean)
.filter(testPath => !blacklist.some(blacklisted => testPath.includes(blacklisted)));
const fileCount = fileNames.length;
// subtract the special tests since they all get their own runners
const chunkSize = fileCount / (Number('${{ inputs.chunks }}') - specialTests.length);
const chunkedFiles = _.chunk(fileNames, chunkSize);
const regularTests = chunkedFiles.map((files, index) => ({
name: `e2e-group-${index + 1}`,
specs: files.join(","),
tags: '',
}));
const testSets = [...regularTests, ...specialTests];
const config = testSets.map((options) => ({
...defaultOptions,
...options,
}));
console.log("matrix config", config);
core.setOutput("config", JSON.stringify({ include: config }));

View File

@@ -87,10 +87,10 @@ jobs:
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
- name: Prepare JDK 21
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 21
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep

151
.github/workflows/e2e-test.yml vendored Normal file
View File

@@ -0,0 +1,151 @@
name: E2E Test
run-name: E2E Test - ${{ inputs.name }}
on:
workflow_call:
inputs:
name:
required: true
type: string
edition: # oss | ee
required: false
type: string
default: ee
specs:
required: false
default: ./e2e/test/scenarios/**/*.cy.spec.*
type: string
tags:
required: false
type: string
runner:
required: false
type: string
default: ubuntu-22.04
jobs:
e2e-tests:
runs-on: ${{ inputs.runner }}
timeout-minutes: 45
name: e2e-tests-${{ inputs.name }}-${{ inputs.edition }}
env:
MB_EDITION: ${{ inputs.edition }}
DISPLAY: ""
QA_DB_ENABLED: true
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()`
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")`
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_PULL_REQUEST_ID: ${{ github.event.pull_request.number || '' }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message || github.event.head.sha }}
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
TZ: US/Pacific # to make node match the instance tz
CYPRESS_CI: true
CYPRESS_QA_DB_MONGO: ${{ inputs.name == 'mongo' }}
CYPRESS_IS_EMBEDDING_SDK: ${{ inputs.name == 'embedding-sdk' }}
mongo: ${{ inputs.name == 'mongo' }}
postgres: ${{ inputs.name != 'mongo' }}
mysql: ${{ inputs.name != 'mongo' }}
openldap: ${{ contains(inputs.specs, 'ldap') }}
maildev: true
webhook: true
steps:
- uses: actions/checkout@v4
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
maildev: true
openldap: ${{ env.openldap }}
postgres: ${{ env.postgres }}
mysql: ${{ env.mysql }}
mongo: ${{ env.mongo }}
webhook: ${{ env.webhook }}
- name: Run Embedding SDK Storybook
if: inputs.name == 'embedding-sdk'
uses: ./.github/actions/run-embedding-sdk-storybook
- name: Retrieve uberjar artifact for ${{ inputs.edition }}
uses: actions/download-artifact@v4
with:
name: metabase-${{ inputs.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
- name: Run EE Cypress tests on ${{ inputs.name }}
if: ${{ !inputs.tags }}
shell: bash
run: |
yarn run test-cypress-run \
--env grepTags="-@slow+-@mongo+-@flaky+-@OSS --@quarantine",grepOmitFiltered=true \
--spec '${{ inputs.specs }}' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run Tagged EE Cypress tests on ${{ inputs.name }}
if: ${{ inputs.tags }}
shell: bash
run: |
yarn run test-cypress-run \
--env grepTags="${{inputs.tags}} --@quarantine",grepOmitFiltered=true \
--spec '${{ inputs.specs }}' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit
output-name: e2e-${{ inputs.name }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-recording-${{ inputs.name }}-${{ inputs.edition }}
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
- name: Publish Summary
if: failure()
uses: actions/github-script@v7
with:
script: | #js
const {
parseReport,
formatSummary
} = require("./.github/scripts/handle-mochawesome-report.js");
const report = parseReport();
const summary = formatSummary(report);
await core.summary.addRaw(summary).write();

View File

@@ -29,15 +29,9 @@ jobs:
filters: .github/file-paths.yaml
e2e-matrix-builder:
runs-on: ubuntu-22.04
timeout-minutes: 5
outputs:
matrix: ${{ steps.e2e-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Generate matrix for E2E tests
id: e2e-matrix
uses: ./.github/actions/build-e2e-matrix
uses: ./.github/workflows/e2e-matrix-builder.yml
with:
chunks: 50
# if this is a test on a release branch, we need to check the build requirements
get-build-requirements:
@@ -70,12 +64,12 @@ jobs:
node_version: requirements.node,
};
build:
needs: [files-changed, e2e-matrix-builder, get-build-requirements]
needs: [files-changed, get-build-requirements]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
needs.e2e-matrix-builder.result == 'success' &&
needs.files-changed.outputs.e2e_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 25
@@ -108,162 +102,58 @@ jobs:
name: metabase-${{ matrix.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
e2e-tests:
name: ${{ matrix.name }}-${{ matrix.edition }}
uses: ./.github/workflows/e2e-test.yml
needs: [build, e2e-matrix-builder]
if: |
!cancelled() && needs.build.result == 'success'
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
name: e2e-tests-${{ matrix.name }}-${{ matrix.edition }}
env:
MB_EDITION: ${{ matrix.edition }}
DISPLAY: ""
QA_DB_ENABLED: true
# Any env starting with `CYPRESS_` will be available to all Cypress tests via `Cypress.env()`
# Example: you can get `CYPRESS_FOO` with `Cypress.env("FOO")`
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_PULL_REQUEST_ID: ${{ github.event.pull_request.number || '' }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message || github.even.head.sha }}
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
TZ: US/Pacific # to make node match the instance tz
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.e2e-matrix-builder.outputs.matrix) }}
matrix: ${{ fromJson(needs.e2e-matrix-builder.outputs.matrix) }}
secrets: inherit
with:
name: ${{ matrix.name }}
edition: ${{ matrix.edition }}
specs: ${{ matrix.specs }}
tags: ${{ matrix.tags }}
runner: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
maildev: true
openldap: ${{ startsWith(matrix.name, 'admin') }}
postgres: ${{ matrix.name != 'mongo'}}
mysql: ${{ matrix.name != 'mongo'}}
mongo: ${{ matrix.name == 'mongo'}}
- name: Retrieve uberjar artifact for ${{ matrix.edition }}
uses: actions/download-artifact@v4
with:
name: metabase-${{ matrix.edition }}-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
- name: Run OSS-specific Cypress tests
if: matrix.edition == 'oss' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags=@OSS,grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run slow and resource-intensive Cypress tests
if: matrix.name == 'slow' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="@slow",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run Flaky Cypress tests
if: matrix.name == 'flaky' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="@flaky --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run EE Cypress tests on ${{ matrix.name }}
if: matrix.context == 'folder' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="-@slow+-@mongo+-@flaky --@quarantine",grepOmitFiltered=true \
--folder ${{ matrix.name }} \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run E2E tests that depend on Mongo
if: matrix.name == 'mongo'
run: |
yarn run test-cypress-run \
--env grepTags="@mongo --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
env:
CYPRESS_QA_DB_MONGO: true
- name: Run Embedding SDK Storybook
if: matrix.context == 'embedding-sdk' && github.event_name != 'schedule'
uses: ./.github/actions/run-embedding-sdk-storybook
- name: Run E2E tests for Embedding SDK
if: matrix.context == 'embedding-sdk' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="-@slow+-@flaky --@quarantine",grepOmitFiltered=true \
--folder 'embedding-sdk' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
env:
CYPRESS_IS_EMBEDDING_SDK: true
shell: bash
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit
output-name: e2e-${{ matrix.name }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-recording-${{ matrix.name }}-${{ matrix.edition }}
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
e2e-tests-skipped-stub:
needs: [e2e-tests, e2e-matrix-builder]
# run this separately to make it non-blocking
flaky-e2e-tests:
name: Flaky e2e Tests
uses: ./.github/workflows/e2e-test.yml
needs: build
if: |
!cancelled() &&
needs.e2e-tests.result == 'skipped'
runs-on: ${{ matrix.runner }}
!cancelled() && needs.build.result == 'success'
secrets: inherit
with:
name: Flaky
tags: "@flaky"
e2e-tests-result:
needs: [e2e-tests, flaky-e2e-tests]
runs-on: ubuntu-latest
timeout-minutes: 5
name: e2e-tests-${{ matrix.name }}-${{ matrix.edition }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.e2e-matrix-builder.outputs.matrix) }}
name: e2e-tests-result
if: always() && !cancelled()
env:
E2E_TESTS_RESULT: ${{ needs.e2e-tests.result }}
FLAKY_E2E_TESTS_RESULT: ${{ needs.flaky-e2e-tests.result }}
steps:
- run: |
- name: Stub
if: ${{ needs.e2e-tests.result == 'skipped' }}
run: |
echo "Didn't run due to conditional filtering"
- name: Test results
if: ${{ needs.e2e-tests.result != 'skipped' }}
run: | # sh
echo "E2E Tests: ${{ needs.e2e-tests.result }}"
echo "Flaky E2E Tests: ${{ needs.flaky-e2e-tests.result }}"
if [ "${{ needs.e2e-tests.result }}" != "success" ]; then
echo "E2E Tests failed"
exit 1
fi
pr-env:
needs: [build]

View File

@@ -7,6 +7,8 @@ on:
jobs:
flake-issue-creator:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:

View File

@@ -7,6 +7,8 @@ on:
jobs:
flake-status-report:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:

32
.github/workflows/links.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: Links
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
jobs:
linkChecker:
runs-on: ubuntu-latest
permissions:
issues: write # required for peter-evans/create-issue-from-file
steps:
- uses: actions/checkout@v4
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
fail: false
args: docs --config ./lychee/config.toml --verbose --no-progress
format: markdown
- name: Create Issue From File
if: steps.lychee.outputs.exit_code != 0
uses: peter-evans/create-issue-from-file@v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: "Type:Documentation"
assignees: jeff-bruemmer

View File

@@ -61,9 +61,9 @@ jobs:
with:
github-token: ${{secrets.METABASE_AUTOMATION_USER_TOKEN}}
script: |
github.issues.removeLabel({
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'loki-update'
})
});

View File

@@ -83,5 +83,6 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: loki-report
include-hidden-files: true
path: .loki/
if-no-files-found: ignore

38
.github/workflows/main.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Slack Notification for New Feature Requests
on:
issues:
types:
- labeled
jobs:
on-issue-labeled:
runs-on: ubuntu-22.04
timeout-minutes: 5
if: |
contains(github.event.issue.labels.*.name, 'Type:New Feature')
steps:
- name: Setting title
uses: actions/github-script@v7
id: vars
with:
script: |
core.setOutput('issue_title', ${{ toJson(github.event.issue.title) }}.replaceAll(/"/g, '\\"'));
- name: Send the issue ${{ github.event.issue.number }} to Slack
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "New incoming feature request: ${{ steps.vars.outputs.issue_title }}\n${{ github.event.issue.html_url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_FEATURE_REQUEST_TRIAGE_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

48
.github/workflows/on-epic-close.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: A New Feature Slack Notification
on:
issues:
types:
- closed
jobs:
on-epic-closed:
runs-on: ubuntu-22.04
timeout-minutes: 5
if: ${{ contains(github.event.issue.labels.*.name, '.Epic') || contains(github.event.issue.labels.*.name, 'Type:New Feature') }}
steps:
- name: Setting title
uses: actions/github-script@v6
id: vars
with:
script: |
core.setOutput('issue_title', ${{ toJson(github.event.issue.title) }}.replaceAll(/"/g, '\\"'));
- name: Extracting team name
id: team_name
run: |
team_label=$(echo "${{ join(github.event.issue.labels.*.name, ',') }}" | grep -o '\.Team/[^,]*' | head -n 1)
echo $team_label
echo "team_label=${team_label}" >> "$GITHUB_OUTPUT"
team_name=${team_label#*.Team/}
echo $team_name
echo "team_name=${team_name^^}_SLACK_EPIC_WEBHOOK_URL" >> "$GITHUB_OUTPUT"
- name: Send the issue ${{ github.event.issue.number }} to Slack
id: slack
if: ${{ steps.team_name.outputs.team_label }}
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ steps.vars.outputs.issue_title }}\n${{ github.event.issue.html_url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets[steps.team_name.outputs.team_name] }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

View File

@@ -10,11 +10,18 @@ on:
required: true
commit:
description: "A full-length commit SHA-1 hash"
type: string
required: true
workflow_call:
inputs:
version:
description: "Metabase version (e.g. v0.46.3)"
type: string
required: true
commit:
description: "A full-length commit SHA-1 hash"
type: string
required: true
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
release-artifact:
@@ -79,7 +86,7 @@ jobs:
- name: Upload Metabase ${{ matrix.edition }} JAR as artifact
uses: actions/upload-artifact@v4
with:
name: metabase-${{ matrix.edition }}-uberjar
name: metabase-test-${{ matrix.edition }}-uberjar
path: |
./metabase.jar
./COMMIT-ID
@@ -93,7 +100,7 @@ jobs:
strategy:
matrix:
edition: [oss, ee]
java-version: [11, 17]
java-version: [11, 17, 21]
steps:
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
@@ -105,9 +112,10 @@ jobs:
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
name: metabase-test-${{ matrix.edition }}-uberjar
- name: Launch uberjar (and keep it running)
run: java -jar ./metabase.jar &
run: >-
java --add-opens java.base/java.nio=ALL-UNNAMED -jar ./metabase.jar &
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
@@ -142,10 +150,10 @@ jobs:
maildev: true
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
- name: Prepare JDK 21
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 21
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
@@ -155,7 +163,7 @@ jobs:
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact for ${{ matrix.edition }}
with:
name: metabase-${{ matrix.edition }}-uberjar
name: metabase-test-${{ matrix.edition }}-uberjar
- name: Get the version info
run: |
jar xf metabase.jar version.properties
@@ -207,16 +215,16 @@ jobs:
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
name: metabase-test-${{ matrix.edition }}-uberjar
- name: Move the Uberjar to the context dir
run: mv metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: bin/docker/.
platforms: linux/amd64
@@ -233,7 +241,7 @@ jobs:
timeout-minutes: 3
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
@@ -270,7 +278,7 @@ jobs:
IMAGE_TAG: ${{ needs.containerize.outputs.image_tag }}
steps:
- name: Login to Docker Hub # authenticated, to avoid being rate-throttled
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
@@ -289,30 +297,6 @@ jobs:
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
trigger-auto-publish:
if: ${{ inputs.auto }}
needs: [run-sanity-check, check-uberjar-health, verify-docker-pull]
permissions:
actions: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: trigger auto publish
uses: actions/github-script@v7
with:
script: | # js
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
auto: true,
}
});
tests-complete-message:
if: always()
runs-on: ubuntu-22.04

View File

@@ -1,35 +1,97 @@
name: Release Metabase Embedding SDK for React
run-name: Release SDK from ${{ inputs.branch }}
on:
workflow_dispatch:
inputs:
# TODO: Add a version validation, so the workflow won't fail when publishing to npm
sdk_version:
description: 'SDK version (e.g. 0.1.3)'
type: string
required: true
git_ref:
description: 'A git commit hash that will be used to build the SDK'
type: string
branch:
description: "Branch we want to release the SDK from"
type: choice
required: true
default: "master"
options:
- master
- release-x.51.x
- release-x.52.x
concurrency:
# We want to ensure only one job is running at a time because
# We want to ensure only one job is running at a time per branch because
# there could be a conflict when updating the readme file.
group: ${{ github.workflow }}
group: ${{ github.workflow }}-${{ inputs.branch }}
cancel-in-progress: true
jobs:
workflow-summary:
name: Log inputs
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Generate workflow summary
run: |
tee -a $GITHUB_STEP_SUMMARY << EOF
**Inputs:**
- \`branch\`: ${{ inputs.branch }}
triggered by: @${{ github.event.sender.login }}
EOF
determine-version:
name: Determine SDK version
runs-on: ubuntu-22.04
timeout-minutes: 20
outputs:
sdk_version: ${{ steps.new-sdk-version.outputs.result }}
steps:
- name: Check out the code using the provided branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Get current SDK version
id: current-sdk-version
run: |
VERSION=$(jq -r .version ./enterprise/frontend/src/embedding-sdk/package.template.json)
echo "sdk_current_version=$VERSION" >> $GITHUB_OUTPUT
- name: Get next SDK patch version
id: new-sdk-version
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const currentVersion = "${{ steps.current-sdk-version.outputs.sdk_current_version }}";
const [currentVersionWithoutSuffix, suffix] = currentVersion.split("-");
const versionParts = currentVersionWithoutSuffix.split(".");
versionParts[versionParts.length - 1] = parseInt(versionParts.at(-1)) + 1;
const newVersion = versionParts.join(".");
if (!suffix) {
return newVersion;
}
return `${newVersion}-${suffix}`
- name: Append workflow summary
run: |
tee -a $GITHUB_STEP_SUMMARY << EOF
**Derived inputs:**
- \`current_version\`: "${{ steps.current-sdk-version.outputs.sdk_current_version }}"
- \`next_version\`: "${{ steps.new-sdk-version.outputs.result }}"
EOF
check-git-tag:
needs: determine-version
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
tag: embedding-sdk-${{ needs.determine-version.outputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
- name: Check out the code using the provided branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
ref: ${{ inputs.branch }}
fetch-depth: 0
fetch-tags: true
@@ -48,10 +110,10 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
- name: Check out the code using the provided branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
ref: ${{ inputs.branch }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
@@ -65,14 +127,14 @@ jobs:
run: yarn embedding-sdk:test-unit
build-sdk:
needs: test
needs: [test, determine-version]
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
- name: Check out the code using the provided branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
ref: ${{ inputs.branch }}
fetch-depth: 0
fetch-tags: true
@@ -84,14 +146,10 @@ jobs:
with:
m2-cache-key: "release-sdk"
- name: Update readme
run: |
./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
# NOTE: this should happen before "Build SDK bundle" as we inject SDK version into the code during build step
run: |
./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ needs.determine-version.outputs.sdk_version }}
- name: Update changelog
run: |
@@ -115,50 +173,18 @@ jobs:
name: sdk-changelog-diff
path: ./changelog-diff
build-jar:
needs: test
uses: ./.github/workflows/uberjar-sdk.yml
with:
git_ref: ${{ inputs.git_ref }}
image_name: embedding-sdk-${{ inputs.sdk_version }}
secrets: inherit
upload-jar:
needs: build-jar
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-ee-uberjar
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Upload uberjar to S3
env:
BUCKET: ${{ vars.AWS_S3_DOWNLOADS_BUCKET }}
BUCKET_PATH: sdk/v${{ inputs.sdk_version }}/metabase.jar
FILE: ./target/uberjar/metabase.jar
shell: bash
run: |
aws s3 cp $FILE s3://$BUCKET/$BUCKET_PATH
publish-npm:
needs: [build-sdk, upload-jar]
needs: [build-sdk, determine-version]
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
sdk_version: ${{ needs.determine-version.outputs.sdk_version }}
steps:
- name: Check out master to prepare for a SDK version bump PR
- name: Check out branch to prepare for a SDK version bump PR
uses: actions/checkout@v4
with:
# when we created version update PR, it would only have diff from 2 files SDK readme and SDK package.json template
ref: master
ref: ${{ inputs.branch}}
- name: Setup git user
run: |
@@ -167,11 +193,11 @@ jobs:
- name: Update readme
run: |
bash ./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
bash ./bin/embedding-sdk/release_utils.bash update_readme ${{ env.sdk_version }}
- name: Bump published npm package version
run: |
bash ./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
bash ./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ env.sdk_version }}
- name: Retrieve SDK changelog diff
uses: actions/download-artifact@v4
@@ -185,13 +211,13 @@ jobs:
- name: Create a PR updating readme + published version, and changelog (using GitHub Metabase Automation account)
run: |
git checkout -b update-sdk-version-${{ inputs.sdk_version }}
git commit -a -m 'Update Readme version references and published npm version to ${{ inputs.sdk_version }}'
git checkout -b update-sdk-version-${{ env.sdk_version }}
git commit -a -m 'Update Readme version references and published npm version to ${{ env.sdk_version }}'
git push origin HEAD
gh pr create --base master\
gh pr create --base ${{ inputs.branch }}\
--assignee "${GITHUB_ACTOR}"\
--title "Update SDK version to ${{ inputs.sdk_version }}"\
--body "Update Readme version references and published npm package version to ${{ inputs.sdk_version }}"
--title "Update SDK version to ${{ env.sdk_version }}"\
--body "Update Readme version references and published npm package version to ${{ env.sdk_version }}"
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
@@ -203,7 +229,7 @@ jobs:
- name: Edit PR adding useful information (using Metabase bot app)
run: |
gh pr edit --add-reviewer @metabase/embedding --add-label no-backport
gh pr edit --add-reviewer @metabase/embedding,albertoperdomo --add-label no-backport
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
@@ -226,22 +252,29 @@ jobs:
path: sdk
- name: Publish to NPM
working-directory: sdk
run: |
cd sdk
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_RELEASE_TOKEN }} > .npmrc
npm publish
# Please keep the value in sync with `inputs.branch`'s release branch
npm publish --tag ${{fromJson('{"master": "nightly", "release-x.51.x": "51-stable", "release-x.52.x": "52-stable"}')[inputs.branch]}}
- name: Add `latest` tag to the latest release branch (`release-x.52.x`) deployment
if: ${{ inputs.branch == 'release-x.52.x' }}
working-directory: sdk
run: |
npm dist-tag add @metabase/embedding-sdk-react@${{ env.sdk_version }} latest
git-tag:
needs: publish-npm
needs: [publish-npm, determine-version]
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
tag: embedding-sdk-${{ needs.determine-version.outputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
- name: Check out the code using the provided branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
ref: ${{ inputs.branch }}
# Lightweight tags don't need committer name and email
- name: Create a new git tag
@@ -249,6 +282,6 @@ jobs:
git tag ${{ env.tag }}
- name: Push the new tag
id : push-tag
id: push-tag
run: |
git push origin ${{ env.tag }}

View File

@@ -1,22 +1,34 @@
name: Update Release Log
run-name: Update Release Log ${{ inputs.version }}
run-name: Update Release Log ${{ inputs.version || github.ref_name }}
on:
push:
branches:
- release-x.*
tags:
- v*
- nightly-*
- latest-*
- beta-*
workflow_dispatch:
inputs:
version:
description: 'Major Metabase version (e.g. 45, 52, 68)'
type: number
required: true
schedule:
- cron: '45 * * * *' # hourly
workflow_call:
inputs:
version:
description: 'Major Metabase version (e.g. 45, 52, 68)'
type: number # needs to be a number to pass variables
required: true
jobs:
update-release-log:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || 50 }} # Update this for the next major release
# don't run this workflow for forks
if: ${{ github.event_name != 'push' || github.repository == 'metabase/metabase' }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
@@ -26,18 +38,54 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
- uses: actions/checkout@v4
with:
ref: master # this only works on master
fetch-depth: 0 # we want all branches and tags
- name: Install Dependencies
run: yarn --cwd release --frozen-lockfile && npm i -g tsx
- name: Build release scripts
run: yarn --cwd release build
- name: Get version number
uses: actions/github-script@v7
with:
script: | # js
const {
getVersionFromReleaseBranch,
getMajorVersion,
} = require('${{ github.workspace }}/release/dist/index.cjs');
console.log({ context });
// if the version is explicitly set, use that
if (context.payload?.inputs?.version) {
core.exportVariable('VERSION', context.payload.inputs.version);
return;
}
// otherwise, get the version from the release branch name
const branch = context.payload.ref;
const version = getVersionFromReleaseBranch(branch);
const majorVersion = getMajorVersion(version);
console.log({ branch, version, majorVersion });
core.exportVariable('VERSION', majorVersion);
- name: generate release Log
run: cd release && tsx ./src/release-log.ts $VERSION > v$VERSION.html
run: cd release && tsx ./src/release-log-run.ts $VERSION > v$VERSION.html
- name: generate release channel log
run: cd release && tsx ./src/release-channel-log.ts > channels.html
- name: upload release log to the web
run: |
aws s3 cp \
release/v$VERSION.html \
s3://${{ vars.AWS_S3_STATIC_BUCKET }}/release-log/v$VERSION.html
- name: upload release channel log to the web
run: |
aws s3 cp \
release/channels.html \
s3://${{ vars.AWS_S3_STATIC_BUCKET }}/release-log/channels.html
- name: Create cloudfront invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths /release-log/v$VERSION.html
--paths "/release-log/v$VERSION.html" "/release-log/channels.html"

View File

@@ -14,6 +14,7 @@ on:
jobs:
check-milestone:
permissions: write-all
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
@@ -24,9 +25,9 @@ jobs:
run: yarn --cwd release --frozen-lockfile && yarn --cwd release build
- uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
with:
script: | # js
const {

View File

@@ -13,6 +13,8 @@ on:
jobs:
auto-patch-trigger:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
@@ -31,8 +33,9 @@ jobs:
hasCommitBeenReleased,
} = require('${{ github.workspace }}/release/dist/index.cjs');
// Don't forget to update this for the next major release 🤞
const AUTO_RELEASE_VERSIONS = [49, 50];
const currentRelease = Number('${{ vars.CURRENT_VERSION }}');
const lastRelease = currentRelease - 1;
const AUTO_RELEASE_VERSIONS = [lastRelease, currentRelease];
async function releasePatchFor(majorVersion) {
const nextPatch = await getNextPatchVersion({

View File

@@ -7,6 +7,8 @@ on:
jobs:
check-release-status:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:

343
.github/workflows/release-tag.yml vendored Normal file
View File

@@ -0,0 +1,343 @@
name: Release 4 - Set Release Channel
run-name: Set ${{ inputs.version }} as ${{ inputs.tag_name }} ( ${{ inputs.tag_ee && 'EE' || '' }} ${{ inputs.tag_oss && 'OSS' || '' }} )
on:
workflow_dispatch:
inputs:
version:
description: Metabase version (e.g. v0.46.3)
type: string
required: true
tag_name:
description: Tag name to apply to this release
type: choice
options:
- nightly
- beta
- latest
required: true
tag_rollout:
description: Rollout % (0-100)
type: number
default: 100
tag_ee:
description: Apply to EE
type: boolean
default: true
tag_oss:
description: Apply to OSS
type: boolean
default: true
workflow_call:
inputs:
version:
type: string
required: true
tag_name:
type: string
# options:
# - nightly
# - beta
# - latest
# - none (skips everything)
required: true
tag_rollout:
description: Rollout % (0-100)
type: number
default: 100
tag_ee:
description: Apply to EE
type: boolean
default: true
tag_oss:
description: Apply to OSS
type: boolean
default: true
jobs:
green-check-stub:
runs-on: ubuntu-22.04
timeout-minutes: 2
steps:
- name: Stub
run: echo "Stub to make this job successful even if all the rest of the steps are skipped"
check-version:
# skips everything if the tag_name is 'none' because all later jobs depend on this job
if: ${{ inputs.tag_name != 'none' }}
runs-on: ubuntu-22.04
timeout-minutes: 5
outputs:
ee: ${{ fromJson(steps.canonical_version.outputs.result).ee }}
oss: ${{ fromJson(steps.canonical_version.outputs.result).oss }}
edition_matrix: ${{ steps.edition_matrix.outputs.result }}
steps:
- name: Fail early on the incorrect version format
if: ${{ !(startsWith(inputs.version,'v0.') || startsWith(inputs.version,'v1.')) }}
run: |
echo "The version format is invalid!"
echo "It must start with either 'v0.' or 'v1.'."
echo "Please, try again."
exit 1
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get Release Version
uses: actions/github-script@v7
id: canonical_version
with:
script: | # js
const { isValidVersionString, getCanonicalVersion, hasBeenReleased } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
if (!isValidVersionString(version)) {
throw new Error("The version format is invalid!");
}
const versions = {
ee: getCanonicalVersion(version, 'ee'),
oss: getCanonicalVersion(version, 'oss'),
};
const released = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.oss,
});
if (!released) {
throw new Error("This version has not been released yet!", version);
}
return versions;
- name: Get Edition matrix
uses: actions/github-script@v7
id: edition_matrix
with:
script: | # js
const tag_oss = ${{ inputs.tag_oss }};
const tag_ee = ${{ inputs.tag_ee }};
if (tag_oss && tag_ee) {
return ["oss", "ee"];
}
if (tag_oss) {
return ["oss"];
}
if (tag_ee) {
return ["ee"];
}
throw new Error("No edition selected to tag");
copy-to-s3:
runs-on: ubuntu-22.04
needs: check-version
timeout-minutes: 5
strategy:
matrix:
edition: ${{ fromJson(needs.check-version.outputs.edition_matrix) }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Determine the source path
uses: actions/github-script@v7
id: source_path
with:
result-encoding: string
script: | # js
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const source_path = edition === 'ee'
? 'enterprise/' + version.replace(/^v0\./, "v1.") // always e.g. v1.47.2
: version.replace(/^v1\./, "v0."); // always e.g. v0.45.6;
console.log("The source path for this", edition, "edition is", source_path);
return source_path;
- name: Determine upload path
uses: actions/github-script@v7
id: upload_path
with:
result-encoding: string
script: | # js
const edition = '${{ matrix.edition }}';
const tagName = '${{ inputs.tag_name }}';
const OSSversion = '${{ needs.check-version.outputs.oss }}';
const EEversion = '${{ needs.check-version.outputs.ee }}';
const upload_path = edition === 'ee'
? `enterprise/${tagName}`
: tagName;
console.log("The upload path for this", edition, "edition is", upload_path);
return upload_path;
- name: Upload to s3 ${{ inputs.tag_name }} path
run: | # sh
aws s3 cp \
s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.source_path.outputs.result }}/metabase.jar \
s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.upload_path.outputs.result }}/metabase.jar
- name: Create cloudfront invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.AWS_CLOUDFRONT_DOWNLOADS_ID }} \
--paths /${{ steps.upload_path.outputs.result }}/metabase.jar
- name: Download the jars
run: | # sh
curl -L http://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}.s3.${{ vars.AWS_REGION }}.amazonaws.com/${{ steps.source_path.outputs.result }}/metabase.jar -o metabase-source.jar
curl -L http://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}.s3.${{ vars.AWS_REGION }}.amazonaws.com/${{ steps.upload_path.outputs.result }}/metabase.jar -o metabase-tagged.jar
- name: Verify Checksums match
run: | # sh
SOURCE_CHECKSUM=$(sha256sum ./metabase-source.jar | awk '{print $1}')
TAGGED_CHECKSUM=$(sha256sum ./metabase-tagged.jar | awk '{print $1}')
echo "Source Checksum: $SOURCE_CHECKSUM"
echo "Tagged Checksum: $TAGGED_CHECKSUM"
if [[ "$SOURCE_CHECKSUM" != "$TAGGED_CHECKSUM" ]]; then
echo "jar Checksums do not match!"
exit 1
fi
tag-docker-image:
runs-on: ubuntu-22.04
needs: check-version
timeout-minutes: 5
strategy:
matrix:
edition: ${{ fromJson(needs.check-version.outputs.edition_matrix) }}
env:
TAG_NAME: ${{ inputs.tag_name }}
steps:
- name: Determine the Docker Hub repository
run: | # sh
if [[ "${{ matrix.edition }}" == "ee" ]]; then
echo "Metabase EE: image is going to be pushed to ${{ github.repository_owner }}/metabase-enterprise"
echo "DOCKERHUB_REPO=${{ github.repository_owner }}/metabase-enterprise" >> $GITHUB_ENV
echo "DOCKERHUB_VERSION=${{ needs.check-version.outputs.ee }}" >> $GITHUB_ENV
else
echo "Metabase OSS: image is going to be pushed to ${{ github.repository_owner }}/metabase"
echo "DOCKERHUB_REPO=${{ github.repository_owner }}/metabase" >> $GITHUB_ENV
echo "DOCKERHUB_VERSION=${{ needs.check-version.outputs.oss }}" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Tag the docker image
run: | # sh
docker pull $DOCKERHUB_REPO\:$DOCKERHUB_VERSION
docker tag $DOCKERHUB_REPO\:$DOCKERHUB_VERSION $DOCKERHUB_REPO\:$TAG_NAME
docker image ls $DOCKERHUB_REPO
SOURCE_ID=$(docker image ls $DOCKERHUB_REPO\:$DOCKERHUB_VERSION -q)
TAGGED_ID=$(docker image ls $DOCKERHUB_REPO\:$TAG_NAME -q)
if [[ $SOURCE_ID != $TAGGED_ID ]]; then
echo "Error tagging docker image"
exit 1
fi
docker push $DOCKERHUB_REPO\:$TAG_NAME
push-git-tags:
permissions: write-all
needs: check-version
runs-on: ubuntu-22.04
timeout-minutes: 5
strategy:
matrix:
edition: ${{ fromJson(needs.check-version.outputs.edition_matrix) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # we want all branches and tags
fetch-tags: true
- name: Add and push git tag
run: | # sh
if [[ "${{ matrix.edition }}" == "ee" ]]; then
git tag -f ${{ inputs.tag_name }}-ee ${{ needs.check-version.outputs.oss }}
git push origin -f ${{ inputs.tag_name }}-ee
elif [[ "${{ matrix.edition }}" == "oss" ]]; then
git tag -f ${{ inputs.tag_name }}-oss ${{ needs.check-version.outputs.oss }}
git push origin -f ${{ inputs.tag_name }}-oss
fi
update-version-info:
runs-on: ubuntu-22.04
needs: check-version
timeout-minutes: 5
strategy:
matrix:
edition: ${{ fromJson(needs.check-version.outputs.edition_matrix) }}
env:
AWS_S3_STATIC_BUCKET: ${{ vars.AWS_S3_STATIC_BUCKET }}
AWS_REGION: ${{ vars.AWS_REGION }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Generate new version info
uses: actions/github-script@v7
id: new_version_info
with:
result-encoding: string
script: | # js
const { updateVersionInfoChannel } = require('${{ github.workspace }}/release/dist/index.cjs');
const fs = require('fs');
const edition = '${{ matrix.edition }}';
const canonical_version = edition === 'ee'
? '${{ needs.check-version.outputs.ee }}'
: '${{ needs.check-version.outputs.oss }}';
const newVersionInfo = await updateVersionInfoChannel({
channel: '${{ inputs.tag_name }}',
newVersion: canonical_version,
rollout: ${{ inputs.tag_rollout }},
});
fs.writeFileSync('version-info.json', JSON.stringify(newVersionInfo));
- name: Upload new version-info.json to S3
run: |
if [[ "${{ matrix.edition }}" == "ee" ]]; then
aws s3 cp version-info.json s3://${{ vars.AWS_S3_STATIC_BUCKET }}/version-info-ee.json
else
aws s3 cp version-info.json s3://${{ vars.AWS_S3_STATIC_BUCKET }}/version-info.json
fi
- name: Create cloudfront invalidation for version-info.json and version-info-ee.json
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths "/version-info.json" "/version-info-ee.json"

View File

@@ -11,26 +11,40 @@ on:
commit:
description: 'A full-length commit SHA-1 hash'
required: true
skip-docker:
description: 'Skip Docker image publishing'
type: boolean
default: false
skip-s3:
description: 'Skip S3 artifact publishing'
type: boolean
default: false
skip-version-info:
description: 'Skip publishing version-info.json'
type: boolean
default: false
skip-tag:
description: 'Skip tagging the release'
type: boolean
default: false
skip-release-notes:
description: 'Skip publishing release notes'
release-channel:
description: 'The release channel to publish to (optional)'
type: choice
options:
- none
- latest
- beta
- nightly
required: true
default: 'none'
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
workflow_call:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
type: string
required: true
commit:
description: 'A full-length commit SHA-1 hash'
type: string
required: true
release-channel:
description: 'The release channel to publish to (optional)'
type: string
# options:
# - none
# - latest
# - beta
# - nightly
required: true
default: 'none'
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
@@ -74,21 +88,14 @@ jobs:
oss: getCanonicalVersion(version, 'oss'),
};
const ossReleased = await hasBeenReleased({
const released = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.oss,
});
const eeReleased = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.ee,
});
if (ossReleased || eeReleased) {
if (released) {
throw new Error("This version has already been released!", version);
}
@@ -185,6 +192,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: metabase-${{ matrix.edition }}-uberjar
overwrite: true
path: |
./metabase.jar
./COMMIT-ID
@@ -192,7 +200,6 @@ jobs:
./version.properties
upload-to-s3:
if: ${{ inputs.skip-s3 != true }}
runs-on: ubuntu-22.04
needs: download-uberjar
timeout-minutes: 15
@@ -230,38 +237,10 @@ jobs:
console.log("The download path for this", edition, "edition is", version_path);
return version_path;
- name: Determine if this is a latest version
uses: actions/github-script@v7
id: latest_path
with:
result-encoding: string
script: | # js
const { isLatestRelease, getCanonicalVersion } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const canonical_version = getCanonicalVersion(version, edition);
const isLatest = await isLatestRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: canonical_version,
});
console.log("Latest version?", isLatest);
if (isLatest) {
return edition === 'ee' ? 'enterprise/latest' : 'latest';
}
return "false";
- name: Upload to S3
run: aws s3 cp ./metabase.jar s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.version_path.outputs.result }}/metabase.jar
- name: Upload to s3 latest path
if: ${{ !inputs.auto && steps.latest_path.outputs.result != 'false' }}
run: aws s3 cp ./metabase.jar s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.latest_path.outputs.result }}/metabase.jar
- name: Create cloudfront invalidation
run: |
aws cloudfront create-invalidation \
@@ -270,7 +249,6 @@ jobs:
verify-s3-download:
if: ${{ inputs.skip-s3 != true }}
runs-on: ubuntu-22.04
needs: upload-to-s3
timeout-minutes: 15
@@ -287,7 +265,7 @@ jobs:
id: version_path
with:
result-encoding: string
script: |
script: | # js
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
@@ -304,7 +282,6 @@ jobs:
run: grep -q $(sha256sum ./metabase-downloaded.jar) SHA256.sum && echo "checksums match" || exit 1
containerize:
if: ${{ inputs.skip-docker != true }}
runs-on: ubuntu-22.04
needs: [check-version, download-uberjar]
timeout-minutes: 15
@@ -319,6 +296,8 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
# checkout the commit that was tagged so we get the right dockerfile
ref: ${{ inputs.commit }}
fetch-depth: 0 # IMPORTANT! to get all the tags
- name: prepare release scripts
run: cd release && yarn && yarn build
@@ -338,23 +317,6 @@ jobs:
console.log("The canonical version of this Metabase", edition, "edition is", canonical_version);
return canonical_version;
- name: Check if the container image should be tagged as latest
uses: actions/github-script@v7
id: latest_version_check
with:
result-encoding: string
script: |
const { execSync } = require("child_process");
const { isLatestVersion } = require('${{ github.workspace }}/release/dist/index.cjs');
const currentTag = '${{ inputs.version }}';
const allTags = execSync("git tag -l").toString("utf-8").split("\n");
const isLatest = isLatestVersion(currentTag, allTags);
console.log("Latest version?", isLatest);
return isLatest ? "latest" : "not-latest";
- uses: actions/download-artifact@v4
name: Retrieve previously downloaded Uberjar
with:
@@ -405,16 +367,7 @@ jobs:
docker push ${{ env.DOCKERHUB_REPO }}:${{ steps.canonical_version.outputs.result }}
echo "Finished!"
- name: Tag the container image as latest
if: ${{ !inputs.auto && steps.latest_version_check.outputs.result == 'latest' }}
run: |
echo "Pushing ${{ env.DOCKERHUB_REPO }}:latest ..."
docker tag localhost:5000/local-metabase:${{ steps.canonical_version.outputs.result }} ${{ env.DOCKERHUB_REPO }}:latest
docker push ${{ env.DOCKERHUB_REPO }}:latest
echo "Finished!"
verify-docker-pull:
if: ${{ inputs.skip-docker != true }}
runs-on: ubuntu-22.04
needs: containerize
timeout-minutes: 15
@@ -463,7 +416,6 @@ jobs:
timeout-minutes: 3
push-tags:
if: ${{ inputs.skip-tag != true }}
permissions: write-all
needs: [verify-s3-download, verify-docker-pull, check-version]
runs-on: ubuntu-22.04
@@ -482,21 +434,7 @@ jobs:
const { tagRelease } = require('${{ github.workspace }}/release/dist/index.cjs');
const OSSversion = '${{ needs.check-version.outputs.oss }}';
const EEversion = '${{ needs.check-version.outputs.ee }}';
// push EE tag
await tagRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: EEversion,
commitHash: '${{ inputs.commit }}',
}).catch((err) => {
console.error('Failed to tag release', EEversion, err);
process.exit(1);
});
// push OSS tag
await tagRelease({
github,
owner: context.repo.owner,
@@ -507,85 +445,9 @@ jobs:
console.error('Failed to tag release', OSSversion, err);
process.exit(1);
});
- name: Reorder release tags to put OSS first
run: |
git config user.name github-actions
git config user.email github-actions@github.com
$GITHUB_WORKSPACE/release/reorder-tags.sh ${{ needs.check-version.outputs.ee }} ${{ inputs.commit }}
trigger-docs-update:
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
needs:
- push-tags
- check-version
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
env:
NEW_OSS_VERSION: ${{ needs.check-version.outputs.oss }}
NEW_EE_VERSION: ${{ needs.check-version.outputs.ee }}
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
await github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: '${{ secrets.DOCS_REPO }}',
event_type: 'trigger-docs-update',
client_payload: {
version: '${{ inputs.version }}'
}
});
- uses: actions/checkout@v4
with:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: update releases.md
uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const fs = require('fs');
const releaseText = fs.readFileSync('./docs/releases.md', 'utf8');
const newReleaseText = releaseText
.replace(
/## Metabase Enterprise Edition releases\n\n/,
`## Metabase Enterprise Edition releases\n\n- [${process.env.NEW_EE_VERSION}](https://github.com/metabase/metabase/releases/tag/${process.env.NEW_EE_VERSION})\n`
)
.replace(
/## Metabase Open Source Edition releases\n\n/,
`## Metabase Open Source Edition releases\n\n- [${process.env.NEW_OSS_VERSION}](https://github.com/metabase/metabase/releases/tag/${process.env.NEW_OSS_VERSION})\n`
);
fs.writeFileSync('./docs/releases.md', newReleaseText);
- name: commit and push updates
run: | # bash
git config --global user.email "metabase-bot@metabase.com"
git config --global user.name "Metabase bot"
git checkout -b docs-add-$NEW_OSS_VERSION
cd docs/
git add releases.md
git commit -m "Add $NEW_OSS_VERSION to the list of releases"
git push origin docs-add-$NEW_OSS_VERSION --force
- name: open pr with updates
run: | # bash
gh pr create --fill \
--body "Like it says on the tin 😁" \
--label "Type:Documentation" \
--label "backport" \
--reviewer "jeff-bruemmer" \
--assignee "jeff-bruemmer"
trigger-cloud-issues:
if: ${{ !inputs.auto }}
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 10
@@ -624,12 +486,12 @@ jobs:
event_type: 'update-ee-extra-build',
client_payload: {
version: enterpriseVersion,
auto: '${{ inputs.auto }}',
auto: 'true', // always auto-merge
}
});
draft-release-notes:
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
if: ${{ !inputs.auto }}
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 15
@@ -638,41 +500,26 @@ jobs:
AWS_S3_DOWNLOADS_BUCKET: ${{ vars.AWS_S3_DOWNLOADS_BUCKET }}
DOCKERHUB_OWNER: ${{ vars.DOCKERHUB_OWNER }}
DOCKERHUB_REPO: ${{ vars.DOCKERHUB_REPO }}
strategy:
matrix:
edition: [oss, ee]
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: prepare release scripts
run: cd release && yarn && yarn build
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Read Checksum
run: |
CHECKSUM=$(cat SHA256.sum)
echo "CHECKSUM=$CHECKSUM" >> $GITHUB_ENV
- name: Publish draft release notes
uses: actions/github-script@v7
with:
result-encoding: string
script: |
script: | # js
const { publishRelease, getCanonicalVersion } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const edition = '${{ matrix.edition }}';
const canonical_version = getCanonicalVersion(version, edition);
await publishRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: canonical_version,
checksum: '${{ env.CHECKSUM }}',
version,
}).then(() => {
console.log('Successfully published release notes', '${{ inputs.version }}');
}).catch((err) => {
@@ -681,7 +528,6 @@ jobs:
});
publish-version-info:
if: ${{ !inputs.auto && inputs.skip-version-info != true }}
runs-on: ubuntu-22.04
needs: [push-tags, check-version]
timeout-minutes: 15
@@ -692,6 +538,11 @@ jobs:
AWS_S3_STATIC_BUCKET: ${{ vars.AWS_S3_STATIC_BUCKET }}
AWS_REGION: ${{ vars.AWS_REGION }}
steps:
- name: Finish early
if: ${{ inputs.auto }}
run: |
echo "skipping version info update for nightly patch"
exit 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
@@ -703,12 +554,12 @@ jobs:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Publish release notes
- name: Publish version info
uses: actions/github-script@v7
id: new_version_info
with:
result-encoding: string
script: |
script: | # js
const { getVersionInfo } = require('${{ github.workspace }}/release/dist/index.cjs');
const fs = require('fs');
@@ -739,10 +590,20 @@ jobs:
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths "/version-info.json" "/version-info-ee.json"
set-release-channel:
needs: publish-version-info
uses: ./.github/workflows/release-tag.yml
secrets: inherit
with:
version: ${{ inputs.version }}
tag_name: ${{ inputs.release-channel }}
tag_rollout: 100
tag_ee: true
tag_oss: true
publish-complete-message:
if: ${{ !inputs.auto }}
runs-on: ubuntu-22.04
needs: [draft-release-notes, verify-docker-pull, verify-s3-download, publish-version-info]
needs: set-release-channel
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
@@ -759,34 +620,7 @@ jobs:
script: | # js
const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
generalChannelName: 'general',
}).catch(console.error);
auto-publish-complete-message:
if: ${{ inputs.auto }}
runs-on: ubuntu-22.04
needs: [push-tags, verify-docker-pull, verify-s3-download]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send auto publish complete message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
const isAutoRelease = '${{ inputs.auto }}' === 'true';
await sendPublishCompleteMessage({
owner: context.repo.owner,
@@ -794,7 +628,7 @@ jobs:
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
generalChannelName: '',
generalChannelName: !isAutoRelease ? '${{ vars.SLACK_GENERAL_CHANNEL }}' : '',
}).catch(console.error);
manage-milestones:
@@ -813,12 +647,12 @@ jobs:
uses: actions/github-script@v7
with:
script: | # js
const { closeMilestone, openNextMilestones, isRCVersion } = require('${{ github.workspace }}/release/dist/index.cjs');
const { closeMilestone, openNextMilestones, isPreReleaseVersion } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
if (isRCVersion(version)) {
console.log("This is a release candidate, skipping milestone management");
if (isPreReleaseVersion(version)) {
console.log("This is a prerelease version, skipping milestone management");
return;
}

View File

@@ -16,6 +16,8 @@ on:
jobs:
monitor:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
name: Generate Snyk report
runs-on: ubuntu-22.04
steps:

View File

@@ -8,6 +8,8 @@ permissions:
jobs:
close-stale-prs:
# don't run this workflow on a cron for forks
if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
runs-on: ubuntu-22.04
steps:
- uses: actions/stale@v6

View File

@@ -83,21 +83,14 @@ jobs:
oss: getCanonicalVersion(version, 'oss'),
};
const ossReleased = await hasBeenReleased({
const released = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.oss,
});
const eeReleased = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.ee,
});
if (ossReleased || eeReleased) {
if (released) {
throw new Error("This version has already been released!", version);
}
@@ -155,7 +148,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17 # 11 throws an error on jar uf
java-version: 21
- name: Retrieve test build uberjar artifact for ${{ matrix.edition }}
id: find_release_artifact
@@ -233,25 +226,25 @@ jobs:
./COMMIT-ID
./SHA256.sum
trigger-tests:
needs: [tag-uberjar-for-release]
permissions:
actions: write
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: trigger pre-release testing
uses: actions/github-script@v7
with:
script: | # js
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'pre-release.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
auto: '${{ inputs.auto }}',
}
});
run-pre-release-tests:
name: Run pre-release tests for ${{ inputs.version }}
needs: tag-uberjar-for-release
uses: ./.github/workflows/pre-release.yml
secrets: inherit
with:
commit: ${{ inputs.commit }}
version: ${{ inputs.version }}
auto-publish-release:
name: Auto-publish release ${{ inputs.version }}
if: ${{ inputs.auto }}
needs: run-pre-release-tests
uses: ./.github/workflows/release.yml
secrets: inherit
with:
version: ${{ inputs.version }}
commit: ${{ inputs.commit }}
auto: ${{ inputs.auto }}
# for now don't auto-set release channel because we don't want to have
# multiple nightlies due to race conditions
release-channel: none

View File

@@ -1,157 +0,0 @@
name: Build + Docker Uberjar for SDK
on:
# This workflow will be called from "release-embedding-sdk.yml"
workflow_call:
inputs:
git_ref:
description: 'Valid git reference e.g. branches, tags, hashes'
type: string
required: true
image_name:
description: Docker image used to upload to Dockerhub
type: string
required: true
jobs:
build:
name: Build MB ${{ matrix.edition }}
runs-on: ubuntu-22.04
timeout-minutes: 40
strategy:
matrix:
edition: [ee]
env:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
- name: Build
run: ./bin/build.sh
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
with:
name: metabase-ee-uberjar
check_jar_health:
runs-on: ubuntu-22.04
name: Is ${{ matrix.edition }} (java ${{ matrix.java-version }}) healthy?
needs: build
timeout-minutes: 10
strategy:
matrix:
edition: [ee]
java-version: [11, 17]
steps:
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
with:
java-package: jre
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- run: java -version
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-ee-uberjar
- name: Launch uberjar
run: java -jar ./target/uberjar/metabase.jar &
- name: Wait for Metabase to start
run: while ! curl 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
containerize_test_and_push_container:
runs-on: ubuntu-22.04
name: Containerize ${{ matrix.edition }}
needs: check_jar_health
strategy:
matrix:
edition: [ee]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Extract and clean branch name
shell: bash
run: echo "branch=$(echo $GITHUB_REF_NAME | sed 's/[^-._a-zA-Z0-9]/-/g')" >> $GITHUB_OUTPUT
id: extract_branch
- name: Set image name to env
run: echo "image_name=${{ inputs.image_name || steps.extract_branch.outputs.branch }}" >> "$GITHUB_ENV"
- name: Verify the intended tag of the container image
run: echo "Container image will be tagged as ${{ env.image_name }}-${{ matrix.edition }}"
- name: Check out the code (Dockerfile needed)
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- name: Download uploaded artifacts to insert into container
uses: actions/download-artifact@v4
with:
name: metabase-ee-uberjar
path: bin/docker/
- name: Move the ${{ matrix.edition }} uberjar to the context dir
run: mv bin/docker/target/uberjar/metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2.5.0
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/metabase-dev:${{ env.image_name }}-${{ matrix.edition }}
no-cache: true
push: true
- name: Launch ${{ matrix.edition }} container
run: docker run --rm -dp 3000:3000 localhost:5000/metabase-dev:${{ env.image_name }}-${{ matrix.edition }}
timeout-minutes: 5
- name: Is Docker running?
run: docker ps
- name: Wait for Metabase to start and reach 100% health
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Retag and push images
run: docker tag localhost:5000/metabase-dev:${{ env.image_name }}-ee ${{ github.repository_owner }}/metabase-dev:${{ env.image_name }} && docker push ${{ github.repository_owner }}/metabase-dev:${{ env.image_name }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
env:
TRIVY_OFFLINE_SCAN: true
with:
image-ref: docker.io/${{ github.repository_owner }}/metabase-dev:${{ env.image_name }}
format: sarif
output: trivy-results.sarif
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'

View File

@@ -4,6 +4,8 @@ on:
push:
branches:
- "master"
- metabot-v3-second-try
- feature-visualizer
paths-ignore:
# config files
- ".**"
@@ -41,6 +43,9 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
# Build with Java 11 so they compiled code doesn't try to use Java >11 classes... see
# https://metaboat.slack.com/archives/C5XHN8GLW/p1731517744549619?thread_ts=1731504670.951389&cid=C5XHN8GLW
java-version: 11
- name: Build
run: ./bin/build.sh
- name: Prepare uberjar artifact
@@ -56,7 +61,7 @@ jobs:
strategy:
matrix:
edition: [ee, oss]
java-version: [11, 17]
java-version: [11, 17, 21]
steps:
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
@@ -70,7 +75,8 @@ jobs:
with:
name: metabase-${{ matrix.edition }}-${{ github.sha }}-uberjar
- name: Launch uberjar
run: java -jar ./target/uberjar/metabase.jar &
run: >-
java --add-opens java.base/java.nio=ALL-UNNAMED -jar ./target/uberjar/metabase.jar &
- name: Wait for Metabase to start
run: while ! curl 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
@@ -80,12 +86,16 @@ jobs:
needs: check_jar_health
strategy:
matrix:
edition: [ee, oss]
edition: [ee, oss, ee-extra]
services:
registry:
image: registry:2
ports:
- 5000:5000
permissions:
id-token: write
contents: read
security-events: write
steps:
- name: Extract and clean branch name
shell: bash
@@ -98,12 +108,24 @@ jobs:
with:
ref: ${{ github.event.inputs.commit }}
- name: Download uploaded artifacts to insert into container
if: ${{ matrix.edition != 'ee-extra' }}
uses: actions/download-artifact@v4
with:
name: metabase-${{ matrix.edition }}-${{ github.sha }}-uberjar
path: bin/docker/
- name: Download uploaded artifacts to insert into container
if: ${{ matrix.edition == 'ee-extra' }}
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.sha }}-uberjar
path: bin/docker/
- name: Move the ${{ matrix.edition }} uberjar to the context dir
run: mv bin/docker/target/uberjar/metabase.jar bin/docker/.
- name: Add partner drivers to the container
if: ${{ matrix.edition == 'ee-extra' }}
uses: ./.github/actions/build-ee-extra
with:
iam-role: ${{ secrets.METABASE_EE_EXTRA_IAM_ROLE }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2.5.0
@@ -133,44 +155,57 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Retag and push images if master (ee)
if: ${{ (github.ref_name == 'master') && matrix.edition == 'ee' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-ee ${{ github.repository_owner }}/metabase-enterprise-head:latest && docker push ${{ github.repository_owner }}/metabase-enterprise-head:latest
# TODO: remove when we're done testing metabot
- name: Retag and push images if metabot-v3-second-try (ee)
if: ${{ (github.ref_name == 'metabot-v3-second-try') && matrix.edition == 'ee' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-ee ${{ github.repository_owner }}/metabase-enterprise-head:metabot && docker push ${{ github.repository_owner }}/metabase-enterprise-head:metabot
- name: Retag and push images if master (oss)
if: ${{ (github.ref_name == 'master') && matrix.edition == 'oss' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-oss ${{ github.repository_owner }}/metabase-head:latest && docker push ${{ github.repository_owner }}/metabase-head:latest
- name: Retag and push images if master (ee-extra)
if: ${{ (github.ref_name == 'master') && matrix.edition == 'ee-extra' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-ee-extra ${{ secrets.METABASE_EE_EXTRA_CONTAINER_REGISTRY }}/metabase-enterprise-head:latest && docker push ${{ secrets.METABASE_EE_EXTRA_CONTAINER_REGISTRY }}/metabase-enterprise-head:latest
- name: Retag and push images if dev branch
if: ${{ !(startsWith(github.ref_name,'master') || startsWith(github.ref_name,'backport')) && matrix.edition == 'ee' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-ee ${{ github.repository_owner }}/metabase-dev:${{ steps.extract_branch.outputs.branch }} && docker push ${{ github.repository_owner }}/metabase-dev:${{ steps.extract_branch.outputs.branch }}
- name: Run Trivy vulnerability scanner if master (ee)
if: ${{ (github.ref_name == 'master') && matrix.edition == 'ee' }}
uses: aquasecurity/trivy-action@master
uses: aquasecurity/trivy-action@0.28.0
env:
TRIVY_OFFLINE_SCAN: true
with:
image-ref: docker.io/${{ github.repository_owner }}/metabase-enterprise-head:latest
format: sarif
output: trivy-results.sarif
version: "v0.57.1"
- name: Run Trivy vulnerability scanner if master (oss)
if: ${{ (github.ref_name == 'master') && matrix.edition == 'oss' }}
uses: aquasecurity/trivy-action@master
uses: aquasecurity/trivy-action@0.28.0
env:
TRIVY_OFFLINE_SCAN: true
with:
image-ref: docker.io/${{ github.repository_owner }}/metabase-head:latest
format: sarif
output: trivy-results.sarif
version: "v0.57.1"
- name: Run Trivy vulnerability scanner if dev branch
if: ${{ !(startsWith(github.ref_name,'master') || startsWith(github.ref_name,'backport')) && matrix.edition == 'ee' }}
uses: aquasecurity/trivy-action@master
uses: aquasecurity/trivy-action@0.28.0
env:
TRIVY_OFFLINE_SCAN: true
with:
version: "v0.57.1"
image-ref: docker.io/${{ github.repository_owner }}/metabase-dev:${{ steps.extract_branch.outputs.branch }}
format: sarif
output: trivy-results.sarif

1
.gitignore vendored
View File

@@ -77,6 +77,7 @@ target/checksum.txt
xcshareddata
xcuserdata
dev/src/dev/nocommit/
dev/serialization_deltas/
*~
**/cypress_sample_database.json
**/cypress_sample_instance_data.json

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Some files were not shown because too many files have changed in this diff Show More