Compare commits

...

680 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
4845 changed files with 314185 additions and 153194 deletions

View File

@@ -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)
@@ -151,7 +280,8 @@
{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.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
@@ -204,7 +334,8 @@
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 #{metabase.query-analysis
metabase.query-analysis.failure-map}
metabase.related #{metabase.related}
metabase.sample-data #{metabase.sample-data}
metabase.search #{metabase.search}
@@ -264,6 +395,7 @@
metabase.api :any
metabase.async :any
metabase.audit :any
metabase.auth-provider #{metabase.util}
metabase.bootstrap #{}
metabase.cmd :any
metabase.compatibility :any
@@ -317,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
@@ -351,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
@@ -368,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
@@ -477,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
@@ -607,110 +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.test/with-grouper-batches! clojure.core/fn
metabase.upload-test/with-upload-table! clojure.core/let
metabase.util.files/with-open-path-to-resource clojure.core/let
metabase.util.malli.defn/defn schema.core/defn
metabase.util.malli.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
@@ -718,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
@@ -752,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*
@@ -763,66 +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-enterprise.query-field-validation.api-test/with-test-setup macros.metabase-enterprise.query-field-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-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}}}
@@ -853,10 +991,18 @@
;;
{:pattern "metabase(?:(?:(?:-enterprise\\.sandbox)?\\.query-processor\\.)|(?:\\.driver\\.)).*(?<!-test)$"
:name qp-and-driver-source-namespaces}
;;
;; driver namespaces
;;
{:pattern "metabase\\.driver.*$"
:name driver-namespaces}]
: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
@@ -934,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,7 +1,7 @@
(ns macros.metabase.api.collection-test
(:require [macros.common]))
(defmacro with-collection-hierarchy [bindings & body]
(defmacro with-collection-hierarchy! [bindings & body]
`(let [~(macros.common/ignore-unused 'a) nil
~(macros.common/ignore-unused 'b) nil
~(macros.common/ignore-unused 'c) nil
@@ -12,6 +12,6 @@
~bindings
~@body))
(defmacro with-some-children-of-collection [collection-or-id-or-nil & body]
(defmacro with-some-children-of-collection! [collection-or-id-or-nil & body]
`(let [~(macros.common/ignore-unused '&ids) ~collection-or-id-or-nil]
~@body))

View File

@@ -1,11 +1,11 @@
(ns macros.metabase.api.embed-test)
(defmacro with-embedding-enabled-and-temp-card-referencing
(defmacro with-embedding-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-embedding-enabled-and-temp-dashcard-referencing
(defmacro with-embedding-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil

View File

@@ -1,11 +1,11 @@
(ns macros.metabase.api.public-test)
(defmacro with-sharing-enabled-and-temp-card-referencing
(defmacro with-sharing-enabled-and-temp-card-referencing!
[table-kw field-kw [card-binding] & body]
`(let [~card-binding [~table-kw ~field-kw]]
~@body))
(defmacro with-sharing-enabled-and-temp-dashcard-referencing
(defmacro with-sharing-enabled-and-temp-dashcard-referencing!
[table-kw field-kw [dash-binding card-binding dashcard-binding] & body]
`(let [~dash-binding [~table-kw ~field-kw]
~(or card-binding '_) nil

View File

@@ -1,4 +1,4 @@
(ns macros.metabase.models.query-field-test
(ns macros.metabase.models.query-analysis-test
(:require [macros.common]))
(defmacro with-test-setup [& 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

@@ -1,11 +0,0 @@
(ns macros.metabase-enterprise.query-field-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 'qf-1) 10
~(macros.common/ignore-unused 'qf-2) 20]
~@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

@@ -1,21 +1,11 @@
(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)))
[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.
@@ -151,7 +141,7 @@
(str/ends-with? s "!"))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node}]
[{[defn-or-defmacro form-name] :children, :as node} config]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
@@ -159,11 +149,12 @@
(doseq [child (:children form)]
(walk f child)))]
(walk (fn [form]
(when-let [qualified-symbol (node->qualified-symbol form)]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(when (and (not (contains? symbols-allowed-in-fns-not-ending-in-an-exclamation-point qualified-symbol))
(end-with-exclamation? qualified-symbol))
(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`."
: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))
@@ -174,10 +165,10 @@
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang]}]
[{:keys [node cljc lang config]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node))
(non-thread-safe-form-should-end-with-exclamation* node config))
{:node node})
(comment

View File

@@ -4,114 +4,7 @@
[clojure.string :as str]
[hooks.common]))
(def ^:private disallowed-parallel-forms
"Things you should not be allowed to use inside parallel tests. Besides these, anything ending in `!` not whitelisted
in [[allowed-parallel-forms]] is not allowed."
'#{clojure.core/alter-var-root
clojure.core/with-redefs
clojure.core/with-redefs-fn
metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.sandbox.test-util/with-gtaps-for-user!
metabase-enterprise.sandbox.test-util/with-user-attributes
metabase-enterprise.test/with-gtaps!
metabase-enterprise.test/with-gtaps-for-user!
metabase-enterprise.test/with-user-attributes
metabase.actions.test-util/with-actions
metabase.actions.test-util/with-actions-disabled
metabase.actions.test-util/with-actions-enabled
metabase.actions.test-util/with-actions-test-data
metabase.actions.test-util/with-actions-test-data-and-actions-enabled
metabase.actions.test-util/with-actions-test-data-tables
metabase.analytics.snowplow-test/with-fake-snowplow-collector
metabase.email-test/with-expected-messages
metabase.email-test/with-fake-inbox
metabase.test.data.users/with-group
metabase.test.data.users/with-group-for-user
metabase.test.persistence/with-persistence-enabled
metabase.test.util.log/with-log-level
metabase.test.util.log/with-log-messages-for-level
metabase.test.util.misc/with-single-admin-user
metabase.test.util/with-all-users-permission
metabase.test.util/with-discarded-collections-perms-changes
metabase.test.util/with-env-keys-renamed-by
metabase.test.util/with-locale
metabase.test.util/with-non-admin-groups-no-root-collection-for-namespace-perms
metabase.test.util/with-non-admin-groups-no-root-collection-perms
metabase.test.util/with-temp-env-var-value
metabase.test.util/with-temp-vals-in-db
metabase.test.util/with-temporary-raw-setting-values
metabase.test.util/with-temporary-setting-values
metabase.test.util/with-user-in-groups
metabase.test/with-actions
metabase.test/with-actions-disabled
metabase.test/with-actions-enabled
metabase.test/with-actions-test-data
metabase.test/with-actions-test-data-and-actions-enabled
metabase.test/with-actions-test-data-tables
metabase.test/with-all-users-permission
metabase.test/with-discarded-collections-perms-changes
metabase.test/with-env-keys-renamed-by
metabase.test/with-expected-messages
metabase.test/with-fake-inbox
metabase.test/with-group
metabase.test/with-group-for-user
metabase.test/with-locale
metabase.test/with-log-level
metabase.test/with-log-messages-for-level
metabase.test/with-non-admin-groups-no-root-collection-for-namespace-perms
metabase.test/with-non-admin-groups-no-root-collection-perms
metabase.test/with-persistence-enabled
metabase.test/with-single-admin-user
metabase.test/with-temp-env-var-value
metabase.test/with-temp-vals-in-db
metabase.test/with-temporary-raw-setting-values
metabase.test/with-temporary-setting-values
metabase.test/with-user-in-groups})
;;; TODO -- we should disallow `metabase.test/user-http-request` with any method other than `:get`
(def ^:private allowed-parallel-forms
"These fns are destructive, but are probably fine inside ^:parallel tests because it usually means you're doing
something to an atom or something like that."
'#{clojure.core/assoc!
clojure.core/compare-and-set!
clojure.core/conj!
clojure.core/disj!
clojure.core/dissoc!
clojure.core/persistent!
clojure.core/pop!
clojure.core/reset!
clojure.core/reset-vals!
clojure.core/run!
clojure.core/swap!
clojure.core/swap-vals!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.core.async/<!
clojure.core.async/<!!
clojure.core.async/>!
clojure.core.async/>!!
clojure.core.async/alt!
clojure.core.async/alt!!
clojure.core.async/alts!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/ioc-alts!
clojure.core.async/offer!
clojure.core.async/onto-chan!
clojure.core.async/onto-chan!!
clojure.core.async/poll!
clojure.core.async/put!
clojure.core.async/take!
clojure.core.async/to-chan!
clojure.core.async/to-chan!!
metabase.driver.sql-jdbc.execute/execute-prepared-statement!
metabase.pulse/send-pulse!
metabase.query-processor.store/store-database!
next.jdbc/execute!})
(defn- warn-about-disallowed-parallel-forms [form]
(defn- warn-about-disallowed-parallel-forms [form config]
(letfn [(error! [form message]
(hooks/reg-finding! (assoc (meta form)
:message message
@@ -119,12 +12,12 @@
(f [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(cond
(disallowed-parallel-forms qualified-symbol)
(error! form (format "%s is not allowed inside a ^:parallel test or test fixture" qualified-symbol))
(contains? (:parallel/unsafe config) qualified-symbol)
(error! form (format "%s is not allowed inside a ^:parallel test or test fixture [:metabase/validate-deftest]" qualified-symbol))
(and (not (allowed-parallel-forms qualified-symbol))
(and (not (contains? (:parallel/safe config) qualified-symbol))
(str/ends-with? (name qualified-symbol) "!"))
(error! form (format "destructive functions like %s are not allowed inside a ^:parallel test or test fixture. If this should be allowed, add it to the whitelist in .clj-kondo/hooks/clojure/test.clj"
(error! form (format "destructive functions like %s are not allowed inside a ^:parallel test or test fixture. If this should be allowed, add it to the whitelist in the Kondo config file [:metabase/validate-deftest]"
qualified-symbol)))))
(walk [form]
(f form)
@@ -135,7 +28,7 @@
(defn- deftest-check-parallel
"1. Check if test is marked ^:parallel / ^:synchronized correctly
2. Make sure disallowed forms are not used in ^:parallel tests"
[{[_ test-name & body] :children, :as _node}]
[{[_ test-name & body] :children, :as _node} config]
(let [test-metadata (:meta test-name)
metadata-sexprs (map hooks/sexpr test-metadata)
combined-metadata (transduce
@@ -152,9 +45,9 @@
(hooks/reg-finding! (assoc (meta test-name)
:message "Test should not be marked both ^:parallel and ^:synchronized"
:type :metabase/validate-deftest)))
;; only when the custom `:metabase/deftest-not-marked-parallel` is enabled: complain if tests are not explicitly
;; marked `^:parallel` or `^:synchronized`. This is mostly to encourage people to mark everything `^:parallel` in
;; places like `metabase.lib` tests unless there is a really good reason not to.
;; only when the custom `:metabase/deftest-not-marked-parallel-or-synchronized` is enabled: complain if tests are
;; not explicitly marked `^:parallel` or `^:synchronized`. This is mostly to encourage people to mark everything
;; `^:parallel` in places like `metabase.lib` tests unless there is a really good reason not to.
(when-not (or parallel? synchronized?)
(hooks/reg-finding!
(assoc (meta test-name)
@@ -162,30 +55,65 @@
:type :metabase/deftest-not-marked-parallel-or-synchronized)))
(when parallel?
(doseq [form body]
(warn-about-disallowed-parallel-forms form)))))
(def ^:private number-of-lines-for-a-test-to-be-considered-horrifically-long
200)
(warn-about-disallowed-parallel-forms form config)))))
(defn- deftest-check-not-horrifically-long
[node]
[node {:keys [max-length], :as _config}]
(let [{:keys [row end-row]} (meta node)]
(when (and row end-row)
(let [num-lines (- end-row row)]
(when (>= num-lines number-of-lines-for-a-test-to-be-considered-horrifically-long)
(when (and max-length
(>= num-lines max-length))
(hooks/reg-finding! (assoc (meta node)
:message (str (format "This test is horrifically long, it's %d lines! 😱 " num-lines)
"Do you really want to try to debug it if it fails? 💀 "
"Split it up into smaller tests! 🥰")
:type :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests)))))))
(defn deftest [{:keys [node cljc lang]}]
(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))
(deftest-check-not-horrifically-long node)
(deftest-check-parallel node (get-in config [:linters :metabase/validate-deftest])))
(deftest-check-not-horrifically-long node (get-in config [:linters :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]))
(deftest-check-no-driver-keywords node (get-in config [:linters :metabase/disallow-hardcoded-driver-names-in-tests]))
{:node node})
;;; this is a hacky way to determine whether these namespaces are required in the `ns` form or not... basically `:ns`
@@ -222,20 +150,11 @@
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)
(defn use-fixtures [{:keys [node config]}]
(warn-about-disallowed-parallel-forms node config)
{:node node})

View File

@@ -288,8 +288,8 @@
(-> (hooks/vector-node
[(hooks/vector-node (map :model binding-infos))
(-> (hooks/list-node (list* (hooks/token-node `let)
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(with-meta (meta body)))])
(with-meta (meta body)))))
@@ -364,11 +364,11 @@
where the first arg should be linted and appear to be used."
[{{[_ arg & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
{:node node*}))
(defn node->qualified-symbol [node]
@@ -407,3 +407,17 @@
;; 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

@@ -1,7 +1,8 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]))
[clojure.string :as str]
[hooks.common]))
(defn route-fn-name
"route fn hook"
@@ -15,16 +16,17 @@
[arg]
(letfn [(update-defendpoint [node]
(let [[_defendpoint method route & body] (:children node)]
(api/list-node
(list
(api/token-node 'do)
(api/token-node (symbol "compojure.core" (str (api/sexpr method))))
(-> (api/list-node
(list*
(api/token-node 'clojure.core/defn)
(api/token-node (route-fn-name (api/sexpr method) (api/sexpr route)))
body))
(with-meta (meta node)))))))]
(-> (api/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

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

@@ -181,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))
@@ -242,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,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 hooks.metabase.util.log.capture-test
(:require
[clj-kondo.hooks-api :as api]
[clojure.test :refer :all]
[hooks.metabase.util.log.capture]))
(deftest ^:parallel with-log-messages-for-level-test
(is (= '(clojure.core/let [messages-1 (clojure.core/fn [])
messages-2 (clojure.core/fn [])]
(concat (messages-1)
(messages-2)))
(-> (hooks.metabase.util.log.capture/with-log-messages-for-level
{:node (-> '(with-log-messages-for-level [messages-1 [my.namespace :debug]
messages-2 :info]
(concat (messages-1) (messages-2)))
pr-str
api/parse-string)})
:node
api/sexpr))))

View File

@@ -1,31 +1,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",
],
},
],
},
},
{

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

@@ -35,6 +35,7 @@ runs:
["dashboard-cards", {} ],
["dashboard-filters", {} ],
["embedding", {} ],
["embedding-sdk", { context: "embedding-sdk" } ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],

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@1.5.1 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

@@ -11,6 +11,7 @@ runs:
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: |
@@ -23,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', '**/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

View File

@@ -35,7 +35,7 @@ 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
@@ -61,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
@@ -79,6 +80,7 @@ backend_specs: &backend_specs
- "modules/drivers/*/test/**"
- "test_config/**"
- "dev/**"
- "test_resources/**"
backend_all: &backend_all
- *default

View File

@@ -0,0 +1,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;
}
}
}

