Compare commits

...

1727 Commits

Author SHA1 Message Date
Sloan Sparger
4266144274 hackin', yah know? 2024-08-30 10:26:04 -05: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
Chris Truter
d2fc33a3b5 Add missing field to serialization exception (#46883) 2024-08-15 10:37:22 +00:00
Uladzimir Havenchyk
bb79405630 ci: deduplicate e2e-tests clojure cache (#46770) 2024-08-15 13:03:58 +03:00
Mahatthana (Kelvin) Nomsawadi
acf87c0cdb Remove incorrect logic to hide hidden db fields (#46876) 2024-08-15 09:23:27 +00:00
Oleksandr Yakushev
1e9bd94d9b perf: Reuse ZoneRegion/UTC instead of creating new object when parsing dates (#46871) 2024-08-15 12:15:34 +03:00
Chris Truter
121b89ab07 Clean up serdes v2 exceptions (#46577) 2024-08-15 09:07:06 +00:00
Nicolò Pretto
e79b57b11e reduce logs during setup tests (#46834)
* refactor: memoize getSteps selector

* screen.getXXX.click() => userEvent.click(...) to avoid missing act() warning

* use mockSettings so that MetabaseSettings.setAll is called and we avoid the unknown features warning
2024-08-15 11:06:43 +02:00
Ngoc Khuat
266c96a595 Speed up updating user parameter value (#46615) 2024-08-15 07:35:14 +00:00
Uladzimir Havenchyk
643dc98b58 ci: restore default strategy for yarn cache (#46768) 2024-08-14 15:42:13 -06:00
Uladzimir Havenchyk
a9ac74047e ci(manual backport): improve logic for searching commit that wasn't merged correctly (#46729)
* ci(manual backport): improve logic for searching commit that wasn't merged correctly

* fixup
2024-08-15 00:29:23 +03:00
Cam Saul
80af26758b Add Kondo linter to disallow hardcoded driver names in tests (#41384)
* Add Kondo linter to disallow hardcoded driver names in tests

* Fix all tests using hardcoded driver names

* Test fixes 🔧

* Appease Kondo

* Remove normal-drivers-except

* Test fix 🔧

* Test fixes 🔧

* MongoDB test fixes
2024-08-14 20:23:38 +00:00
Nick Fitzpatrick
bd13952fca 46657 pulse edit migration (#46693)
* Functional and typed

* migrate Recipient Picker

* removing dead code
2024-08-14 16:41:07 -03:00
Raphael Krut-Landau
2b7741f594 fix(browse): Use a simple, CSS-based approach to representing paths responsively (#46530) 2024-08-14 15:36:56 -04:00
Uladzimir Havenchyk
e426b1a3b9 make local cypress dx great again (#46839) 2024-08-14 17:32:45 +02:00
Mahatthana (Kelvin) Nomsawadi
76cb82a047 Theme Mantine DatePicker (#46816)
* Remove unpassed props

* Add tests

* Theme mantine date picker
2024-08-14 16:27:49 +01:00
Nicolò Pretto
365e8d9e76 convert hasPremiumFeature to TypeScript and add missing token features keys (#46837) 2024-08-14 14:11:23 +00:00
metamben
8030e76ad0 Remove support for questions with metric source (#46789)
* Remove support for questions with metric source

* Fix e2e test
2024-08-14 17:04:38 +03:00
Romeo Van Snick
bf07ac9263 Moving average with offset clause (#46726)
* Add type picker to comparison modal

* Adjust offset input labels based of comarison type

* Pass comparisonType to column picker

* Add current period picker

* Use deepCompareEffect to avoid rerender loops

* Add moving average helpers

* Add moving average clause to query

* Prevent less than 1 period moving average from being created

* Fix unit test for CompareAggregations

* Use the ComparisonType type for the comparisonType arg

* Hardcode the mapping for offset <-> moving-average column types

* Convert column types in the comparisonType callback instead of a hook

* Remove unused parameter

* Automatically change to 2 when setting an invalid value for moving average periods

* Use expression parts in test

* Use named arguments for movingAverage

* Fixup test for moving average offset input

* Fix type issue

* Pass on includePreviousPeriod to getAggregations
2024-08-14 15:42:00 +02:00
Anton Kostenko
0a4806ed0c Switch Perf test events to labels from comments (#46835)
* Switch Perf test events to labels from comments
2024-08-14 09:34:07 -04:00
Phoomparin Mano
3df927c974 fix(sdk): optimistic update query builder and update questions in notebook (#46652)
* update question state

* update question state

* reload metadata for runQuestionOnNavigate

* fix runnable queries

* fix cannot run question

* extract question predicate functions to question.ts

* update types

* create utils subfolder for query builder

* fix query builder predicate imports

* naming tweaks to be more self-explanatory

* document the non-intuitive loadQuestion useEffect

* change imports to support metric

* remove unused import

* revert originalQuestion check to try to fix e2e failures

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-14 20:12:38 +07:00
John Swanson
621d3fe3f7 Don't disable triggers before data perms migration (#46826)
I didn't consider that we might not have permissions necessary to
disable triggers.
2024-08-14 05:56:26 -07:00
Anton Kostenko
30ce108c9a Switch perf test trigger from label to comment (#46828) 2024-08-14 08:39:58 -04:00
Anton Kostenko
75cbcb033f Add workflow to run per test on pr by /perf command (#46779)
* Add workflow to run per test on pr by /perf command

* Fix yaml name
2024-08-14 08:04:46 -04:00
Nemanja Glumac
234e32135a Remove the assertion about the tooltip on returning to the notebook page (#46805) 2024-08-14 11:43:43 +00:00
Kamil Mielnik
a4f1223d1d Remove flaky tag (#46822) 2024-08-14 11:06:44 +00:00
Oisin Coveney
30bf9c3225 Add label for #46771 test (#46821) 2024-08-14 10:27:15 +00:00
Oisin Coveney
7fa6cf56f2 fix #46765 - Add dashboard filter popover does not close on click outside (#46771) 2024-08-14 12:59:33 +03:00
Kamil Mielnik
c805442231 Fix column-compare.cy.spec.ts flake (#46817)
* Fix flake

* Inline the function
2024-08-14 16:55:07 +07:00
Uladzimir Havenchyk
fab6177105 dx: handle CSP errors in pivot table (#46766) 2024-08-14 09:53:37 +00:00
lbrdnk
d62f868fb8 Enable type info computation for string id fields (#46488)
* Enable type info computation for fields coming from model source query

* Add test

* Add handling for fields coming from joins
2024-08-14 10:34:29 +02:00
Oisin Coveney
07767290f5 Fix broken popover in Segments form (#46723) 2024-08-14 11:30:11 +03:00
Romeo Van Snick
9fa749d6b8 Automatically select offset breakout or move it to the front (#46573)
* Add defaultTemporalBucket helper

* Add helper to pick default breakout

* Move breakout to the front or add one if it does not exist

* Add updateQuery to AggregationPicker props

* Add tests for creation and reordering of temporal breakouts

* Reuse defaultTemporalBucket in withDefaultTemporalBucket

* Reorder query operations to make sure the correct names get generated

* Remove dependency on referential equality of breakout

* Rename updateQuery to onQueryChange

* Remove onAddAggregations and onUpdateAggregation for onQueryChange

* Extract query update in to separate function

* Remove on{Add,Update,Remove}Aggregation in favor of onQueryChange

* Remove aggregations from summarize details

* Fix e2e tests

* Remove conflicting test

* Fix recent clause in unit tests

* Fix superflouous check for columnAndBucket

* Future proof breakout check

* Remove reliance on details in the useSummarize hook

* Remove details in unit tests

* Removal of default summarization should not trigger a query change
2024-08-14 10:25:22 +02:00
Mahatthana (Kelvin) Nomsawadi
763ebb7421 Fix exported png got different backgrounds based on screen density (#46769) 2024-08-14 08:15:16 +01:00
github-automation-metabase
e2bcdb1462 Add v0.50.20 to the list of releases (#46804)
* Add v0.50.20 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-08-14 00:54:12 +00:00
metamben
e4d8849516 Fix handling explicit joins in metrics (#46798) 2024-08-14 02:43:30 +03:00
Alexander Polyankin
a7e59b9863 Expect broken field refs in filter drills (#46691)
* Handle column matching errors

* Fix test

* Fix test

* Fix test

* Fix test

* Fix test
2024-08-13 19:12:32 -04:00
Aleksandr Lesnenko
2cf4f2d42c disallow close global function usage (#46753) 2024-08-13 22:08:02 +00:00
github-automation-metabase
e38e689b6c Add v0.49.23 to the list of releases (#46800)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-13 17:45:02 -04:00
Nemanja Glumac
0ff6ef5224 e2e: Fix dashboard ID filter flakes (#46787) 2024-08-13 20:33:45 +02:00
metamben
460ac41f6f Use the metric's source instead of the metric itself as base (#46688) 2024-08-13 14:21:37 -04:00
Nemanja Glumac
719f3ed6ac e2e: Fix dashboard number filter flakes (#46785)
* Try to fix dashboard-filters-number flake

* Try to fix dashboard-filters-number flake

* Intercept all dashboard data requests for number filters
2024-08-13 19:56:42 +02:00
Anton Kulyk
02f5a20e38 Ellipsify long dashboard filter values (strings only) (#46073)
* Clean up `Ellipsified`

* Add `multiline` prop to `Ellipsified`

* Ellipsify long string parameter values
2024-08-13 16:38:02 +01:00
Noah Moss
873fc865d5 Speed up permissions migrations (round 2) (#46393)
* new version of data_access migration + run ANALYZE beforehand

* relax constraints on migration timestamps

* more migration rewrites

* fix bug in migration

* fix another bug and remove extraneous logging

* reorder migrations to fix ID validation

* start adapting the changes to mysql as well

* wip

* add more ANALYZE calls

* revert logging changes

* finish duplicating work for mysql + a bit of clean up

* create H2 versions of migrations without the ANALYZE calls

* remove ANALYZE call from view_data.sql (probably not necessary)

* fix mysql syntax

* fix another mysql bug

* another mysql fix

* Don't exclude inactive tables for data_access

* Don't write rows for Administrators group

* Don't write rows for Admins (H2/MySQL)

* disable triggers before perms migration

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-08-13 08:06:07 -07:00
github-automation-metabase
73c7e67505 Update Readme version references and published npm version to 0.1.30 (#46772) 2024-08-13 13:53:29 +00:00
Phoomparin Mano
4c3df61d2a feat(sdk): generate sample react component with the embedding cli (#46538)
* add setup commands

* fix settings definition

* update environment variables for cli

* handle instances not being ready

* update error messages

* add more specific loading messages

* loading spinner state

* improve error message

* use a fixed demo setup token

* remove extraneous spinner

* update status checks

* update container messages

* update wait timing

* create api keys

* extract constants

* remove manual steps

* Add anonymous tracking + other things. will need to clean up

* Modify SDK for better structure

* remove line from print.ts

* Update webpack.embedding-sdk-cli.config.js back to production

* Add types and add quick note

* Fix a typo

* Add index file, simplify types, use an array

* Add safer json parsing

* use delay of 100ms between each setup call

* Suggestions from review

* ensure that cli works

* Attempt to fix jest errors

* Remove node-fetch from sdk code to hopefully get unit tests working again

* add database connection

* add connection details handling

* refactor asking for database connection info

* apply actual database id for syncing schema

* fix failing database sync step

* allow table selection

* create model for each table

* handle errors in model creation

* fix incorrect model display name

* create x-rays based on user data

* consolidate instance setup message

* workaround for inquirer eventemitter issue

* add sample components

* fix yarn.lock file

* add sample components

* set spinner to fail state when instance setup fails

* use a transparent background by default

* update cli welcome messages

* add import notice

* refactor imports

* update snippet to add dashboard dropdown

* cli add credential file to users .gitignore

* add docs on quickstart

* clear screen with console.clear

* address code review feedback

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

* allow node 18 lts

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-08-13 20:30:13 +07:00
Nemanja Glumac
67644874f3 Repro #46756: Add/remove a single column in a model with tables joined by themselves adds/removes all columns (#46757) 2024-08-13 12:05:30 +02:00
Uladzimir Havenchyk
82e95749fd fix: get correct values from theme to fill css variables (#46740) 2024-08-13 12:47:07 +03:00
Chris Truter
558cf9463c Fix false negatives for query reference validation (#46735) 2024-08-13 08:29:55 +00:00
Mahatthana (Kelvin) Nomsawadi
ea3007efb3 Fix conventional commit reminder (#46760)
* Fix conventinoal commit reminder

* debug conventional commit reminder

* debug conventional commit reminder

* Revert readme used to test the workflow
2024-08-13 08:33:12 +01:00
Luis Paolini
9a33e10893 fix(sdk): always pull the latest image in the cli (#46739)
Fixes https://github.com/metabase/metabase/issues/46738
2024-08-13 14:12:35 +07:00
Nicolò Pretto
210aebe60b fix(sdk): increase setup timeout to 15s to avoid 'user already created' issue on retry 2024-08-13 14:09:41 +07:00
Nicolò Pretto
8b4f855411 fix(sdk): fix health endpoint when polling whether metabase instance is ready (#46730) 2024-08-13 14:05:00 +07:00
Nicolò Pretto
df81b2de3b fix(sdk): make sure generated password has at least one number, one upper case and one lower case character to avoid issues with password policies (#46737) 2024-08-13 14:04:21 +07:00
Mahatthana (Kelvin) Nomsawadi
7fd0d80201 Fix tooltip style is mistakenly applied to popover (#46683)
* Fix tooltip styles leaking to popover

* Fix snapshot now showing the tooltips and dropdowns

* Update the loki snapshot using built storybook for consistency
2024-08-13 06:41:20 +00:00
Nemanja Glumac
b7fad81ddb Fix the distance between "Field to map to" and "required" (#46747) 2024-08-13 07:25:20 +02:00
Nemanja Glumac
020f98c28c Prevent opening data source in a new tab for embedding SDK (#46743)
* Prevent opening data source in a new tab for embedding SDK

* Add unit tests for embedding SDK context
2024-08-13 07:24:42 +02:00
Ryan Laurie
63295cefc6 Remove unnecessary api call from create collection form (#46736) 2024-08-12 17:02:55 -06:00
Nemanja Glumac
1cce770449 test: Update embedding state mocks (#46744) 2024-08-13 00:52:35 +02:00
Alexander Polyankin
cb79783158 FE - Support multiple breakout positions (#46555) 2024-08-12 16:54:37 -04:00
appleby
6f8332bcca Add appleby to team.json and github-slack-map.json (#46748)
* Add appleby to Query Processor team in team.json

* Add appleby to github-slack-map.json
2024-08-12 17:45:05 -03:00
Nemanja Glumac
f5ac1f279c Show loading state while fetching data in a new model page (#46694)
* Show new model loading state while fetching

* Show new model loading state while fetching

* Add unit test

* Use `DelayedLoadingSpinner` instead

* Update the test

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

* Prettier

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-08-12 21:39:47 +02:00
adam-james
34e0b67ca9 Add Timeseries insights even when Custom Columns exist (#46253)
* Add Timeseries insights even when Custom Columns exist

WIP

Fixes 46244

I don't know why it was (maybe still is) required that the :other columns be empty before providing insights.

* might be a solution to changing trendlines when data doesn't change

The insights code that powers the frontend trendline requires taking a sample of the dataset.

This sampling has some randomness associated by design, and should maintain its randomness. But it makes some sense to
use the exact same sample when the input has not changed at all, hence trying this memoize approach out.

Might not be the final solution, but it's a start

* add test to show that insights are computed

* use java.util.random with a seed to keep insights stable
2024-08-12 10:00:34 -07:00
Oisin Coveney
8e918199f8 Convert Dashboard Header buttons to Mantine (#46632) 2024-08-12 19:23:28 +03:00
Duncan Mak
86d2e1bbc1 Support hhmm timezone format (#46172)
* Add testcase from https://github.com/metabase/metabase/issues/43915

* Try a custom formatter if the default formatter for OffsetDateTime doesn't work

* Add testcase

* Make auxillary formatter private

* Catch a more specific exception

* Throw IllegalArgumentException on invalid dates

* Use strict resolver and fix test

* Empty commit to assign credit where it's due

---------

Co-authored-by: Chris Truter <chris@metabase.com>
2024-08-12 18:04:17 +02:00
adam-james
47d9fc19c5 Dowload Row Limit Env Var (#46401)
* Dowload Row Limit Env Var

Adds `MB_DOWNLOAD_ROW_LIMIT` to enable changing the row limit on downloads and alert/subscription attachments (not the
rendered tables, but the .csv, etc.).

Based on: #44982 (Thanks, @r-kot)

Partially implements: #28144

The difference in this PR compared to #44982 is that the download limit applies to all downloads, the only exception
being when the limit is above `qp.i/absolute-max-results` (1048575, based on Excel's limitation); in such a case, the
user supplied limit is only used if the download is csv or json, and `qp.i/absolute-max-results` is used for xlsx.

This PR also fixes alert/subscription attachment limits; prior to this, they were set to the in-app limit of 2000
rows, but now they will follow the user supplied download-row-limit.

This PR also adds a test to the downloads-and-exports test namespace, confirming that they follow the supplied limit,
or the max limit if none is supplied.

* add test confirming the default limit works

* fix test to use the download-row-limit

* address review feedback

* Update src/metabase/public_settings.clj

Co-authored-by: Cal Herries <39073188+calherries@users.noreply.github.com>

* add test covering case where download-row-limit is unset

---------

Co-authored-by: Cal Herries <39073188+calherries@users.noreply.github.com>
2024-08-12 14:57:52 +00:00
Uladzimir Havenchyk
b53a898e12 ci: move flaky specs to jail (#46715) 2024-08-12 17:19:11 +03:00
Kamil Mielnik
bcd1a90cb6 Refactor parameters filters utils to TS (#46719)
* Refactor filter utils to TS

* Remove type casts

* Improve dimension instantiation

* Fix typing
2024-08-12 14:15:48 +00:00
Chris Truter
eca4bb5f84 Improve test coverage around query_table (#46718) 2024-08-12 13:41:53 +00:00
Denis Berezin
10e21e2507 feat(sdk): Add edit mode for interactive dashboard component (#46255) 2024-08-12 16:33:35 +03:00
Uladzimir Havenchyk
84433da548 dx: get rid of csp error from cljs devtool (#46705) 2024-08-12 16:30:58 +03:00
Alexander Solovyov
92aed870d0 [serdes] convert database, card and dashboard with friends to using spec (#46147) 2024-08-12 16:19:57 +03:00
Nick Fitzpatrick
8dbe627364 44723 human readable coercion strategies (#46347)
* Revert "Remove unused humanizeCoercionStrategy and its test suite (#36136)"

This reverts commit 5375347e33.

* humanize coercion strategies, add e2e test

* unit test adjustment

* pr feedback
2024-08-12 09:26:51 -03:00
Uladzimir Havenchyk
3313704cd5 refactor: replace lodash with alternatives and forbid its usage (#46660)
* dx: raise an error if lodash is used

* fix lint errors

* use ts-deepmerge

* don't throw an error

* use correct type

* use merge form icepick
2024-08-12 11:31:47 +00:00
Chris Truter
b8adf4d5c1 Fix query analysis clean up and add logging (#46651) 2024-08-12 12:49:43 +03:00
Alexander Solovyov
1628d5fa67 [serdes] ability to skip errors (#46591) 2024-08-12 09:46:36 +00:00
Oisin Coveney
056b6a39da Convert QueryBuilder action buttons to Mantine (#46631) 2024-08-12 11:20:21 +03:00
Oisin Coveney
abacb880e6 fix(sdk): Add location-specific provider for SDK (#46681) 2024-08-12 11:19:40 +03:00
Ngoc Khuat
479b3e385f limit the anon stats on query execution to 30 days (#46560) 2024-08-12 05:02:55 +00:00
Oleksandr Yakushev
a97bdb2529 perf: Use database-id instead of database object in memoizing calls to driver/supports? (#46673) 2024-08-10 10:05:30 +03:00
Aleksandr Lesnenko
f83bfa6601 Fix exports E2E flakes (#46690)
* conditional dismissal step

* check for download status in the container

* try fixing flakes again

* try again

* chartPathWithFillColor already verifies chart has been rendered
2024-08-10 00:39:25 -04:00
Nemanja Glumac
528cccd9a0 Safely open in a new tab for a subpath scenario (#46684)
* Introduce subpath-safe URL utils

* Open data source links from a notebook safely on a subpath

* Open browse model links safely on a subpath

* Uniform naming

* Use the existing URL helper

* Trim url

* Add unit tests

* Add one more test case

* Fix test name 😅

* Make URLs non-optional strings
2024-08-09 22:17:18 +00:00
adam-james
c35f2503c3 Export Formatting Correctness (#46306)
* Export Formatting Correctness

WIP

Several bugs exist around the correctness of export formatting, this aims to fix them.

Fixes #27374

When a model has viz settings/metadata changed after save, the download won't incorporate said changes. At least it's
clear that scale doesn't work.

* number formatter merges settings from columns too

* column formatting on aggregated cols works in xlsx now too

* fixes 43040 by grabbing global-type-settings in csv formatter
2024-08-09 12:50:12 -07:00
github-automation-metabase
b5ad29da99 Update Readme version references and published npm version to 0.1.29 (#46686) 2024-08-09 17:43:58 +00:00
Raphael Krut-Landau
d36ee579d6 fix(admin/performance): Ensure that the tab's title (e.g. Database caching) and 'Performance' are visible in document title (#46602) 2024-08-09 13:37:36 -04:00
Oleksandr Yakushev
7397af5897 Include function name in generated lambda name when using malli/defn (#46678) 2024-08-09 20:16:49 +03:00
Oisin Coveney
db5347d5e3 Split form component from SaveQuestionModal (#46649) 2024-08-09 17:57:34 +03:00
Mahatthana (Kelvin) Nomsawadi
69e011853d fix(sdk): Fix unmapped theme colors (#46650)
* Refactor

* Fix wrong colors when passing empty SDK `colors`

* Clean up CSS custom properties

* Add missing color mapping to the SDK

* Add missing colors to the main app

* Only override additional dynamic colors when values are passed

* Fix unit tests

* Address review

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

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-08-09 14:11:37 +00:00
Uladzimir Havenchyk
7c77185acb dx: get rid of most of CSP errors in dev mode (#46666)
* dx: get rid of csp errors in TableInteractive

* get rid of csp errors in mantine
2024-08-09 16:14:49 +03:00
Romeo Van Snick
e6b84e42e0 Move the compare to the past aggregation to the bottom of the dropdown and hide it when no temporal breakouts are available (#46500)
* Move the compare to the past aggregation to the bottom of the dropdown

* Fix missing icon property

* Hide 'Compare to the past' when there are no temporal columns

* Update copy in tests

* Add test for questions with no temporal columns

* Fix unit test for AggregationPicker

* Allow adding a compare aggregation when the first breakout is not temporal too

* Rename to 'Compare to the past' in custom column action

* Rename to 'Compare to the past' in column drill

* Update copy in tests for actions and drills

* Move canAddTemporalAggregation to CompareAggregation utils

* Use aggregations from the query always

* Remove unnecessary displayName check
2024-08-09 11:24:08 +02:00
adam-james
d5884d5706 Last Used Param Value doesn't fill in with default value if cleared (#46468)
* Last Used Param Value doesn't fill in with default value if cleared

Fixes #46368

The Last used parameter value is cleared when the frontend sends `nil` as the parameter's value. This works except in
cases where a user clears a parameter with a default value. In this case, we want to indicate that the parameter is
cleared, so we store `nil` in the appdb in such a case.

* Update src/metabase/query_processor/dashboard.clj

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

* add assertion showing that 'nil' with default is still stored

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-08-08 17:44:34 -07:00
Ryan Laurie
e5950f94ac Log full version history in release log (#46659)
* log full version history

* remove test code
2024-08-08 16:10:40 -06:00
Case Nelson
a37544cc80 fix: uuid join conditions should not cast (#46614)
Fixes: #46558

In #45575 we introduced casting uuid fields for drilldowns.

However we failed to include a check that the rhs was itself another
field of uuid type and so no casting should occur. This broke joins on
models when the database_type of the field may not be known.
2024-08-08 16:05:39 -06:00
Aleksandr Lesnenko
ad537f2ad9 fix downloads e2e flakes (#46612)
* fix downloads e2e flakes

* fix flake
2024-08-08 19:31:54 +00:00
Nemanja Glumac
94134a2600 MS2 follow up: add more unit tests for joins (#46619)
* MS2 follow up: add more unit tests for joins

* Address review comments re: variable naming
2024-08-08 19:25:10 +00:00
Nemanja Glumac
e56f1b6486 MS3: Open notebook data source in new tab (tooltip) (#46552)
* Add tooltip to the data step cell

* Conditionally display tooltip

* Add unit tests for the data step

* Add unit tests for the join step

* Move the abstraction to the NotebookDataPicker

* Cover the tooltip behavior with E2E test

* Update test
2024-08-08 18:55:48 +00:00
Emmad Usmani
a4bec904a6 automatically use compact formatting for pie chart total (#46505)
* automatically use compact formatting for pie chart total

* add story and snapshots
2024-08-08 15:45:35 +00:00
Mahatthana (Kelvin) Nomsawadi
cf7a09e3a1 More styling on dark theme (#46637) 2024-08-08 16:40:33 +01:00
Nick Fitzpatrick
82d25cafe2 45003 entity picker recents context (#46289)
* useLogRecentItem

* updating tests

* unit tests

* e2e test

* PR Feedback

* log questions / models

* Accept :dataset instead of :model

* Adding e2e test for recent activity datasets, reverting 'await' changes

* Add e2e for collection moving error

---------

Co-authored-by: dan sutton <dan@dpsutton.com>
2024-08-08 11:57:11 -03:00
Oisin Coveney
ae9cae6ed9 Add ToolbarButton to start replacing dashboard header buttons (#46628) 2024-08-08 17:34:33 +03:00
Uladzimir Havenchyk
6d8c039239 ci: replace docker-compose and fix mba usage (#46517) 2024-08-08 17:17:14 +03:00
Oisin Coveney
ea677b3696 Refactors getScheduleText to use ts-pattern (#46627) 2024-08-08 16:41:31 +03:00
Kamil Mielnik
4957660c6c FE - Cover Unit of Time in getParameterColumns with tests (#46529)
* Add test boilerplate

* Rename test and add assertions

* Add broken test for models

* Add unit of time tests

* Deduplicate code

* Add date parameter tests

* Add test for multiple stages

* Fix model test setup and refactor getColumnsInfos

* Remove redundant assertions

* Format codee

* Extract createQuestion and createModel

* Add unit of time model tests

* Add test for model

* Extract constants

* Add a warning

* Build dataset queries with mbql

* Introduce queryOrders

* Revert redundant change

* Improve Question creation
2024-08-08 13:25:04 +00:00
Alexander Polyankin
448eaa0eed Disable broken card refs (#46594)
* Try without broken refs

* Disable broken test

* Disable broken test
2024-08-08 08:49:15 -04:00
Chris Truter
13da5ff5aa Disable Validation API if Analysis is disabled (#46266) 2024-08-08 12:09:26 +00:00
Oisin Coveney
162e24a78a Split AlertModals into multiple files (#46376) 2024-08-08 15:00:20 +03:00
Mahatthana (Kelvin) Nomsawadi
cfee367c09 Fix spammy GitHub Actions comments (#46625)
* Fix spammy GitHub Actions comments

* [DEBUG] trigger conventional commit reminder

* fix syntax errors

* Mock update

* mock another update

* 3rd update

* test if the comment would be updated only if the actual commet changes

* Remove all code relating to testing

* Fix type not compatible with node 18
2024-08-08 12:56:42 +01:00
Chris Truter
6da3a02502 Hide non-qualified fields from query validator (#46587) 2024-08-08 13:51:21 +02:00
Mahatthana (Kelvin) Nomsawadi
a4df4eb7c5 Follow-up milestone 2 for [Epic] Re-design transparent theme for static embedding and public links (#46491)
* Update new Metabase base colors

* Make hover and selected state consistency

* Fix wrong embed frame border color

* Refactor: extract props

* Fix border color

* Fix pivot table cell hover color

* Fix smart scalar text contrast

* Add smart scalar tests + update text color design

* Theme dashboard card menu

* Remove dashcard action menu tests since they don't work in loki

* Fix storybook background color for dark theme

* Update loki snapshots

* Disable untestable tests

* Make sure all storybook inherit all necessary base styles

* Skip untestable tests

* Update loki snapshots
2024-08-08 11:31:40 +00:00
Oisin Coveney
14d8eb86af Convert AlertListPopoverContent to TS (#46413) 2024-08-08 14:22:18 +03:00
github-automation-metabase
14fa99c1d1 Update Readme version references and published npm version to 0.1.28 (#46624) 2024-08-08 10:43:56 +00:00
Ngoc Khuat
afa66abf94 Fix oom during sync field values (#46524) 2024-08-08 10:34:09 +00:00
Oisin Coveney
d75f1685b8 Add useCreateQuestion and useSaveQuestion for SDK's Create Question (#46621) 2024-08-08 12:50:40 +03:00
Cal Herries
b6f4e51724 Reset report_card.last_used_at for all cards (#45448) 2024-08-08 12:33:36 +03:00
Phoomparin Mano
178997d776 feat(sdk): connect databases, generate models and x-rays from the CLI (#46502)
* add setup commands

* fix settings definition

* update environment variables for cli

* handle instances not being ready

* update error messages

* add more specific loading messages

* loading spinner state

* improve error message

* use a fixed demo setup token

* remove extraneous spinner

* update status checks

* update container messages

* update wait timing

* create api keys

* extract constants

* remove manual steps

* Add anonymous tracking + other things. will need to clean up

* Modify SDK for better structure

* remove line from print.ts

* Update webpack.embedding-sdk-cli.config.js back to production

* Add types and add quick note

* Fix a typo

* Add index file, simplify types, use an array

* Add safer json parsing

* use delay of 100ms between each setup call

* Suggestions from review

* ensure that cli works

* Attempt to fix jest errors

* Remove node-fetch from sdk code to hopefully get unit tests working again

* add database connection

* add connection details handling

* refactor asking for database connection info

* apply actual database id for syncing schema

* fix failing database sync step

* allow table selection

* create model for each table

* handle errors in model creation

* fix incorrect model display name

* create x-rays based on user data

* consolidate instance setup message

* workaround for inquirer eventemitter issue

* fix yarn.lock file

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-08 16:30:42 +07:00
Mahatthana (Kelvin) Nomsawadi
6fb1e51d8f Fix unintentional color changes (#46516)
* Sync storybook colors with the main app

* Fix Metabase badge color

* Fix wrong mixed brand colors

* Add mistakenly removed colors

* Update comments

* Correct `brand-light` color

* Fix wrong Mantine button color when passing `color` prop

* Update loki snapshots
2024-08-08 10:01:07 +01:00
Uladzimir Havenchyk
e1af9340b8 dx: automate babel deduplication (#46495) 2024-08-08 09:15:33 +03:00
Aleksandr Lesnenko
7d6b458c2b make series style settings tab first (#46549)
* make series style settings tab first

* spec
2024-08-08 06:14:32 +00:00
Case Nelson
e0c710780f fix: Handle tokens in strings when parsing params (#46547)
* fix: Handle tokens in strings when parsing params

Fixes #38051
Fixes #36262
Fixes #11755

* Fix handling snippets with single quotes in name
2024-08-08 04:57:16 +00:00
Aleksandr Lesnenko
c31c0e45b7 Fix pie e2e flake (#46613)
* fix pie e2e flake

* try fixing pie e2e flake

* try fixing pie e2e flakes

* last resort

* drop realHover
2024-08-07 22:29:20 -04:00
Alexander Polyankin
41fc438c34 Migrate field ref-based column keys in column_settings (#46025) 2024-08-07 23:37:52 +00:00
Nemanja Glumac
07da3e1de3 MS2: Open notebook data source in new tab (joins) (#46582)
* Add E2E support for notebook joins

* Add negative test cases
2024-08-08 00:52:03 +02:00
Aleksandr Lesnenko
b85747312c bump loki tolerance (#46600)
* bump loki tolerance

* fix loki-update command

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-07 22:32:53 +00:00
Raphael Krut-Landau
3f9e2b7bf9 fix(webapp/sidenav): Move Browse sidebar section in between Trash and other collections (#46457) 2024-08-07 21:22:25 +00:00
Alex Yarosh
40fbf96b6a docs: fix titles (#46599) 2024-08-07 16:46:25 -04:00
Dennis Schridde
fbaf58ad03 Hide upload config when data warehouse is attached (#45842)
== Goal ==

Prevent admins of Metabase Cloud instances with Metabase Cloud Storage
from accidentally breaking their upload configuration, since in this
scenario that is automatically managed by Metabase Cloud to use the
attached data warehouse.

== How to test ==

On a subscription with Metabase Cloud Storage:
* The "Uploads" section in the left sidebar of `/admin/settings` does
  not show
* A "not found" page is shown at `/admin/settings/uploads` where one
  would otherwise expect the "Uploads Settings" page
* `PUT /api/setting` with an `uploads-settings` field in the body fails
  with `403 Forbidden` and the setting is not changed
* `PUT /api/setting/uploads-settings` fails with `403 Forbidden` and
  the setting is not changed
* `GET /api/setting` contains an element with `key: "uploads-settings"`
  and a value
* `GET /api/setting/uploads-settings` responds with the value
* `GET /api/session/properties` contains the `uploads-settings` field

Closes: https://github.com/metabase/harbormaster/issues/5121
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-08-07 20:32:39 +02:00
Jeff Bruemmer
09de0eceac snowflake connection info (#46588) 2024-08-07 14:56:46 -03:00
github-automation-metabase
19397799a3 Add v0.50.19 to the list of releases (#46515)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-07 13:34:07 -04:00
Emmad Usmani
9eea034bb2 truncate total text in pie chart (#46466)
* truncate total text in pie chart

* add story

* Update Loki Snapshots

* add e2e test

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-07 09:10:53 -07:00
github-automation-metabase
fd2639077d Update Readme version references and published npm version to 0.1.27 (#46589) 2024-08-07 15:57:24 +00:00
Romeo Van Snick
527ec55390 Handle non-number cases in NumberFingerprint (#46579)
* Add unit test for #46574

* Handle non-numeric values in NumberFingerprint

* Be more realistic about NumberFingerprintDisplayInfo type

* Add comment on why the types are unknown
2024-08-07 15:53:20 +00:00
Chris Truter
7dd9fd5fa7 Protect against invalid file uploads (#46566) 2024-08-07 15:30:26 +00:00
Phoomparin Mano
4ce37a2516 feat(sdk): CLI to bootstrap an embedding-ready Metabase instance (#46080)
* add setup commands

* fix settings definition

* update environment variables for cli

* handle instances not being ready

* update error messages

* add more specific loading messages

* loading spinner state

* improve error message

* use a fixed demo setup token

* remove extraneous spinner

* update status checks

* update container messages

* update wait timing

* create api keys

* extract constants

* remove manual steps

* Add anonymous tracking + other things. will need to clean up

* Modify SDK for better structure

* remove line from print.ts

* Update webpack.embedding-sdk-cli.config.js back to production

* Add types and add quick note

* Fix a typo

* Add index file, simplify types, use an array

* Add safer json parsing

* use delay of 100ms between each setup call

* Suggestions from review

* ensure that cli works

* Attempt to fix jest errors

* Remove node-fetch from sdk code to hopefully get unit tests working again

* fix yarn.lock file

* revert capture groups change

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-07 22:24:33 +07:00
Ryan Laurie
33aa003a10 Generate better release logs for success (#46504)
* generate better release logs for success

* fix env

* fix env

* fix refname

* create invalidation

* remove test code
2024-08-07 09:00:14 -06:00
Uladzimir Havenchyk
63d029c763 e2e: add cypress-terminal-report (#46483)
* e2e: add cypress-terminal-report

* enable video recording

* revert error

* add a comment

* Update e2e/support/cypress.js

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-08-07 14:53:19 +00:00
Dennis Schridde
e97a8e7e93 Delete database using config file (#46437)
== Goal ==

Currently the config file (`MB_CONFIG_FILE_PATH`) only allows adding or
changing databases, but not removing them.  Since connected databases
can be managed as a service by us, it becomes necessary to delete any
information Metabase has about them, including any stored credentials.

Since this is a destructive operation with no way to revert (without
restoring from a backup), we raise the bar for accidental deletion and
require not just a (boolean) flag, but a magic string to be set.

== How to test ==

1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases.
2. Start your Metabase instance.
3. Verify the database shows up in the "admin" section and it works.
   Create a dashboard and questions using the database.
4. Add a `delete: "DELETE_WITH_DEPENDENTS:${name}"` line to your
   database configuration section.
5. Restart your Metabase instance.
6. Verify the database no longer shows up in the "admin" section.
   Notice that questions using it are gone, too.

References: https://github.com/metabase/harbormaster/issues/5173
2024-08-07 16:52:48 +02:00
dpsutton
e5a3827ef7 Exclude javax.annotation/javax.annotation-api (#46546)
dep is brought in by google cloud

From `clj -X:deps tree :aliases '[:ee :drivers]'`

```
  . metabase/bigquery-cloud-sdk metabase/modules/drivers/bigquery-cloud-sdk
    . com.google.cloud/google-cloud-bigquery 2.38.1
      . com.google.cloud/google-cloud-core 2.35.0
      [...]
      . javax.annotation/javax.annotation-api 1.3.2
```

Before this change:

```
❯ clj -X:deps tree :aliases '[:ee :drivers]' | grep 'javax.annotation/javax.annotation-api'
      . javax.annotation/javax.annotation-api 1.3.2
```

After:

```
❯ clj -X:deps tree :aliases '[:ee :drivers]' > deps-master

❯ echo $?
0
```
2024-08-07 09:48:56 -05:00
Uladzimir Havenchyk
f4e6024c90 e2e: allow cypress to start with --browser=firefox passed (#46569) 2024-08-07 13:57:05 +00:00
Chris Truter
ba66cf3220 Consider the first 10 lines when inferring upload separator (#46321) 2024-08-07 13:36:38 +00:00
Raphael Krut-Landau
b9a7566f2c fix(webapp/browse): Fix e2e test of recently viewed models (#46568)
* fix(webapp/browse): Fix e2e test of recently viewed models

* Remove try/catch block from e2e config file
2024-08-07 13:39:21 +02:00
lbrdnk
582fa9ade6 Add relative-time-interval mbql function 2 (#46438)
* Add :relative-time-interval mbql function

* Add relativeDateFilterPartsRelativeTimeInterval

* Update display-name-method :relative-time-interval

* Update desugar-relative-time-interval

* Define relative-time-filter op

* Add or update tests

* Update tests

* Update display-name-method

* Update test

* Fix positive relative-time-interval shift

* Add checkins:1-per-day:60 dataset

* Update var name

* Bail out from optimization of relative-time-interval desugared filters

* Update dataset kondo hook

* Generate cache required for kondo hooks in kondo.sh

* Rename dataset
2024-08-07 11:36:41 +02:00
Raphael Krut-Landau
2d99a35387 fix(webapp/browse): Fix bug where verified filter is applied to recents even when no verified models exist (#46462) 2024-08-06 22:56:35 -04:00
Anton Kulyk
657abc0a96 Fix default viz settings are ignored when saving a question from raw table view (#46045)
* Add repro test

* Fix selectors and getSubmittableQuestion

* Add null check
2024-08-07 00:06:12 +00:00
Ryan Laurie
195e89f8a6 Allow edits to users with empty name fields (#46511)
* allow edits to uers with empty name fields

* add repro for 40750

* whoopsie
2024-08-06 17:01:19 -06:00
Nemanja Glumac
e122df47d3 MS1: Open notebook data source in new tab (#46228)
* WIP Open notebook data source in new tab

* WIP

* Implement the new functionality with `pickerInfo`

* Use destructured value

* Add the simplest possible E2E test as PoC

* Smoke test

* Add basic coverage for questions

* Add basic coverage for models

* Source question has been archived scenario

* Add basic permissions test

* Expand to the user without wite query permissions

* Fix title

* Add another permission scenario

* Add E2E coverage for a source being native

* Add coverage for the native model

* Address review comment re: `pickerInfo`

* Extract `getUrl` to utils

* Add support for the middle/scroll click

* Add unit tests

* Add a negative test case

* Fix title
2024-08-07 00:18:36 +02:00
Jeff Bruemmer
beda4b0c3d Add product categories to release notes (#46298) 2024-08-06 17:49:06 -04:00
metamben
d312a304f9 Support consuming question or model based metrics (#46356) 2024-08-07 00:42:15 +03:00
Uladzimir Havenchyk
b377285034 ci: do not save same m2 cache multiple times (#46545) 2024-08-07 00:04:53 +03:00
Alexander Polyankin
259f55ba70 Convert audit v2 column_settings to column names (#46460)
* Add column_settings migration

* Remove old getColumnKey

* Remove old getColumnKey

* Fix export

* Change comment

* Change comment

* Change comment

* Change comment

* Add RemoveFieldRefsFromDashboardCardColumnSettings

* fix

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* Fix

* Fix

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Update loki

* Update loki

* Fix the homepage dashboard being loaded everywhere

* Fix the homepage dashboard being loaded everywhere

* Fix tests

* Fix tests

* Fix tests

* Fixes

* Fix tests

* Fix tests

* Fix tests

* Fix

* Fix

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fix typo

* Fix types

* Improve migration performance

* Fixes

* Revert changes

* Revert changes

* Revert changes

* Revert changes

* Remove migration
2024-08-06 14:51:22 -04:00
Jeff Bruemmer
832aa96972 docs - add MariaDB page (#45763) 2024-08-06 18:48:31 +00:00
Alexander Polyankin
d3a515858a Support both name & field ref-based column keys in viz settings on read and upgrade on write (#46383) 2024-08-06 17:29:34 +00:00
dpsutton
ce61da58c8 Fix bad i18n string (#46454)
Fixes #46440

couple things come together here.

Bad escaping:
The `{` characters are used for format strings and placeholders like

```clojure
impl=> (translate "fr" "After {0}" ["Bob"])
"Après Bob"
```

And if you want _literal_ {'s in your translation string, you must
escape them like "'{" or "'}" using an apostrophe. But this isn't the
end of our worries.

in `resources/zh-CN.edn`, we actually have _two_ translations for the
original string:

```clojure
"User lookup filter. The placeholder '{login'} will be replaced by the user supplied login."
"用户找过滤器,占位符 '{login'} 将替换为用户提供的登录名。"

,,,

"User lookup filter. The placeholder '{login}' will be replaced by the user supplied login."
"用户查找筛选器。占位符“{login}”将替换为用户提供的登录名。"
```

And this later has unescaped curlies.

The fix for that is at
https://poeditor.com/projects/po_edit?per_page=20&id=200535&id_language=31&filter=&order=&search=User+lookup+filter
but will need to wait for the new source translation string in this
instance with the corrected escaping.

```clojure
;; simulate what happens at runtime
impl=> (translated-format-string "zh_CN"
                                 "User lookup filter. The placeholder '{login}' will be replaced by the user supplied login."
                                 {})
"用户查找筛选器。占位符“{login}”将替换为用户提供的登录名。"
impl=> (MessageFormat. *1 (locale "zh_CN"))
Execution error (NumberFormatException) at java.lang.NumberFormatException/forInputString (NumberFormatException.java:67).
For input string: "login"
;; the problematic zh-CN string
impl=> (MessageFormat. "用户查找筛选器。占位符“{login}”将替换为用户提供的登录名。")
Execution error (NumberFormatException) at java.lang.NumberFormatException/forInputString (NumberFormatException.java:67).
For input string: "login"
;; minimal reproduction
impl=> (MessageFormat. "“{login}”")
Execution error (NumberFormatException) at java.lang.NumberFormatException/forInputString (NumberFormatException.java:67).
For input string: "login"
```
2024-08-06 10:49:41 -05:00
Chris Truter
e2dfd06b14 Gracefully handle ignored errors during sync (#45968) 2024-08-06 18:24:04 +03:00
Raphael Krut-Landau
5e6ca94619 fix(browse/models): Correct the number of recently viewed models shown (#46487) 2024-08-06 11:05:10 -04:00
Uladzimir Havenchyk
1a803fb5dc ci: re-enable node cache to speedup initial yarn install (#45892) 2024-08-06 14:11:17 +00:00
Denis Berezin
22944e115f feat(sdk): Add storybook docs for embedding SDK e2e tests debug (#46496) 2024-08-06 15:55:00 +03:00
Oleksandr Yakushev
5ed7d786d3 chore: Load system-wide user.clj when REPL starts (#46514) 2024-08-06 10:05:09 +00:00
Chris Truter
97594871e9 Use message's query for async updates (#46508) 2024-08-06 09:11:14 +00:00
Oleksandr Yakushev
0d517c998f perf: Optimize validation with Malli (#46485)
* perf: Optimize validation

* Bump Malli version

* perf: Optimize validation
2024-08-06 10:54:15 +03:00
Oleksandr Yakushev
a792ca29d9 fix: Reduce bcrypt work factor when running tests (#45315) 2024-08-05 22:14:41 +00:00
Ngoc Khuat
3c4a1ce35f Remove uncessary db calls when updating card (#46480) 2024-08-05 21:49:41 +00:00
Uladzimir Havenchyk
741ae589a3 ci: enable video recordings for failing cypress tests (#46281) 2024-08-06 00:32:02 +03:00
Case Nelson
d5601723b4 fix: mongo ObjectId should be orderable (#46501)
* fix: mongo ObjectId should be orderable

Fixes #46259

Mongo ObjectId derive :type/TextLike but that can't be an orderable
type, so we mark the specific Mongo type as orderable for malli schemas.

* Fix test
2024-08-05 19:15:16 +00:00
Sloan Sparger
46dc7687f9 [Bug Fix] Items can be dragged from the Trash into the Trash (#46389)
* prevents users from moving items to the trash if they are in the trash already and archives instead of moves in cases where item is moved to or from the trash

* reverts detecting if dragging in or out of the trash not setting the collection id, this will be prevented on the BE instead

* adds test coverage for dragging and dropping items to/from/within the trash (one of which is failing until we can make a BE change)

* Throw away `collection_id` when marking archived

This is a hack around a frontend issue. Apparently, the undo
functionality depends on calculating a diff between the current state
and the previous state. Sometimes this results in the frontend telling
us to *both* mark an item as archived *and* "move" it to the Trash.

Let's just say that if you're marking something as archived, we throw
away any `collection_id` you passed in along with it.

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-08-05 11:01:57 -05:00
Ryan Laurie
c810c38de0 Fix auto release schedule off by one (#46469) 2024-08-05 08:36:35 -06:00
Alexander Solovyov
64dbaa13ea fix db switching in ts/with-dbs (#46481)
mt/with-temp opens transaction which is used by toucan to make requests, so `mt/with-db` had no impact on database used inside of mt/with-temp
2024-08-05 14:21:53 +00:00
Chris Truter
39bb33ec4c Various hardenings for SQL analysis (#46432)
### Description

This change should fix some explosions in stats due to phantom fields, while also making things a bit more rigorous.

- Record the table schema in query_field - especially useful for unknown tables
- Allow null table names in query_field - they might be phantoms, or they might not
  - We still have the option to filter them out in tools we build on top
- Tighten up matching logic to consider schema
2024-08-05 15:46:28 +02:00
Mahatthana (Kelvin) Nomsawadi
3d5233bc6a [Milestone 2] Re-design transparent theme for static embedding and public links (#46428)
* Update popover dark theme on part of ParameterFieldWidget (#45813)

* Add filter visual tests

* Simplify embed CSS colors

* [WIP] theme filter popover

* Move theme to global node, so it affects portal too

* Fix embed colors

* Theme part of ParameterFieldWidget

* Add story for parameter with dropdown

* Update loki snapshots

* Update more popover style

* Update loki snapshots

* Remove outdated snapshots

* Update loki snapshots with production build

* Fix loki not working with `userEvent`

* Theme mantine popover

* Improve dark theme text-brand visibility

* Update loki snapshots from master change

* Fix new colors not working in SDK

* Fix flaky Loki tests

* Filter popover dark theme part 2 (#46284)

* Theme Date all options

* wip add month and year filter

* Fix wrong CSS custom property declaration

* Test hover state

* Update Loki snapshots

* Theme date month and year

* Add quarter and year tests

* Theme date single and date range

* Style relative date

* Update frontend/src/metabase/admin/datamodel/components/filters/pickers/DatePicker/DatePickerHeader.styled.tsx

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

---------

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

* Complete theming filter popover night mode (#46365)

* Style unit of time and number widget

* Attempt to fix flaky Loki snapshots

* Address white background checkbox on dark theme

* Style search filter single value

* Fix mis color

* Update snapshots

* Remove duplication on play functions since they're long

* Milestone 2 polishing (#46382)

* Matches the footer padding with header padding

* Update snapshots

* Add E2E to prevent further problem

* Try to reduce flaky Loki tests

* Remove unused color shades (#46421)

* Update no results illustration to work better on dark theme

* Update loki snapshots

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-08-05 10:20:34 +00:00
Kamil Mielnik
a05452ef2e "Reset all filters" button (#46322)
* Refactor dashboard helpers to TypeScript

* Reuse existing helper

* Refactor cy.createQuestionAndDashboard to a function helper
- there was no good place to put it, so I also created new helpers/api directory
- and I moved all helpers using cy.request (with 1 exception, where a CSV download helper also does a bunch of assertions) in there

* Merge TS command definitions into a single file

* Export types

* Make dashboardDetails optional

* Export StructuredQuestionDetails

* Remove duplicated function

* Extract createNativeQuestion to separate file
- 1 exported helper per file, no exceptions!

* Reuse const

* Add test for unit of time parameters

* Improve assertions

* Extract createDashboardWithParameters

* Add tests for time parameters

* Fix hardcoded parameter_mappings ids

* Format code

* Extract checkButtonVisible

* Improve test names

* Add tests for location parameters

* Reuse const

* Update test name

* Add WidgetStatusButton

* Add unit tests for WidgetStatusButton

* Rename handler

* Remove redundant assertions

* Add iconSize prop

* Fix styling

* Replace WidgetStatusIcon with WidgetStatusButton
- Remove WidgetStatusIcon

* Fix tooltip issue

* Fix tooltip for good

* Use default compact button size

* Prevent overflow

* Fix alignment issues in parameter sidebar
- Remove iconSize prop
- Simplify StatusConfig

* Update padding in Unit of Time input to make it consistent with other inputs in dashboard parameter sidebar

* Update unit tests

* Rename WidgetStatusButton to WidgetStatus

* Explicitly specify what is a button

* Update helpers in tests

* Update when buttons are displayed according to the new spec, update tests

* Simplify label

* Remove utils

* Adjust padding

* Update reset icon

* Make the button gray when color is undesired

* Remove old definitions

* Add missing export

* Remove unused type

* Add test for location (single value)

* Add test for id (single value)

* Add more assertions

* Add test for id (multiple values)

* Improve name

* Add tests for number (single and multi value)

* Add tests for text (single and multi value)

* Rename file

* Update comment

* Update test name

* Use unique ids

* Use new color name

* Add a test for chevron icons alignment

* Lift className up

* Make types more specific

* Sort attributes

* Revert "Make types more specific"

This reverts commit 2e6994b5ed.

* Revert "Use new color name"

This reverts commit 2cc68df6ba.

* Remove TODO

* Introduce editFilter util, refactor chevron assertions to work with any number of chevrons

* Connect label to the default value input in ParameterSettings

* Add a whitespace in the default value label when required "(required)" is shown

* Add parameter sidebar tests for unit of time

* Add parameter sidebar tests for date filters

* Extract checkParameterSidebarDefaultValue

* Add parameter sidebar tests for location - single values

* Add parameter sidebar tests for location - multiple values

* Use constants for test case names

* Add parameter sidebar tests for id parameters - single values

* Add parameter sidebar tests for id parameters - multi values

* Add parameter sidebar tests for number parameters - single values

* Add parameter sidebar tests for number parameters - multi values

* Add parameter sidebar tests for text parameters - single values

* Add parameter sidebar tests for text parameters - multi values

* Extract checkDashboardFilters

* Use checkDashboardFilters in time parameters

* Use checkParameterSidebarDefaultValue in checkDashboardFilters

* Use checkDashboardFilters everywhere

* Sort helpers

* Rename checkDashboardFilters to checkDashboardParameters

* Rename checkOnlyOneButtonVisible to checkStatusIcon

* Add test suite for sql filters, coverage for text filter - single value

* Add a whitespace in the default value label when required "(required)" is shown - SQL filters
- Similar to 930dd3a50a

* Add test suite for sql filters, coverage for number filters

* Add test for sql filters - date

* Remove unused things, rename placeholder to labelOrPlaceholder

* Apply label only to 1 input

* Add test for sql filters - field parameters

* Fix date tests

* Make all sql filters tests work

* Add assertions for required without default in text filters

* Add assertions for required without default in date filters

* Add assertions for required without default in field filters

* Allow clearing required SQL filters without default value

* Add a test to ensure comma-separated numeric values work

* Update unit test

* Update helper

* Update e2e tests

* Use != null and == null checks with defaultValue instead of just checking if its truthy/falsy

* Run `yarn test-visual:loki` and then `yarn loki approve`
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069

* Add button boilerplate

* Add getCanResetFilters selector

* Move canResetFilters to utils

* Add explicit return types

* Implement the button action

* Rename

* Simplify action

* Optimize: use single action

* Use parameterHasNoDisplayValue to account for empty strings

* Run `yarn test-visual:loki` and then `yarn loki approve` after merging master
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069

* Rename getHiddenParameterSlugs to getTabHiddenParameterSlugs

* Take all tabs into account

* Add unit tests for canResetFilter

* Format test name

* Fix non-human-friendly aria-label

* Add assertions for "Reset all filters" button's visibility

* Unnest helpers from describe

* Add a test for comma-separated values

* Improve typing

* Fix typing

* Add tests for multiple tabs and auto-apply-filters on/off

* Improve test name

* Remove redundant util

* Remove redundant condition

* Verify card results get filtered

* Test that all tabs are affected

* Fix test case with autoApplyFilters: false

* Add tests for resetting to default value

* Fix wrong initial state in reduce

* Fix updated parameters not being applied

* Add reset all filters assertions

* Remove unused attribute

* Run `yarn test-visual:loki` and then `yarn loki approve`
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069

* Run `yarn test-visual:loki` and then `yarn loki approve`
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069
2024-08-05 09:18:48 +00:00
Kamil Mielnik
35d9a8177e Update "Clear" and "Reset" buttons (#46050)
* Refactor dashboard helpers to TypeScript

* Reuse existing helper

* Refactor cy.createQuestionAndDashboard to a function helper
- there was no good place to put it, so I also created new helpers/api directory
- and I moved all helpers using cy.request (with 1 exception, where a CSV download helper also does a bunch of assertions) in there

* Merge TS command definitions into a single file

* Export types

* Make dashboardDetails optional

* Export StructuredQuestionDetails

* Remove duplicated function

* Extract createNativeQuestion to separate file
- 1 exported helper per file, no exceptions!

* Reuse const

* Add test for unit of time parameters

* Improve assertions

* Extract createDashboardWithParameters

* Add tests for time parameters

* Fix hardcoded parameter_mappings ids

* Format code

* Extract checkButtonVisible

* Improve test names

* Add tests for location parameters

* Reuse const

* Update test name

* Add WidgetStatusButton

* Add unit tests for WidgetStatusButton

* Rename handler

* Remove redundant assertions

* Add iconSize prop

* Fix styling

* Replace WidgetStatusIcon with WidgetStatusButton
- Remove WidgetStatusIcon

* Fix tooltip issue

* Fix tooltip for good

* Use default compact button size

* Prevent overflow

* Fix alignment issues in parameter sidebar
- Remove iconSize prop
- Simplify StatusConfig

* Update padding in Unit of Time input to make it consistent with other inputs in dashboard parameter sidebar

* Update unit tests

* Rename WidgetStatusButton to WidgetStatus

* Explicitly specify what is a button

* Update helpers in tests

* Update when buttons are displayed according to the new spec, update tests

* Simplify label

* Remove utils

* Adjust padding

* Update reset icon

* Make the button gray when color is undesired

* Remove old definitions

* Add missing export

* Remove unused type

* Add test for location (single value)

* Add test for id (single value)

* Add more assertions

* Add test for id (multiple values)

* Improve name

* Add tests for number (single and multi value)

* Add tests for text (single and multi value)

* Rename file

* Update comment

* Update test name

* Use unique ids

* Use new color name

* Add a test for chevron icons alignment

* Lift className up

* Make types more specific

* Sort attributes

* Revert "Make types more specific"

This reverts commit 2e6994b5ed.

* Revert "Use new color name"

This reverts commit 2cc68df6ba.

* Remove TODO

* Introduce editFilter util, refactor chevron assertions to work with any number of chevrons

* Connect label to the default value input in ParameterSettings

* Add a whitespace in the default value label when required "(required)" is shown

* Add parameter sidebar tests for unit of time

* Add parameter sidebar tests for date filters

* Extract checkParameterSidebarDefaultValue

* Add parameter sidebar tests for location - single values

* Add parameter sidebar tests for location - multiple values

* Use constants for test case names

* Add parameter sidebar tests for id parameters - single values

* Add parameter sidebar tests for id parameters - multi values

* Add parameter sidebar tests for number parameters - single values

* Add parameter sidebar tests for number parameters - multi values

* Add parameter sidebar tests for text parameters - single values

* Add parameter sidebar tests for text parameters - multi values

* Extract checkDashboardFilters

* Use checkDashboardFilters in time parameters

* Use checkParameterSidebarDefaultValue in checkDashboardFilters

* Use checkDashboardFilters everywhere

* Sort helpers

* Rename checkDashboardFilters to checkDashboardParameters

* Rename checkOnlyOneButtonVisible to checkStatusIcon

* Add test suite for sql filters, coverage for text filter - single value

* Add a whitespace in the default value label when required "(required)" is shown - SQL filters
- Similar to 930dd3a50a

* Add test suite for sql filters, coverage for number filters

* Add test for sql filters - date

* Remove unused things, rename placeholder to labelOrPlaceholder

* Apply label only to 1 input

* Add test for sql filters - field parameters

* Fix date tests

* Make all sql filters tests work

* Add assertions for required without default in text filters

* Add assertions for required without default in date filters

* Add assertions for required without default in field filters

* Allow clearing required SQL filters without default value

* Add a test to ensure comma-separated numeric values work

* Update unit test

* Update helper

* Update e2e tests

* Use != null and == null checks with defaultValue instead of just checking if its truthy/falsy

* Run `yarn test-visual:loki` and then `yarn loki approve`
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069

* Use parameterHasNoDisplayValue to account for empty strings

* Run `yarn test-visual:loki` and then `yarn loki approve` after merging master
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069

* Run `yarn test-visual:loki` and then `yarn loki approve`
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069

* Run `yarn test-visual:loki` and then `yarn loki approve`
- see https://metaboat.slack.com/archives/C505ZNNH4/p1721289287037069
2024-08-05 15:48:04 +07:00
Romeo Van Snick
019fb467d6 Custom labels for number parameter (#44230)
* Make number also have custom parameter values

* Render the correct label in the dropdown for number inputs

* Mock paramter values endpoint in number input test

* Add test for custom labels on number input

* Fix number input test

* Allow entering comma separated values using labels

* Only show custom labels in popover

* Use getLabel and getValue helpers to avoid indexing confusion

* Remove calls to parameter endpoints for number input

* Do not parse the value from the label

* Add support for number parameters in the source picker modal

* Filter number values

* Add e2e test for number parameters with custom source

* Remove card option for number parameters

* Set the correct initial value for number parameters without fields

* Do not render number parameter as search box when it is a list

* Fix e2e tests for number lists

* Remove e2e tests for card source dashboard filters

* Add tests for native filter custom source

* Show the dropdown when picking the default value for number parameters

* Clear values_source_config when changing parameter type

* Restore a parameters' values_source_config when changing the parameter type back

* Clear and restore values_source_config for template tags when chaning type

* Add e2e test for restoring of template tag sources_value_config

* Add e2e test for clear and restore of static-list for dashboard parameters

* Fix input type for numbers

* Fix broken test

* Display labels for ParameterValuePicker too

* Clear and restore values_source_type when changing parameter type

* Clear and restore values_source_type for tag parameters

* Clear and restore values_query_type when changing parameter type

* Clear and restore value_query_type for parameters tags

* Update tests to test for reset to also apply to values_source_config and values_query_type
2024-08-05 09:23:47 +02:00
Emmad Usmani
6eaff50e3f add both option for pie chart percentages (#46399)
* add both option for pie chart percentages

* create story snapshot
2024-08-05 05:53:11 +00:00
Radosław Kotkiewicz
d71cb6e6cb expose MB_DB_QUERY_TIMEOUT_MINUTES setting (#44759) 2024-08-04 17:25:03 +02:00
Emmad Usmani
5edfd8ac97 add pie.decimal_places setting (#46397)
* add pie.decimal_places setting

* add unit spec

* add stories

* Update Loki Snapshots

* add placeholder text

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-02 15:46:05 -07:00
Aleksandr Lesnenko
cffca8af58 fix missing horizontal scroll on pivot tables (#46400)
* fix pivot table missing horizontal scroll

* spec

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-02 18:44:14 -04:00
Ryan Laurie
c924c38e2f test(sdk) Update the Query Editor Button (#46097)
* YOLO

* fix a lot of tests

* fix more tests

* fix unit tests

* remove comment

* update tests and formatting

* add debug code

* remove debug code
2024-08-02 16:18:48 -06:00
Sloan Sparger
fab23e52be [Permissions] Fix advanced permissions edits not always saving #46453 2024-08-02 17:06:33 -05:00
Raphael Krut-Landau
9c8168a20e fix: In delayed error/loading wrapper, on error, display the error (#46395) 2024-08-02 17:14:38 -04:00
Raphael Krut-Landau
1df7e96518 Remove global css module that was applying red borders (#40112) 2024-08-02 16:23:27 -04:00
Alexander Polyankin
b9354860eb Perf fix for card metadata in QP (#46443) 2024-08-02 19:36:44 +00:00
Sloan Sparger
1d27703540 [Auto Clean-up] Clean-up modal (#44512)
* wip

* moves code to enterprise folder, adds enterprise guards, updates conditionals as to when to show the feature

* impls filter date logic, improves styling, mocks out real endpoint with collection items endpoint, updates table with isLink boolean rath
er than using custom item renderer, removes dead code

* use the actual url for stale

* so many things... updated design, custom table component, polish, misc. refactors, more correct api typing

* updates to pagination component and reverts some now unused changes to the base items table

* impls pr feedback

* fixes

* fixes failing unit test

* completes pr feedback from raffi

* implements second round of feedback from raffi

* adds tests and couple of small fixes / feedback

* migrate clean up action to enterprise plugin and fix related e2e test, also skip the collection items count query when we do not need the value

* finish main base case e2e test

* clean up helper code for manual testing and add OSS test to make sure feature is not available in OSS

* better handling of min-height on smaller screens

* adds internal undo notification for bulk archiving in the clean up modal

* reset pagination when items are archived/unarchived to keep users from getting stuck on a page beyond the current view

* pr feedback

* further cleanup

* unit test fix

* fixes issue where archiving all items in the modal and then undoing does not result in the stale items list getting refetched

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-08-02 14:10:07 -05:00
Emmad Usmani
5b109bdbeb fix flaking tab reorder e2e test (#46455) 2024-08-02 12:09:14 -07:00
Ryan Laurie
b0fa8500de test(sdk) Don't show notebook toggle button for brand new questions (#46350)
* hide notebook button for brand new questions

* test notebook button visibility for new questions

* move brand new check inside shouldRender

* test embedding SDK notebook button

* update unit tests

* add spy to shouldRender
2024-08-02 19:07:59 +00:00
John Swanson
7e826d723e Fix coll permissions for audit collection (#46351)
* Fix coll permissions for audit collection

We've had a function in `models.collection` for a while that has taken a
permissions set and returned a set of collection IDs that the user has
permissions on. I refactored this recently, but didn't notice that it
was actually doing the permissions checks slightly incorrectly.
Specifically, because it only looks at the user's permissions and the
collection IDs and doesn't use `mi/can-read?` or `mi/can-write?`, it's
completely indifferent to whether a collection is an audit collection or
not.

This is arguably not a *permissions* issue: the two errors that could
come about here are:

- someone sees the audit collection even though the audit feature is
disabled, or

- someone is presented with the audit collection in a context where only
writable collections should be present - when they try to actually write
to it, it fails (since then we're doing the real permissions check).

The primary motivation for this fix was to prevent audit dashboards and
cards from appearing in the list of stale items.

* Fix hardcoded collection ID

We were creating a timeline in a fixed collection ID, that in tests
happened to be the ID of the Metabase Analytics collection.
2024-08-02 09:43:09 -08:00
lbrdnk
b4b8f6e963 Avoid sorting by missing aggregation reference (#46386)
* Update values-from-card-query

* Add test

* Update values-from-card-query

* Add missing issue no
2024-08-02 19:24:00 +02:00
Ryan Laurie
1c7de429b0 Properly handle SMTP Settings environment variables (#46302)
* properly handle SMTP environment variables

* disable clear button when set by env var

* allow the SMTP form to validate with any combination of environment variables

* add unit tests for SMTP connection form

* BONUS: fix console error for jt keys

* fix types
2024-08-02 11:21:56 -06:00
github-automation-metabase
69588cffea Update Readme version references and published npm version to 0.1.26 (#46447) 2024-08-02 16:24:41 +00:00
Jeff Bruemmer
8d621e0b01 remove reference to Google Analytics (#46445) 2024-08-02 12:23:50 -04:00
Jeff Bruemmer
da92a622e5 docs - various link fixes (#46441)
* link fixes

* more links
2024-08-02 17:57:36 +02:00
Uladzimir Havenchyk
6abe4bb8e9 test: do not allow cypress to raise an error on timeline hover (#46230)
* do not update size if width or height is 0

* add a comment
2024-08-02 18:48:35 +03:00
Alexander Solovyov
2512d29a37 [xray] separate limits for max cards in section and max total cards (#46436) 2024-08-02 15:32:44 +00:00
Nicolò Pretto
07bc6afa9d update the UI of the downloads toggle to make it look like the others… (#46409)
* update the UI of the downloads toggle to make it look like the others in the page

* make unit tests pass

* make e2e pass
2024-08-02 16:50:15 +02:00
Sloan Sparger
5607dc9c6c [Permissions] Update ordering of create query permissions options (#46391)
* updates the ordering of create queries permissions options so that granular permissions is the last option

* fix unit test

* move granular option above no
2024-08-02 09:31:15 -05:00
Nicolò Pretto
c08b85cf98 Embed downloads ms3 - analytics (#46335)
* update static_embed_code_copied to use downloads (#45944)

* copy schema file for better diff

* adds downloads field to appearance in embed_flow schema

* update event to send `downloads` parameter, update e2e tests

* fix test for dwonloads: false

* fix: use correct schema version for embed flow analytics (#46053)

* update `dashboard_pdf_exported` and use it in embedding context (#46076)

* copy schema for better diff

* adds `dashboard_accessed_via` to the `dashboard_pdf_exported` event

* download_results_clicked event (#46132)

* adds download_results_clicked event + e2e tests

* make strings nullable

* adds maxLength

* switch back to if/then as it seems more readable

* refactor: use the resourceType to determine the download params instead of re-doing the logic

* fix ''question' is possibly 'undefined'.'

* split resource_type into resource_type and accessed_via to also consider interactive-embedding and sdk

* edit comment

* adds test for ad-hoc-question

* Update frontend/src/metabase/query_builder/actions/downloading.ts

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

* makes describe message more consistent

* "else if" => if

* fix describe block name

* convert downloads event to use enum for download_type and export_type

* resource_type should be an enum too

* fix line added in the wrong place during merges

---------

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

* Update frontend/src/metabase/public/components/EmbedFrame/EmbedFrame.tsx

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

* adds enum schema to dashboard_accessed_via

* fix accessed_via for sdk embeds

* update comments to explain why we send 0 when dashboardId is null

* only send dashboard_id as a number when it is a number, as expected by snowplow

* remove un-needed async/await from saveAsPDF function

* rename frontend/src/metabase/redux/downloading-analytics.ts -> frontend/src/metabase/redux/downloads-analytics.ts

* fix cy.log message

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-08-02 16:16:19 +02:00
John Swanson
2c7d0cf146 Revert "Preprocess queries before data perms check (#45601)" (#46429)
This reverts commit c7a5aee1f8.
2024-08-02 13:38:23 +00:00
Noah Moss
002238217a Add extra geojson content type (#46427) 2024-08-02 13:37:23 +00:00
Chris Truter
5ba895be36 Tighten up queue test (#46420) 2024-08-02 12:58:44 +00:00
Nicolò Pretto
3108d9fed1 fix low contrast on night theme embed frame "Export as pdf" (#46288)
* update embed frame pdf button colors to use --mb-color- vars

* change download pdf button color to brand color

* testing adding the images that actually differ
2024-08-02 14:56:14 +02:00
Jeff Bruemmer
d81c74b822 add note about locked parameters (#46392) 2024-08-02 08:40:58 -04:00
Roman Abdulmanov
0b3d8d6dee Added another webhook (#46414) 2024-08-02 11:51:03 +00:00
Ngoc Khuat
9f1cbc3c79 Reduce memory usage when sending anon stat (#46404) 2024-08-02 16:29:02 +07:00
Chris Truter
979897ebbc Fix log formatting for query analyzer (#46410) 2024-08-02 09:14:06 +00:00
Alexander Solovyov
49e6dbdfe3 [serdes] http api: be more picky about files we unpack from an archive (#46362)
Previously we unpacked everything and picked up first entry as the directory
containing the data. This works well when archives are passed as is. However,
if a user unpacks and then packs an archive, there is a good chance that some
hidden directories will appear - and they are first in order.

So we skip those right now, and additionally check known markers of the
serialization data directory.
2024-08-02 10:29:31 +03:00
Nemanja Glumac
32b7af2747 e2e: Remove flaky tag from timeseries question with a goal test in alert-types spec (#46367) 2024-08-02 09:07:57 +02:00
Emmad Usmani
a5cd7d04b8 fix viz settings not persisted during question edit (#46308)
* fix lost settings

* add e2e test

* trigger ci
2024-08-01 22:37:27 -04:00
Emmad Usmani
cd6cadf007 fix pie slice border missing in backend static viz (#46384)
* fix pie border missing in batik static viz

* refactor args

* fix typo
2024-08-01 18:38:10 +00:00
Ryan Laurie
db8f114f6e fix db connection form icons (#46290)
* fix db connection form icons

* fix db connection form icons

* appease typescript
2024-08-01 12:22:17 -06:00
Oreon Lothamer
67cca0771e change pr-env conditional (#46352) 2024-08-01 08:17:48 -10:00
lbrdnk
07648603d2 Avoid adding temporal-unit to lhs cols (#46262)
* Avoid adding temporal-unit to lhs cols

* Use :default temporal-unit

* Simplify logic, update comments

* Update substitute-field-filter-test

* Update align-temporal-unit-with-param-type-test

* Update field-filter-date-test

* Use end-excludding gte lt filter for DateTime fields

* Update substitute-field-filter-test

* Update align-temporal-unit-with-param-type-test

* Update field-filter-date-test

* Update bigquery test + comment

* Update date-str->qp-aware-offset-dt

* Add guard for unexpected date string format

This is just for the completeness, I haven't encountered it.

* Address review remarks

* Update comment
2024-08-01 20:16:37 +02:00
Nick Fitzpatrick
5b4fe7cd3f Permissions modal dismiss patch (#46381)
* dismiss permissions modal regardless of network request

* Spelling is hard
2024-08-01 14:23:02 -03:00
Ryan Laurie
acea9a2979 Automatic Nightly Patch Releases (#46254)
* add auto-release patch job

* better error handling

* update schedule

* address review feedback
2024-08-01 10:35:34 -06:00
Chris Truter
8005283add Detect queries referencing unknown tables (#46185)
* Squash

* Clean up query modifier for validating card references (#46283)

* Fixup bad git merge on test expectation

* Tweak docstrings and de-densify logic
2024-08-01 16:17:02 +02:00
lbrdnk
ae63a13cc1 Revert "Add :relative-time-interval mbql function (#46211)" (#46370)
This reverts commit 72a201819b.
2024-08-01 14:11:14 +00:00
github-automation-metabase
f92e056942 Add v0.49.22 to the list of releases (#46355)
* Add v0.49.22 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-08-01 09:35:32 -04:00
lbrdnk
72a201819b Add :relative-time-interval mbql function (#46211)
* Add :relative-time-interval mbql function

* Add relativeDateFilterPartsRelativeTimeInterval

* Update display-name-method :relative-time-interval

* Update desugar-relative-time-interval

* Define relative-time-filter op

* Add or update tests

* Update tests

* Update display-name-method

* Update test

* Fix positive relative-time-interval shift
2024-08-01 11:12:14 +02:00
Ngoc Khuat
683faf64e9 Fix x-ray generate invalid query for table with Date column (#46317) 2024-08-01 06:34:52 +00:00
Emmad Usmani
bfc6838a7b fix pie chart total graphic not being removed (#46349)
* fix pie chart total graphic not being removed

* add e2e test
2024-07-31 21:58:25 +00:00
John Swanson
c4196d99fb Some improvements to the REST API for query field validation (#46024)
* Allow filtering on collection

* Add `effective_ancestors` to collection data

Note: I removed the `qv=` comparator. I think it'.s better to be more explicit
about what exactly we're asserting. In particular, I hadn't updated the
`:count` when we were filtering on collection type, so the count was
still the total for *every* collection even though the results were being
restricted by the collection. However the `qv=-data` function was still
reporting that everything was OK, because it was accounting for other
data from the App DB by just asserting that the count we'd specified was
lower than the actual count. I'd argue it's better for tests to fail
locally because I have garbage in my app DB (which I can clean up) than
succeed when they really shouldn't.

* Consolidate effective ancestors

For the Search API, we're currently returning slightly different
ancestors:

- it never has the Root Collection, and

- the ancestors don't have a `personal_owner_id`

We could change the API (and maybe will soon - it seems pretty
unexpected to have `effective_ancestors` sometimes act one way and
sometimes act another) but for now we can just reshape things to look
the same as they did before, while using the same code under the hood.
2024-07-31 11:28:02 -08:00
Gustavo Saiani
58d7b2ca84 Update links to Learn section of metabase.com (#46336) 2024-07-31 15:04:19 -03:00
Noah Moss
d55b6a313c SCIM feature branch (#44243)
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
2024-07-31 13:45:02 -04:00
Emmad Usmani
4ec1fd883f migrate pie chart to echarts (#43555)
* echarts pie

* setup rendering pipeline for static pie chart (#43547)

* setup rendering pipeline for static pie chart

* remove more donut code from BE

* compute viz settings for static pie chart (#43548)

* compute viz settings for static pie chart

* create chartModel for pie chart (#43549)

* create chartModel for pie chart

* render static pie chart (#43550)

* render static pie chart

* render static pie chart legend (#43551)

* disable animation

* alter static-viz pie chart be tests to account for echarts-impl

The old implementation had a different implementation for legends, separate from the 'categorical/donut' js
render. Echarts nicely combines the legend into the pie render, so we don't need to worry about that stuff anymore.

Instead, I've written a simple set of assertions on the echarts pie implementation now.

* Get rid of this test that was attempting to use old code path

* echarts pie

* One last spot where we don't need old pie stuff anymore.

* add loki specs

* save snapshots

* fix small slices disappearing

* update snapshots

* add repro story for exteremely small slice

* add snapshot

* fix rounded total

* fix percent formatting in legend

* fix date dimension formatting

* fix binned and relative date dimension labels on legend

* add specs and snapshots for null and unaggregated dimensions

* hide overlaping labels on chart

* fix null dimension color

* show error when metric column has a negative value

* move legend to botom

* make dot margin smaller

* add columns to legend

* sort legend vertically

* dont use grid if only one row for legend

* never hide legend in static viz

* fix empty column culling

* show single legend item

* add long dimension name story

* fix long dimension name in legend

* right justify percentages in legend

* remove negative error and re-add stories

* handle negative values

* create chart definition for dynamic pie chart

* render chart with responsiveness

* add comment for borderWidth calculation

* center legend

* fix legend centering

* add story for missing currency formatting

* fix missing currency formatting

* fix graalvm crashing

* fix column settings computation

* add another currency formatting repro

* fix wrong order of col settings computations

* convert colors to hex

* fix colors missing from viz settings

* temp todo comment

* fix colors in dynamic viz

* update snapshots

* fix crashing due to invalid dimension/metric setting

* fix chart crashing for boolean dimension with labels on chart

* add repro

* fix regression in label formatting

* fix labels on small slices

* update specs

* emphasis state for slice hover

* recreate old label hiding logic

* include height measurement in getIsLabelVisible

* move d3 slices to chart model

* fix labels on static viz

* wip basic hover state and tooltip

* fix emphasis style getting stuck by memoizing everything

* update total display value

* fix stuck emphasis by setting notMerge to false for pie only

* handle other slice in tooltip

* fix bugs in total graphic

* use OTHER_SLICE_KEY const in static viz legend

* implement legend and connect to hover state

* implement click actions

* fix slice not clickable

* handle all zero slices

* add repro

* update specs

* update pie_chart.cy.spec.js

* update chart_drill.cy.spec.js

* add repro for single column legend

* use minimum 2 legend columns

* fix legend text overlap

* use more margin for single row legend

* update specs

* add repro for 28568

* add repro for 38424

* fix percent label not showing on large slices

* hide total text when chart is small

* replace comment about animations

* show warning for mixed positive and negative values

* delete old chart files

* fix type errors

* update d3 import

* update specs

* remove branch from uberjar.yml

* dont put single slice into other

* fix lint errors and pie render test

* update more d3 imports

* remove unused settings

* revert preview-card-width change

* remove unused import

* remove majorWidth option from formatting

* use debounceLeading refresh mode in ChartWithLegend

* remove TOTAL_GRAPHIC_OPTION constant

* delete unit test for pie chart

* fix failing test by doing set comparison instead

* fix typo in comment

* remove SUNBURST_SERIES_OPTION constant

* fix lint by removing unused eslint-disable

* move default color computation to getValue

* fix static pie test to show that we will always render the legend

* update pie border color for night mode and embedding

* fix styles for embedding case and add stories

* skip embedding stories

---------

Co-authored-by: Adam James <adam.vermeer2@gmail.com>
2024-07-31 17:11:55 +00:00
adam-james
e8d5dac2ca Quick Followup to Pull #45691 (#46286)
Since I set auto-merge to #45691, I missed some bits of review feedback.
Luckily, nothing was blocking, so these are small readability/docs changes
2024-07-31 08:56:15 -07:00
Raphael Krut-Landau
3bf08eadda fix(webapp/browse): Use user locale if available in Browse models (#45914) 2024-07-31 10:03:57 -04:00
Uladzimir Havenchyk
9f6d99b5e0 dx: drop eslint-loader (#46279)
* cleanup webpack config

* drop eslint-loader
2024-07-31 16:11:06 +03:00
Jeff Bruemmer
d9eb14e8c3 update firefox link (#46330) 2024-07-31 14:59:06 +02:00
Alex Yarosh
e33c21ff4c docs: import clarification (#46328) 2024-07-31 08:51:33 -04:00
Uladzimir Havenchyk
5b8e1fb2d0 test: reduce flakiness by waiting longer for loader to disappear (#46320) 2024-07-31 15:12:05 +03:00
github-automation-metabase
052d75f0bb Add v0.50.18 to the list of releases (#46304)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-07-31 08:00:17 -04:00
Jeff Bruemmer
498db82c35 correct tar command (#46299) 2024-07-31 07:56:51 -04:00
Alexander Solovyov
fed8a1f244 make search results filterable by concrete ids (#46276) 2024-07-31 14:54:07 +03:00
Uladzimir Havenchyk
8ad5011b66 dx: cleanup webpack config (#45902) 2024-07-31 11:53:34 +00:00
Ngoc Khuat
200541d5ab Fix sync indexes mark all fields with same name as indexed if one of them is (#46313) 2024-07-31 07:27:34 +00:00
github-actions[bot]
e2086b2f73 Update Translations for v50.16 (#46015)
* Add new strings for v50.15

* import updated translations

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-07-30 22:22:17 +00:00
Oreon Lothamer
d41071987b Don't create PR Env on external PRs (#46301)
* don't run pr envs on external
2024-07-30 11:23:48 -10:00
Nick Fitzpatrick
e62aaa1e52 Show error when geojson coordinates are outside lat/lng bounds (#46064) 2024-07-30 16:44:50 -03:00
Alexander Polyankin
e12323976c Pass parameter values as JSON (#46250) 2024-07-30 16:29:42 +00:00
John Swanson
cbbcf4c872 Add an API to get stale dashboards and cards (#44711)
* Make an internal API for retrieving stale content

This introduces the `metabase.stale` module, which has one public
function (so far): `metabase.stale/find-candidates`. This takes a set of
`collection-ids`, a cutoff date, and pagination/sort info.

Next, we introduce an HTTP API endpoint that will figure out the appropriate
set of `collection-ids` for a given user/request, call this function,
and return the results in the shape we want.

Also: for e2e tests, we need a way to mark a card or dashboard as stale. I
think the easiest way to do this is to just create a testing endpoint
that we can call to update the `last_used_at` or `last_viewed_at` of the
card/dashboard to set it to ~7 months ago.


---------

Co-authored-by: bryan <bryan.maass@gmail.com>
2024-07-30 08:21:25 -08:00
Uladzimir Havenchyk
c364cd21f7 do not run licenses step only when the value is true (#46272) 2024-07-30 15:35:00 +00:00
Cal Herries
7e0ae60a1f + handle double-quotes in table and schema name in privileges query (#46268) 2024-07-30 15:10:57 +00:00
Nemanja Glumac
01af236aa6 ci: Fix E2E flake for the reproduction #21559 (#46269)
* Fix flaky reproduction 21559

* Improve the test structure and assertions

* Remove the flaky tag
2024-07-30 16:10:08 +02:00
Raphael Krut-Landau
fc312267a1 fix(webapp/sidenav): Fix bookmark reordering (#45632) 2024-07-30 09:35:05 -04:00
Uladzimir Havenchyk
e56d54b832 deps: update testing packages (#46242)
* test: update testing-library packages

* upgrade jest

* drop useless types

* drop babel-jest

* fix types

* fix canvas error
2024-07-30 15:55:58 +03:00
Denis Berezin
fc5115d622 feat(sdk): Add Embedding SDK analytics context for API requests (#45059)
* Add SDK context header

* Update naming

* Update naming

* Add client header for embedded context

* Add client header for embedded context

* Add sdk version header

* Fix e2e

* Fix storybook build

* Refactor to inject version in build step

* Fix unit tests

* Self review

* Fix e2e

* Fix e2e

* Fix e2e

* Fix e2e

* Fix e2e
2024-07-30 12:49:44 +03:00
Chris Truter
928ef0d9f3 Detect queries referencing unknown fields (#46143) 2024-07-30 11:28:54 +02:00
Oisin Coveney
06ec01861b cursor:pointer on ParameterValueWidget (#46223) 2024-07-30 10:52:43 +03:00
Ngoc Khuat
02db079b9c Add a "See this dashboard" link for dashboard sub for slack (#45029) 2024-07-30 14:41:45 +07:00
Uladzimir Havenchyk
3dcbd7f9fe deps: update react-use and remove resolutions (#46226) 2024-07-30 09:04:34 +03:00
Uladzimir Havenchyk
44a09c59c4 build: disable licenses generation for e2e tests (#46225) 2024-07-30 09:02:46 +03:00
Luis Paolini
00aa457e05 Upgrade webpack to v5.93.0 (#46251)
* Upgrade webpack

* deduplicate webpack deps

* add ^

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
2024-07-29 23:09:24 -03:00
Aleksandr Lesnenko
da6fe862dc Indicate in-progress exports (#45697)
* indicate in-progress exports

* specs, public dashboards

* add onbeforeunload hook when uploads are in-progress
2024-07-30 00:01:49 +00:00
Cal Herries
17f6443996 Increase slack upload timeout to 20 seconds (#46235) 2024-07-29 21:42:19 +03:00
Ryan Laurie
4a7d51a65b Use regular mantine buttons for filter and summarize buttons in query builder (#46106)
* use mantine buttons for filter and summarize

* Restore fancy color hover states

* Add css modules

* oh the cleverness of me

* better var name

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-07-29 17:31:20 +00:00
Braden Shepherdson
6e64a3e04c [perf] Better CLJC memoization; bounded strategy, fast versions (#46199)
Expands and refactors `metabase.util.memoize` to support better cross-platform memoization.

**Better basic memoization**

Use `clojure.core.memoize/memo` (and its clone in CLJS) rather than `clojure.core/memoize` for
the "everything forever" strategy.

**Bounded memoization**

There are a few places (eg. `u/kebab-case-en`) where we want zero-overhead *hits* and expect the input space
to be fixed. To guard against runaway memory usage, this **bounded** strategy dumps the entire cache when it
overflows. It logs an INFO level note when that happens - the intent here is that the threshold should never
actually get hit!

**Fast JVM versions**

In the special case where the function to memoize takes exactly 1 argument which is a valid map key, we can
use `ConcurrentHashMap.computeIfAbsent` as the basis of the cache and have much less overhead.

`fast-memo` and `fast-bounded` implement this in CLJ; in CLJS they just call `memo` and `bounded`.
2024-07-29 16:53:01 +00:00
Aleksandr Lesnenko
029a6c7271 Infer id numeric columns as non metrics (#45662)
* infer id numeric columns as non metrics

* update spec
2024-07-29 11:34:25 -04:00
Cal Herries
0bc880ad7e Avoid all tables in memory during sync (#46193)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-07-29 15:30:17 +00:00
Jeff Bruemmer
a31adea8bc docs - updates env vars for main branch (#45946) 2024-07-29 11:17:59 -04:00
Nemanja Glumac
de8e196e4a e2e: Rewrite dashboard card resizing spec (#46212)
* Use function helpers

* Only assert the resize down

* Refactor repro 31701

* Remove flaky tag

* Better organize describe blocks

* Move custom `requestTimeout` config to the common block for resizing tests
2024-07-29 16:35:57 +02:00
Chris Truter
d0f9ef1c96 Track table references, even if we don't query their columns (#46128) 2024-07-29 13:02:10 +00:00
Chris Truter
a0e8395f37 Track column references whether they resolve to Fields or not (#46101) 2024-07-29 11:39:08 +00:00
Uladzimir Havenchyk
a5239fb5bd test(jest): get rid of warnings about duplicated manual mock (#46146)
* test(jest): get rid of warnings about duplicate manual mock

* update file-paths
2024-07-29 13:03:26 +03:00
github-automation-metabase
20005edc32 Update Readme version references and published npm version to 0.1.25 (#46222) 2024-07-29 08:43:26 +00:00
Oisin Coveney
337bf6883b feat(sdk): Add API keys for development mode (#46067) 2024-07-29 11:17:36 +03:00
Kamil Mielnik
7770cc69f6 Structure e2e API helpers (#46041)
* Refactor dashboard helpers to TypeScript

* Reuse existing helper

* Refactor cy.createQuestionAndDashboard to a function helper
- there was no good place to put it, so I also created new helpers/api directory
- and I moved all helpers using cy.request (with 1 exception, where a CSV download helper also does a bunch of assertions) in there

* Merge TS command definitions into a single file

* Export types

* Make dashboardDetails optional

* Export StructuredQuestionDetails

* Remove duplicated function

* Extract createNativeQuestion to separate file
- 1 exported helper per file, no exceptions!

* Reuse const

* Remove old definitions

* Add missing export
2024-07-29 14:16:33 +07:00
Denis Berezin
9d1569bda5 Migrate DashboardSidebars to TS (#46161)
* Migrate DahboardSidebars to TS

* More fixes for types
2024-07-26 23:54:32 +03:00
Alexander Polyankin
f27d115bb5 Fix the homepage dashboard being loaded everywhere (#46202)
* Fix homepage dashboard being loaded everywhere

* Fix

* Fix
2024-07-26 16:41:52 -04:00
Oleksandr Yakushev
7b14ccd974 perf: Allocation improvements on sync-db/fingerprinting path (#46167)
* perf: Optimize metabase.lib.schema.util/unique-uuids?

* perf: Allocation improvements on sync-db/fingerprinting path
2024-07-26 23:29:09 +03:00
Jeff Bruemmer
d2c2bccbe8 link fixes (#46200) 2024-07-26 15:59:29 -04:00
Alexander Polyankin
dc760a8bfa Remove unused dimension options from query_metadata (#46195)
* Remove unused dimension options

* Fix test
2024-07-26 15:35:27 -04:00
Braden Shepherdson
f95cff571d [perf] Fix memoization based on dashboard_load_id (#45809)
The `dashboard_load_id` is attached to the body for queries, not as a
query parameter. This correctly receives the `dashboard_load_id` and
uses it for `/query` calls.
2024-07-26 19:02:16 +00:00
github-automation-metabase
d2dc669c68 Add v0.50.17 to the list of releases (#46197)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-07-26 13:08:12 -04:00
Ryan Laurie
8f8a3351b4 Filter invalid recent and search items in move modal (#46086)
* filter invalid recent and search items in move modal

* e2e test disabled moving search and recent items

* update test
2024-07-26 10:52:49 -06:00
bryan
646b651703 Put SDK client and version into data on-thread (#46173)
* pull sdk info into data on-thread

* include api tests for query_execution and view_log

* Try mt/test-helpers-set-global-values!

- disambiguate names used in tests

* pass test + cleanup test helper

* make sure view logging is enabled in test
2024-07-26 16:48:07 +00:00
Alexander Polyankin
b17416a845 [perf] Fetch query metadata with DB calls directly (#45891)
* Remove unused properties

* Remove unused properties

* Remove comment

* Experiment

* Simplify

* general cleanup and adding dashboard links handling

* fix tests, link cards; sort output

* include databases from queries, not just tables, fix card sort

* use a simplified get-databases that doesn't throw

* Fix tests

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-07-26 15:34:27 +00:00
Oisin Coveney
71814c602d Add tests for #45452 (#46178) 2024-07-26 17:34:10 +02:00
Braden Shepherdson
ee2df9120b [perf] Add a test for the Clojure-side lib.cache/side-channel-cache (#46133)
This was missed in the original PR #45394 due to clumsy `git`
wrangling; my bad.
2024-07-26 15:00:26 +00:00
Ryan Laurie
05646572e8 Populate newly created metrics in recents (#46166)
* refetch metric after save to log view

* Update e2e/test/scenarios/metrics/metrics-editing.cy.spec.js

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-07-26 14:37:54 +00:00
Ryan Laurie
ae14aa31bc Add e2e tests for 45831 - instance analytics db appearing in permissions (#46061) 2024-07-26 07:52:13 -06:00
Cal Herries
fbf7a23309 Skip long values in JSON unfolding query (#46089) 2024-07-26 16:42:39 +03:00
Alexander Polyankin
99b59ed58f Fix for temporal unit parameters in click behaviors (#46112)
* Add a test

* Add a unit test for TextLike
2024-07-26 08:40:01 -04:00
Raphael Krut-Landau
d4cebf6043 fix(admin/nav): Ensure that the "Exit admin" button can be clicked regardless of locale or viewport size (#45882)
Closes #45876
2024-07-25 23:22:45 -04:00
adam-james
7efce7dfd3 Some Email/Attachment Improvements and Fixes (#45691)
* fix conditional formatting color lookup with correct col names

The column names for color lookup are expected to be the same as the :name key of each column, and applying column
formatting broke this lookup. This fixes it.

* move overflow-x into pulse body div to exlude card title from scroll

* add a test for conditional formatting w/ a hidden row.

This still fails at the moment, working on a fix yet.

* apply conditional formatting in static viz even when col is hidden

Conditional formatting that depends on a hidden column was not being rendered in the static viz, but now we pass all
columns into the color selector fn, thus when rendering the table with the ordered/hidden columns, all other columns
will still use their appropriate conditional formatting

* I missed a linter warning

* fix tab rendering

* fix test

* fix up tests with some better structural searching
2024-07-26 09:45:01 +07:00
Nemanja Glumac
77619a5084 Document E2E mongo connectivity workaround (#46162) 2024-07-25 23:47:07 +02:00
Nemanja Glumac
a05ae7bb8b e2e: Fix dashboard card resizing flake (#46158)
* Do not store elements in a `const`

* Remove mid-test save and edit dashboard
2024-07-25 15:32:34 -06:00
metamben
84f932b5b6 Add Azure managed identity support (#46011)
Add Azure managed identity support 

---------

Co-authored-by: Case Nelson <case@metabase.com>
2024-07-26 00:30:11 +03:00
Uladzimir Havenchyk
8d841b1b0d ci: patch esbuild preprocessor to show errors in watch mode (#46074) 2024-07-26 00:22:06 +03:00
Raphael Krut-Landau
0079088e57 feat(admin/performance): Improve short label for duration policy (#45933)
Closes #45127
2024-07-25 16:37:43 -04:00
Raphael Krut-Landau
6b5ce3b6e6 fix(admin/performance): Fix default time bug in Schedule policy (#45915)
Closes #45916
2024-07-25 16:37:15 -04:00
Uladzimir Havenchyk
63b483b67b dx: deduplicate yarn.lock (#45923) 2024-07-25 23:18:02 +03:00
bryan
2febfbb44d Saving SDK data for embedding statistics (#45954)
* Adds a middleware that sets 2 dynamic vars

- These vars will be used to insert context for embedding analytics

* migration adding embedding_client and embedding_version to qe and vl tables

* clarify function api

* headers come in -> dynamic vars -> written to db

When the vars are set we insert their values into query execution and
query_log under embedding_client and embedding_version.

* update update migrations

* add predconditions to migrations

* fix tablenames + dataset_test

* Code Review responses

- remove commented out requires
- clarify test for merge-count-maps
2024-07-25 19:30:17 +00:00
Raphael Krut-Landau
613db813ac feat(question): Make two messages in the question footer - query runtime and cache age - more useful (#46072)
Closes #46009
2024-07-25 15:09:02 -04:00
John Swanson
72e9b9a4af Lock down the trash collection more (#45866)
* Lock down the trash collection more

Oops. I was very thorough in checking that you couldn't modify the
trash collection in the sense of moving things to or from it. I missed
the most obvious thing: actually modifying the trash collection itself.
So if someone wanted, they could change the name of the Trash to
"Definitely Not the Trash".

* Remove the Trash Collection from serialization

Serialization tests were failing due to the previous change, but this
got me thinking, and I realized that serializing the Trash collection is
completely unnecessary. We want to create it programatically on
startup (which we are) and then nothing should change it afterwards.
2024-07-25 18:44:53 +00:00
John Swanson
f9e2720154 Loosen N+1 query detection again (#46081)
I tightened this up by removing the condition here, thinking that CI
would catch it if it was necessary - but I'm getting failures in
development. Oops - didn't realize that this defmethod wasn't actually
applied during CI runs.
2024-07-25 18:44:19 +00:00
Noah Moss
b17b351b01 Request-level caching for sandboxes (#46138)
Co-authored-by: bryan <bryan.maass@gmail.com>
2024-07-25 13:55:17 -04:00
Raphael Krut-Landau
53bc5dda7b fix(webapp): Localize 'Settings' in command palette (#46124)
Closes #46123
2024-07-25 12:36:19 -04:00
Oisin Coveney
d840db5f89 Remove extra scrollbars from summarization sidebar (#46134) 2024-07-25 18:26:01 +02:00
use-tusk[bot]
433494c757 Updating Tusk Sanity GitHub workflow (#46150)
* Updating Tusk Sanity GitHub workflow

* fix: automatic Tusk self-review

---------

Co-authored-by: use-tusk[bot] <144006087+use-tusk[bot]@users.noreply.github.com>
2024-07-25 17:19:00 +01:00
bryan
d9961ef0bb Use the new private defn (#46013)
* add mu/defn-

* use new built-in mu/defn-

* mu/defn- preserves metadata

---------

Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-07-25 16:01:45 +00:00
Nemanja Glumac
4df6519710 [E2E] Rewrite and expand repro #27643 (#45887)
* Rewrite repro for 27643

* Add TODO for the remaining tasks

* Make a test name consistent with others

* Finish the E2E test for #27643

* Fix the test to use PostgresDB

Since H2 originally doesn't fail the test

* Attempt to fix a flake on CI by waiting for table to finish syncing

* Create QA snapshot with fully synced field metadata

* Fix failed tests from field metadata change

* Simplify question scenarios

* Simplify dashboard scenarios

* Fix permissions

* Rework titles

* Add comment about PG

* Add limit to speed things up

* Fix and improve dashboard assertions

* Fix and improve question assertions

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-07-25 15:11:20 +00:00
adam-james
ba54b95c69 Bigquery Pagination Use next page to get proper results (#46095)
* Bigquery Pagination Use next page to get proper results

Fixes 45953

WIP

* use new-page in values-iterator

* disable just the part of the test that is still flaky

Want to keep the other part of the test that does prove we're not getting duplicates due to incorrect pagination.
2024-07-25 15:10:33 +00:00
github-automation-metabase
2581b4ad9d Add v0.50.16 to the list of releases (#46118)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-07-25 10:33:16 -04:00
Noah Moss
5741b9fe8d Make the sandbox cleanup logic more robust, and reorganize some perms code for better testing (#46102) 2024-07-25 10:16:19 -04:00
adam-james
1911899330 Number formatter Reports correct Decimal places for negative Numbers (#46104)
* Number formatter Reports correct Decimal places for negative Numbers

Fixes #41640

Prior to this, the number formatter would get the incorrect number of decimal places for negative numbers.

The way the decimal places count is derived works as follows:

 - convert number to a string
 - split the string on the separator (decimal, comma, whatever the instance has set)
 - destructure that split into [int decimal]
 - count decimal to get the number of decimals.

That all works for positive numbers, but for negative numbers, the regex was just splitting on 'not digits', so we got
an extra group due to the leading negative sign. This would incorrectly destructure  the 'int' part of the number into
the count, thus we would always get 1 instead of the correct value.

This fixes it by just taking last instead of destructuring.

* correct comparison to always use abs value in conditonal check

* tiny incorrectness in the test
2024-07-25 07:14:36 -07:00
Anton Kulyk
575fa4edd8 Don't show "Download results" button until dashcard query is complete (#46060)
* Don't show "Download" button until query complete

* Fix `PublicOrEmbeddedDashboardPage` tests

* Add tests

* Remove redundant dataset error checks

* Revert "Remove redundant dataset error checks"

This reverts commit fc7810f045.
2024-07-25 13:56:54 +01:00
Mahatthana (Kelvin) Nomsawadi
c24e48413a Allow stress testing E2E tests with PostgresDB (#46065)
* Modify the E2E stress test workflow to allow running PostgresDB

* Fix syntax

* Add qa_db to workflow summary

* Only run necessary containers

* Fix QA DB snapshots running when QA_DB_ENABLED=false

* Use more generic option that's not only specific to postgres
2024-07-25 13:03:35 +01:00
Cal Herries
3ec2ca99d6 Fix driver changelog for 0.50.16 entries (#46042) 2024-07-25 11:43:31 +00:00
Luis Paolini
f1319da6a6 Make drivers build in parallel rather than sequentially (#45897)
* Make drivers build in parallel rather than sequentially

* Make the whitespace linter happy

* Add duration to steps
2024-07-25 07:56:58 -03:00
use-tusk[bot]
de1a0b28bb Updating Tusk Sanity GitHub workflow (#46116)
Co-authored-by: use-tusk[bot] <144006087+use-tusk[bot]@users.noreply.github.com>
2024-07-25 11:55:25 +01:00
Oleksandr Yakushev
1624877666 [perf] Improve DB syncing times (#46103)
* perf: Add explicit .entryAt method for SnakeHatingMap

Otherwise, SHM invokes .keySet on itself which triggers the contstruction of the list of keys on each map access.

* perf: Cache (un)successful requiring of EE in dynamic-ee-oss-fn

* perf: Add a quicker path for getting metadatas from cache

* perf: Minor improvements
2024-07-25 13:16:13 +03:00
lbrdnk
d6ff929fb4 Enable e2e repro for the issue #38181 (#46082) 2024-07-25 10:14:21 +00:00
Anton Kulyk
8cb3e540dd Fix document title when opening a multi-series question from dashboard (#46004)
* Add repro

* Fix onOpenQuestion uses unexpected card object
2024-07-25 10:50:24 +01:00
Kamil Mielnik
8a2019c033 Refactor e2e dashboard helpers to TypeScript (#46037)
* Refactor dashboard helpers to TypeScript

* Reuse existing helper
2024-07-25 16:42:12 +07:00
Kamil Mielnik
40bf76ef14 Fix comma in location.svg (#46056) 2024-07-25 13:29:58 +07:00
Braden Shepherdson
80a20c0228 [perf] Add a Clojure-side impl for lib.cache/side-channel-cache (#45394)
It's based on a (global, synchronized) `WeakHashMap` using the query map
itself as the key. That gives the cache the same lifespan as the query
map, which is generally brief but often includes many calls to
expensive, cached functions like `visible-columns`.
2024-07-24 23:42:16 -04:00
Alexander Polyankin
e74130a8b9 Revert "fix: param-fields when native model is aggregated (#45068)" (#46108)
This reverts commit 6495def057.
2024-07-24 23:56:37 +00:00
Nemanja Glumac
d992abdfbc ci: Fix request timeout in E2E dashboard filters flake (#46091)
* Make filter corrupted again™

* Speed up the test by limiting the number of rows

* Make the repro more correct, and more resilient

* Remove intercepts

* Improve assertions
2024-07-24 17:06:02 -06:00
Alexander Polyankin
5519ad2e0f Fix a race condition with models creation (#46066)
* Fix a race condition with models creation

* Fix the test

* Fix the test
2024-07-24 17:51:58 -04:00
Jeff Bruemmer
e727f1be9d docs - notes on view data vis (#46093)
* notes on view data vis

* Update docs/permissions/data.md

Co-authored-by: Alex Yarosh <alexandra@metabase.com>

---------

Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2024-07-24 21:05:32 +00:00
Jeff Bruemmer
05f6129d5a note on projected coordinates (#46079) 2024-07-24 17:04:26 -04:00
Noah Moss
1e4e8e31be Cross branch migration testing workflow (#45998)
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-07-24 13:37:27 -04:00
Phoomparin Mano
3fe3739194 feat(sdk): add CLI to download and start Metabase locally for better onboarding experience (#45784)
* add webpack configuration for cli

* add requirements checking

* docker check

* docker start command

* port checks

* add getting started steps

* add final install message

* cleanup cli text

* handle force-closing prompt

* build the cli when running build-embedding-sdk

* wording updates

* add redundant prompt in case of small terminals

* remove redundant instruction

* make sure the user confirms the step

* change container name to metabase-enterprise-embedding

* migrate cli to es modules instead of webpack

* add shebang line for npx

* add cli dependencies to devDependencies

* Revert "add cli dependencies to devDependencies"

This reverts commit 5d5e952c2b.

* Revert "add shebang line for npx"

This reverts commit 766fdda09e.

* Revert "migrate cli to es modules instead of webpack"

This reverts commit 7d1b065163.
2024-07-25 00:35:12 +07:00
Phoomparin Mano
850f52488d docs(sdk): readme updates on react 17 partial compatibility (#46043) 2024-07-25 00:34:26 +07:00
Denis Berezin
871955e8eb feat(sdk): Add SDK storybook and e2e tests tooling (#45512) 2024-07-24 19:16:50 +03:00
Alexander Polyankin
3f7044618b Disallow multi-stage metrics (#46054) 2024-07-24 16:12:42 +00:00
Nemanja Glumac
65e38984e8 ci: Fix ace editor E2E typing flakes (#46048)
* Rewrite startNewNative helpers

* Update existing tests

* Fix table hovercards E2E flake

* Fix repro 37009

* Update repro 30680

* Add comment

* Fix nested question flake

* Fix typo
2024-07-24 14:48:22 +00:00
adam-james
f257598e8f Embedding Parameter Values set in Tokens work properly when nil or empty list (#45771)
* Embedding Parameter Values set in Tokens work properly when `nil` or empty list

Fixes: #40292

If a locked parameter's value is set to `nil` or `[]` in the embedding JWT, we want to treat this as 'no value has
been set' on that filter, but we should still run the query as normal. Likewise, any linked filters should still
properly derive their values from the unfiltered values of the filter to which they are linked.

* when a parameter's value is nil or empty seq, don't include it

This is a partial solution as I still need to find the place that's still erroring on the empty list case in terms of
the linked parameter's values.

* Treat empty list like `nil` for the token param

When you're using a filter in the App, it makes intuitive sense that when you've not selected anything from a filter's
drop down list (or entered any text, etc.), then the filter is effectively not applied.

For token params, we should behave similarly; `nil` and `[]` can both be accepted, and signal that the user intends
for that filter to basically NOT apply.

This also means we should not pass the constraint to the linked filters, since it errors, but even if it worked, it
would return 0 results, making it impossible to properly apply the linked filter at all.

So, this change causes empty lists to be treated as nil, AND will remove any parameters with `nil` as a value before
being passed to the query processor, which results in the proper behaviour of not having constraints on the linked
filter, and having the 'parent' filter not filtering anything.

* Embed preview should always use params from the token

In making a screenshot, I discovered a slight bug in previews, where if the embed had been previously published, it
could pull embedding params from the db that don't match the settings on screen. So, always pull the settings from the
token, which updates as the user is making changes in the Preview Embed UI.

* for previews, merge the embedding params sources instead

* alter 'nil' behaviour to work just as if the key doesn't exist

* fix one spot where I was passing maps into set functions

* Adjust tests to check for consistent behaviour in dash/qstn embeds

* fix an e2e test

* fix up last 2 failing e2e tests

* add the test case of a locked param having no value set in token

* some further e2e changes
2024-07-24 14:44:33 +00:00
John Swanson
50d0c35a77 Improve N+1 detection for simple hydration methods (#45848)
We have N+1 detection for simple hydration methods that checks to see
whether the hydration method made any DB queries at all. This makes
sense, because a simple hydration method is called on each instance
individually - if we make database calls *each time*, we're in trouble.

Where this runs into issues is with cached data, where the simple
hydration method is populating the cache - e.g. `:can_read` or
`:can_write` dereferencing `api/*current-user-permissions-set*`.
Currently we specifically exclude those hydration methods from the
check.

But after running into this again for a different simple hydration
method, I think there's a more robust approach:

- first, run the hydration method without counting DB queries

- then, run it again and make sure we don't make any additional DB
queries.

There is a potential downside here: if someone wrote a simple hydration
method with side effects, they'd potentially be very confused (in
development - this doesn't run in prod!) when those side effects
happened twice for a single hydration. But I *think* that's fairly
unlikely.
2024-07-24 06:33:02 -07:00
Alexander Polyankin
7628e33deb Fix broken details-only check in viz (#45959)
* Proper fix

* Add e2e repro

* E2E repro

* Update e2e/test/scenarios/models/reproductions.cy.spec.ts

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

* Update e2e/test/scenarios/models/reproductions.cy.spec.ts

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-07-24 13:32:44 +00:00
Uladzimir Havenchyk
f308cc1e47 test: wait for element to be rendered in flaky test (#45978) 2024-07-24 15:39:06 +03:00
Uladzimir Havenchyk
0cd024f752 dx: clean output folder before building jar (#45911)
* dx: clean output folder before building jar

* clean output only in prod mode
2024-07-24 15:30:00 +03:00
Nick Fitzpatrick
6a9230f146 Add repro for 38041 (#46003) 2024-07-24 09:18:38 -03:00
github-automation-metabase
03b802ee87 Update Readme version references and published npm version to 0.1.24 (#46044) 2024-07-24 12:04:10 +00:00
Phoomparin Mano
bfdcf0cb73 fix(sdk): throw errors when sdk hooks are used outside of redux context (#45999)
* handle errors when useMetabaseAuthStatus is used outside of sdk context

* address review comments feedback

* extract useSdkContext

* fix import type error
2024-07-24 18:12:42 +07:00
Chris Truter
ce9b57beaf Docstrings and refinements to the query-analysis module (#46023) 2024-07-24 12:56:21 +02:00
Nemanja Glumac
0cbd98df9d Fix E2E models flake 35039 (#46038) 2024-07-24 12:44:52 +02:00
Phoomparin Mano
3ceac07d4d fix(sdk): support React 17 backwards compatibility (#46012)
* polyfill useSyncExternalStore for React 17

* adds the shim

* use ReactDOM.render instead of createRoot for backwards compat

* use createRoot for React 18 environment

* refactor renderRoot compatibility

* remove semver dependency

* add small test for version

* use the same check for react 17
2024-07-24 17:25:21 +07:00
Chris Truter
52615c3774 Abandon deduplicating queue due to a race condition (#46014) 2024-07-24 09:09:54 +00:00
Chris Truter
f0323abee4 Decouple query analysis models from validation API (#46002) 2024-07-24 07:21:36 +00:00
Ngoc Khuat
7369c056f0 [perf] Only update ParameterCard when it changes (#45901) 2024-07-24 05:51:16 +00:00
Cam Saul
65bb3bb3a9 Make Redshift sync much more robust (#46021)
* Potential Redshift sync flake fix

* Make Redshift sync much more robust
2024-07-24 01:26:07 +00:00
Noah Moss
fb9c56e866 Tweak some sandboxing-related comments (#45862)
Co-authored-by: bryan <bryan.maass@gmail.com>
2024-07-23 23:57:54 +00:00
Cal Herries
2081799850 Skip syncing field values for oracle CLOB columns (#44654) 2024-07-23 21:19:30 +00:00
Jeff Bruemmer
61012d1f66 docs - mysql appdb note (#45956)
* notes

* more notes

* edits

* update app db page

* file-based db mention

* anchor link
2024-07-23 17:01:46 -04:00
Noah Moss
97ea91eb58 Add mu/defn- as private counterpart to mu/defn (#45962) 2024-07-23 20:54:06 +00:00
Nick Fitzpatrick
fad4fe4c85 don't trigger onChange when create dialog is open (#45989) 2024-07-23 15:58:19 -03:00
Raphael Krut-Landau
92bd6c5ede Fix several problems with the localization of the Performance feature (#45773) 2024-07-23 14:43:25 -04:00
github-automation-metabase
335cebb461 Add v0.50.15 to the list of releases (#46017)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-07-23 14:31:53 -04:00
Alexander Polyankin
4110cbacee Fix e2e-models-metadata flakes (#45995) 2024-07-23 14:14:53 -04:00
Chris Truter
a293958d93 Rename feature to query-reference-validation (#45986) 2024-07-23 17:42:02 +00:00
Uladzimir Havenchyk
b83b9955b4 fix webpack refresh in static mode (#45987)
* fix webpack refresh in static mode

* clean output

* revert
2024-07-23 16:56:27 +00:00
Ryan Laurie
8724560f52 Fix Analytics DB Appearing in Permissions (#45831)
* what does this break?

* Revert "what does this break?"

This reverts commit 93e09edeb3.

* don't show audit db in permissions
2024-07-23 16:25:37 +00:00
use-tusk[bot]
07e6a0416b Creating Tusk Sanity GitHub workflow (#46006)
Co-authored-by: use-tusk[bot] <144006087+use-tusk[bot]@users.noreply.github.com>
2024-07-23 17:20:26 +01:00
Nemanja Glumac
4c1964db7e ci: Fix dashboard subscription E2E flake 24223 (#45993)
* Rewrite reproduction for 24223

* Fix test
2024-07-23 17:41:17 +02:00
Luis Paolini
7772e623f0 Make the translation artifacts build in parallel rather than sequentially (#45898) 2024-07-23 12:15:53 -03:00
Uladzimir Havenchyk
7b7d84f166 dx: make fe stress test faster (#45980)
* dx: make fe stress test faster

* uncomment

* invalidate cache and run in band
2024-07-23 17:43:28 +03:00
Chris Truter
5f669eeb57 Track queries with inactive tables (#45971) 2024-07-23 16:29:04 +02:00
Kamil Mielnik
a4541b8d3b Fix - Calendar widget jumps when switching months (#45803)
* Add repro for #39487

* Refactor test

* Add repro for 'on' filter

* Fix metabase#39487

* Refactor test

* Change order of tests

* Improve assertions

* Group tests

* Add tests for filter pills

* Refactor tests

* Rename helpers

* Add filter modal tests

* Add tests for filter drill

* Add notebook tests

* Fix test

* Add one more repro

* Fix typo

* Optimize tests

* Simplify the fix
- apply the fix everywhere
- remove fix for width

* Update tests

* Improve comment

* Move min height to Calendar
2024-07-23 14:27:31 +00:00
github-automation-metabase
122c4e98d7 Add v0.50.14 to the list of releases (#45958)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-07-23 09:50:06 -04:00
Noah Moss
6443715133 Set validCheckSum for permissions migration to ANY (#45981) 2024-07-23 13:38:54 +00:00
Alexander Polyankin
a459bea253 Fix editing models with metadata overrides (#45951) 2024-07-23 09:34:27 -04:00
Nemanja Glumac
4a87571b2b Fix the (object detail) flake for repro 39477 (#45973)
* Fix the flake for repro 39477

* Expand the repro
2024-07-23 14:37:22 +02:00
github-automation-metabase
621c19bc9d Update Readme version references and published npm version to 0.1.23 (#45982) 2024-07-23 12:18:30 +00:00
Nemanja Glumac
64f0054dd9 ci: Fix the native snippet flake (#45976)
* Wait for the native editor to be ready

* Add comment

* Make ace editor slightly more resilient to re-renderings

* Improve the test readability
2024-07-23 13:19:37 +02:00
Chris Truter
3c0b5ab72f Tweak failure map size and test (#45970) 2024-07-23 10:02:54 +00:00
Nemanja Glumac
db7cadb6f5 ci: Quarantine dashboard-card-resizing flake (#45972)
[ci skip]
2024-07-23 11:43:11 +02:00
Oisin Coveney
62bb5bc9d2 fix(sdk) - fix popover errors on dashboard parameters (#45671) 2024-07-23 10:59:02 +02:00
Nemanja Glumac
558a98395a 45877 follow up: Improve a11y of the ListField component (filter picker options dropdown) (#45883)
* Use Mantine checkbox

* Update E2E tests

* Remove unused `checkedColor` prop
2024-07-23 10:49:42 +02:00
Alexander Solovyov
083df744db [cache] remove mentions of removed cache settings from docs (#45921) 2024-07-23 11:27:53 +03:00
Tim Macdonald
3f30da9cc7 Add qv= test helper (#45810)
Makes much nicer test output than the resp= nonsense
2024-07-23 08:06:56 +00:00
Alexander Solovyov
183bc66217 we had unlimited xrays since 2018 and it is time to end this madness (#45909) 2024-07-23 10:39:40 +03:00
lbrdnk
3bf053c491 Add temporal bucketing to expression references (#45492)
* Add test

* Add bucketing to expression references

* Restore original schema

* Update e2e test

* Update test as per review remarks

* Apply suggestions from code review

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

* Remove alignment

* Rename ::field-type-info

* Update log level

* Remove redundant log

---------

Co-authored-by: Vamsi Peri <vamsi@metabase.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-07-23 08:07:13 +02:00
lbrdnk
1546661b00 Move parse-currency to util.jvm ns (#45939)
* Move parse-currency to jvm-util ns

* Use util.jvm ns
2024-07-23 08:06:43 +02:00
John Swanson
cb66e220b6 Require geojson to be json or plaintext (#45718)
Also modify the tests to not actually make HTTP requests. We have the
clj-http-fake client which works well for this sort of thing.
2024-07-22 20:40:37 +00:00
Uladzimir Havenchyk
e02589a386 replace babel-loader with swc-loader (#45843)
- babel is kept to transpile fonts file as swc emotion plugin doesn't handle our case correctly. I didn't find a root cause of wrong behaviour, but the safe past is to keep using babel + emotion plugin for one file and all others can be transpiled with swc
- react fast-refresh now handled by swc
- swc-loader can't read browserslist config from package.json, so we had to manually specify supported browsers in webpack
2024-07-22 19:49:03 +03:00
Alexander Polyankin
cfc6152928 Remove unused properties from query_metadata (#45858) 2024-07-22 11:57:16 -04:00
Roman Abdulmanov
2dcd3b4e4e update team json (#45936) 2024-07-22 22:01:44 +07:00
Raphael Krut-Landau
5b8d87a3b3 fix(admin): Parse cron expressions correctly in Safari v16.3 (#45654)
* fix(admin): Don't use regex lookbehinds in Schedule utility functions since these fail on Safari 16.3

* Remove blank describe block
2024-07-22 10:56:57 -04:00
Jeff Bruemmer
eef46fd37d caching order (#45930) 2024-07-22 10:45:06 -04:00
Alexander Polyankin
5bc284a3d2 Fix search field values with has_more_values: true (#45922) 2024-07-22 14:30:50 +00:00
Abed Habli
fcf8c51c80 Rename Azure AD to Microsoft Entra ID (#45863)
* Rename Azure to Microsoft Entra ID

* adding a new screenshot
2024-07-22 09:21:42 -04:00
Kamil Mielnik
b354780cd2 Repro #28270, #33708 - Object relationships in nested questions (#45854)
* Add repro for #28270

* Refactor assertions

* Add repro for #33708

* Fix typo

* Skip the repros
2024-07-22 19:39:21 +07:00
Nemanja Glumac
62688d781f ci: Run without Replay (#45799)
* Uninstall ReplayIO

* Remove Replay config

* Install and use custom Chrome v111

* Simplify comment

* Set a specific Chrome version commit

* Skip repro for #22517
2024-07-22 14:34:03 +02:00
Ngoc Khuat
7d398c1710 [dev tool] monitor all toucan2 queries (#45176) 2024-07-22 10:01:41 +00:00
Uladzimir Havenchyk
4516e643c2 refactor: drop prop-types from tsx files (#45871) 2024-07-22 11:52:20 +03:00
metamben
8d22b08fee Support out of order expression references (#45872)
* Support out of order expression references
* Return just the cycle for cyclic expression references
* Prevent "yarn test-cljs" from testing twice
2024-07-20 12:57:52 +00:00
Alexander Polyankin
3e4bf91fe2 Check for cardId being undefined (#45860) 2024-07-19 19:21:52 -04:00
Case Nelson
a82419a2fd fix: replacing joins and conditions updates alias (#45774)
* fix: replacing joins and conditions updates alias

Fixes #37074

* Only change alias if conditions or table changed

* Fix test

* Fix fe test

* Address PR feedback
2024-07-19 23:05:50 +00:00
Nemanja Glumac
05af78853f Fix #45877: Duplicated boolean options in a filter dropdown menu (#45880)
* Fix duplicated boolean options in a dropdown filter

* Add repro for 45877
2024-07-19 22:30:37 +00:00
Alexander Polyankin
66afb0d7fe Fix right section overflow in MultiSelect (#45838)
* Fix right section in MultiSelect

* Fix right section in MultiSelect

* Update MultiSelect.styled.tsx

* Add a test

* Add a test
2024-07-19 17:49:05 -04:00
Alexander Polyankin
aa4be30eb3 Remove can_run_adhoc_query (#45847)
* Remove can_run_adhoc_query from the FE

* Remove can_run_adhoc_query from the FE

* Disable can_run_adhoc_query on dashboard

Was impacting performance on dashboard load. Timings locally for me:

get dash: 3178 -> 199
get metadata: 3604 -> 1002

So dashboard went from 6 seconds to load to 1 second.

* Fixup test from disabling can_run_adhoc_query

---------

Co-authored-by: dan sutton <dan@dpsutton.com>
2024-07-19 21:19:42 +00:00
Cam Saul
1695a18d84 Redshift CI flake fix: enable robust sync behavior in tests (#45873)
* I think this should fix Redshift test flakes

* PR feedback

* PR feedback

* Make some flaky X-Ray tests ^:mb/once
2024-07-19 13:16:02 -07:00
Phoomparin Mano
b69d4d5ecd fix(sdk): missing semantic text colors mapping (#45859)
* missing text semantic colors mapping

* add foreground color test

* update tests to use SdkGlobalStylesWrapper
2024-07-20 01:15:17 +07:00
Uladzimir Havenchyk
8ef0691e87 fix: install frontend dependencies in dockerfile (#45802)
* fix: install frontend dependencies in dockerfile

* do not skip optional deps
2024-07-19 14:32:48 -03:00
lbrdnk
f4a93cba9c Move desugar-host-and-domain to jvm-util (#45808) 2024-07-19 19:19:52 +02:00
lbrdnk
a5eb647e62 Add basic auth params to dbms-version call on Druid (#45729)
* Add basic auth to dbms-version

* Add test
2024-07-19 19:16:40 +02:00
bryan
5bb2a1523c Don't show Invalid questions for Joins in Query Builder (#45768)
* adds database_id to recents, and question collection items

* don't show unjoinable things in recents either

* unskip repro

* fix types

* fix repro

* fix tests in model/recent_views

* add unit test for invalid join in recents

* fix tests in test/metabase/api/collection_test.clj

* update type

* improve unit tests

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-07-19 15:46:27 +00:00
Raphael Krut-Landau
36652d4118 fix(cache/admin): Remove old caching components (#45755) 2024-07-19 11:07:25 -04:00
Noah Moss
e5e3ef876f Speed up permission migrations by 95% under specific conditions (#45775) 2024-07-19 14:33:26 +00:00
John Swanson
ec4d4418c4 Add report_dashboard.last_viewed_at (#44240)
* Add `report_dashboard.last_viewed_at`

- defaults to `now()` (it's intended to be used as a timestamp after which
we're *sure* the item hasn't been used, not a definitive timestamp we're
sure the dashboard was actually used at)

- updated whenever the QP processes a query for a dashcard

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-07-19 06:55:23 -07:00
github-automation-metabase
be6ad03804 Update Readme version references and published npm version to 0.1.22 (#45850) 2024-07-19 13:54:39 +00:00
Noah Moss
9832bb0608 Add .jar extension in example serialization command (#45849) 2024-07-19 09:49:57 -04:00
Nicolò Pretto
a09d136ede fix(sdk): make png/pdf export work in the sdk (#45751)
* remove dynamic import to make html2canvas work on the sdk

* Revert "remove dynamic import to make html2canvas work on the sdk"

This reverts commit a8b511fa28.

* manually import html2canvas-pro and jspdf in the sdk
2024-07-19 15:03:07 +02:00
Braden Shepherdson
f5835c5900 [perf] Properly buffer while streaming JSON to API responses (#45684)
Previously, due to over-eager `.flush()` calls in Cheshire, we were
flushing the output stream for every `data.rows` entry. Typically this
resulted in 3 + N TCP packets sent, where N is the number of rows being
returned.

This PR rebuilds how we stream the JSON responses to avoid extra
`.flush()` calls. For the unit test in this PR, that reduced the number
of packets sent over the wire from 37524 to 4.

Fixes #34795.
2024-07-19 08:58:44 -04:00
Alberto Perdomo
6f570c8e19 fix(sdk) Update README.md for SDK (#45792)
Warning about React 17
Update supported and planned features
2024-07-19 13:19:02 +01:00
lbrdnk
9c708c217e Remove :foreign-keys feature or convert to :metadata/key-constraints where appropriate (#44894)
* Post sync hook stub for implicit joins testing stub

* Add join alias to field lvalues to enable sorting on joined fields

* Disable :foreign-keys on Mongo

* Require :left-join support for implicit joins instead of :foreign-keys

* Update implicit joins tests

* Adjust sync-fields-test

* Update implicit joins feature check test

* Transform post-sync-hook to normal function

* Add foreign key relationships only for dbmses without :foreign-keys feature

* Update test to handle Oracle correctly

* Split convoluted fn

* Avoid unnecessary computations for datasets with no fks

* Update docstring

* Fix driver usage

* Transform :foreign-keys to :metadata/key-constraints in test data loading code

* Update sync_test.clj

* Update driver_test.clj

* Update moviedb.clj

* Update dataset_definition_test.clj

* Update fetch_metadata.clj

* Update fields_test.clj

* Update driver.clj

* Update driver/sql.clj

* Set sql driver join support to true for all joins

Deriving drivers are expected to set to false where applicable.

* Update sqllite.clj

* Remove foreign-keys from spark

* Remove :foreign-keys from presto

* Remove :foreign-keys from Athena

* Remove foreign-keys from big query

Reading docs it seems fk inference should be ok. Let's see the test results. Act based on that.

* Update test_metadata.cljc

* Set key-constraints to false for bigquery

* Add foreign keys to sqlite manually until sync is fixed

* Return driver require to Athena

* Correct typo

* Add naive primary key heuristic

* Update pk fk logic to handle name components correctly

* Add alias escaping to presto

* Add ordering to test

* Add order by to test

* Update test

* Remove use of rewrite-fields-to-force-using-column-aliases in order by fields

* Add exception to alias forcing

* Different approach to exception from alias forcing

* Alternative approach for prefixing idents in bigq

* All seelcted fields by desired alias

* Rewrite only fields not from this source table

* Update test

* Enable breakout-on-fk-field-test for :left-join drivers

* Add feature comment

* Explicit joins tests foreign-keys removal

* Update nested_queries_test.clj

* Update remapping tests

* Update tests

* Update tests to handle sqlite results format

* Disable metadata/key-constraints on sqlite during tests until

* Address remarks

* Remove mt/with-mock-fks-for-drivers-without-fk-constraints

* Update bigquery test

* Update tests

* Adjust row level restrictions

* Add parameterized-sql feature

* Update comment

* Update leftovers

* Order keys

* Remove foreign keys from frontend

* Fix FE unit

* Update driver changelog

* Address review remark

* Update test/metabase/query_processor/test_util.clj

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 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/query_processor.clj

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 test

* Update comment and reduce expression

* Update comment

* Address remarks

* Fix merge

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-07-19 13:55:09 +02:00
Alexander Polyankin
473ae3b6bd Add a repro for "Cannot create another filter value if it starts with the same value as an existing value" (#45837) 2024-07-19 07:11:15 -04:00
Mahatthana (Kelvin) Nomsawadi
143f27577a Skip repro 27643 again for issue that hasn't been fully fixed (#45841) 2024-07-19 10:42:35 +02:00
Aleksandr Lesnenko
9c44162334 update trend chart copy (#45814) 2024-07-18 18:51:02 -04:00
metamben
15376b55d4 Remove dead code (#45815) 2024-07-19 01:39:57 +03:00
Noah Moss
d47b153392 Exclude deactivated admins from legacy no-self-service email (#45726) 2024-07-18 18:34:24 -04:00
metamben
d364df916e Derive MySQLEnum from Text instead of TextLike (#45752)
* Derive MySQLEnum from Text instead of TextLike

Fixes #44807.

This change is in accordance with https://dev.mysql.com/doc/refman/8.0/en/enum.html describing the ENUM types as a
kind of string.  All our string operations seem to work with MySQL ENUM fields.
2024-07-19 01:13:53 +03:00
Raphael Krut-Landau
df2d409771 fix(webapp/collections): Tweak the height of action menu items so they align well with icons (#45618) 2024-07-18 17:35:38 -04:00
Alex Yarosh
0e41258185 docs: extract requires a db with regex (#45828)
* docs: extract requires a db with regex

* Update docs/questions/sharing/visualizations/table.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-07-18 20:29:09 +00:00
Jeff Bruemmer
57dfd4a629 docs - json filter limitation (#45822) 2024-07-18 16:14:56 -04:00
Chris Truter
bd842dae52 Track query analysis failures in an in-memory map (#45793) 2024-07-18 22:13:57 +02:00
Alexander Polyankin
48985218c2 Fix parameter mapping (#45806) 2024-07-18 16:00:05 -04:00
Alexander Polyankin
abcefc989e E2E repro for Field Filter's Default Value Not Working on Dashboard with UNIX timestamp (#45811) 2024-07-18 15:59:45 -04:00
Nemanja Glumac
f2710c35ec Unskip repro for #27643 (#45785) 2024-07-18 20:59:19 +02:00
Ryan Laurie
8a1d6b2f79 Remove stupid perf unit test (#45812) 2024-07-18 18:15:03 +00:00
Tim Macdonald
122b0766d6 Include cards from the root collection in the Query Validator Tool (#45770)
Include  cards from the root collection in the Query Validator Tool

[Fixes #45756]
2024-07-18 18:59:20 +01:00
Case Nelson
bcd5a0026e test: add database feature to test identifiers with spaces (#45680)
* tests for drivers with spaces in their identifiers

* Add driver feature

* Fix tests

* Remove ambiguous alias for sqlite

* Try to fix bigquery and sqlite tests not seeing left-join support

* Add explicit support for left-join because of foreign-keys during test hacks

* Handle left-join support weirdness

* Fix test
2024-07-18 09:25:46 -06:00
Nemanja Glumac
5e49f15b84 45749 follow up: guard against the potential null (#45796) 2024-07-18 15:32:20 +02:00
Uladzimir Havenchyk
e8e87857d2 Remove flakiness from e2e repro but move it to jail anyway (#45791)
* Remove flakiness from e2e repro

* add to flaky group anyway

* add to flaky group anyway

* fixup! add to flaky group anyway
2024-07-18 13:17:18 +00:00
Kamil Mielnik
16eb7df08d Fix flaky test (#45794) 2024-07-18 18:58:02 +07:00
Chris Truter
115de918cb Asynchronously fix missing, stale, or orphaned Query Analysis (#45711) 2024-07-18 11:15:10 +00:00
Anton Kulyk
f4f71ea7bd Clean up dashboard URL management (#44639)
* Fix falsy tabSelected/tabRenamed checks

* Update URL management (WIP)

* Fix tests failing because of whitespace changes

* Fix tests failing because of parameter order

* Use one hook for parameters and tab URL management

* Fix tests failing because of parameter order

* Fix test failing because of whitespace changes

* Revert

* Fix DashboardTabs tests

* Fix tests failing because of parameter order

* Fix test

* Fix test failing because of whitespace changes

* Remove unit tests that should be e2e tests now

* Fix tab navigation

* Fix string encoding/decoding

* Revert test changes

* Consistent question search params

* Update DashboardTabs tests

* Fix `SyncedParametersList`

* Fix e2e tests

* Fix nav usage

* Fix types

* Remove `useSyncedQueryString`

* Fix test

* Move slug utils to dashboard utils

* Fix nav

* Revert nav change

* Fix e2e tests

* Fix public/embedded dashboards, handle site url

* Add repro test

* Bring back and fix `PublicOrEmbeddedDashboardPage` tests

* Move `SyncedParametersList` to qb
2024-07-18 11:30:57 +01:00
Nemanja Glumac
c0b63285b6 Do not render ExecutionTime if there is no time to format (#45749)
* Do not render if there is no time to format

* Add a unit test

* Render time if 0

* Simplify the logic with explicit check for `undefined`
2024-07-18 09:45:09 +00:00
github-automation-metabase
18bbd3adab Update Readme version references and published npm version to 0.1.21 (#45783) 2024-07-18 07:18:21 +00:00
Kamil Mielnik
d62bc6ca80 Fix - App crashes when navigating back during model creation (#45709)
* Refactor EditoTabs
- get rid of options prop
- use named export

* Remove unused data-testid

* Remove redundant id and aria-labelledby

* Remove redundant props spread

* Bring back data-testid in use
- Thanks VSCode for randomly showing me search results or not...

* Fix navigation issue

* Add a repro for first issue

* Adjust EntityPickerModal root element so that it works with "be.visible" assertion in Cypress

* Add a repro for second issue

* Refactor tests
- Fix not enough history entries issue

* Change order of tests to start with simpler one

* Fix invalid request issue

* Add more assertions

* Format code
2024-07-18 13:57:47 +07:00
Phoomparin Mano
1e48f9629a feat(sdk): theme option to customize popover's z-index (#45613)
* customize popover z-index

* make popover z-index customizable

* make the popover z-index customizable

* add tests for popover z-index

* also specify z-index for mantine popover
2024-07-18 13:55:20 +07:00
Cam Saul
bab905c069 Use single connection for test data loading & big test data loading improvements (#45268)
* Reuse connection for test data loading & JDBC data loading overhaul

* Revert silly change

* Remove unneeded logic for recording which datasets are loaded or not-yet-loaded

* Ok so I guess we do need the code to detect duplicate dataset loading after all

* B I G  improvements

* Appease Kondo

* Test fixes 🔧

* More test fixes 🔧

* Fix dataset-already-loaded?-test

* Fix test

* Fix Presto JDBC and greatly improve test data load speed for it

* Postgres test fix 🔧

* Fix compilation errors

* MySQL fixes 🔧

* Fix syntax error

* MySQL fixes 🔧

* Implement `dataset-already-loaded?` for Athena and cache the set of existing databases

* Fix Redshift

* Fix Presto JDBC

* Vertica test fix 🔧

* Fix Oracle dataset-already-loaded?

* Test fixes and parallelize some API tests.

* Test fixes 🔧

* Oracle test fix? 🔧

* Another test fix 🔧

* Stop putting random spaces in code bodies this is not JavaScript code

* with-temp-vals-in-db should merge in original value of Database settings

* The most test fixes 🔧

* 3 or 4 test fixes 🔧

* Add schemas around stuff to catch errors

* Appease Kondo

* Implement dataset-already-loaded? for vertica

* Implement dataset-already-loaded? for SQLite and Snowflake
2024-07-17 21:06:11 -07:00
Case Nelson
7ea19b4f72 fix: UUID filters across supported databases (#45575)
* [WIP] Testing driver filters

* Only test returned values in CI

* Add :uuid-type for dbs that support that type (test oracle's support)

* Try again for oracle test, redshift does not support uuid-type

* Add tests, support where available

* Add empty/null tests

* Adjust test query for athena

* Reset logging

* Fix comments

* Add Athena uuid conversion

* Address PR review

* Add comments

* Address PR comments

* Use varchar for portability. Add inline uuid casting for athena

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-07-17 19:13:55 -06:00
Emmad Usmani
7b4e4c3349 fix tab actions not working in firefox (#45682)
* fix tab actions not working in firefox

* add e2e test

* update e2e tests that need awaitRequest: false
2024-07-17 22:12:21 +00:00
Alexander Polyankin
03905e7940 Bulk filter modal incorrectly suggests that you can filter by values in a JSON column (#45748) 2024-07-17 17:31:21 -04:00
Oreon Lothamer
0293ce541f ephemeral pr envs on label (#45602)
* ephemeral pr envs on label
2024-07-17 11:13:14 -10:00
adam-james
60ad50b9b8 Field Filter Value Normalization in Embedding Endpoints (#45447)
* Field Filter Value Normalization in Embedding Endpoints

Fixes 27643

Since we use query-params to pass paramter values, we have to normalize the parameter map values.

This PR is a WIP, as I'm trying to find a way to do this hollistically/properly.

First commit here is mostly as a marker for where to start working on this properly, as I think the json parsing won't
catch all cases, nor should the normalization happen without some attempt to use a schema to properly validate, maybe
even coerce things.

* read strings if boolean or numbers, replace blank str with nil

Also update the common dashboard param values fn to use embedding params from the URL blob if the app db doesn't have
embedding params. This happens upon first preview where nothing will have been written to the Appdb yet.

* Add query-param normalization test, add related embedding test

* schema didn't work in this case after all.

Worth a shot, but don't want this to block the PR, so reverting to the previous schema

* Add comment pointing out the downsides/reasons for this solution

It's nto a perfect solution, but it's probably the best we can get at the moment, without adding a new filter
type (boolean) and/or improving the design of hte embedding endpoints and how filters/parameters work
2024-07-17 20:33:14 +00:00
John Swanson
c7a5aee1f8 Preprocess queries before data perms check (#45601)
When we run queries, we preprocess them, during which the sandboxing
middleware adds information that we use when checking permissions
later on in query processing.

When we checked data permissions before saving a card, we were checking
permissions on the raw query, without preprocessing. Without the data
provided by the sandboxing middleware, the permission check sometimes
failed (depending on the permissions for other tables in the DB).

Note the big hack here: preprocessing can fail, for lots of reasons.
This broke a *lot* of tests that were passing in invalid queries. If an
exception occurs during preprocessing, we catch and just use the
original query like we were before.
2024-07-17 19:20:14 +00:00
lbrdnk
45728b0824 Fix deserialization of mongo native query string (#45566)
* Fix deserialization of mongo native query string

* Add test
2024-07-17 20:23:25 +02:00
Tim Macdonald
8b9e7afe90 Don't return duplicate cards in the Query Validator Tool (#45677)
* Don't return duplicate cards in the Query Validator Tool

[Fixes #45673]
2024-07-17 18:35:51 +01:00
Cam Saul
dcbddc9ebc Sync Snowflake VARIANT type as new :type/SnowflakeVariant (#45674)
* Sync Snowflake `VARIANT` type as :type/SnowflakeVariant`

* Test fix 🔧
2024-07-17 10:02:02 -07:00
Uladzimir Havenchyk
7cfb0e72e2 build: do not run duplicated steps during jar building (#42699) 2024-07-17 19:13:38 +03:00
Alexander Polyankin
96e60529c9 Add fallback filter widgets for uncommon (or unknown by Metabase) data types (#45578) 2024-07-17 16:12:03 +00:00
Nicolò Pretto
489a0ac8da fix(sdk): fix downloads not working on sdk (#45657) 2024-07-17 15:30:46 +00:00
Ryan Laurie
271affa885 Install release packages before building (#45660)
* install before running script

* freeze dat lockfile
2024-07-17 09:22:00 -06:00
Oleksandr Yakushev
5b35e8a429 perf: Optimize XLSX export by using more efficient iteration (#45669) 2024-07-17 18:13:57 +03:00
Nicolò Pretto
dec3a0ec03 fix public resource flake (#45731) 2024-07-17 15:10:17 +00:00
Tim Macdonald
9fc76a7e09 Fix Emacs indentation of with-anaphora (#45716) 2024-07-17 14:30:45 +00:00
Ryan Laurie
e6b500087a Use automation token for checkout in docs update action (#45663) 2024-07-17 08:27:11 -06:00
Sloan Sparger
24caede62a Add model icon to model section of a collection (#45696) 2024-07-17 09:13:06 -05:00
Nemanja Glumac
ce8f43e111 Repro #33327: Visualization does not recover from an error in native query editor (#45715) 2024-07-17 21:08:36 +07:00
Mahatthana (Kelvin) Nomsawadi
ffa54f0f45 [Milestone 1] Re-design transparent theme for static embedding and public links (#45633)
* refactor: Simplify code (#44275)

* Remove dead code

* Remove values same as default options

* Simplify hook API: Removing unused argument

* review: Remove redundant code

* Update look and feel copy (#44277)

* Update static embed tab name

* Update copies + rearrange settings

* Use Mantine Select

* Fix E2E tests by applying new copies

* Fix unit tests

* Fix more E2E tests

* review: Add a comment on Mantine `value` quirk

* Adjust spacing and relevant tests

* Move `transparent` theme to its own toggle option (#44362)

* Reorder the function to match the visual order

* Make function name consistent

* Introduce the new background option (do nothing yet)

* Remove redundant exports

* Tighten up values to reduce confusion

* Make the parameters order consistent

* Only show background option on dashboads (spec)

* Allow dashboard embed background to be transparent

* Make filter background and header/footer transparent

* Fix type error

* Fix unit tests

* Fix E2E tests

* Fix checkerboard pattern not showing when no background

* Add unit tests

* Add missing copy update

* Remove remnants from outdated solutions within the PR

* Improve code comment references

* Fix E2E tests since the last copy change

* Fix type errors from merging master

* Update light theme style (#44488)

* Add background to dashboard filter on light theme

* Make position sticky works with transparent background

* Fix sticky filters not working on theme=transparent

* Fix unit tests

* Simplify IntersectionObserver components + fix E2E tests

* Add storybook for embedded dashboard

* Clarify the use of ExplicitSize context

* Remove unused code

* Formatting

* Review: Better mock `isWithinIframe`

* Update dark theme to match the new design (#45134)

* Update light theme checkerboard colors

* Update checkerboard colors

* Consolidate dashboard light/dark border style

* Use `--mb-color-text-primary` for light theme dashboard

* Update embed dashboard dark theme primary color

* Migrate dashboard text-secondary color

* Migrate text-tertiary color

* Migrate gold, axis, and split line to CSS custom properties

* Fix failed e2e tests

* Fix static viz not working

* Update loki snapshots

* Remove unnecessary CSS custom property

* Make diff more consistent

* Address review: reusing type

* Support backward compatibility when passing `theme=transparent` (#45214)

* Match preview query with the actual code query

* Handle backward compatibility when `theme=transparent` on dashboard

* Add unit tests

* Address review: Make tests less repetitive

* Update Metabase banner upsell UI (#45424)

* Prepare folder for nested components

* Update upsell UI

- add `fullWidth` variant
- align title to the left

* Fix Upsell banner having horizontal scroll on full width

* Add new Metabase banner upsell component

* Fix unit tests

* Address review: Fix typo

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

* Address review: Move upsel UI to `admin/upsells`

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

* Remove unnecessary ESLint disable comment

We can remove it since the file is in admin folder, and is already excluded from the rule.

* Address review: remove default value property

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

* Address review: Extract magic number

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* More UI updates (#45450)

* Update dark theme text colors to match the new design

* Update powered by metabase logo

* Update loki snapshots

* Fix unit tests

* Fix formatting

* Fix wrong dark theme metabase logo badge color

* Address review: Compress SVG with svgo

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

* Fix E2E tests

* Update loki snapshots

* Clarify Metabase base colors with comments

---------

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

* Add more tests (#45628)

* Add static embed question stories

* Add loki snapshots

* Add transparent theme for static dashboard tests

* Add transparent theme tests for static questions

* Assert `background` option in analytics tests

* Remove tests for logic that has been moved

* Update loki snapshots

* Fix failed E2E tests from merging master

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-07-17 14:51:34 +01:00
Kamil Mielnik
9ec6c7293e Refactor EditorTabs component (#45705)
* Refactor EditoTabs
- get rid of options prop
- use named export

* Remove unused data-testid

* Remove redundant id and aria-labelledby

* Remove redundant props spread

* Bring back data-testid in use
- Thanks VSCode for randomly showing me search results or not...
2024-07-17 20:44:19 +07:00
Raphael Krut-Landau
35b3dfc667 fix(webapp/collections): Allow only one action menu popover to be open at once (#45619)
This also makes collections tabbable

No longer skip e2e test: "scenarios > collections > trash > should open only one context menu at a time"
2024-07-17 09:42:26 -04:00
Alexander Polyankin
68ade651a1 Fix offset error (#45693) 2024-07-17 08:15:12 -04:00
Ngoc Khuat
f5d4361776 Fix pulse being sent multiple times (#45703) 2024-07-17 09:36:08 +00:00
Oleksandr Yakushev
2a4a283987 perf: Work around Apache POI ColumnHelper performance bug (#45667) 2024-07-17 12:22:07 +03:00
Cam Saul
8aeebaa2ea Debug QP improvements from today's eng demo (#45376)
* Debug QP improvements from today's eng demo

* More taps

* Fixes 🔧
2024-07-16 20:00:25 -07:00
Tim Macdonald
1a07aa45ed Add type hints to dev/migrate.clj to avoid reflection warnings (#45679) 2024-07-17 01:58:52 +00:00
bryan
5c62992b7d add defendpoint dox (#45683)
* get-sub-props -> ->sub-props because it doesn't 'get' anything

* add defendpoint dox

* make style consistent

* respond to review comment

* fix formatting
2024-07-16 22:50:04 +00:00
Noah Moss
4431c4acfa Refactor perms middleware to enforce view-data at the table-level (#45615) 2024-07-16 18:36:48 -04:00
Case Nelson
36b7c2dc13 fix: add timezone to bigquery param substitution (#45661)
* fix: add timezone to bigquery param substitution

Fixes #43597

* Fix indentation and remove report-timezone lookup from loop
2024-07-16 16:25:09 -06:00
Nemanja Glumac
bdcf0f2e19 Fix typo in the (segment) Revision logic (#45651) 2024-07-16 23:30:21 +02:00
Nick Fitzpatrick
72d36b0f9c Adjusting unit tests (#45643) 2024-07-16 17:06:49 -03:00
Nick Fitzpatrick
dcfdbec602 Alert on asset download error (#45444)
* Alert on asset download error

* moving function to metabase global

* removing alert, adjusting e2e test

* update CSP
2024-07-16 17:05:00 -03:00
Alexander Polyankin
738cb39cd1 Fix field values endpoints in public & embedded dashboards (#45659)
* Fix field values endpoints

* E2E tests
2024-07-16 18:53:12 +00:00
github-automation-metabase
55d4f0fd70 Add v0.49.21 to the list of releases (#45658) 2024-07-16 14:43:44 -04:00
metamben
f961d4fb9f Preserve display-name and long-display-name in aggregation expressions (#45502)
Fixes #13437.
2024-07-16 21:22:20 +03:00
Ryan Laurie
99a3681712 Reconcile Milestones with Release Branch before release (#44631)
* Reconcile release branch commits with milestone issues

polish up pre-release milestone check

add and trigger new github action

handle already fixed issues

updates

* cleanup

* replace global imports

* prettier install

* update imports
2024-07-16 11:56:32 -06:00
Nicolò Pretto
f4d1d87398 Embed pdf export - MS2 (#44463)
* add pdf export button to static embed and public sharing (#43743)

* add export button to embed frame, it works on static embed and public sharing

* move css around to make dashcard border show up on static/public embed pdf exports
the library we use to render an html node to an image doesn't seem to support box shadow
the original fix was done in ParametersAndCardsContainer, but that component is not used in the static/public embeds

* fix types

* fix night theme pdf export
- use padding for the title instead of starting to draw the image from 60px, to keep the bg color
- change the css to also apply the bg-color to the first child of the EmbedFrame, to make it work when exporting to pdfs, where the EmbedFrame is not part of the exported dom

* refactor: exportTabAsPdfButtonText function

* give a default to the filename, even though it should always be there

* exportTabAsPdfButtonText -> getExportTabAsPdfButtonText

* introduce .WithThemeBackground to not have a css rule too much generic

* feat: adds endpoint to download results of a dashcard part of a public dashboard (#44156)

* Flag to hide download buttons (#44206)

* pass down downloadsEnabled to hide downloads buttons in public and embedded questions or dashcards

* Update frontend/src/metabase/dashboard/components/DashCard/DashCardMenu/DashCardMenu.tsx

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

* PLUGIN_DOWNLOADS_ENABLED -> PLUGIN_RESOURCE_DOWNLOADS

* adds comment to areDownloadsEnabled function to explain what it does

---------

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

* logic to handle downloads url parameter (#44363)

* minimal support for downloads url parameter

* updates StaticEmbedSetupPane test to epxect downloads=false instead of hide_download_button=true

* fix prettier mistakes

* tmp fix to the tests until we have the new analytics events

* fix eslint issues

* update embedding snippets e2e

* update embedding questions e2e

* try to clean up the mess of downloads/downloadsEnabled

* adds `hasPremiumFeature` check to the plugin, adds unit test for the logic

* adds TODOS for analytics

* unit tests for downloads flag (#45178)

* fix download pdf button not showing up when titled=false and there's only one tab

* unit tests for downloads flag on dashboards and questions

* adds test about the container id, not sure if we should keep it

* adds a comment to explain why we enable premium features in the tests

* move downloadsEnabled outside of the Boolean cast as it's already a boolean

* E2E tests for public/static downloads (#45240)

* wip e2e tests

* make downloadUtils ts friendly

* assertNotEmpty function

* adds tests for public questions

* e2e tests for static embed downloads

* publicUid -> publicUuid

* fix assertNotEmpty

* fix parameter not renamed

* Apply suggestions from code review

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

* remove duplicated test

* fix another typo i forgot to rename

* fix another rename issue

* convert e2e-downloads-helpers to ts

* refactor: put method calculation in getEndpoint function

* adds note to downloadUtils

---------

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

* Update e2e/test/scenarios/embedding/embedding-snippets.cy.spec.js

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

* change requires to import to reflect that we changed to export the source code in downloadUtils

* makes downloadsEnabled prop more consistent across components

* colocate downloadsEnabled with hideDownloadButton in embed-display-options

* defaults displayOptions.downloads to true to simplify logic

* remove unused queryString parameter in tests setup function

* reword TODO

* Revert "defaults displayOptions.downloads to true to simplify logic"

This reverts commit aebf4cf3cf.

* fix png export when on dark theme (public/embed) not having the dark … (#45497)

* fix png export when on dark theme (public/embed) not having the dark background

* move the border-radius fix for the dashcard export to saveChartImage

* remove comments

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-07-16 19:27:40 +02:00
Nemanja Glumac
1890179ab9 FE part of #37893: Do not offer alerts for models (#45611)
* Do not display alert icon for models

* Add e2e repro for #37893

* Put the guard higher

* Fix unrelated test

* Go back to keeping the logic in `shouldRender`

* Remove whitespace
2024-07-16 19:10:25 +02:00
Chris Truter
d392a4984b Implement SQL Analysis worker (#45549) 2024-07-16 18:46:46 +02:00
Nemanja Glumac
386797b232 Fix typo in a task fetching error message logic (#45652) 2024-07-16 16:17:40 +00:00
Braden Shepherdson
bcff4138ee [QP] Test :results_metadata disambiguates column names eg. ID_2 (#45109)
This makes the names inconsistent with what's in `data.cols` on the same
API response(!) but consistent with what MBQL lib will return.
2024-07-16 11:28:45 -04:00
Alexander Polyankin
6fe489a1cc Optimize autocomplete filters in FilterModal (#45532)
* Optimize input in FilterModal

* Optimize input in FilterModal

* Fix
2024-07-16 11:11:02 -04:00
Alexander Polyankin
7eeb4b186f Fix string filters with multiple values in dashboards (#45599) 2024-07-16 10:04:53 -04:00
Jeff Bruemmer
c057f236cf docs - clarify caching policy interactions (#45584) 2024-07-16 10:01:01 -04:00
Kamil Mielnik
09ab44a3f9 Fix - useIsTruncated gives incorrect results (#45625)
* Get rid of tolerance

* Use range rect and element rect instead of clientWidth/clientHeight/scrollWidth/scrollHeight

* Fix types

* Mock Range.prototype.getBoundingClientRect

* Mock getBoundingClientRect in unit tests
2024-07-16 13:49:47 +00:00
github-automation-metabase
00d574e586 Update Readme version references and published npm version to 0.1.20 (#45639) 2024-07-16 12:33:50 +00:00
Kamil Mielnik
35c8477120 Fix - Data source picker sources not refreshed after archiving a question (#45570)
* Add repro for #32252

* Have a test for archiving a question and a collection

* Refactor cy.createCollection and cy.archiveCollection to TS

* Refactor collection and user helpers to TS

* Keep collection helpers together

* Sort code

* Format code

* Use new createCollection helper

* Add return type to createCollection

* Fix typing

* Fix #32252

* Fix typing

* Deprecate openNewCollectionItemFlowFor

* Revert "Fix typing"

This reverts commit ecf3179868.

* Fix TS error
2024-07-16 11:56:31 +00:00
Phoomparin Mano
dfab26710d fix(sdk): rename scalar theme option to number (#45610)
* rename scalar to number

* try to update loki reference image

* change scalar to number

* update loki reference image
2024-07-16 18:55:16 +07:00
Phoomparin Mano
97cfe29e89 feat(sdk): add useMetabaseAuthStatus hook to get current authentication status (#45606)
* add authentication status hook

* update docs
2024-07-16 18:00:32 +07:00
Phoomparin Mano
b5fa28e210 fix(sdk): sync fetch request token function with store (#45596)
* sync fetch request token function with store

* update unit test

* update docs

* use re-render to rerender test
2024-07-16 17:51:47 +07:00
Oisin Coveney
e1869d52bc Fix padding for QueryDownloadPopover (#45627)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-07-16 10:45:13 +00:00
Kamil Mielnik
642e333d96 Refactor e2e collection helpers and commands to TS (#45624)
* Refactor cy.createCollection and cy.archiveCollection to TS

* Refactor collection and user helpers to TS

* Keep collection helpers together

* Sort code

* Format code

* Add return type to createCollection

* Fix typing

* Deprecate openNewCollectionItemFlowFor
2024-07-16 10:41:42 +00:00
Ngoc Khuat
2767fce7ad Batch processing usage metadata (#45007) 2024-07-16 10:38:50 +00:00
Kamil Mielnik
1e5bef2a0c Fix - More than 10 Series (using Add Series Dashboard Feature) cause Filter UI to be inaccessible (#45550)
* Add a repro for #43219

* Fix #43219

* Create questions in parallel

* Make 2 elements scrollable so that the 'Make sure to make a selection ...' element is not weirdly cut off when scrolling horizontally to see inside of parameter-mapper-container

* Fix assertion

* Be more specific which element is to be scrolled

* Avoid realMouseWheel which does not work reliably in CI
2024-07-16 14:46:05 +07:00
Nemanja Glumac
cc91b1c762 Fix #45594: Segment name is missing from the segment revision history title (#45604)
* Fix segment name in a revision history title

* Remove redundant `tableMetadata`

* Add repro for #45594
2024-07-16 09:39:47 +02:00
Ryan Laurie
efeab36be9 Swap out devex team (#45608) 2024-07-16 08:54:38 +03:00
Sloan Sparger
2984cdbe9c Skip fetching collection permissions graph on update (#45561)
* updates the fe to skip refetching the graph when updating the collection graph, adds tests

* Moves the skip_graph flag to be part of the body.

- the FE tooling makes it awkward for PUTs to include query params

* fixes failing unit tests

* pr feedback

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
2024-07-15 21:26:43 -06:00
Aleksandr Lesnenko
d224f1ad51 remove unnecessary explicit size (#45612) 2024-07-15 21:35:43 -04:00
adam-james
04dac01909 Add Temporal Units List to Dashboard Parameters Schema (#44454)
* Add Temporal Units List to Dashboard Parameters Schema

Closes: #44361

This adds an entry to the Dashboard Parameter schema so that we can validate
the list of temporal_units that might be passed from the frontend when adding
or updating the `Unit of Time` type parameters.

* This is the way

the real reason the schema wasn't working... well, it was, but the un-decoded versoin of parameters was being passed
to `update-dashboard` because inside defendpoint, you can use map destructuring and bind the whole map to whatever
with :as keyword.

If you decode/validate on all of the symbols in the destructuring, that's great, but if you then pass the map bound
with `:as whatever`, you don't get that decoded goodness, just the data that our http middleware produces (that is, it
might not be the shape you expect).

So, here I've created a private Schema for the :body of the request and use the same schemas to validate each key in
that map. The result should be the same but we can pass a fully decoded/validated map along.

* change test to look for the error in the right place
2024-07-15 23:21:30 +00:00
Ryan Laurie
20ab934fd5 Import updated translations (#45607) 2024-07-15 22:24:33 +00:00
Alexander Polyankin
7c254a936d E2E repro for "Selecting Exclude Hours of the day from Date Filter doesn't give the option to deselect 12:00 am" (#45603) 2024-07-15 21:20:33 +00:00
Ryan Laurie
7c97239c9a Fix translation imports (#45600) 2024-07-15 14:51:01 -06:00
Ryan Laurie
28070212e5 Automate docs version list update PR (#45048)
* automate version list update pr

* updates

* remove release-list babashka script 😢

* Revert "remove release-list babashka script 😢"

This reverts commit 372a570f9af030abd6f297116e14568b3b51afa6.

* add deprecation message
2024-07-15 14:06:50 -06:00
Ryan Laurie
49175b79c3 Automate (most of) updating translations (#36420)
* automate updating translations for major releases

* add reviewer to PR

* auto translate

* auto-translate works!

* update

* automate translation updates in CI

* fixes

* whitespace

* sort scripts

* just checkout the branch to begin with

* fix tests!

* fix import
2024-07-15 14:02:23 -06:00
Nemanja Glumac
7e4b748279 Fix segments revision history (#45581)
* Fix segments revision history

* Simplify fetchSegments selector

* Fix breadcrumbs

* Add E2E reproduction for #45577
2024-07-15 21:43:08 +02:00
Nick Fitzpatrick
26aaa6a84d prevent moving snippet collections into descendents, remove recents tab (#45477)
* prevent moving snippet collections into descendents, remove recents tab

* PR feedback
2024-07-15 16:06:56 -03:00
Ryan Laurie
fe2a5f5326 Run release code tests separately in CI (#45505)
* run release code tests separately

* remove extra install from frontend unit tests

* use the right dir

* fix dependency issues
2024-07-15 12:47:41 -06:00
Tim Macdonald
9c02ca6475 Make the Query Validator endpoint admin-only (#45573)
[Fixes #45572]
2024-07-15 19:52:12 +02:00
lbrdnk
cc5791f438 Update query-dependents (#44205) 2024-07-15 19:10:00 +02:00
Chris Truter
4ef76d2f0f Consolidate query analysis code (#45483)
* Consolidate query analysis code

* Tighten up more

* Missed a spot

* More encapsulation

* Remove blank line
2024-07-15 19:01:08 +02:00
Oisin Coveney
51c1d83ea6 fix(sdk): Allow mapping dashboard buttons for future customization (#45356) 2024-07-15 16:30:43 +00:00
Ngoc Khuat
8a870948cc update check sum of v50.2024-06-12T12:33:08 migration that was changed in #45539 (#45563) 2024-07-15 14:49:20 +00:00
Jeff Bruemmer
b14769401c notes on regexextract (#45442) 2024-07-15 10:31:15 -04:00
Jeff Bruemmer
bcd36c1ca9 add 50.13 to list of releases (#45562) 2024-07-15 10:21:34 -04:00
Ngoc Khuat
13a927ea57 update supported DB version for postgres to 12. 9.5 is out of support 3 years ago (#45535) 2024-07-15 13:35:22 +00:00
Ngoc Khuat
4a1d8ff425 fix cache config migration fails with float setting on mysql (#45539) 2024-07-15 13:32:36 +00:00
github-automation-metabase
eacabf921b Update Readme version references and published npm version to 0.1.19 (#45558) 2024-07-15 13:29:51 +00:00
Alexander Polyankin
38b532887a Fix underlying records drill from pivot tables (#45507) 2024-07-15 09:16:21 -04:00
Alexander Polyankin
2895cc3a2b fix(sdk): Remove default Count aggregation without triggering a query update (#45398)
* Remove default Count aggregation without triggering a query update

* Fix flaky test
2024-07-15 09:15:50 -04:00
Alexander Polyankin
49cda8b708 E2E repro for 43088: (#45533)
"Admins can't create queries on Metabase Analytics models"
2024-07-15 09:15:19 -04:00
Uladzimir Havenchyk
abf1c6b231 refactor: create typed dashboard reducers (#45156)
* Create typed dashboard reducers

* fix reference

* fix export

* Move more reducers

* move parameterValues

* fixup! move parameterValues

* rtkCreateAction -> createAction
2024-07-15 15:58:35 +03:00
Phoomparin Mano
fa335318ae feat(sdk): ability to pass parameters to static questions (#45498)
* parameterized static questions

* sdk parameter values

* use parameters to construct parameter input

* add a unit test for passing the correct parameters

* fix parameter parsing

* move TEST_PARAM to top of file

* update readme docs

* address code review
2024-07-15 19:40:32 +07:00
Uladzimir Havenchyk
037bf09f09 refactor: rework QueryModals to a functional component (#45457)
* refactor: rework QueryModals to a functional component

* destructure props
2024-07-15 11:52:56 +00:00
Nick Fitzpatrick
7f52f5b67f add support for disabled command palette items. Make search states disabled (#45432) 2024-07-15 08:51:07 -03:00
Romeo Van Snick
cc8a4f071d Add missing type in the base64 string for cards (#45482)
* Pass missing type to clean card in url

* Add reproduction for #34517
2024-07-15 12:27:00 +02:00
Kamil Mielnik
5a3ee5bd81 Repro #42949 - Create column actions always visible (#45487)
* Add repro for #42949

* Add more repros for #42949
2024-07-15 15:12:53 +07:00
Ngoc Khuat
78a25608c3 Temporarily disable tracking field usage (#45536) 2024-07-15 14:32:24 +07:00
Kamil Mielnik
79dcbb6f09 Repro #23857 - Inconsistent and confusing "Duplicate" action mechanism (#45465)
* Add repro for the frontend part of metabase#23857

* Avoid cy.visit
2024-07-15 14:31:29 +07:00
Aleksandr Lesnenko
1e808e6c80 fix legend order (#45446) 2024-07-12 21:17:21 -04:00
bryan
4dcd413fd0 add skip_graph to coll perm PUT (#45438)
* add skip_graph to coll perm PUT

- also no longer ignores revision and groups
  so we don't print this warning:
  2024-07-11 16:17:32,293 WARN api.common :: Unexpected parameters at [:put "/api/collection/graph"]: [:revision :groups]

* namespace should be a keyword

* decode the keyword

* add a typehint to avoid reflection

* Adds test for skip_graph

* handle revision 0 🤦
2024-07-12 16:56:41 -06:00
Alexander Polyankin
51bec61446 Do not reset table.columns when some column is deleted (#45509)
* Do not reset `table.columns` when some column is deleted

* Do not reset `table.columns` when some column is deleted

* Fix

* Fix

* Make API calls more obvious
2024-07-12 22:21:22 +00:00
Alexander Polyankin
b2104283e8 Add FE repro for the visual glitch when working with models that have an expression with the same name as the column (#45503)
* Add FE repro for #35840

* Add FE repro for #35840
2024-07-12 18:02:12 -04:00
Uladzimir Havenchyk
3e519b93be do not allow to render empty SaveQuestionModal content (#45476)
* do not allow to render empty SaveQuestionModal content

when question is already saved and QB rerenders still open SaveQuestionModal there is a moment when content is empty before modal is closed

* fixup! do not allow to render empty SaveQuestionModal content
2024-07-12 23:49:10 +02:00
Kamil Mielnik
d81046a6f3 Repro #26919 - Aggregating with Custom Column first doesn't show sub-totals in pivot table (#45479) 2024-07-12 23:47:26 +02:00
Nemanja Glumac
5707fcdce0 Fix model metadata tooltip visibility (#45508) 2024-07-12 23:31:08 +02:00
bryan
534951b7e4 parallelize coll perm graph group lookup (#45256)
* parallelize coll perm graph group lookup w/ core.async

* respond to code review

* add + uses ExecutorCompletionService map function

* rename test

* more tests

* no concurrency for cljs

* fix timeout + add more tests

* use claypoole

* cleanup

* add kondo hooks for claypoole

* cleanup

* Can't use libraries that don't have a license

Revert "add kondo hooks for claypoole"

This reverts commit 9d93b55b28.

* ignore unused value

-- TODO: check back in on claypoole to see if the kondo config gets merged

* fix linter
2024-07-12 20:30:21 +00:00
Ryan Laurie
676b48f139 Refactor issue tracing (#45034)
* refactor and improve milestone check code

* whitespace
2024-07-12 19:48:21 +00:00
Ryan Laurie
646dd399a8 Fix cross-version test flakes (#45440)
* fix cross-version flakes

* more flake fix

* fix slack message

* tired_face

* ref name is what I want already
2024-07-12 19:41:14 +00:00
Alexander Polyankin
fc789c2d71 Fix pivoted table crash (#45485) 2024-07-12 15:16:23 -04:00
Alexander Polyankin
fde8b90f48 Fix deselecting the last join column (#45475)
* Fix fields in joins

* Fix deselecting the last join column

* Update frontend/src/metabase/query_builder/components/notebook/steps/JoinStep/JoinStep.unit.spec.tsx

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

* Fix reference

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-07-12 14:53:53 -04:00
Ryan Laurie
f3a25fb38e remove zx/globals refs (#45500) 2024-07-12 18:22:41 +00:00
John Swanson
e1e8e0c4aa Don't set :max-rows in search (#45443)
This was a huge footgun.

We were accidentally limiting *ALL* queries run in our transducer to
1000 results. This included the query to fetch permissions, so when we
checked permissions we were checking a small percentage of your *actual*
permissions (e.g. 1000 / ~6300 for me on stats).
2024-07-12 15:44:17 +00:00
Uladzimir Havenchyk
38039ecf3b refactor: do not spread props to QueryModals (#45459) 2024-07-12 18:35:02 +03:00
metamben
8bd91f5fa9 Preserve type namespace of base-type in legacy-expression-for-expression-clause (#45331)
* Preserve type namespace of base-type in legacy-expression-for-expression-clause

Fixes #44584.
2024-07-12 18:13:06 +03:00
github-automation-metabase
a54fb927a2 Update Readme version references and published npm version to 0.1.18 (#45484) 2024-07-12 14:46:31 +00:00
Braden Shepherdson
52d772006a [perf] Fix remaining thread leak in BigQuery query execution (#45253)
This comes in two parts.

**Rebuilt query logic**

I rewrote the query exec logic to use one `future` and one `a/go` block,
reporting results to a `promise`. This is easier to follow and doesn't leak
threads like the original implementation with two `future`s.

The single future is guaranteed to exit. It blocks on the BigQuery call.
That will either complete or throw an exception. Either the exception or
the BigQuery result is sent to the promise, and then the future is
complete. The only reference to that future is overwritten after the `promise`
resolves, so the `future`, its closure, and its thread don't persist longer than needed.

**Return a reducible result**

Previously the results were returned as a lazy sequence, but that brings
a lot of `seq` overhead, and is a risk of retaining the entire result
set in memory until the query is all done. Above all, it doesn't support
`reduced?` to explicitly drop any further results.

The `thunk` function style of `qp.reducible/reducible-rows` doesn't fit
neatly here, so I implemented the reducible logic directly on top of the
`Iterable` BigQuery results.

**Verifying**

This is a bit tricky. I've been testing it like this:

- Add a BigQuery database to my instance
- Create a saved question and note its ID (say, 123)
- Create an API key in (EE) Metabase and save it in an env var
- Install the `siege` load testing tool
- Install VisualVM and monitor my Clojure REPL process's thread count
- `siege --concurrent=15 --time=30s --header="x-api-key: $API_KEY" "http://localhost:3000/api/card/123/query POST"`

That will create a bunch of new threads while it's getting called, but
within a minute of the last queries they'll gradually drop out of the
thread pools and it will return to the baseline number of threads.
2024-07-12 13:39:30 +00:00
Alexander Solovyov
007127f412 [serdes] spec check requires up-to-date db (#45455) 2024-07-12 15:05:13 +03:00
Oisin Coveney
f3b6e9bcee fix(sdk): Add README for dashcard menu modifications (#45417) 2024-07-12 14:45:17 +03:00
Uladzimir Havenchyk
cc300e671a Update fast-loops (#45415) 2024-07-12 11:41:48 +00:00
Alexander Polyankin
53955c281e Fix type/PK -> type/Name and type/FK field remapping in the QB (#45047) 2024-07-12 07:19:43 -04:00
Chris Truter
979c0d6635 Implement transfer queues for performing async backfills (#45408) 2024-07-12 13:09:04 +02:00
Romeo Van Snick
a6c785623c Do not show revert button for default parameter (#45216)
* Coerce value to array

* Add reproduction for #38083
2024-07-12 12:05:20 +02:00
Nemanja Glumac
250453b5e1 Repro #44435: Long text filters overflow the window width (#45377)
* Add reproduction for #44435

* Fix and skip the repro
2024-07-12 10:03:07 +02:00
Denis Berezin
7e6adfaa3f feat(sdk): Add event handlers docs, refactor handlers naming (#45374)
* Add event handlers docs for SDK

* Invert events logic and update documentation

* Apply prettier
2024-07-11 22:48:12 +00:00
Nemanja Glumac
dc75e08d94 chore: upgrade concurrently (#45419) 2024-07-11 15:05:41 -06:00
Phoomparin Mano
49926e6873 feat(sdk): support multiple interactive questions by decoupling from query builder reducer (#45133)
* create sdk load question

* store question result in sdk context

* remove dataset data type

* update question

* handle navigate to new card

* add loading states

* fix on query change

* update question change logic

* refactor question loading and query params

* fix ad-hoc question in dashboards

* extract useLoadQuestion into a separate hook

* cleanup run question on load

* revert changes in interactive question component

* store original question in the question result state

* turn the question into ad-hoc questions

* refactor run question methods

* add a separate isQueryRunning state for better ux

* isQueryRunning should default to false

* simulate re-running the query in unit tests

* add tests for rendering multiple valid questions

* refactor sync question method

* extract raw series and computed pivot logic

* add getCardAfterVisualizationClick

* separate single and multiple question tests

* fix import paths

* is question native

* pass queryResult instead of queryResults

* temporarily remove checkNotNull for aggregation picker to avoid sdk crash
2024-07-12 00:23:29 +07:00
Alexander Solovyov
8e3b98d8fb [serdes] allow entity ids in targets (#45290) 2024-07-11 20:14:49 +03:00
Nemanja Glumac
9c1d21c46d Fix the markdown preview in model details (#45413)
* Fix the markdown preview in model details

* Add repro for #34574

* Use real `Tab` instead of a blur

* Fix test flakiness
2024-07-11 18:26:48 +02:00
Ryan Laurie
5baa23dd3a Properly handle frontend test dependencies (#45433)
* properly handle frontend test dependencies

* better yarn syntax
2024-07-11 16:26:09 +00:00
lbrdnk
84651267d4 Restore foreign key support (#44572) 2024-07-11 17:42:05 +02:00
Aleksandr Lesnenko
17d2967757 funnel chart handle duplicated steps (#45333)
* handle duplicated funnel chart steps

* fix import
2024-07-11 11:26:55 -04:00
Kamil Mielnik
793561f519 Fix broken docs link (#45418) 2024-07-11 15:10:48 +00:00
Uladzimir Havenchyk
14d8ba142c fix: render children of DebouncedFrame only when width is specified (#45365)
It prevents blinking during QB loading - initially we rendered an absolute container with width 0 in the top left corner which caused a blink
2024-07-11 17:39:51 +03:00
Uladzimir Havenchyk
d797301953 fix: adjust Popover styles to avoid horizontal scroll on body (#45414) 2024-07-11 17:15:52 +03:00
Alexander Solovyov
855951533c [serdes] use spec instead of a pipeline for Card (#45209) 2024-07-11 13:58:42 +00:00
Ryan Laurie
515af74d44 Flaky test issue automation (#43714)
* WIP flaky test issue creator

* add summary and workflows

* adjust recent flake period

* code cleanup and add tests

* Update .github/workflows/flake-status.yml

Co-authored-by: Tim Macdonald <tim@metabase.com>

---------

Co-authored-by: Tim Macdonald <tim@metabase.com>
2024-07-11 07:48:46 -06:00
Oisin Coveney
e62d098b6d Split dashboard header buttons into files (#45232) 2024-07-11 12:17:02 +00:00
Kamil Mielnik
359ae5804d Fix flaky collections test (#45370)
- getAllCollectionItemNames was breaking the chain in Cypress, so assertions did not know how to wait for DOM to be updated
2024-07-11 13:39:27 +07:00
Nemanja Glumac
b8948be99a Fix and reproduce #45300: Broken filter modal when joining using FKs (#45304)
* Add repro for #45300

* Remove empty line

* Fix

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-07-11 00:21:57 +00:00
adam-james
763dc88786 Dashboard Paramter Value Now Works in Preview Embed (#45265)
* Dashboard Paramter Value Now Works in Preview Embed

Fixes: #44962

Prior, a common util fn used both in the embed and preview_embed endpoints was causing the preview_embed to error out
when fetching dashboard parameter values because it was checking if embedding was enabled. This check is needed for
the normal embedding endpoints, but we want the preview embed endpoints to work without needing to publish the
dashboard first.

* pass proper args

* put args back in proper order.

oops

* change form back to previous, but keep preview check

* autocorrect mistake? Or perhaps a silly typo?

* change one test to show that the preview flag is working

Didn't create a whole new test for this flag as it is provable just by adjusting this test to not bother enabling
embedding on the dashboard.

* improve the docstring
2024-07-10 23:45:22 +00:00
bryan
e32b7c036c Async coll perm graph revision (#45258)
* Log changes when they make sense + async coll perm-graph revision

* - Make revision-number consistent

Decouples the creation of a revision number from the (potentially
expensive) writing of before and after for the coll perms-graph
revision.

* get id from the perms revision entity

* Move the revision id creation into the transaction

The revision id creation should only happen iff the perm updates went
through successfully.

* write a test that checks the incomplete revision

* remove sleep from tests
2024-07-10 16:36:49 -06:00
Cal Herries
a99081cddd Soft-delete defective duplicate fields (#45151) 2024-07-10 21:29:06 +00:00
Nick Fitzpatrick
cd53fa9384 Migrate Model Indexes to RTK (#43981)
* Migrate Model Indexes to RTK

* Sorting out types... I think?

* remove unneeded comment

* replacing the selector with an initiate to ensure that there is data

* catching and throwing error

* Updating unit tests
2024-07-10 17:12:06 -03:00
Jeff Bruemmer
ce477eed28 docs - add note about parameters for datetime functions (#45388) 2024-07-10 16:09:46 -04:00
John Swanson
e0762f613a Make import work on a fresh install (#45297)
This introduces a new metadata on commands, `:requires-init`. If set,
we'll run `metabase.core/init!` before running the command. `init!` will
initialize the database and run our normal startup, though it won't
actually start the Metabase server.

This allows you to use

```
env MB_CONFIG_FILE_PATH=... java -jar metabase.jar import /my/metabase/export
```

We'll run the normal init process (creating the internal user, loading
from the config file, etc), then run the command.

On my machine this adds about 2-3 seconds to the time it takes to run an
`import`.
2024-07-10 12:43:55 -07:00
adam-james
97ef3d16dd Static Viz and Exports/Downloads Respect Dashcard Viz Settings (#45164)
* start adding some util fns to download-exports-test ns

* wip improving test util fns

* add subscription attachment util fn

* add tests to catch download/export differences

* viz-settings from card and dashcard  merged properly

* revert these changes which probably aren't needed

* split test: downloads can be parallel, email attachments cannot

* normalize viz-settings no matter their origin

* Update test/metabase/api/downloads_exports_test.clj

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>

* Incorporate some review feedback

* rendered table cards also respect column names

* Clean up table render tests and remove unhelpful render test utils

The big removal of code in the render test utils namespace is a clean up task that could've happened sooner, but this
table test adjustment is the perfect opportunity to clean up.

I had made the test utils before I truly knew how best to use `mt/with-temp`, so it had a lot of poorly implemented
'generators' that were doing a poor job of creating mock data for the rendering functions anyway.

So, reworking a few table tests here to just use a temp card is way more inline with the rest of the codebase, and
actually improves confidence that the tests are testing on well-formed data to begin with.

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-07-10 19:23:42 +00:00
Noah Moss
fe73834439 put the backport disclaimer on one line so that it wraps properly when rendered (#45380) 2024-07-10 15:07:21 -04:00
bryan
bc32ba9e15 Add admin-only user-local setting that controls perms tutorial (#45076)
* add admin-only user-local setting that controls perms tutorial

* Adding modal and banner, user setting for dismissable banner

* copy changes

* adjust so modal only appears on data permission page

* e2e adjustments, adding banner test

* never show the modal or banner on new instances

* add test

* e2e adjustments, copy update

* more PR feedback

* move modal/banner settings & tests + clarify tests

* query for v50 migration execution works on mysql

- move changelog lookup into metabase.db.liquibase

* no race conditions in changelog-table-name

The previous implementation of this function was hitting this
liquibase issue: https://github.com/liquibase/liquibase/issues/2966

* revert changelog-table-name

- simply lookup the changlog row

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-07-10 13:06:19 -06:00
Cal Herries
60919cce5c Add default value to report_card.last_used_at (#45323) 2024-07-10 19:00:25 +00:00
Nemanja Glumac
2e773875f6 Repro #45036 and #44910: Multiple popovers can be opened simultaneously (#45369)
* Reproduce #45036

* Add repro for #44910
2024-07-10 17:36:22 +02:00
Kamil Mielnik
e52eaee0ba Repro #45359 - Incorrect font in e2e tests in CI (#45274)
* Add a test verifying that fonts are loaded

* Verify font is mentioned in HTML

* Bring back working assertions

* Add wait

* Disable speedy

* Disable CSP and emotion cache

* Revert "Disable CSP and emotion cache"

This reverts commit 573e99bfa4.

* Revert "Disable speedy"

This reverts commit 6f9962b869.

* Don't use local fonts

* Revert "Don't use local fonts"

This reverts commit 17c58aa73d.

* Force Lato

* Fix storybook file name

* ESLint

* Add more !important

* Revert !important

* Add font-family assertion

* Move test
2024-07-10 21:38:22 +07:00
Tim Macdonald
0d563b7af9 REST API endpoint for Query Validator Tool (#45137) 2024-07-10 16:23:10 +02:00
Nemanja Glumac
10d98f264c Repro #40622: Filter modal UI breaks when there are many tables in a question (#45352) 2024-07-10 20:41:09 +07:00
Chris Truter
d814074bea Bump macaw to 0.1.65 (#45354)
A bunch of small improvements, notably a timeout and support for MSSQL square bracket quotes.
2024-07-10 12:04:11 +00:00
Ryan Laurie
fb0daedfc1 Fix cross-version tests (#44691)
* try fixing cross-version tests

* restore legacy metrics

* its not legacy in v43

* Dont got echarts either

* newfangled echarts

* run cross-version tests on code changes in the tests

* enable slack message

* don't always run cross-version tests

* whitespace
2024-07-10 11:57:35 +00:00
github-automation-metabase
778c5da996 Update Readme version references and published npm version to 0.1.17 (#45350) 2024-07-10 10:20:58 +00:00
Chris Truter
e91850954a Add dialect based feature flags for macaw (#45234) 2024-07-10 12:07:22 +02:00
Phoomparin Mano
7af7213e64 feat(sdk): ability to specify a function to fetch the refresh token (#45313)
* add refresh auth token function

* provide a default implementation for refreshing auth tokens

* rename getRequestToken to fetchRequestToken

* add docs on customizing jwt authentication

* clarify docs, add error handling and failing tests

* update tests to pass

* re-export FetchRequestTokenFn type

* re-export EmbeddingSessionToken type
2024-07-10 16:55:45 +07:00
Cal Herries
4db6ede44a fix uniqueConstraintExists precondition (#45336) 2024-07-10 04:47:27 +00:00
Denis Berezin
51330810cb feat(sdk): Add Dashboard loading event handlers (#45153)
* feat(sdk): Add Dashboard loading event handlers

* Refactor to redux state

* Fix logic with load with cards data

* Fix nasty e2e fails

* Fix nasty e2e fails

* Add global events

* Fix issue with loading event

* Fix issue with loading event

* Review fixes

* Add unit tests

* Fix unit tests
2024-07-10 02:07:58 +03:00
Cal Herries
b39e3e8251 Extend dev/migration-sql-by-id with db-type argument (#45249) 2024-07-09 22:57:17 +00:00
Alexander Polyankin
395a0949c3 Sync table.columns and graph.metrics viz settings based on the desired column alias (#45237) 2024-07-09 22:05:22 +00:00
Jeff Bruemmer
d22913439a warning for mysql (#45322) 2024-07-09 17:43:19 -04:00
Uladzimir Havenchyk
a7cd3ab4bc perf: pass uuid to BE to enable metadata caching during fetching dashboard (#45210)
* perf: pass uuid to BE to enable metadata caching during fetching dashboard

* fixup! perf: pass uuid to BE to enable metadata caching during fetching dashboard

* Add wildcard on interceptions

* Add tests
2024-07-10 00:25:43 +03:00
Aleksandr Lesnenko
658a71f5b7 fix funnel chart settings crash on null (#45262) 2024-07-09 21:09:03 +00:00
Aleksandr Lesnenko
7c7d189234 fix incorrect y-axis extent computation (#45159) 2024-07-09 20:51:15 +00:00
Alexander Solovyov
ebe2b8726f restrict open redirects imitating no host in them (#45278) 2024-07-09 20:14:29 +00:00
Noah Moss
2a1d585156 Exclude internal content when populating :has_question_and_dashboard for current user. (#45317) 2024-07-09 20:01:56 +00:00
John Swanson
11e9a7d5a2 Lock down the Trash collection (#44921)
Prevent anything from being moved to the trash, or created in the trash.
2024-07-09 19:09:31 +00:00
Alex Yarosh
374483b74e docs: add releases (#45316) 2024-07-09 15:00:17 -04:00
Aleksandr Lesnenko
eb8555a683 fix object detail view is not scrollable on mobile (#45312) 2024-07-09 14:57:02 -04:00
Phoomparin Mano
a81b51e2bf remove the --force flag from installation guide (#45311) 2024-07-09 18:41:24 +00:00
dpsutton
d97465fc1e Fixes the formatting (#45308)
Before
====

```
2024-07-04 15:54:39,084 INFO metabase.server :: Shutting Down Embedded Jetty Webserver
Exception in thread "Thread-9" java.util.IllegalFormatConversionException: f != java.lang.Long
2024-07-04 15:54:39,122 WARN db.liquibase :: (#object[liquibase.Liquibase 0x2b7e6614 liquibase.Liquibase@2b7e6614])
	at java.base/java.util.Formatter$FormatSpecifier.failConversion(Unknown Source)
	at java.base/java.util.Formatter$FormatSpecifier.printFloat(Unknown Source)
	at java.base/java.util.Formatter$FormatSpecifier.print(Unknown Source)
	at java.base/java.util.Formatter.format(Unknown Source)
	at java.base/java.util.Formatter.format(Unknown Source)
	at java.base/java.lang.String.format(Unknown Source)
	at clojure.core$format.invokeStatic(core.clj:5770)
	at clojure.core$format.doInvoke(core.clj:5764)
	at clojure.lang.RestFn.invoke(RestFn.java:423)
	at metabase.db.liquibase$wait_for_all_locks.invokeStatic(liquibase.clj:258)
	at metabase.db.liquibase$wait_for_all_locks.invoke(liquibase.clj:251)
	at metabase.db.setup$release_migration_locks_BANG_.invokeStatic(setup.clj:175)
	at metabase.db.setup$release_migration_locks_BANG_.invoke(setup.clj:170)
	at metabase.db$release_migration_locks_BANG_.invokeStatic(db.clj:91)
	at metabase.db$release_migration_locks_BANG_.invoke(db.clj:86)
	at metabase.core$destroy_BANG_.invokeStatic(core.clj:90)
	at metabase.core$destroy_BANG_.invoke(core.clj:81)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.base/java.lang.Thread.run(Unknown Source)
```

And now it will correctly log

```
2024-07-09 16:04:28,345 INFO db.liquibase :: Waiting for migration lock(s) to be released (max 0.4 secs)
```

Why no tests?
====

There _is_ a test that would have caught this. And in fact running at
the repl will catch it:

```clojure
liquibase=> (do (require 'clojure.test 'metabase.db.liquibase-test)
                (clojure.test/run-test metabase.db.liquibase-test/wait-for-all-locks-test))

Testing metabase.db.liquibase-test

ERROR in (wait-for-all-locks-test) (Formatter.java:4515)

:h2
 Will timeout if a lock is not released
expected: (= :timed-out (liquibase/wait-for-all-locks sleep-ms timeout-ms))
  actual: java.util.IllegalFormatConversionException: f != clojure.lang.Ratio
```

But this _passes_ in CI:

```
❯ clj -X:dev:test :only metabase.db.liquibase-test/wait-for-all-locks-test
Finding tests took 23.5 s.
Running 1 tests
Running before-run hooks...

Ran 1 tests in 1.461 seconds
3 assertions, 0 failures, 0 errors.
{:test 1, :pass 3, :fail 0, :error 0, :type :summary, :duration 1461.175042, :single-threaded 1}
Ran 0 tests in parallel, 1 single-threaded.
Finding and running tests took 25.0 s.
All tests passed.
Running after-run hooks...
```

And that's because the log level in testing is FATAL and this is an INFO
level log.

Discussed ways to improve this like adding a null logger during CI but
we aren't ready to increase CI times for that just yet.
2024-07-09 12:16:21 -05:00
Nick Fitzpatrick
3c7cc680c5 move subtext to command palette item generation. Support model-indexes (#44638)
* move subtext to command palette item generation. Support model-indexes

* changing text, adding unit tests

* PR Feedback
2024-07-09 13:46:29 -03:00
Nicolò Pretto
797e9d02d6 fix flaky unit test by removing un-needed waitForElementToBeRemoved (#45291) 2024-07-09 17:44:43 +02:00
Jeff Bruemmer
911dafbefe copy change in csv modal (#45185) 2024-07-09 10:38:17 -04:00
Nemanja Glumac
f434c6c986 Add the default pinned metric description (#45287)
* Add the default pinned metric description

* Expand unit tests to repro #45270
2024-07-09 16:21:36 +02:00
Oisin Coveney
57ce93aaec feat(sdk): Add overflow menu options to Interactive Dashboard cards (#45138) 2024-07-09 17:18:17 +03:00
Cal Herries
d1d3c97f73 Only drop idx_uniq_field_table_id_parent_id_name if it exists (#45246) 2024-07-09 07:57:58 -06:00
Nemanja Glumac
6946a5d3dd Enable "Add to dashboard" for metrics v2 (#45271)
* Enable "Add to dashboard" for metrics v2

* Add repro for #44220
2024-07-09 13:58:04 +02:00
Romeo Van Snick
9b167f7cbc Pass missing size to info icon (#45272) 2024-07-09 12:04:50 +02:00
Alexander Solovyov
30c0bd021a /api/testing/set-time: ability to set JVM time during development (#45230) 2024-07-09 09:49:07 +00:00
Ngoc Khuat
aa110f2e09 Use team instead of group for auto request review (#45221) 2024-07-09 16:01:27 +07:00
Elton Okawa
d237bb3158 refactor: Tests depend on exported default polling value (#45264) 2024-07-09 09:38:08 +02:00
Romeo Van Snick
43e09e64e5 Do not insert newlines when typing text in the native editor. (#45129)
* Move focus to separate helper

* Use focus method to do initial focus

* Use focus method for other _editor.focus calls

* Move focus to componentDidMount

* Cancel focus timeout  on unmount

* Add delay to broken test

* Switch to requestAnimationFrame

* Remove wait in test
2024-07-09 08:57:31 +02:00
Noah Moss
2d7891b8ed Allow unrestricted data perms to override block even if another table has legacy no-self-service (#45118) 2024-07-08 23:17:04 +00:00
Aleksandr Lesnenko
b54d62c8f2 fix stacking settings on line charts (#45197) 2024-07-08 19:05:45 -04:00
Aleksandr Lesnenko
600fe62a4b Fix combined cards crash when cards have invalid settings (#45115)
* fix combined cards crash when some cards have invalid viz settings

* fix mock column was not metric

* ensure combined scalar column has proper type to handle the case when the card returns empty results
2024-07-08 19:05:02 -04:00
metamben
5f400a76da Remove SQL Server rowcount-override support (#44029)
Fixes #39789.
2024-07-09 01:14:57 +03:00
Raphael Krut-Landau
431a9395d3 fix: Don't require submit buttons to have the 'filled' variant (#45247)
This PR also specifies the 'filled' variant for the question duplication
modal, since the previous default 'filled' variant for submit button was
added to make that specific button filled.
2024-07-08 17:06:20 -04:00
bryan
fdd75ffca2 Remove enable nested queries (#44447)
* update e2e test for command pallete to use a valid setting

* remove the setting from the ui, make it always true, unless set false from env

* remove enable-nested-queries from admin section on fe

- fix unused oldValue -> _oldValue

* tests aren't allowed to change enable-nested-queries

* fix test + disallow setting nested queries from code

* we cannot set enable-nested-queries

- set the env var instead

* add checks for the enable-nested-queries setting

* make resolve-source-cards work with enable-nested-queries setting

* fix recents uri interception

* return enable_nested_queries setting to client

* adjust fetchmock url matcher

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-07-08 15:04:59 -06:00
John Swanson
775d7183bb Nicer error messages for linting migrations (#43667)
* Nicer error messages for linting migrations

In general, just throw exceptions instead of using clojure spec here.

You'll only get one error per run, but that seems fine.

I did keep some specs around, but run them slightly differently. Rather
than validating the whole collection of changeSets at once with `s/+`,
just `doseq` through the changeSets and validate each one separately.

That way, the value that's presented as erroneous is much smaller (a
single changeSet) and it's easier to see what went wrong.

* Update bin/lint-migrations-file/test/lint_migrations_file_test.clj

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

* Update bin/lint-migrations-file/src/lint_migrations_file.clj

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

* Require preConditions for certain liquibase change types to encourage idempotence (#44578)

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

* remove `!`s from non-side-effecty fns

* add preConditions to a few v51 migrations

---------

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-07-08 13:55:39 -07:00
Jeff Bruemmer
889e92a9ca docs - note on info schema (#45244) 2024-07-08 16:42:32 -04:00
Noah Moss
5bdabe119c Batch permission updates with many tables (#45110) 2024-07-08 15:37:47 -04:00
Cam Saul
958aaa90e2 Require Card ref permissions to use Card reference template tag in native query (#45000)
* Split unrelated changes into separate PR

* Fix test since user perms set reset fix split into other PR

* Fix syntax error

* Test fixes 🔧

* Test fix??? 🔧

* Test fix 🔧
2024-07-08 13:52:18 -04:00
Noah Moss
040ff46b84 Don't return an archived dashboard as the most recently viewed dashboard (#45229) 2024-07-08 13:41:40 -04:00
Nemanja Glumac
b6df6e217c Fix #44754: qbnewq modal can't be dismissed with keyboard (#45148)
* Use Mantine Modal for QB Newb disclaimer

* Add repro for #44754

* Use theme spacing units

* Tweak the design slightly

* Fix E2E test
2024-07-08 15:50:53 +00:00
Nemanja Glumac
beb5b3f360 Use filled button variant for the "Duplicate entity" modal (#45218) 2024-07-08 14:56:48 +00:00
Jeff Bruemmer
d8ddaa9247 add note about MySQL and MariaDB re: offset (#45219) 2024-07-08 10:47:52 -04:00
Jeff Bruemmer
77417112d1 add 50.10 to list of versions (#45190) 2024-07-08 10:47:25 -04:00
lbrdnk
d53e7e493b Add tables pre-fetching to dashboard load (#45107)
* Move collect-source-tables to util

* Add table prefetching

* Add test comparing call counts of select

* Update comment

* Add exception handling

* Add nil handling

* Handle possibye empty table-ids

* Update exception handling and test case

* Update src/metabase/models/card.clj

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

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-07-08 16:18:25 +02:00
Nick Fitzpatrick
c44d88e97c Fix Menu button in admin app on mobile view (#45058)
* use useClickOutside, add repro test

* adjusting aria label
2024-07-08 10:45:29 -03:00
Tim Macdonald
a35ed3cd00 Alphabetize EE API routes (#45215)
(Cleans up [#45137])
2024-07-08 13:43:02 +00:00
Nemanja Glumac
1f0712f2cc fix: Do not collide "no results" with "running the query" (#45167)
* Do not colide "no results" with "running the query"

Fixes #41464

* Add E2E reproduction for #41464
2024-07-08 14:05:17 +02:00
Mahatthana (Kelvin) Nomsawadi
7ff39c9e3b docs(sdk): Document how to reload Metabase embedding SDK components (#45194)
* Document how to reload Metabase embedding SDK components

* Improve readme clarity on useEffect block
2024-07-08 12:41:28 +01:00
Uladzimir Havenchyk
a2fb599a8d ci: pin replayio version (#45122) 2024-07-08 14:38:38 +03:00
Oisin Coveney
d784c95928 Use Mantine Components for QueryDownloadWidget and QueryDownloadPopover (#45104) 2024-07-08 11:49:21 +03:00
Uladzimir Havenchyk
59199fdd5a refactor: drop unused js file (#45183) 2024-07-08 10:59:50 +03:00
Cal Herries
446bb823c1 Allow defective duplicate fields (#44866) 2024-07-05 19:47:06 +00:00
Alexander Polyankin
28513ae886 Remove field ref matching from table.columns (#45180) 2024-07-05 19:41:37 +00:00
Uladzimir Havenchyk
c168b34ee3 lint: add stylelint support for emotion components (#45132)
* lint: add stylelint support for emotion components

* drop comment

* fix pattern order

* Use one version of typescript

* use :focus not :outline

* Use the logical CSS property "inset-inline-start:" (not "inline-start:" which doesn't exist) as replacement for the physical css property "left:"

* Use mb-color-focus for focus color

* Drop dead code

---------

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-07-05 20:59:46 +03:00
Case Nelson
e3378d4ea9 fix: limit xrays on agg models to source fields (#44863)
* fix: limit xrays on agg models to source fields

Fixes #43793

1. `table-like?` was checking aggregations but not breakouts. This meant
   that legacy metric definitions would try to apply to the second stage
   which is generally illegal and would cause things like implicit joins
   to come in where they make no sense.
2. Trying to bin a `count` metric-like model would give a bin span of
   0.0 which would blow up those questions.
3. Trying to self reference breakout fields, in the precense of a
   question's  aggregation meant that most fields would not be exposed to
   the next stage and should be ignored. (similar to 1.)

* Fix tests
2024-07-05 11:31:42 -06:00
Cal Herries
0a54587cd5 Skip fingerprinting or scanning field values for fields with base-type=type/Collection (#45160) 2024-07-05 11:13:31 -06:00
Cal Herries
d60facf3fc Add INFO log for each table before JSON unfolding during field sync (#45162) 2024-07-05 10:14:10 -06:00
Anton Kulyk
77e1a47228 Show alert sending time in alert form (#45062)
* Show alert sending time in alert form

* F
2024-07-05 16:33:12 +01:00
Alexander Polyankin
41250c623f Remove field refs from DatasetEditor (#44999) 2024-07-05 10:50:12 -04:00
Alexander Solovyov
b200d29857 fix serialization errors we get on big old databases (#45177) 2024-07-05 16:54:48 +03:00
Romeo Van Snick
0d5bc020d7 Allow setting labels for filters (#44352)
* Add csv-stringify package

* Split values at comma

WIP: Parse values using json

* Add label to ParameterValue and add ParameterValue to value config

* Use custom label in FieldValuesWidget

* Allow passing displayValue from outside of RemappedValue

* Allow passing displayValue in ParameterFieldWidgetValue

* Get custom value label in FormatterParameterValue

* Allow rendering custom displayValue in FieldValuesWidget

* Add custom ParameterValue types

* Fix ParameterValuePicker type

* Fix jest import for csv-stringify

* Add missing RTKQ exports for paramters

* Use direct implementation of useGetParameterValues

* Fix ValueSourceModal tests

* Add tests for value parsing and stringifying

* Use custom label in list too

* Render the custom label in a parameter value

* Setup parameter mocks in embed test

* Add info about splitting values with comma

* Add model hint when user is using labels

* Add test for cusom labels on dashboards

* Handle label-value pairs in test

* Test custom labels in parameter search input

* Use the label to parse the value for text inputs

* Fix comma's to commas

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

* Use strong instead of styling link

* Use getInput instead of ignoring eslint rule

* Use arrow function

* Add newlines between tests

* Use uppercase for test value

* Name value

* Use getLabel and getValue helpers to avoid indexing confusion

* Pull out confusing condition

* Move out getLabel helper

* Be more explicit about non-existent config values

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

* Move setupParameterValuesEndpoints to setup

* Add loading state

* Do not use alert to implement info box

* Fix formatting

* Remove undefined from getValue signature

* Use getLearnUrl

* Remove dependency on column

* Make custom field labels work in the absence of fields

* Support custom values for non-field parameters

* Add test for native question parameters

* Add newline in test

* Add test case for when show-metabase-links is false

* Just fall back to rendering value when fetching label, or in case it failed

* Add test for loading state of FormattedParameterValue

* Do not fetch custom label for FormattedParameterValue

* Add table with ip addresses

* Add test for IPAddress filter with custom labels

* Add test for custom labels on type/Quantity fields

* Remove getInput helper in test

* Remove unused hasCustomLabel value

* Split up into common and premium tests

* Make fieldValues a map for performance

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-07-05 14:05:25 +02:00
Elton Okawa
b78222eac1 Fix/logs keep pooling after unmount (#44585) 2024-07-04 23:44:54 +02:00
Nemanja Glumac
ba55d38aaf Repro #39504: Pivot table disappears (#45143) 2024-07-04 20:31:34 +00:00
Case Nelson
6495def057 fix: param-fields when native model is aggregated (#45068)
* fix: param-fields when native model is aggregated

Fixes #42829

The param-field lookup required result_metadata to match
filterable-columns in order to find parameter targets. This adds a
fallback where if the param field is missing from result_metadata,
then we look at filterable-columns.

* Unskip test
2024-07-04 14:00:20 -06:00
adam-james
6b3dc8e831 Fix Wrong Migration IDs for User Parameter Values Migration (#45120)
Per discussion in Slack, I made a mistake with the migration IDs as I wanted to backport to 50 but used 51 IDs.
This PR uses 50 IDs and places the migrations in the correct place.

Not sure if it's mergable in this state because Stats has run with the PR containing the incorrect migration IDs.
2024-07-04 11:35:29 -07:00
Alexander Polyankin
9fc1a21030 Fix actions menu permission checks (#44931) 2024-07-04 12:08:03 -04:00
Romeo Van Snick
f022f911b9 Refine the reproduction for " Entity picker surfaces recent questions that are not valid joins" (#44974) (#45091)
* Refine the reproduction for 44794

* Move skip to top-level again

* Remove superflouous click

* Verify wether or not the recents tab exists and is open

* Make the test description more descriptive

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

* Move question details to a variable

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-07-04 18:04:21 +02:00
Braden Shepherdson
ee52a52a52 [repro] Add e2e repro for Zoom In on pivot tables row headers (#45066)
This works on master, but this reproduction will prevent #38265 from
reoccurring.
2024-07-04 08:46:04 -04:00
Alexander Polyankin
07b98cee6a E2E repro for "Editing Column description of Model is confusing if it contains aggregations" (#45113)
* Fix checks and tests

* Fix checks and tests
2024-07-04 08:44:36 -04:00
Uladzimir Havenchyk
ec6e1f80f9 Pass correct redux action name (#44970) 2024-07-04 13:54:32 +03:00
Alexander Solovyov
638d79c457 [serdes] a bit more descriptive exceptions (#45093) 2024-07-04 07:28:24 +00:00
Mahatthana (Kelvin) Nomsawadi
bd9355233f Reproduce #27643: Field filter linked to Boolean column causes an error when used in Embedding (#45038)
* Add a repro for #27643

* Clarify the race condition behavior in the comment
2024-07-04 06:55:31 +01:00
Noah Moss
00c318ea95 Ignore unknown columns when reverting cards and dashboards (#45067) 2024-07-03 23:23:48 +00:00
adam-james
bac53b24cf User Parameter Values Are Unique Per Dashboard (#45064)
* User Parameter Values Are Unique Per Dashboard

Fixes: #43001

Might be related: #44858

User Parameter Values previously stored just the `parameter-id` and `user-id` as data to look up the last used
parameter value. This isn't sufficient as the parameter id is not guaranteed to be unique, in particular this is true
when a dashboard is duplicated: the parameters are copied to the new dashboard without changing the parameter id at
all.

This means that we need to also store the dashboard-id in the user_parameter_value table and use that to update/get
the last used value.

The migration removes existing entries to the user_parameter_value table because I want a non-nullable constraint on
the dashboard_id column, and existing entries will not have a value. The only way to backfill those values would be to
look through every dashboard containing parameters, and for every parameter check for a matching ID. Even if you can
do this, there's no way to disambiguate if the same paramter exists on 2 dashboards anyway, so one of them will be
wrong. I think it's not worth the trouble considering that removing the entries in this table doesn't break anything;
it just becomes a mild inconvenience that a user has to select a filter value again (since the dashboard will use the
default value).

* alter test to check for uniqueness across dashboard

This test makes 2 dashboards with parameters of the same ID and asserts that changing the value on dashboard-a does
not change the value on dashboard-b.

* adjust migration to pass linter rules

* remove the extra rollback on migration

* Update src/metabase/models/user_parameter_value.clj

Co-authored-by: bryan <bryan.maass@gmail.com>

* Update src/metabase/models/user_parameter_value.clj

Co-authored-by: bryan <bryan.maass@gmail.com>

* adjust parameters in test so we don't get logged warnings

* put update!/insert! in a transaction to avoid any race conditions

---------

Co-authored-by: bryan <bryan.maass@gmail.com>
2024-07-03 22:06:29 +00:00
Cam Saul
42b167b8b9 Support compiling SQL with inlined parameters directly (#45008)
* Support compiling SQL with inlined parameters directly

* Test fix

* Make `format-honeysql` a multimethod

* Add test for #32543

* Test also fixes #44915

* Add explicit test for #44915

* Better test for #44915

* More test fixes 🔧

* Fix Kondo error
2024-07-03 14:37:10 -07:00
bryan
6533335c5c Adds plan alias info + exposes it in troubleshooting (#45051) 2024-07-03 15:46:01 -04:00
github-automation-metabase
957b755e70 Update Readme version references and published npm version to 0.1.16 (#45106) 2024-07-03 15:48:21 +00:00
Kamil Mielnik
daafe4a976 Optimize: compute chart title href only on mouseenter and focus (#45095)
* Optimize: compute chart title href only on mouseenter and focus

* Improve comment

* Improve comment

* Format code

* Update existing tests

* Extract helpers

* Update unit tests

* Make getHref argument-less
2024-07-03 15:17:19 +00:00
Jeff Bruemmer
1bc6b7490e add note about permissions update (#45101) 2024-07-03 10:53:53 -04:00
Aleksandr Lesnenko
22bf4ccbfc fix night theme png downloads (#44941)
* include dark background to PNG exports when night theme is enabled

* fix css

* override border for png downloads
2024-07-03 14:31:19 +00:00
Ngoc Khuat
6e472b381b Auto request review workflow (#44332) 2024-07-03 21:13:18 +07:00
Noah Moss
f26eee4ee4 Only check create-queries perms when fetching DB/schema metadata (#45045) 2024-07-03 09:32:30 -04:00
Braden Shepherdson
fa20f4c60a [MBQL lib] Allow a space in datetime literal strings (#45060)
`Lib.diagnoseExpression` is stricter about this than the QP or FE
expression parser, making it reject expressions that tried to compare
datetimes to strings like `2024-07-02 14:34:17Z`.

Those used to work in 49.x, but a new `Lib.diagnoseExpression` call
while editing expressions caused it to regress.

Fixes #44916.
2024-07-03 09:02:09 -04:00
Braden Shepherdson
870e85305b [perf] Add caching on dashboard_load_id; reusable MetadataProviders (#45050)
**MetadataProvider cache**

The reusable MetadataProviders is a generally useful thing - within some
dynamic scope like an API request, a `clojure.core.cache` instance can
be provided as `lib.metadata.jvm/*metadata-provider-cache*`, and that
will be used to cache the provider for each `database-id`.

Reusing those providers can significantly reduce appdb traffic,
re-fetching the same metadata in different `MetadataProvider`
instances.

**Dashboard loads**

The FE can supply `?dashboard_load_id=uuid_string` on requests for a
dashboard load:

- `/api/dashboard/:id`
- `/api/dashboard/:id/query_metadata`
- `/api/dashboard/:id/dashcard/:dashcard_id/card/:card_id/query`

That provides a good cache key across that burst of N+2 API requests
that are part of a single load. Currently it is used for two things:

- Caching `get-dashboard` (used by the first two requests)
- Selecting the `clojure.core.cache` for `*metadata-provider-cache*`

Both use a TTL of 10 seconds, which is generally enough for the first
screenful of a dashboard load, if not the whole thing. (Browsers will
only issue a handful of requests at once, so a few long-running queries
might delay later parts of the dashboard from loading until after the
TTL expires.)
2024-07-03 09:00:16 -04:00
Chris Truter
0d2b4b063b Support duplicate prefixes in long column names for CSV uploads (#44885) 2024-07-03 12:53:58 +00:00
Oisin Coveney
1175cafb63 fix(sdk): modify Custom column widget in notebook to conform to some styles (#45044) 2024-07-03 15:13:38 +03:00
Kamil Mielnik
f6197cc993 Fix - Ellipsis tooltip cut off/not visible in GUI editor (#45030)
* Fix #39771

* Add repro for #39771

* Add explanatory comment

* Fix z-index

* Use Mantine Tooltip in Ellipsified to fix z-index issues

* Revert "Fix z-index"

This reverts commit 951e3dca86.

* Revert "Fix #39771"

This reverts commit 4165da5022.

* Update repro to new tooltip

* Update assertions
2024-07-03 18:41:43 +07:00
Kamil Mielnik
0539f89448 Add repro for extra case related to metabase#42385 (#45083) 2024-07-03 18:22:30 +07:00
Romeo Van Snick
d044534746 Add reproduction for #44974 (#44978) 2024-07-03 13:16:21 +02:00
Oisin Coveney
63167c7408 fix(sdk): Improve filter/summarize/notebook layouts (#45039) 2024-07-03 12:49:01 +03:00
Kamil Mielnik
ce319ae888 Add repro for #43216 (#44972) 2024-07-03 13:51:22 +07:00
Cam Saul
3f769c77d5 Test for #40775 (#45072) 2024-07-02 22:19:45 +00:00
Denis Berezin
ab1930dd9d Remove excess deprecation logs in production build (#45069) 2024-07-02 21:42:44 +00:00
Cam Saul
bc4e3854d4 Misc unrelated code cleanup from #45000, split into a different PR. (#45001) 2024-07-02 14:34:34 -07:00
Uladzimir Havenchyk
c82be6a7fe Add e2e tests for basic field remapping logic (#45055)
* Add e2e tests for basic field remapping logic

* await for PUT
2024-07-02 21:17:55 +00:00
Cam Saul
4ebe04efb7 Debug QP 2.0 (#39804)
* Debug QP 2.0

* Update for the ensure-legacy and ensure-pmbql wrappers
2024-07-02 21:12:07 +00:00
Nemanja Glumac
c932732f2f Fix #35954: SQL-converted question with field filter breaks filtered dashboard if reverted back to its editor version (#44987)
* Make sure the query is native

* Convert the comment to JSDoc

* Add E2E reproduction

* Fix mapping

* Add test scenarios for the public sharing and embedding

* Simplify API payload

* Extract and significantly expand the reproduction scope


---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-07-02 22:36:04 +02:00
Jeff Bruemmer
1e35115cdd docs - oracle note (#44543)
* clarify driver vs database reqs

* note
2024-07-02 10:19:33 -07:00
Sloan Sparger
6193a2316b Performance: partial data-permissions graph refactor (#44795)
* only send permissions updates for groups that have been modified in the graph

* Support partial permission graph updates on the BE (#44797)

* handles keeping track of advanced permissions changes to send relevant group data when updating the graph, merges response

* tests and optimizations

* respect group-ids set when fetching connection impersonations, sandboxes, and admin group perms

* fix typo

* add e2e test

* fix BE test

* impls pr feedback, reduces code needed since advanced permissions state is always reset on save

* last fixes

---------

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
2024-07-02 12:13:02 -05:00
Sloan Sparger
9730dca6b7 fixes typo in trash spec (#44986) 2024-07-02 12:08:28 -05:00
John Swanson
39a63ad6c3 prevent collections with special types / non-null namespaces from appearing in recents (#44763)
* recent views sometimes don't show special colls

colls with a non-null namespace are special: they can't interact with
normal collections, dashboards, cards, etc at all. (Currently the only
use for these we have is snippets.) At some point we could add a
`namespace` argument to this endpoint to support looking at recent
collections in a different namespace, but that'd be a bigger refactor
without a whole lot to gain. For now we can just exclude these
completely, which is what we want for current usages of the recents
endpoint anyway.

We won't exclude non-null types across the board, because sometimes
we'll want to see these. But we will be particular about when to display
them.

We'll never display the `trash` collection, but will display the
instance analytics collection when we're not trying to make selections.

* Hack an e2e test around an existing bug

So, the entity picker that pops up when you're selecting a collection to
put a Snippet into shows you "Recent" collections - which previously
included snippet collections.

We should either make the Recents API support a namespace parameter for
collections so it could actually support this case, or the entity picker
shouldn't show a recents tab here (realistically, how many collections
are people going to have for snippets that they would need this tab
anyway).
2024-07-02 10:37:17 -06:00
Cam Saul
ee59ece958 Calculate metadata without running queries [JDBC] (#43430)
* Calculate metadata without running queries [JDBC]

* Appease Kondo

* Test fixes 🔧

* Overhauled Card metadata calculation code

* Test fixes 🔧

* Kondo fix 🔧

* Ok maybe I fixed stuff

* Work around https://github.com/aws/amazon-redshift-jdbc-driver/issues/118

* Maybe fixx the Cypress tests

* Experimental possible e2e test fix 🔧

* Test fixes 🔧

* Do things a little differently.

* Try re-enabling the field refs
2024-07-02 09:12:30 -07:00
Alex Yarosh
00ac183e82 docs: warnings about question marks (#44920)
* question marks

* remove all question mark notes except about json
2024-07-02 11:26:05 -04:00
Kamil Mielnik
06c0218c1b Fix - Invalid join clause does not disappear after changing query source to use a different database (#45025)
* Reset JoinDraft state on database change (fixes metabase#42385)

* Add repro for #42385

* Use admin user
2024-07-02 21:03:12 +07:00
Alexander Polyankin
e048976f2e Repro parameter field matching issues for questions based on sql models (#44942) 2024-07-02 09:45:35 -04:00
Ryan Laurie
75bd6557ec Hide docs issues in release notes (#45037) 2024-07-02 07:26:09 -06:00
Jeff Bruemmer
67f0ea1662 add 50.9 to list of releases (#45033) 2024-07-02 06:46:31 -06:00
Ryan Laurie
1c1d58ee56 Remove incorrect default parameter from release note generation code (#45031) 2024-07-02 05:56:09 -06:00
Phoomparin Mano
213b6d2c81 fix(sdk): runtime error when font family is not provided (#44989)
* add default font family

* use metabase provider internal component for tests
2024-07-02 15:29:54 +07:00
Kamil Mielnik
20674a669f Repro #34350 - Unable to switch question to query table in another database (#44969)
* Add repro for #34350

* Reduce diff
2024-07-02 07:47:22 +00:00
Ryan Laurie
2bf642319d Allow ad-hoc release-notes generation (#44980)
* make ad-hoc changelog generation actually useful

* add github action

* remove test code

* fix whitespace

* fix formatting
2024-07-02 01:22:41 -06:00
Ryan Laurie
04855ca92d fix missing release dependency (#45011) 2024-07-02 07:15:28 +00:00
Uladzimir Havenchyk
11f03823ca Add a repro for 'Permission error before finishing referencing a question in the native query' (#44995) 2024-07-02 13:54:59 +07:00
Ryan Laurie
d549cd6414 Create new release note sections (#44967)
* Create new release note sections

* add explanatory text
2024-07-02 00:29:05 -06:00
Alexander Solovyov
282fb413a5 cached metadata provider: lower the log level for metadata retrieval so DEBUG is less busy (#44977) 2024-07-02 09:07:49 +03:00
bryan
4b58eb986e Return info about the proper billing status on the license page (#44855)
* return data about the proper billing status

* fix copy

* fix the tests
2024-07-01 22:57:32 +00:00
Cal Herries
95817d084e Better display names for CSV upload tables (#44862) 2024-07-01 14:05:33 -06:00
Aleksandr Lesnenko
270e37f115 support sorting on funnel bar charts (#44943)
* support sorting on funnel bar charts

* fix funnel bar row display setting

* spec
2024-07-01 18:57:39 +00:00
bryan
9003927973 Adds a property to a defsetting (#44990)
* mark a defsetting as being :sensitive?

* add test
2024-07-01 18:18:11 +00:00
Denis Berezin
8786c23a50 feat(sdk): Improve dashboard and question loaders to show in the middle (#44710)
* Fix SDK components loaders

* Review fixes
2024-07-01 15:10:59 +00:00
Romeo Van Snick
9256999d77 Add reproduction for "Accurate Error Messaging for Cross DB Joins in Notebook Editor" (#44975)
* Add reproduction for #38989

* Use saveQuestion instead of clicking trough the UI

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

* Use openOrdersTable instead of manually clicking through the ui

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

* Create question programmatically in test

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-07-01 15:01:38 +00:00
Cal Herries
8c0d9ab1d0 Memoize driver.u/supports? only in prod (#44938) 2024-07-01 08:21:13 -06:00
Alexander Polyankin
e45f93fa2c Support specific date filters with 00:00 time (#44859) 2024-07-01 09:50:58 -04:00
Kamil Mielnik
781c9484e4 Repro #28106 - Scrolling up on schema list jumps to the top when creating a new question (#44965)
* Add a test table with many schemas

* Add a repro for #28106

* Format code

* Add issue tag
2024-07-01 12:27:47 +00:00
Kamil Mielnik
2c8bf0f8aa Repro #27521 - Query fails when selecting two fields from nested query, when fields are identical except for their join-alias (#44909)
* Add repro for #27521

* Improve assertions

* Add comments

* Use saveQuestion helper

* Use openOrdersTable helper
2024-07-01 12:16:04 +00:00
Oisin Coveney
7fafc1aa7b feat(sdk): Add customizable layout to interactive question (#44775) 2024-07-01 13:52:18 +03:00
Romeo Van Snick
44427fb61d Add a reproduction for "Cannot find the new column in pick columns after alter schema and synced" (#44882)
* Add a reproduction for metabase#41765

* Navigate manually to the admin page
2024-07-01 10:37:47 +02:00
Ryan Laurie
dd2d231190 Milestone tracing logic update (#44956) 2024-07-01 02:36:18 -06:00
Ngoc Khuat
a73a1d3861 [dev tool] Generate sql statement for a migration (#44872) 2024-07-01 07:40:47 +00:00
Nicolò Pretto
983814bae5 replace html2cavas with html2canvas-pro to support color css functions (#44888) 2024-07-01 09:23:05 +02:00
Ngoc Khuat
cd40cc7215 Fix unable to rollback due to dropped not null constraint on 50 (#44886) 2024-07-01 13:47:59 +07:00
Alexander Solovyov
ce550ca1f5 fix: one of transactions was removed and that causes problems on downgrade (#44908) 2024-07-01 09:28:43 +03:00
adam-james
9757569743 Wrap non-latin characters in a span specifying working font (#44580)
* Wrap non-latin characters in a span specifying working font

Fixes: #38753

CSSBox seems to have a bug where font fallback doesn't work properly. This is noticeable when a font does not contain
glyphs that are present in the string being rendered. For example, Lato does not have many international characters,
so the rendered version of tables (that show up in Slack messages) will not render properly, making the card
unreadable.

Since this appears to be a downstream bug, I've opted to work around this limitation by wrapping any non-latin
characters in a <span> that specifies the font family to be sans-serif, which should contain the glyphs to properly
render.

This leaves Lato in place for other characters.

For now, I figured it's worth trying this solution over using Noto for 2 reasons:
- we can keep Lato, which has been the decided font style for the app for some time (this keeps things consistent
where possible)
- the Noto font containing all glyphs is quite a large font (>20mb, I think) and it would be nice to avoid bundling
that if we can.

* stub installed fonts test

* typo

* Do wrapping, but now per-string, and in Clojure data not html string

I've decided that a reasonable solution is to still wrap strings containing non-lato characters. But it's not done
with str/replace to the html string but rather in a postwalk over the Hiccup data prior to rendering.

Seems like a decent compromise of issues without patching CSSBox or fixing upstream (may be good to do, but will take
longer to get a fix in).

* add test checking that glyphs render correctly

* Add a test that directly checks the wrapping fn

* Change the string to keep the linter quiet

* Change how we check if string can be rendered to faster method, new Lato Font

With Sanya's help, the way I check if a given string is renderable with Lato is now faster.

Also use the full Lato font, not just the 'latin' lato so we can cover more chars

* change lato so that it loads the fn even in a fresh test run
2024-06-28 19:34:06 -07:00
Aleksandr Lesnenko
6f91db0ea8 improve cartesian charts performance (#44861)
* improve cartesian charts performance

* drop unused import
2024-06-28 23:21:05 +00:00
Uladzimir Havenchyk
53f58806b3 Add a repro for 'Filter values in dropdown are not getting populated in SQL question based dashboard' (#44927) 2024-06-29 00:11:53 +03:00
Jesse Devaney
43ed85df83 Fix pin maps unnecessarily filtering out null values (#44853)
* prevent pin maps from filtering out rows with null values

- since pin maps are just displaying where the data is by latitude and longitude, we do not need to filter the pin just because one of the rows is null.
- the metric column selection does not make sense for pins as they just represent that data through coordinates (no aggregations or values displayed), so we should not be filtering out any data just because it is null

* add unit test
2024-06-28 20:38:16 +00:00
Alex Yarosh
6d8f077974 docs: add 50.8 (#44925) 2024-06-28 20:22:28 +00:00
Jeff Bruemmer
fb5990945a ClickHouse note (#44929) 2024-06-28 16:21:31 -04:00
Chris Truter
23ef0e2055 Be explicit about truncating characters versus bytes (#44876) 2024-06-28 18:57:28 +02:00
github-automation-metabase
074c78de53 Update Readme version references and published npm version to 0.1.15 (#44918) 2024-06-28 16:21:53 +00:00
Oisin Coveney
92c1961544 fix(sdk): Fix SDK types, split files, and improve navigation within SDK InteractiveQuestion (#44898) 2024-06-28 18:55:28 +03:00
Chris Truter
59f98b0668 Rather support old files, than duplicate columns (#44873)
* Rather support old files, than duplicate columns

* Cope with driver specific failure modes

* Restore bytes comment
2024-06-28 17:36:28 +02:00
Denis Berezin
d480a4d302 fix(sdk): Upgrade outdated dependencies to remove installation warnings (#44774)
* Upgrade visx packages

* Fixup some dependencies

* Fix textarea styles

* Fix charts diff
2024-06-28 17:42:10 +03:00
Alexander Polyankin
d796bb6439 Fix changing viz type for nodata users (#44693) 2024-06-28 08:49:56 -04:00
Alexander Polyankin
de24931065 Add repro for Dashboard click through behavior to a question does not pass time filters correctly (#44833) 2024-06-28 08:49:43 -04:00
Alexander Polyankin
e199281b3f Add repro for API allows count(field) which kills the metrics page (#44836) 2024-06-28 08:49:27 -04:00
Alexander Polyankin
f0e633610b Add repro for "Join UI picks the first schema even if a different one is selected" (#44837) 2024-06-28 08:49:05 -04:00
Kamil Mielnik
8651009e97 Repro #33427 - Question editor does not work if model joins the same table more than once (#44884)
* Add repro for #33427

* Update e2e/test/scenarios/models/reproductions.cy.spec.ts

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-06-28 10:42:56 +00:00
Mahatthana (Kelvin) Nomsawadi
da0c9cb645 Patch storybook to fix failed loki tests with runtime error (#44875) 2024-06-28 09:21:38 +01:00
Nemanja Glumac
5088602802 Repro #34955: Custom column of type datetime with dashboard filter (#44838)
* Add repro for #34955

* Add a comment
2024-06-28 08:10:56 +00:00
Kamil Mielnik
90ef5e8e4c Repro #40635 - Metabase model does not display information correctly (#44824)
* Add repro for #40635

* Comment out failing assertions

* Skip repro

* Improve test name
2024-06-28 15:08:40 +07:00
Oisin Coveney
d0274f7ba9 feat(sdk): Add filter, summarize, and notebook functionality to InteractiveQuestion (#44494) 2024-06-28 10:47:11 +03:00
Uladzimir Havenchyk
6167b36a28 Add a repro for 'Page hangs when one of parameters contains {{x}} value' (#44852) 2024-06-28 03:54:00 +00:00
dpsutton
9fb1bd7dd5 Ensure we close the canceled chan in query processor after query (#44860)
Customer complaints that thread growth was unbounded. Investigated and
found bigquery involved and isolated to the cancel thread bits. Gist is
this:

```clojure
      (when cancel-chan
        (future                       ; this needs to run in a separate thread, because the <!! operation blocks forever
          (when (a/<!! cancel-chan)
            (log/debug "Received a message on the cancel channel; attempting to stop the BigQuery query execution")
            (reset! cancel-requested? true) ; signal the page iteration fn to stop
            (if-not (or (future-cancelled? res-fut) (future-done? res-fut))
              ;; somehow, even the FIRST page hasn't come back yet (i.e. the .query call above), so cancel the future to
              ;; interrupt the thread waiting on that response to come back
              ;; unfortunately, with this particular overload of .query, we have no access to (nor the ability to control)
              ;; the jobId, so we have no way to use the BigQuery client to cancel any job that might be running
              (future-cancel res-fut)
              (when (future-done? res-fut) ; canceled received after it was finished; may as well return it
                @res-fut)))))
```

The important parts is that we closeover the cancel-chan and start a
thread that is trying to pull from it. If we never put anything on that
channel or never close that channel this thread will just remain blocked
waiting.

In a thread dump, that looks like the following:
(note, I've made it set the thread names to make it easy to follow run a
query 30 times)

```
Full thread dump OpenJDK 64-Bit Server VM (21.0.2+13-LTS mixed mode):
...

"bigquery-cancel-thread" #73 [95747] prio=5 os_prio=31 cpu=2.76ms elapsed=208.53s tid=0x000000029e00f600 nid=95747 waiting on condition  [0x00000002c1266000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #108 [93211] prio=5 os_prio=31 cpu=154.60ms elapsed=128.72s tid=0x000000029f0dc200 nid=93211 waiting on condition  [0x000000029fa06000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #116 [116527] prio=5 os_prio=31 cpu=0.16ms elapsed=61.14s tid=0x00000002c1917c00 nid=116527 waiting on condition  [0x000000029fc12000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #118 [98315] prio=5 os_prio=31 cpu=161.69ms elapsed=60.27s tid=0x00000002b91cca00 nid=98315 waiting on condition  [0x000000029fe1e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #119 [121607] prio=5 os_prio=31 cpu=0.13ms elapsed=59.35s tid=0x00000002b9236400 nid=121607 waiting on condition  [0x00000002a002a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #120 [99079] prio=5 os_prio=31 cpu=0.13ms elapsed=58.55s tid=0x000000029e295600 nid=99079 waiting on condition  [0x00000002a0506000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #121 [122375] prio=5 os_prio=31 cpu=0.10ms elapsed=57.75s tid=0x00000002b921f400 nid=122375 waiting on condition  [0x00000002c0e4e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #122 [123655] prio=5 os_prio=31 cpu=0.18ms elapsed=56.97s tid=0x0000000134bfa000 nid=123655 waiting on condition  [0x00000002c105a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #123 [122631] prio=5 os_prio=31 cpu=0.11ms elapsed=56.28s tid=0x000000013569be00 nid=122631 waiting on condition  [0x00000002c1472000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #124 [96007] prio=5 os_prio=31 cpu=0.10ms elapsed=55.42s tid=0x0000000133b54e00 nid=96007 waiting on condition  [0x00000002c167e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #125 [97799] prio=5 os_prio=31 cpu=0.09ms elapsed=54.73s tid=0x0000000131c19a00 nid=97799 waiting on condition  [0x00000002c2206000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #126 [96519] prio=5 os_prio=31 cpu=0.10ms elapsed=53.97s tid=0x000000012370f600 nid=96519 waiting on condition  [0x00000002c2412000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #127 [124167] prio=5 os_prio=31 cpu=0.10ms elapsed=53.33s tid=0x0000000134312200 nid=124167 waiting on condition  [0x00000002c28ea000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #128 [97287] prio=5 os_prio=31 cpu=0.12ms elapsed=52.57s tid=0x00000001233ae000 nid=97287 waiting on condition  [0x00000002c4706000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #129 [104715] prio=5 os_prio=31 cpu=0.10ms elapsed=51.83s tid=0x0000000131e47a00 nid=104715 waiting on condition  [0x00000002c4912000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #130 [102919] prio=5 os_prio=31 cpu=0.08ms elapsed=51.10s tid=0x0000000123540200 nid=102919 waiting on condition  [0x00000002c4b1e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #131 [117263] prio=5 os_prio=31 cpu=0.17ms elapsed=50.37s tid=0x00000001233d1200 nid=117263 waiting on condition  [0x00000002c4d2a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #132 [114951] prio=5 os_prio=31 cpu=0.09ms elapsed=49.71s tid=0x000000013484dc00 nid=114951 waiting on condition  [0x00000002c4f36000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #133 [103687] prio=5 os_prio=31 cpu=0.14ms elapsed=49.08s tid=0x0000000123517200 nid=103687 waiting on condition  [0x00000002c5142000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #134 [91419] prio=5 os_prio=31 cpu=0.08ms elapsed=48.38s tid=0x0000000131b43600 nid=91419 waiting on condition  [0x00000002c534e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #135 [127495] prio=5 os_prio=31 cpu=0.14ms elapsed=47.66s tid=0x0000000131ce7000 nid=127495 waiting on condition  [0x00000002c555a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #139 [103955] daemon prio=5 os_prio=31 cpu=0.12ms elapsed=23.22s tid=0x0000000121aaca00 nid=103955 waiting on condition  [0x00000002c5766000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #140 [105219] daemon prio=5 os_prio=31 cpu=0.10ms elapsed=22.54s tid=0x0000000133f47600 nid=105219 waiting on condition  [0x00000002c5972000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #141 [105731] daemon prio=5 os_prio=31 cpu=0.15ms elapsed=21.69s tid=0x00000001353ba800 nid=105731 waiting on condition  [0x00000002c5b7e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #142 [114435] daemon prio=5 os_prio=31 cpu=0.08ms elapsed=20.89s tid=0x0000000131e76400 nid=114435 waiting on condition  [0x00000002c5d8a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #143 [106499] daemon prio=5 os_prio=31 cpu=0.10ms elapsed=20.12s tid=0x0000000123107e00 nid=106499 waiting on condition  [0x00000002c5f96000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #144 [113923] daemon prio=5 os_prio=31 cpu=0.11ms elapsed=19.52s tid=0x00000002c1918400 nid=113923 waiting on condition  [0x00000002c61a2000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #145 [107011] daemon prio=5 os_prio=31 cpu=0.13ms elapsed=18.93s tid=0x00000002a6ad3e00 nid=107011 waiting on condition  [0x00000002c63ae000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #146 [113667] daemon prio=5 os_prio=31 cpu=0.12ms elapsed=18.37s tid=0x00000001341a2800 nid=113667 waiting on condition  [0x00000002c65ba000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #147 [113155] daemon prio=5 os_prio=31 cpu=0.16ms elapsed=17.74s tid=0x000000013445da00 nid=113155 waiting on condition  [0x00000002c67c6000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #148 [107779] daemon prio=5 os_prio=31 cpu=0.13ms elapsed=17.19s tid=0x0000000134704e00 nid=107779 waiting on condition  [0x00000002c69d2000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #149 [112643] daemon prio=5 os_prio=31 cpu=0.17ms elapsed=16.54s tid=0x000000011f185000 nid=112643 waiting on condition  [0x00000002c6bde000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #150 [108035] daemon prio=5 os_prio=31 cpu=0.24ms elapsed=15.95s tid=0x000000011f1be200 nid=108035 waiting on condition  [0x00000002c6dea000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #151 [108547] daemon prio=5 os_prio=31 cpu=0.11ms elapsed=15.38s tid=0x00000001302cf800 nid=108547 waiting on condition  [0x00000002c6ff6000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #152 [109059] daemon prio=5 os_prio=31 cpu=0.24ms elapsed=14.85s tid=0x0000000133c4be00 nid=109059 waiting on condition  [0x00000002c7202000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #153 [109315] daemon prio=5 os_prio=31 cpu=0.10ms elapsed=14.15s tid=0x00000001339dc000 nid=109315 waiting on condition  [0x00000002c740e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #154 [109571] daemon prio=5 os_prio=31 cpu=0.17ms elapsed=13.57s tid=0x0000000134ea3600 nid=109571 waiting on condition  [0x00000002c761a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #155 [110083] daemon prio=5 os_prio=31 cpu=0.20ms elapsed=12.95s tid=0x0000000121d7aa00 nid=110083 waiting on condition  [0x00000002c7826000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #156 [110339] daemon prio=5 os_prio=31 cpu=0.12ms elapsed=12.35s tid=0x0000000134ff5c00 nid=110339 waiting on condition  [0x00000002c7a32000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #157 [110595] daemon prio=5 os_prio=31 cpu=0.09ms elapsed=11.65s tid=0x0000000133e27000 nid=110595 waiting on condition  [0x00000002c7c3e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #158 [111107] daemon prio=5 os_prio=31 cpu=0.13ms elapsed=11.04s tid=0x0000000131e8b800 nid=111107 waiting on condition  [0x00000002c7e4a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #159 [174339] daemon prio=5 os_prio=31 cpu=0.13ms elapsed=10.51s tid=0x0000000134ff6400 nid=174339 waiting on condition  [0x00000002c8056000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #160 [173827] daemon prio=5 os_prio=31 cpu=0.12ms elapsed=9.79s tid=0x0000000133ff7c00 nid=173827 waiting on condition  [0x00000002c8262000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #161 [173315] daemon prio=5 os_prio=31 cpu=0.11ms elapsed=9.18s tid=0x0000000122c9b600 nid=173315 waiting on condition  [0x00000002c846e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #162 [131331] daemon prio=5 os_prio=31 cpu=0.12ms elapsed=8.58s tid=0x0000000133b9c400 nid=131331 waiting on condition  [0x00000002c867a000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #163 [172547] daemon prio=5 os_prio=31 cpu=0.14ms elapsed=8.06s tid=0x0000000134d4cc00 nid=172547 waiting on condition  [0x00000002c8886000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #164 [131587] daemon prio=5 os_prio=31 cpu=0.15ms elapsed=7.35s tid=0x000000029e17f800 nid=131587 waiting on condition  [0x00000002c8a92000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #165 [131843] daemon prio=5 os_prio=31 cpu=0.16ms elapsed=6.71s tid=0x00000002b9513a00 nid=131843 waiting on condition  [0x00000002c8c9e000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #166 [132355] daemon prio=5 os_prio=31 cpu=0.10ms elapsed=6.12s tid=0x0000000122dede00 nid=132355 waiting on condition  [0x00000002c8eaa000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)
--
"bigquery-cancel-thread" #167 [132867] daemon prio=5 os_prio=31 cpu=0.11ms elapsed=5.54s tid=0x00000001233b1000 nid=132867 waiting on condition  [0x00000002c90b6000]
   java.lang.Thread.State: WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@21.0.2/Native Method)

```

Simple repro:

```clojure
bigquery-profile=> (require '[clojure.core.async :as a])
nil
bigquery-profile=> (let [c (a/chan)
                         t (Thread. (fn []
                                      (when (a/<!! c)
                                        (println "got something")))
                                    "Forever-running")]
                     (.start t)
                     (a/close! c)
                     (Thread/sleep 4000)
                     (let [thread-names (into #{} (map ^[] Thread/.getName) (.keySet (Thread/getAllStackTraces)))]
                       (contains? thread-names "Forever-running")))
false
bigquery-profile=> (let [c (a/chan)
                         t (Thread. (fn []
                                      (when (a/<!! c)
                                        (println "got something")))
                                    "Forever-running")]
                     (.start t)
                     #_(a/close! c) ;; if we don't close it will never stop running
                     (Thread/sleep 4000)
                     (let [thread-names (into #{} (map ^[] Thread/.getName) (.keySet (Thread/getAllStackTraces)))]
                       (contains? thread-names "Forever-running")))
true
```

So this PR just adds a transducer around the rf that closes the
`cancel-chan` if it's open. Note that multiple closes are fine: from the
docstring: "Closing a closed channel is a no-op".
2024-06-28 03:19:30 +00:00
John Swanson
02f9341353 Error on import into an empty appdb (#44840)
I was thinking about the potential options here.

On one hand, we could initialize the app db ourselves. This is a little
problematic, because:

- our `init!` function is in `metabase.core` and calling it yields a
painful cyclical dependency. It's also pretty tied to outputting things
to the user that they might not expect during an import, e.g. "Looks
like this is a new installation ... preparing setup wizard", and starts
up jobs, etc.

- if we choose to *only* initialize the database ourselves (only the
bits that we actually *need* initialized), I'm a little nervous about
maybe missing something. Right now we need to create the internal user
and create users from the config file before running the import. If we
added a third thing, would we remember to update this?

- we could refactor to put all of the above in one spot, but this is a
P1 and it feels important to close this out as quickly as possible. We
also don't claim to support initializing the app DB from an import in
the first place.

So: just throw an exception if the app db hasn't been set up yet. Our
heuristic here is whether a single non-internal user has been created.
So if you want to use your config, you can run:

```
MB_CONFIG_FILE_PATH=dev/config.yml java -jar metabase.jar
java -jar metabase.jar import /my/exported/dump
```

If you try to run `java -jar metabase.jar import ...` on a fresh
DB, it'll now fail with the error message:

```
You cannot `import` into an empty database. Please set up Metabase
normally, then retry.
```
2024-06-27 12:56:19 -07:00
Sloan Sparger
678c0b5410 Highlight Trash collection in sidebar when viewing root trash collection or a trashed item (#44258)
* highlights the trash link in the sidebar when viewing root trash collection or a trashed item

* impls pr feedback

* impls more pr feedback

* fixes unit tests and logical mistake that allowed urls with invalid collection ids to match on undefined trash id due to it not being loaded yet
2024-06-27 13:41:39 -05:00
bryan
0d4790d99a Single Log Out saml-slo-enabled defsetting (#44794)
* stop using strings for enum values (prefer kw)

* only do SLO when saml-slo-enabled is true

* make defsetting docstring formatting consistent

* log-direction is a string

* add test for enabling / disabling saml slo

- also return a 403 when the client tries, but it's disabled
2024-06-27 18:21:16 +00:00
Alex Yarosh
83c54806d3 docs: clarify migrate down instructions (#44843)
* docs: clarify migrate down for docker

* add jar instructions

* wording
2024-06-27 14:13:05 -04:00
Nemanja Glumac
f3a9d26202 Unskip repro for #14957: Saving a question before query has been executed can be slow with UI "hanging" (#44825) 2024-06-27 18:56:04 +02:00
lbrdnk
88a31b4121 Fix order by field refs (#44740)
* Fix order by field refs

* Update test to handle all drivers

* Untangle fix-order-by-field-refs
2024-06-27 17:34:26 +02:00
lbrdnk
a4158f13fe [Mongo] Convert bson Decimal128 negative zero to BigInteger zero (#44611)
* Convert bson Decimal128 negative zero to BigInteger zero
2024-06-27 17:33:38 +02:00
Nicolò Pretto
692841e082 remove dashboardcontrols from normal dashboard (#44688)
* let's see how many things break

* add missing useSyncURLSlug

* remove cardTitled prop that's not needed

* remove DashboardControls

* remove @ts-expect-error for dashboardId

* move props destructuring at the top

* remove use-dashboard-nav.ts as it's not needed anymore

* remove import of use-dashboard-nav from dashboard/hooks/index.ts

* remove unused props from dashboard
2024-06-27 17:22:16 +02:00
Uladzimir Havenchyk
b3be46e69c Parse not a number passed to id filter (#44826) 2024-06-27 15:20:29 +00:00
Oisin Coveney
11cf86e63c fix(sdk): Convert components in InteractiveQuestion to context-aware components (#44738) 2024-06-27 15:07:55 +00:00
Romeo Van Snick
2d911b9bf6 Reproduction for "When List style field is changed to show remapped foreign key, then cached values are not updated" (#44806)
* Add a reproduction for metabase#15542

* Add comment on force: true usage in sidebar
2024-06-27 16:58:45 +02:00
Oisin Coveney
6e7e51f581 fix(sdk): Move InteractiveQuestionResult variables into provider (#44730) 2024-06-27 14:31:37 +00:00
Nicolò Pretto
fea2aac7ff add e2e test for public dashboard title (#44822)
* refactor: move prepareDashboard to a separate function

* test: page title on public dashboard
2024-06-27 16:27:29 +02:00
Noah Moss
e1e4d983cb Fix n+1 query in sandboxing enforcement (#44793) 2024-06-27 10:20:52 -04:00
Alexander Polyankin
1e030333a2 E2E repro for Metrics fields disapearing when joinning question (#44785) 2024-06-27 12:53:40 +00:00
Alexander Polyankin
437684cd3d Fix numeric parameter parsing (#44792)
* Fix numeric parameter parsing

* Update frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.unit.spec.js

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

* Update frontend/src/metabase-lib/v1/parameters/utils/parameter-parsing.unit.spec.js

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-06-27 12:53:11 +00:00
Alexander Polyankin
a11d4dd705 E2E repro for Adding filter of summarized field grouped by latitude and longitude on a map breaks breadcrumbs (#44787) 2024-06-27 12:52:03 +00:00
Alexander Polyankin
024664890f Coerce the default parameter value when the parameter is no longer multi-select (#44690) 2024-06-27 08:20:36 -04:00
Kamil Mielnik
55fed903ab Repro #41785 - Using Column picker to remove columns on model breaks question with ERROR: column source.name_2 does not exist Position (#44808)
* Add repro for #41785

* Update comment
2024-06-27 19:09:02 +07:00
Anton Kulyk
de786c3188 Fix graph.metrics sync after adding a new query stage (#44697)
* Add repro

* Accept non-aggregation cols in graph metrics sync

* Address feedback
2024-06-27 11:19:56 +01:00
Cal Herries
5260e2a333 Memoize driver.u/supports? (#44719) 2024-06-27 10:17:12 +02:00
Anton Kulyk
e0381e9bc9 Fix FE crash for line/area/bar charts with no data (#44769)
* Add test

* Fix `xDomain` calculation in QB selectors

* Make database `features` optional

* Update reproductions-3.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-06-27 08:26:05 +01:00
Denis Berezin
7091c9eb47 feat(sdk): Improve dashboard to question navigation (#44648)
* Add dashboard question header

* Add dashboard data preserve after question drill

* Review fixes

* Review fixes

* Potential fix for e2e

* Potential fix for e2e

* Add basic unit tests

* Fix Dashboard reloading on unmount, fix ad hoc question title in SDK

* Move dashboard reset to SDK component

* Fix issue with dashboard rerender

* Fix one more reported issue with rerender
2024-06-27 00:23:36 +00:00
Uladzimir Havenchyk
a4a68f426d Add a repro for 'Visible Columns errors when source query is a table joined on itself' (#44737)
* Add a repro for 'Visible Columns errors when source query is a table joined on itself'

* verify warning icon is not rendered
2024-06-26 17:53:55 +00:00
Uladzimir Havenchyk
6667721ac0 Add a repro for 'Cannot change question data source to raw data after selecting saved question' (#44757)
* Add a repro for 'Cannot change question data source to raw data after selecting saved question'

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

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

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

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

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

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-26 19:42:56 +03:00
Jesse Devaney
f84e0d2321 Update default map.type display for breakouts with un-binned coordinates (#44717)
* fix map default display type with un-binned coordinates

- default to `"map.type"` = "pin" when coordinates are not binned
- default to `"map.type"` = "grid" when coordinates are binned

* add tests

* refactor breakouts usage
2024-06-26 16:03:44 +00:00
Alexander Polyankin
c0f10581e6 Allow clicking "Remove all" for the first group in FieldPanel and omit removing the first field in the group (#44645) 2024-06-26 15:54:55 +00:00
Alexander Polyankin
ca72311518 Fix broken field normalization in metadata (#44721)
* Fix broken field normalization in metadata

* Handle Fields.actionTypes.UPDATE action in tables reducer to keep table's original_fields in sync

* Add an e2e test for fields

* Format code

* Use a different table, since accounts table is not available in e2e tests

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-26 11:50:19 -04:00
Jesse Devaney
7ade61330d Fix invalid API request fired on chart legend click (#44579)
* remove invalid else conditional

* fix RowChart firing invalid API request on legend item click

* fix clicking on non-breakout legend on dashboards

* add E2E test to validate and enforce the desired behavior
2024-06-26 11:12:24 -04:00
Alex Yarosh
08be787014 docs: add 50.7 to releases (#44712) 2024-06-26 17:01:13 +02:00
Nemanja Glumac
fea908d474 Unskip the repro for #18770 (Post-aggregation filters) (#44748) 2024-06-26 16:30:05 +02:00
Noah Moss
cfb3de0231 Skip unecessary quartz job deletion migration (#44652) 2024-06-26 10:17:07 -04:00
Alexander Polyankin
03ca0ec174 Add missing tests for temporal unit parameters parsing and fix issues (#44685) 2024-06-26 09:11:38 -04:00
Chris Truter
fb4bbfa6e7 Fix appends for long column names (#44727) 2024-06-26 15:00:24 +02:00
Mahatthana (Kelvin) Nomsawadi
dd7996b756 Remove the workflow until we figured out a better workflow (#44749) 2024-06-26 12:55:13 +01:00
github-automation-metabase
68c2fbf023 Update Readme version references and published npm version to 0.1.14 (#44746) 2024-06-26 11:45:16 +00:00
Arkadi Yaroslavtsev
726589d824 Pass enterprise version to cloud issues (#44701) 2024-06-26 07:43:37 -04:00
Anton Kulyk
a03d3a85d2 Remove description length check from copy question form (#44736) 2024-06-26 12:37:12 +01:00
Chris Truter
48b6f349b7 Opt out of non-reserved SQL keywords (#44609) 2024-06-26 11:36:33 +00:00
Romeo Van Snick
d145a24747 Add reproduction for "Closing Drop-down in Join column selector causes non-drop-down columns to disappear" (#44675)
* Add reproduction for #19894

* Use startNewQuestion
2024-06-26 13:09:01 +02:00
Phoomparin Mano
43a9a796ea docs(sdk): remove vite incompatibility from sdk docs (#44729) 2024-06-26 17:54:34 +07:00
Anton Kulyk
9ce72a44cd Bump dashboard description max length limit to 1.5K (#44470)
* Bump dashboard description max len limit to 1.5K

* Extract `DASHBOARD_DESCRIPTION_MAX_LENGTH` const

* Handle description max length in dashboard sidebar

* Add red border to dashboard description box

* Add test
2024-06-26 11:31:16 +01:00
Uladzimir Havenchyk
5f4c2638f2 Remove repro for #40223 that's not valid anymore (#44682) 2024-06-26 12:08:53 +02:00
Oisin Coveney
e1ffb582f0 Split SummarizeContent from SummarizeSidebar (#44539) 2024-06-26 09:54:04 +00:00
Alexander Solovyov
a91a363a60 enable-query-caching is now default true (#44227) 2024-06-26 12:27:11 +03:00
Alexander Solovyov
c7e2a0078a [cache] surface last run time and make sure "nocache" won't use cache (#44679) 2024-06-26 11:10:19 +03:00
Phoomparin Mano
87914fd870 fix(sdk): upgrade D3.js to the latest version for Vite compatibility (#44562) 2024-06-26 14:06:57 +07:00
Sloan Sparger
6665c0a4f0 Fix trash banner icon color regression (#44304)
* fixes spacing and color issue of trash icon in archive banner

* css var for color

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-06-25 18:59:15 -05:00
Emmad Usmani
45b4b1b247 fix pivot table horizontal scrollbar not appearing (#44514)
* fix pivot horizontal scroll

* fix scroll on dashboard

* add e2e test

* fix unit tests

* fix e2e test
2024-06-25 22:56:17 +00:00
Alexander Polyankin
b6a307d00b E2E test for custom date expression error (#44694) 2024-06-25 17:49:02 -04:00
Alexander Polyankin
7e74dd2279 Add E2E repro for convertTimezone (#44705) 2024-06-25 17:48:54 -04:00
Alexander Polyankin
22baa028fb Add repro for 32804 (#44709) 2024-06-25 17:48:35 -04:00
Alex Yarosh
091f94b160 add 49.18 (#44699) 2024-06-25 20:51:29 +02:00
Cal Herries
52b23ee2f7 Fix testing week-of-year extraction in general-timezone-support-test (#44583) 2024-06-25 12:15:13 -06:00
Aleksandr Lesnenko
3e554323a7 bump echarts (#44695) 2024-06-25 17:14:43 +00:00
Nemanja Glumac
6a68804eb6 Repro #35043: Date range filter - from newer to older date (#44687) 2024-06-25 18:54:09 +02:00
Nicolò Pretto
eaf1e80dec refactor DashboardControls (#44558)
* WIP PublicOrCustomEmbedDashboardPage without using dashboard controls

* add usePublicDashboardEndpoints instead of WithPublicDashboardEndpoints

* fix type error by setting null as default value for hide_parameters and hide_download_button

* use usePublicDashboardEndpoints inside WithPublicDashboardEndpoints

* also migrate embed

* i don't think we need useDashboardNav public/static embed

* SetTitle component to use instead of the `title` hoc

* wrap setEmbedDashboardEndpoints/setPublicDashboardEndpoints in useEffect as per PR comment

* after the fix for metabase#38640 we don't need the public routes in the main app

* renamed test file

* change tests to use PublicOrEmbeddedDashboardPage

* remove PublicOrEmbeddedDashboardControlled and change imports for PublicOrEmbeddedDashboardPage

* remove debug prop left by mistake
2024-06-25 17:02:20 +02:00
Noah Moss
e7e4fd6f87 Fix parsing of MB_JETTY_SKIP_SNI (#44651) 2024-06-25 10:00:23 -04:00
Alexander Polyankin
e5e0c2ccd0 Fix expressions with the same name as their base column (#44641)
* Pass expressionPosition

* Add a test

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

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

* Rename expressionPosition to expressionIndex

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-25 13:25:42 +00:00
Alexander Polyankin
113d95366d Add e2e repro (#44656) 2024-06-25 09:12:22 -04:00
Ngoc Khuat
191d845941 Fix flaky test: update-db-to-never-scan-values-on-demand-test (#44658) 2024-06-25 19:26:30 +07:00
Oisin Coveney
d8a54827ee Split content from FilterModal into FilterContent (#44534) 2024-06-25 15:26:20 +03:00
Romeo Van Snick
3e54ff961e Add reproduction for "Result inconsistencies with Preview in GUI editor #40399" (#44630)
* Add e2e test to verify that step previews only care about the step being previewed

* Use getNotebookStep and find preview button using cy.icon

* Remove empty line

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-06-25 14:21:04 +02:00
Nemanja Glumac
7b706ff9e6 Repro #33330: Cumulative count breaks in certain situations (#44671) 2024-06-25 13:47:36 +02:00
Uladzimir Havenchyk
689f8d7e58 refactor: drop old and unused endpoint (#44629)
* Drop old and not used  endpoint

* fixup! Drop old and not used  endpoint

* fixup! fixup! Drop old and not used  endpoint
2024-06-25 13:41:28 +03:00
Mahatthana (Kelvin) Nomsawadi
1fa5a933c6 refactor(sdk): Make sense of dashboard and embed code (#44636)
* Make the code makes more sense

* Fix type error
2024-06-25 10:25:43 +01:00
Nemanja Glumac
f43a15076d Refactor: Time-series chrome component (#44568)
* Move SimpleSpecificDatePicker to the form

* Extract `isSpecificValue` helper

* Integrate the toggle into `SimpleDateIntervalPicker`

* Make DateOperatorPicker do only one thing

Separation of concerns - lift SimpleRelativeDatePicker up to the form.

* Fix unit tests

* Add back the test for the `SimpleSpecificDatePicker`

* Keep the rendering logic in the `SimpleDatePicker`
2024-06-25 11:17:18 +02:00
Ryan Laurie
3fcc0f6e14 Tag core-release group in pre-release messages (#44663) 2024-06-25 02:11:04 -06:00
Phoomparin Mano
70eea1167b fix(sdk): missing css variables when rendering under a portal (#44473)
* apply css variables injection right under the public component

* refactor css variables

* fix name changes

* apply css variables to global styles

* update path

* render component wrapper as full-width

* move style resets to public component styles wrapper

* update unit tests for global styles
2024-06-25 12:51:52 +07:00
Cal Herries
a57718bd52 Fix querying TIMESTAMP WITH LOCAL TIME ZONE for oracle (#44456) 2024-06-24 20:16:22 -06:00
adam-james
a27c151078 Sanitize SVG before parsing with Batik to prevent render failures when invalid characters are in the SVG content (#44516)
* Add Temporal Units List to Dashboard Parameters Schema

Closes: #44361

This adds an entry to the Dashboard Parameter schema so that we can validate
the list of temporal_units that might be passed from the frontend when adding
or updating the `Unit of Time` type parameters.

* Sanitize the SVG before parsing it with Batik

WIP

Fixes: #43677

There are characters that are invalid according to the Batik XML Parser. This sanitizes the svg string to strip out
some of those characters so that the render can continue.

* Use the xml 1.0 spec allowed unicode chars list for the regex

* Remove accidentally merged code

* still miseed a line
2024-06-24 21:52:09 +00:00
Case Nelson
6317927039 fix: dont always optimize between expressions (#44493)
* fix: dont always optimize between expressions

Fixes #42291

The frontend produces expressions like

```
[:between
 [+ [:field ... {:temporal-bucket :day] [:interval 2 :day]]
 [:relative-datetime -1 :week]
 [:relative-datetime 0 :week]]
```

This should not be optimized because of the mixed `:day` and `:week`
units. However, it was being optimized since the compatible units
weren't being properly picked up by the match.

* Disable suspcicios args eastwood lint, kondo does it better

* Stop autobucket to day when adding a time interval
2024-06-24 14:18:53 -06:00
Case Nelson
8198461c9b perf: disable view log and card used updates during metadata fetches (#44502)
* perf: disable view log and card used updates during metadata fetches

* Disable writes for view_count and last_used_at

* Disable view_count tests

* Disable last-used-at tests

* Disable view_count test

* Fix view count test

* Disable view_count e2e testing
2024-06-24 10:21:34 -06:00
Alexander Polyankin
9b305a03e6 Add a try-catch for MBQL lib diagnoseExpression (#44628) 2024-06-24 16:07:58 +00:00
Alexander Polyankin
1d5d9cb430 Fix the operator list for type/TextLike PKs (#44569)
* Fix the operator list for `type/TextLike` PKs

* Fix the bug with using wrong operators

* Fix the bug with using wrong operators

* Update test/metabase/lib/filter_test.cljc

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>

* Test FKs too

* Update test/metabase/lib/filter_test.cljc

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>

---------

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2024-06-24 16:00:09 +00:00
Nemanja Glumac
172c7cc3af Repro #44550: Missing display name for the filter with an offset (#44624) 2024-06-24 16:53:56 +02:00
Jeff Bruemmer
d3aa47a58d fix link (#44622) 2024-06-24 10:23:04 -04:00
Nemanja Glumac
dc4a553056 Visually improve time-series chrome component (#44554)
* Get rid of the styled component

* Stack date operator on top of actual filter pickers

* Use the existing `CurrentDatePicker`

* Fix unit test

* Conditionally apply padding to the `CurrentDatePicker`

* Remove the custom prop
2024-06-24 14:18:21 +00:00
Denis Berezin
e74f0bbf41 Migrate ViewTitleHeader and its children to TS (#44513)
* part 1

* part 1

* part 2

* part 3

* part 4

* Self review

* Self review

* Fix merge conflicts

* Fix e2e

* review fixes

* review fixes
2024-06-24 17:12:36 +03:00
Uladzimir Havenchyk
f21ad7da0a test: add a test for the edge case in mapping on parameter change (#44610)
* test: add a test for the edge case in mapping on parameter change

* fixup! test: add a test for the edge case in mapping on parameter change
2024-06-24 16:41:59 +03:00
Mahatthana (Kelvin) Nomsawadi
1c2b5cc346 refactor: Create static embed view components (#44555)
* Remove `this` reference from the markup

* Move functions inline

* Introduce a view component making it purer

* Introduce question embed view component

* Address review: Don't lie about types

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

* Address review: Make code consistent

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-06-24 14:30:13 +01:00
Ngoc Khuat
f135ea4f07 Tidy pulse code, remove unused methods (#44603) 2024-06-24 20:27:45 +07:00
Alexander Polyankin
4bda202926 Fix new column shortcuts overwriting viz settings (#44582) 2024-06-24 09:08:32 -04:00
Alexander Polyankin
1f74c4312a Fix setting the join strategy for not yet existing join clauses (#44557) 2024-06-24 09:07:13 -04:00
Alexander Polyankin
8954c23632 Fix setting the temporal bucket of columns in a join condition to "Don't bin" (#44564) 2024-06-24 09:06:33 -04:00
Nemanja Glumac
bf5df6cd2b Increase the Codecov frontend target (#44613)
* Fix the comment

* Update the threshold for the front-end
2024-06-24 14:44:55 +02:00
Alexander Polyankin
b34b9607c4 Fix model metadata editing for SQL models with manually sorted columns (#44574) 2024-06-24 08:37:29 -04:00
Uladzimir Havenchyk
b228f16bb6 refactor: split DashCardCardParameterMapper into smaller components to reduce complexity (#44526)
* Exrtract 'useResetParameterMapping'

* Extract 'DashCardCardParameterMapperButton'

* Extract 'DashCardCardParameterMapperContent'

* cleanup

* Drop if/else

* cleanup
2024-06-24 13:16:42 +03:00
lbrdnk
260f8b0392 Add role to spec even if used in :connection-uri (#44397)
This PR removes `:role` removal from spec, even if it was added in `:connection-uri`.
It seems that `:connection-uri` is ignored on `do-with-connection-options` code path.
Hence use of non-default roles is again available on Snowflake.
2024-06-24 12:12:37 +02:00
lbrdnk
ba42baaf0f Adjust distinct aggregation expansion on Mongo (#44442)
This commit adds `$size` operator wrapping to `$addToSet`. That enables use of `:distinct`
clause in expressions on Mongo.
2024-06-24 12:10:11 +02:00
Ryan Laurie
452382bcca Fix infinite backport PR recursion in milestone setter (#44593)
* fix infinite backport PR recursion

* dedupe issue numbers
2024-06-24 01:57:22 -06:00
Alexander Solovyov
ea69066d83 add a test to check that openapi definitions can be generated (#44586) 2024-06-24 10:40:33 +03:00
Alexander Solovyov
839f1f775c xray should not filter again models with filters (#44547)
This not only does not make sense, but also fails for models with aggregations (and thus not having those fields for filtering available).
2024-06-24 10:13:15 +03:00
Ryan Laurie
2f6e5d7fcd Update Milestone Setter (#44521) 2024-06-23 23:28:46 -06:00
Alexander Solovyov
bdf67dbe3f [openapi] do not die when :query-params is not a map (#44549) 2024-06-22 11:32:26 +02:00
Uladzimir Havenchyk
981d69ab2a refactor: Rework undo to typescript (#44479)
* refactor: Rework undo to typescript

* fixup! refactor: Rework undo to typescript

* fixup! fixup! refactor: Rework undo to typescript

* Convert UndoListing to ts

* fixup! Convert UndoListing to ts

* Update frontend/src/metabase/redux/undo.ts

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

* address review

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-22 07:22:46 +00:00
Jeff Bruemmer
674ac9787c notes on upload perms (#44575) 2024-06-21 17:02:40 -04:00
Denis Berezin
dbcd84484c Add global styles to storybook, fix default fonts display (#44559)
* Add global styles to storybook, fix default fonts display

* Update loki testing screenshots
2024-06-21 22:45:52 +03:00
adam-james
998b28cddb Disable Pivot Export Post Processing Step (#44561)
This PR disables the 'make exports look pivoted' post processing step for csv and xlsx exports.

This is in response to a reported issue that Large Pivot Table downloads are failing entirely: #44556

A more hollistic fix and improvement to the post processing feature will be worked on, so the post processing code is
left untouched in this PR.

The dynamic vars in the csv and xlsx namespaces each default `false` and disable the export from running any post
processing. The var should remain `false` until we've got a plan for these types of exports, and there is no way for
users (either through ENV or UI) to change this, so the feature is effectively disabled.
2024-06-21 18:28:27 +00:00
Jeff Bruemmer
7a83278718 docs - actions and public dashboards (#44551) 2024-06-21 18:16:34 +00:00
Cam Saul
89f12e7c01 Set useLocalSessionState=true for MySQL DW connections [PERFORMANCE BOOST] (#44509)
* Set `useLocalSessionState=true` for MySQL DW connections

* Fix GH issue number

* Test fixes 🔧

* Lint fix 🔧
2024-06-21 10:04:22 -07:00
github-automation-metabase
e2670a1567 Update Readme version references and published npm version to 0.1.13 (#44553) 2024-06-21 16:13:22 +00:00
Nicolò Pretto
ecce383824 convert embed.ts to ts and to use createSlice from rtk (#44496)
* convert embed.ts to use createSlice from rtk

* only store in the state what we care about for interactive embedding

* use DEFAULT_EMBED_OPTIONS keys to filter searchOptions

* removed unused hash parameter

* adds basic unit test
2024-06-21 16:04:21 +00:00
John Swanson
0637fefa67 Fix dev migrate! command (#44545)
There were two problems here:

- wrong args to `mdb/migrate!` (passing the db-type as well as the data
source), and

- in MySQL, the changelog table name is not `:databasechangelog`. Use
`metabase.db.liquibase/changelog-table-name` to get the actual table name.
2024-06-21 14:41:23 +00:00
Mahatthana (Kelvin) Nomsawadi
74b2c11ea5 refactor: Extract refactor code out of feature branch to avoid conflicts (#44540)
* refactor: Simplify code (#44275)

* Remove dead code

* Remove values same as default options

* Simplify hook API: Removing unused argument

* review: Remove redundant code

* Refactor
2024-06-21 15:22:28 +01:00
Anton Kulyk
ce48b30e16 Revert graph settings sync change (#44535)
* Skip repro for 10493

* Add repro for 44532

* Remove `ensureMetricsAndDimensions`
2024-06-21 14:34:05 +01:00
Kamil Mielnik
fa192d940b Fix - Missing schema name in data picker (#44468)
* Show table's schema name when available

* Add a test

* Add a test for empty table schema
2024-06-21 20:19:57 +07:00
Phoomparin Mano
dbaddac9cb add demo video to the sdk readme (#44531) 2024-06-21 20:18:14 +07:00
Oisin Coveney
0b9bfbd21d Split FilterModal components into separate files and folders (#44530) 2024-06-21 12:38:01 +00:00
Oisin Coveney
bd6391cef0 Make notebook props explicit (#44529)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-06-21 12:11:35 +00:00
Oisin Coveney
27fc6ae43e Convert ViewTitleHeaderRightSide and associated components to TS (#44368) 2024-06-21 14:53:30 +03:00
Nicolò Pretto
2c04840477 convert browser.js to typescript (#44524)
* file renamed to .ts

* fixed ts errors in browser.ts
2024-06-21 12:17:45 +02:00
Kamil Mielnik
3565d5e2b8 Update browserslist-db (#44522)
- Run "npx update-browserslist-db@latest"
2024-06-21 08:38:59 +00:00
Ryan Laurie
db3b8979c5 ci: Move cloverage to run nightly (#44365)
* move cloverage to a nightly run

* what a mess
2024-06-21 00:54:21 -06:00
Chris Truter
0e8787805f Track metabase.nqa module dependencies (#44464) 2024-06-21 05:58:51 +02:00
Noah Moss
c966918bda Don't run sandboxing rollback test on mysql (#44515)
* Don't run sandboxing rollback test on mysql

* Update test/metabase/db/schema_migrations_test.clj
2024-06-21 02:03:17 +00:00
Cam Saul
1dceed32b8 Make the App DB transaction isolation level READ_COMMITTED for MySQL [MEGA PERFORMANCE BOOST] (#44505)
* Make the App DB transaction isolation level READ_COMMITTED for MySQL/MariaDB [MEGA PERFORMANCE BOOST]

* Add test
2024-06-21 01:44:34 +00:00
Mateusz Burzyński
514564290f Update @replayio/cypress (#44396) 2024-06-20 23:18:29 +02:00
John Swanson
cb055ac9de Don't sort official collections first in trash (#44322)
Add a new query parameter to `/api/collection/:id/items` and
`/api/collection/root/items`. If `official_collections_first` is passed,
we'll sort official collections first, or not, as requested. If it isn't
passed, we'll default to `false` for the trash collection, or `true` for
normal collections.
2024-06-20 21:17:38 +00:00
Nick Fitzpatrick
7f9e369c34 Fix crash on restoring bookmarked items, update bookmarks on restore (#44414)
* Fix crash on restoring bookmarked items, update bookmarks on restore

* adding bookmark assertions to e2e tests

* removing unintended createDashboard change
2024-06-20 17:55:03 -03:00
Cam Saul
08c841f3ef Oops fix the order we attempt to set DW transaction isolation in (#44501) 2024-06-20 20:41:10 +00:00
Jeff Bruemmer
d0096dc0fa clarify database vs driver (#44503) 2024-06-20 16:16:21 -04:00
Noah Moss
dce9879067 Fix rollback when sandboxing is configured (#44481) 2024-06-20 14:24:26 -04:00
Nemanja Glumac
442cedd5b9 Fix flaky E2E segments test (#44487) 2024-06-20 12:04:51 -06:00
Nicolò Pretto
105a72a008 remove code from useDashboardUrlParams and related files (#44426)
* simplify bordered logic

* 🧹 setTitled

* 🧹 setHideDownloadButton

* 🧹 setHideParameters

* inline useEmbedDisplayOptions

* move DEFAULT_EMBED_DISPLAY_OPTIONS to costants file so we can remove use-embed-display-options.ts

* move consts up in the file

* update deps of useEffect

* fix ts error in the sdk

* use useEmbedFrameOptions in useDashboardUrlParams

* embed frame should not touch the `embed` slice, which is used for interactive embedding
2024-06-20 17:05:35 +02:00
Mahatthana (Kelvin) Nomsawadi
05417a3a6c Add a link to embedding SDK changelog (#44480) 2024-06-20 15:35:48 +01:00
Alexander Polyankin
b3749f8fe5 E2E tests for click behaviors with temporal unit parameters (#44436) 2024-06-20 10:29:28 -04:00
Raphael Krut-Landau
79c8e9bd82 fix(admin): Add e2e tests of the database caching policy form's basic functionality (in Admin / Performance) (#44416)
Closes #44478
2024-06-20 10:14:44 -04:00
Ngoc Khuat
4a03070a9b Fix unable to sync json column with value is an array (#44465) 2024-06-20 14:05:00 +00:00
Raphael Krut-Landau
7e7414e86e fix(cache): Add missing question mark in the 'Clear cache' confirmation modal (#44453) 2024-06-20 07:47:20 -05:00
Phoomparin Mano
dab2d85277 fix(sdk): font size, color and padding in viz (#44283)
* funnel start color should be text-dark

* change pivot table font size unit to em for scaling

* change funnel and legend item unit to em

* change funnel font size to em

* change object detail font size to em

* change gauge font size to em

* add cartesian chart padding config

* update docs

* remove isEmbeddingSdk prop

* simulate the 0.875em base font size

* chart padding override should apply in query builder

* add cartesian padding to stories

* update readme docs

* fix collection browser option in readme docs

* fix pivot table font size scaling

* update loki

* update loki

* use em for smart scalar

* update chart default padding

* revert smart scalar font size scaling due to measurement

* dynamic font family and font size as defaults

* pivot table

* add more properties to sdk docs

* make FONT_SIZES constant local

* link to discussion on query builder extra spacing

* enforce that font is passed to getLeftHeaderWidths
2024-06-20 19:14:09 +07:00
Phoomparin Mano
992b2e899f fix(sdk): load custom font files when font is set to custom (#44432)
* load custom font family

* always return custom font family

* add tests for returning custom font family
2024-06-20 18:26:43 +07:00
github-automation-metabase
488e08a7dd Update Readme version references and published npm version to 0.1.12 (#44466) 2024-06-20 09:56:14 +00:00
Uladzimir Havenchyk
5638d79768 Adjust undo toast timeout 12s -> 8s (#44422)
* Adjust undo toast timeout 12s -> 8s

* typo

* Address review
2024-06-20 11:48:46 +03:00
Alberto Perdomo
0081f202bc Update SDK README.md (#44427)
Remove warnings about not using MB versions in production. This is a left over from the time we were pointing to builds off master and RCs.
2024-06-20 07:33:48 +00:00
Raphael Krut-Landau
e5c14e16ae fix: Use an indicator-agnostic testid (#44265)
* Use an indicator-agnostic testid

* Run sed

* Use correct testid
2024-06-19 20:32:15 -04:00
Case Nelson
523ea2488b fix: populate param-fields for named fields on public dashboards (#44440)
* Update e2e test

* Update e2e test

* fix: populate param-fields for named fields on public dashboards

* Add name to public hydration

* Add tests

* Add tests

* Fix tests

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-06-19 17:26:25 -06:00
Raphael Krut-Landau
08613cb3b6 fix(cache): Fix two bugs in Admin / Performance (#44255)
Ensures that minimum query durations are correctly displayed in the form post-save (#44249) and that all times can be used in the Schedule component  (#44257)
2024-06-19 18:53:03 -04:00
Raphael Krut-Landau
c006657dce feat: Use skeletons to indicate that the main navigation sidebar is loading (#44010) 2024-06-19 18:38:05 -04:00
Cal Herries
3f788bbaf2 Exclude native query matches in search scoring when the search should exclude native queries (#43982)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-06-19 22:06:02 +00:00
adam-james
bbde99dd31 User parameter value json fix (#44420)
* UserParameterValue transforms wrapped to properly escape string vals

The `json-in` and `json-out` functions used for toucan model transforms do not perform any string escaping logic. This
makes sense as we don't want to make assumptions about the shape of data flowing in/out of the db. But, this did mean
that for the User paramter values table, string values were causing an error to be logged. This doesn't break
anything, as the function will still correctly return the string, but it can clutter up logs.

So, this PR wraps all incoming values in a map and unwraps it for outgoing values.

* Add migration to wrap existing user param values with ::wrapper key

Since the in/out transform for UserParameterValues is updated, we need to migrate any existing values to have this wrapping.

* Simplify the solution to the problem.

Since we're already getting what we need from the json-in/json-out *except* that it's logging a parse error, we can
create a json-out that works the same way (tries to parse and returns the string as-is if it fails) without logging an
error at all.

* take away the arg and keywordize inside the json-out fn

* remove irrelevant comment

Signed-off-by: Adam James <adam.vermeer2@gmail.com>

* Add a little more test coverage for different value types

* faster test thanks to Dan!

* Add a comment about the data being tested

---------

Signed-off-by: Adam James <adam.vermeer2@gmail.com>
2024-06-19 21:50:47 +00:00
Alexander Polyankin
80c34c673d Disable parameter mapping to native models (#44372) 2024-06-19 21:21:57 +00:00
adam-james
89bdaa2fa8 XLSX Pivot Table Downloads have 'Native' Pivot Table (#43791)
* XLSX Pivot Table Downloads have 'Native' Pivot Table

Addresses: #2473

The xlsx downloads work fine for regular tables. However, on Pivot Table downloads, the resulting file isn't pivoted
and is formatted somewhat strangely (it contains additional rows related to totals, has an extra 'pivot-grouping'
column).

Now, the downloaded xlsx file contains 2 sheets:
- the data sheet containing the question's rows unpivoted. If you were constructing a pivot table yourself, you would
probably start with this shape of data.
- the pivot sheet containing a 'native' Pivot table whose reference points to the data on the data sheet, and whose
columns, rows, and values align with the cols, rows, and measures set up in Metabase

* Silly typo!

* Exported Pivot uses correct aggregation (sum, count, stddev, avg, min, max)

* data for pivot exports now also uses the formatting

* Add a test asserting that a pivot table exists in the xlsx file

* add-row! is a method dispatching on sheet class

* remove unnecessary hint

* address review feedback:

 - consolidate the aggregation function key fns into one function in the .xlsx namespace
   this was moved out of postprocessing so that the xlsx specific fns don't litter the post processing namespace at
   this time

 - clean up an unnecessary destructiring inside the native-pivot function
 - don't shadow 'name' inside the body of a fn

* Add tests that confirm zero-col and zero-row situations work

* Consolidate the atoms used to store pivot rows/options
2024-06-19 21:14:05 +00:00
Alex Yarosh
301ab32cef docs: Serialization API uses POST (#44439)
* call attention to POST

* wording
2024-06-19 16:24:01 -04:00
Nemanja Glumac
737c24af95 MS2: Expose "Include this {period}" in time-series chrome (#44247)
* Expose "Include this {period}" in timeseries chrome

* Fix type errors

* Simplify type guards

* Add unit tests

* Remove Flex wrapper around Switch

* Extract `IncludeCurrentSwitch` component

* Add E2E smoke tests

* Cover the toggle behavior with E2E tests

* Simplify test with a simple helper
2024-06-19 20:14:47 +00:00
Chris Truter
870dcd6c4a Don't analyse non-SQL cards with Macaw (#44350) 2024-06-19 12:48:15 -06:00
Denis Berezin
fa32093271 feat(sdk): Add interactive dashboards to embedding SDK (#44161)
* Temp

* Add support for saved questions

* Try to fix question not found issue

* Try to fix question not found issue

* Fix unit tests

* Add basic unit test

* Fix unit tests

* Fix unit tests, fix question not found issue

* Review fixes

* Review fixes

* Refactor components structure, review fixes

* Adjust readme
2024-06-19 18:05:19 +00:00
Anton Kulyk
4f53b0b9a9 Fix updating table questions in the notebook editor before running a query (#44428)
* Add repro test

* Fix null check
2024-06-19 18:33:02 +01:00
Braden Shepherdson
3ccf4d411c [QP] Fix breakouts on a nested model (#44418)
Fixes #43993 for real.

The earlier fix #44182 was needlessly restricting the
"nominal refs" check to fields which were using numeric IDs,
when really any match on nominal refs is valid.
2024-06-19 17:24:00 +00:00
Braden Shepherdson
891260cb57 [MBQL lib] Put :fields :all on joins on deleting last aggregation/breakout (#44321)
Part of #44298.
2024-06-19 17:09:42 +00:00
Mahatthana (Kelvin) Nomsawadi
863bc82af1 Clarify SDK release workflow (#44385) 2024-06-19 17:51:05 +01:00
github-automation-metabase
6f5c43d358 Update Readme version references and published npm version to 0.1.11 (#44421) 2024-06-19 16:50:54 +00:00
Mahatthana (Kelvin) Nomsawadi
0a550944f6 docs(sdk): Update readme pointing to the most recent v50 version (#44411)
* Update readme pointing to newer 50 release

* Update enterprise/frontend/src/embedding-sdk/README.md

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

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-06-19 17:22:50 +01:00
Ryan Laurie
9e4cbda477 ci: Automatically add milestones to prs and issues (#44357)
* automatically add milestones to prs and issues

* test code

* test code

* test commit (#3138)

* test commit (#43320)

* test commit (#44357)

* remove test code

* add newlines

* prefer older version milestones
2024-06-19 09:54:36 -06:00
Alex Yarosh
f0db81fccd docs: change paid to pro/enterprise (#44383)
* docs: change paid to pro/enterprise

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-06-19 15:28:12 +00:00
Jeff Bruemmer
5efb56c065 docs - add 50.6 to list of releases (#44399)
* add 50.6 to list of releases

* 49.17
2024-06-19 10:33:51 -04:00
Ryan Laurie
c643f094f1 Send five flakiest tests to flake job (#44402) 2024-06-19 14:24:16 +00:00
dependabot[bot]
c17bb33f0e Bump ws from 7.5.9 to 7.5.10 (#44345)
Bumps [ws](https://github.com/websockets/ws) from 7.5.9 to 7.5.10.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.9...7.5.10)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-19 17:16:28 +03:00
Uladzimir Havenchyk
400a1a2a10 fix: Do not pass template variables to findColumnIndexesFromLegacyRefs (#44377)
* fix: Do not pass template variables to findColumnIndexesFromLegacyRefs

* Add repro
2024-06-19 16:57:46 +03:00
Alexander Solovyov
f284a522e3 [openapi] fix query parameter detection and add default/description handling (#44239)
Also OpenAPI generation now handles parameter renaming, like in `{c :count}` destructuring.
2024-06-19 16:24:35 +03:00
Uladzimir Havenchyk
b41a5e840f Make dashboard filter auto-wire less presumptuous - add toast animation and hint messages (#44378) 2024-06-19 16:11:19 +03:00
github-automation-metabase
0e9076c0ff Update Readme version references and published npm version to 0.1.10 (#44398) 2024-06-19 13:07:43 +00:00
Kamil Mielnik
6daecbc66b Upgrade RTK to v2 (#44339)
* Upgrade @reduxjs/toolkit from ^1.9.3 to ^2.2.5

* Fix typing

* Upgrade redux-actions and @types/redux-actions

* Fix type errors

* Fix type errors

* Upgrade react-redux from ^8.0.5 to ^9.1.2
- remove @types/react-redux as it's no-longer-needed

* Upgrade redux-promise from ^0.5.0 to ^0.6.0
- upgrade @types/redux-promise

* Remove unused @types/redux-logger

* Revert "Upgrade redux-actions and @types/redux-actions"

This reverts commit 65005a0053.

* Remove createWeakSelector as weakMapMemoize is the default memoization strategy now

* Do not call unsubscribe if it does not exist

* Do not subscribe

* Remove console.log

* Make DelayedLoadingSpinner always render something with data-testid="spinner" so that tests can be aware of when things are loading

* Fix JoinStep unit tests

* Fix AddToDashSelectDashModal unit tests

* Fix SegmentApp unit tests

* Bring back original subscription logic

* Fix DataUsageStep unit tests

* Fix ManageApiKeys unit tests

* Simplify comment

* Fix MainNavbar unit tests

* Fix HomeRecentSection unit tests

* Use afterEach instead of afterAll to reset mocks

* Remove explanatory variable
2024-06-19 18:04:34 +07:00
Ngoc Khuat
613318f786 Metabase channel (#43924) 2024-06-19 09:25:42 +00:00
Ryan Laurie
35f97092e0 ci:Pass enterprise version to ee-extra build (#44386) 2024-06-19 02:38:34 -06:00
Nemanja Glumac
ce95331f30 Rename date/time empty filter options in the simple mode (#44102)
* Rename "empty" date/time filter options

* Add repro for #44101
2024-06-19 10:35:21 +02:00
Oisin Coveney
7de0faa635 Split View Header components into separate files (#44347) 2024-06-19 11:16:03 +03:00
adam-james
37abc08449 Pivot Tables with no Pivot Columns should still download (#44329)
* Pivot Tables with no Pivot Columns should still download

Fixes #44159

Pivot Tables can still be valid without columns, and therefore the download should respect such a query and be
successfully exported.

In this PR, the postprocessing of pivot results into 'visual pivot' exports for csv takes into account the zero-column
configuration and the download no longer fails.

* add a test to confirm that zero cols and >1 measures works as well

* Handle the case where there are zero pivot-rows.

This is a similar problem to the zero pivot-cols case, just with rows.

The app actually doesn't render these tables correctly, but that's a separate frontend bug
2024-06-18 13:20:00 -07:00
Benoit Vinay
6622470420 Add upload button for attached data warehouse (#43511)
* DWH plans added

* UploadCSV button component created

* Comments added

* Main nav bar updates

* Misc

* Align main nav bar button with link

* Misc comment

* Upload package created

* Various upload cleanup

* Misc

* Display button rule cleaned up

* Tracking added to upload CSV button

* Misc comment

* e2e tests WIP

* More comments

* e2e tests basic created

* NEw tracking schema

* e2e tests updated / Tracking WIP

* Analytics cleanup for button

* Misc

* Misc e2e tests Snowplow

* Removed forced Upload CSV button in FE

* Upload helpers created

* Misc unit tests updates

* Updated analytics

* Fix for e2e tests

* Upload fixture paths updated

* Misc for Snowplow

* Misc for plan

* More tests cleanup

* Misc

* Source added to analytics

* Plan unit tests fixed

* Update frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

* Update frontend/src/metabase/components/upload/constants.ts

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

* Misc imports

* Retrieving `uploads-settings` DB

* Remove default UploadCSV component export

* Misc

* Button copy updated

* Analytics updated with optional properties

* Default upload file input id updated

* csvupload schema updated

* Removed before

* No bad Snowplow events added

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-06-18 12:48:32 -04:00
Romeo Van Snick
4f6bf67629 Add RTK endpoints for loading and searching parameters (#44291)
* Add RTK endpoints for loading and searching parameters

* Add Parameter API types

* Move types to metabase-types

* Add return type to normalizeQuery
2024-06-18 18:02:06 +02:00
Oisin Coveney
cc17b9e88e fix(sdk): Fix spacing between collection browser and breadcrumbs (#44342) 2024-06-18 18:35:55 +03:00
Anton Kulyk
1b78f5a361 Fix timeline events filtering in the query builder (#44355)
* Add repro test

* Fix timeline events filtering

* Don't include first date of next interval
2024-06-18 16:23:04 +01:00
Alexander Polyankin
bdbaee5a2a E2E repro for "Fix field values remapping with models & custom dropdown source in public dashboards" (#44315) 2024-06-18 14:09:27 +00:00
John Swanson
d6873e86d5 Fix missing can_restore on collections (#44287)
I'd fixed the `can_restore` on non-collections to always be present, but
forgot about fixing it for collections as well.
2024-06-18 07:01:48 -07:00
Nick Fitzpatrick
413efacef5 [Bug Fix] Use effective location when building initial path in entity picker (#44327)
* use effective location when building initial path in entity picker

* unit test adjustment

* more unit test adjustments
2024-06-18 10:59:14 -03:00
Nemanja Glumac
bc78552d5f Fix metabase lib returning the string "null" as the drill through value (#44234)
* Convert drill-through (CLJ) values to JS

* Convert the drill-through `:null` to an actual `null`

Resolves #44232

* Use new function in `filter-drill-details`

* display-info->js should check for nil before seqable?

* fix js object comparison

* Add test for the `drill-value->js` function

* Simplify the test

* Fix the JS object equality in the test

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-06-18 15:56:36 +02:00
Nemanja Glumac
cb9fac1ddd Update Past to Previous in date filters (#44299) 2024-06-18 15:55:54 +02:00
Alexander Polyankin
191572d90f E2E repro for "Fix issue with root collection in QuestionPicker" (#44318) 2024-06-18 09:33:07 -04:00
Alexander Polyankin
9c18d099ce Add auto-wiring e2e tests for temporal unit parameters (#44326) 2024-06-18 09:30:29 -04:00
Nemanja Glumac
844188a97e Preemptively fix the E2E flake in alerty types (#44344) 2024-06-18 15:15:31 +02:00
Roman Abdulmanov
4ab0cfca9c Mark external PRs with the label (#44343) 2024-06-18 15:44:13 +04:00
Oisin Coveney
8cb98be8af fix(sdk): Remove night mode toggle from SDK static dashboards (#44284) 2024-06-18 11:44:04 +03:00
Oisin Coveney
f57be777d4 fix(sdk): Add theming options for Collection Browser's empty content message (#44281) 2024-06-18 11:05:28 +03:00
Ngoc Khuat
4d907fe8fb dev/rollback! n migrations (#40488) 2024-06-18 14:58:29 +07:00
Ngoc Khuat
62e8739fed Writing migration notes (#44116)
* Writing migration notes
2024-06-18 05:57:19 +00:00
Alexander Polyankin
337dbbe074 Fix remapped values in public dashboards (#44254) 2024-06-17 21:34:35 -04:00
Nick Fitzpatrick
1c83904ee2 Search events 1-1-0 (#44314)
* search events 1-1-0

* backwards compatible adjustment

* making context optional
2024-06-17 18:33:00 -03:00
Jesse Devaney
7f19247f7f Fix incorrect goal line plotting when using non-linear y-axis scales (log/pow) (#44320)
* refactor: de-duplicate variable usage

* fix incorrect goal-line plotting in pow and log y-axis scales

* add Loki variants to validate and enforce desired behavior

* update loki snapshots
2024-06-17 20:57:02 +00:00
Case Nelson
ea9dfd1d2b Change run to make-run in process-query-for-card (#44244)
* Change run to make-run in process-query-for-card

Fixes #44160

There were two levers where a card could change how it was run.

`qp` this is basically `qp/process-query` with some optional userland
flags and constraints marked on the passed in query.
In the case of pivot tables in the
`/pivot/:card-id/query` endpoints it was `qp.pivot/process-query`

'run' this defaults to a streaming response that takes the `qp` param
and `export-format` and passes a query to qp. Most often this is
overriden to not stream the response.

Unfortunately, if `run` is overwritten, then `qp` is thrown away, and
the caller who overrides `run` must determine the correct `qp` to use.

However, when running `process-query-for-dashcard` it is difficult to properly set
`qp` for all of the dashcards without doing card lookups. So [this commit](https://github.com/metabase/metabase/blob/release-x.50.x/src/metabase/query_processor/card.clj#L230-L232) did a check to swap the runner in the presence of a pivot query that calls the **default** runner with a `qp.pivot/run-pivot-query`. The problem is that pulse needs to use a non-default runner, but there's no way for `process-query-for-card` to do both.

This commit changes `run` to `make-run` which raises the abstraction to
a function that produces a runer given a `qp`. This allows
`process-query-for-card` to change the `qp` as needed while keeping the
passed in runner.

There's really three things going on that could be teased apart
further/better.

1. `qp` - this conflates the processor (`qp/process-query` `qp.pivot/run-pivot-query`)
  and modifying query (`qp/userland-query`,
  `qp/userland-query-with-default-constraints` `(update query :info merge info)`)
2. `make-run` - How the above are processed: (streaming/realized)

* Fix tests
2024-06-17 11:29:57 -07:00
Alberto Perdomo
66a189f77f Update SDK README.md (#44292)
Tweak the callout about the SDK still being in development
2024-06-17 18:27:37 +01:00
Alex Yarosh
f8298e49e2 remove audit mentions (#44309) 2024-06-17 11:29:01 -04:00
Raphael Krut-Landau
01db0a2a70 fix: Remove references in the FE to the deprecated enable-query-caching setting (#44263)
* wip

* Remove references to the old enable-query-caching setting

* remove fixme

* linter

* remove some more instances

* fix imports
2024-06-17 10:06:52 -05:00
Alexander Polyankin
a0dfc99c41 E2E repro for "Dashboard filters do not work with SQL models" (#44297) 2024-06-17 14:51:12 +00:00
Ryan Laurie
a72afa4751 Rework slow test group (#44286)
* skip super slow xray test

* unmark not very slow tests
2024-06-17 08:49:18 -06:00
Nemanja Glumac
5fd247c5a1 MS1: Elevate "include this {period}" and "starting from" in the relative date picker (#44279)
* Elevate include this period in the relative date picker (#44179)

* Mock new row with "include {period}"  string

* Implement "include this" using a toggle

* Elevate "starting from" option in the relative date picker (#44242)

* Elevate "Starting from" option in the filter picker

* Tweak the date offset close icon

* Fix tests
2024-06-17 15:59:01 +02:00
Jeff Bruemmer
fdc0b71512 add 50.5 (#44293) 2024-06-17 09:33:18 -04:00
Ryan Laurie
13c71cd054 ci(release): Fix ee-extra trigger in release script (#44282) 2024-06-17 11:43:58 +00:00
Raphael Krut-Landau
93334133ea fix: Remove help email from error diagnostic modal (#44165) 2024-06-15 03:36:04 +00:00
Jesse Devaney
aac751c212 Fix tool-tip values not being scaled in waterfall charts (#44180)
* fix column scaling issues in waterfall chart

- refactor dataset scaling to behave like scatter and cartesian chart models

* add E2E test
2024-06-14 21:12:53 -03:00
Raphael Krut-Landau
9a68f25867 fix(webapp): Tweak dashboard move toast to add internal spaces and ttag context (#44191) 2024-06-14 17:17:59 -04:00
Jeff Bruemmer
9ac932ae16 Note on SQLite and cloud (#44237) 2024-06-14 15:42:51 -04:00
Aleksandr Lesnenko
74e73d2b6a fix charts crash in safari when dataset timezone is not in iana format (#44193)
* fix charts crash in safari when dataset timezone is not in iana format

* Update Loki Snapshots

* better fix: apply offset instead of finding a timezone with such offset

* remove unused specs

* Update Loki Snapshots

* review

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-06-14 19:18:58 +00:00
Cal Herries
dd1eb6cb4d Fix fields from Amazon Athena Tables failing to sync if there is not an underscore in the Table Name (#44032) 2024-06-14 18:26:21 +00:00
John Swanson
27e1ff6452 Fix collection id on collection items endpoint (#44236)
* Fix a potential bug in `hydrate-can-restore`

I had a bug here. I wanted to hydrate `:collection` on the items and
then return the original items, but instead I was `dissoc`ing
`:collection` from the items. If the original items passed in already
had `:collection` keys this would break them.

AFAIK this didn't cause any issues, but it could have - so fixing it here.

* Add a test

* Present collection items in the collection

When fetching collection items, we need to fetch the true
`collection_id` in order to figure out things like `can_restore` and
`can_delete`, but set it to the displayed/effective `collection_id` when
we actually send it out.

This fixes a bug where collections had their `collection_id` match their
`id` when returned by this endpoint.
2024-06-14 18:22:50 +00:00
Ryan Laurie
6d87ed281e ci(release):Tag tech writers in release message (#44216) 2024-06-14 08:39:25 -06:00
Jeff Bruemmer
7d2112e697 Update partner-and-community-drivers.md (#44218) 2024-06-14 11:16:03 -03:00
Sloan Sparger
f702aee6a0 Sort trash collection by last_edited_at desc (#44181) 2024-06-14 09:04:49 -05:00
Alex Yarosh
8c416bd9ab update list of releases (#44217) 2024-06-14 09:56:40 -04:00
Phoomparin Mano
dd00df1a06 Replace usage of color-mod with color-mix and remove the postcss function (#44175)
* replace color-mod with color-mix

* update alpha values to round to 5%

* add deprecation notice to lighten, darken and alpha

* update loki reference image

* add alpha value css variables to storybook preview

* update loki reference image
2024-06-14 13:29:13 +00:00
Abed Habli
0e8469f4b0 capitalize the ‘U’ in user interface (#44196) 2024-06-14 09:12:06 -04:00
Ryan Laurie
e1ade5c665 Trigger ee extra build (#44138) 2024-06-14 06:40:15 -06:00
John Swanson
e677eb7ad2 Always provide can_restore (#44124)
Previously we were just adding this when the item was archived. Instead,
always send a value - if the item is not archived, it can't be restored,
so it will be `false` in this case.

Making this change will make fixing a frontend bug easier, because the
frontend will be able to just trust the `can_restore` value coming in
from the backend.
2024-06-14 05:25:03 -07:00
github-automation-metabase
012a763522 Update Readme version references and published npm version to 0.1.9 (#44212) 2024-06-14 12:13:41 +00:00
Oisin Coveney
d7a1e86798 fix(sdk): Update README to move Embedding the collection browser to Features currently supposed (#44208) 2024-06-14 11:46:42 +00:00
Ryan Laurie
4bbc3163e2 Better Release Slack Notifications (#44195)
* add additional release slack message

* trigger slack messages from build

* fixes

* remove silly var name
2024-06-14 05:35:30 -06:00
Ryan Laurie
c769688711 Update release script to trigger ops issue creation (#39634)
* update release script to trigger ops issue creation

* update secret vars
2024-06-14 05:27:35 -06:00
Kamil Mielnik
5258ec54f8 Fix background-color usage in CSS-in-JS (#44204) 2024-06-14 11:25:30 +00:00
Ryan Laurie
4f25a4720b Combine collections e2e specs (#43841)
* combine collections e2e specs

* obey the linter
2024-06-14 05:12:09 -06:00
Raphael Krut-Landau
1bfcdf8c90 fix(admin): Rename some variables (#43817) 2024-06-14 06:40:19 -04:00
Oisin Coveney
7854e07a62 fix: Ensure interactive embedding CTA matches instance features (#44197) 2024-06-14 13:32:50 +03:00
Oisin Coveney
81a586df95 fix(sdk): Add theming to collection browser breadcrumbs (#44066) 2024-06-14 12:19:04 +03:00
Nemanja Glumac
884901f20a Remove "is empty" and "not empty" from time-series chrome (#44164)
* Remove "is empty" and "not empty" from time-series chrome

* Fix unit test
2024-06-14 11:00:58 +02:00
Phoomparin Mano
9decd3e8ed docs(sdk): add theming changes to embedding SDK docs (#44172)
* docs update

* add dashboard.backgroundColor
2024-06-14 08:58:04 +00:00
Romeo Van Snick
62123c073e Use MultiAutocomplete in dashboard filters (#43293)
* Use MultiAutocomplete in dashboard filters

* Handle prefix on MultiAutocomplete

* Remove unnecessary tests for empty values

* Remove input className

* Handle numbers in MultiAutocomplete

* Accept number values in MultiAutocomplete

* Use MultiAutocomplete in NumberInputWidget

* Filter out empty items

* Do not expect formatted number in values

* Do not allow adding multiple values when multi is false

* Handle undefined values

* Make value optional

* Fix MultiAutocomplete types

* Make MultiAutoComplete generic in its value type

* Refine MultiAutocomplete type in NumberInputWidget

* Refine MultiAutocomplete type in FieldValuesWidget

* Fix typo

* Fix MultiAutocomplete tests

* Add helpers to work with MultiSelect and MultiAutocomplete inputs

* Handle MultiAutocomplete input in tests

* Fix filter helper

* Use multiAutocompleteInput helper

* Find the value remove button in test

* Fix tests for NumberInputWidget

* Fix tests for DefaultPicker

* Fix type in NumberInput

* Fix dasboard test

* Fix embedding test

* Add helpers to remove values

* Fix chained filter test

* Fix nested test

* Fix embedding tests

* Fix filter tests

* Use removeMultiAutocompleteValue

* Use removeMultiAutocompleteValue

* Remove unused variable

* Use multiAutocompleteInput helper

* Handle comma's in values

* Handle multiselect

* Fix filter test

* Add filter

* Format field value

* Fix embedding tests

* Allow rendering custom label for item

* Use renderValue in FieldValuesWidget

* Fix data prop type

* Be more explicit about broken types in FieldValuesWidget

* Fix default behaviour for label

* Fix embedding tests

* Force click

* Fix sharing test

* Use removeMultiAutocompleteValue

* Handle multiautocomplete inputs

* Force click filter

* Close the suggestions menu

* Fix email test

* Fix sharing filter

* Set viewport in test

* Fix sharing test

* Remove debugging logs

* Use removeMultiAutocompleteValue

* Close the suggestions menu using blur

* Remove commented out code

* Remove the unused color prop

* Move shared types to types file

* Rename ValueType to TValue

* Add missing forwardRef

* Add tests for filter and renderValue

* Use TokenField for single value parameters

* Fix single value test

* Be more specific about when to select a single input

* Fix single value e2e test

* Handle undefined parameter

* Accept all RowValue types in MultiSelect

* Accept all RowValue types in ListField

* Accept all RowValue types in SingleSelectListField

* Be more precise about the FieldValuesWidget value types

* Be more specific about when to render normal input

* Remove duplicate import

* Remove maxSelectedValues from MultiAutocomplete

* Parse values in FieldValuesWidget

* Remove parsing complexity from MultiAutocomplete

* Be more strict when parsing numbers

* Do not use multiselect when arity is 1

* Remove spurious changes

* Pass prefix from FieldValuesWidget

* Remove number MultiAutocomplete story

* Remove renderValue from MultiAutocomplete

* Add custom component to MultiAutocomplete

* Add missing data prop

* Remove spurious changes in MultiAutocomplete

* Remove SelectItem reference

* Use renderValue in FieldValuesWidget
2024-06-14 10:04:18 +02:00
Nick Fitzpatrick
a8d5ea6437 fix(command-palette): fix docs url (#44113) 2024-06-13 22:49:44 -04:00
Raphael Krut-Landau
a95ff7f595 fix: Remove console warnings in cache-related code (#44173)
This PR removes:
- a warning about missing React keys in the `Schedule` component
- a warning about invalid props in the `StrategyFormLauncher` component
2024-06-13 22:32:54 -04:00
Raphael Krut-Landau
e33acdc6b6 feat(admin/cache): Use distinct routes for each performance tab (#44139) 2024-06-14 00:38:32 +00:00
Raphael Krut-Landau
1088baf011 [Browse] Add skeletons to Browse models (#44008)
* adds a shimmer effect to the skeletons
* adds a `natural` prop that makes the skeletons have a random width between 50% and 80%
* adds a skeleton to Browse models

Closes #44111
2024-06-13 20:33:56 -04:00
Braden Shepherdson
ba182e1745 [QP] Fix :fields clauses in nest-query with extra aggs outside model (#44182)
Fixes #43993.
2024-06-13 22:55:07 +00:00
Sloan Sparger
458fbf9efb fixes coloring for bulk actions bar button (#44178) 2024-06-13 17:14:59 -05:00
Nick Fitzpatrick
4772b5e249 Adding snippets back into getCollection (#44097)
* adding snippets back into getCollection

* e2e test

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-06-13 17:01:58 -05:00
Phoomparin Mano
04a08d3304 replace css variables in static viz (#44131) 2024-06-14 03:04:15 +07:00
Noah Moss
2e94093025 Don't sync JWT registered claims as login attributes (#43976) 2024-06-13 19:10:53 +00:00
Noah Moss
d971a83601 Minor refactoring in JWT/SAML tests (#43866)
* little bit of refactoring in sso test code

* use :once instead of :each
2024-06-13 14:22:37 -04:00
Noah Moss
16599b223e Relax constraints on GET /api/user/:id endpoint (#44100) 2024-06-13 14:13:18 -04:00
Noah Moss
c7bf7d1def Fix login_history indexed columns (#44091) 2024-06-13 14:13:01 -04:00
Phoomparin Mano
d843973a8e feat(sdk): option to hide dashboard card title (#43859)
* expose card title settings

* Add dashboard test skeleton

* add a sample dashcard to the test

* dashboard grid should have card title by default

* add unit test for card title

* remove unused delay in unit test

* fix width and height being smaller than min values

* flip grid layout condition

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-06-14 00:54:01 +07:00
Raphael Krut-Landau
c7e46dc961 fix(ui-library): Don't animate Buttons (micro-PR) (#44137) 2024-06-13 16:10:33 +00:00
Phoomparin Mano
ee38f0e449 feat(sdk): apply theme options to tables in static dashboard (#44007)
* apply cell background color

* add id column overrides

* do not add transparency to id column cell when overridden

* fix static dashboard theming

* update loki reference image

* add style resets and regenerate loki snapshots

* add style resets and regenerate loki snapshots
2024-06-13 21:34:26 +07:00
Aleksandr Lesnenko
6e87cb9306 Fix invalid areas when line style is step (#44107)
* fix area step

* specs
2024-06-13 11:08:22 -03:00
Chris Truter
68bd9781ae Update Macaw to fix double blank lines (#44119) 2024-06-13 15:20:53 +02:00
Alex Yarosh
c5ef3fe772 [docs] update the list of releasts for 50.3 and 49.16 (#44125) 2024-06-13 09:11:19 -04:00
Anton Kulyk
ffbad1d6ae Fix broken line/area/bar charts after adding a second stage filter (#44053)
* Rework column sync to work with series objects

* Reuse previous metrics and dimensions if available

* Add repro test
2024-06-13 13:57:43 +01:00
Alexander Polyankin
3afe4821a0 Fix issue with root collection in QuestionPicker (#44081) 2024-06-13 03:52:09 +00:00
dpsutton
8824bd9a19 Handle errors when inferring separator of csv (#44073)
* Handle errors when inferring separator of csv

This file

```
"c1","c2"
"a,b,c","d"
```

was failing to upload for a silly reason: when we were checking for
which separator it used, we had a parse error when using a semi-colon
and that blew up the whole pipeline.

* Use cal's helpful test suggestions
2024-06-12 17:21:52 -05:00
Raphael Krut-Landau
e2144d140d Remove dead props in getButtonOverrides (#44082) 2024-06-12 16:55:17 -04:00
John Swanson
837beda619 Set can_delete to false for unarchived items (#44088)
Although a user may have the necessary permissions to delete an item, if we're not going to allow deleting unarchived items, can_delete should be false for them too.
2024-06-12 20:24:22 +00:00
Jeff Bruemmer
eb9bb2dad7 docs - minor edit (#44089) 2024-06-12 16:14:52 -04:00
Raphael Krut-Landau
6240dee136 [Browse] Use a loading skeleton instead of a spinner for Browse models in the nav (#43970)
* Add our first Mantine Skeleton

* Sort

* Simplify Skeleton.tsx
2024-06-12 15:16:34 -04:00
Alexander Polyankin
bab6387cdf Consolidate temporal unit pickers between dashboards and timeseries chrome (#44061) 2024-06-12 18:47:13 +00:00
Raphael Krut-Landau
44cfdf48e2 Make model persistence tab available on OSS (#44059) 2024-06-12 14:36:26 -04:00
Anton Kulyk
0cce65e2cb Move syncColumnSettings to metabase/visualization (#44074)
* Move `syncColumnSettings` to metabase/visualization

* Remove unused `SettingsSyncOptions`

* Fix type errors
2024-06-12 19:14:05 +01:00
Sloan Sparger
edcd2ff7c9 Fix "Manage database" perms incorrectly show up on the schema-level permissions page (#43601) 2024-06-12 13:02:01 -05:00
Jeff Bruemmer
fa8c7a2361 docs - release list 50.1 (#44076) 2024-06-12 13:26:21 -04:00
Alexander Solovyov
d638e94971 certain settings should be decrypted for cache config migration to run (#44048) 2024-06-12 11:22:04 -06:00
Ryan Laurie
d7bd5603bc Combine and reorganize admin e2e specs (#43853)
* combine and reorganize admin specs

* fix import and reorganize more
2024-06-12 11:20:47 -06:00
Ryan Laurie
acd7c31f22 Combine embedding e2e specs (#43843) 2024-06-12 11:20:25 -06:00
Ryan Laurie
cbda131e84 Combine native e2e specs (#43844) 2024-06-12 11:20:01 -06:00
Ryan Laurie
121054b293 Update how we run maildev in pre-release testing (#44072) 2024-06-12 10:27:22 -06:00
Oisin Coveney
fad00d4346 Convert Badge and CollectionBadge (#43997) 2024-06-12 17:18:15 +03:00
Alexander Polyankin
084dd3b2ae Allowlist for temporal unit parameters (#43967) 2024-06-12 10:05:24 -04:00
Ngoc Khuat
937e3daac1 Fix get card query_metadata and dashboard query_metadata throws 500 when users don't have view perms on any tables (#44052) 2024-06-12 15:53:50 +02:00
Nemanja Glumac
01e9387f62 Fix broken filter E2E test (#44051)
* Fix broken E2E test

* Remove linter warning
2024-06-12 12:31:03 +00:00
Oisin Coveney
14db7aeeac feat(sdk): Add collection browser (#43606) 2024-06-12 11:37:42 +03:00
Uladzimir Havenchyk
f7502d96e7 Restore icons in the new filter popup (#44025)
* Restore icons in the new filter popup

* it.each
2024-06-12 07:40:48 +00:00
Ivan Križnar
bae0aedf2c Fix scrollbar interaction in the custom expression suggestion list (#43995)
* Fix dismissing popup

* Undo revert

* Merge refs

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorTextfield/ExpressionEditorTextfield.tsx

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

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorSuggestions/ExpressionEditorSuggestions.tsx

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

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorSuggestions/ExpressionEditorSuggestions.tsx

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

* Use semantically correct HTML

* Fix popmenuTarget type

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-06-12 09:07:40 +02:00
Aleksandr Lesnenko
ae2c960913 fix single series bar hover (#43984)
* fix single series bar hover

* prefer reduced motion
2024-06-12 01:17:09 +00:00
Case Nelson
febfe4a5aa [Metrics V2] Metrics with filters on implicitly joined columns produce query error when added in a Summarize block (#43987)
* [Metrics V2] Metrics with filters on implicitly joined columns produce query error when added in a Summarize block

* Handle multiple metrics with same implicit join

* Address PR feedback
2024-06-11 16:12:51 -06:00
Nemanja Glumac
9ebb679f6d Fix "collection items sorting" E2E flake (#44023)
* Fix "collection items sorting" E2E flake

* Add comments

* Remove the `@flaky` tag
2024-06-11 19:45:45 +00:00
Nemanja Glumac
ce5d2547e7 Remove the custom resize handle from the notebook native query preview sidebar (again) (#44021) 2024-06-11 19:25:02 +00:00
Jeff Bruemmer
6c1458ff2f uploads in config file (#43891) 2024-06-11 14:13:32 -04:00
Nemanja Glumac
8af1555502 Fix the dashboard drill E2E flake (#44016) 2024-06-11 17:02:41 +00:00
bryan
7b849da346 Make recents understand context (#43478)
* adds the endpoint and a test

* add recents endpoint, todo: tests

* add post recents endpoint

* return recent views for both lists, but make the endpoint work

* Make recent-views context aware

- pruning is context aware, only checks for the recently-inserted
  context
- Adds endpoints:
    - POST to create selection recents,
    - GET activity/recents
      - requres context query param to be one of:
      - all, views, selections

- Adds context arg to update-users-recent-views!
- Cleans up arg schema for update-users-recent-views

* impl GET api/activity/recents

- return recent-selections and recent-views from
- send context == collection from pinned card reads

* update callsites of recent-views/update-users-recent-views!

- to use :view param where necessary

* fixes models/recent-view tests

* adds more activity/recent-view tests

* wip

- fix whitespace linter

* Fix command palette e2e test

- reuse util snake-keys

* updates fe to use new recents endpoints

* fixes fe type issue

* snake-keys -> deep-snake-keys

- I've been betrayed by lsp rename

* snake-keys -> deep-snake-keys

- I've been betrayed by lsp rename

* log selection events for created collections

* mysql doesn't allow default values for TEXT types

* log a recent view on data-picker selection

* decouple view-log context from card-event view context

* fix a doc typo

* stop double logging recent-views on POST

* maybe fixes some tests

* some e2e fixes

* fix mysterious divide by zero during score search

* fix divide by zero possibilities everywhere in score-items

metabase.api.activity/score-items used to throw when there weren't any
items being scored (even though there's a `(when (seq items) ...)` check)

* more test fixes

* fix more e2e tests, + rename endpoint in tests

* fix oopsie

* fixes a few more tests

* address review comments/questions

* allow for a comma delimited list in qps like ?context=views,selections

returns all recent view items with those contexts, most recent first
under the `:recents` key.

* refactors FE around new endpoint

* fixes for unit tests

* use ms/QueryVectorOf for context

* fix models/recent_views tests

* use multiple query params instead of comma delimited value on FE

* ignore timestamp when deduping recents

* review comments + test fixing

* update docstring

* fix api/activity_test s

* actually dedupe

* add test for deduping by context

* e2e fix: shows up-to-date list of recently viewed items after another page is visited

* e2e fix: should undo the question replace action

* e2e fix: should replace a dashboard card question (metabase#36984)

* e2e fix: should preselect the most recently visited dashboard

* fix 6 more e2e tests

* fixes fe type check and unit failure

* renames unit test mocking function

* fix a flaky e2e test

* widen Item to accept str or kw where sensible

- allow strings or keywords for moderated_status, and authority_level

* simplify impl + add test

* add view-log to events schema

* add collection context to view log

* fix the final 2 failing e2e tests

* click dashboard tab when the user has can-read? on recent entities

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-06-11 10:12:29 -06:00
John Swanson
7374e61ed7 Improve the Trash data model (#42845)
* Improve the Trash

Ok, so I had a realization at the PERFECT time, immediately after the RC
cutoff. Great job, brain!

Here's the realization. For the Trash, we need to keep track of two
things:

- where the item actually is located in the hierarchy, and

- what collection we should look at to see what permissions apply to the
item.

For example, a Card might be in the Trash, but we need to look at
Collection 1234 to see that a user has permission to Write that card.

My implementation of this was to add a column,
`trashed_from_collection_id`, so that we could move a Card or a
Dashboard to a new `collection_id`, but keep track of the permissions we
actually needed to check.

So:

- `collection_id` was where the item was located in the collection
hierarchy, and

- `trashed_from_collection_id` was where we needed to look to check
permissions.

Today I had the realization that it's much, much more important to get
PERMISSIONS right than to get collection hierarchy right. Like if we
mess up and show something as in the Trash when it's not in the Trash,
or show something in the wrong Collection - that's not great, sure. But
if we mess up and show a Card when we shouldn't, or show a Dashboard
when we shouldn't, that's Super Duper Bad.

So the problem with my initial implementation was that we needed to
change everywhere that checked permissions, to make sure they checked
BOTH `trashed_from_collection_id` and `collection_id` as appropriate.

So... there's a much better solution. Instead of adding a column to
represent the *permissions* that we should apply to the dashboard or
card, add a column to represent the *location in the hierarchy* that
should apply to the dashboard or the card.

We can simplify further: the *only time* we want to display something in
a different place in the hierarchy than usual is when it was put
directly into the trash. If you trash a dashboard as a part of a
collection, then we should display it in that collection just like
normal.

So, we can do the following:

- add a `trashed_directly` column to Cards and Dashboards, representing
whether they should be displayed in the Trash instead of their actual
parent collection

- use the `collection_id` column of Cards and Dashboards without
modification to represent permissions.

There's one main downside of this approach. If you trash a dashboard,
and then delete the collection that the dashboard was originally in,
what do we do with `dashboard.collection_id`?

- we have to change it, because it's a foreign key

- we can't set it to null, because that represents the root collection

In this initial implementation, I've just cascaded the delete: if you
delete a dashboard and then delete a collection, the dashboard will be
deleted. This is not ideal. I'm not totally sure what we should do in
this situation.

* Rip out all the `trashed_from_collection_id`

* Migration to delete trashed_from_collection_id

* fixes

* don't move collections

And don't allow deleting collections

* only show cards/dashboards with write perms

* Show the correct archived/unarchived branch

* some cleanup

* add a todo for tomorrow

* Fix for yesterday's TODO

* more wip

* refactor

* memoize collection info

* move around memoization a bit

* fix schema migration test

* oops, delete server.middleware.memo

* Use a migration script (postgres only for now)

* Fix some tests

* remove n+1 queries in `collection-can-restore`

* fix test

* fix more tests, and x-db migration script

* fix h2 rollback

* fix mysql/mariadb migration

* lint

* fix some mariadb/mysql tests

* fix h2 rollback

* Fix mysql rollback

* Fix Postgres migration

* "Real" `trash_operation_id` UUIDs from migration

* fix mariadb migration

* Separate MySQL/MariaDB migrations

* trashed directly bit->boolean

* Remove `trashed_from_*` from migrations

* Rename `api/updates-with-trashed-directly`

Previously named `move-on-archive-or-unarchive`, which was no longer
accurate since we're not moving anything!

* Add `can_delete`

* Delete test of deleted code

* Can't move anything to the Trash

The Trash exists as a real collection so that we can list items in and
such without needing special cases. But we don't want anything to
_actually_ get moved to it.

* integrates can_delete flag on FE

* Update src/metabase/models/collection.clj

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

* Update src/metabase/search/impl.clj

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

* Better name for `fix-collection-id`

Also consolidated it into a single function. It takes the
trash-collection-id as an argument to prevent a circular dependency.

* s/trashed/archived/ on the backend

In the product, we want to move to "trashed" as the descriptor for
things that are currently-known-as-archived.

It'd be nice to switch to that on the backend as well, but that'll
require quite a lot of churn on the frontend as we'd need to change the
API (or have an awkward translation layer, where we call it `trashed` on
the backend, turn it into `archived` when sending data out via the API,
and then the FE turns around and called it "trashed" again).

For now, let's just be consistent on the backend and call it `archived`
everywhere. So:

- `archived_directly` instead of `trashed_directly`, and
- `archive_operation_id` instead of `trash_operation_id`

* Fix up a couple docstrings

* Rename `visible-collection-ids` args

for `collection/permissions-set->visible-collection-ids`:

- `:include-archived` => `:include-archived-items`

- `:include-trash?` => `:include-trash-collection`

* select affected-collection-ids in the tx

* Stop dealing with `:all` visible collection ids

This used to be a possible return value for
`permissions-set->visible-collection-ids` indicating that the user could
view all collections. Now that function always returns a set of
collection IDs (possibly including "root" for the root collection) so we
don't need to deal with that anymore.

* Don't use separate hydration keys for collections

Dispatch on the model of each item (but still keep them in batches for
efficiency.)

* vars for collectable/archived-directly models

* Round up loose `trashed_directly`s

* Fix a test

* Use `clojure.core.memoize` instead of handrolled

It's slightly different (TTL instead of exactly per-request) but that
should be fine.

* FE lint fixes

* 😭 e2e test fix

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-06-11 11:31:14 -04:00
Phoomparin Mano
a742b3408b feat(sdk): theme option to customize the dashboard card border (#43963)
* add option to customize dashcard border

* use the shadow CSS variable

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

* make the shadow and border decoration call more explicit

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

* pass in theme as argument

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-06-11 22:14:46 +07:00
Romeo Van Snick
d876627b24 Unary number parameter (#43921)
* Allow picking arity of number parameters

* Limit to input to have arity 1 when multi is false

* Use MultiAutocomplete in NumberInputWidget when arity is 1

* Add test cases for single value numbers

* Only change arity when it is n

* Fix unit tests for NumberInputWidget

* Move arity check for numbers to getNumberParameterArity
2024-06-11 16:57:14 +02:00
Jeff Bruemmer
64f82436ef docs - updates for 50 (#44002) 2024-06-11 10:38:15 -04:00
Nemanja Glumac
28fc332064 Fix "line/bar chart" tooltip flake (#43975)
* Fix the typo

* Replace `realHover` with the `mouseMove` trigger

* Be explicit when targetting elements by their index

* fix combo chart tooltip e2e specs

* cy.wait as a last resort

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-06-11 14:09:24 +00:00
Aleksandr Lesnenko
6ec9de852e move stackable settings (#43978) 2024-06-11 13:42:56 +00:00
Nemanja Glumac
eebf4b5239 Fix E2E flake in the native_subquery spec (#43991)
* Re-work `startNewNativeQuestion` helper

* Fix native_subquery flakes

* Simplify the helper

* Remove the `flaky` tags
2024-06-11 14:10:58 +02:00
Kamil Mielnik
c0a804bfe6 Copy question link from dashboard (#43816)
* Improve typing in Question

* Remove dead CSS

* Improve typing in getUrlWithParameters

* Add LegendLabel

* Drop navigateToNewCardFromDashboard in PublicOrEmbeddedDashboard

* Extract getNewCardUrl and move getParametersMappedToDashcard closer to it

* Add link to dashboard chart title

* Update title-drill tests

* Format code

* Update test

* Add HrefMemo

* Use state to memoize href

* Recompute state on getHref prop change

* Format code

* Refactor href computation

* Update test

* Use selector instead of useMemo

* Fix unit tests

* Ensure type safety

* Revert getDashCardById type change to not make this PR too large

* Use complete dashboard

* Add a workaround for metabase#43990
2024-06-11 17:39:45 +07:00
Kamil Mielnik
40ef144430 Revert "Fix scrollbar interaction in the custom expression suggestion list (#…" (#43992)
This reverts commit a297e9a6ad.
2024-06-11 10:14:33 +00:00
Phoomparin Mano
6113998662 apply full width to static dashboard (#43954) 2024-06-11 17:05:35 +07:00
Mahatthana (Kelvin) Nomsawadi
ddb6299993 Release a test from the flaky test jail (#43946) 2024-06-11 09:06:03 +01:00
Mahatthana (Kelvin) Nomsawadi
459429985c ci(sdk): Remind SDK PR author to use conventional commits PR title (#43932)
* Remind embedding SDK PR author to use conventional commits

* Only remind PR author when PR title isn't conventional commits

* Add branch for testing

* Fix gh cli command

* Fix getting wrong user login

* Ensure we don't create more than 1 comment

* Improve comment format

* Add more info for non-changelog related type

* Check non-changelog related types

* Update the comment for consistency

* Revert "Add branch for testing"

This reverts commit 4a1be68828.
2024-06-11 07:30:35 +01:00
Chris Truter
a46b9d7fc2 More precise migration range logs (#43962) 2024-06-11 08:21:58 +02:00
Denis Berezin
e8fedf0164 feat(sdk): SDK theming part 6 - text-brand, text-dark, text-light, text-medium, admin-navbar, accentX (#43687)
* Migrate text-brand

* Migrate text-dark

* Migrate text-light

* Migrate text-medium

* Migrate admin-navbar

* make compact formatting consistent across all series (#43472)

* make compact formatting consistent across all series

* fix rebase

* [Browse] Show Browse models link in nav only when there are models (#43286)

* Upgrade to TypeScript v5.4 (#43736)

* use correct github api for CI (#43750)

* update list of releases (#43754)

* Multi Series Dashcards Render with Filters Applied To All Series (#43428)

* Multi Series Dashcards Render with Filters Applied To All Series

Fixes: #39083

Multi-series dashcards now properly render when a subscription is set up with filters that impact the values of each
card in the multi-series card.

* Small refactor for executing dashcards in a pulse context.

- move execute-dashboard-subscription to pulse.util
- this fn now will also execute all card series cards
  and put those results into a list on the key :series-results in the dashcard
  which is then used in the render multimethod to send the correct data to the javascript context

A small todo was taken care of as well, we can now use :dashboard-subscription in the :context key

* Fix up render fn

The shape of hte data going into the javascript was a bit unclear before. This keeps things a little more
understandable.

Next step is probably to create some Malli schemas inside the js_svg namespace to document and enforce the needed data shapes

* pull :data up a level from :result in the series cards

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

* Remove unneeded let

* set/rename-keys won't work here because we raise the :data key

I've realised a suggested change to just use set/rename-keys won't do what we need. We need instead to raise :data
from within the result key up to the same level (and dissoc result).

I've renamed the helper function to make its purpose a bit clearer

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

* Hydrate can_run_adhoc_query and address review comments (#43747)

This is a followup on #43625.

* Consolidate dashboard-card specs (#43716)

* Consolidate joins specs (#43717)

* Update translations for v50 and add Danish Language Support (#43314)

* update translations for v50

* add Danish

* update translations for v50 release

* alphabetical order is nice

* Move database role to url parameters from connection properties on Snowflake (#43602)

* Move role to url parameters from connection properties

* Fix test

* Fix width of save button in cache sidebar (#43755)

* Remove dead code (#43603)

* Combine search e2e specs (#43718)

* Highlight the table cell data in dashboards when the cell is an ID column (#43728)

* highlight id cell column

* add simpletable stories

* add simple table test data

* add loki reference image

* Update frontend/src/metabase/visualizations/components/TableSimple/TableCell.styled.tsx

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

---------

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

* Remove old repro for 39150 (#43749)

* Fix remaining `tinyint` booleans in MySQL (#43296)

* Correct type for `report_card.dataset`

This was missed in the original migration of boolean types to
${boolean.type} in MySQL/MariaDB, and then missed again by me when I
migrated `collection_preview` over a week ago.

* Change all boolean types to `bit(1)` in MySQL

Liquibase changed their boolean type in MySQL from `bit(1)` to
`tinyint(4)` in version 4.25.1. Our JDBC driver does not recognize these
as booleans, so we needed to migrate them to `bit(1)`s.

As discussed [here](#36964), we
changed all existing `boolean` types that were in the
`001_update_migrations.yml` but not the SQL initialization file.

For new installations, this works: things in the SQL initialization file
get created with the `bit(1)` type.

However, for existing installations, there's a potential issue. Say I'm
on v42 and am upgrading to v49. In v43, a new `boolean` was added.

In this case, I'll get the `boolean` from the liquibase migration rather
than from the SQL initialization file, and it need to be changed to a
`bit(1)`.

I installed Metabase v41 with MySQL, migrated the database, and then
installed Metabase v49 and migrated again. I made a list of all the
columns that had the type `tinyint`:

```
mysql> SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_TYPE,        COLUMN_DEFAULT, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_TYPE = 'tinyint' AND TABLE_SCHEMA='metabase_test';
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| TABLE_SCHEMA  | TABLE_NAME                   | COLUMN_NAME       | COLUMN_TYPE | COLUMN_DEFAULT | IS_NULLABLE |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| metabase_test | core_user                    | is_datasetnewb    | tinyint     | 1              | NO          |
| metabase_test | metabase_field               | database_required | tinyint     | 0              | NO          |
| metabase_test | metabase_fieldvalues         | has_more_values   | tinyint     | 0              | YES         |
| metabase_test | permissions_group_membership | is_group_manager  | tinyint     | 0              | NO          |
| metabase_test | persisted_info               | active            | tinyint     | 0              | NO          |
| metabase_test | report_card                  | dataset           | tinyint     | 0              | NO          |
| metabase_test | timeline                     | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline                     | default           | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | time_matters      | tinyint     | NULL           | NO          |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
10 rows in set (0.01 sec)
```

Then wrote migrations. For each column, we:

- turn it into a `bit(1)`,

- re-set the previously existing default value, and

- re-add the NOT NULL constraint, if applicable.

* Change author and add missing `dbms`

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>

* Add ts-pattern library (#43752)

* Add events to measure search performance (#43135)

* new_search_query event

* Filters in object, search click event

* updating event schema

* type and event schema adjustments

* delete comments BE code

* adjusting tests

* PR feedback

* typos and spacing

* Fixup missing colors

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: SakuragiYoshimasa <ysrhsp@outlook.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
2024-06-10 22:13:47 +00:00
Aleksandr Lesnenko
8936df34fb fix bar normalized stacking breaks line charts (#43957)
* fix bar normalized stacking breaks line charts

* spec
2024-06-10 21:24:30 +00:00
Emmad Usmani
80d33f6869 remove unused timeseries interval (#43421)
* remove two year timeseries interval

* use two year instead of five year interval

* update binning e2e spec
2024-06-10 21:17:15 +00:00
Nemanja Glumac
c62003fff3 Fix the flaky "bookmark" E2E test (#43965)
* Fix the flaky "bookmark" E2E test

Resolves #43871

* Remove the `flaky` tag
2024-06-10 22:27:02 +02:00
Alexander Polyankin
f530b0fd31 E2E tests for temporal unit parameters (#43688) 2024-06-10 16:24:51 -04:00
lbrdnk
f971c42ada Add connection string parsing to Snowflake (#43923)
* Add connection string parsing

* Add test case with role suffixed key
2024-06-10 22:04:10 +02:00
metamben
be9740ca70 Enable Clojure logging in the browser (#43959)
Messages at INFO level and higher will appear in the browser console.
2024-06-10 22:39:47 +03:00
Uladzimir Havenchyk
dc4614151c [Dashboard] Replace automatic wiring of the cards with opt-in variant (#43827) 2024-06-10 22:19:17 +03:00
Nemanja Glumac
84fd549fff Fix "CC typing suggestion" E2E flake (#43956)
* Fix E2E flake "cc-typing-suggestion"

Resolves #43872

* Remove `@flaky` tag

* Improve the assertion
2024-06-10 20:34:46 +02:00
Cal Herries
a2f3d74950 Actually validate view_log.context matches ::view-log/context on insert (#43801) 2024-06-10 18:04:08 +00:00
Nemanja Glumac
121fe66f67 Fix flaky E2E test "sidebar should be resizable" (#43947)
* Fix flaky E2E test "sidebar should be resizable"

* Remove the `flaky` tag

* Remove unused intercept
2024-06-10 17:35:36 +00:00
Ivan Križnar
a297e9a6ad Fix scrollbar interaction in the custom expression suggestion list (#43837)
* Expose `ExpressionEditorSuggestions` ref

* Add popup ref

* Prevent popup being dismissed when active

* Update displayName
2024-06-10 19:08:15 +02:00
metamben
8609c02bb6 Bulk load data for can_run_adhoc_query and table metadatas (#43899) 2024-06-10 19:47:31 +03:00
Raphael Krut-Landau
46215d51fc Remove classnames (#43869) 2024-06-10 12:33:38 -04:00
Raphael Krut-Landau
752749f79e [Cache] Fix save button bug and several smaller issues (#43810) 2024-06-10 15:49:25 +00:00
Chris Truter
5fc87983ff Avoid guessing Liquibase table name (#43928) 2024-06-10 15:29:09 +00:00
Raphael Krut-Landau
b6dea77ab0 Use the metric icon for metrics (#43893)
Closes #43894
2024-06-10 10:48:26 -04:00
Anton Kulyk
f106ffa776 Fix stacked redirects to homepage dashboard crashing the app (#43836)
* Add repro test

* Move home selectors to `metabase/selectors/app`

* Prevent unnecessary redirects to home dashboard

* Rename

* Handle navbar home link

* Fix unit tests

* Fix navigating away from an archived dashboard

* Handle sub-root Metabase URLs
2024-06-10 15:30:07 +01:00
Chris Truter
2cf666d9af Rename 'direct' fields references to 'explicit' (#43823) 2024-06-10 13:58:41 +00:00
Cal Herries
67fec430a5 Change the uploads-enabled setting's visibility to internal (#43849) 2024-06-10 07:54:03 -06:00
Denis Berezin
7046fef3c4 feat(sdk): SDK theming part 5 - success, summarize, warning, white, text-white, bg-white (#43676)
* Migrate success

* Migrate summarize

* Migrate warning

* Migrate white

* Add colors to storybook

* Fix CI

* Fix CI

* Codereview fixes

* Convert warning color
2024-06-10 16:34:51 +03:00
Jeff Bruemmer
88734ca33c note on locked filters (#43886) 2024-06-10 08:34:32 -04:00
Kamil Mielnik
897a22f298 Time-over-time comparison - e2e tests (#43724)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Add tracking helpers

* Add new schema

* Add tracking in column header

* Add tracking in plus modal

* Add tracking in aggregation picker

* Fix destructuring

* Add functionsUsedByExpression

* Fix schema number

* Add tests boilerplate

* Implement test for notebook editor

* Add test for column header

* Add a test for summarize sidebar

* Add a test for the plus button

* Add expectNoBadSnowplowEvents call in afterEach

* Format code

* Add missing redux store state in tests

* Add data for tests

* Move createQuestion call out of beforeEach

* Add tests for labels when there are no aggregations

* Add describe

* Add group helper

* Revert "Add group helper"

This reverts commit e047a223e9.

* Optimize: use cy.log() instead of it()

* Format code

* Add tests for 1 breakout, add helpers

* Add test for non-binned datetime column text

* Add test for non-datetime column text

* Nest tests

* Add test for multiple aggregations and no breakout, fix getTitle in this case

* Add all text tests

* Reduce nesting

* Enable test

* Format code

* Add tests

* Rename function

* Format code

* Simplify code

* Add assertions

* Format code

* Add column assertions

* Run tests with all 3 aggregations

* Remove logs

* Introduce CUSTOM_EXPRESSIONS_USED

* Avoid force click

* Remove explicit assertion

* Use be.visible instead of exist

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-10 11:56:46 +00:00
Ngoc Khuat
35b8b8b814 Fix flaky skip-if-empty-test by making sure pulse card follow ordres (#43913) 2024-06-10 08:05:22 +00:00
Uladzimir Havenchyk
8f399a1b3e Replace deprecated option from typescript v5 with eslint rule (#43767) 2024-06-10 10:43:50 +03:00
Ngoc Khuat
7b919f8b27 Task history sorted by started at (#43809) 2024-06-10 06:17:16 +00:00
Ngoc Khuat
51098a6cfa If there is an error in sync processes, make sure we catch the right exception (#43821) 2024-06-10 05:39:12 +00:00
Jesse Devaney
c93403e98f Fix stacked bar chart tool-tips when total value is negative (#43883)
* fix stacked bar chart tooltips when total value is negative

* add E2E test
2024-06-10 03:01:19 +00:00
Nick Fitzpatrick
92242d99b0 43475 command palette icon tweaks (#43652)
* Initial commit

* unit test, always white on active

* Run Prettier 🙄

* removing yellow color from verified model icon

* linter and type fix
2024-06-09 10:14:10 -06:00
Nick Fitzpatrick
7f4fd36b4e Refresh on login when user locale is different from site locale (#43775) 2024-06-09 09:08:28 -06:00
Braden Shepherdson
522b0df40a [MBQL lib] Move the field_ref matching hack from #43848 (#43902)
I'm not sure it's any less hacky in the CLJS but it keeps the TS
wrappers thin.

Context:
- #43799 is the original issue
- #43848 added the hack being removed here
2024-06-08 11:15:33 -04:00
Aleksandr Lesnenko
85ba3ac755 add line symbol on hover (#43887) 2024-06-07 21:04:57 -03:00
Ryan Laurie
f54fd3b1b6 Combine actions e2e specs (#43846) 2024-06-07 17:07:37 -06:00
Alexander Polyankin
6dff2dfe7e Fix parameter mapping with models (#43848) 2024-06-07 22:47:49 +00:00
Raphael Krut-Landau
74500ba310 Micro-edit: spaces not white spaces (#43860)
This PR simplifies a bit of text used in the cache cron schedule component: we can say "spaces" (which is normal English) not "white spaces" (which is developerese)
2024-06-07 18:07:33 -04:00
Raphael Krut-Landau
4e81aed3fb Fix unit test (#43895) 2024-06-07 18:02:03 -04:00
Aleksandr Lesnenko
f307977168 reset series displays when changing card display (#43868) 2024-06-07 21:12:41 +00:00
Nemanja Glumac
1d904a7eff Use params instead of body in RTK Query GET requests (#43786)
Resolves #41511
2024-06-07 22:59:50 +02:00
Jeff Bruemmer
9e191a48e6 docs - line charts updates (#43845) 2024-06-07 20:59:21 +00:00
Raphael Krut-Landau
95adc26b34 recents (#42138) 2024-06-07 16:28:10 -04:00
Raphael Krut-Landau
1b164bf49d [Browse] Remove Metabase analytics models from Browse models (#43778)
Closes #43251
2024-06-07 16:24:24 -04:00
Noah Moss
2cb5dd1919 Move around audit content to make perm checks more consistent + general cleanup (#43693) 2024-06-07 15:52:45 -04:00
Nemanja Glumac
19e92f3ee0 Use RTK Query to obtain task/job information (#43798)
* Type `TaskInfo`

* Re-write `JobInfoApp` to use RTK Query

* Re-write `JobTriggersModal` to use RTK Query

* Remove unused `fetchJobInfo` action

* Remove `TaskApi` from `services.js`

* Remove `JobApp` styled component

* Simplify fetching logic
2024-06-07 19:20:50 +00:00
Nemanja Glumac
bbde8ff568 Upgrade @testing-library/cypress to v10.0.2 (#43842) 2024-06-07 21:03:32 +02:00
Jeff Bruemmer
e34d653777 docs - update upload setting metadata (#43855) 2024-06-07 19:01:01 +00:00
Sloan Sparger
296636e5a6 Fix CloudPanel unit flake (#43856) 2024-06-07 18:36:20 +00:00
Raphael Krut-Landau
9f27f3775f Fix typo (#43808)
Fixes a small typo
2024-06-07 14:35:18 -04:00
Mahatthana (Kelvin) Nomsawadi
dfdaab03b3 ci(sdk): Automate merging SDK doc PR (#43751)
* Automate SDK doc PR

* Prevent auto merge

* Dry run npm publish for testing

* Speed up testing by not building jars

* Fix auto approve step

* disable concurrency so I could test multiple runs in parallel

* Test auto-merge

* Fix auto merge

* Revert "disable concurrency so I could test multiple runs in parallel"

This reverts commit 60e90076eb.

* Revert "Speed up testing by not building jars"

This reverts commit 4e53a54414.

* Revert "Dry run npm publish for testing"

This reverts commit 9b5d761c8d.

* Enable all commented out steps

* Remove unnecessary steps
2024-06-07 17:18:14 +01:00
github-automation-metabase
e13c64ec2c Update Readme version references and published npm version to 0.1.8 (#43832) 2024-06-07 16:56:25 +01:00
Mahatthana (Kelvin) Nomsawadi
905625eb5a ci(sdk): Ensure we append new release to the chaneglog instead of overwriting it. (#43729)
* Mock that the changelog is different from the one in master

* Apply changelog patch incase the changelog is created from another branch

* Dry run npm publish so I could test

* Fix failed patch

* Speed up testing by not building jar

* Fix adding new changelog to master

* feat(sdk): A placeholder for an actual feature in the changelog

* Mock that the changelog diverges from master

* Revert "Speed up testing by not building jar"

This reverts commit acb80d7465.

* Revert "Dry run npm publish so I could test"

This reverts commit f4e679efd9.

* Revert "Mock that the changelog diverges from master"

This reverts commit 0e77a68e1b.
2024-06-07 16:15:53 +01:00
Phoomparin Mano
40d11066a9 Customize dashboard, dashcard and question background color for embedding SDK (#43618)
* dashcard background color

* add bg-dashboard and bg-dashboard-card

* rename background-visualization to background-question

* apply bg-question to embedded questions

* use CSS variables along with theme object

* add css variables to more places

* add ability to reference design system colors for defaults

* use CSS variables for defaults

* fix chart skeleton test

* fix legend item title
2024-06-07 22:07:27 +07:00
Alexander Solovyov
33df115357 [sync] parse naked json values (#43812) 2024-06-07 17:42:16 +03:00
Alexander Polyankin
2b01d9fd3c Remove unused containers/DataPicker (#43802) 2024-06-07 10:31:49 -04:00
Ryan Laurie
4520bf9324 Run smaller smoke test suite for pre-release check (#43633)
* run smaller smoke test suite for pre-release check

* fix run command
2024-06-07 08:14:12 -06:00
Alex Yarosh
0d4c0e7850 format sql (#43753) 2024-06-07 09:59:32 -04:00
Romeo Van Snick
ceeac2912c Merge combine column components (#43593)
* Move expressionClause to handleSubmit

* Allow passing the first column as a prop and allow auto picking of columns

* Use CombineColumns component in header drills

* Remove duplicate CombineColumnsDrill component and helpers

* Allow separators to be null

* Calculate example in Example component to avoid useMemo call

* Fix test reference in test

* Append suffix to duplicate columns

* Rename parameter to something more expressive

* Enable autoPickColumn for all instances of the combine column popover

* Fix tests

* Fix notebook tests

* Make test typescript

* Correct types of openTable function
2024-06-07 12:38:56 +02:00
Mahatthana (Kelvin) Nomsawadi
dd30ead9a8 Add single CORS origin limitation (#43805) 2024-06-07 09:08:21 +00:00
Cal Herries
3c97497126 Change MySQL ENUM columns to have base_type=type/TextLike (#43533) 2024-06-06 22:10:17 -06:00
Nemanja Glumac
25c4cb0bd8 Fix milestone reminder (#42861)
* Add a helper to extract linked issues from PR body

* Add tests

* Tweak the workflow

* Fix the workflow

* Delete obsolete code

* Improve the message

* Fix whitespace error
2024-06-07 00:44:55 +02:00
Jesse Devaney
f54e3d5a76 Fix RowChart X-Axis ticks formatter (#43783)
* fix RowChart XAxis ticks formatter

- remove scaling from x-axis tick values like we did for y-axis tick values in ECharts charts

* add loki variant
2024-06-06 18:26:54 -04:00
Jesse Devaney
486e3370af hide "show_series_values" setting when "show_values" setting is disabled (#43785) 2024-06-06 21:54:35 +00:00
Ryan Laurie
1e50d9f3a8 Send more tests to flake jail (#43761)
* mark more tests as flaky

* all the flakes
2024-06-06 15:40:05 -06:00
Aleksandr Lesnenko
e3f166bf7b fix timeline events covers series (#43780) 2024-06-06 21:00:03 +00:00
Nick Fitzpatrick
6d0f5e69d6 Add events to measure search performance (#43135)
* new_search_query event

* Filters in object, search click event

* updating event schema

* type and event schema adjustments

* delete comments BE code

* adjusting tests

* PR feedback

* typos and spacing
2024-06-06 17:40:27 -03:00
Sloan Sparger
c7048cf89e Add ts-pattern library (#43752) 2024-06-06 14:58:18 -05:00
SakuragiYoshimasa
49b126efcd Fix remaining tinyint booleans in MySQL (#43296)
* Correct type for `report_card.dataset`

This was missed in the original migration of boolean types to
${boolean.type} in MySQL/MariaDB, and then missed again by me when I
migrated `collection_preview` over a week ago.

* Change all boolean types to `bit(1)` in MySQL

Liquibase changed their boolean type in MySQL from `bit(1)` to
`tinyint(4)` in version 4.25.1. Our JDBC driver does not recognize these
as booleans, so we needed to migrate them to `bit(1)`s.

As discussed [here](#36964), we
changed all existing `boolean` types that were in the
`001_update_migrations.yml` but not the SQL initialization file.

For new installations, this works: things in the SQL initialization file
get created with the `bit(1)` type.

However, for existing installations, there's a potential issue. Say I'm
on v42 and am upgrading to v49. In v43, a new `boolean` was added.

In this case, I'll get the `boolean` from the liquibase migration rather
than from the SQL initialization file, and it need to be changed to a
`bit(1)`.

I installed Metabase v41 with MySQL, migrated the database, and then
installed Metabase v49 and migrated again. I made a list of all the
columns that had the type `tinyint`:

```
mysql> SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_TYPE,        COLUMN_DEFAULT, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_TYPE = 'tinyint' AND TABLE_SCHEMA='metabase_test';
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| TABLE_SCHEMA  | TABLE_NAME                   | COLUMN_NAME       | COLUMN_TYPE | COLUMN_DEFAULT | IS_NULLABLE |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| metabase_test | core_user                    | is_datasetnewb    | tinyint     | 1              | NO          |
| metabase_test | metabase_field               | database_required | tinyint     | 0              | NO          |
| metabase_test | metabase_fieldvalues         | has_more_values   | tinyint     | 0              | YES         |
| metabase_test | permissions_group_membership | is_group_manager  | tinyint     | 0              | NO          |
| metabase_test | persisted_info               | active            | tinyint     | 0              | NO          |
| metabase_test | report_card                  | dataset           | tinyint     | 0              | NO          |
| metabase_test | timeline                     | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline                     | default           | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | time_matters      | tinyint     | NULL           | NO          |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
10 rows in set (0.01 sec)
```

Then wrote migrations. For each column, we:

- turn it into a `bit(1)`,

- re-set the previously existing default value, and

- re-add the NOT NULL constraint, if applicable.

* Change author and add missing `dbms`

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-06-06 21:55:33 +02:00
Nemanja Glumac
2473fa2f8b Remove old repro for 39150 (#43749) 2024-06-06 21:53:50 +02:00
Phoomparin Mano
ea2d0a7e03 Highlight the table cell data in dashboards when the cell is an ID column (#43728)
* highlight id cell column

* add simpletable stories

* add simple table test data

* add loki reference image

* Update frontend/src/metabase/visualizations/components/TableSimple/TableCell.styled.tsx

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

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-06-07 02:20:44 +07:00
Ryan Laurie
8cb8d6405d Combine search e2e specs (#43718) 2024-06-06 12:05:33 -06:00
Raphael Krut-Landau
df62bb0cb4 Remove dead code (#43603) 2024-06-06 13:56:09 -04:00
Raphael Krut-Landau
e199d76e6f Fix width of save button in cache sidebar (#43755) 2024-06-06 13:53:02 -04:00
lbrdnk
4a88a0c86a Move database role to url parameters from connection properties on Snowflake (#43602)
* Move role to url parameters from connection properties

* Fix test
2024-06-06 19:34:06 +02:00
Ryan Laurie
2cdae6bc9a Update translations for v50 and add Danish Language Support (#43314)
* update translations for v50

* add Danish

* update translations for v50 release

* alphabetical order is nice
2024-06-06 17:30:05 +00:00
Ryan Laurie
7a9767e110 Consolidate joins specs (#43717) 2024-06-06 11:14:54 -06:00
Ryan Laurie
3d1cbd3b8e Consolidate dashboard-card specs (#43716) 2024-06-06 11:14:43 -06:00
metamben
8eeacc60c4 Hydrate can_run_adhoc_query and address review comments (#43747)
This is a followup on #43625.
2024-06-06 20:07:30 +03:00
adam-james
b8907454c9 Multi Series Dashcards Render with Filters Applied To All Series (#43428)
* Multi Series Dashcards Render with Filters Applied To All Series

Fixes: #39083

Multi-series dashcards now properly render when a subscription is set up with filters that impact the values of each
card in the multi-series card.

* Small refactor for executing dashcards in a pulse context.

- move execute-dashboard-subscription to pulse.util
- this fn now will also execute all card series cards
  and put those results into a list on the key :series-results in the dashcard
  which is then used in the render multimethod to send the correct data to the javascript context

A small todo was taken care of as well, we can now use :dashboard-subscription in the :context key

* Fix up render fn

The shape of hte data going into the javascript was a bit unclear before. This keeps things a little more
understandable.

Next step is probably to create some Malli schemas inside the js_svg namespace to document and enforce the needed data shapes

* pull :data up a level from :result in the series cards

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

* Remove unneeded let

* set/rename-keys won't work here because we raise the :data key

I've realised a suggested change to just use set/rename-keys won't do what we need. We need instead to raise :data
from within the result key up to the same level (and dissoc result).

I've renamed the helper function to make its purpose a bit clearer

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-06-06 09:58:58 -07:00
Alex Yarosh
60bb8d6158 update list of releases (#43754) 2024-06-06 12:44:51 -04:00
Ryan Laurie
5a481f98b8 use correct github api for CI (#43750) 2024-06-06 10:12:51 -06:00
Sloan Sparger
18d5388de0 Upgrade to TypeScript v5.4 (#43736) 2024-06-06 11:04:10 -05:00
Raphael Krut-Landau
080efbc837 [Browse] Show Browse models link in nav only when there are models (#43286) 2024-06-06 15:43:15 +00:00
Aleksandr Lesnenko
b9c10c5178 make compact formatting consistent across all series (#43472)
* make compact formatting consistent across all series

* fix rebase
2024-06-06 15:32:32 +00:00
metamben
2bfaab28e6 Batch load card metadata (#43625) 2024-06-06 11:04:46 -04:00
github-automation-metabase
56b3b5054f Update Readme version references and published npm version to 0.1.7 (#43734) 2024-06-06 16:04:34 +01:00
Mahatthana (Kelvin) Nomsawadi
3164995660 Reference new Metabase 50 RC version (#43735) 2024-06-06 15:26:14 +01:00
Ngoc Khuat
13e51d4ecc add mt/inbox as testing context for test helpers' (#43731) 2024-06-06 21:22:00 +07:00
Alexander Solovyov
74e524c057 do not output exceptions used only for tests (#43723) 2024-06-06 17:03:06 +03:00
Jeff Bruemmer
18581104b9 docs - models and caching (#43681) 2024-06-06 09:45:08 -04:00
Ryan Laurie
01840901fe Backport reminder bot (#43637)
* WIP backport reminder bot

* polish and automate backport reminder

* do better english
2024-06-06 07:12:46 -06:00
Ryan Laurie
4b66bdbabc Fix OSS tests in CI (#43660)
* fix OSS tests in CI

* update tests that went on vacation for a while

* do safer cypress things

* better helper name
2024-06-06 07:02:46 -06:00
Oisin Coveney
b87281c531 Update README to reflect API changes in Static Dashboard (#43727) 2024-06-06 13:00:09 +00:00
Alexander Polyankin
855c840bc2 Fetch ad-hoc query metadata on the BE (#43675)
* adhoc-query-metadata

* Get ad-hoc query metadata from the BE

* Fix broken ad-hoc queries

* Fix broken ad-hoc queries

* Fix tests

* Add a test

* Add tests

* Add tests

* Fix whitespace

* Fix whitespace

* Fix tests
2024-06-06 07:13:19 -04:00
Kamil Mielnik
49360f68bf Analytic events for time-over-time comparison (#43589)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Add tracking helpers

* Add new schema

* Add tracking in column header

* Add tracking in plus modal

* Add tracking in aggregation picker

* Fix destructuring

* Add functionsUsedByExpression

* Fix schema number

* Add tests boilerplate

* Implement test for notebook editor

* Add test for column header

* Add a test for summarize sidebar

* Add a test for the plus button

* Add expectNoBadSnowplowEvents call in afterEach

* Format code

* Add missing redux store state in tests

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-06 18:03:32 +07:00
Kamil Mielnik
54d9fb2257 Time-over-time comparison - Unit tests (#43653)
* Use createQueryWithClauses in createQueryWithCountAggregation

* Support column-specific aggregations in createQueryWithClauses

* Add tests for compare option presence

* Fix case

* Add a test for onAdd

* Split tests

* Rename tests

* Add boilerplate for CompareAggregations unit tests

* Fix assertion

* Add more tests

* Add offset input tests

* Add tests

* Update frontend/src/metabase/query_builder/components/CompareAggregations/CompareAggregations.unit.spec.tsx

* Update tests after merge

* Use constants instead of factory functions
2024-06-06 07:44:54 +00:00
Mahatthana (Kelvin) Nomsawadi
ac6bb7b452 Followed-up tasks for changelog generation (#43656)
* Check git tag for an exact match

* Set npm publish to dry run, so I can test

* Uses new github automation account for creating a PR

* Remove unnecessary step

* Automatically set `no-backport` on the SDK doc version bump PR

* Fix step to edit PR with correct permission

* Remove npm dry run after finished testing
2024-06-06 08:42:24 +01:00
Denis Berezin
e430b776e3 feat(sdk): SDK theming part 4 - danger, dark, error, filter, focus, saturated, shadow (#43608)
* Migrate danger

* Migrate dark

* Migrate error

* Migrate filter

* Migrate focus

* Migrate saturated

* Migrate shadow

* Fix CI

* Fix CI

* Fix CI
2024-06-06 03:26:18 +03:00
metamben
0ade074b53 Remove serdes support for legacy metrics (#43272) 2024-06-05 23:17:17 +00:00
Ryan Laurie
7789ce34bf move github-slack-map to fix release script build (#43692) 2024-06-05 21:48:57 +00:00
Denis Berezin
6fcbf23e54 feat(sdk): SDK theming part 3 - brand, brand-light, brand-lighter (#43598)
* Migrate brand

* Migrate brand-light, brand-lighter

* Fix unit tests

* Code review fixes

* Fix CI
2024-06-06 00:17:00 +03:00
Jesse Devaney
6ac4fe977f Fix column scaling ("Multiply by a number") bugs (#43668)
* return empty string so non-empty labels do not get hidden by empty labels

* fix function name

* apply scaling in transformed dataset

* add missing option to OptionsType

* fix double scaling

* add column scaling to waterfall transformed dataset

* add column value scaling to dataset transform

* fix stacked bar segment labels not responding to column scaling

* fix tooltip values displayed

* since scaling as added to transformedDataset, use transformedDataset for formatters

* revert changes to display percentage instead of absolute value

* fix stacked data labels

* add loki variant for custom y-axis range with column scaling

* fix stack segmented label formatters compact calculation

* scale original dataset and use that instead of modifying transformedDataset

* update loki snapshots

* fix scatter plot dataset scaling

* fix tooltip values being double scaled

* add E2E test to validate behavior

* add helper for not duplicating the column scaling

* port multiple y-axis metrics with column scaling fixes to RowChart

* add waterfall and scatterplot loki variants

* fix type errors and failing unit tests

* fix failing unit tests

* update loki snapshots
2024-06-05 16:47:49 -04:00
Nemanja Glumac
5bf50a2131 Add E2E reproduction for #39150 (#43610)
* Add E2E reproduction for #39150

* Fix typo in the test title

* Move the viewport config to the `describe` block

* Add the second repro scenario as per the review comment

* Scope the variable to the relevant test
2024-06-05 22:47:38 +02:00
Anton Kulyk
c7c5b3568b Fix long field names handling for series names and in the model editor (#43394)
* Fix long names in model editor

* Fix long names in series name input
2024-06-05 19:04:01 +00:00
Alexander Polyankin
13aae6632d Performance fix for getUrlWithParameters when there are no parameters (#43626)
* Simple performance fix for getUrlWithParameters

* Fix tests
2024-06-05 14:50:55 -04:00
Jeff Bruemmer
f05fa8e607 column heading options (#43409) 2024-06-05 14:09:09 -04:00
Dennis Schridde
937e30fbed Expose attached-dwh token feature flag to frontend (#43657)
This allows frontend code to conveniently check whether the feature
flag is enabled or disabled.  This is in addition to the raw flag's
presence (or absence) in `(:features token-status)`.

References: https://github.com/metabase/metabase/issues/42381
References: https://github.com/metabase/metabase/pull/43511
2024-06-05 19:55:17 +02:00
Denis Berezin
8659846f0b feat(sdk): SDK theming part 2 - bg-error, bg-medium, bg-night, bg-white, border (#43512)
* Migrate bg-error

* Migrate bg-medium

* Migrate bg-night

* Migrate bg-white

* Migrate border

* Fix CI

* Fix unit tests

* Fix unit tests

* Code review fixes

* Code review fixes
2024-06-05 20:26:09 +03:00
Chris Truter
50e4cf7798 More wiring and documentation around Macaw (#43580) 2024-06-05 17:02:05 +00:00
Chris Truter
2a260cc9ff Demonstrate nesting dynamic redefines (#43496) 2024-06-05 18:42:52 +02:00
Kamil Mielnik
f61a065796 Previous period comparison shortcut in chill mode - column headers (#43500)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Fix destructuring

* Fix tests

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-05 15:53:51 +00:00
Oisin Coveney
5c5f6c39a1 fix(sdk): Fix static dashboard API (#43581) 2024-06-05 18:36:47 +03:00
Ryan Laurie
a691754a94 Add team devex (#43662)
* Add DevEx to team.json

* no trailing commas in json
2024-06-05 09:20:47 -06:00
Ryan Laurie
7251aa834c Put New Tests in Flake Jail + Parole Well Behaved Tests (#43623)
* tag flakiest tests as such

* let well behaved tests out of flake jail

* more bad actors off the streets

* add another flake

* sandboxes re-offended already
2024-06-05 07:40:45 -06:00
Alexander Polyankin
f28991450a Temporal unit parameters in dashboards (#43212) 2024-06-05 08:39:31 -04:00
Aleksandr Lesnenko
f025758d8f Set min bar height for non-zero bars (#43485)
* set min bar height for non-zero values

* fix y-axis split logic uses transformed dataset instead of actual data
2024-06-05 11:41:28 +01:00
Aleksandr Lesnenko
0fb138af86 Fix RowChart shrinks on hover (#43634)
* fix memoization

* extend the basic row chart e2e spec
2024-06-05 11:22:43 +01:00
Tim Macdonald
4ec415a024 Use a more obvious test error message (#43642)
(When scrolling through CI logs I always do a double-take when I see a
huge stack trace with "Just an error". I think this is a little
clearer?)
2024-06-05 10:15:18 +00:00
Oisin Coveney
7c636450c2 Convert Pagination Controls to TS (#43586) 2024-06-05 13:04:25 +03:00
Ngoc Khuat
b561b0111c Add inbox as testing context to debug flaky pulse tests (#43570) 2024-06-05 09:36:07 +00:00
Mahatthana (Kelvin) Nomsawadi
44fb3171f4 Fix flaky interactive-embedding.cy.spec.js (#43588)
* Fix flaky test

* Fix the flake for real

* Fix stress test failing because of mismatched height

* Review: Move viewport setting to shared config
2024-06-05 08:01:36 +00:00
Alexander Solovyov
1e4fe0f1b8 [cache] config should be editable if entity is accessible (#43522) 2024-06-05 08:35:41 +03:00
Ryan Laurie
03d60d8fed Make Backports Automerge Again (#43635) 2024-06-05 01:14:28 +00:00
Sloan Sparger
b97d9791ec uses data-autofocus attribute to avoid mantine modal moving focus to the modal close button (#43546) 2024-06-04 18:07:48 -05:00
Ryan Laurie
75fbccb765 Consolidate permissions e2e specs (#43552) 2024-06-04 15:52:39 -06:00
Ryan Laurie
68938adb0c Consolidate custom column e2e specs (#43616) 2024-06-04 15:52:00 -06:00
Ryan Laurie
fa0cf11b25 Combine e2e native filter specs (#43527)
* consolidate e2e native filter specs

* fix helper

* fix runQuery call
2024-06-04 15:51:47 -06:00
Ryan Laurie
590be77299 Consolidate dashboard e2e specs (#43613)
* consolidate dashboard e2e specs

* fix import
2024-06-04 15:51:35 -06:00
Ryan Laurie
ce5b1cfe2f Consolidate chart viz e2e specs (#43619) 2024-06-04 15:51:17 -06:00
Ryan Laurie
384af8167e Release from tagged test jars (#43545)
* allow releasing from tagged test jars

* always listen to nemanja

* use java 17
2024-06-04 15:29:55 -06:00
Jeff Bruemmer
5b5b05973e docs - license step (#43534) 2024-06-04 16:55:58 -04:00
Phoomparin Mano
9d61985fcc feat(sdk): font size scaling and adjustment for visualizations (#43264)
* support test utilities in sdk import

* add relative unit default chart font size in embedding defaults

* make font size follow sdk root

* feat(sdk): add font size settings to axis ticks

* feat(sdk): add font size settings to series labels

* re-add hasTimelineEvents from merge commits

* apply default font size at the theme level

* add table header cell font size

* calculate cell font size based on 12.5px

* rename theme.chart to theme.cartesian

* refactor visualization theme

* refactor default viz theme

* remove chart style config

* add goal line

* pass font size to chart measurements

* use px as reference unit

* support row chart viz

* add missing echarts font size

* add table cell font sizes

* use css variables for funnel color

* fix theme type in smart scalar story

* add bar chart to storybook for visual test

* add line chart to storybook for visual test

* add loki reference images

* add loki reference images for row chart

* add loki shared reference images to stories filter

* update loki reference image

* synchronize base font size

* add theme provider to funnel test setup

* add missing default visualization theme

* add unit test for get size in px

* update loki reference image

* fix static viz build error
2024-06-05 03:36:49 +07:00
Nick Fitzpatrick
7d0357d983 remove modified padding on ellipsifyed sidebar items (#43585) 2024-06-04 17:21:27 -03:00
Aleksandr Lesnenko
a727faddda loki CI improvements (#43607) 2024-06-04 15:49:00 -03:00
Jeff Bruemmer
d9aaa9fd43 docs - caching updates (#42857) 2024-06-04 13:25:10 -04:00
Case Nelson
cefd7a61e8 Add can_run_adhoc_query to Card hydration (#43464) 2024-06-04 11:04:03 -04:00
Jeff Bruemmer
c5404ea285 Docs env var info (#43150) 2024-06-04 14:43:18 +00:00
Raphael Krut-Landau
8b6a4c966e [Browse] Add brand-colored dot to filter icon when the filter is active (#43350)
Closes #42964
2024-06-04 10:33:42 -04:00
Ryan Laurie
91b4bd6b34 Add build requirements for v50 (#43537) 2024-06-04 08:07:11 -06:00
Ryan Laurie
d53b0a7a80 Consolidate sharing e2e specs (#43514) 2024-06-04 08:06:49 -06:00
Nicolò Pretto
fea8f89a57 temporarily removes the SameSite=None suggestion box (#43524)
* temporarily removes the SameSite=None suggestion box

* fix copy
2024-06-04 13:05:06 +02:00
Oisin Coveney
ecad0c94b5 fix(sdk): Fix map visualizations breaking (#43491) 2024-06-04 13:43:26 +03:00
dependabot[bot]
237a663b3a Bump mysql2 from 3.9.7 to 3.9.8 (#43446)
Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.9.7 to 3.9.8.
- [Release notes](https://github.com/sidorares/node-mysql2/releases)
- [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md)
- [Commits](https://github.com/sidorares/node-mysql2/compare/v3.9.7...v3.9.8)

---
updated-dependencies:
- dependency-name: mysql2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-06-04 11:18:03 +01:00
Kamil Mielnik
0da1dd1662 Previous period comparison shortcut in chill mode - "+" button (#43493)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Do not navigate to chart view

* Add type attribute to all ListItems
2024-06-04 09:53:55 +00:00
Kamil Mielnik
6763b13cfc Update dead jetty docs links (#43573)
* Update dead jetty docs link

* Update dead jetty docs link
2024-06-04 16:43:22 +07:00
Nicolò Pretto
816e1b0dbc refactor public/embed reducers and related code (#43495)
* move parameters and dashboard reducers to the common ones as they're used everywhere

* convert reducers-{common,main,public}.js to typescript, done with --no-verify

* convert reducers to named exports
2024-06-04 10:39:00 +02:00
Kamil Mielnik
3305c815b0 Previous period comparison shortcut in notebook mode (#43220)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Add type attribute to all ListItems
2024-06-04 08:15:47 +00:00
Raphael Krut-Landau
2f0bc49783 [Browse] Don't show filter icon when no models have been verified (#43284)
On the Browse models page we have a filter icon which opens a popover with a switch that toggles "Show only verified models". With this change, the icon is not rendered if there are no verified models at all.
2024-06-03 22:21:22 -04:00
Raphael Krut-Landau
85e113420d [Browse] Unify breadcrumbs into one link (#43313)
* [Browse] Unify breadcrumbs into one link

* Avoid !important
2024-06-03 22:08:48 -04:00
Aleksandr Lesnenko
95d4179e28 Amend stack values labels control copy (#43553) 2024-06-04 01:53:49 +00:00
Emmad Usmani
9c7e96a857 fix data labels under trend/goal lines (#42928)
* fix data labels under trend/goal lines

* fix fontFamily missing

* update specs

* fix type errors

* snapshots

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-06-03 22:09:06 +00:00
Cal Herries
9f73b0ceb8 Skip fingerprinting or scanning field values for fields with base_type=type/* (#43483) 2024-06-03 15:49:13 -06:00
Jeff Bruemmer
12e25b65a1 notes and links to relevant docs (#42975) 2024-06-03 16:56:24 -04:00
Jeff Bruemmer
3206c87a61 docs - druid jdbc and json unfolding (#43267) 2024-06-03 16:49:34 -04:00
Sloan Sparger
4c2aed648f Fix bulk action delete button hover contrast (#43518) 2024-06-03 15:19:31 -03:00
Ryan Laurie
f10ab55f8a Combine tabular viz e2e specs (#43519) 2024-06-03 11:34:07 -06:00
Nemanja Glumac
97fe4c437c Use actions/checkout@v4 everywhere (#43525) 2024-06-03 19:14:01 +02:00
Nemanja Glumac
34b6159658 Use actions/github-script@v7 everywhere (#43526) 2024-06-03 19:13:43 +02:00
Aleksandr Lesnenko
cb4264c6b3 measure auto compactness on correct values (#43477)
* measure auto compactness on correct values

* snapshots
2024-06-03 16:22:33 +00:00
Cal Herries
5c8de49521 Don't throw an exception when a non-existent setting is in the config file (#43425) 2024-06-03 09:44:32 -06:00
Cal Herries
6bf7bfca9a Catch exceptions from driver/database-supports? outside driver code (#43429) 2024-06-03 09:44:06 -06:00
Denis Berezin
d228123152 feat(sdk): SDK theming part 1 - black, bg-light, bg-dark, bg-black (#43413)
* Convert black

* Convert bg-light

* Convert bg-dark

* Convert bg-black

* Fix CI

* Fix CI

* Fix tests

* Update visual test fixtures

* Fix visual tests
2024-06-03 18:29:33 +03:00
Ryan Laurie
32011873b1 Tag slack users by github handle (#43420)
* tag slack users by github handle

* sort users
2024-06-03 08:49:29 -06:00
Aleksandr Lesnenko
d19ad598b2 fix stacked data labels on ordinal charts (#43469) 2024-06-03 11:20:53 -03:00
Chris Truter
fa90376b08 Populate Macaw options based on database type (#43460) 2024-06-03 16:06:16 +02:00
Noah Moss
2c3c328472 Populate collection search results with effective parent (#43331)
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-06-03 09:55:59 -04:00
Kamil Mielnik
81621016d4 Revert "Copy question link from dashboard (#42892)" (#43499)
This reverts commit e7948a7249.
2024-06-03 13:49:35 +00:00
Nemanja Glumac
d67f3f5d99 Fix invalid input in the "build for release" action (#43492) 2024-06-03 13:28:37 +02:00
Ngoc Khuat
03d5dec982 Fix mariadb failed to migrate due to having deep nested revision (#43434) 2024-06-03 05:23:54 +00:00
Jesse Devaney
72443c62b1 Fix data labels too dense with large single series (#42985)
* remove unused variable

* conditionally render labels sparsely if large amount of data points

* update loki snapshots

* refactor data label formatter conditions

* setup intelligent label plotting

* handle the case when there are no labels

* add sparse data label rendering to bar charts

* do not compute if no labels need to be shown or hidden

* add sparse data labeling to waterfall charts

* adjustment for large series waterfall labels

* revert change

* refactor name

* add sparse labels to stacked bar and area

* improve scaleFactor

* fix type errors

* remove unused labelFormatter

* update snapshots

* patch ECharts

- labels with no text, i.e. "", were still being considered as plot-able labels which was causing labels with real text "asdfec.." to be hidden because of overlap.
- This patch makes it so that labels with no text, i.e. "", are not considered to be candidates for overlap checking.

* update loki snapshots

* only loop over dataset once for getWaterfallChartDataDensity

* improve performance of chart data density calculations

* update loki snapshots

* update E2E spec

* update E2E spec

* increase cartesian label density allotment

* update loki snapshots

* update loki snapshots

* comment out node_modules cache since it cannot be skipped by commit and is breaking CI

* fix type errors

* Reset node modules if patches are changed

* refactor type naming

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-01 06:05:22 +00:00
Cal Herries
2c1333ebb6 Only log views for cards in a dashboard if the user views the tab (#43102) 2024-05-31 17:51:41 -06:00
Case Nelson
68435f9091 Single metadata endpoint for cards (#43405) 2024-05-31 23:32:44 +00:00
Sloan Sparger
d5280c6bcf Fixes LDAP admin settings form not allowing modification if a custom port is set (#43476) 2024-05-31 23:26:37 +00:00
Ryan Laurie
7038b2e4c2 Combine Filters Reproduction into new e2e job (#43328)
* combine reproductions into new filters e2e job

* fix import

* gee thanks sloan
2024-05-31 14:16:40 -06:00
Cam Saul
3d0bc85a5b Kondo linter tests for :metabase/validate-logging (#43104)
* PoC Kondo linter test

* Log linter tests

* Remove fail-test
2024-05-31 20:12:28 +00:00
Vamsi Peri
a3f19cd8c5 Updated the QPD team board (#43466) 2024-05-31 18:02:31 +00:00
Chris Truter
70c1474c87 Handle MySQL quotes when resolving analyzed fields (#43447) 2024-05-31 17:42:30 +00:00
metabase-bot[bot]
6b59534f39 Update SDK version to 0.1.6 (#43457)
* Update Readme version references and published npm version to 0.1.6

* Update SDK Changelog

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alberto Perdomo <albertoperdomo@users.noreply.github.com>
2024-05-31 17:13:53 +00:00
Uladzimir Havenchyk
e5aa995590 Optimize dashcard rendering in edit mode (#43431)
* Avoid unnecessary re-renderings in dashcards

* replace useCallback with useMemo

* Optimize dashcard rendering in edit mode
2024-05-31 16:58:12 +00:00
Ryan Laurie
557e6ead6a Add Advanced Cache Upsell (#43099)
* add hook to check token features

* add cache upsell to performance page

* upsell cards are white

* fix rebase
2024-05-31 10:30:58 -06:00
Oisin Coveney
d711251a70 fix(sdk): Add Static Dashboards to README (#43392)
* fix(sdk): add Static Dashboards to README

* Add more clarification comments for API

* Clarify dashboard ID type

* Prevent crashing SDK static dashboard if not provided optional values

* Document fallback behavior for `font`

---------

Co-authored-by: Mahatthana Nomsawadi <mahatthana.n@gmail.com>
2024-05-31 16:12:28 +00:00
Uladzimir Havenchyk
55c00bdd90 Avoid unnecessary re-renderings in dashcards (#43323)
* Avoid unnecessary re-renderings in dashcards

* replace useCallback with useMemo
2024-05-31 18:33:28 +03:00
Kamil Mielnik
1947328ed9 Repro #37380 - Users with no self-service access may update pivot tables and leave them in a non-working state (#43437)
* Fix crash and remove redundant casting

* Add repro for metabase#37380

* Be extra-safe with an empty array
2024-05-31 15:16:10 +00:00
Mahatthana (Kelvin) Nomsawadi
78db8c4916 ci(sdk): Autogenerate changelog on build (#43364)
* Auto tag embedding team for PR review + dry run npm publish

* Install changelog generation package

* Add the initial changelog

* feat(sdk): This is an empty commit. For testing purposes.

* Update SDk build script to include changelog

* Check if a tag exists

* Ensure changelog is in the released package

* Fix workflow

* Remove unnecessary step

* Ensure we can have access to release utils script when checking out master

* Fix the step to create a PR updating readme and changelog

* Fix changelog generation

* Fix couldn't download changelog

* Clean up steps
2024-05-31 16:03:06 +01:00
Emmad Usmani
c1f1d98381 remove accidental comment from scatterplot model (#43423) 2024-05-31 07:58:17 -07:00
Nick Fitzpatrick
ead905b105 React 18 (#41975)
* initial commit with most types sorted

* admin, binning, collections, custom-column and dashboard-cards suites

* Filters, Joins, Metrics, Models, Native and Native filters suites

* rest of e2e specs

* filters, actions, onboarding and custom column will hopfully be green?

* fixing static viz, brush filtering, login redirecting, and a few other tests

* types green

* linter green

* hopefully fixes filter tests

* I don't often cry, but when I do it's because of filter-types

* hopfully sorted the last test that's failing CI

* PR Feedback

* yarn prettier

* React 18 Upgrade - Unit Tests (#41577)

* fixes for most unit tests to work with react 18 + upgraded rtl to v15

* fixes all unit tests locally

* fixes from rebasing

* linter shames me

* fix flake in maps.cy.spec.js

---------

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-05-31 11:56:05 -03:00
Noah Moss
86b8825996 Bump nippy to 3.4.2 (#43444) 2024-05-31 14:50:01 +00:00
Romeo Van Snick
af6cecb863 Show the columns for the correct stage when using combine/extract in the presence of an aggregation (#43226)
* Do not use asReturned to determine columns for extractions and combine columns

* Add reproduction for #43226 for combine columns

* Add reproduction for #43226 for extract columns

* Remove commented out code

* Only render extraction shortcut when there are extractions

* Only render combination shortcut when there are combinations

* Use hasCombinations from CombineColumns

* Add hasExtractions from ExtractColumn

* Use appendStageIfAggregated over Lib.asReturned

* Only show combine column shortcut when there are two or more columns to be combined

* Lift appendStageIfAggregated to top-level drill

* Add test for extraction on table with just breakout

* Add test for combinations on table with just breakouts

* Disable the 2-column requirement for combinations

* Remove Lib.asReturned in appendStageIfAggregated

* Remove + 1 to stageIndex in appendStageIfAggregated

* Check for empty breakouts too in as-returned

* Switch back to Lib.asReturned

* Fix test for combine column on breakouts

* Reference the correct query and stageIndex

* add CLJS unit tests for as-returned with only aggs, breakouts

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-05-31 16:49:21 +02:00
Kamil Mielnik
9378e28ed4 Fix unit tests running multiple times in watch mode (#43445)
* Fix unit tests running multiple times in watch mode

* Ignore even more
2024-05-31 14:44:54 +00:00
Oisin Coveney
c3c65abdf0 #41973 Improvements + Convert PublicQuestion to TS (#43361) 2024-05-31 17:11:17 +03:00
Uladzimir Havenchyk
862ca7ea27 Optimize imports from collection (#43241) 2024-05-31 13:50:48 +00:00
Alexander Polyankin
780532543c Move loading of linked targets metadata to the BE (#43380) 2024-05-31 09:26:44 -04:00
metamben
3b6def1eb7 Support string operations on postgres UUIDs (#43417)
Fixes #40176.
2024-05-31 14:45:22 +03:00
Braden Shepherdson
54c8f9bac4 [QP] Drop last stage aggregations for questions in chain filtering (#43274)
Models are treated as opaque here, but for a saved question we expose
filters on the query before its final aggregation step.

This drops the aggregation clauses and gets the possible values for the
column of interest.

Fixes #43154.
2024-05-31 07:43:19 -04:00
Cam Saul
d6381501e9 Rework Kondo defendpoint custom macro to be a custom hook instead (#43411) 2024-05-31 13:26:24 +02:00
Nicolò Pretto
ea7bd55939 PublicDashboard -> PublicOrEmbeddedDashboard (#43302)
* PublicDashboard -> PublicOrEmbeddedDashboard

* file renames and some fixes for PublicOrEmbeddedDashboard

* PublicQuestion -> PublicOrEmbeddedQuestion (file renames)

* PublicDashboard -> PublicOrEmbeddedDashboard

* isPublic prop -> isPublicOrEmbedded in Dashboard and Dashcard
2024-05-31 12:45:04 +02:00
Mahatthana (Kelvin) Nomsawadi
0e8d4f8acf Add SDK changelog (#43433) 2024-05-31 09:04:44 +00:00
Phoomparin Mano
badf8b957b Update the SDK docs to point to v1.50.0-RC1 and add note on height customization (#43383)
* update jar and docker version in sdk readme

* add notes on customizing the component height
2024-05-31 12:55:07 +07:00
metamben
67ae7aded0 Remove redundant field from select (#43396)
This is just removing a duplicate field from a select clause.
2024-05-30 23:35:40 +00:00
Sloan Sparger
2bd4c9b59a Improve haveDashboardCardsChanged util permformance (#43422) 2024-05-30 23:21:03 +00:00
adam-james
42b6edb8c4 Multiple Measures Requires Additional Header Row in Pivot Exports (#43322)
* Multiple Measures Requires Additional Header Row in Pivot Exports

Mulitple measures can be set in our pivots. We indicate these properly in the fronted with a header row that shows
which measure is reprsented in that particular column.

The header builder fn in the pivot export post processing didn't handle this case, but after this PR, it correctly
adds the final header when necessary.

* Fix up header tests

* Remove comment form; the tests are derived from that work already
2024-05-30 21:52:24 +00:00
Aleksandr Lesnenko
642a704e66 support stacked series values labels (#42803) 2024-05-30 20:59:50 +00:00
Braden Shepherdson
246f9b55ac [drivers] Enable :regex feature for MySQL (and MariaDB) (#43269)
These databases previously had impoverished support for regular
expressions. The `:regex` driver feature requires advanced,
"Perl-compatible" regular expressions that can do things like lookahead
assertions.

- MySQL supports this from 8.0.4; we recommend 8.0.33+.
- MariaDB supports this from 10.0.5; we recommend 10.4+.

Fixes #43180.
2024-05-30 16:13:29 -04:00
Aleksandr Lesnenko
f83080071b fix waterfall chart timezone issues, bar widths (#41671) 2024-05-30 17:04:32 -03:00
Ryan Laurie
f143179759 Fix merge-conflicted e2e tests (#43404) 2024-05-30 19:50:30 +00:00
Romeo Van Snick
378f0de215 Fix timeseries chrome overflow (#42761)
* Avoid overflowing dropdown menus

* Hide most bucket picker items behind a More... button

* Add test for More… button on TimeseriesBucketPicker

* Add color to More... button

* Add test for showing all columns when a lower bucket is picked
2024-05-30 21:23:55 +02:00
metamben
e53aeff946 Move models.interface test to the right namespace (#43398) 2024-05-30 19:00:28 +00:00
Anton Kulyk
a39055459c Fix duplicate filter panels in fullscreen dashboards (#43370) 2024-05-30 19:58:40 +01:00
Cam Saul
52d5ccfaff Remove Google Analytics driver (#43352)
* Remove Google Analytics driver

* Remove more GA-related tests

* Un-remove tests that aren't related to GA
2024-05-30 18:22:11 +00:00
Chris Truter
6f2535e8d5 Update macaw for qualified rename support (#43195) 2024-05-30 17:24:35 +00:00
bryan
3b2736c22e CRU card events will log recent-views, and get returned through the API (#43037)
* Handles card events for CRU (not D) => recent view

* add tests

* avoid some errors in dev

We expect recent-views/post-process to return nil occasionally (for
permissions reasons, or more), so let's filter those out instead of
printing a noisy unactionable warning

* uncomment and fix test

* fix some cypress tests + docs improvements

* update more cypress tests

* more cypress test updates

* adding a card puts it into your recents now

* fix notebook-data-source

* fix notebook-data-source

* fixing more e2e tests

* fix command palette e2e tests

* run prettier

* fix style issue

* update notebook-data-source tests

* update homepage e2e tests

* Next question is in recents, now

* update command palette: skip the first pagedown, since it is a noop

* check the buttons for their respective names

* ensure that the model is there, and no questions are
2024-05-30 11:05:30 -06:00
Sloan Sparger
63ecb0a303 Prep unit tests for React 18 upgrade (#43375)
* pulls out test changes from react 18 / rtl 15 refactor that are comptable with react 17 / rtl 12

* impls pr feedback
2024-05-30 16:53:51 +00:00
Anton Kulyk
b1eca0f9b7 Keep a single null dimension value (#43246)
* Keep a single null dimension value

* Add Loki test

* Remove Loki test

* Throw an error if dataset is empty after filtering

* Extract error message into a constant
2024-05-30 17:11:59 +01:00
Romeo Van Snick
a4add27807 Minor design updates to multi select (#43292)
* Add color to icon directly

* Remove unused css file

* Only show info icon when the field is focussed

* Use metabase blue for background on value tags

* Use larger font size for value labels

* Make the value labels bold

* Tweak padding on search input

* Move custom MultiAutocomplete styles to MultiSelect overrides and adapt to accept xs size too
2024-05-30 15:16:30 +00:00
Uladzimir Havenchyk
beba8d5c01 Optimize DashboardHeader rendering by using selector (#43123) 2024-05-30 15:14:53 +00:00
Uladzimir Havenchyk
b62726d36d Avoid heavy calculations on dashboard fetching (#43340) 2024-05-30 17:33:56 +03:00
Anton Kulyk
1610201fba Revalidate x-axis scale when graph.dimensions change (#43254) 2024-05-30 15:30:13 +01:00
Alexander Polyankin
0975be548c Force loading metadata before queries (#43369) 2024-05-30 10:24:49 -04:00
metamben
24ec71c88e Leave viz-setting part as is if normalization fails (#43336)
Fixes #43089.
2024-05-30 16:46:04 +03:00
Ryan Laurie
b77443a410 Combine models repro specs (#43342) 2024-05-30 07:10:24 -06:00
Ryan Laurie
f134831a71 Combine question e2e reproductions into fewer specs in a different job (#43271)
* combine question reproductions into one spec

* split question reproductions

* split reproductions three ways

* fix sample db id
2024-05-30 07:10:12 -06:00
Alexander Polyankin
520c7dc94f Fix getMappingOptionByTarget perf (#43339) 2024-05-30 12:37:26 +00:00
Anton Kulyk
7463c67887 Fix relative/internal links in table viz (#43303)
* Use internal Link for relative and same-origin URLs

* Update frontend/test/metabase/lib/formatting.unit.spec.js

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

* Update frontend/test/metabase/lib/formatting.unit.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-05-30 13:04:27 +01:00
Alexander Polyankin
85b053b77f Load metadata before queries (#43354) 2024-05-30 11:32:42 +00:00
Phoomparin Mano
b55e141fe8 feat(sdk): pivot table color customizations (#43201)
* feat(sdk): colors for pivot tables

* fix theme type

* feat(sdk): basic pivot table theming

* fix emphasis hover color

* customizable row toggle color

* add storybook story and refactor hover color logic

* add sdk visualization wrapper

* make theme values with defaults internally non-optional but externally optional

* update test to render with providers

* update test wrapper to have height container

* update pivot table loki reference image

* update theme names

* make all theme options optional in the public config

* update readme

* readme update for consistency
2024-05-30 11:24:43 +00:00
metabase-bot[bot]
7737d3c857 Update Readme version references and published npm version to 0.1.5 (#43035)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-05-30 12:05:48 +01:00
lbrdnk
127d2626e5 Backfill :effective-type for coerced fields (#43144)
- Update how base type and effective type is added in query-method :mbql/query.
- Base type and effective type is added also during the conversion of query-method :query.
- Adds warning suppression for expressions to places where normalize is 
  called something that does not conform schme (eg. ->pMBQL :dispatch-type/map called
  in query-method :query).
2024-05-30 09:31:01 +02:00
Cal Herries
07dae0a6b6 Fix not being able to upload to a table if the uploads database has switched (#43026) 2024-05-30 00:11:34 +00:00
Sloan Sparger
bee66b406b [WIP] Cloud migration v3 (#43047)
* syncs with BE better for using prod/staging store links

* updates init step, fixes tests

* updates start confirmation modal design

* copy changes

* adjusting unit test

* removing unneeded code

* PR feedback, updating tests

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-05-29 23:26:02 +00:00
Case Nelson
f811b08b6d Single metadata endpoint for a dashboard (#43283) 2024-05-29 21:21:04 +00:00
Alexander Polyankin
84952a7f2b Do not use MBQL lib for parameter fields in dashboards when possible (#43312) 2024-05-29 15:44:43 -04:00
Braden Shepherdson
a672996a96 [MBQL lib] Add preview-query to truncate a query for Notebook preview (#42836)
Fixes #42831.

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-29 19:24:22 +00:00
Aleksandr Lesnenko
4c2d2400f9 fix edit hash is not removed after editing a dashboard (#43213) 2024-05-29 14:45:28 -03:00
Oisin Coveney
d0314b2e9c feat(sdk): Add static dashboards to embedding SDK (#41973) 2024-05-29 20:40:30 +03:00
Filipe Silva
96b357a625 cloud migration rc1 (#43082) 2024-05-29 18:11:58 +01:00
Anton Kulyk
10fee384b2 Add font fallbacks to charts rendering context (#43315)
* Use `useBrowserRenderingContext` in most charts

* Add font family fallbacks
2024-05-29 17:14:53 +01:00
John Swanson
8cfca2c6ef Allow disabling encryption for settings (#43085)
* Allow disabling encryption for settings

For two settings, we want to disable encryption entirely.

On the way out of the data source, we don't need to worry - the
decryption is already backwards-compatible with non-encrypted data.

On the way in, things are a bit less straightforward. The core of the
change is replacing the `t2/deftransform` that *always* runs
`encryption/maybe-encrypt` on the value with:

- a define-after-select that always tries to decrypt the value (so we
can handle existing encrypted values in the db)

- a define-before-insert that encrypts the value if the `defsetting`
told us to, and

- a define-before-update that does the same thing.

For now, set two settings to be never-encrypted: `analytics-uuid` and
`anon-tracking-enabled`.
2024-05-29 08:41:50 -07:00
Kamil Mielnik
cb828242f3 Time-over-time comparison aggregation helpers (#43081)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Use displayName instead shortName
2024-05-29 21:41:42 +07:00
Romeo Van Snick
c25c32a552 Update expression suggestion design (#43232)
* Use sentence case for suggestion headers

* Remove suggestion group dividers

* Highlight suggestions when mousing over them

* Remove unused hoverparent

* Remove custom highlighting for icons

* Allow passing color to metadata info icon

* Make suggestions icons have a consisten color

* Update documentation suggestion style

* Add margin to suggestion sections

* Reorder suggestion sections

* Add test for mouse over highlight on suggestions

* Fix test for suggestion footers

* Remove debugging true

* Rename 'Most used functions/aggregations' to 'Common functions/aggregations'

* Highlight suggestion on mouse move

* Only call onHighlightSuggestion if it is not already highlighted

* Use arrow functions

* Fix test for suggestion highlight
2024-05-29 11:00:55 +00:00
Romeo Van Snick
58867ab701 Correctly place "Add column" button and allow using it when summarizing (#43189)
* Do not render 'Add column' shortcut when viewing a raw table

* Do not show 'Add column' shortcut when a query has aggregations

* List shortcut guards out of component

* Make 'Add column' icon sticky in the header

* Add test for hiding the column shortcut

* Remove Number wrapper

* Move padding to a constant

* Use actions directly to determine if there are any shortcuts

* Make sure there are expressionable columns for the combine columns shortcut

* Make sure there are extractable columns for the extract column shortcut

* Remove padding when not overflowing

* Do not shadow query in popover components

* Allow combine and extract for raw tables

* Add test for combining summarization columns

* Add test for combining summarization columns

* Use a more precise way of calculating the offset for the 'Add column' button

* Handle null question

* Change to the outline button

* Use actual column widths to calculate total width

* Handle empty mode

* Remove extra measure call

* Move shortcutColumn to separate method and avoid looping over all available actions when possible
2024-05-29 11:02:53 +02:00
Nicolò Pretto
d187cadbde Fix multiple origins support by handling invalid origins (#43170)
* Revert "Revert "minimal support for multiple values for Access-Control-Allow-Origin (#42888)" (#43125)"

This reverts commit a4312230a8.

* refactor: extracted parse-approved-origins + supported "*" without special case

* fix: parse-approved-origins won't break on multiple spaces in a row

* handles invalid urls in the origins + some formatting

* log instead of throwing in parse-url + simplify the logic in parse-approved-origins

* simplify parse-approved-origins logic by splitting on "at least one space"

* remove extra boolean call

* approved-origins -> approved-origins-raw to better reflect that it's a raw string

* swap the order of the arguments to `is` in the tests

* indentation 🙃
2024-05-29 07:59:33 +02:00
Phoomparin Mano
fdfcf63573 support test utilities in sdk import (#43242) 2024-05-29 12:53:20 +07:00
Raphael Krut-Landau
505d43496b Move model caching form to Admin / Performance (#43143) 2024-05-29 03:15:24 +00:00
metamben
dcb9713d56 Return card type in GET /api/table/card__:id/query_metadata (#43203)
* Return card type in GET /api/table/card__:id/query_metadata

Also, stop requesting card metadata in dependent-metadata.
2024-05-29 02:10:57 +03:00
Ryan Laurie
61c778c1cd Improve models table performance (#43149)
* improve models table performance

* add loading state for large sets of models

* less icon padding
2024-05-28 22:53:30 +00:00
Raphael Krut-Landau
b9d037f60b Tweak appearance of cache page and form (#42856)
* squashed branch

* fix form buttons and formpadding

* fix some tests
2024-05-28 17:30:50 -04:00
Aleksandr Lesnenko
c75cbe65da use automation user PAT when creating commits in CI workflows (#43250) 2024-05-28 18:29:52 -03:00
Anton Kostenko
35a6544b79 Add Git repo SHA to the final image for future tracking (#43260) 2024-05-28 20:47:23 +00:00
Ryan Laurie
cd53c8af5d entityPicker in technicolor (#43161)
* entityPicker in technicolor

* more precise import

* add unit test
2024-05-28 20:45:58 +00:00
Chris Truter
bc3ce713db Upgrade zx from 7.2.3 to 8.1.0 (#43054) 2024-05-28 14:04:56 -06:00
Cal Herries
2c75a0c66a Fix a couple of flaky tests using with-call-count (#43248) 2024-05-28 13:22:06 -06:00
Alexander Polyankin
1712e03e79 Fix parameter matching with model columns (#43204) 2024-05-28 14:36:15 -04:00
Ryan Laurie
0e66b0d19a Use table2 icon for questions (#43095)
* use table2 icon for questions

* update e2e tests
2024-05-28 11:05:44 -06:00
Jeff Bruemmer
1670832a39 docs - app db note (#43239) 2024-05-28 13:04:47 -04:00
Cal Herries
8b82721dc9 A couple of changes to the sample content (#43200) 2024-05-28 16:24:25 +00:00
Jesse Devaney
8770ea27f0 Implement graceful error handling for trend charts (#43090)
* fix trend charts erroring on latest value being null

* refactor previousRowIndex calculation

* handle errors gracefully

* refactor error messages

* update computeTrend unit tests

* add error handling integration test

* add E2E test to check that errors are gracefully handled

* add integration test to enforce the fix

* fix static viz

* display more meaningful error on static-viz trend charts

* move error handling out of trend chart and fix error handling in Visualization.tsx

* update compute.unit.spec.js

* update SmartScalar.unit.spec.js

* use separate error handler for ErrorBoundary errors in Visualization.jsx

* update E2E test

* update error handling

* update compute.unit.spec.js

* fix react state change error in render function

* show generic error message for ErrorBoundary caught errors

* revert ErrorBoundary changes

* remove generic error border for visualizations
2024-05-28 11:41:31 -04:00
Jeff Bruemmer
cebf9a9622 add 49.12 to list of releases (#43236) 2024-05-28 15:04:03 +00:00
Phoomparin Mano
8fc52d228b feat(sdk): expose color and typography options for smart scalar in embedding SDK (#42915)
* feat(sdk): allow overriding positive and negative values

* docs(sdk): add positive and negative colors to docs

* feat(sdk): add smart scalar font size

* feat(sdk): add smart scalar line height settings

* feat(sdk): get rid of custom embedding mantine theme type

* wip: setup storybook and loki for smart scalar

* fix missing state for rendering visualizations

* docs(sdk): add scalar customizations to readme

* test(sdk): add test cases to loki

* add smart scalar reference image

* use css variables for brand

* make embedding theme options partial

* fix scalar value wrapper line height

* update loki snapshot

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-05-28 14:17:58 +00:00
Kamil Mielnik
3b3dcd8647 Disable offset() in custom columns (#43224)
* Disable offset in custom columns

* Remove .only

* Update CLJS tests
2024-05-28 21:08:37 +07:00
Uladzimir Havenchyk
33bb0759c5 Do not ignore icon prop on the Filter button (#43229) 2024-05-28 16:30:49 +03:00
Oisin Coveney
ed3cfb6087 Convert ParametersList to TS (#42822) 2024-05-28 15:20:20 +03:00
Alexander Solovyov
0bd7db0f18 [serdes] unify snowplow analytics in a single event (#43218) 2024-05-28 12:18:22 +00:00
Anton Kulyk
cc660510ed Fix rare axis ticks for timeseries axes (#43127)
* Fix typos

* Tweak `maxTicksForChartWidth` calculation

* Update Loki screenshots

* Tweak `PIXELS_PER_CHARACTER`

* Update test
2024-05-28 13:15:13 +01:00
Romeo Van Snick
b6bb9d184e Allow creating new items by inserting comma in MultiAutocomplete (#42824)
* Pass current values to shouldCreate

* Allow comma to create new item

* Simplify getAvailableSelectItems

* Add unit test for MultiAutocomplete input

* Use text instead of Text in paste

* Handle spaces in MultiAutocomplete

* Remove cast

* Reuse last var

* Use haveLastBeenCalledWith over haveBeenCalledWith

* Handle pasting when there is text in the input already

* Accept quote-delimited values

* Add info icon

* Handle tab as a separator

* Fix test cases for unsanitized parseValues

* Add csv-parse

* Use csv-parse to parse values

* Apply the correct color to the info icon

* Rename util to utils

* Break up tooltip text

* Only return unique values

* Be more accepting around quotes in the middle of unescaped values

* provide Buffer for csv-parse package in storybook

* Use browser-friendly version of csv-parse

* Remove unused eslint rule

* Add specital case for csv-parse to jest config

* Put uniqueness check in each state update

* Only add partial value if it is valid

* Only add partial value if it is valid

* Fix test case for FilterValuePicker

* Just use Set

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

* Allow parsing more than one value

* Use isValid everywhere it makes sense

* Add test for RTL languages

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-28 13:43:10 +02:00
Kamil Mielnik
e7948a7249 Copy question link from dashboard (#42892)
* Remove dead CSS

* Use proper types

* Properly type parameterValues

* Add href prop support to LegendCaption

* Extract getNewCardUrl
- move getParametersMappedToDashcard

* Use href in CartesianChart

* Handle RowChart

* Handle Funnel

* Format code

* Fix types

* Update first test in title-drill

* Update test

* Update test

* Update tests
- pass questionId in createQuestionAndDashboard

* Add test for links

* Fix createDashboardWithQuestions

* Add missing click handler

* Fix crash

* Fix typo

* Add a workaround for #42999

* Fix tests

* Fix hover color

* Update comment

* Get rid of mapStateToProps in DashboardGrid

* Invert condition

* Use useCallback instead useMemo

* Do not pass getNewCardUrl down if navigateToNewCardFromDashboard is not present
- Remove default noop for navigateToNewCardFromDashboard in PublicDashboard

* Remove explicit undefined prop
2024-05-28 18:23:51 +07:00
Phoomparin Mano
8cbacf7511 feat(sdk): override chart colors (#42960)
* add color types for chart sdk colors

* simplify chart color types

* chart color mappings

* apply mapping to master branch

* add chart mapping to mantine

* feat(sdk): apply chart accent colors to mantine and color getter

* rename tint and shade

* remove chart color logic from mantine

* add a color mapping test

* docs(sdk): add chart customizations to readme

* add type comments on MappableSdkColor

* cleanup sdk colors
2024-05-28 16:56:01 +07:00
Mahatthana (Kelvin) Nomsawadi
0c6b9355a7 Fix typo (#43194) 2024-05-28 09:05:39 +01:00
Cal Herries
92daf0cc7f Fix flaky migration rollback test for mysql: metabase.db.custom-migrations-test/migrate-uploads-settings-test-1 (#43210) 2024-05-28 04:06:25 +00:00
Cal Herries
83b55b99d6 Don't allow executing archived pivot-table cards in a public dashboard (#43206) 2024-05-27 16:51:53 -06:00
Alexander Polyankin
c45307cc9f Omit checks for dashboard metadata when not needed (#43197) 2024-05-27 14:39:39 -04:00
Case Nelson
a306b35715 [Metrics V2] Remove legacy-metric metadata (#43134)
* [Metrics V2] Remove legacy-metric metadata

Fixes #43131

* Don't mock metric

* Drop definition_description hydration on legacy metric

* Remove defintion_description tests

* Update src/metabase/lib/metadata.cljc

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

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-05-27 12:04:14 -06:00
Cal Herries
f3ddcb66a7 Migrate uploads settings to the db-level behind the scenes, so the uploads DB can be set by the config file (#42869) 2024-05-27 17:18:46 +00:00
Phoomparin Mano
a9d0596fcf docs(sdk): update color reference (#43086) 2024-05-27 15:07:52 +00:00
Uladzimir Havenchyk
057cb3f386 Avoid unnecessary re-renderings in dashboard - dashboard controls (#43169)
* Avoid unnecessary re-renderings in dashboard - dashboard controls

* Comment
2024-05-27 15:16:02 +03:00
Kamil Mielnik
e532b95fc6 Fix missing React key prop (#43179)
* Fix missing React key prop

* Fix missing React key prop

* Fix order of conditions and make the code easier to follow
2024-05-27 11:58:52 +00:00
Uladzimir Havenchyk
5f33a31dbd Restructure parameters e2e tests - separate auto-wiring (#42820) 2024-05-27 14:20:25 +03:00
Kamil Mielnik
4f37d5607a Enable running tagged tests defined in TS (#43172)
* Update & tag a test

* Run tests also on TS files

* Update mongo test
2024-05-27 18:11:20 +07:00
Alexander Solovyov
80687b8a42 [serdes] nested fields should be properly serialized (#43066) 2024-05-27 11:19:06 +03:00
Cal Herries
f4f2d45b23 Fix connection impersonation when jdbc spec is passed (#43147) 2024-05-25 01:02:31 +00:00
metamben
d208d800c3 Migrate metrics with display setting scalar (#43160) 2024-05-24 22:57:10 +00:00
metamben
1416017caa Remove api/legacy-metric (#43133) 2024-05-25 01:47:13 +03:00
metamben
e50a22f971 Remove unused card related endpoints (#43141) 2024-05-24 23:59:27 +03:00
Alexander Polyankin
b18e9caa42 Optimize initial dashboard load - load dashboard metadata in parallel with the query (#43101) 2024-05-24 20:38:53 +00:00
Nick Fitzpatrick
5e29f434a0 Add media query to search button (#43084)
* add media query to search button

* useSmallScreen hook
2024-05-24 16:48:02 -03:00
Ryan Laurie
abf9004160 Allow recent command palette items with the same name (#43098) 2024-05-24 13:04:02 -06:00
Ryan Laurie
c77f7f23d9 Hide creation buttons on search and recents tabs (#42977)
* hide creation buttons on search and recents tabs

* update e2e tests
2024-05-24 13:03:38 -06:00
Oisin Coveney
e1e845afa4 Convert DashboardControls to TS hooks (#42777)
* Convert DashboardControls to TS hooks

* fix types

* Modify dashboard url params to ensure that we keep hash options that haven't changed

* Fix PublicDashboard and DashboardTabs tests

* Use synced dashboard tabs for automatic dashboard, and use normal tabs for those with DashboardControls

* reduce hash option location changes to only the ones we can change through the UI

* Add comment on state management

* Remove console

* Attempt to solve more tests

* Remove loadDashboardParams as a passed prop

* Fix some tests, but will cause unit test to break

* Change names to reflect actual usage

* Fix lint and type issues

* Add simpler url param control, simplify types, and simplify fullscreen hook

* Add two way binding with url params to attempt to fix tests

* Fix unit test + types

* Move folders and fix imports

* Use Record<string, unknown> for refresh hook

* Remove console.log

* Clear query parameters when ParametersList unmounts

* Add comment

* Revert DisplayTheme changes

* Fix weird reloading problem

* Fix reducers test

* add code comments on selecting the tab once tab data is loaded

* add code comments on unsyncing parameters

* Fix e2e tests, move url reset to tabs context

* Fix e2e tests

* Hotfix

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-05-24 21:58:34 +03:00
Raphael Krut-Landau
adb7ff58a4 [Cache] Only show "Adaptive" and "Don't cache" options on OSS page (#43122)
* Limit options on OSS Admin/Performance page

* simplify

* simplify

* simplify

* divide constants to avoid circular imports

* divide constants to avoid circular imports

* divide constants to avoid circular imports

* simplify

* simplify

* simp

* fix

* simplify

* simplify

* fix test
2024-05-24 13:44:03 -04:00
Aleksandr Lesnenko
a4312230a8 Revert "minimal support for multiple values for Access-Control-Allow-Origin (#42888)" (#43125)
This reverts commit bf6fd9ef25.
2024-05-24 11:33:03 -04:00
Aleksandr Lesnenko
9194a1baca fix bars width when chart has two y-axes (#43100) 2024-05-24 12:29:29 -03:00
Uladzimir Havenchyk
1cb339e833 [Dashboard] Optimize rendering by reducing the number of props passing down to from the very top (#43114)
* Avoid unnecessary re-renderings in dashboard - getEmbeddedParameterVisibility

* Avoid unnecessary re-renderings in dashboard - favicon, page title

* Exclude isLoadingComplete from passing down

* Avoid unnecessary re-renderings in dashboard - metadata

* Drop metadata from Public Dashboard

* Avoid unnecessary re-renderings in dashboard - dashcardData
2024-05-24 18:20:04 +03:00
Nicolò Pretto
bf6fd9ef25 minimal support for multiple values for Access-Control-Allow-Origin (#42888)
* minimal support for multiple origins in security middleware

* if -> when to be more idiomatic

* adds tests for parse-url

* if -> when

* add missing new line in tests

* split the logic of validation in functions

* adds tests for the small functions

* use namespace in tests instead of :refer
2024-05-24 15:48:57 +02:00
Romeo Van Snick
2ab5debac0 Remove fixed height on popover (#43058) 2024-05-24 15:16:01 +02:00
Romeo Van Snick
2145b3cf9e Fix breakout pivot tether (#43060)
* Limit the height of the breakout popover

* Allow the click action popover to untether to prevent overflowing the screen

* Add reproduction for #43075

* Rename breaktrhough to breakout

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

* Use findAllByTestId

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

* Remove copy pasted question name

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

* Remove unused api intercept

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-24 14:01:58 +02:00
Romeo Van Snick
023ca9d1e9 Fix bucket trigger position (#43061)
* Make accordion list item content 100% wide

* Remove unused Dot component

* Move bucket popover trigger to the end of the item

* Revert QueryColumnPicker styles to what they were before adding the info icons

* Fix the height of the bucket picker
2024-05-24 08:36:39 +00:00
Uladzimir Havenchyk
14a42893a8 [UI] Fix styles for disabled Switch (#43091) 2024-05-24 09:19:03 +03:00
Case Nelson
5ad73d6fe6 [Metrics V2] Port Legacy metric tests and fixes (#43094)
* [Metrics V2] Port Legacy metric tests and fixes

Fixes #43093

* Address pr review
2024-05-23 16:39:57 -06:00
Alexander Polyankin
3713a16283 Optimize initial dashboard load (#42901) 2024-05-23 21:57:41 +00:00
metamben
e5e879afd4 Stop returning archived metrics in available metrics (#43031)
* Stop returning archived metrics in available metrics
* Add archived metric test
* Migrate legacy metric tests
* Delete lib/legacy_metric.cljc
2024-05-24 00:29:57 +03:00
metamben
1754ddcfaa Prevent returning metrics v2 migration backup field (#43087) 2024-05-23 18:39:43 +00:00
Emmad Usmani
1ea2b05fa3 refactor scatter plot to separate code path (#43032)
* refactor scatter plot model to separate function

* (2/3) refactor scatter plot option to separate function (#43033)

* use getScatterPlotOption

* use buildEChartsScatterSeries directly

* remove hoveredSeriesDataKey from scatter

* (3/3) improve chart model types (#43034)

* create WaterfallChartModel type

* create ScatterPlotModel type

* rename BaseCartesianChartModel to CartesianChartModel

* simplify chartModel creation in hook
2024-05-23 16:58:26 +00:00
Nick Fitzpatrick
ef28ff992c 42592 new modal adding database (#42966)
* modal built

* code cleanup, removing unused components

* whitespace shame

* adjusting unit test

* removing px shame
2024-05-23 11:40:37 -03:00
Ngoc Khuat
c9f2ffe99e Fix flaky test send-pulses-exceed-thread-pool-test (#43050) 2024-05-23 13:46:12 +00:00
Chris Truter
20cdd7cc1b Fix a bunch of small typos (#43055) 2024-05-23 13:39:52 +00:00
Kamil Mielnik
73e1b12679 Add repro for #42999 (#43000) 2024-05-23 19:56:05 +07:00
Noah Moss
5597f0febd Rework popular_items to use recent_views and view_count columns (#43041) 2024-05-23 08:45:02 -04:00
Alexander Polyankin
0e157dc8fb Revert "Load dashcard metadata in parallel with the query (#42953)" (#43063)
This reverts commit a0a4a26fdf.
2024-05-23 12:29:50 +00:00
Ryan Laurie
eee1c7e5b8 Properly show parent DBs in entity picker recents and search (#43016) 2024-05-23 05:32:02 -06:00
Tim Macdonald
4f7f55807c [ParseSQL] Find-and-replace with optional tags (#43013)
* Support find-and-replace with optional tags

[Fixes #42583]
2024-05-23 09:55:29 +00:00
Tim Macdonald
925454f14c [ParseSQL] Find-and-replace for snippets (#43011)
* Support F&R for snippets

[Fixes #42648]
2024-05-23 09:47:18 +01:00
Kamil Mielnik
dc4d78f16c Add a repro for #36508 (#43002) 2024-05-23 15:18:08 +07:00
Alexander Polyankin
59859a16b6 Flaky e2e fix (#43048) 2024-05-23 09:16:01 +02:00
Kamil Mielnik
41f6d17519 Fix - Empty collections shown in Data Picker (#42959)
* Generate different shouldShowItem for different pickers

* Add repro for #42957

* Update test to use models instead of metrics
2024-05-23 13:57:27 +07:00
Uladzimir Havenchyk
848fd9303e Drop props spreading to DashboardHeader (#42887) 2024-05-23 09:52:17 +03:00
bryan
ba7eae7554 bump saml20 - fix azure SLO (#43022) 2024-05-22 23:25:57 +00:00
Alexander Polyankin
a0a4a26fdf Load dashcard metadata in parallel with the query (#42953)
* Split card data and query

* Split card data and query

* Split card data and query

* Fix loading state

* Postpone card check

* Postpone card check

* Postpone field check

* Postpone field check

* Postpone field check

* Postpone field check

* Postpone field check

* Add await

* Add await

* Add await

* Add await

* Fix tests

* Fix data loading

* Fix data loading

* Fix data loading

* Fix data loading

* Revert "Fix data loading"

This reverts commit 2b782b9936.

* Fix data loading

* Fix test

* Fix test

* Fix embedding

* Fix xrays

* Fix xrays
2024-05-22 18:05:11 -04:00
Sloan Sparger
bdb006be00 Update link to docs about "No self-service" deprecation (#43038) 2024-05-22 21:22:18 +00:00
Nick Fitzpatrick
bd48581c81 42934 entity picker create collection root (#43005)
* NewCollectionDialog adjustment and unit test

* adding unit test for NewDashboardDialog
2024-05-22 17:28:08 -03:00
Alberto Perdomo
7deaf0d4ae Improvements to embedding sdk readme (#43021)
* SDK readme: update available and planned features

* SDK readme: general improvements
2024-05-22 20:46:48 +01:00
Ryan Laurie
f52078550b simplify db strategy editor markup (#42986)
* simplify strategy editor markup

* make it work for OSS too 😁
2024-05-22 13:41:17 -06:00
bryan
b2cf93c671 Effective location on collection recent items (#43018)
* add effective_location to recent-collection-items

* cleanup
2024-05-22 12:51:39 -06:00
Alexander Polyankin
93b83ab52f Add data source specific icons to data and join steps in the notebook editor (#42982) 2024-05-22 14:26:23 -04:00
Case Nelson
a68a4da67a [Metrics V2] Handle clashing expression names when adjusting metrics (#42984)
* [Metrics V2] Handle clashing expression names when adjusting metrics

Fixes #42782

* Address PR review
2024-05-22 11:51:32 -06:00
Ryan Laurie
bd552424ae update required checks copy documentation (#43003) 2024-05-22 08:58:10 -06:00
Jeff Bruemmer
ac639eaaef docs - download diagnostics (#42930) 2024-05-22 10:57:46 -04:00
Braden Shepherdson
acbfc6b5cc Drivers: Update the driver changelog with new features (#43004)
These were added in #42602 but I neglected to update the changelog.
Their defaults should serve for most drivers.
2024-05-22 10:18:27 -04:00
Uladzimir Havenchyk
933fd547f6 Cleanup annoying console warning from emotion (#42819) 2024-05-22 13:05:59 +00:00
Tim Macdonald
12bb81b528 Handle native query find-and-replace for queries with card refs (#42939)
* Handle native query find-and-replace for queries with card refs

[Fixes #42582]

c.f. limitiations in #42938

* wee cleanup
2024-05-22 10:44:18 +00:00
Cam Saul
340ea839d0 Tests for #15131 (#42972)
* Tests for #15131

* Appease Kondo
2024-05-22 11:23:58 +02:00
Romeo Van Snick
946974fb77 Limit the height of actions popover (#42946)
* Limit the height of actions popover

* Use Box instead of custom wrapper

* Add rem import
2024-05-22 10:58:16 +02:00
bryan
9dbfae2e17 the ' makes the doseq do nothing (#42988) 2024-05-22 04:45:50 +00:00
Cam Saul
d5a32ecb57 metabase.search namespace (#42487)
* Search API namespace

* Search API namespace

* Search API namespace

* Fix Kondo warnings

* Fix typo

* Finally solve the MySQL ^:parallel test failures <3

* Make some search tests REPL-friendly

* Did I finally fix `^:parallel` MySQL tests?

* Ok I give up just make the search tests single-threaded for MySQL/MariaDB.

* Revert the stuff to make paralell tests work for MySQL... for now.

* Keep new name

* Revert deps-graph changes

* Remove unused namespaces

* Fix Kondo linter for log/info + format

* Misc fixes 🔧

* Test fixes 🔧
2024-05-21 20:44:00 -07:00
Cam Saul
618b8c28aa metabase.analyze API namespace (#42469)
* Squashed commit

* Update config

* Backport the kondo ignore stuff from other PR.

* `metabase.analyze` API namespace
2024-05-22 02:56:04 +00:00
Cal Herries
a2b85e4b75 Tidy api-changelog.md (#42992) 2024-05-21 20:32:48 -06:00
John Swanson
1279a73ae2 Fix report_card.collection_preview in v49 (#42950)
This is a bit painful. I merged this change, but realized we need to
backport the fix to v49. However:

- we don't want to have two versions of the migration (one with a v49
id, one with a v50 id) because then if someone upgrades to 50, then
downgrades to 49, the `rollback` will run and change the type back,
leading to a bug.

- we don't want to push a v51 changeSet ID to v49 or v50, because we
give the user a helpful notice when their database needs a downgrade.
We do this by checking for the latest *executed* migration in the
database and comparing it to the latest migration that Liquibase knows
about, and making sure the executed isn't bigger than the known (e.g.
you can't have executed a v51 migration if it isn't in the local
migration yaml). That would all work fine, except that then we want to
tell you how to downgrade your database, and we use the latest-executed
version for that. So if, for example, someone upgraded from 48 to 49 and
got a v51 changeset, then downgraded back to 48, they would get an error
telling them to run the *v51* jar to roll back their DB.

In this case though, I think it's fine to just move the migration around
to v49, then we can backport it to 49 and 50.
2024-05-21 23:34:16 +00:00
Ryan Laurie
8615540e38 add snowplow tracking for upsells (#42955)
* add snowplow tracking for upsells

* add upsell snowplow test

* appease the linter
2024-05-21 16:49:10 -06:00
Emmad Usmani
139e421771 highlight hovered timeline event (#42969)
* highlight hovered timeline event

* add e2e test

* use TIMELINE_EVENT_DATA_NAME constant

* add test case for clicking icon
2024-05-21 15:23:18 -07:00
bryan
790a6479c8 Fixing a couple Recents API corner cases (#42813)
* handle visibilty_type on tables

- remove def wtf
- uncomment + fix tests

* make sure parent colls exist on report_cards

- official is a string
- ensure the database for a recent table exists

* remove def + improve arg name

* docstring

* improve + extract valid parent collection check

* grab the entity's colllection id and use that for the validity test

- This seems like something that should never happen, but I've seen it
happen. I think it might be possible from a down/up migration.

* fix tests

* fix more tests

* cleanup

* fixing another test

* add error-avoider, to filter bad items in prod instead of throwing

- improve recent view testing for table

* remove wrap (it double prints the value)
2024-05-21 16:07:43 -06:00
Denis Berezin
89bef96b93 feat: Add utm parameters to embedded OSS Metabase footer link (#42968)
* Add utm params to  link

* Fix e2e, add url domain

* Fix e2e
2024-05-21 21:34:27 +00:00
Case Nelson
8f9b9c3a13 [Metrics V2] Backfill viz settings for compatible-series (#42970)
* [Metrics V2] Backfill viz settings for compatible-series

Fixes #42575

The BE should rely on the query when there is no corresponding viz setting.
If there is no graph.metrics setting, assume that all last-stage aggregations are used.
No graph.dimensions -> use breakouts.

* Fix tests

* Unskip e2e test

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-21 21:20:32 +00:00
Jeff Bruemmer
64aa52ea12 docs - command palette (#42397) 2024-05-21 17:13:17 -04:00
Case Nelson
4fd9d7ae21 [Metrics V2] Adjust expression clauses in metric refs (#42962)
Fixes #42360
2024-05-21 13:49:55 -06:00
Jesse Devaney
6270bb4bc6 Fix overly frequent line series dots (#42735)
* hide symbols for charts with too many of them

* update loki

* prevent series dots showing up after manually disabling another series

* update loki snapshots

* refactor conditional

* update loki snapshots
2024-05-21 19:30:54 +00:00
metamben
9771eaa290 Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc (#42653)
* Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc
* Fix test-runner: druid should not exclude druid-jdbc
* Implement set-parameter and unprepare-value for LocalDateTime for druid-jdbc
2024-05-21 18:58:47 +00:00
Nick Fitzpatrick
c69596ab0b changing button height and CP input placeholder (#42770)
* changing button height and CP input placeholder

* adjusting search button size

* translate new placeholder
2024-05-21 15:39:59 -03:00
Denis Berezin
a3c3193474 fix(sdk): Various fixes for InteractiveQuestion theming (#42932)
* Fixes for InteractiveQuestion theming

* Update readme

* Fix for unset filter theme color

* Fix unit tests

* Fix unit tests
2024-05-21 18:31:17 +00:00
Sloan Sparger
eca94e12d8 Fix c method of ttag not showing strings as tagged in debug mode #42965 2024-05-21 17:50:57 +00:00
Alexander Polyankin
4be9fcf47f Revert "Fix failing offset tests" (#42961)
* Revert "Fix failing offset tests (#42944)"

This reverts commit fca30b1ae5.

* Fix e2e
2024-05-21 17:33:25 +00:00
Phoomparin Mano
2e9a53a778 feat(sdk): apply user interface color overrides to the sdk (#42834)
* feat(sdk): apply ui color overrides to the sdk

selector state

set global embedding colors

rename the method

* test(sdk): add unit test on color overrides
2024-05-21 17:29:24 +00:00
Kamil Mielnik
bbaa180303 Fix - Admin Email does not Display on Question Timeout Page (#42937)
* Extract EmailAdmin and add tests for it

* Rename EmailAdmin to AdminEmail

* Remove redundant async

* Add a test case for no email
2024-05-21 17:26:15 +00:00
Romeo Van Snick
1424a6ea70 Fix icon colors in column picker (#42945)
* Make icons 16px in data picker

* Use text-light in DataPicker to match other icons
2024-05-21 17:18:31 +00:00
Kamil Mielnik
fca30b1ae5 Fix failing offset tests (#42944)
* Fix failing offset tests

* Fix flaking test
2024-05-21 15:24:34 +00:00
Cal Herries
ccb4942b6a [forward-port] More upload test changes for clickhouse (#42531) (#42715) 2024-05-21 07:46:44 -06:00
Cal Herries
9da95541f1 CSV uploads: Add test for appending duplicate data (#42918) 2024-05-21 07:46:02 -06:00
Alexander Polyankin
4b7f04a8bc Cleanup DataPicker initialization (#42916) 2024-05-21 08:31:22 -04:00
Uladzimir Havenchyk
c09ec3ddeb Drop props spreading to DashboardSidebars (#42907) 2024-05-21 12:48:02 +03:00
Kamil Mielnik
9384525278 Repro #36631 - A "Default period" is appended for Date columns within Custom Columns when using Question as Source Data (#42876)
* Add a repro for #36631

* Do not wrap id
2024-05-21 13:38:18 +07:00
Kamil Mielnik
802b0d915f Cover Offset() in custom expressions with e2e tests (#42756)
* [MBQL lib] Reject broken uses of `offset` in expressions, filters (#42662)

- Using `offset` in custom expressions is supported only when there is
  an order-by defined on that stage.
- Using `offset` in custom filters is not supported at all, currently.

* Support `Offset()` in custom columns [frontend] (#42326)

* Only nest expressions referenced in breakouts or aggregations

* Support Offset() as expression with no breakouts

* Test fixes 🔧

* Oracle test update

* Improved Oracle test

* Test update 🔧

* Fix busted test

* Add naive support for Offset() in expressions

* Introduce MBQLClauseFunctionReturnType

* Add "window" to MBQLClauseFunctionReturnType and use it for the offset function

* Handle offset type inference

* Remove unused export

* Use "expression" instead of "window" return type
- Rename identifiers in isCompatible
- Make isCompatible accept a clause object instead of just the type
- Handle offset as a special case in isCompatible

* Use any type

* Rename expectedArgumentType to expectedType

* Format code

* Sort types

* Do not suggest offset function in filters

* Fix offset not working in case

* Revert "Do not suggest offset function in filters"

This reverts commit e63790b780.

* Fix order of adjustments

---------

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

* Disable offsets in filters expressions

* Group existing aggregations-specific tests

* Remove repro for a closed issue

* Use findByText instead of contains

* Add a test for filter expressions

* Add a test for aggregation expressions suggestions

* Disable offsets in filters expressions (#42755)

* Add a test for custom column suggestions

* Add "typing" to enterCustomColumnDetails

* Use enterCustomColumnDetails, improve assertions

* Add more assertions

* Optimize queries

* Add typing for offset expressions

* Add a repro for metabase#42764

* Add a TODO

* Add a TODO

* Add a TODO

* Use NumericLiteral

* Post-merge fixes

* Update test

* Add tests for other custom expressions

* Test drills

* Format code

* Update test name

* Add an assertion

* Add assertions for the preview

* Unskip fixed issue

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
Co-authored-by: Cam Saul <github@camsaul.com>
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-21 13:37:45 +07:00
metamben
09c557cdf7 Fix flaky adjust-mixed-multi-source-test (#42926) 2024-05-21 09:10:26 +03:00
Sloan Sparger
cf97acdaeb Split out Search e2e tests and Record Pre-Release Sanity Checks with Replay (#42933)
* add replay recordings to sanity check e2e tests during pre-release workflow

* split out search tests from onboarding folder

* parallelize pre-release testing

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-20 23:33:19 +00:00
John Swanson
b76e26fac3 Correct type for report_card.collection_preview (#42919)
In v49, we converted all boolean types to `bit(1)` on mysql/mariadb. It
looks like we missed this one, so when you `GET` a card it has
`"collection_preview": 1`. Then we get an error when trying to save,
because `collection_preview` should be a boolean.

I verified that after this migration, `GET`ting a card results in a
boolean `"collection_preview"`.
2024-05-20 15:20:05 -07:00
Jesse Devaney
f436b5b066 fix trend charts spacing (#42860) 2024-05-20 20:41:09 +00:00
Sloan Sparger
32421f2e39 Remove flaky / redundant e2e test (#42920) 2024-05-20 20:19:05 +00:00
Jeff Bruemmer
1ef312845f small edits (#42923) 2024-05-20 20:17:37 +00:00
metamben
9cb18c0056 Fix comment (#42906)
* Fix comment
2024-05-20 19:27:40 +00:00
Kamil Mielnik
fb4b8ca2a6 Create the new Metric entity (Metrics v2) (#38457) 2024-05-20 13:47:00 -04:00
Roman Abdulmanov
d80667fe36 revert embed board (#42911) 2024-05-20 17:44:49 +00:00
Uladzimir Havenchyk
3999e8ebe4 Drop props spreading to DashboardGrid (#42875) 2024-05-20 20:43:58 +03:00
Sloan Sparger
375cb63200 Disable popular items e2e home page test in OSS (#42896)
* disables testing for home page popular items in oss

* Update e2e/test/scenarios/onboarding/home/homepage.cy.spec.js

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-05-20 12:23:52 -05:00
Sloan Sparger
45622180e1 asserts values match current expectations of values which hopefully solves race conditions that might be happening (#42905) 2024-05-20 12:23:02 -05:00
Denis Berezin
0278b8d221 fix(sdk): Use theme font in charts and tooltips (#42855)
* Allow charts font override in SDK

* Fix default not configured font
2024-05-20 16:57:49 +00:00
Ryan Laurie
36d03247f3 Improve db setup tests more (#42899)
* improve db setup test

* improve embedding test
2024-05-20 11:04:33 -05:00
Ryan Laurie
3697804c3c Remove utm from source plan in upsell links (#42890) 2024-05-20 15:15:42 +00:00
Ryan Laurie
5e562cd86c Make Metabot Cool Again (#42797)
* Make Metabot Cool Again

* update tests
2024-05-20 07:32:55 -06:00
Uladzimir Havenchyk
5d795be2c8 Exclude jspdf and html2canvas from the bundle (#42536)
* Exclude jspdf and html2canvas from the bundle

* cleanup
2024-05-18 13:03:29 +03:00
John Swanson
930777e1a4 Add a type to collections returned by search (#42535)
Under:

- `item.type`

- `item.collection.type`, and

- `item.collection.effective_ancestors.*.type`
2024-05-17 15:36:56 -07:00
Cal Herries
b300002061 Use db argument in driver/database-supports? for uploads (#42851) 2024-05-17 21:43:22 +00:00
John Swanson
80d8e87242 Update API Changelog (#42864) 2024-05-17 21:14:01 +00:00
Jeff Bruemmer
9be96be978 docs - csv upload replace (#42529) 2024-05-17 16:59:36 -04:00
Denis Berezin
7f6ba3e374 Restore default styles for subtle button (#42854) 2024-05-17 20:29:12 +00:00
metabase-bot[bot]
443203b41c Update Readme version references and published npm version to 0.1.4 (#42852)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-05-17 19:22:00 +00:00
Noah Moss
fb9da630b3 Fix schema error in recent views query (#42844) 2024-05-17 18:07:31 +00:00
Sloan Sparger
8477f8db86 Fix homepage flaky test (#42839)
* fixes homepage flaky test

* take 2

* better fix
2024-05-17 17:52:03 +00:00
Nick Fitzpatrick
f74b0e3fbb fixing e2e flakes in search-snowplow and recently-viewed specs (#42840) 2024-05-17 17:10:56 +00:00
Ryan Laurie
eaab3ba2ce Improve db connection setup test (#42838) 2024-05-17 11:54:33 -05:00
Nemanja Glumac
3b5258d7ea Remove GoogleAnalytics specific logic from the FE (#42827) 2024-05-17 18:01:23 +02:00
Oisin Coveney
01e45b8471 Review suggestions from #42768 (#42830) 2024-05-17 14:44:09 +00:00
Romeo Van Snick
147b9f7dad Scroll to created column when extracting or combining columns in chill mode (#42650)
* Set scrollToLastColumn ui control from column extract action

* Scroll to last column when the uiControl is set

* Scroll to last column when combining a column

* Scroll to last column when combining a column via the + shortcut

* Scroll to last column when extracting a column via the + shortcut

* Remove all references to settingsSyncOptions

* Check that the column is added at the end

* Disable scrollToLastColumn once used

* Add test that verifies scrollToLastColumn ui control has been reset
2024-05-17 16:23:03 +02:00
Ngoc Khuat
29a1713df7 Add task history status (#42372) 2024-05-17 14:06:21 +00:00
Denis Berezin
a6035a1aff Add custom theming support for SDK InteractiveQuestion component (#42663)
* Add proper brand colors to drills menu

* Add theming for filters and drills

* Fix css vars

* Fix table css

* Add SDK theme colors interface and remapping

* Fix dashboard brand color issue

* Fix theme colors interface

* Fix default theme table cell background

* Fix typo

* Fix for qb filters panel custom border
2024-05-17 13:40:28 +00:00
Nemanja Glumac
c64187b17b Drop the "frozen" frontend install during build when in CI (#42771) 2024-05-17 15:26:10 +02:00
Oisin Coveney
2cf2955f91 Convert RefreshWidget to Mantine, CSS modules, and TS (#42768) 2024-05-17 13:24:48 +00:00
Kamil Mielnik
784e869891 Data picker (#41175)
* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 38ac092335.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 2b8fe78ed4.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 219506f0e0.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 9430478bdf.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 8c6cdd9068.

* Table Picker (#40509)

* Generic types

* Generic types

* Generic types + make generateKey a prop

* Generic types

* Extract AutoScrollBox.styled.tsx

* Move AutoScrollBox to a separate directory

* Generic types

* Generic types

* Generic types

* Unhookify searchFilter

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Finish dealing with a cast

* Destructure import

* Inline type

* Generic types

* Remove cast

* Remove commented code

* Remove redundant fallback

* Move CollectionPicker out of EntityPicker

* Avoid as unknown

* Remove TODOs

* Rename TisFolder to IsFolder

* Fix any

* Fix anys

* Remove NestedItemPicker's storybook

* Remove a cast

* Remove a cast

* Remove a cast

* Revert "Remove a cast"

This reverts commit b762d0f076.

* Use extends SearchModelType instead of extends string everywhere

* Revert "Use extends SearchModelType instead of extends string everywhere"

This reverts commit 708190d63e.

* Fix SearchResult["available_models"] type

* Handle options.allowCreateNew

* Add missing description attribute to Database type

* Move allowCreateNew to CollectionPickerOptions

* Add missing description attribute in Database mock

* Add types

* Add TableList component

* Add SchemaList component

* Fix naming

* Add DatabaseList component

* Add NotebookDataItemPickerResolver

* Fix typing

* Add TablePicker and NotebookDataPickerModal

* Update types

* Fix types

* Add folder type

* Fix initial state

* Update title

* Make query model-dependent

* Render tables

* Fix schema icon

* Adjust key generation

* Rename utilts to utils

* Use ItemList error prop

* Use value prop

* Rename NotebookDataPickerModal to DataPickerModal

* Automatically open datapicker if there is no value

* Highlight current item

* Rename value to initial value

* Fix item highlighting

* Rework TablePicker state

* Leave TODOs for names

* Fix selecting items

* Fix highlighting selected item

* Hide confirmation button

* Add fetchMetadata to tableApi

* Fix Table['schema'] type

* Fetch table metadata upon selection

* Remove options from DataPickerModal

* Fix collectionId typing in Question

* Add collectionId prop

* Remove title prop

* Add todo

* Fix confirmation button

* Remove old DataSourceSelector

* Bring back useSchemaListQuery

* Fix crash

* Fix picker not opening

* Hide dbs list and schemas list if there's only 1

* Remove unused ref

* Remove unused DataPickerListResolver

* Remove unused types

* Change conditional rendering to allow for loading state

* Revert collection-related changes

* Use RTK

* Avoid using stale data

* Fix highlighted db

* Remove todo

* Remove unused type

* Remove useSchemaListQuery

* Rename Value to TablePickerValue

* Move isValueEqual to utils and rename it to isTablePickerValueEqual

* Improve TODO

* Remove unused options prop

* Introduce tablePickerValueFromTable

* Avoid having 2 table metadata requests

* Update comment

* Update comment

* Remove unused function

* Allow null in tablePickerValueFromTable

* Extract helpers

* Rename schemaId to schemaName

* Remove description

* Improve naming

* Simplify types

* Add explanatory comments

* Fall back to empty state when there are no items

* Account for null schemas

* Account for null schema in tests

* Revert "Account for null schema in tests"

This reverts commit 0c96d1cb88.

* Revert "Account for null schemas"

This reverts commit 4f5c4e99ee.

* Improve typing around schema name

* Refactor auto-select logic

* Refactor

* Avoid comment

* Make useAutoSelectOnlyItem generic

* Do not enforce presence of at least 1 tab with TypeScript

* Fix types

* Remove obsolete comment

* Post-merge fix

* Integrate QuestionPicker in DataPicker (#42268)

* Add question and model pickers to Data Picker

* Add model attribute to data picker value

* Introduce DataPickerValue

* Start with the right tab when opening data picker modal

* Do not use stale sourceCard value

* Fix switching tabs when a table is selected

* Use undefined instead of null for consistency

* Do not show models/questions tabs when there are no models/questions

* Fix selecting models/questions in search results

* Remove dead code

* Remove dead code

* Ignore selecting collections

* Refactor useHasModels and useHasQuestions into useAvailableData

* Use models param to speed up the query

* Do not require `onConfirm` prop in `EntityPickerModal` (#42317)

* Make onConfirm prop optional

* Add a test for onConfirm prop assertion

* Table does not appear selected in single-schema dbs (#42336)

* Convert useAutoSelectOnlyItem arguments to param object

* Disable auto-selection when there already is a selection

* Use `DataPicker` in `JoinTablePicker` (#42330)

* Refactor DataStep:
- rename handleTableSelect to handleTableChange
- extract value and memoize it

* Remove redundant fragment

* Add new DataPicker props

* Use DataPickerModal in JoinTablePicker

* Remove initialTab prop since the default tab is always the models tab anyway

* Limit table selection to particular database

* Limit search results to a given database

* Support databaseId in useAvailableData

* Filter collection items by databaseId

* Use databaseId prop only for CollectionItemList component

* Fix types

* Fix filtering

* Use useLatest for onChange

* Fix typing

* Introduce shouldShowItem and use it instead of databaseId prop

* Improve PickerInfo type

* Use MLv2 to generate DataPickerModal value in JoinTablePicker

* Fix title

* Add isModel to TableDisplayInfo

* Add a hack to populate query metadata with info that table is a model

* Remove NewQuestionView & QuestionDataSelector (#42562)

* Temporarily disable recents tab in the data picker

* Update Data Picker tests (#42565)

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Fix metadata loading

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test and make it pass

* Update test

* Update tests

* Update test

* Use entityPickerModal() instead of modal()

* Use entityPickerModal() instead of modal()

* Update test

* Update test

* Update test

* Revert change that broke tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Remove test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Rename createDatabaseIdItemFilter to createShouldShowItem

* Update test

* Update and skip a test

* Remove test

* Update tests

* Update tests

* Update tests

* Remove test

* Update tests

* Update test

* Update test

* Update test

* Extract utils

* Use helpers

* Extract helpers

* Update test

* Update test

* Update test

* Update test

* Update test

* Filter out collections that do not have card or dataset

* Improve filtering

* Always show root and personal collections, see https://github.com/metabase/metabase/issues/42687

* Remove failing assertion

* Update tests

* Use entityPickerModalTab

* Accept strings in pickEntity

* Use entityPickerModalLevel

* Use entityPickerModalTab

* Use entityPickerModalTab

* Update tests

* Update test

* Update tests

* Update test

* Fix assertion

* Update test

* Update tests

* Update test

* Update tests

* Update tests

* Update test

* Update test

* Update tests
- ensure database list gets loaded like in a real app

* Update test

* Update test

* Integrate Recents tab in Data Picker (#42821)

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Fix metadata loading

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test and make it pass

* Update test

* Update tests

* Update test

* Use entityPickerModal() instead of modal()

* Use entityPickerModal() instead of modal()

* Update test

* Update test

* Update test

* Revert change that broke tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Remove test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Rename createDatabaseIdItemFilter to createShouldShowItem

* Update test

* Update and skip a test

* Remove test

* Update tests

* Update tests

* Update tests

* Remove test

* Update tests

* Update test

* Update test

* Update test

* Extract utils

* Use helpers

* Extract helpers

* Update test

* Update test

* Update test

* Update test

* Update test

* Filter out collections that do not have card or dataset

* Improve filtering

* Always show root and personal collections, see https://github.com/metabase/metabase/issues/42687

* Remove failing assertion

* Update tests

* Use entityPickerModalTab

* Accept strings in pickEntity

* Use entityPickerModalLevel

* Use entityPickerModalTab

* Use entityPickerModalTab

* Update tests

* Update test

* Update tests

* Update test

* Fix assertion

* Update test

* Update tests

* Update test

* Update tests

* Update tests

* Update test

* Update test

* Update tests
- ensure database list gets loaded like in a real app

* Update test

* Enable recents tab and update tests

* Update test

* Update tests

* Add Recents-related assertions

* Update test

* Clean up mocks

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-17 12:53:29 +00:00
Uladzimir Havenchyk
752bf845fc Add missing tests for user-level filter state in dashboards (#42826)
* Add missing tests for user-level filter state in dashboards

* Update e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-17 12:41:41 +00:00
Raphael Krut-Landau
5ac502a58c rebase (#42808) 2024-05-17 08:30:47 -04:00
Raphael Krut-Landau
95722dcbe3 New copy for strategyform (#42815) 2024-05-17 08:13:37 -04:00
Raphael Krut-Landau
918327bb34 Remove dead code (#42823) 2024-05-17 08:13:15 -04:00
Raphael Krut-Landau
12ae82f084 Fix BucketPickerPopover test (#42811) 2024-05-17 08:09:19 -04:00
Phoomparin Mano
74ec3eeec7 feat(sdk): document theming options in readme (#42784)
* add font size example

* feat(sdk): document theming options in readme
2024-05-17 17:16:42 +07:00
Sloan Sparger
7460cad859 [Feature branch] Make Trash Usable (#42339)
* Migration to add `trashed_from_*` (#41529)

We want to record where things were trashed *from* for two purposes:

- first, we want to be able to put things back if they're "untrashed".

- second, we want to be able to enforce permissions *as if* something is
still in its previous location. That is, if we trash a card or a
dashboard from Collection A, the permissions of Collection A should
continue to apply to the card or dashboard (e.g. in terms of who can
view it).

To achieve this, collections get a `trashed_from_location` (paralleling
their `location`) and dashboards/cards get a
`trashed_from_collection_id` (paralleling their `collection_id`).

* Create the trash collection on startup (#41535)

* Create the trash collection on startup

The trash collection (and its descendants) can't have its permissions
modified.

Note that right now, it's possible to move the Trash collection. I'll
fix this when I implement the API for moving things to the Trash.

* s/TRASH_COLLECTION_ID/trash-collection-id/g

* Add a comment to explain null comparison

* Move archived items to the trash (#41543)

This PR is probably too big. Hopefully documenting all the changes made here will make it easier to review and digest. So:

Tables with a `collection_id` had `ON DELETE SET NULL` on the foreign key. Since we only deleted collections in testing and development, this didn't really affect anything. But now that we are actually deleting collections in production, it's important that nothing accidentally get moved to the root collection, which is what `SET NULL` actually does.

When we get an API request to update the `archived` flag on a card, collection, or dashboard, we either move the item *to* the trash (if `archived` is `true`) or *from* the trash (if `archived` is `false`). We set the `trashed_from_collection_id` flag as appropriate, and use it when restoring an item if possible.

Because moving something to the trash by itself would have permissions implications (since permissions are based on the parent collection) we need to change the way permissions are enforced for trashed items.

First, we change the definition of `perms-objects-set-for-parent-collection` so that it returns the permission set for the collection the object was *trashed from*, if it is archived.

Second, when listing objects inside the Trash itself, we need to check permissions to make sure the user can actually read the object - usually, of course, if you can read a collection you can read the contents, but this is not true for the trash so we need to check each one. In this case we're actually a little extra restrictive and only return objects the user can *write*. The reasoning here is that you only really want to browse the Trash to see things you could "act on" - unarchive or permanently delete. So there's no reason to show you things you only have read permissions on.

Because previously the Collections API expected archived collections to live anywhere, not just in a single tree based in the Trash, I needed to make some changes to some API endpoints.

This endpoint still takes an `exclude-archived` parameter, which defaults to `false`. When it's `false`, we return the entire tree including the Trash collection and archived children. When it's `true`, we exclude the Trash collection (and its subtree) from the results.

Previously, this endpoint took an `archived` parameter, which defaulted to `false`. Thus it would only return non-archived results. This is a problem, because we want the frontend to be able to ask for the contents of the Trash or an archived subcollection without explicitly asking for archived results. We just want to treat these like normal collections.

The change made to support this was to just default `archived` to the `archived` status of the collection itself. If you're asking for the items in an archived collection, you'll only get archived results. If you're asking for the items in a non-archived collection, you'll only get unarchived results.

This is, for normal collections, the same thing as just returning all results. But see the section on namespaced collections for details on why we needed this slightly awkward default.

No change - this endpoint still takes an `archived` parameter. When `archived=true`, we return the Trash collection, as it is in the root collection. Otherwise, we don't.

* Make Trash Usable - UI (#41666)

* Remove Archive Page + Add `/trash` routing (#42226)

* removes archive page and related resources, adds new /trash route for trash collection, adds redirects to ensure consistent /trash routing instead of collection path

* fixes unit + e2e tests, corrects links generated for trash collection to use /trash over /collect/:trashId route

* updates comment

* Serialize trash correctly (#42345)

Also, create the Trash in a migration rather than on startup. Don't set a specific trash collection.id, instead just select based on the `type` when necessary.

* Fix collection data for trashed items (#42284)

* Fix collection IDs for trashed items

When something is in the trash, we need to check permissions on the
`trashed_from_collection_id` rather than the `collection_id`. We were
doing this. However, we want the actual collection data on the search
result to represent the actual collection it's in (the trash). I added
the code to do this, a test to make sure it works as intended, and a
comment to explain what we're doing here and why.

* Refactor permission for trashed_from_collection_id

Noah pointed out that the logic of "what collection do I check for
permissions" was getting sprinkled into numerous places, and it felt a
little scary. In fact, there was a bug in the previous implementation.
If you selected a collection with `(t2/select [:model/Collection ...])`,
selecting a subset of columns, and *didn't* include the
`trashed_from_collection_id` in that set of columns, then called
`mi/can-write?` on the result, you'd get erroneous results.
Specifically, we'd return `nil` (representing the root collection).

I think this is a reasonable fix, though I'm pretty new to using fancy
multimethods with `derive` and such. But basically, I wanted a way to
annotate a model to say "check these permissions using
`:trashed_from_collection_id` if the item is archived." And in this
case, we'll throw an exception if `:trashed_from_collection_id` is not
present, just like we currently throw an exception if `:collection_id`
is not present when checking permissions the normal way.

* Move existing archived items to the trash (#42241)

Move everything that's archived directly to the trash. It's not ideal
because we're wiping out the existing collection structure, but the
existing Archive page also has no collection structure.

* lint fixes from rebase

* Fix backend tests (#42506)

`can_write` on collection items was wrong because we didn't have a
`trashed_from_collection_id` - the refactor to ensure we didn't make
that mistake worked! 🎉

* Add an /api/collections/trash endpoint (#42476)

This fetches the Trash in exactly the same way as if we'd fetched it
with `/api/collection/:id` with the Trash ID. I hadn't realized that the
frontend was doing this with the previously hardcoded Trash ID.

* Make Trash Usable - Dynamic Trash Collection Id (#42532)

* wip

* fixes hardcoded reference to trash id in sidebar

* remove TRAHS_COLLECTION

* fixes line and e2e tests

* fix invert logic mistake and fixes lint

* Make Trash Usable - Search Filter UI (#42402)

* adds filtering for archived items on the search page

* fix typing mistake

* Make Trash Usable - Bug Bash 1 (#42541)

* disables reordering columns in archived questions, disables modifying archived question name in question header, collection picker no longer defaults to archived item, keeps trashed collection from appearing collection picker search results, shops showing empty area in trashed dashboard info sidebar, disables uploading csvs to trashed collections

* impls pr feedback

* fix e2e failure

* Localize the name of the Trash (#42514)

There are at least two spots where we can't just rely on the
after-select hook, and select the collection name directly from the
database: the Search and Collection API.

In these cases we need to call `collection/maybe-localize-trash-name`,
which will localize the name if the passed Collection is the Trash
collection.

* Update migration IDs

Migration IDs need to be in order.

* Fix failing mariadb:latest test (#42608)

Hooooly cow. Glad to finally track this down. The issue was that
booleans come back from MariaDB as NON BOOLEANS, and clojure says 0 is
truthy, and together that makes for FUN TIMES.

We need to turn MariaDB's bits to booleans before we can work with them.

* Make Trash Usable: Add `can_restore` to API endpoints (#42654)

Rather than having two separate implementations of the `can_restore`
hydration for cards and dashboards, I set up automagic hydration for the
`trashed_from_collection_id`. Then the hydration method for
`can_restore` can just first hydrate `trashed_from_collection` and then
operate based on that.

* fix can_restore for collections trashed from root

* Fix `trashed_from_location` for trashed subcols

We were setting `trashed_from_location` on subcollections to the
`trashed_from_location` of the ancestor that was trashed - which is
wrong.

This would have caused bugs where collections would be restored to the
root collection, regardless of where they were originally trashed from.

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>

* Fix Trash rollbacks (#42710)

* Fix Trash rollbacks

There were a few errors in my initial implementation.

First, we can't simply assume that `trashed_from_location` and
`trashed_from_collection_id` are set for anything in the archive. They
should be set for things *directly* trashed, but not for things trashed
as part of a collection.

Therefore, we need to set `location` and `collection_id` to something
like "if the item is in the trash, then the `trashed_from` - otherwise,
don't modify it".

Second, because `trashed_from_collection_id` is not a foreign key but
`collection_id` is, we have a potential problem. If someone upgrades,
Trashes a dashboard, then Trashes and permanently deletes the collection
that dashboard _was_ in, then downgrades, how do we move the dashboard
"back"? What do we set the dashboard's `collection_id` to?

The solution here is that when we downgrade, we don't actually move
dashboards, collections, or cards out of the Trash collection. Instead
we just make Trash a normal collection and leave everything in it.

* Make Trash Usable - Bug Bash 2 (#42787)

* wip

* fixes access to property on null value

* pr clean up

* more clean up

* Fix up tests

- permissions will check the archived from location. So recents need to
select :report_card.trashed_from_collection_id and
:dash.trashed_from_collection_id to satisfy mi/can-read?
- some commented out code with `(def wtf (mt/user-http-request
...))`. Restore tests.
- probably commented out because the recent views come back in an order
but we don't care about the order. And it was asserting against an
ordered collection. Just go from [{:id <id> :model <model>} ...] to a
map of {<id> <model>} and then our comparison works fine and is not
sensitive to order.

* put try/finally around read-only-mode

ensure the setting read-only-mode! to false happens in a finally
block. Also, set read-only-mode to false in

```clojure
(deftest read-only-login-test
  (try
    (cloud-migration/read-only-mode! true)
    (mt/client :post 200 "session" (mt/user->credentials :rasta))
    (finally
      (cloud-migration/read-only-mode! false))))
```

But worryingly, I think we have a lurking problem that I'm not sure why
we haven't hit yet. We run tests in parallel and then put all of the
non-parallel tests on the same main thread. And when one of these puts
the app in read-only-mode, the parallel tests will fail. HOPEFULLY since
they are parallel they won't be hitting the app-db necessarily, but
there could be lots of silly things that break.

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: dan sutton <dan@dpsutton.com>
2024-05-17 06:01:30 -04:00
Luiz Arakaki
dc4c56174d Update Metabase Analytics content for v50 (#42799)
* update metabase analytics with cache dashboardtab and subscriptions and alerts dashboard

* update yamls without view_count

* fix metabase analytics namespace
2024-05-17 09:51:28 +00:00
Uladzimir Havenchyk
d5bd7cac1f Maintain user-level state in dashboards for filters (#39813) 2024-05-17 12:37:14 +03:00
Nick Fitzpatrick
8fd90abb5a defaultToRecentsTab added (#42800) 2024-05-17 15:06:39 +07:00
Oisin Coveney
e2828c7902 Bump screenfull version to 6.0.2 (#42776) 2024-05-17 10:23:53 +03:00
Jesse Devaney
c747c1709c Move series data label formatters from option to the model (#42616)
* move series data label formatters to the model

- TODO: move stacked data label formatters to the model

* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* remove unused formatting options parameter

* move stacked labels formatter to model

* fix stacked combo chart label display for non-stacked lines

* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* fix waterfall chart labels

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-05-17 07:02:41 +00:00
Raphael Krut-Landau
c059690297 rebase (#42788) 2024-05-17 00:22:38 -04:00
Cal Herries
0fd6da0b1f Remove some columns from serialized card and table entities (#42812) 2024-05-16 21:44:09 -06:00
Raphael Krut-Landau
6cfb3b5f21 Add cache invalidation configuration form to question info sidebar (#42729) 2024-05-16 23:33:06 -04:00
Cam Saul
7a9b6acca8 Fix sorting by Offset() custom expression aggregation (#42737)
* Fix sorting by `Offset()` custom expression aggregation

* Unskip test

* Revert breaking change to `mt/id` and related
2024-05-17 02:56:23 +00:00
Cal Herries
c7b5cddbdd Exclude view_count columns from serialized dashboard and card (#42801) 2024-05-17 01:18:01 +00:00
Alexander Polyankin
4e50783cd2 Fix filters with is-null and not-null operators crashing the QB (#42796) 2024-05-17 00:44:10 +00:00
bryan
7ab065f2e3 Recents API Improvements (#42660)
* handle recent view for non-existant entity

* test that recent views works with missing entities

- just doesn't return them.

* dont count on there being entities in the app-db

* Query for the entity data upfront for recent-views

- Still need to check for the model_object due to popular-items calls

* cleanup, fix ellide logic

memoize get-parent-coll

* more cleanup

* rewire half of the queries

* rewrite the other queries, and improve docs

* align some queries

* lookup all entities ahead of time

- always return effective parent collections

* seperate n+1 tests

* use = instead of a set

* no need for a vector

* fixup simple table test

* go from effective-location-path to id instead of hydrating
2024-05-16 23:19:58 +00:00
Filipe Silva
b7253af4f2 Cloud Migration Feature (#41317)
* feat: cloud migration endpoints

* fix: don't leave open conn behind when checking migrations

`unrun-migrations` would open a new connection but not close it.
Since `with-liquibase` is happy enough using a data-source the fix is straightforward.

You can verify this by running the following code:

```
(comment
  (require '[metabase.cmd.dump-to-h2 :as dump-to-h2]
           '[metabase.analytics.prometheus :as prometheus])

  (defn dump []
    (-> (str "cloud_migration_dump_" (random-uuid) ".mv.db")
        io/file
        .getAbsolutePath
        dump-to-h2/dump-to-h2!))

  (defn busy-conns []
    (-> (prometheus/connection-pool-info)
        first
        second
        :numBusyConnections))

  ;; each dump leaves behind 1 busy conn

  (busy-conns)
  ;; => 0

  (dump)
  (busy-conns)
  ;; => 1

  (dump)
  (busy-conns)
  ;; => 2

  (dump)
  (busy-conns)
  ;; => 3

  )
```

* fix: flush h2 before returning from dump

* rfct: move code to models.cloud-migration

* test: add login while on read-only test

* fix: assorted cloud_migration fixes from review

* test: allow overriding uploaded dump

* fix: add UserParameterValue to read-only exceptions

Also make the list a little bit nicer.

* fix: only block dumped tables on read-only

* fix: recover on startup if read-only was left on

* feat: block migration when hosted already

* test: test settings for migration

* feat: cloud migration supports retries and multipart

* test: sane dev defaults for migration

* fix: upload 100% shouldn't be migration 100%

* chore: make up a new migration id after merge

* Cloud Migration FE (#42542)

* it's a start

* ui wip

* wip

* dynamic polling intervals, and custom modal for migrate confirmation modal

* cleans out most of the remainig UI TODOs

* adding progress component

* impls team feedback

* makes component more testable, starts some a unit test for the CloudPanel

* finish unit testing

* reverts api changes

* update progress styling

* fix type issues

* fix e2e failure, fix feature unit tests by holding last migration state in fetchMock if more requests than expected happen at the end of a test, remove white spacing change in clj file

* second pass at fixing tests

* fix copy from ready-only to read-only

* copy fix

* Update frontend/src/metabase/admin/settings/components/CloudPanel/MigrationError.tsx

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

* Update frontend/src/metabase/admin/settings/components/CloudPanel/MigrationInProgress.tsx

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

* adding e2e test

* pr feedback

---------

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

---------

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-05-16 18:05:32 -05:00
Alexander Polyankin
606686c3c4 Use is-empty and not-empty for string columns in quick filter drill (#42804) 2024-05-16 22:51:38 +00:00
Ryan Laurie
4308410389 Basic Upsell System Setup + Hosting Upsell (#42785)
* Basic Upsell System Setup

* Hosting Upsell

* add upsell to updates page

* update utms

* update copy, utms and text
2024-05-16 16:12:28 -06:00
Raphael Krut-Landau
f225c92795 Allow license tokens that start with airgap_ (#42733)
Accept license tokens with an `airgap_` prefix, besides the already accepted 64-character long tokens.

This weakens the validation in the FE. Rigorous validation of tokens beginning with `airgap_` occurs in the BE. See this [Slack message](https://metaboat.slack.com/archives/C064EB1UE5P/p1715813885703249?thread_ts=1715813614.437989&cid=C064EB1UE5P).
2024-05-16 17:58:24 -04:00
Raphael Krut-Landau
430df7ee49 Browse-related heading changes (#42779)
Rename "Browse data" to "Browse databases"

Closes #42781
2024-05-16 17:56:46 -04:00
Aleksandr Lesnenko
8b9e15266a combo stacked chart (#42085)
* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* show show data values setting on normalized charts that have a line series

* fixes
2024-05-16 18:40:46 -03:00
adam-james
672fa62e47 Area Bar Combo Stacked Viz Settings Migration (#42740)
* Area Bar Combo Stacked Viz Settings Migration

Per: https://www.notion.so/metabase/Migration-spec-e2732e79215a4a5fa44debb272413db9

This addresses the necessary migrations for area/bar/combo stacked viz settings.

* Custom migration test works

* Check that non area/bar/combo charts also remove stack_display
2024-05-16 14:36:41 -07:00
Braden Shepherdson
d46c23fe55 [MBQL lib] Add canPreview and use it from the notebook (#42791)
* [MBQL lib] Add `canPreview` and use it from the notebook

* Fix previewQuery

* Apply can-preview across stages; add unit tests

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-16 21:27:36 +00:00
Jeff Bruemmer
02e42f32e3 49.11 to list of releases (#42794) 2024-05-16 16:30:59 -04:00
adam-james
2f30a47ffc Correct Data Shape for Multi-Series Static Viz (#42730)
* Correct Data Shape for Multi-Series Static Viz

Fixes: #41787

During the echarts migration, some backend tests needed fixing. In this process, the shape of data (eg. list of cards
and their data results from execution) were altered.

This was done to fix failing tests and renders for single series cards (all Questions and many dashcards), but didn't
correctly handle a multi-series card.

This conditionally adds back the expected shape.

Perhaps in a follow on PR it's worth inspecting the implementation of the :javascript_visualization render method to
clean it up. Probably worth putting some Malli schemas around it too to make it clearer what shape we need.

* Make sure card/data maps going into static-viz are distinct

* Add a test util to render dashcards, add multiseries card test

We haven't made a 'unit' (perhaps more like a small integration test at this point) test for multi series dashcards
yet.

In most other cases, making sure a card (Question) renders properly is sufficient, but the multi series dashcards are
a special case. It's probably useufl to have a test or two, and the dashcards test util should hopefully help future
test writing a bit now too.
2024-05-16 13:05:23 -07:00
Kamil Mielnik
cd007ba6ac Offset in custom expressions (#42751) 2024-05-16 19:23:16 +00:00
Aleksandr Lesnenko
361f568ee1 drop percy (#42303) 2024-05-16 13:37:29 -03:00
Nemanja Glumac
54d7a3b559 Remove the last traces of BuildJet from the CI (#42758) 2024-05-16 16:42:28 +02:00
Oisin Coveney
d58cb8a6cc Fix unmounted node error on ExplicitSize (#42766) 2024-05-16 14:15:04 +00:00
Alexander Polyankin
0147c695a7 Fix broken pivot table questions that had out of date viz settings (#42698) 2024-05-16 09:53:14 -04:00
Mahatthana (Kelvin) Nomsawadi
3dbeb3bfbd Automate releasing embedding SDK (#42516)
* WIP some workflows

* Add reminder todo comment

* Complete the workflow

* Fix YAML syntax error

* Trigger the workflow

* Fix resuable workflow

* Fix uberjar workflow

* Add missing steps before testing

* Pass recrets to resuable workflow, so it could run

* Fix sdk artifact location

* Remove unneeded output

* fetch tags, so it doesn't fail on push

* Only running EE uberjar in SDK workflow

Because OSS is never needed

* Fix incorrect syntax

* Shuffle workflow so it failed fast

* Fix syntax error

* Attempt to bulid only EE jar

* Fix the error handling step

* Fix failing to upload to s3

* Fix create a PR step

* Fix the last temporary command, so the build looks green

* Remove hack to trigger the workflow

* Remove completed todo comment

* Clean up S3 step

* Add todo comment

* Upload correct docker image name

* Bump the package version before building SDK

* Fix uploading the correct Metabase dev container name

* Fix one too many double quote

* Push the correct docker image

* Fix PR creation step

* Dry run publishing SDK

* Use a separate uberjar workflow for SDK

* Remove a bunch of unused steps

* Update variable names, step names

* Improve tag error message

* Correct m2-cache-key to be unique

* Fix the push tag failure step to only run when failed to push tag

* Fix changed artifact name

* Improve env name for clarity

* Fix extra trailing empty line

* Remove conditions from running certian steps

* Removing npm publish dry-run
2024-05-16 13:21:09 +00:00
Tim Macdonald
34900091e5 [ParseSQL] Find-and-replace for variables and field filters (#42703)
* Add a simple replace-names test

* Support find-and-replace in cards with variables and field filters

[Fixes #42580]

[Fixes #42581]

* Add models.card/replace-fields-and-tables!

* Docstring fix

* Little cleanup
2024-05-16 13:13:59 +01:00
Mahatthana (Kelvin) Nomsawadi
44cb385c40 Upgrade redshift dependency version (#42746) 2024-05-16 06:03:22 +00:00
Cal Herries
0843dafbd9 Realize DB transient rows in after-select hook before calling driver.u/features (#42744) 2024-05-16 04:07:33 +00:00
Luis Paolini
4a6dfe409b Bump SQL Server driver for v50 (#41021)
same compatibility of the previous one but this is compatible with JDK 21
https://learn.microsoft.com/en-us/sql/connect/jdbc/release-notes-for-the-jdbc-driver?view=sql-server-ver16

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-15 20:45:23 -03:00
Nick Fitzpatrick
62754d5b88 42701 search type ahead cp (#42716)
* respect search-typeahead-enabled

* updating unit test

* adding e2e test
2024-05-15 18:48:15 -03:00
Raphael Krut-Landau
95d5a829de Move createMockModelResult to browse folder (#42690)
* Move createMockModelResult to browse folder

* fix
2024-05-15 17:23:28 -04:00
Jeff Bruemmer
95db580178 docs - update appearance settings (#42388) 2024-05-15 17:09:19 -04:00
Jeff Bruemmer
7bdfafc822 docs - offset (#42484) 2024-05-15 17:08:54 -04:00
Nick Fitzpatrick
f37c417b89 replace search bar with command palette toggle (#42603)
* replace search bar with command palette toggle

* e2e test part one

* onboarding suite

* green e2e

* unit tests

* delete shame
2024-05-15 17:26:45 -03:00
Alex Yarosh
e8d6f86ccd [docs] Jessica's onboarding feedback (#42670)
* update collections

* feedback

* links

* 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-05-15 19:28:31 +00:00
John Swanson
9aa572cbc1 remove TODOs from metabase.models.setting (#40020)
3 TODOs were removed here:

- "a way to SET Database-local values." More like TODONE :haaa:

- "we should probably also bind this [that is, *database-local-values*]
in sync contexts e.g. functions in [[metabase.sync]]" I think we don't
need to do this. The full set of maybe-database-local settings right now
is `aggregated-query-row-limit`, `unaggregated-query-row-limit`,
`database-enable-actions`, and `persist-models-enabled`. None of these
need to be set when `sync`ing. If at some point we do add a db-local
setting that should affect the way syncing works, we will need to do
this - but I don't think this TODO will help figure that out.

- "settings sent via an env var aren't returned for security purposes.
It is an open question whether we should obfuscate them and still show
the last two characters like we do for sensitive values that are set via
the UI." I think if it's been this way for 5 years, it no longer
qualifies as an "open question." We can reopen if down the road if this
is something we want.
2024-05-15 12:10:16 -07:00
adam-james
a52450c38a Pivot table exports (#41668)
* PoC Pivot table exporting.

Works so far!

This just hacks a couple things in. I added the :query via format_rows, which should instead have its own proper
middleware

Pivot export should probably not just be in the middleware namespace but in qp.pivot.

Should not break the streaming results writer for non-pivots... obviously this breaks ordinary results, so that needs
to be handled properly.

Better documentation about how the logic actually works. Pivot tables are hard to remember/easy to forget, so some
very clear diagrams/examples would probably be good.

* adjust csv export to export a pivot table when pivot options exist

* post processing of pivot table rows for card/dashcard downloads

* WIP on getting pivot exports to work with unsaved questions

* WIP getting pivot exports working on unsaved questions

The dataset POST /pivot endpoint is used to get the pivot data to the frontend, but also to get the pivot query.

The query that is returned by the POST comes from the json_query, which is populated by the userland-query stuff with
the last run query. The pivot qp runs mulitple queries and each query runs through the regular userland query qp, so
we'll 1. see lots of executions recorded and 2. end up with the wrong query in the POST return. It'll look mostly
correct, but due to how the pivot qp works won't necessarily have all of the fields.

That incorrect pivot query is passed to the /:export-format endpoint and we don't end up seeing correct results.

Since that json_query gets fed back to the backend when doing an export, we do need it to be correct, like the query
that was sent to /pivot in the first place.

Since this is a WIP, I've just passed the query as a string to :original-query in :info, and if that exists, use that
to fill the :json_query key.

Then, also add a :was-pivot flag so that the dataset download endpoint can look at it and use the pivot qp instead of
the regular qp. Even if we have the correct 'top level' query, we need to run it through the pivot qp to get the full,
correct pivoted results.

* Pivot Export Test

Here I've added a pivot export test that has various assertions trying to capture the correct output from the pivot
csv export.

I've done my best to explain the tests with comments, but have also left a (comment ) form with a function
`explore-pivot` to help *show* rather than tell what the expected pivot output should be.

I've created this new namespace to first capture this pivot export test with the intent to add tests that can improve
our confidence that ALL exports/downloads in ALL places behave as we expect in the future. It just seemed nice to
start fresh here with the pivot export test first.

* Don't need to make this public.

* Add lots of comments to hopefully make this a bit easier to follow

* Added an explore-raw-pivot fn in comment form

* Update test/metabase/api/downloads_exports_test.clj

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

* begin addressing feedback

- finish an unfinished docstring
- merge info instead of assoc
- use a native query to build the pivot data instead of using a custom dataset, to keep test speed ok

* Create a new ns for the pivot post processing utils

Separate the post processing fns into their own namespace. This means I can easily add a test namespace for the post
processing specifically as well.

* Add pivot postprocessing test ns, not complete, but decent start

* fix mistake in endpoint. Only add original query to first pivot q

* Figured out how to keep the original query without storing as a string

* Perhaps this'll fix things properly?

---------

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-15 17:47:58 +00:00
Romeo Van Snick
3506941ec8 Design update for extract examples (#42399)
* Move the extract examples inline

* Use ui Button for ClickAction and render examples inline
2024-05-15 17:23:12 +00:00
Phoomparin Mano
c16ff2be32 Support basic theming in interactive data tables for embedding SDK (#42411)
* support theming in table

* theme injection with hoc

* reasonable default theme options

* customizable text color

* theming table header

* table theming

* change theme configuration order

* apply sorted cell color directly

* gutter background

* remove header theming for now

* fix: id column styling

* id column borders

* border color

* add cell hover color

* conditional hover color

* use brand color to accent

* add default theme values to unit test

* cell background should default to white

* update unit test

* remove unused properties

* remove duplicated color declaration as inner cell data styles it

* remove duplicate fallback

* remove unused use-embedding-theme hook

* use theme color from Mantine for css variables

* update defaults

* inject default component theme

* add notes on cell data theme

* update unit tests

* update unit tests

* remove no-op text-brand hover color

* remove no-op is sorted cell color
2024-05-16 00:13:03 +07:00
Raphael Krut-Landau
13bbb9d0c7 Add cache configuration form to dashboard sidebar (#42192) 2024-05-15 12:42:45 -04:00
Raphael Krut-Landau
413872d243 Don't explicitly set the dimensions of the verified model icon (#42702) 2024-05-15 12:40:44 -04:00
Raphael Krut-Landau
e23e654c65 Use new icon for verified models (#42689) 2024-05-15 09:23:26 -04:00
Nemanja Glumac
5333bd946a Require an explicit knob to allow uploading ReplayIO recordings (#42649)
* Explicitly decide whether to upload or not

* Upload in the main e2e workflow, but skip uploading in stress-test workflow

* Do not record runs in the stress-test workflow

* Add Replay API key

Even though we're not using it in this workflow. 🤷

* Omit env var from the stress-test workflow
2024-05-15 14:10:29 +02:00
Alexander Solovyov
5cfc079d1d json unfolding: parse incrementally instead of using cheshire (#42638)
this lowers memory usage 100x for 50kb strings (our limit before this change) and speeds up parsing by an order of magnitude.

For example, results for parsing 42kb string (already in memory):

Before: Time per call: 6.32 ms    Alloc per call: 8,732,850b
After:  Time per call: 55.16 us   Alloc per call: 83,254b
2024-05-15 13:08:32 +03:00
Romeo Van Snick
214a59894e Info icon design update (#42557)
* Render item icon inline with column icon

* Use inline info icon in field picker

* Use new QueryColumnInfoIcon on filter columns picker

* Use new QueryColumnInfoIcon on suggestions dropdown

* Use new QueryColumnInfoIcon aggregations dropdown

* Use new QueryColumnInfoIcon filter modal

* Use new QueryColumnInfoIcon in BreakoutColumnListItem

* Use new QueryColumnInfoIcon in FieldList

* Use new QueryColumnInfoIcon in DataSelectorFieldPicker

* Update TableInfoIcon to render fallback too

* Use new TableInfoIcon in DataSelector

* Use new TableInfoIcon in ViewHeader

* Fix types in breakout column

* Move aria-label to wrapper

* Move binning back to the right

* Always give info icon full opacity

* Remove asDot props everywhere
2024-05-15 08:48:18 +02:00
Uladzimir Havenchyk
90f7e62f58 Optimize getColumnCardinality by using cache correctly (#42664) 2024-05-15 06:01:06 +00:00
Ngoc Khuat
fe1f5950fb An one time job to init send-pulse trigger and migration down to clean up send-pulse triggers (#42316)
* Add a job to init send pulse trigger only once

* Send pulse triggers should respect report timezone (#42502)
2024-05-15 05:42:44 +00:00
Aleksandr Lesnenko
e9f3f490f5 fix static combo chart crashes when viz settings are invalid (#42669)
* fix static combo chart crashes when viz settings are invalid

* spec
2024-05-14 23:20:30 +00:00
Emmad Usmani
f401054091 remove percent change tooltip from waterfall chart (#42658) 2024-05-14 19:42:51 -03:00
Jeff Bruemmer
342ed573bb docs - view data and create queries (#42121) 2024-05-14 16:31:47 -04:00
Braden Shepherdson
a6039a0fcb [MBQL lib] Add native queries to the shared tests for all drills (#42478)
Follow up to #42424.

This enforces that all drills do not appear on native stages.
Also fixes one more drill on top of the two in #42424 that were wrongly
showing up for native queries.
2024-05-14 20:20:22 +00:00
Uladzimir Havenchyk
df92623dda Optimize isVisualizationClickable check in TableInteractive (#42639)
* Optimize isVisualizationClickable check in TableInteractive

* Destructure question

* Mode is nullable
2024-05-14 22:51:19 +03:00
Alexander Polyankin
1519acb6c9 Fix metadata loading issues after tabs (#42655) 2024-05-14 15:04:20 -04:00
Braden Shepherdson
50a03a1956 [Drivers] New features to replace hard-coded driver lists in tests (#42602)
- `:metadata/key-constraints` for those databases which formally track
  PK and FK key constraints. Some databases (eg. Presto/Athena/Starburst
  family) don't support constraints like that, but do support querying
  based on foreign keys (which is the `:foreign-keys` feature).
- `:connection/multiple-databases` for databases where a single
  connection can connect to many databases. This is the case for Athena,
  since it connects to an S3 bucket and exposes all files in the bucket
  as databases through that single connection.
- Also removed a troublesome "all DBs except a huge list" case in the
  SSH tunnel tests with a shorter list of supported drivers.
2024-05-14 13:06:35 -04:00
Anton Kulyk
706a553550 Use icons for "Line style" viz settings (#42637)
* Add icons

* Use icons
2024-05-14 18:01:11 +01:00
Nemanja Glumac
f4c7b9f0fc Fix broken metric revision API call (#42634)
* Fix broken metric revision API call

Fixes #42633

* Add E2E repro for #42633

* Fix metrics revision history in the data reference

* Add repro for #42633 for the reference page

* Consolidate tests

* Do not use hard coded id

* Fix lint errors
2024-05-14 16:27:20 +00:00
Ryan Laurie
5437e3d34d Disable Error Diagnostic Modal In Embedding (#42641)
* Disable Error Diagnostic Modal In Embedding

* add e2e test for diagnostic modal
2024-05-14 09:36:16 -06:00
bryan
60888cc593 handle RecentViews for non-existant entites (#42643)
* handle recent view for non-existant entity

* test that recent views works with missing entities

- just doesn't return them.

* dont count on there being entities in the app-db
2024-05-14 15:32:37 +00:00
Ryan Laurie
52d32c15e0 Recents Picker Tab (#42079)
* add recents tab

type updates

fix unit test

change where we filter recents

WIP Recents Tab

wip recents

design updates

update recents design to match search

use new recents format

initial recents implementation

fix types

* fix e2e tests

* update more e2e tests

* allow recents filters

* update test mocks

* add unit tests for recents tab

* update e2e tests

* add e2e tests for recents picker tab

* fix lost access test
2024-05-14 09:19:28 -06:00
Nemanja Glumac
47b3f17292 Remove unused @visx libraries (#42624)
* Remove `@visx/event`

* Remove `@visx/legend`

* Remove `@visx/responsive`

* Remove `@visx/mock-data`

* Remove `@visx/tooltip`
2024-05-14 16:15:38 +02:00
Ngoc Khuat
b6b67a6158 Delete pulses when archive dashboard (#42558) 2024-05-14 14:09:51 +00:00
Ngoc Khuat
11c985398d Fix migration fail with encryption key (#42617) 2024-05-14 21:09:15 +07:00
Raphael Krut-Landau
8b6e0bf15f Fix column widths in Browse models (#42601) 2024-05-14 09:40:51 -04:00
Chris Truter
c594662969 Fix reflection on newer JVM versions (#42630) 2024-05-14 10:05:08 +00:00
Nemanja Glumac
f52e02ff58 Remove unused SettingsBatchForm component (#42627)
* Remove unused `SettingsBatchForm` component

* Remove `react-collapse` and its types
2024-05-14 09:05:17 +00:00
Nemanja Glumac
1a44a83c3a Allow multiple values for string operators in the dashboard (#42013)
* Expand the single or multi-selectable string filter choices

* Mark operators as `multi`

* Wrap an existing test in a separate `describe` block

* Test multiple values settings

* Expand repro to include multiple dashboard filter values

* Ease the load by limiting the card results

* Switch to the more flexible data structure for the dashboard filters

* Expand the assertions

* Fix typo

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-14 10:46:44 +02:00
Romeo Van Snick
50e64abfac Prevent the suggestion popover from flipping to the top (#42625) 2024-05-14 10:35:23 +02:00
Uladzimir Havenchyk
2555eebaa7 Avoid unnecessary re-renderings in column settings sidebar (#42595) 2024-05-14 11:22:44 +03:00
Nemanja Glumac
1d1bcdff9f Remove number-to-locale-string (#42590) 2024-05-14 06:53:41 +02:00
Aleksandr Lesnenko
0ecb5b085c allow description columns to be dimensions of charts (#42539) 2024-05-14 03:12:50 +00:00
Emmad Usmani
47148ce79b add + symbol to percent change tooltip (#42614) 2024-05-13 23:29:45 -03:00
Emmad Usmani
090222677a refactor legend components to use items prop (#42417)
* refactor legend components to use items prop

* update RowChart

* add types

* add key to type

* fix type errors

* fix legend.unit.spec.ts
2024-05-14 01:35:58 +00:00
bryan
2b91354fd4 New Recents API Format (#42239)
* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* ellide inactive tables

* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* New Recents + Popular API Format - Frontend (#42305)

* fix tests

* new API payload format for recents and populars

* update url generation

* update recents components

* update tests

* only show 5 recents in command palette

* remove unused types

* update tests

* obey the linter

* type updates

* fix unit test

* change where we filter recents

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>

* fix modelToUrl types

* respond to review comments

* post merge test fix

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-13 22:55:58 +00:00
Raphael Krut-Landau
cc0a4231f4 Ellipsify descriptions properly in Browse models (#42456)
* Ellipsify descriptions properly in Browse models

* Simplify
2024-05-13 20:47:44 +00:00
Jeff Bruemmer
e6213e4b45 add 49.10 (#42599) 2024-05-13 20:26:31 +00:00
adam-james
127a62f640 Don't use the slugify util for filenames (#42475)
* Don't use the slugify util for filenames

* Fix tests that looked for incorrect filenames

* add a test

* fix filename in pulse test util
2024-05-13 13:21:22 -07:00
Noah Moss
9d968d9eef SCIM-scoped API key (#42086) 2024-05-13 15:49:30 +00:00
Nemanja Glumac
dcc5587ff7 Remove classlist-polyfill (#42588) 2024-05-13 15:44:07 +00:00
Ngoc Khuat
35a487d367 Static viz get background color thread safe (#42548) 2024-05-13 22:17:44 +07:00
Nemanja Glumac
3820cf05f0 Remove color-harmony (#42577) 2024-05-13 15:05:13 +00:00
Uladzimir Havenchyk
1fe63c52bf Partially fix columns and viz settings mismatch (#42344)
From now we allow mismatch between `base-type` if we need to match columns and columnSettings
2024-05-13 14:35:14 +00:00
Romeo Van Snick
9665e569f1 Combine/extract shortcuts snowplow events (#42445)
* Copy question event to new version

* Add new events for adding column via plus modal

* Add plus modal variants

* Track combine column via plus header

* Track extract column via plus header

* Add test for combine question event

* Add e2e test for extract column shortcut snowplow events
2024-05-13 15:52:54 +02:00
Romeo Van Snick
e3dffcc497 Combine column shortcut (#42442)
* Add index file to CombineColumns

* Add CombinColumnAction

* Add CombinColumnsAction to default and embedding modes

* Fix outdated --color-brand references

* Set up sequenced close handler in combine columns

* Allow outside clicks to happen when popover is not open

* Add e2e test for combine column shortcut

* Remove unused prop

* Rename file to match component name: CombineColumnsAction

* Simplify test assertion

* Set width on combine columns action

* Remove superflouous ? check
2024-05-13 14:16:05 +02:00
Kamil Mielnik
f596f0b00f Cover Offset() in aggregations with e2e tests (#42455)
* Add repro for 32323

* Fix offset not working in case

* Make offset function return any

* Add a repro for #42377

* Fix order of adjustments

* Revert unrelated changes

* Remove commented code

* Revert unrelated changes

* Refactor test

* Type offset aggregation

* Add a test for no order by or breakout clause

* Add a basic test for breakout clause

* Fix assertion

* Remove problematic dependency

* Fix uuids generation

* Remove redundant limit

* Add a test for multiple breakouts

* Update test names

* Extract OFFSET_SUM_TOTAL_AGGREGATION

* Add a repro for metabase#42509

* Add a test for multiple aggregations and breakouts

* Remove unused intercept

* Move uuid utils to separate file
- it wasn't possible to import the utils file in e2e tests without it

* Make isUuid a type guard

* Add tests for sorting

* Tag the test

* Add extra assertion to verify expression parsing

* Add a complex scenario

* Reverse isFirst logic
2024-05-13 11:04:20 +00:00
Nemanja Glumac
38d540a91f Remove code related to GoogleAnalytics tracking (#42556) 2024-05-13 12:01:41 +02:00
Ngoc Khuat
77fccd8b63 Quartz: auto delete jobs without a class during scheduler initialization (#42383) 2024-05-13 16:07:48 +07:00
Phoomparin Mano
e8dc5ec5a6 Migrate smart scalar and night mode to support Mantine theming (#42347)
* migrate smart scalar to css modules

* lighten theme color

* adjust margin

* map space 1 to xs

* use c prop instead of color

* use rem unit

* use rem unit

* add y margin

* return null when no children

* comment on text variation

* cleanup unused components and add dark mode todo

* remove todo comment

* support night mode in embedding

* lift dashboard theme to redux

* make theme non-nullable with default

* use component prop instead of title tag

* optional display theme

* restore tooltip state

* add default mock state

* remove theme from embed

* replace handleActions with createReducer
2024-05-13 08:57:16 +00:00
Nemanja Glumac
f8474255e8 Upgrade Cypress to v13.9.0 (#42507)
* Upgrade Cypress to `v13.9.0`

* Upgrade `@replayio/cypress` to `v2.1.0`

* Upgrade `cypress-real-events` to `v1.12.0`

* Upgrade `esbuild` to `v0.21.1`
2024-05-13 09:55:04 +02:00
Nicolò Pretto
84519c835b remove google analytics (#42515) 2024-05-13 09:44:35 +02:00
Phoomparin Mano
6cc0f2bc9c bump to 0.1.3 (#42519) 2024-05-13 07:18:35 +00:00
Romeo Van Snick
eca348eab9 Extract column shortcut (#42261)
* Render plus button in interactive table header

* Add columnShortcuts on ClickObject

* Dispatch click action for columnShortcuts on plus button

* Make onCancel an optional prop

* Add ExtractColumn action

* Add ExtractColumn action to Default and Embedding mode

* Use arrow_split icon for extract column action

* Add title to extract column popover

* Add e2e test for Extract column shortcut

* Use asReturned in extract column

* Rename to Extract part of column

* Add a custom title to the new column shortcut

* Add onClose to ExtractColumn popover

* Hide shortcuts icon when question is not editable

* Fix null error

* Do not use submodules in import

* Scroll more in test
2024-05-13 08:26:52 +02:00
7210 changed files with 685870 additions and 289757 deletions

View File

@@ -1,5 +1,5 @@
;; -*- comment-column: 100; -*-
{:config-paths ["macros"]
{: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?
@@ -20,15 +20,144 @@
: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}
:metabase/warn-about-schema= {:level :warning}
: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-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.pulse/send-pulse!
metabase.query-processor.store/store-database!
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
:druid
:druid-jdbc
:googleanalytics
:mongo
:oracle
:presto-jdbc
:redshift
:snowflake
:sparksql
:sqlite
:sqlserver
:vertica}}
;;
;; disabled linters
@@ -53,7 +182,7 @@
(clojure.core.logic/fresh)
(clojure.core.logic/matcha)
(clojure.core.logic/run)
(clojure.test/is [query= =? malli=])
(clojure.test/is [query= =? malli= qv=])
(clojure.tools.macro/macrolet)
instaparse.core/transform
(metabase.async.streaming-response/streaming-response)
@@ -107,6 +236,7 @@
malli.core/explainer {:message "Use metabase.util.malli.registry/explainer instead of malli.core/explainer"}
me.flowthing.pp/pprint {:message "Use metabase.util.log instead of me.flowthing.pp/pprint"}
medley.core/random-uuid {:message "Use clojure.core/random-uuid instead of medley.core/random-uuid"}
metabase.driver/database-supports? {:message "Use metabase.driver.util/supports? instead of metabase.driver/database-supports?"}
metabase.lib.equality/find-column-indexes-for-refs {:message "Use lib.equality/closest-matches-in-metadata or lib.equality/find-closest-matches-for-refs instead of lib.equality/find-column-indexes-for-refs"}
metabase.test/with-temp* {:message "Use mt/with-temp instead of mt/with-temp*"}
toucan2.tools.with-temp {:message "Use mt/with-temp instead of t2.with-temp/with-temp"}}
@@ -114,6 +244,7 @@
:discouraged-namespace
{camel-snake-kebab.core {:message "CSK is not Turkish-safe, use the versions in metabase.util instead."}
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+."}
honeysql.format {:message "Use Honey SQL 2. Honey SQL 1 is removed as a dependency in Metabase 49+."}
honeysql.helpers {:message "Use Honey SQL 2. Honey SQL 1 is removed as a dependency in Metabase 49+."}
@@ -135,7 +266,7 @@
;; namespace(s). This is mostly a temporary placeholder until we go in and create module namespaces, which means
;; you should go create one.
;;
;; 2. A set of namespace symbols. All namespaces in other modules will only be allowed ;; to use namespaces from
;; 2. A set of namespace symbols. All namespaces in other modules will only be allowed to use namespaces from
;; this set. Ideally this set should only have one namespace, but restricting it to a set of several is still
;; better than `:any`.
;;
@@ -149,12 +280,9 @@
{metabase.actions #{metabase.actions.core}
metabase.analytics #{metabase.analytics.prometheus
metabase.analytics.snowplow
metabase.analytics.stats} ; TODO -- consolidate these into a real API namespace.
metabase.analyze #{metabase.analyze.classifiers.core
metabase.analyze.classifiers.name
metabase.analyze.fingerprint.fingerprinters
metabase.analyze.fingerprint.schema
metabase.analyze.query-results} ; TODO -- consolidate these into a real API namespace.
metabase.analytics.stats
metabase.analytics.sdk} ; TODO -- consolidate these into a real API namespace.
metabase.analyze #{metabase.analyze}
metabase.api #{metabase.api.common
metabase.api.dataset
metabase.api.permission-graph
@@ -162,8 +290,10 @@
metabase.async #{metabase.async.streaming-response
metabase.async.streaming-response.thread-pool
metabase.async.util} ; TODO -- consolidate these into a real API namespace.
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.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
@@ -190,7 +320,6 @@
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.native-query-analyzer #{metabase.native-query-analyzer}
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
@@ -205,12 +334,11 @@
metabase.pulse.render.js-svg
metabase.pulse.render.style} ; TODO -- consolidate these into a real API namespace.
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.sample-data #{metabase.sample-data}
metabase.search #{metabase.search.config
metabase.search.filter
metabase.search.scoring
metabase.search.util} ; TODO -- consolidate these into a real API namespace.
metabase.search #{metabase.search}
metabase.server #{metabase.server
metabase.server.handler
metabase.server.middleware.auth
@@ -266,8 +394,12 @@
metabase.analyze :any
metabase.api :any
metabase.async :any
metabase.audit :any
metabase.auth-provider #{metabase.util}
metabase.bootstrap #{}
metabase.cmd :any
metabase.compatibility :any
metabase.channel :any
metabase.config #{metabase.plugins}
metabase.core :any
metabase.db :any
@@ -284,11 +416,18 @@
metabase.metabot :any
metabase.models :any
metabase.moderation :any
metabase.native-query-analyzer :any
metabase.permissions :any
metabase.plugins :any
metabase.public-settings :any
metabase.pulse :any
metabase.query-analysis #{metabase.config
metabase.driver
metabase.legacy-mbql
metabase.lib
metabase.models
metabase.public-settings
metabase.query-processor
metabase.util}
metabase.query-processor :any
metabase.related :any
metabase.sample-data :any
@@ -310,11 +449,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
@@ -344,11 +483,7 @@
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
@@ -361,6 +496,7 @@
metabase-enterprise.audit-app.pages.common common
metabase-enterprise.sandbox.api.table table
metabase-enterprise.test met
metabase.analytics.sdk sdk
metabase.analytics.stats stats
metabase.analyze.query-results qr
metabase.analyze.classifiers.category classifiers.category
@@ -415,6 +551,7 @@
metabase.api.user api.user
metabase.api.util api.util
metabase.async.streaming-response.thread-pool thread-pool
metabase.channel.core channel
metabase.cmd.copy.h2 copy.h2
metabase.config config
metabase.config.file config.file
@@ -434,10 +571,6 @@
metabase.driver.druid.js druid.js
metabase.driver.druid.query-processor druid.qp
metabase.driver.druid.sync druid.sync
metabase.driver.googleanalytics.client ga.client
metabase.driver.googleanalytics.execute ga.execute
metabase.driver.googleanalytics.metadata ga.metadata
metabase.driver.googleanalytics.query-processor ga.qp
metabase.driver.impl driver.impl
metabase.driver.mongo.execute mongo.execute
metabase.driver.mongo.parameters mongo.params
@@ -473,6 +606,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
@@ -493,8 +627,8 @@
metabase.models.setting.cache setting.cache
metabase.models.timeline timeline
metabase.models.timeline-event timeline-event
metabase.native-query-analyzer query-analyzer
metabase.native-query-analyzer.parameter-substitution nqa.sub
metabase.analysis.native-query-analyzer nqa
metabase.analysis.native-query-analyzer.parameter-substitution nqa.sub
metabase.plugins.initialize plugins.init
metabase.public-settings public-settings
metabase.public-settings.premium-features premium-features
@@ -576,6 +710,7 @@
metabase.util.encryption encryption
metabase.util.encryption-test encryption-test
metabase.util.files u.files
metabase.util.grouper grouper
metabase.util.honey-sql-2 h2x
metabase.util.i18n i18n
metabase.util.i18n.impl i18n.impl
@@ -602,106 +737,114 @@
toucan.models models}}}
:lint-as
{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.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.fn/fn schema.core/fn
metabase.util.malli/defmethod schema.core/defmethod
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.http-test/with-captured-http-requests clojure.core/fn
metabase.channel.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-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.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-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.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}
: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.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
@@ -709,33 +852,34 @@
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.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/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.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.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
@@ -743,7 +887,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*
@@ -754,68 +897,70 @@
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-drivers hooks.common/do*
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.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/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.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.advanced-permissions.api.util-test/with-impersonations! macros.metabase-enterprise.advanced-permissions.api.util-test/with-impersonations!
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/defendpoint macros.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async macros.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async-schema macros.metabase.api.common/defendpoint
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-field-test/with-test-setup macros.metabase.models.query-field-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.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.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}}
:config-in-comment
{:linters {:unresolved-symbol {:level :off}}}
@@ -845,7 +990,19 @@
;; `metabase.driver.*`, excluding `-test` namespaces.
;;
{:pattern "metabase(?:(?:(?:-enterprise\\.sandbox)?\\.query-processor\\.)|(?:\\.driver\\.)).*(?<!-test)$"
:name qp-and-driver-source-namespaces}]
:name qp-and-driver-source-namespaces}
;;
;; driver namespaces
;;
{:pattern "metabase\\.driver.*$"
:name driver-namespaces}
;;
;; general QP tests are ones that run across multiple drivers. Anything `metabase.query-processor*-test`,
;; `metabase.driver.sql*-test` (excluding SQLServer and SQLite), or
;; `metabase-enterprise.sandbox.query-processor*-test`
;;
{:pattern "^metabase(?:((?:-enterprise\\.sandbox)?\\.query-processor)|(?:\\.driver\\.sql(?!server)(?!ite))).*-test$"
:name general-qp-and-driver-test-namespaces}]
:config-in-ns
{test-namespaces
@@ -853,7 +1010,9 @@
{:inline-def {:level :off}
:missing-docstring {:level :off}
:private-call {:level :off}
:metabase/defsetting-must-specify-export {:level :off}}
:metabase/defsetting-must-specify-export {:level :off}
:discouraged-var {metabase.driver/database-supports? {:level :off}}}
:hooks
{:analyze-call
{clojure.core/defmacro hooks.clojure.core/non-thread-safe-form-should-end-with-exclamation
@@ -903,6 +1062,11 @@
toucan.util.test {:message "Don't use application database inside MLv2 code"}
toucan2.core {:message "Don't use application database inside MLv2 code"}}}}
driver-namespaces
{:linters
{:discouraged-var
{metabase.driver/database-supports? {:level :off}}}}
qp-and-driver-source-namespaces
{:linters
{:discouraged-namespace
@@ -916,4 +1080,8 @@
{medley.core/map-keys {:message "Use clojure.core/update-keys"}
medley.core/map-vals {:message "Use clojure.core/update-vals"}
metabase.db.query/query {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
metabase.db.query/reducible-query {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}}}}}}
metabase.db.query/reducible-query {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}}}}
general-qp-and-driver-test-namespaces
{:linters
{:metabase/disallow-hardcoded-driver-names-in-tests {:level :warning}}}}}

View File

@@ -1,329 +0,0 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.set :as set]
[clojure.string :as str]))
(defn- node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(let [resolved (hooks/resolve {:name sexpr})]
(when-not (= :clj-kondo/unknown-namespace (:ns resolved))
(symbol (name (:ns resolved)) (name (:name resolved))))))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(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.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/>!!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; Definitely thread safe
metabase.test.util.dynamic-redefs/patch-vars!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions/perform-action!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.api.public-test/add-card-to-dashboard!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.core/ensure-audit-db-installed!
metabase.db.schema-migrations-test.impl/run-migrations-in-range!
metabase.db.setup/migrate!
metabase.db.setup/setup-db!
metabase.db/migrate!
metabase.db/setup-db!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.email-test/reset-inbox!
metabase.email/send-email!
metabase.models.action/insert!
metabase.models.collection.graph-test/clear-graph-revisions!
metabase.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.models.field-values/create-or-update-full-field-values!
metabase.models.model-index/add-values!
metabase.models.moderation-review/create-review!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.models.permissions/grant-application-permissions!
metabase.models.permissions/grant-collection-read-permissions!
metabase.models.permissions/grant-collection-readwrite-permissions!
metabase.models.permissions/grant-full-data-permissions!
metabase.models.permissions/grant-native-readwrite-permissions!
metabase.models.permissions/grant-permissions!
metabase.models.permissions/revoke-application-permissions!
metabase.models.permissions/revoke-data-perms!
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.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data/try-to-extract-sample-database!
metabase.setup/create-token!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.sync/sync-database!
metabase.task.index-values/job-init!
metabase.task.persist-refresh/job-init!
metabase.task.persist-refresh/refresh-tables!
metabase.task.persist-refresh/schedule-persistence-for-database!
metabase.task/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-default-dataset!
metabase.test.data.impl.get-or-create/set-test-db-permissions!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.integrations.ldap/start-ldap-server!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.util.ssh-test/start-mock-servers!
metabase.util.ssh-test/stop-mock-servers!})
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node}]
(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]
(when-let [qualified-symbol (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))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
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]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(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))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
(when (and (hooks/list-node? node)
(let [first-child (first (:children node))]
(and (hooks/keyword-node? first-child)
(= (hooks/sexpr first-child) :require))))
node))
(:children ns-form-node)))
(defn- lint-require-shapes [ns-form-node]
(doseq [node (-> ns-form-node
ns-form-node->require-node
:children
rest)]
(cond
(not (hooks/vector-node? node))
(hooks/reg-finding! (assoc (meta node)
:message "All :required namespaces should be wrapped in vectors [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker))
(hooks/vector-node? (second (:children node)))
(hooks/reg-finding! (assoc (meta node)
:message "Don't use prefix forms inside :require [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))
(defn- require-node->namespace-symb-nodes [require-node]
(let [[_ns & args] (:children require-node)]
(into []
;; prefixed namespace forms are NOT SUPPORTED!!!!!!!!1
(keep (fn [node]
(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)))
;; 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)))
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
args)))
(defn- ns-form-node->ns-symb [ns-form-node]
(some-> (some (fn [node]
(when (and (hooks/token-node? node)
(not= (hooks/sexpr node) 'ns))
node))
(:children ns-form-node))
hooks/sexpr))
(defn- module
"E.g.
(module 'metabase.qp.middleware.wow) => 'metabase.qp"
[ns-symb]
(some-> (re-find #"^metabase\.[^.]+" (str ns-symb)) symbol))
(defn- ignored-namespace? [ns-symb config]
(some
(fn [pattern-str]
(re-find (re-pattern pattern-str) (str ns-symb)))
(:ignored-namespace-patterns config)))
(defn- module-api-namespaces
"Set API namespaces for a given module. `:any` means you can use anything, there are no API namespaces for this
module (yet). If unspecified, the default is just the namespace with the same name as the module e.g.
`metabase.db`."
[module config]
(let [module-config (get-in config [:api-namespaces module])]
(cond
(= module-config :any)
nil
(set? module-config)
module-config
:else
#{module})))
(defn- lint-modules [ns-form-node config]
(let [ns-symb (ns-form-node->ns-symb ns-form-node)]
(when-not (ignored-namespace? ns-symb config)
(when-let [current-module (module ns-symb)]
(let [allowed-modules (get-in config [:allowed-modules current-module])
required-namespace-symb-nodes (-> ns-form-node
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))
:let [required-namespace (hooks/sexpr node)
required-module (module required-namespace)]
;; ignore stuff not in a module i.e. non-Metabase stuff.
:when required-module
:let [in-current-module? (= required-module current-module)]
:when (not in-current-module?)
:let [allowed-module? (or (= allowed-modules :any)
(contains? (set allowed-modules) required-module))
module-api-namespaces (module-api-namespaces required-module config)
allowed-module-namespace? (or (empty? module-api-namespaces)
(contains? module-api-namespaces required-namespace))]]
(when-let [error (cond
(not allowed-module?)
(format "Module %s should not be used in the %s module. [:metabase/ns-module-checker :allowed-modules %s]"
required-module
current-module
current-module)
(not allowed-module-namespace?)
(format "Namespace %s is not an allowed external API namespace for the %s module. [:metabase/ns-module-checker :api-namespaces %s]"
required-namespace
required-module
required-module))]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/ns-module-checker)))))))))
(defn lint-ns [x]
(lint-require-shapes (:node x))
(lint-modules (:node x) (get-in x [:config :linters :metabase/ns-module-checker]))
x)

View File

@@ -1,240 +0,0 @@
(ns hooks.clojure.test
(:require
[clj-kondo.hooks-api :as hooks]
[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.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]
(letfn [(error! [form message]
(hooks/reg-finding! (assoc (meta form)
:message message
:type :metabase/validate-deftest)))
(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))
(and (not (allowed-parallel-forms 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"
qualified-symbol)))))
(walk [form]
(f form)
(doseq [child (:children form)]
(walk child)))]
(walk form)))
(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}]
(let [test-metadata (:meta test-name)
metadata-sexprs (map hooks/sexpr test-metadata)
combined-metadata (transduce
(map (fn [x]
(if (map? x)
x
{x true})))
(completing merge)
{}
metadata-sexprs)
parallel? (:parallel combined-metadata)
synchronized? (:synchronized combined-metadata)]
(when (and parallel? synchronized?)
(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.
(when-not (or parallel? synchronized?)
(hooks/reg-finding!
(assoc (meta test-name)
:message "Test should be marked either ^:parallel or ^:synchronized"
: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)
(defn- deftest-check-not-horrifically-long
[node]
(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)
(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)))))))
(defn deftest [{:keys [node cljc lang]}]
;; 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)
{:node node})
;;; this is a hacky way to determine whether these namespaces are required in the `ns` form or not... basically `:ns`
;;; will come back as `nil` if they are not.
(defn- approximately-equal-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.approximately-equal/=?-report}))
'metabase.test-runner.assert-exprs.approximately-equal))
(defn- malli-equals-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.malli-equals/malli=-report}))
'metabase.test-runner.assert-exprs.malli-equals))
(defn- warn-about-missing-test-expr-requires-in-cljs [{:keys [children], :as _is-node}]
(let [[_is assertion-node] children]
(when (hooks/list-node? assertion-node)
(let [[assertion-symb-node] (:children assertion-node)]
(when (hooks/token-node? assertion-symb-node)
(let [assertion-symb-token (hooks/sexpr assertion-symb-node)
warn! (fn [ns-to-require]
(hooks/reg-finding!
(assoc (meta assertion-symb-node)
:message (format "You must require %s to use %s in ClojureScript"
ns-to-require
assertion-symb-token)
:type :metabase/missing-test-expr-requires-in-cljs)))]
(condp = assertion-symb-token
'=?
(when-not (approximately-equal-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.approximately-equal))
'malli=
(when-not (malli-equals-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.malli-equals))
nil)))))))
(defn- warn-about-schema= [{[_is assertion-node] :children, :as _is-node}]
(let [{[assertion-symb-node] :children} assertion-node]
(when (and (hooks/token-node? assertion-symb-node)
(= (hooks/sexpr assertion-symb-node) 'schema=))
(hooks/reg-finding! (assoc (meta assertion-symb-node)
:message "Use =? or malli= instead of schema="
:type :metabase/warn-about-schema=)))))
(defn is [{:keys [node lang]}]
(when (= lang :cljs)
(warn-about-missing-test-expr-requires-in-cljs node))
(warn-about-schema= node)
{:node node})
(defn use-fixtures [{:keys [node]}]
(warn-about-disallowed-parallel-forms node)
{:node node})

View File

@@ -1,402 +0,0 @@
(ns hooks.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
as the current version of kondo will use the whole form by default."
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-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)
(defn- trace* [f]
{:pre [(fn? f)]}
(fn traced-fn [node]
(println \newline)
(clojure.pprint/pprint (hooks/sexpr (:node node)))
(let [node* (f node)]
(println '=>)
(clojure.pprint/pprint (hooks/sexpr (:node node*)))
node*)))
;;; this doesn't seem to work with SCI. Use [[defn-traced]] instead.
;; (defn trace [varr]
;; {:pre [(var? varr)]}
;; (when-not (::traced? (meta varr))
;; (alter-var-root varr trace*)
;; (alter-meta! varr assoc ::traced? true)
;; (println "Traced" varr)))
(defmacro defn-traced
"Replace a hook [[defn]] with this to trace the before and after sexprs."
[fn-name & fn-tail]
`(do
(defn fn# ~@fn-tail)
(def ~fn-name (trace* fn#))))
;;;; 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."
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(for [arg args]
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(with-meta (meta node)))]
{:node node*}))
(defn with-one-binding
"Helper for macros that have a shape like
(my-macro [x]
...)
=>
(let [x nil]
...)
Binding is optional and `_` will be substituted if not supplied."
[{{[_ {[x] :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 with-two-bindings
"Helper for macros that have a shape like
(my-macro [x y]
...)
=>
(let [x nil, y nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y] :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)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-three-bindings
"Helper for macros that have a shape like
(my-macro [x y z]
...)
=>
(let [x nil, y nil, z nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y z] :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)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)
(or z (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-four-bindings
"Helper for macros that have a shape like
(my-macro [a b c d]
...)
=>
(let [a nil, b nil, c nil, d nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-five-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-six-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-seven-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f g]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil, g nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f g] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)
(or g (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-one-top-level-binding
"Helper for macros that have a shape like
(my-macro x
...)
=>
(let [x nil]
...)"
[{{[_ x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-top-level-bindings
"Helper for macros that have a shape like
(my-macro x y
...)
=>
(let [x nil, y nil]
...)"
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)
y (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn let-one-with-optional-value
"This is exactly like [[clojure.core/let]] but the right-hand side of the binding, `value`, is optional, and only one
binding can be established.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {[binding value] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[binding (or value (hooks/token-node 'nil))])
body))]
{:node node*}))
(defn- let-second-inner [body bindings]
(let [binding-infos (for [[model {[binding value] :children}] (partition 2 bindings)]
{:model model
:binding binding
:value (or value
(hooks/token-node 'nil))})]
(-> (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))
(with-meta (meta body)))])
(with-meta (meta body)))))
(defn let-second
"Helper for macros that have a shape like
(my-macro x [y]
...)
where the let is for second arg.
=>
(let [y nil]
...)"
[{:keys [node]}]
(let [[_ first-arg-ref binding+opts & body] (:children node)]
{:node (let-second-inner body [first-arg-ref binding+opts])}))
(defn let-with-optional-value-for-last-binding
"This is exactly like [[clojure.core/let]] but the right-hand side of the *last* binding, `value`, is optional.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {bindings :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
(into []
(comp (partition-all 2)
(mapcat (fn [[binding value]]
[binding (or value (hooks/token-node 'nil))])))
bindings))
body))]
{:node node*}))
(defn with-ignored-first-arg
"For macros like
(discard-setting-changes [setting-1 setting-2]
...)
=>
(do ...)
where the first arg ought to be ignored for linting purposes."
[{{[_ _x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'do)
body))]
{:node node*}))
(defn with-used-first-arg
"For macros like
(with-drivers (filter pred? some-drivers)
...)
=>
(let [_1234 (filter pred? some-drivers)]
...)
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))]
{:node node*}))
(defn node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(when-let [resolved (hooks/resolve {:name sexpr})]
(symbol (name (:ns resolved)) (name (:name resolved)))))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(defn format-string-specifier-count
"Number of things like `%s` in a format string, not counting newlines (`%n`) or escaped percent signs (`%%`). For
checking the number of args to something that takes a format string."
[format-string]
(count (re-seq #"(?<!%)%(?![%n])" format-string)))
(comment
;; should be 1
(format-string-specifier-count "%s %%")
;; should be 2
(format-string-specifier-count "%s %%%n%s")
;; should be 0
(format-string-specifier-count "%n%%%%")
;; should be 1
(format-string-specifier-count "%-02d"))

View File

@@ -1,157 +0,0 @@
(ns hooks.metabase.util.log
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]
[clojure.walk :as walk]
[hooks.common]))
;;;; Checks for both log + logf
(defn- disallow-i18n [node]
(walk/postwalk
(fn [x]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol x)]
(when (and (= (namespace qualified-symbol) "metabase.util.i18n")
(or (str/includes? (name qualified-symbol) "tru")
(str/includes? (name qualified-symbol) "trs")))
(api/reg-finding! (assoc (meta x)
:message "do not i18n the logs!"
:type :metabase/validate-logging)))))
node))
(defn- check-position-of-exception-arg
"Tell people to do (info e \"whatever\") instead of (info \"whatever\" e)."
[node]
(let [[f _first-arg & args] (:children node)]
(doseq [arg args]
(when (and (api/token-node? arg)
(= (api/sexpr arg) 'e))
(api/reg-finding! (assoc (meta arg)
:message (format "pass exceptions as the first arg to %s" (api/sexpr f))
:type :metabase/validate-logging))))))
(defn- common-checks [node]
(check-position-of-exception-arg node)
(disallow-i18n node))
(defn- check-for-i18n-format-specifiers
"Make sure people aren't using things like {0} in their log messages."
[node string-node]
(when (re-find #"\{\d+\}" (api/sexpr string-node))
(api/reg-finding! (assoc (meta node)
:message "this looks like an i18n format string. Don't use identifiers like {0} in logging."
:type :metabase/validate-logging))))
;;; log only
(defn- check-not-format-string
"Make sure we're not using something like log/trace with a format string."
[{[f] :children, :as node} string-node]
(when (pos? (hooks.common/format-string-specifier-count (api/sexpr string-node)))
(api/reg-finding! (assoc (meta node)
:message (format "%s used with a format string, use %s instead."
(api/sexpr f)
(str (api/sexpr f) "f"))
:type :metabase/validate-logging))))
(defn- warn-against-log+format-instead-of-logf
"Tell people to use things like infof instead of info + format."
[{[f] :children, :as node} [x :as args]]
(when (and (= (count args) 1)
(api/list-node? x))
(let [[y] (:children x)]
(when (and (api/token-node? y)
(= (hooks.common/node->qualified-symbol y) 'clojure.core/format))
(api/reg-finding! (assoc (meta node)
:message (format "Use %s instead of %s + format"
(str (api/sexpr f) "f")
(api/sexpr f))
:type :metabase/validate-logging))))))
(defn info
"Valid log, debug, etc."
[{:keys [node], :as x}]
(common-checks node)
(let [[_f & args] (:children node)
[_e & [x :as args]] (if (and (api/token-node? (first args))
(api/string-node? (second args)))
args
(cons nil args))]
(when (api/string-node? x)
(check-for-i18n-format-specifiers node x)
(check-not-format-string node x))
(warn-against-log+format-instead-of-logf node args))
x)
;;;; logf only
(defn- check-format-string-arg-count
"Make sure the number of args passed to something like tracef match the number of format string specifiers."
[{[f] :children, :as node} format-string args]
(let [expected-arg-count (hooks.common/format-string-specifier-count (api/sexpr format-string))
actual-arg-count (count args)]
(when (zero? expected-arg-count)
(api/reg-finding! (assoc (meta node)
:message (format "Don't use %s with no format string arguments, use %s instead."
(api/sexpr f)
(str/replace (str (api/sexpr f)) #"f$" ""))
:type :metabase/validate-logging)))
(when-not (= expected-arg-count actual-arg-count)
(api/reg-finding! (assoc (meta node)
:message (format "log format string expects %d arguments instead of %d."
expected-arg-count
actual-arg-count)
:type :metabase/validate-logging)))))
(defn infof
"Valid logf, debugf, etc."
[{:keys [node], :as x}]
(common-checks node)
(let [[_f & args] (:children node)
[_e format-string & args] (if (api/string-node? (first args))
(cons nil args)
args)]
;; TODO -- maybe we can error if you did not pass a format string, e.g. (log/infof 1 2) is obviously incorrect.
(when (api/string-node? format-string)
(check-for-i18n-format-specifiers node format-string)
(check-format-string-arg-count node format-string args)))
x)
(comment
;; should fail, missing a format arg
(infof
{:node (api/parse-string
(str '(log/warnf "Migration lock was acquired after %d retries.")))})
(infof
{:node (api/parse-string
(str '(log/warnf e "Migration lock was acquired after %d retries.")))})
;; should fail, too many format args
(infof
{:node (api/parse-string
(str '(log/warnf "Migration lock was acquired after %d retries." 1 2)))})
(infof
{:node (api/parse-string
(str '(log/warnf e "Migration lock was acquired after %d retries." 1 2)))})
(infof
{:node (api/parse-string
(str '(log/warnf "Migration lock was acquired after {0} retries." 1)))})
;; should fail, has format args but is warn rather than warnf
(info
{:node (api/parse-string
(str '(log/warn e "Migration lock was acquired after %d retries." 1 2)))})
;; should fail -- should not use i18n/tru or i18n/trs
(infof
{:node (api/parse-string
(str '(log/warnf (metabase.util.i18n/tru "Migration lock was acquired after {0} retries." 1))))})
(info
{:node (api/parse-string
(str '(log/warn (metabase.util.i18n/trs "Migration lock was acquired after {0} retries." 1))))}))

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,26 +1,7 @@
(ns macros.metabase.api.common
(:require
[clojure.string :as str]))
(ns macros.metabase.api.common)
(defmacro define-routes
"Macro for api.common/define-routes"
[& args]
`(do (def ~'routes "docstring" nil)
~@args))
(defn route-fn-name
"route fn hook"
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defmacro defendpoint
"Macro for api.common/defendpoint*"
[method route & body]
(let [method-fn (symbol "compojure.core" (str method))
route-name (route-fn-name method route)]
`(do
~method-fn
(defn ~route-name ~@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

@@ -0,0 +1,9 @@
(ns macros.metabase.models.query-analysis-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
`(let [~(macros.common/ignore-unused 'card-id) 1
~(macros.common/ignore-unused 'table-id) 2
~(macros.common/ignore-unused 'tax-id) 3
~(macros.common/ignore-unused 'total-id) 4]
~@body))

View File

@@ -1,9 +0,0 @@
(ns macros.metabase.models.query-field-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
`(let [~(macros.common/ignore-unused 'card-id) 1
~(macros.common/ignore-unused 'table-id) 2
~(macros.common/ignore-unused 'tax-id) 3
~(macros.common/ignore-unused 'total-id) 4]
~@body))

View File

@@ -0,0 +1,13 @@
(ns macros.metabase.task.setup.query-analysis-setup
(:require [macros.common]))
(defmacro with-test-setup!
"Set up the data required to test the Query Analysis related tasks"
[& body]
`(let [~(macros.common/ignore-unused 'c1) 1
~(macros.common/ignore-unused 'c2) 2
~(macros.common/ignore-unused 'c3) 3
~(macros.common/ignore-unused 'c4) 4
~(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,12 @@
(ns macros.metabase-enterprise.query-reference-validation.api-test
(:require [macros.common]))
(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
~(macros.common/ignore-unused 'card-4) 4
~(macros.common/ignore-unused 'card-5) 5
~(macros.common/ignore-unused 'coll-2) 100
~(macros.common/ignore-unused 'coll-3) 200]
~@body))

View File

@@ -0,0 +1,320 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[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.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/>!!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; Definitely thread safe
metabase.test.util.dynamic-redefs/patch-vars!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions/perform-action!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.api.public-test/add-card-to-dashboard!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.core/ensure-audit-db-installed!
metabase.db.schema-migrations-test.impl/run-migrations-in-range!
metabase.db.setup/migrate!
metabase.db.setup/setup-db!
metabase.db/migrate!
metabase.db/setup-db!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.email-test/reset-inbox!
metabase.email/send-email!
metabase.models.action/insert!
metabase.models.collection.graph-test/clear-graph-revisions!
metabase.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.models.field-values/create-or-update-full-field-values!
metabase.models.model-index/add-values!
metabase.models.moderation-review/create-review!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.models.permissions/grant-application-permissions!
metabase.models.permissions/grant-collection-read-permissions!
metabase.models.permissions/grant-collection-readwrite-permissions!
metabase.models.permissions/grant-full-data-permissions!
metabase.models.permissions/grant-native-readwrite-permissions!
metabase.models.permissions/grant-permissions!
metabase.models.permissions/revoke-application-permissions!
metabase.models.permissions/revoke-data-perms!
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.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data/try-to-extract-sample-database!
metabase.setup/create-token!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.sync/sync-database!
metabase.task.index-values/job-init!
metabase.task.persist-refresh/job-init!
metabase.task.persist-refresh/refresh-tables!
metabase.task.persist-refresh/schedule-persistence-for-database!
metabase.task/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-default-dataset!
metabase.test.data.impl.get-or-create/set-test-db-permissions!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.integrations.ldap/start-ldap-server!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.util.ssh-test/start-mock-servers!
metabase.util.ssh-test/stop-mock-servers!})
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[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]
(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))
(or (end-with-exclamation? qualified-symbol)
(contains? (get-in config [:linters :metabase/validate-deftest :parallel/unsafe]) 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)))))
node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
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 config]}]
(when (or (not cljc)
(= lang :clj))
(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))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(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))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
(when (and (hooks/list-node? node)
(let [first-child (first (:children node))]
(and (hooks/keyword-node? first-child)
(= (hooks/sexpr first-child) :require))))
node))
(:children ns-form-node)))
(defn- lint-require-shapes [ns-form-node]
(doseq [node (-> ns-form-node
ns-form-node->require-node
:children
rest)]
(cond
(not (hooks/vector-node? node))
(hooks/reg-finding! (assoc (meta node)
:message "All :required namespaces should be wrapped in vectors [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker))
(hooks/vector-node? (second (:children node)))
(hooks/reg-finding! (assoc (meta node)
:message "Don't use prefix forms inside :require [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))
(defn- require-node->namespace-symb-nodes [require-node]
(let [[_ns & args] (:children require-node)]
(into []
;; prefixed namespace forms are NOT SUPPORTED!!!!!!!!1
(keep (fn [node]
(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)))
;; 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)))
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
args)))
(defn- ns-form-node->ns-symb [ns-form-node]
(some-> (some (fn [node]
(when (and (hooks/token-node? node)
(not= (hooks/sexpr node) 'ns))
node))
(:children ns-form-node))
hooks/sexpr))
(defn- module
"E.g.
(module 'metabase.qp.middleware.wow) => 'metabase.qp"
[ns-symb]
(some-> (re-find #"^metabase\.[^.]+" (str ns-symb)) symbol))
(defn- ignored-namespace? [ns-symb config]
(some
(fn [pattern-str]
(re-find (re-pattern pattern-str) (str ns-symb)))
(:ignored-namespace-patterns config)))
(defn- module-api-namespaces
"Set API namespaces for a given module. `:any` means you can use anything, there are no API namespaces for this
module (yet). If unspecified, the default is just the namespace with the same name as the module e.g.
`metabase.db`."
[module config]
(let [module-config (get-in config [:api-namespaces module])]
(cond
(= module-config :any)
nil
(set? module-config)
module-config
:else
#{module})))
(defn- lint-modules [ns-form-node config]
(let [ns-symb (ns-form-node->ns-symb ns-form-node)]
(when-not (ignored-namespace? ns-symb config)
(when-let [current-module (module ns-symb)]
(let [allowed-modules (get-in config [:allowed-modules current-module])
required-namespace-symb-nodes (-> ns-form-node
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))
:let [required-namespace (hooks/sexpr node)
required-module (module required-namespace)]
;; ignore stuff not in a module i.e. non-Metabase stuff.
:when required-module
:let [in-current-module? (= required-module current-module)]
:when (not in-current-module?)
:let [allowed-module? (or (= allowed-modules :any)
(contains? (set allowed-modules) required-module))
module-api-namespaces (module-api-namespaces required-module config)
allowed-module-namespace? (or (empty? module-api-namespaces)
(contains? module-api-namespaces required-namespace))]]
(when-let [error (cond
(not allowed-module?)
(format "Module %s should not be used in the %s module. [:metabase/ns-module-checker :allowed-modules %s]"
required-module
current-module
current-module)
(not allowed-module-namespace?)
(format "Namespace %s is not an allowed external API namespace for the %s module. [:metabase/ns-module-checker :api-namespaces %s]"
required-namespace
required-module
required-module))]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/ns-module-checker)))))))))
(defn lint-ns [x]
(lint-require-shapes (:node x))
(lint-modules (:node x) (get-in x [:config :linters :metabase/ns-module-checker]))
x)

View File

@@ -0,0 +1,160 @@
(ns hooks.clojure.test
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]))
(defn- warn-about-disallowed-parallel-forms [form config]
(letfn [(error! [form message]
(hooks/reg-finding! (assoc (meta form)
:message message
:type :metabase/validate-deftest)))
(f [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(cond
(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 (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 the Kondo config file [:metabase/validate-deftest]"
qualified-symbol)))))
(walk [form]
(f form)
(doseq [child (:children form)]
(walk child)))]
(walk form)))
(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} config]
(let [test-metadata (:meta test-name)
metadata-sexprs (map hooks/sexpr test-metadata)
combined-metadata (transduce
(map (fn [x]
(if (map? x)
x
{x true})))
(completing merge)
{}
metadata-sexprs)
parallel? (:parallel combined-metadata)
synchronized? (:synchronized combined-metadata)]
(when (and parallel? synchronized?)
(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-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)
:message "Test should be marked either ^:parallel or ^:synchronized"
:type :metabase/deftest-not-marked-parallel-or-synchronized)))
(when parallel?
(doseq [form body]
(warn-about-disallowed-parallel-forms form config)))))
(defn- deftest-check-not-horrifically-long
[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 (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)))))))
(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))))
(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)
(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))
:type :metabase/disallow-hardcoded-driver-names-in-tests))
::error))
(walk [node]
(cond
(ignore? node :metabase/disallow-hardcoded-driver-names-in-tests)
nil
(= (f node) ::error)
::error
:else
(reduce
(fn [_acc child]
(when (= (walk child) ::error)
(reduced ::error)))
nil
(:children node))))]
(walk node)))
(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 (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`
;;; will come back as `nil` if they are not.
(defn- approximately-equal-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.approximately-equal/=?-report}))
'metabase.test-runner.assert-exprs.approximately-equal))
(defn- malli-equals-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.malli-equals/malli=-report}))
'metabase.test-runner.assert-exprs.malli-equals))
(defn- warn-about-missing-test-expr-requires-in-cljs [{:keys [children], :as _is-node}]
(let [[_is assertion-node] children]
(when (hooks/list-node? assertion-node)
(let [[assertion-symb-node] (:children assertion-node)]
(when (hooks/token-node? assertion-symb-node)
(let [assertion-symb-token (hooks/sexpr assertion-symb-node)
warn! (fn [ns-to-require]
(hooks/reg-finding!
(assoc (meta assertion-symb-node)
:message (format "You must require %s to use %s in ClojureScript"
ns-to-require
assertion-symb-token)
:type :metabase/missing-test-expr-requires-in-cljs)))]
(condp = assertion-symb-token
'=?
(when-not (approximately-equal-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.approximately-equal))
'malli=
(when-not (malli-equals-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.malli-equals))
nil)))))))
(defn is [{:keys [node lang]}]
(when (= lang :cljs)
(warn-about-missing-test-expr-requires-in-cljs node))
{:node node})
(defn use-fixtures [{:keys [node config]}]
(warn-about-disallowed-parallel-forms node config)
{:node node})

View File

@@ -0,0 +1,423 @@
(ns hooks.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
as the current version of kondo will use the whole form by default."
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-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)
(defn- trace* [f]
{:pre [(fn? f)]}
(fn traced-fn [node]
(println \newline)
(clojure.pprint/pprint (hooks/sexpr (:node node)))
(let [node* (f node)]
(println '=>)
(clojure.pprint/pprint (hooks/sexpr (:node node*)))
node*)))
;;; this doesn't seem to work with SCI. Use [[defn-traced]] instead.
;; (defn trace [varr]
;; {:pre [(var? varr)]}
;; (when-not (::traced? (meta varr))
;; (alter-var-root varr trace*)
;; (alter-meta! varr assoc ::traced? true)
;; (println "Traced" varr)))
(defmacro defn-traced
"Replace a hook [[defn]] with this to trace the before and after sexprs."
[fn-name & fn-tail]
`(do
(defn fn# ~@fn-tail)
(def ~fn-name (trace* fn#))))
;;;; 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."
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(for [arg args]
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(with-meta (meta node)))]
{:node node*}))
(defn with-one-binding
"Helper for macros that have a shape like
(my-macro [x]
...)
=>
(let [x nil]
...)
Binding is optional and `_` will be substituted if not supplied."
[{{[_ {[x] :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 with-two-bindings
"Helper for macros that have a shape like
(my-macro [x y]
...)
=>
(let [x nil, y nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y] :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)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-three-bindings
"Helper for macros that have a shape like
(my-macro [x y z]
...)
=>
(let [x nil, y nil, z nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y z] :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)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)
(or z (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-four-bindings
"Helper for macros that have a shape like
(my-macro [a b c d]
...)
=>
(let [a nil, b nil, c nil, d nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-five-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-six-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-seven-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f g]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil, g nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f g] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)
(or g (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-one-top-level-binding
"Helper for macros that have a shape like
(my-macro x
...)
=>
(let [x nil]
...)"
[{{[_ x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-top-level-bindings
"Helper for macros that have a shape like
(my-macro x y
...)
=>
(let [x nil, y nil]
...)"
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)
y (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn let-one-with-optional-value
"This is exactly like [[clojure.core/let]] but the right-hand side of the binding, `value`, is optional, and only one
binding can be established.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {[binding value] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[binding (or value (hooks/token-node 'nil))])
body))]
{:node node*}))
(defn- let-second-inner [body bindings]
(let [binding-infos (for [[model {[binding value] :children}] (partition 2 bindings)]
{:model model
:binding binding
:value (or value
(hooks/token-node 'nil))})]
(-> (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))
(with-meta (meta body)))])
(with-meta (meta body)))))
(defn let-second
"Helper for macros that have a shape like
(my-macro x [y]
...)
where the let is for second arg.
=>
(let [y nil]
...)"
[{:keys [node]}]
(let [[_ first-arg-ref binding+opts & body] (:children node)]
{:node (let-second-inner body [first-arg-ref binding+opts])}))
(defn let-with-optional-value-for-last-binding
"This is exactly like [[clojure.core/let]] but the right-hand side of the *last* binding, `value`, is optional.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {bindings :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
(into []
(comp (partition-all 2)
(mapcat (fn [[binding value]]
[binding (or value (hooks/token-node 'nil))])))
bindings))
body))]
{:node node*}))
(defn with-ignored-first-arg
"For macros like
(discard-setting-changes [setting-1 setting-2]
...)
=>
(do ...)
where the first arg ought to be ignored for linting purposes."
[{{[_ _x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'do)
body))]
{:node node*}))
(defn with-used-first-arg
"For macros like
(with-drivers (filter pred? some-drivers)
...)
=>
(let [_1234 (filter pred? some-drivers)]
...)
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))]
{:node node*}))
(defn node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(let [resolved (hooks/resolve {:name sexpr})]
(cond
(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.
(qualified-symbol? sexpr)
sexpr)))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(defn format-string-specifier-count
"Number of things like `%s` in a format string, not counting newlines (`%n`) or escaped percent signs (`%%`). For
checking the number of args to something that takes a format string."
[format-string]
(count (re-seq #"(?<!%)%(?![%n])" format-string)))
(comment
;; should be 1
(format-string-specifier-count "%s %%")
;; should be 2
(format-string-specifier-count "%s %%%n%s")
;; should be 0
(format-string-specifier-count "%n%%%%")
;; 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]
(letfn [(update-ignores [existing-ignores]
(hooks/vector-node
(cons
(hooks/keyword-node :clojure-lsp/unused-public-var)
(:children existing-ignores))))]
(vary-meta node update :clj-kondo/ignore update-ignores)))

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

@@ -0,0 +1,47 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]
[hooks.common]))
(defn route-fn-name
"route fn hook"
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defn defendpoint
[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
(list*
(api/token-node 'clojure.core/defn)
(api/token-node (route-fn-name (api/sexpr method) (api/sexpr 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

@@ -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

@@ -38,8 +38,6 @@
engines
enum-cardinality-threshold
follow-up-email-sent
ga-code
ga-enabled
google-auth-auto-create-accounts-domain
google-auth-client-id
google-auth-configured
@@ -164,7 +162,6 @@
token-status
toucan-name
uncached-setting
uploads-table-prefix
user-visibility
version
version-info
@@ -184,12 +181,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))
@@ -245,14 +243,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

@@ -11,6 +11,10 @@
[]
(not-empty (set (keys (:clj (hooks/ns-analysis 'metabase.test.data.dataset-definitions))))))
(defn- local-def?
[ns* sexpr]
(= ns* (:ns (hooks/resolve {:name sexpr}))))
(defn- dataset-type
"`dataset` can be one of:
@@ -21,7 +25,7 @@
We can only determine if an unqualified symbol refers to something in the dataset definitions namespace if there are
cached results available from [[global-dataset-symbols]]."
[dataset]
[this-ns dataset]
(let [sexpr (hooks/sexpr dataset)
global-defs (global-dataset-symbols)]
(cond
@@ -31,20 +35,19 @@
(namespace sexpr)
:qualified
(empty? global-defs)
:unqualified/unknown
(contains? global-defs sexpr)
:unqualified/from-dataset-defs-namespace
;; either something defined in the current namespace or let-bound in the current scope.
(local-def? this-ns sexpr)
:unqualified/local-def
:else
:unqualified/local-def)))
:unqualified/unknown)))
(defn dataset
[{{[_ dataset & body] :children} :node}]
[{{[_ dataset & body] :children} :node this-ns :ns}]
(let [noop (constantly nil)
body (case (dataset-type dataset)
body (case (dataset-type this-ns dataset)
;; non-symbol, qualified symbols, and unqualified symbols from the current namespace/let-bound can all
;; get converted from something like
;;

View File

@@ -0,0 +1,126 @@
(ns hooks.metabase.util.log
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]
[clojure.walk :as walk]
[hooks.common]))
;;;; Checks for both log + logf
(defn- disallow-i18n [node]
(walk/postwalk
(fn [x]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol x)]
(when (and (= (namespace qualified-symbol) "metabase.util.i18n")
(or (str/includes? (name qualified-symbol) "tru")
(str/includes? (name qualified-symbol) "trs")))
(api/reg-finding! (assoc (meta x)
:message "do not i18n the logs!"
:type :metabase/validate-logging)))))
node))
(defn- check-position-of-exception-arg
"Tell people to do (info e \"whatever\") instead of (info \"whatever\" e)."
[node]
(let [[f _first-arg & args] (:children node)]
(doseq [arg args]
(when (and (api/token-node? arg)
(= (api/sexpr arg) 'e))
(api/reg-finding! (assoc (meta arg)
:message (format "pass exceptions as the first arg to %s" (api/sexpr f))
:type :metabase/validate-logging))))))
(defn- common-checks [node]
(check-position-of-exception-arg node)
(disallow-i18n node))
(defn- check-for-i18n-format-specifiers
"Make sure people aren't using things like {0} in their log messages."
[node string-node]
(when (re-find #"\{\d+\}" (api/sexpr string-node))
(api/reg-finding! (assoc (meta node)
:message "this looks like an i18n format string. Don't use identifiers like {0} in logging."
:type :metabase/validate-logging))))
;;; log only
(defn- check-not-format-string
"Make sure we're not using something like log/trace with a format string."
[{[f] :children, :as node} string-node]
(when (pos? (hooks.common/format-string-specifier-count (api/sexpr string-node)))
(api/reg-finding! (assoc (meta node)
:message (format "%s used with a format string, use %s instead."
(api/sexpr f)
(str (api/sexpr f) "f"))
:type :metabase/validate-logging))))
(defn- format-node? [node]
(when (api/list-node? node)
(let [[x] (:children node)]
(and (api/token-node? x)
(or (= (hooks.common/node->qualified-symbol x) 'clojure.core/format)
(= (api/sexpr x) 'format))))))
(defn- warn-against-log+format-instead-of-logf
"Tell people to use things like infof instead of info + format."
[{[f] :children, :as node} [x :as args]]
(when (and (= (count args) 1)
(api/list-node? x))
(when (format-node? x)
(api/reg-finding! (assoc (meta node)
:message (format "Use %s instead of %s + format"
(str (api/sexpr f) "f")
(api/sexpr f))
:type :metabase/validate-logging)))))
(defn info
"Valid log, debug, etc."
[{:keys [node], :as x}]
(common-checks node)
(let [[_f & args] (:children node)
[_e & [x :as args]] (if (and (api/token-node? (first args))
(or (api/string-node? (second args))
(format-node? (second args))))
args
(cons nil args))]
(when (api/string-node? x)
(check-for-i18n-format-specifiers node x)
(check-not-format-string node x))
(warn-against-log+format-instead-of-logf node args))
x)
;;;; logf only
(defn- check-format-string-arg-count
"Make sure the number of args passed to something like tracef match the number of format string specifiers."
[{[f] :children, :as node} format-string args]
(let [expected-arg-count (hooks.common/format-string-specifier-count (api/sexpr format-string))
actual-arg-count (count args)]
(when (zero? expected-arg-count)
(api/reg-finding! (assoc (meta node)
:message (format "Don't use %s with no format string arguments, use %s instead."
(api/sexpr f)
(str/replace (str (api/sexpr f)) #"f$" ""))
:type :metabase/validate-logging)))
(when-not (= expected-arg-count actual-arg-count)
(api/reg-finding! (assoc (meta node)
:message (format "log format string expects %d arguments instead of %d."
expected-arg-count
actual-arg-count)
:type :metabase/validate-logging)))))
(defn infof
"Valid logf, debugf, etc."
[{:keys [node], :as x}]
(common-checks node)
(let [[_f & args] (:children node)
[_e format-string & args] (if (api/string-node? (first args))
(cons nil args)
args)]
;; TODO -- maybe we can error if you did not pass a format string, e.g. (log/infof 1 2) is obviously incorrect.
(when (api/string-node? format-string)
(check-for-i18n-format-specifiers node format-string)
(check-format-string-arg-count node format-string args)))
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,52 @@
(ns hooks.clojure.test-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.test :refer :all]
[hooks.clojure.test]))
(set! *warn-on-reflection* true)
(defn- deftest-warnings
[form]
(binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/disallow-hardcoded-driver-names-in-tests {:level :warning}}}
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(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 ^:parallel disallow-hardcoded-driver-names-in-tests-test
(is (= []
(deftest-warnings
"(mt/test-drivers (mt/normal-drivers)
(do-something))")))
(is (= ["Do not hardcode driver name :athena in driver tests! [:metabase/disallow-hardcoded-driver-names-in-tests]"]
(deftest-warnings
"(mt/test-drivers (mt/normal-drivers)
(when-not (= driver/*driver* :athena)
(do-something)))")))
(testing "make sure :clj-kondo/ignore is propagated correctly"
(is (= []
(deftest-warnings
"(mt/test-drivers (mt/normal-drivers)
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(when-not (= driver/*driver* :athena)
(do-something)))")))))
(deftest ^:parallel check-driver-keywords-test
(testing "Make sure we keep hooks.clojure.test/driver-keywords up to date"
(let [driver-keywords (-> (slurp ".clj-kondo/config.edn")
edn/read-string
(get-in [:linters :metabase/disallow-hardcoded-driver-names-in-tests :drivers]))]
(doseq [^java.io.File file (.listFiles (io/file "modules/drivers"))
:when (.isDirectory file)
:let [driver (keyword (.getName file))]]
(is (contains? driver-keywords driver)
(format "hooks.clojure.test/driver-keywords should contain %s, please add it" driver))))))

View File

@@ -0,0 +1,19 @@
(ns ^:mb/once hooks.common-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.test :refer :all]
[hooks.common]))
(deftest ^:parallel node->qualified-symbol-test
(binding [clj-kondo.impl.utils/*ctx* {:namespaces (atom nil)}]
(is (= 'metabase.util.i18n/tru
(hooks.common/node->qualified-symbol (api/parse-string "metabase.util.i18n/tru"))))))
(deftest ^:parallel node->qualified-symbol-test-2
(binding [clj-kondo.impl.utils/*ctx* {:namespaces (atom {:clj {:clj '{hooks.common-test {:qualify-ns {i18n metabase.util.i18n}}}}})
:lang :clj
:base-lang :clj
:ns {:name 'hooks.common-test}}]
(is (= 'metabase.util.i18n/tru
(hooks.common/node->qualified-symbol (api/parse-string "i18n/tru"))))))

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

@@ -0,0 +1,77 @@
(ns ^:mb/once hooks.metabase.util.log-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.string :as str]
[clojure.test :refer :all]
[hooks.metabase.util.log]))
(defn- warnings
[form]
(let [f (if (str/ends-with? (name (first form)) "f")
hooks.metabase.util.log/infof
hooks.metabase.util.log/info)]
(binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/validate-logging {:level :warning}}}
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(f {:node (api/parse-string (pr-str form))})
(mapv :message @(:findings clj-kondo.impl.utils/*ctx*)))))
(deftest ^:parallel warn-on-missing-format-args-test
(testing "should fail, missing a format arg"
(are [form] (= ["log format string expects 1 arguments instead of 0."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock was acquired after %d retries.")
(metabase.util.log/warnf e "Migration lock was acquired after %d retries."))))
(deftest ^:parallel warn-on-too-many-format-args-test-1
(testing "should fail, too many format args"
(are [form] (= ["log format string expects 1 arguments instead of 2."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock was acquired after %d retries." 1 2)
(metabase.util.log/warnf e "Migration lock was acquired after %d retries." 1 2))))
(deftest ^:parallel warn-on-too-many-format-args-test-2
(testing "should fail, too many format args"
(are [form] (= ["this looks like an i18n format string. Don't use identifiers like {0} in logging."
"Don't use metabase.util.log/warnf with no format string arguments, use metabase.util.log/warn instead."
"log format string expects 0 arguments instead of 1."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock was acquired after {0} retries." 1)
(metabase.util.log/warnf e "Migration lock was acquired after {0} retries." 1))))
(deftest ^:parallel warn-on-format-args-without-logf-test
(testing "should fail, has format args but is warn rather than warnf"
(are [form] (= ["metabase.util.log/warn used with a format string, use metabase.util.log/warnf instead."]
(warnings (quote form)))
(metabase.util.log/warn "Migration lock was acquired after %d retries." 1)
(metabase.util.log/warn e "Migration lock was acquired after %d retries." 1))))
(deftest ^:parallel warn-on-format-without-logf-test
(testing "should fail, has format args but is warn rather than warnf"
(are [form] (= ["Use metabase.util.log/warnf instead of metabase.util.log/warn + format"]
(warnings (quote form)))
(metabase.util.log/warn (format "Migration lock was acquired after %d retries." 1))
(metabase.util.log/warn e (format "Migration lock was acquired after %d retries." 1)))))
(deftest ^:parallel warn-on-logf-with-no-format-args-test
(testing "should fail, has format args but is warn rather than warnf"
(are [form] (= ["Don't use metabase.util.log/warnf with no format string arguments, use metabase.util.log/warn instead."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock cleared.")
(metabase.util.log/warnf e "Migration lock cleared."))))
(deftest ^:parallel warn-on-i18n-test-1
(testing "should fail -- should not use i18n/tru or i18n/trs"
(are [form] (= ["do not i18n the logs!"]
(warnings (quote form)))
(metabase.util.log/warnf (metabase.util.i18n/tru "Migration lock was acquired after {0} retries." 1))
(metabase.util.log/warnf e (metabase.util.i18n/tru "Migration lock was acquired after {0} retries." 1)))))
(deftest ^:parallel warn-on-i18n-test-2
(testing "should fail -- should not use i18n/tru or i18n/trs"
(are [form] (= ["do not i18n the logs!"]
(warnings (quote form)))
(metabase.util.log/warn (metabase.util.i18n/trs "Migration lock was acquired after {0} retries." 1))
(metabase.util.log/warn e (metabase.util.i18n/trs "Migration lock was acquired after {0} retries." 1)))))

View File

@@ -1,31 +1,339 @@
;; 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"
"modules/drivers"
#_"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.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.shared.util.i18n/trs [[:default]]
metabase.shared.util.i18n/trsn [[:default]]
metabase.shared.util.i18n/tru [[:default]]
metabase.shared.util.i18n/trun [[:default]]
metabase.shared.util.namespaces/import-fns [[:default]]
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/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/tru [[: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]]
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,67 +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 '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,
@@ -78,9 +85,10 @@ module.exports = {
"react/forbid-component-props": [2, { forbid: ["sx"] }],
"react-hooks/exhaustive-deps": [
"warn",
{ additionalHooks: "(useSyncedQueryString|useSafeAsyncFunction)" },
{ additionalHooks: "(useSafeAsyncFunction)" },
],
"prefer-const": [1, { destructuring: "all" }],
"no-restricted-globals": ["error", "close"],
"no-useless-escape": 0,
"no-only-tests/no-only-tests": [
"error",
@@ -133,6 +141,7 @@ module.exports = {
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:depend/recommended",
],
settings: {
"import/internal-regex": "^metabase/|^metabase-lib/",
@@ -160,6 +169,17 @@ module.exports = {
rules: {
"no-unconditional-metabase-links-render": "error",
"no-literal-metabase-strings": "error",
"depend/ban-dependencies": [
"error",
{
allowed: [
"underscore",
"moment",
"lodash.orderby",
"lodash.debounce",
],
},
],
},
},
{
@@ -189,7 +209,13 @@ module.exports = {
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{

1
.github/CODEOWNERS vendored
View File

@@ -12,3 +12,4 @@ enterprise/backend/src/metabase_enterprise/task/truncate_audit_table.clj @noahmo
enterprise/backend/src/metabase_enterprise/internal_user.clj @noahmoss
src/metabase/**/*permissions* @noahmoss
src/metabase/integrations @noahmoss
snowplow/* @metabase/data

View File

@@ -1,9 +1,5 @@
> [!IMPORTANT]
> For those employed by Metabase: if you are merging into master, please add either a `backport` or a `no-backport` label
> to this PR. You will not be able to merge until you do this step. Refer to the section [Do I need to backport this
> PR?](https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#89f80d6f17714a0198aeb66c0efd1b71)
> in the Metabase Branching Strategy document for more details. If you're not employed by Metabase, this section does not
> apply to you, and the label will be taken care of by your reviewer.
> For those employed by Metabase: if you are merging into master, please add either a `backport` or a `no-backport` label to this PR. You will not be able to merge until you do this step. Refer to the section [Do I need to backport this PR?](https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#89f80d6f17714a0198aeb66c0efd1b71) in the Metabase Branching Strategy document for more details. If you're not employed by Metabase, this section does not apply to you, and the label will be taken care of by your reviewer.
> **Warning**
>

View File

@@ -16,7 +16,6 @@ runs:
const java = 11;
const defaultRunner = "ubuntu-22.04";
const beefierRunner = "buildjet-2vcpu-ubuntu-2204";
const defaultOptions = {
"java-version": java,
@@ -36,8 +35,11 @@ runs:
["dashboard-cards", {} ],
["dashboard-filters", {} ],
["embedding", {} ],
["embedding-sdk", { context: "embedding-sdk" } ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],
["metrics", {} ],
["models", {} ],
["native", {} ],
["native-filters", {} ],
@@ -45,6 +47,8 @@ runs:
["organization", {} ],
["permissions", {} ],
["question", {} ],
["question-reproductions", {} ],
["search", {}],
["sharing", {} ],
["visualizations-charts", {} ],
["visualizations-tabular", {} ],

View File

@@ -0,0 +1,67 @@
name: Cross-branch migration test
inputs:
base-ref:
required: true
runs:
using: "composite"
steps:
- name: Check out base branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.base-ref }}
- name: Prepare backend environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: cross-branch-migrations
- name: Run backend on base branch
run: |
clojure -M:run:ee > metabase.log 2>&1 & echo $! > metabase_pid
tail -F metabase.log &
shell: bash
- name: Wait for Metabase to start
run: |
while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}' > /dev/null; do
if ! kill -0 $(cat metabase_pid) 2>/dev/null; then
cat metabase.log
echo "Metabase process has exited."
exit 1
fi
sleep 1
done
shell: bash
- name: Stop Metabase on base branch
run: kill $(cat metabase_pid)
shell: bash
- name: Check out pull request branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Run backend on pull request branch
run: |
clojure -M:run:ee > metabase.log 2>&1 & echo $! > metabase_pid
tail -F metabase.log &
shell: bash
- name: Wait for Metabase to start
run: |
while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}' > /dev/null; do
if ! kill -0 $(cat metabase_pid) 2>/dev/null; then
cat metabase.log
echo "Metabase process has exited. Check that your migration changes work on an instance that has been previously initialized on your PR's target branch."
exit 1
fi
sleep 1
done
shell: bash
- name: Stop Metabase on pull request branch
run: kill $(cat metabase_pid)
shell: bash

View File

@@ -10,24 +10,23 @@ 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
runs:
using: "composite"
@@ -84,4 +83,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 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

@@ -1,12 +1,20 @@
name: Prepare cypress environment
description: Cypress preparation steps
outputs:
chrome-path:
description: Path to the custom Chrome executable
value: ${{ steps.setup-chrome.outputs.chrome-path }}
runs:
using: "composite"
steps:
- name: Install Replay.io browser
run: npx @replayio/cypress install
shell: bash
- name: Install Chrome v111
uses: browser-actions/setup-chrome@v1
with:
# https://chromium.cypress.io/linux/stable/111.0.5563.146
chrome-version: 1097615
id: setup-chrome
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}

View File

@@ -1,11 +1,17 @@
name: Prepare front-end environment
inputs:
node-version:
description: "The version of Node.js to use, overriding .nvmrc"
required: false
runs:
using: "composite"
steps:
- name: Prepare Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }} # this overrides, if present
node-version-file: ".nvmrc"
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}
run: |
@@ -18,11 +24,27 @@ runs:
with:
path: ~/.m2
key: ${{ runner.os }}-cljs-${{ hashFiles('**/shadow-cljs.edn') }}
- name: Get node_modules cache
uses: actions/cache@v4
id: node-modules-cache
if: ${{ !contains(github.event.head_commit.message, '[ci nocache]') }}
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock', '**/patches/*.patch') }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
if: steps.node-modules-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile --prefer-offline
shell: bash

View File

@@ -0,0 +1,33 @@
name: Run Embedding SDK Storybook
runs:
using: "composite"
steps:
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
- 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 Storybook
run: yarn build-storybook-embedding-sdk
shell: bash
- name: Serve Storybook
run: yarn http-server storybook-static -p 6006 &
shell: bash
- name: Wait for Storybook to become available
run: |
echo "Waiting for Storybook to be served..."
while ! curl --silent --fail http://localhost:6006; do
sleep 5
echo "Retrying..."
done
echo "Storybook is being served!"
shell: bash

View File

@@ -2,7 +2,7 @@ name: Test database driver
inputs:
junit-name:
required: true
default: 'driver'
default: "driver"
test-args:
required: false
@@ -14,7 +14,7 @@ runs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: driver-${{ inputs.junit-name }}
m2-cache-key: driver
- name: Build static viz frontend
run: yarn build-static-viz
shell: bash
@@ -25,7 +25,7 @@ runs:
uses: dorny/test-reporter@v1
if: failure()
with:
path: 'target/junit/**/*_test.xml'
path: "target/junit/**/*_test.xml"
name: JUnit Test Report ${{ inputs.junit-name }}
reporter: java-junit
list-suites: failed

17
.github/auto_request_review.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# The reviewers configuration for the auto_request_review workflow
# See https://github.com/necojackarc/auto-request-review/tree/master?tab=readme-ov-file#reviewers-configuration
# for the spec
files:
# migrations related files
'resources/migrations/**':
- team:core-backend-components
'src/metabase/db/custom_migrations.clj':
- team:core-backend-components
options:
ignore_draft: true
ignored_keywords:
- DO NOT REVIEW
- WIP
enable_group_assignment: false

View File

@@ -35,14 +35,22 @@ frontend_specs: &frontend_specs
- "frontend/test/**"
- "frontend/**/tests/**"
- "frontend/**/*.unit.*"
- "jest.config.json"
- "jest.config.js"
- "jest.tz.unit.conf.json"
release_source: &release_sources
- "release/**"
frontend_all: &frontend_all
- *frontend_ci
- *frontend_sources
- *frontend_specs
frontend_loki_ci: &frontend_loki_ci
- ".github/workflows/loki.yml"
- ".loki/**"
- ".storybook/**"
backend_ci: &backend_ci
- ".github/actions/prepare-frontend/**"
- ".github/actions/prepare-backend/**"
@@ -53,6 +61,7 @@ backend_ci: &backend_ci
backend_presto_kerberos:
- "**/presto_jdbc/**"
- "**/presto_jdbc.clj"
- ".github/workflows/presto-kerberos-integration-test.yml"
backend_sources: &backend_sources
- *shared_sources
@@ -71,6 +80,7 @@ backend_specs: &backend_specs
- "modules/drivers/*/test/**"
- "test_config/**"
- "dev/**"
- "test_resources/**"
backend_all: &backend_all
- *default
@@ -100,6 +110,10 @@ e2e_specs: &e2e_specs
- "e2e/support/**"
- "e2e/snapshot*/**"
e2e_cross_version: &e2e_cross_version
- ".github/workflows/e2e-cross-version.yml"
- "e2e/test/scenarios/cross-version/**"
e2e_all:
- *default
- *e2e_ci

View File

@@ -0,0 +1,68 @@
exports.updateComment = updateComment;
/** @param {import('@types/github-script').AsyncFunctionArguments} AsyncFunctionArguments */
async function updateComment({ github, context }) {
const githubUsername = context.payload.sender.login;
const comment = `${CONVENTIONAL_COMMIT_REMINDER_COMMENT_IDENTIFIER}
@${githubUsername} You have modified embedding SDK code. Please make sure the PR title follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) style.
Here are all the supported types that will be shown in the changelog:
- \`feat\`
- \`fix\`
- \`perf\`
These types \`docs\`, \`style\`, \`refactor\`, \`test\`, \`build\`, and \`ci\` are also encouraged for non-changelog related tasks.
Please also make sure to include \`sdk\` scope, otherwise, the changelog will not include this task.
For example, these are valid PR titles:
- \`feat(sdk): Add interactive dashboard component\`
- \`feat(sdk): Support theming pie chart\`
- \`fix(sdk): Fix static dashboard crash\``;
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullRequestNumber = context.issue.number;
const comments = await github.rest.issues.listComments({
owner,
repo,
issue_number: pullRequestNumber,
});
const existingComment = getExistingConventionalCommitReminderComment(
comments.data,
);
if (existingComment) {
return await github.rest.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body: comment,
});
} else {
return await github.rest.issues.createComment({
owner,
repo,
issue_number: pullRequestNumber,
body: comment,
});
}
}
const CONVENTIONAL_COMMIT_REMINDER_COMMENT_IDENTIFIER =
"<!---conventional commit reminder comment ID-->";
/**
* @typedef Comment
* @property {string} body
*
* @param {Comment[]} comments
*/
function getExistingConventionalCommitReminderComment(comments) {
for (const comment of comments) {
if (
comment.body.startsWith(CONVENTIONAL_COMMIT_REMINDER_COMMENT_IDENTIFIER)
) {
return comment;
}
}
}

38
.github/team.json vendored
View File

@@ -1,19 +1,30 @@
{
"teams": [
{
"name": "Querying Components",
"label": ".Team/QueryingComponents",
"name": "Querying",
"label": ".Team/Querying",
"projectUrl": "https://github.com/orgs/metabase/projects/97/views/1",
"members": [
"ranquild",
"uladzimirdev",
"kamilmielnik",
"nemanjaglumac",
"romeovs"
"romeovs",
"bshepherdson",
"metamben",
"lbrdnk",
"appleby",
"uladzimirdev"
]
},
{
"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"]
},
{
@@ -23,28 +34,21 @@
"members": [
"tsmacdonald",
"qnkhuat",
"calherries",
"piranha",
"crisptrutski"
]
},
{
"name": "Query Processor",
"label": ".Team/QueryProcessor",
"projectUrl": "https://github.com/orgs/metabase/projects/85/views/1",
"members": ["camsaul", "snoe", "bshepherdson", "metamben", "lbrdnk"]
},
{
"name": "Admin Webapp",
"label": ".Team/AdminWebapp",
"members": [
"noahmoss",
"escherize",
"iethree",
"npfitz",
"johnswanson",
"rafpaf",
"sloansparger"
"sloansparger",
"iethree"
]
},
{
@@ -53,10 +57,16 @@
"members": [
"alxnddr",
"EmmadUsmani",
"JesseSDevaney",
"kulyk",
"adam-james-v"
]
},
{
"name": "DevEx",
"label": ".Team/DevEx",
"members": [
"camsaul"
]
}
]
}

View File

@@ -11,11 +11,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- 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 }}
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- uses: ./.github/actions/find-squashed-commit
name: Find commit
id: find_commit
@@ -82,7 +78,7 @@ jobs:
TARGET_BRANCH: ${{ steps.get_latest_release_branch.outputs.branch-name }}
ORIGINAL_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
ORIGINAL_TITLE: ${{ github.event.pull_request.title }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
COMMIT: ${{ steps.find_commit.outputs.commit }}
- name: Auto approve backport PR
@@ -96,7 +92,7 @@ jobs:
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

View File

@@ -0,0 +1,21 @@
# Config is in .github/auto_request_review.yml
name: Auto Request Review
on:
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
jobs:
auto-request-review:
# Don't run on forked repos
if: ${{ !github.event.pull_request.head.repo.fork }}
permissions:
contents: read
pull-requests: write
name: Auto Request Review
runs-on: ubuntu-latest
steps:
- name: Request review based on files changes and/or groups the author belongs to
uses: necojackarc/auto-request-review@v0.13.0
with:
token: '${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}'

27
.github/workflows/backend-cloverage.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Backend-Cloverage
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * 1-5' # every weekday at 5am US eastern time
jobs:
be-linter-cloverage:
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cloverage"
- name: Build static viz frontend
run: yarn build-static-viz
- name: Collect the test coverage
run: clojure -X:dev:ci:ee:ee-dev:test:cloverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/coverage/codecov.json
flags: back-end

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
@@ -63,29 +60,6 @@ jobs:
token: ${{ github.token }}
filters: .github/static-viz-sources.yaml
be-linter-cloverage:
needs: files-changed
if: (github.ref_name == 'master' && needs.files-changed.outputs.backend_all == 'true')
|| contains(github.event.pull_request.labels.*.name, 'run-cloverage')
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cloverage"
- name: Build static viz frontend
run: yarn build-static-viz
- name: Collect the test coverage
run: clojure -X:dev:ci:ee:ee-dev:test:cloverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/coverage/codecov.json
flags: back-end
be-linter-clj-kondo:
needs: [files-changed, static-viz-files-changed]
if: |
@@ -93,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
@@ -291,3 +254,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

@@ -107,8 +107,23 @@ jobs:
echo "PR has been merged, searching for a squashed commit in the base branch"
echo "searching for a commit in a ${ORIGINAL_BASE_REF} that contains pull request number ${ORIGINAL_PULL_REQUEST_NUMBER}"
SQUASHED_COMMIT=$(env -i git log ${ORIGINAL_BASE_REF} --grep="(#${ORIGINAL_PULL_REQUEST_NUMBER})" --format="%H")
echo "found commit ${SQUASHED_COMMIT}"
git cherry-pick ${SQUASHED_COMMIT}
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}

View File

@@ -17,30 +17,52 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send build start message
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendReleaseMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
const { sendPreReleaseMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendReleaseMessage({
stage: 'build-start',
await sendPreReleaseMessage({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
releaseSha: '${{ inputs.commit }}',
userName: '${{ github.actor }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
trigger-milestone-check:
runs-on: ubuntu-22.04
timeout-minutes: 5
needs: start-message
steps:
- name: trigger pre-release milestone check
uses: actions/github-script@v7
with:
script: | # js
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release-milestone-check.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
}
});
check-version:
runs-on: ubuntu-22.04
timeout-minutes: 10
@@ -113,7 +135,7 @@ jobs:
uses: actions/github-script@v7
id: release_branch
with:
result_encoding: string
result-encoding: string
script: | # js
const { getReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';

View File

@@ -1,80 +1,41 @@
name: Milestone Reminder
name: Automatically set milestone
run-name: Set milestone for ${{ github.event.head_commit.message }}
on:
pull_request:
types: [closed]
push:
branches:
- "master"
- release-x.**
jobs:
milestone-reminder:
if: github.event.pull_request.merged == true
name: Remind to set milestone
set-milestone:
name: Automatically set milestone
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
pull-requests: write
issues: read
issues: write
contents: read
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
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
with:
script: | # js
const { setMilestoneForCommits } = require('${{ github.workspace }}/release/dist/index.cjs');
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullNumber = '${{ github.event.pull_request.number }}';
const branchName = `${{ github.ref }}`;
const commitMessage = context?.payload?.head_commit?.message ?? '';
// the github API doesn't expose linked issues, so we have to parse the body ourselves
function getLinkedIssueId(pull) {
// https://regexr.com/7sk94
const match = pull.data.body.match(/(close(s|d)?|fixe?(s|d)?|resolve(s|d)?) (#|https?:\/\/github.com\/.+\/issues\/)(\d+)/i);
return match && match?.[2];
}
function getMilestone(pullOrIssue) {
// pull has pull.data.milestone, issue has issue.milestone
return pullOrIssue?.data?.milestone || pullOrIssue?.milestone;
}
const pull = await github.rest.pulls.get({
await setMilestoneForCommits({
github,
owner,
repo,
pull_number: pullNumber,
});
if (getMilestone(pull)) {
console.log("Pull request has milestone", pull.data.milestone?.title);
process.exit(0);
}
const issueId = getLinkedIssueId(pull);
if (issueId) {
console.log('linked issue found', issueId);
const issue = await github.rest.issues.get({
owner,
repo,
issue_number: issueId,
});
const milestone = getMilestone(issue);
if (milestone) {
console.log("Linked issue has milestone", milestone.title);
process.exit(0);
}
}
console.log("No milestone found");
const author = pull.data.user.login;
const guideLink = "https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#3dea255ffa3b4f74942a227844e889fa";
const message = `@${author} Did you forget to add a milestone to the issue for this PR? _[When and where should I add a milestone?](${guideLink})_`;
await github.rest.issues.createComment({
owner,
repo,
issue_number: pullNumber,
body: message,
branchName,
commitMessages: [commitMessage],
});

View File

@@ -0,0 +1,42 @@
name: Conventional commit PR Title Reminder
on:
pull_request:
branches:
- master
paths:
- enterprise/frontend/src/embedding-sdk/**
jobs:
pr-title-reminder:
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
pull-requests: write
steps:
- name: Check if the PR title is already following Conventional Commits style
uses: actions/github-script@v7
id: is-conventional-commit
with:
result-encoding: string
script: | # js
const pullRequestTitle = context.payload.pull_request.title
const conventionalCommitRegex = /^(?<type>\w+)\((?<scope>\w+)\):/
const match = pullRequestTitle.match(conventionalCommitRegex)
if (match) {
const { type, scope } = match.groups
return ['feat', 'fix', 'perf', 'docs', 'style', 'refactor', 'test', 'build', 'ci'].includes(type) && scope === 'sdk'
}
- name: Checkout repository so `gh` CLI works
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Remind PR authors to use conventional commit in the title
if: ${{ steps.is-conventional-commit.outputs.result != 'true' }}
uses: actions/github-script@v7
with:
script: |
const { updateComment } = require(".github/scripts/conventional-commit-pr-title-reminder/utils.js")
await updateComment({github, context})

View File

@@ -0,0 +1,162 @@
name: Cross-branch migration tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "resources/migrations/**"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
migrations-h2-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: h2
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-postgres-12-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
services:
postgres:
image: postgres:12-alpine
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-postgres-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
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
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mysql-8-0-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mysql:
image: cimg/mysql:8.0
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mysql-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: circle_test
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mariadb-10-2-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:10.2.23
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mariadb-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:latest
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}

View File

@@ -21,7 +21,6 @@ on:
- Athena
- BigQuery
- Druid
- Google Analytics
- Google Classpath Test
- Maria DB
- Maria DB (latest)
@@ -109,42 +108,6 @@ jobs:
junit-name: 'be-tests-druid-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-tests-googleanalytics-ee:
if: inputs.driver == 'Google Analytics'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: googleanalytics
steps:
- uses: actions/checkout@v4
- name: Test Google Analytics driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-googleanalytics-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-google-related-drivers-classpath-test:
if: inputs.driver == 'Google Classpath Test'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: 'googleanalytics,bigquery-cloud-sdk'
MB_BIGQUERY_TEST_PROJECT_ID: ${{ secrets.BIGQUERY_TEST_PROJECT_ID }}
MB_BIGQUERY_TEST_CLIENT_ID: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_ID }}
MB_BIGQUERY_TEST_CLIENT_SECRET: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_SECRET }}
MB_BIGQUERY_TEST_ACCESS_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_ACCESS_TOKEN }}
MB_BIGQUERY_TEST_REFRESH_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_REFRESH_TOKEN }}
MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON: ${{ secrets.MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON }}
steps:
- uses: actions/checkout@v4
- name: Test Google Related Drivers Classpath
uses: ./.github/actions/test-driver
with:
junit-name: 'be-google-related-drivers-classpath-test'
test-args: ':only "[metabase.query-processor-test.expressions-test metabase.driver.google-test metabase.driver.googleanalytics-test ${{ inputs.test }}] :times ${{ inputs.times }}"'
be-tests-mariadb-10-2-ee:
if: inputs.driver == 'Maria DB'
runs-on: ubuntu-22.04

View File

@@ -40,6 +40,9 @@ jobs:
MB_ATHENA_TEST_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_ACCESS_KEY }}
MB_ATHENA_TEST_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_SECRET_KEY }}
MB_ATHENA_TEST_S3_STAGING_DIR: ${{ secrets.MB_ATHENA_TEST_S3_STAGING_DIR }}
# These credentials are used to test the driver when the user does not have the athena:GetTableMetadata permission
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY }}
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- name: Test Athena driver
@@ -160,66 +163,6 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-googleanalytics-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: googleanalytics
steps:
- uses: actions/checkout@v4
- name: Test Google Analytics driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-googleanalytics-ee'
test-args: ":exclude-tags '[:mb/once]'"
- 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-google-related-drivers-classpath-test:
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: 'googleanalytics,bigquery-cloud-sdk'
MB_BIGQUERY_TEST_PROJECT_ID: ${{ secrets.BIGQUERY_TEST_PROJECT_ID }}
MB_BIGQUERY_TEST_CLIENT_ID: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_ID }}
MB_BIGQUERY_TEST_CLIENT_SECRET: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_SECRET }}
MB_BIGQUERY_TEST_ACCESS_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_ACCESS_TOKEN }}
MB_BIGQUERY_TEST_REFRESH_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_REFRESH_TOKEN }}
MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON: ${{ secrets.MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON }}
steps:
- uses: actions/checkout@v4
- name: Test Google Related Drivers Classpath
uses: ./.github/actions/test-driver
with:
junit-name: 'be-google-related-drivers-classpath-test'
test-args: ':only "[metabase.query-processor-test.expressions-test metabase.driver.google-test metabase.driver.googleanalytics-test]"'
- 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-mariadb-10-2-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
@@ -866,6 +809,11 @@ jobs:
MB_SNOWFLAKE_TEST_WAREHOUSE: ${{ secrets.MB_SNOWFLAKE_TEST_WAREHOUSE }}
MB_SNOWFLAKE_TEST_PK_USER: METABASE PK
MB_SNOWFLAKE_TEST_PK_PRIVATE_KEY: ${{ secrets.MB_SNOWFLAKE_TEST_PK_PRIVATE_KEY }}
# RSA Role testing:
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_DEFAULT_USER: RSA_ROLE_TEST_DEFAULT_USER
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_CUSTOM_USER: RSA_ROLE_TEST_CUSTOM_USER
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_ROLE: RSA_ROLE_TEST_ROLE
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_DB: RSA_ROLE_TEST_DB
steps:
- uses: actions/checkout@v4
- name: Test Snowflake driver

View File

@@ -2,12 +2,31 @@ name: E2E Cross-version Tests
on:
schedule:
- cron: '0 9 * * 0'
- cron: '0 9 * * 1-5'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
cross-version-testing:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 60
timeout-minutes: 3
outputs:
e2e_cross_version: ${{ steps.changes.outputs.e2e_cross_version }}
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
cross-version-testing:
needs: files-changed
if: ${{ needs.files-changed.outputs.e2e_cross_version == 'true' || github.event_name == 'schedule'}}
runs-on: ubuntu-22.04
timeout-minutes: 20
strategy:
matrix:
version: [
@@ -52,11 +71,12 @@ jobs:
- name: Wait for Metabase to start on port 3000
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Cypress on the source
run: |
yarn cypress run \
--browser chrome \
--browser ${{ steps.cypress-prep.outputs.chrome-path }} \
--config-file e2e/test/scenarios/cross-version/source/shared/cross-version-source.config.js \
--spec e2e/test/scenarios/cross-version/source/**/*.cy.spec.js
- name: Stop Metabase ${{ matrix.version.source }}
@@ -84,7 +104,7 @@ jobs:
- name: Run Cypress on the target
run: |
yarn cypress run \
--browser chrome \
--browser ${{ steps.cypress-prep.outputs.chrome-path }} \
--config-file e2e/test/scenarios/cross-version/target/shared/cross-version-target.config.js \
--spec e2e/test/scenarios/cross-version/target/**/*.cy.spec.js
- name: Upload Cypress Artifacts upon failure
@@ -97,20 +117,11 @@ jobs:
if-no-files-found: ignore
notify-on-failure:
needs: cross-version-testing
if: ${{ always() && contains(needs.*.result, 'failure') }}
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }}
name: Cross-version test failure
runs-on: ubuntu-22.04
env:
BRANCH_NAME: ${{ github.event.workflow_run.head_branch }}
AUTHOR_NAME: ${{ github.event.workflow_run.head_commit.author.name }}
timeout-minutes: 5
steps:
- name: Generate job summary
run: |
echo "# ${{ github.event.workflow_run.name }} workflow failed! :x:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "View the failed run attempt (#${{ github.event.workflow_run.run_attempt }}) using the following link:" >> $GITHUB_STEP_SUMMARY
echo "${{ github.event.workflow_run.html_url }}" >> $GITHUB_STEP_SUMMARY
- uses: actions/setup-node@v4
with:
node-version: lts/Hydrogen # 18.x.x
@@ -119,11 +130,8 @@ jobs:
uses: actions/github-script@v7
with:
script: | # js
const FAILED_RUN_URL = "${{ github.event.workflow_run.html_url }}";
const FAILED_RUN_NAME = "${{ github.event.workflow_run.name }}";
const BREAKING_COMMIT = "${{ github.event.workflow_run.head_sha }}";
const AUTHOR = process.env.AUTHOR_NAME;
const BRANCH = process.env.BRANCH_NAME;
const FAILED_RUN_URL = "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}";
const REF_NAME = "${{ github.ref_name }}";
// notify slack of failure
const { WebClient } = require('@slack/web-api');
@@ -137,7 +145,7 @@ jobs:
"type": "header",
"text": {
"type": "plain_text",
"text": `:broken_heart: Cross-version tests are failing on ${BRANCH}`,
"text": `:broken_heart: Cross-version tests are failing on ${REF_NAME}`,
"emoji": true,
}
},
@@ -149,7 +157,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": `Commit <https://github.com/metabase/metabase/commit/${BREAKING_COMMIT}|${BREAKING_COMMIT.slice(0,7)}> has failing <${FAILED_RUN_URL}|${FAILED_RUN_NAME}> tests on the <https://github.com/metabase/metabase/commits/${BRANCH}|\`${BRANCH}\`> branch.`
"text": `See <${FAILED_RUN_URL}|failing run details>.`
}
},
]

View File

@@ -20,6 +20,15 @@ on:
type: string
required: false
default: "ee"
qa_db:
description: 'Select the type of Database you want to run your tests with'
type: choice
required: true
default: "none"
options:
- none
- sql
- mongo
jobs:
workflow-summary:
@@ -35,6 +44,7 @@ jobs:
echo '- `spec`: ${{ inputs.spec }}' >> $GITHUB_STEP_SUMMARY
echo '- `burn_in`: ${{ inputs.burn_in }}' >> $GITHUB_STEP_SUMMARY
echo '- `grep`: "${{ inputs.grep }}"' >> $GITHUB_STEP_SUMMARY
echo '- `qa_db`: "${{ inputs.qa_db }}"' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'triggered by: @${{ github.event.sender.login }}' >> $GITHUB_STEP_SUMMARY
@@ -44,9 +54,8 @@ jobs:
name: Stress test E2E flake fix
env:
DISPLAY: ""
QA_DB_ENABLED: true
CYPRESS_QA_DB_MONGO: true
CYPRESS_REPLAYIO_ENABLED: 1
QA_DB_ENABLED: ${{ contains(fromJSON('["sql", "mongo"]'), inputs.qa_db) }}
CYPRESS_QA_DB_MONGO: ${{ inputs.qa_db == 'mongo' }}
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
MB_SNOWPLOW_AVAILABLE: true
@@ -67,9 +76,9 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
maildev: true
openldap: true
postgres: true
mysql: true
mongo: true
postgres: ${{ inputs.qa_db == 'sql' }}
mysql: ${{ inputs.qa_db == 'sql' }}
mongo: ${{ inputs.qa_db == 'mongo' }}
- name: Download Metabase ${{ matrix.edition }} uberjar
uses: ./.github/actions/e2e-download-uberjar
@@ -84,6 +93,7 @@ jobs:
java-version: 11
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
@@ -96,7 +106,7 @@ jobs:
--spec '${{ github.event.inputs.spec }}' \
--env burn=${{ github.event.inputs.burn_in }},grep='${{ github.event.inputs.grep }}' \
--config-file e2e/support/cypress-stress-test.config.js \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4

View File

@@ -4,7 +4,7 @@ on:
push:
branches:
- "master"
- 'release-**'
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
@@ -39,8 +39,39 @@ jobs:
id: e2e-matrix
uses: ./.github/actions/build-e2e-matrix
# if this is a test on a release branch, we need to check the build requirements
get-build-requirements:
if: |
!cancelled() &&
contains(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 version = getVersionFromReleaseBranch('${{ github.ref }}');
const requirements = getBuildRequirements(version);
return {
java_version: requirements.java,
node_version: requirements.node,
};
build:
needs: [files-changed, e2e-matrix-builder]
needs: [files-changed, e2e-matrix-builder, get-build-requirements]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
@@ -54,14 +85,19 @@ jobs:
env:
MB_EDITION: ${{ matrix.edition }}
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: e2e-tests
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
@@ -87,14 +123,11 @@ jobs:
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 }}
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
CYPRESS_REPLAYIO_ENABLED: 1
RECORD_REPLAY_METADATA_FILE: /tmp/replay-metadata.json
RECORD_REPLAY_METADATA_TEST_RUN_ID: ${{ github.run_id }}
REPLAY_API_KEY: ${{ secrets.REPLAY_IO_TOKEN }}
TZ: US/Pacific # to make node match the instance tz
CYPRESS_CI: true
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.e2e-matrix-builder.outputs.matrix) }}
@@ -112,6 +145,7 @@ jobs:
postgres: ${{ matrix.name != 'mongo'}}
mysql: ${{ matrix.name != 'mongo'}}
mongo: ${{ matrix.name == 'mongo'}}
webhook: true
- name: Retrieve uberjar artifact for ${{ matrix.edition }}
uses: actions/download-artifact@v4
@@ -133,6 +167,7 @@ jobs:
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
@@ -143,24 +178,24 @@ jobs:
run: |
yarn run test-cypress-run \
--env grepTags=@OSS,grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--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' \
--browser 'replay-chromium'
--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' \
--browser 'replay-chromium'
--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'
@@ -168,18 +203,33 @@ jobs:
yarn run test-cypress-run \
--env grepTags="-@slow+-@mongo+-@flaky --@quarantine",grepOmitFiltered=true \
--folder ${{ matrix.name }} \
--browser 'replay-chromium'
--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' \
--browser 'replay-chromium'
--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()
@@ -217,46 +267,10 @@ jobs:
- run: |
echo "Didn't run due to conditional filtering"
visual-regression-tests:
runs-on: ubuntu-22.04
timeout-minutes: 60
pr-env:
needs: [build]
if: |
!cancelled() && needs.build.result == 'success'
name: percy-visual-regression-tests
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
- name: Retrieve uberjar artifact for ${{ matrix.edition }}
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 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ github.ref == 'refs/heads/master' && secrets.PERCY_TOKEN || ''}}
!cancelled() &&
contains(github.event.pull_request.labels.*.name, 'PR-Env')
uses: ./.github/workflows/pr-env.yml
secrets: inherit

View File

@@ -0,0 +1,34 @@
name: Flake Issue Creator
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1-5' # every weekday at 1am US eastern time
jobs:
flake-issue-creator:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Update flake issues
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { updateFlakeIssues } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
await updateFlakeIssues({
github,
owner: context.repo.owner,
repo: context.repo.repo,
});

35
.github/workflows/flake-status.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Flake Status Report
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 2,5' # Tuesdays and Fridays at 1am US eastern time
jobs:
flake-status-report:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Post Flake Status Report
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { summarizeFlakes } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
await summarizeFlakes({
github,
owner: context.repo.owner,
repo: context.repo.repo,
channelName: 'engineering-ci'
});

View File

@@ -4,15 +4,15 @@ on:
workflow_dispatch:
inputs:
spec:
description: 'Relative path of the target spec'
description: "Relative path of the target spec"
type: string
required: true
burn_in:
description: 'Number of times to run the test (e.g. 20)'
description: "Number of times to run the test (e.g. 20)"
type: string
required: true
grep:
description: 'Grep and filter tests to run in isolation'
description: "Grep and filter tests to run in isolation"
type: string
required: false
@@ -45,10 +45,12 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Build cljs
run: yarn build:cljs
- name: Stress-test ${{ github.event.inputs.spec }} ${{ github.event.inputs.burn_in }} times
run: |
for i in {1..${{ github.event.inputs.burn_in }}}; do
yarn test-unit \
yarn jest --runInBand --ci --silent --no-cache \
--testPathPattern '${{ github.event.inputs.spec }}' \
--testNamePattern '${{ github.event.inputs.grep }}'
if [[ "$?" != 0 ]]; then

View File

@@ -10,8 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
ref: ${{ github.head_ref }}
- name: Prepare frontend environment
@@ -26,7 +27,9 @@ jobs:
run: yarn build-pure:cljs
- name: Build Storybook
run: yarn build-storybook
# We won't be able to use Storybook play's `userEvent` with production build
# see https://github.com/storybookjs/storybook/issues/19758
run: NODE_ENV=development yarn build-storybook
- name: Serve Storybook
run: yarn http-server storybook-static -p 6006 &
@@ -44,25 +47,19 @@ jobs:
- name: Update Loki Snapshots
run: yarn test-visual:loki-update
- 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 }}
- name: Commit and Push Changes
run: |
git config --global user.name "Metabase bot"
git config --global user.email "metabase-bot@metabase.com"
git config --global user.name "Metabase Automation"
git config --global user.email "github-automation@metabase.com"
git add .loki/**
git commit -m "Update Loki Snapshots"
git push
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Remove 'loki-update' label
uses: actions/github-script@v3
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
github-token: ${{secrets.METABASE_AUTOMATION_USER_TOKEN}}
script: |
github.issues.removeLabel({
issue_number: context.issue.number,

View File

@@ -3,7 +3,26 @@ name: Loki Visual Regression Testing
on: [pull_request]
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
frontend_ci: ${{ steps.changes.outputs.frontend_ci }}
frontend_sources: ${{ steps.changes.outputs.frontend_sources }}
frontend_loki_ci: ${{ steps.changes.outputs.frontend_loki_ci }}
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
visual-test:
needs: files-changed
if: needs.files-changed.outputs.frontend_ci == 'true' || needs.files-changed.outputs.frontend_sources == 'true' || needs.files-changed.outputs.frontend_loki_ci == 'true'
runs-on: ubuntu-latest
services:
docker:
@@ -19,7 +38,7 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
@@ -33,7 +52,9 @@ jobs:
run: yarn build-pure:cljs
- name: Build Storybook
run: yarn build-storybook
# We won't be able to use Storybook play's `userEvent` with production build
# see https://github.com/storybookjs/storybook/issues/19758
run: NODE_ENV=development yarn build-storybook
- name: Serve Storybook
run: yarn http-server storybook-static -p 6006 &
@@ -50,7 +71,7 @@ jobs:
- name: Run Loki Visual Tests
run: |
yarn loki test
yarn test-visual:loki
- name: Generate Visual Report on Failure
if: failure()

View File

@@ -1,4 +1,4 @@
name: Migrations
name: Lint migrations
on:
push:
@@ -9,14 +9,14 @@ on:
jobs:
check-migrations:
lint-migrations:
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: check-migrations
- name: Verify Liquibase Migrations
run: ./bin/lint-migrations-file.sh
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: lint-migrations
- name: Verify Liquibase Migrations
run: ./bin/lint-migrations-file.sh

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

@@ -1,91 +0,0 @@
# Triggers Percy job by "@metabase-bot run visual tests" comment in a PR
name: PercyIssueComment
on:
issue_comment:
types: [created]
jobs:
pr_info:
if: github.event.comment.body == '@metabase-bot run visual tests'
runs-on: ubuntu-22.04
outputs:
pull_request_number: ${{ fromJson(steps.fetch_pr.outputs.data).head.number }}
branch_name: ${{ fromJson(steps.fetch_pr.outputs.data).head.ref }}
commit_sha: ${{ fromJson(steps.fetch_pr.outputs.data).head.sha }}
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
with:
ref: ${{ needs.pr_info.outputs.branch_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Membership
id: verify-membership
uses: ./.github/actions/verify-membership
with:
github_token: ${{ steps.generate-token.outputs.token }}
organization_name: metabase
username: ${{ github.event.comment.user.login }}
- run: |
result=${{ steps.verify-membership.outputs.is_member }}
if [ $result == false ]; then
echo User ${{ github.event.comment.user.login }} is not a member of Metabase organization
exit 1
fi
- name: Fetch issue
uses: octokit/request-action@v2.x
id: fetch_issue
with:
route: GET ${{ github.event.issue.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch PR
uses: octokit/request-action@v2.x
id: fetch_pr
with:
route: GET ${{ fromJson(steps.fetch_issue.outputs.data).pull_request.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
percy:
timeout-minutes: 30
runs-on: buildjet-4vcpu-ubuntu-2004
needs: [pr_info]
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MB_EDITION: ee
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.pr_info.outputs.branch_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: percy-issue-comment
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- run: ./bin/build.sh
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Run maildev
run: docker run -d -p 1080:1080 -p 1025:1025 maildev/maildev:2.0.5
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_COMMIT: ${{ needs.pr_info.outputs.commit_sha }}
PERCY_BRANCH: ${{ needs.pr_info.outputs.branch_name }}
PERCY_PULL_REQUEST: ${{ needs.pr_info.outputs.pull_request_number }}

View File

@@ -1,39 +0,0 @@
# Triggers Percy job on pull requests that contain "visual" label
name: Percy visual tests
on:
pull_request:
types: [synchronize, labeled]
jobs:
percy:
if: contains(github.event.pull_request.labels.*.name, 'visual')
timeout-minutes: 30
runs-on: buildjet-4vcpu-ubuntu-2004
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MB_EDITION: ee
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: percy-visual-label
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- run: ./bin/build.sh
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Run maildev
run: docker run -d -p 1080:1080 -p 1025:1025 maildev/maildev:2.0.5
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

17
.github/workflows/perf-test-labeled.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Perf test command
on:
pull_request:
types: [ labeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run-perf-test:
if: ${{ github.event.label.name == 'Run-perf' }}
uses: ./.github/workflows/perf-test.yml
with:
wait_for_uberjar: true
secrets: inherit

150
.github/workflows/perf-test.yml vendored Normal file
View File

@@ -0,0 +1,150 @@
name: CI for Perf tests
run-name: Run perf test for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
inputs:
wait_for_uberjar:
description: "Wait for uberjar build"
required: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
name: Build Metabase Docker image
timeout-minutes: 60
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
with:
registries: "${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}"
- name: Wait for uberjar
id: wait_for_uberjar
if: ${{ inputs.wait_for_uberjar == true }}
run: |
## Get workflow run id for uberjar build
curl -Ls --output e2e-tests.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/e2e-tests.yml/runs?head_sha=${{ github.event.pull_request.head.sha || github.sha }}
ID=$(jq -r '.workflow_runs[0].id' e2e-tests.json)
## Wait for uberjar build to complete
while [ true ]; do
curl -Ls --output uberjar.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${ID}/jobs?filter=latest
jq -r '.jobs[] | select(.name == "build (ee)") | .steps[] | select(.name == "Prepare uberjar artifact") | .status' uberjar.json | grep -q "completed" && break
echo "Waiting for uberjar build..."
sleep 10
done
echo "run_id=$(jq -r '.workflow_runs[0].id' e2e-tests.json)" >> $GITHUB_OUTPUT
- name: Retrieve uberjar artifact for ee
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.wait_for_uberjar && steps.wait_for_uberjar.outputs.run_id || github.run_id }}
- name: Move uberjar to bin/docker
run: |
jar xf target/uberjar/metabase.jar
mv target/uberjar/metabase.jar bin/docker/metabase.jar
- name: Build container
uses: docker/build-push-action@v6
with:
context: bin/docker/
platforms: linux/amd64
network: host
tags: ${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/metabase-enterprise:pr${{ github.event.number }}
push: true
launch_perf_test:
needs: [ build ]
runs-on: ubuntu-latest
name: Launch Perf Test
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Download Deployment YAML template
run: aws s3 cp s3://metabase-pr-env/perf-test-pr.yml.tmpl ./perf-test-pr.yml.tmpl
- name: Trim SHA
env:
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
id: split
run: echo "::set-output name=fragment::${SHA:5}"
- name: Render Deployment YAML
uses: nowactions/envsubst@v1
with:
input: ./perf-test-pr.yml.tmpl
output: ./perf-test-pr.yml
env:
IMAGE_TAG: pr${{ github.event.number }}
PR_NUMBER: ${{ github.event.number }}
RUN_ID: ${{ steps.split.outputs.fragment }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
TEST_NAME: test
- name: Deploy PR Review ENV
run: |
kubectl apply -f ./perf-test-pr.yml

View File

@@ -0,0 +1,15 @@
name: PR Closed or Unlabeled
on:
pull_request:
types: [ closed, unlabeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-env:
if: ${{ github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR-Env') || github.event.label.name == 'PR-Env' }}
uses: ./.github/workflows/pr-env-destroy.yml
secrets: inherit

71
.github/workflows/pr-env-destroy.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: CI for PR Review ENV Destroy
run-name: Destroying Dynamic PR Environment for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
jobs:
destroy_pr:
runs-on: ubuntu-latest
name: PR Review ENV Destroy
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Destroy PR Review ENV
run: |
kubectl delete metabase -n hosting-pr${{ github.event.number }} hosting-pr${{ github.event.number }}
kubectl delete ns hosting-pr${{ github.event.number }}
- name: Setup psql client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Drop app database if exists
run: |
PGPASSWORD='${{ secrets.PR_ENV_DB_PASSWORD }}' \
psql \
-h ${{ secrets.PR_ENV_DB_HOST }} \
-U ${{ secrets.PR_ENV_DB_USER }} \
-d ${{ secrets.PR_ENV_DB_NAME }} \
-c "DROP DATABASE IF EXISTS hosting_pr${{ github.event.number }};"

17
.github/workflows/pr-env-labeled.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: PR-Env labeled
on:
pull_request:
types: [ labeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-env:
if: ${{ github.event.label.name == 'PR-Env' }}
uses: ./.github/workflows/pr-env.yml
with:
wait_for_uberjar: true
secrets: inherit

169
.github/workflows/pr-env.yml vendored Normal file
View File

@@ -0,0 +1,169 @@
name: CI for PR Review ENV
run-name: Building Dynamic PR Environment for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
inputs:
wait_for_uberjar:
description: "Wait for uberjar build"
required: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
name: Build Metabase Docker image
timeout-minutes: 60
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
with:
registries: "${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}"
- name: Wait for uberjar
id: wait_for_uberjar
if: ${{ inputs.wait_for_uberjar == true }}
run: |
## Get workflow run id for uberjar build
curl -Ls --output e2e-tests.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/e2e-tests.yml/runs?head_sha=${{ github.event.pull_request.head.sha || github.sha }}
ID=$(jq -r '.workflow_runs[0].id' e2e-tests.json)
## Wait for uberjar build to complete
while [ true ]; do
curl -Ls --output uberjar.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${ID}/jobs?filter=latest
jq -r '.jobs[] | select(.name == "build (ee)") | .steps[] | select(.name == "Prepare uberjar artifact") | .status' uberjar.json | grep -q "completed" && break
echo "Waiting for uberjar build..."
sleep 10
done
echo "run_id=$(jq -r '.workflow_runs[0].id' e2e-tests.json)" >> $GITHUB_OUTPUT
- name: Retrieve uberjar artifact for ee
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.wait_for_uberjar && steps.wait_for_uberjar.outputs.run_id || github.run_id }}
- name: Move uberjar to bin/docker
run: |
jar xf target/uberjar/metabase.jar
mv target/uberjar/metabase.jar bin/docker/metabase.jar
- name: Build container
uses: docker/build-push-action@v6
with:
context: bin/docker/
platforms: linux/amd64
network: host
tags: ${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/metabase-enterprise:pr${{ github.event.number }}
push: true
deploy_pr:
needs: [ build ]
runs-on: ubuntu-latest
name: PR Review ENV
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Setup psql client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Create app database if not exists
run: |
export PGPASSWORD='${{ secrets.PR_ENV_DB_PASSWORD }}'
export PGUSER=${{ secrets.PR_ENV_DB_USER }}
export PGHOST=${{ secrets.PR_ENV_DB_HOST }}
export PGDATABASE=${{ secrets.PR_ENV_DB_NAME }}
psql -tc "SELECT 1 FROM pg_database WHERE datname = 'hosting_pr${{ github.event.number }}'" \
| grep -q 1 \
|| psql -c "CREATE DATABASE hosting_pr${{ github.event.number }}"
- name: Download Deployment YAML template
run: aws s3 cp s3://metabase-pr-env/metabase.yml.tmpl ./metabase.yml.tmpl
- name: Render Deployment YAML
uses: nowactions/envsubst@v1
with:
input: ./metabase.yml.tmpl
output: ./metabase.yml
env:
IMAGE_TAG: pr${{ github.event.number }}
PR_NUMBER: ${{ github.event.number }}
MB_PREMIUM_EMBEDDING_TOKEN: ${{ secrets.PR_ENV_MB_PREMIUM_EMBEDDING_TOKEN }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Deploy PR Review ENV
run: |
kubectl apply -f ./metabase.yml
preview_links:
runs-on: ubuntu-latest
needs: [ deploy_pr ]
steps:
- uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
message: |
👋 Deploying a preview environment for commit ${{ github.event.pull_request.head.sha || github.sha }}.
✅ Preview:
https://pr${{ github.event.number }}.coredev.metabase.com
🗒️ [login instructions](https://www.notion.so/metabase/Ephemeral-PR-Environments-c74a3710c87a460dbf4fc0007a001458)

View File

@@ -11,6 +11,10 @@ on:
commit:
description: "A full-length commit SHA-1 hash"
required: true
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
release-artifact:
@@ -110,7 +114,7 @@ jobs:
run-sanity-check:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [release-artifact, check-uberjar-health]
needs: [release-artifact]
strategy:
matrix:
edition: [oss, ee]
@@ -125,20 +129,17 @@ jobs:
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
TERM: xterm
services:
maildev:
image: maildev/maildev:2.0.5
ports:
- "1080:1080"
- "1025:1025"
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
maildev: true
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
@@ -147,6 +148,7 @@ jobs:
java-version: 11
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
@@ -161,7 +163,10 @@ jobs:
- name: Run a few important Cypress tests as sanity check
run: |
mkdir -p ./target/uberjar && cp metabase.jar ./target/uberjar/metabase.jar
yarn test-cypress-run --folder onboarding
yarn test-cypress-run \
--env grepTags="@smoke",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
@@ -174,7 +179,7 @@ jobs:
if-no-files-found: ignore
containerize:
needs: [release-artifact, run-sanity-check]
needs: [release-artifact]
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
@@ -283,3 +288,61 @@ jobs:
- name: Wait for Metabase to start
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
needs: [run-sanity-check, check-uberjar-health, verify-docker-pull]
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 tests 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 { sendTestsCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
const allJobsSuccessful =
'${{ needs.run-sanity-check.result }}' === 'success' &&
'${{ needs.check-uberjar-health.result }}' === 'success' &&
'${{ needs.verify-docker-pull.result }}' === 'success';
await sendTestsCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
testStatus: allJobsSuccessful ? 'success' : 'failure',
}).catch(console.error);

View File

@@ -1,3 +1,8 @@
# this file uses MBA https://github.com/metabase/mba to spin up a Metabase
# instance then runs the test script in the MBA instance sharing the same
# network to interact with presto container
# TODO: get rid of MBA and use actions/prepare-backend instead
name: Kerberized Presto Integration Test
on:
@@ -5,10 +10,10 @@ on:
push:
branches:
- master
- 'release**'
- 'feature**'
- "release**"
- "feature**"
tags:
- '**'
- "**"
jobs:
files-changed:
@@ -52,7 +57,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
path: presto-kerberos-docker
- name: Bring up Presto+Kerberos cluster
run: cd presto-kerberos-docker && docker-compose up -d && cd ..
run: cd presto-kerberos-docker && docker compose up -d && cd ..
- name: Run Presto test query from command line (sanity check)
run: cd presto-kerberos-docker && ./test.sh && cd ..
# Since we are managing the Docker containers from the GitHub action container, we need to copy all the
@@ -63,6 +68,7 @@ jobs:
run: docker cp presto-kerberos:/etc/krb5.conf resources
- name: Copy client.keytab file to resources
run: docker cp presto-kerberos:/home/presto/client.keytab resources
- name: Checkout mba
uses: actions/checkout@v4
with:
@@ -74,11 +80,30 @@ jobs:
run: ls -latr mba-src
- name: Symlink mba
run: cd mba-src && sudo ln -s $(pwd)/src/main.clj /usr/local/bin/mba && chmod +x /usr/local/bin/mba && cd ..
- name: Ensure mba
run: which mba
- name: Run Metabase via MBA
run: /home/runner/work/metabase/metabase/mba-src/src/main.clj --mb . --data-db postgres-data -n example.com up
run: mba --mb . --data-db postgres-data -n example.com compose config > mba-compose.yml
- name: Adjust generated docker-compose config
uses: actions/github-script@v7
with:
script: | #js
const fs = require("fs");
const config = fs.readFileSync("mba-compose.yml", "utf8");
const newConfig = config.replace(
/name:\s+example.com/,
"name: example.com\n external: true",
);
fs.writeFileSync("mba-compose.yml", newConfig);
- name: Print compose config
run: cat mba-compose.yml
- name: Run mba
run: docker compose -f mba-compose.yml up -d
- name: Run test script in MBA instance
run: >
mba --mb . --data-db postgres-data -n example.com \
run .github/scripts/run-presto-kerberos-integration-test.sh
run: docker compose -f mba-compose.yml exec metabase .github/scripts/run-presto-kerberos-integration-test.sh

View File

@@ -0,0 +1,254 @@
name: Release Metabase Embedding SDK for React
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
required: true
concurrency:
# We want to ensure only one job is running at a time because
# there could be a conflict when updating the readme file.
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
check-git-tag:
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
fetch-tags: true
- name: check tags
run: |
if [ $(git tag -l | grep $tag$) ]
then
echo "::error::Tag '${{ env.tag }}' already exists. If you expect to run this workflow with the same tag, please remove the tag first and rerun this workflow again."
exit 1
else
exit 0
fi
test:
needs: check-git-tag
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
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: "release-sdk"
- name: Run unit tests
run: yarn embedding-sdk:test-unit
build-sdk:
needs: test
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
fetch-tags: true
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
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 }}
- name: Update changelog
run: |
yarn embedding-sdk:generate-changelog -o changelog-diff
- name: Build SDK bundle
run: yarn run build-embedding-sdk
- name: Generate SDK package.json in the build directory
run: yarn run embedding-sdk:generate-package
- name: Upload built SDK package as artifact
uses: actions/upload-artifact@v4
with:
name: metabase-sdk
path: ./resources/embedding-sdk
- name: Upload changelog diff
uses: actions/upload-artifact@v4
with:
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]
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out master 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
- name: Setup git user
run: |
git config --global user.email "github-automation@metabase.com"
git config --global user.name "Metabase Automation"
- name: Update readme
run: |
bash ./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
run: |
bash ./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
- name: Retrieve SDK changelog diff
uses: actions/download-artifact@v4
with:
name: sdk-changelog-diff
- name: Update changelog
run: |
cat changelog-diff enterprise/frontend/src/embedding-sdk/CHANGELOG.md > new-changelog
mv new-changelog enterprise/frontend/src/embedding-sdk/CHANGELOG.md
- 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 push origin HEAD
gh pr create --base master\
--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 }}"
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.METABASE_BOT_APP_ID }}
private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- name: Edit PR adding useful information (using Metabase bot app)
run: |
gh pr edit --add-reviewer @metabase/embedding --add-label no-backport
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Auto approve PR (using GitHub Actions account)
run: |
gh pr review --approve
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable Pull request auto-merge (using GitHub Metabase Automation account)
run: |
gh pr merge --auto --squash
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Retrieve build SDK package artifact
uses: actions/download-artifact@v4
with:
name: metabase-sdk
path: sdk
- name: Publish to NPM
run: |
cd sdk
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_RELEASE_TOKEN }} > .npmrc
npm publish
git-tag:
needs: publish-npm
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
# Lightweight tags don't need committer name and email
- name: Create a new git tag
run: |
git tag ${{ env.tag }}
- name: Push the new tag
id : push-tag
run: |
git push origin ${{ env.tag }}

43
.github/workflows/release-log.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Update Release Log
run-name: Update Release Log ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Major Metabase version (e.g. 45, 52, 68)'
type: number
required: true
schedule:
- cron: '45 * * * *' # hourly
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
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:
fetch-depth: 0 # we want all branches and tags
- name: Install Dependencies
run: yarn --cwd release --frozen-lockfile && npm i -g tsx
- name: generate release Log
run: cd release && tsx ./src/release-log.ts $VERSION > v$VERSION.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: Create cloudfront invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths /release-log/v$VERSION.html

View File

@@ -0,0 +1,53 @@
name: Release Milestone Check
run-name: Pre-release Milestone check for ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: "Metabase version (e.g. v0.46.3)"
type: string
required: true
commit:
description: "A full-length commit SHA-1 hash"
required: true
jobs:
check-milestone:
permissions: write-all
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
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 }}
with:
script: | # js
const {
checkMilestoneForRelease,
sendMilestoneCheckMessage,
} = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const commitHash = '${{ inputs.commit }}';
const issueCount = await checkMilestoneForRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version,
commitHash,
});
await sendMilestoneCheckMessage({
channelName: process.env.SLACK_RELEASE_CHANNEL,
issueCount,
version,
});

View File

@@ -0,0 +1,55 @@
name: Release Notes Preview
run-name: Preview ${{ inputs.version }} release notes
on:
workflow_dispatch:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
type: string
required: true
jobs:
preview-release-notes:
runs-on: ubuntu-22.04
timeout-minutes: 5
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
env:
DOCKERHUB_OWNER: test_owner
DOCKERHUB_REPO: test_repo
AWS_S3_DOWNLOADS_BUCKET: test_bucket
with:
script: | # js
const { getChangelog } = require('${{ github.workspace }}/release/dist/index.cjs');
const fs = require('fs');
const version = '${{ inputs.version }}';
const notes = await getChangelog({
version,
github,
owner: context.repo.owner,
repo: context.repo.repo,
});
fs.writeFileSync(`release-notes-preview-${version}.md`, notes);
- name: Upload Release Notes
uses: actions/upload-artifact@v4
with:
name: release-notes-preview-${{inputs.version}}.md
path: |
${{ github.workspace }}/release-notes-preview-*.md

91
.github/workflows/release-patch.yml vendored Normal file
View File

@@ -0,0 +1,91 @@
name: Release 1b - Auto Patch
run-name: Patch Release ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Major Metabase version (e.g. 45, 52, 68)'
type: number
required: true
schedule:
- cron: '15 0 * * 2-6' # every weekday at 7/8:15 pm Eastern Time
jobs:
auto-patch-trigger:
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: yarn --cwd release --frozen-lockfile && yarn --cwd release build
- name: Trigger auto-patch
uses: actions/github-script@v7
with:
script: | # js
const {
getLatestGreenCommit,
getNextPatchVersion,
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];
async function releasePatchFor(majorVersion) {
const nextPatch = await getNextPatchVersion({
github,
owner: context.repo.owner,
repo: context.repo.repo,
majorVersion,
});
const goodCommit = await getLatestGreenCommit({
github,
owner: context.repo.owner,
repo: context.repo.repo,
branch: `release-x.${majorVersion}.x`,
});
const hasBeenReleased = await hasCommitBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
ref: goodCommit,
majorVersion: Number(majorVersion),
});
if (nextPatch && goodCommit && !hasBeenReleased) {
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'tag-for-release.yml',
ref: 'refs/heads/master',
inputs: {
commit: goodCommit,
version: nextPatch,
auto: true,
}
});
} else {
console.log(
{ nextPatch, goodCommit, hasBeenReleased }
);
console.error(`No new patch version or no green commit found for v${majorVersion}`);
}
}
if (context.eventName === 'workflow_dispatch') {
const inputVersion = Number(context.payload.inputs.version);
if (typeof inputVersion !== 'number') {
console.log('Invalid version number', inputVersion);
throw new Error(`Invalid version number: ${inputVersion}`);
}
await releasePatchFor(inputVersion);
} else { // scheduled release of AUTO_RELEASE_VERSIONS
await Promise.all(AUTO_RELEASE_VERSIONS.map(releasePatchFor));
}

View File

@@ -1,9 +1,9 @@
name: Release Status Check
name: Release and Backport Status Check
on:
workflow_dispatch:
schedule:
- cron: '0 11 * * 1-5' # every weekday at 6am US eastern time
- cron: '0 7 * * 1-5' # every weekday at 8am/9am Central European Time
jobs:
check-release-status:
@@ -38,3 +38,31 @@ jobs:
repo: context.repo.repo,
channelName: process.env.SLACK_RELEASE_CHANNEL,
});
open-backport-reminder:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Check release status and post to Slack
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { checkOpenBackports } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
const ossReleased = await checkOpenBackports({
github,
owner: context.repo.owner,
repo: context.repo.repo,
channelName: 'engineering-ci',
});

72
.github/workflows/release-tests.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: Release Code Tests
on:
push:
branches:
- "master"
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:
release_source: ${{ steps.changes.outputs.release_source }}
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
release-type-check:
needs: files-changed
if: needs.files-changed.outputs.release_source == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: "release"
- name: prepare dependencies in release directory
run: yarn --cwd release --frozen-lockfile
- name: Run frontend type-check
run: yarn --cwd release type-check
release-tests-unit:
needs: files-changed
if: needs.files-changed.outputs.release_source == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: "release"
- name: prepare dependencies in release directory
run: yarn --cwd release --frozen-lockfile
- name: Run release unit tests
run: yarn --cwd release test:unit
release-test-build:
needs: files-changed
if: needs.files-changed.outputs.release_source == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: "release"
- name: prepare dependencies in release directory
run: yarn --cwd release --frozen-lockfile
- name: Build release bundle
run: yarn --cwd release build
- name: Smoke test release bundle
run: node release/dist/index.cjs

View File

@@ -31,6 +31,10 @@ on:
description: 'Skip publishing release notes'
type: boolean
default: false
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
check-version:
@@ -90,6 +94,34 @@ jobs:
return versions;
publish-start-message:
runs-on: ubuntu-22.04
needs: [check-version]
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 publish start 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 { sendPublishStartMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishStartMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
download-uberjar:
needs: check-version
runs-on: ubuntu-22.04
@@ -228,7 +260,7 @@ jobs:
- 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: ${{ steps.latest_path.outputs.result != 'false' }}
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: |
@@ -374,7 +406,7 @@ jobs:
echo "Finished!"
- name: Tag the container image as latest
if: ${{ steps.latest_version_check.outputs.result == '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
@@ -482,16 +514,25 @@ jobs:
$GITHUB_WORKSPACE/release/reorder-tags.sh ${{ needs.check-version.outputs.ee }} ${{ inputs.commit }}
trigger-docs-update:
if: ${{ inputs.skip-release-notes != true }}
needs: push-tags
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.DOCS_UPDATE_TOKEN }}
script: |
github.rest.repos.createDispatchEvent({
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',
@@ -499,9 +540,97 @@ jobs:
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
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const version = '${{ inputs.version }}';
const enterpriseVersion = version.replace(/^v0\./, "v1.");
github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: '${{ vars.OPS_REPO }}',
event_type: 'create-release-issues',
client_payload: {
version: enterpriseVersion,
}
});
trigger-ee-extra-pr:
needs: verify-s3-download
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const version = '${{ inputs.version }}';
const enterpriseVersion = version.replace(/^v0\./, "v1.");
github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: 'metabase-ee-extra',
event_type: 'update-ee-extra-build',
client_payload: {
version: enterpriseVersion,
auto: true, // always auto-merge
}
});
draft-release-notes:
if: ${{ inputs.skip-release-notes != true }}
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 15
@@ -553,7 +682,7 @@ jobs:
});
publish-version-info:
if: ${{ inputs.skip-version-info != true }}
if: ${{ !inputs.auto && inputs.skip-version-info != true }}
runs-on: ubuntu-22.04
needs: [push-tags, check-version]
timeout-minutes: 15
@@ -611,7 +740,66 @@ jobs:
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths "/version-info.json" "/version-info-ee.json"
publish-complete-message:
if: ${{ !inputs.auto }}
runs-on: ubuntu-22.04
needs: [draft-release-notes, verify-docker-pull, verify-s3-download, publish-version-info]
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 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');
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');
await sendPublishCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
generalChannelName: '',
}).catch(console.error);
manage-milestones:
if: ${{ !inputs.auto }}
permissions: write-all
runs-on: ubuntu-22.04
needs: [draft-release-notes, publish-version-info] # this will ensure that the milestone stays open until the release notes are published

View File

@@ -1,44 +0,0 @@
name: Require Percy specs
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
files-changed:
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'visual')
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
visualizations: ${{ steps.changes.outputs.visualizations }}
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
add-label:
needs: files-changed
if: needs.files-changed.outputs.visualizations == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 20
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/github-script@v7
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["visual"]
})

View File

@@ -2,7 +2,7 @@ name: Re-run Flaky Workflows
on:
workflow_run:
workflows: [Backend, Driver Tests, E2E Tests, Frontend]
workflows: [Backend, Driver Tests, E2E Tests, Frontend, Backend-Cloverage]
types: [completed]
branches: [master, 'release-x.**', 'backport-**']
@@ -10,7 +10,7 @@ jobs:
rerun-on-failure:
name: 'Re-run ''${{ github.event.workflow_run.name }}'' workflow'
runs-on: ubuntu-22.04
# Do not re-run scheduled workflow runs. That's only Replay.io E2E tests for now.
# Do not re-run scheduled workflow runs
if: github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event != 'schedule'
env:
BRANCH_NAME: ${{ github.event.workflow_run.head_branch }}

View File

@@ -0,0 +1,38 @@
name: Security Issue Slack Notification
on:
issues:
types:
- labeled
jobs:
on-issue-opened:
runs-on: ubuntu-22.04
timeout-minutes: 5
if: github.event.label.name == 'SECURITY'
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": "${{ steps.vars.outputs.issue_title }}\n${{ github.event.issue.html_url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SECURITY_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

257
.github/workflows/tag-for-release.yml vendored Normal file
View File

@@ -0,0 +1,257 @@
name: Release 1a - Tag Release Artifact
run-name: Tag ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
type: string
required: true
commit:
description: 'A full-length commit SHA-1 hash'
required: true
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
start-message:
runs-on: ubuntu-22.04
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 build start 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 { sendPreReleaseMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPreReleaseMessage({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
releaseSha: '${{ inputs.commit }}',
userName: '${{ github.actor }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
check-version:
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
ee: ${{ fromJson(steps.canonical_version.outputs.result).ee }}
oss: ${{ fromJson(steps.canonical_version.outputs.result).oss }}
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! It must start with either 'v0.' or 'v1.'.");
}
const versions = {
ee: getCanonicalVersion(version, 'ee'),
oss: getCanonicalVersion(version, 'oss'),
};
const ossReleased = 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) {
throw new Error("This version has already been released!", version);
}
return versions;
check-commit:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Check out the code to verify the release branch
uses: actions/checkout@v4
with:
fetch-depth: 0 # IMPORTANT! to get all the branches
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get Release Branch
uses: actions/github-script@v7
id: release_branch
with:
result_encoding: string
script: | # js
const { getReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const releaseBranch = getReleaseBranch(version);
return releaseBranch;
- name: Ensure that the specified commit exists in the ${{ steps.release_branch.outputs.result }} release branch
run: |
RELEASE_BRANCH=${{ steps.release_branch.outputs.result }}
git checkout $RELEASE_BRANCH
git branch --contains ${{ inputs.commit }} | grep -q $RELEASE_BRANCH \
&& echo "Commit found in correct release branch" \
|| (echo "Commit not found in correct release branch" && exit 1)
tag-uberjar-for-release:
needs: [check-version, check-commit]
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
edition: [oss, ee]
env:
INTERACTIVE: false
steps:
- name: Get correct version number
run: | # bash
if [ '${{matrix.edition}}' == 'ee' ]; then
version='${{ needs.check-version.outputs.ee }}'
else
version='${{ needs.check-version.outputs.oss }}'
fi
echo "VERSION=$version" >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17 # 11 throws an error on jar uf
- name: Retrieve test build uberjar artifact for ${{ matrix.edition }}
id: find_release_artifact
uses: actions/github-script@v7
with:
result-encoding: string
script: | # js
const fs = require('fs');
const artifacts = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
name: `metabase-${{ matrix.edition }}-${{ inputs.commit }}-uberjar`,
per_page: 1,
});
if (!artifacts.data?.artifacts?.[0]?.id) {
console.warn(`No existing artifacts found for ${{ inputs.commit }}, need to build jar`);
if ("${{matrix.edition}}" === 'oss') {
// only trigger the build job on OSS, otherwise we'll get double builds
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'build-for-release.yml',
ref: 'refs/heads/master',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
}
});
}
throw new Error('aborting in favor of build script');
}
const artifact_id = artifacts.data.artifacts[0].id;
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact_id,
archive_format: 'zip',
});
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/mb.zip`, Buffer.from(download.data));
- name: Unzip Metabase artifact containing an uberjar
run: |
unzip mb.zip
mv target/uberjar/metabase.jar metabase.jar
- name: Update version.properties in jar
run: | # sh
jar xf metabase.jar version.properties
echo "Old version.properties:"
cat version.properties
sed -i "s/^tag=.*/tag=$VERSION/" version.properties
echo "\n\nNew version.properties:"
cat version.properties
echo "\n\nUpdating metabase.jar with new version.properties"
jar uf metabase.jar version.properties
- name: Store commit's SHA-1 hash
run: echo ${{ inputs.commit }} > COMMIT-ID
shell: bash
- name: Calculate SHA256 checksum
run: sha256sum ./metabase.jar > SHA256.sum
shell: bash
- name: Upload JARs as artifact
uses: actions/upload-artifact@v4
with:
name: metabase-release-${{ matrix.edition }}-${{ inputs.commit }}-uberjar
path: |
./metabase.jar
./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 }}',
}
});

134
.github/workflows/translation-update.yml vendored Normal file
View File

@@ -0,0 +1,134 @@
name: Update Translations
run-name: Update Translations for v${{ inputs.version }} - ${{ inputs.step }}
on:
workflow_dispatch:
inputs:
step:
type: choice
description: Upload untranslated strings | Download translated strings
options:
- upload
- download
required: true
version:
type: string
description: "The version number for which to update translations (e.g. 43, 58.7)"
required: true
permissions:
contents: write
pull-requests: write
jobs:
upload-translations:
name: Upload Translations
if: ${{ inputs.step == 'upload' }}
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
POEDITOR_API_TOKEN: ${{ secrets.POEDITOR_API_TOKEN }}
POEDITOR_PROJECT_ID: 200535
VERSION: ${{ inputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: manage-translations
- name: install gettext
run: sudo apt-get install gettext
# TODO: check for untranslated strings
- name: Upload strings to be translated
run: | # sh
./bin/i18n/update-translation-template
./bin/i18n/export-pot-to-poeditor
echo "Strings uploaded to POEditor"
- name: Commit changes
env:
GH_TOKEN: ${{ github.token }}
run: | # sh
git config user.name github-actions
git config user.email github-actions@github.com
BRANCH_NAME="update-translations-v$VERSION"
git checkout -b $BRANCH_NAME
git add locales/
git commit -m "Add new strings for v$VERSION"
git push -u origin $BRANCH_NAME
gh pr create \
--reviewer "${GITHUB_ACTOR}" \
--assignee "${GITHUB_ACTOR}" \
--title "Update Translations for v$VERSION" \
--body "Update translations from POEditor for v$VERSION
See [translation update documentation](https://www.notion.so/metabase/Process-for-updating-translations-421db70048fe400da1153ad0b61102f4)
## To Do
- [x] Upload new strings to POEditor
- [ ] Message contributors on POEditor (manual)
- [ ] Copy source strings to english language (manual)
- [ ] Download translations from POEditor (github action)
- [ ] Merge this PR and backport to the release branch (manual)
" \
--label "backport" \
--label "Customization/i18n"
# TODO: notify contributors
# TODO: copy source strings to english language
download-translations:
name: Download Translations
if: ${{ inputs.step == 'download' }}
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
POEDITOR_API_TOKEN: ${{ secrets.POEDITOR_API_TOKEN }}
POEDITOR_PROJECT_ID: 200535
VERSION: ${{ inputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# assumes there's already a branch with that name from the upload step
ref: update-translations-v${{inputs.VERSION}}
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: manage-translations
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Automatically translate untranslated strings
uses: actions/github-script@v7
with:
script: | # js
const { autoTranslateSupportedLanguages } = require('${{ github.workspace }}/release/dist/index.cjs');
await autoTranslateSupportedLanguages();
- name: Download translated strings
run: | # sh
cd ${{ github.workspace }}
./bin/i18n/import-po-from-poeditor
./bin/i18n/build-translation-resources
- name: Commit changes
run: | # sh
git config user.name github-actions
git config user.email github-actions@github.com
BRANCH_NAME="update-translations-v$VERSION"
git add locales/
git commit -m "Update translations"
git push -u origin $BRANCH_NAME

Some files were not shown because too many files have changed in this diff Show More