27
.github/team.json vendored
View File

@@ -1,15 +1,26 @@
{
"teams": [
{
"name": "Querying Components",
"label": ".Team/QueryingComponents",
"name": "Querying",
"label": ".Team/Querying",
"projectUrl": "https://github.com/orgs/metabase/projects/97/views/1",
"members": [
"ranquild",
"kamilmielnik",
"nemanjaglumac",
"romeovs"
"romeovs",
"bshepherdson",
"metamben",
"lbrdnk",
"appleby",
"uladzimirdev"
]
},
{
"name": "Drivers",
"label": ".Team/Drivers",
"members": ["snoe"]
},
{
"name": "Embedding",
"label": ".Team/Embedding",
@@ -23,17 +34,10 @@
"members": [
"tsmacdonald",
"qnkhuat",
"calherries",
"piranha",
"crisptrutski"
]
},
{
"name": "Query Processor",
"label": ".Team/QueryProcessor",
"projectUrl": "https://github.com/orgs/metabase/projects/83/views/8",
"members": ["camsaul", "snoe", "bshepherdson", "metamben", "lbrdnk"]
},
{
"name": "Admin Webapp",
"label": ".Team/AdminWebapp",
@@ -53,7 +57,6 @@
"members": [
"alxnddr",
"EmmadUsmani",
"JesseSDevaney",
"kulyk",
"adam-james-v"
]
@@ -62,7 +65,7 @@
"name": "DevEx",
"label": ".Team/DevEx",
"members": [
"uladzimirdev"
"camsaul"
]
}
]

View File

@@ -12,9 +12,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
env:
CLJ_KONDO_VERSION: "2023.09.07"
jobs:
files-changed:
name: Check which files changed
@@ -70,23 +67,12 @@ jobs:
(needs.files-changed.outputs.backend_all == 'true' || needs.static-viz-files-changed.outputs.static_viz == 'true')
runs-on: ubuntu-22.04
timeout-minutes: 10
env:
DOWNLOAD_URL: https://github.com/clj-kondo/clj-kondo/releases/download
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'kondo'
- name: Install clj-kondo
run: |
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
curl -OL ${DOWNLOAD_URL}/v${CLJ_KONDO_VERSION}/clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256
cat clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip.sha256 >> SHA256sum.txt
echo " clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip" >> SHA256sum.txt
sha256sum -c SHA256sum.txt
unzip -d /usr/local/bin clj-kondo-${CLJ_KONDO_VERSION}-linux-static-amd64.zip
- run: clj-kondo --version
- name: Run clj-kondo
run: ./bin/kondo.sh
@@ -268,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

@@ -35,23 +35,8 @@ jobs:
- name: Remind PR authors to use conventional commit in the title
if: ${{ steps.is-conventional-commit.outputs.result != 'true' }}
run: |
comment='@${{ github.event.pull_request.user.login }} 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`'
gh pr comment -b "$comment" --edit-last || gh pr comment -b "$comment"
env:
GH_TOKEN: ${{ github.token }}
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

@@ -71,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 }}
@@ -103,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

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

@@ -50,25 +50,25 @@ jobs:
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');
- 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);
const version = getVersionFromReleaseBranch('${{ github.ref }}');
const requirements = getBuildRequirements(version);
return {
java_version: requirements.java,
node_version: requirements.node,
};
return {
java_version: requirements.java,
node_version: requirements.node,
};
build:
needs: [files-changed, e2e-matrix-builder, get-build-requirements]
@@ -85,17 +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 }}'
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
java-version: '${{ needs.get-build-requirements.outputs.java_version || 11 }}'
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
@@ -124,12 +126,8 @@ jobs:
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
CYPRESS_REPLAYIO_ENABLE_UPLOAD: 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) }}
@@ -147,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
@@ -168,6 +167,7 @@ jobs:
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
@@ -179,7 +179,7 @@ jobs:
yarn run test-cypress-run \
--env grepTags=@OSS,grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run slow and resource-intensive Cypress tests
if: matrix.name == 'slow' && github.event_name != 'schedule'
@@ -187,7 +187,7 @@ jobs:
yarn run test-cypress-run \
--env grepTags="@slow",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run Flaky Cypress tests
if: matrix.name == 'flaky' && github.event_name != 'schedule'
@@ -195,7 +195,7 @@ jobs:
yarn run test-cypress-run \
--env grepTags="@flaky --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run EE Cypress tests on ${{ matrix.name }}
if: matrix.context == 'folder' && github.event_name != 'schedule'
@@ -203,7 +203,7 @@ 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'
@@ -211,10 +211,25 @@ jobs:
yarn run test-cypress-run \
--env grepTags="@mongo --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
--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()
@@ -251,3 +266,11 @@ jobs:
steps:
- run: |
echo "Didn't run due to conditional filtering"
pr-env:
needs: [build]
if: |
!cancelled() &&
contains(github.event.pull_request.labels.*.name, 'PR-Env')
uses: ./.github/workflows/pr-env.yml
secrets: inherit

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

@@ -27,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 &

View File

@@ -52,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 &

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

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:
@@ -119,7 +123,6 @@ jobs:
DISPLAY: ""
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_REPLAYIO_ENABLED: 1
# disabled because of out of memory issues
# probably related to https://github.com/cypress-io/cypress/issues/27415
CYPRESS_NO_COMMAND_LOG: 1
@@ -145,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
@@ -162,7 +166,7 @@ jobs:
yarn test-cypress-run \
--env grepTags="@smoke",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
@@ -285,6 +289,30 @@ jobs:
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
trigger-auto-publish:
if: ${{ inputs.auto }}
needs: [run-sanity-check, check-uberjar-health, verify-docker-pull]
permissions:
actions: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: trigger auto publish
uses: actions/github-script@v7
with:
script: | # js
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
auto: true,
}
});
tests-complete-message:
if: always()
runs-on: ubuntu-22.04

View File

@@ -1,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

@@ -89,6 +89,7 @@ jobs:
./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 }}

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

@@ -14,6 +14,7 @@ on:
jobs:
check-milestone:
permissions: write-all
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
@@ -21,12 +22,12 @@ jobs:
with:
sparse-checkout: release
- name: Prepare build scripts
run: yarn --cwd ${{ github.workspace }}/release build
run: yarn --cwd release --frozen-lockfile && yarn --cwd release build
- uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
with:
script: | # js
const {

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

@@ -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:
@@ -256,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: |
@@ -402,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
@@ -510,7 +514,7 @@ jobs:
$GITHUB_WORKSPACE/release/reorder-tags.sh ${{ needs.check-version.outputs.ee }} ${{ inputs.commit }}
trigger-docs-update:
if: ${{ inputs.skip-release-notes != true }}
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
needs:
- push-tags
- check-version
@@ -537,6 +541,8 @@ jobs:
}
});
- uses: actions/checkout@v4
with:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: update releases.md
uses: actions/github-script@v7
with:
@@ -580,6 +586,7 @@ jobs:
--assignee "jeff-bruemmer"
trigger-cloud-issues:
if: ${{ !inputs.auto }}
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 10
@@ -618,11 +625,12 @@ jobs:
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
@@ -674,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
@@ -733,6 +741,7 @@ jobs:
--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
@@ -760,7 +769,37 @@ jobs:
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

@@ -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

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:
start-message:
@@ -248,5 +252,6 @@ jobs:
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
auto: '${{ inputs.auto }}',
}
});

72
.github/workflows/tusk-sanity-check.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
# This allows Tusk to manually run workflows to check lint/build/tests before creating a PR.
# If you have any questions, please reach out to support@usetusk.ai.
name: Tusk Sanity Check
on:
workflow_dispatch:
inputs:
taskId:
description: "Tusk Task ID"
required: true
runType:
description: "Tusk Run Type"
required: true
runId:
description: "Tusk Run ID"
required: true
jobs:
sanity_check:
runs-on: ubuntu-latest
steps:
- name: Log inputs
run: |
echo "Tusk Task ID: ${{ github.event.inputs.taskId }}"
echo "Tusk Run Type: ${{ github.event.inputs.runType }}"
echo "Tusk Run ID: ${{ github.event.inputs.runId }}"
echo "Current Branch: ${{ github.ref }}"
echo "Repository default branch: ${{ github.event.repository.default_branch }}"
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Check which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
# Similar to .github/workflows/frontend.yml
- name: Prepare front-end environment
if: steps.changes.outputs.frontend_all == 'true'
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- run: yarn build-pure:cljs
name: Compile CLJS
- name: Run lint-staged
if: steps.changes.outputs.frontend_all == 'true'
run: |
BASE_COMMIT=$(git merge-base origin/${{ github.event.repository.default_branch }} HEAD)
npx lint-staged --shell --no-stash --diff="$BASE_COMMIT...HEAD"
# You must include this step after running all auto-fixing steps
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "fix(${{ github.run_id }}): auto linting" # The commit message MUST start with "fix(${{ github.run_id }}):"
commit_options: "--no-verify" # No verify because we already ran it above
skip_fetch: true
skip_checkout: true
status_options: "--untracked-files=no"
add_options: "--update"
- name: Check types
if: steps.changes.outputs.frontend_all == 'true'
run: yarn type-check-pure

4
.gitignore vendored
View File

@@ -77,6 +77,7 @@ target/checksum.txt
xcshareddata
xcuserdata
dev/src/dev/nocommit/
dev/serialization_deltas/
*~
**/cypress_sample_database.json
**/cypress_sample_instance_data.json
@@ -112,3 +113,6 @@ modules/drivers/*/.lsp/*
# airgap
/resources/airgap/
# swc
.swc/

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Some files were not shown because too many files have changed in this diff Show More