Compare commits

...

2494 Commits

Author SHA1 Message Date
Sloan Sparger
4266144274 hackin', yah know? 2024-08-30 10:26:04 -05:00
Braden Shepherdson
bef93ce0b4 [QP, debug] Fix preprocessing diffs in Portal (#47154)
The Portal diff view wants `[before after]` pairs of the original data,
not the three-part output of `clojure.data/diff`. This fixes the
`qp.debug/debug>` output from the preprocessing middleware to emit
correct diffs.

Also, since the diffs are not useful when the query is converted between
legacy and pMBQL, this also attaches the *converted* input query to the
output query's Clojure metadata, and this converted value is used as the
basis for the diff.
2024-08-30 14:51:23 +00:00
Aleksandr Lesnenko
730a2657b4 fix trend lines scaling (#47361)
* fix trend lines scaling
2024-08-30 14:50:45 +00:00
Chris Truter
d3aba662ce Trigger BE tests when test_resources are updated (#47455) 2024-08-30 17:39:31 +03:00
metamben
0ef7e4bcfd Check joins in lib.metadata/editable? (#47421) 2024-08-30 17:01:52 +03:00
Chris Truter
550f9c36d7 Add serialization baseline for Channel (#47451) 2024-08-30 20:32:23 +07:00
Chris Truter
cf5c932f21 Update serialization fixtures to track new database field (#47446) 2024-08-30 13:21:08 +03:00
Oisin Coveney
976de66801 Remove ButtonBar (#47212) 2024-08-30 13:12:09 +03:00
Tim Macdonald
7d34ca123b Use published version of Hawk (#47440) 2024-08-30 09:31:04 +00:00
Chris Truter
312a46bd43 Add test against serialization YAML format changing (#47349) 2024-08-30 11:57:14 +03:00
Oleksandr Yakushev
1e78f8bd2d perf: Perform string->datetime conversion once during timeseries insights (#47424) 2024-08-30 10:09:22 +03:00
Ngoc Khuat
d897f2016f [notification] webhook for alert (#45201)
* [notification] New method: `channel/can-connect?` (#44955)

* [notification] Channel APIs (#45207)

* [notification] namespaced channel type (#45527)

* [Notification] Render alert for http channel (#45545)

* [notification] Add channel description (#45840)

* [notification] update API to enable http channels for alert (#45839)

* [Notification] Remove channel details for users without write perms (#46034)

* [Notification] Serdes channel (#46031)

* [Notification] Update http details schema (#45960)

* [Notification] Deactivate channels will delete PulseChannel (#46115)

* [Notification] audit log for channel create and update (#46113)

* [Notification] Disallow undefined key for http channel details (#46712)

* [Notification] Handle channel name conflicts (#46818)

* Webhooks Admin Section (#46194)

* [notification] Fix test pulse endpoint does not work properly for http channels (#46474) (#47050)

* [Notification] Fix unable to update multiple channels per type (#47111)

* [Notification] Record Task History when pulse sends channel message (#46218)

* Enabling Webhook Alerts (#47022)

* [Notification] fix cyclic deps (#47379)

* [notification] channel serdes spec (#47386)

Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
2024-08-30 04:54:01 +00:00
Aleksandr Lesnenko
0ccc471c7b fix formatting null values adds prefix and suffix (#47435) 2024-08-29 23:21:35 -04:00
bryan
05c2fb221d Realign migration ids (#47367)
* move migration in release to match master

* add column if not exists
2024-08-29 22:46:06 +00:00
bryan
b0dbb38e74 Static embed dashboard and question endpoints (#47270)
* entity id translation + tests

* add api level test

* simplify definition of eid-table->model + add test

* update tests to take keywords

* improve comment

* generate the eid-table->model map

* delete now-obsolete test

* make it work in oss

* put the resulting response into a key, so we can add more information later

* formatting

* use model names without the model/ prefix as keys

* Creates list of `api/model->db-model`

- update keys for util/entity_id request
- update shape of util/entity_id response
- add test for not-found eids

* formatting

* Respond to code review feedback

* entity-ids work on /embed/{card,dashboard}* routes

* make entity id translation work for all tokens

* Merge branch 'static-embed-dashboard-and-question-endpoints' of github.com:metabase/metabase into static-embed-dashboard-and-question-endpoints

* massage schema. add tons of tests

* decode more eids

* test alignment

* don't require ns inside of itself :think:

* make the test functions to create tokens better

* bring back `dashboard-url`

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-29 16:09:11 -06:00
github-automation-metabase
b644dcca22 Add v0.50.23 to the list of releases (#47422)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-29 17:15:21 -04:00
Nick Fitzpatrick
b7349ec5f6 Query validator FE (#47098)
* Query Validator FE

* collection path, unit tests

* wrapping feature with token flag

* updating util function, adding row type

* updating session_test.clj

* type adjustment

* fixing other table sorting

* Empty state, clean up utils

* unit test adjustment

* e2e adjustment
2024-08-29 16:20:54 -03:00
Ryan Laurie
2b25fcab13 Milestone Check Perms Fix (for real this time) 😅 (#47401)
* another attempt at perms fix

* try again

* try manual graphql auth

* try with global env

* Try setting defaults in graphql

* try some more things

* use my own graphql instance

* one more test

* remove test code

* remove rogue curly brace
2024-08-29 13:08:26 -06:00
Dennis Schridde
592360c9fa Hide attached DWH database details (#47247)
== Goal ==

Hide attached DWH database details from anyone incl. admins:
* Do not show them in the UI
* Do not permit to change them
* Do not serialize them

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

== Implementation ==

The Metabase backend already contains provisions in the implementation
of `metabase.models.interface/to-json` for `:model/Database` to hide the
`details` of the database in HTTP responses, if the user lacks write
permission on the database.  We utilize this by adding an
`is_attached_dwh` column to the `database` table and rejecting
`metabase.models.interface/can-write?` when this flag is enabled.  In
the "admin" UI, we show a replacement text instead of the edit form when
the flag is set.  (It might be correct to show this whenever `details`
is absent.  See below for possible follow-up work.)

However, several sections of the frontend code expected the `details`
field to always be present.  In order to make `details` optional, as the
backend seems to handle it, we fix the respective code to treat this
case in the way that appears appropriate in the context.

Database details are already generally excluded from H2 dump snapshots
(see `metabase.cmd.copy/*copy-h2-database-details*`), thus nothing
changes there.

== How to test ==

=== New behaviour ===

Setting the `is_attached_dwh` field hides the database details:

1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases.
   - In addition to the fields you would normally set, also set
     `is_attached_dwh: true`.
   - This also works when adding this flag to a database that previously
     did not have this flag set.
2. Start your Metabase instance.
3. Verify the database shows up in the "admin" section
   (`/admin/databases`).
4. Verify that clicking the database to see its details only reveals
   "This database cannot be modified."
5. Verify that responses from the backend do not include a `details`
   field for this database.

=== Original behaviour ===

Behaviour without setting the `is_attached_dwh` field is unchanged:

1. Configure a database as described in https://www.metabase.com/docs/latest/configuring-metabase/config-file#databases.
   - Only set the fields you would normally set.  Do not set
     `is_attached_dwh` (or set it to `false`).
2. Start your Metabase instance.
3. Verify the database shows up in the "admin" section
   (`/admin/databases`).
4. Verify that clicking the database to see its details only reveal the
   regular edit form, showing connection fields like `host`, `user`,
   etc. with the values you configured.

== How this will be rolled out ==

1. Upgrade existing Metabase Cloud instances with data warehouse to a
   Metabase version that supports `is_attached_dwh`.
2. Set `is_attached_dwh` in the database section of the config file for
   Metabase Cloud instances with a data warehouse.

== Possible follow-up work ==

In https://github.com/metabase/metabase/issues/25715, absent
`database.details` was identified as a bug.  Since then, `details` was
made `NOT NULL` in the application database, so this bug can no longer
occur.  However, today backend responses can be missing the `details`
field, if the current user lacks write permission to the database
setting (see above).  Fully re-evaluating the fix to #25715 in this
context is outside the scope of this PR.

Closes: https://github.com/metabase/harbormaster/issues/5051
2024-08-29 19:36:53 +02:00
Cam Saul
7fb88340d4 Update Kondo to 2024.08.01 and add deps.edn aliases to run from the JVM (#47370)
* Add `clojure -M:kondo` and `clojure -M:kondo:kondo/all` and bump version

* Fix Kondo errors

* Fix Kondo+LSP issues with `defendpoint`, `defenterprise`, etc.

* Use replace-deps instead of deps for speed

* Ok apparently maybe we do need to copy configs when we run Kondo on CI

* Oops `./bin/kondo.sh` should not try to use `clj-kondo`

* Remove references to GA driver folders
2024-08-29 10:24:33 -07:00
Noah Moss
f148925047 Migrate Tooltip in FormField to mantine to fix z-index issue (#47314) 2024-08-29 16:57:26 +00:00
Luiz Arakaki
bbe366ea94 Update instance_analytics for 50 major release (#47323)
This updates the instance analytics YAMLs:
- v50.22
- fixes several fk-target-field-id references
2024-08-29 16:51:06 +00:00
John Swanson
b0d9bc53c4 Fixup backported migrations (#47398)
These migrations will be backported to v49.

Three changes:

- update IDs/locations of the migrations to v49 vs v51

- add one preCondition (when adding the foreign key constraint)

- add `onFail: MARK_RAN` to the index preconditions. I forgot this
before, so it blows up when the precondition doesn't hold.
2024-08-29 09:05:58 -07:00
Ryan Laurie
268268b08d Flake Jail Update (#47407) 2024-08-29 15:58:08 +00:00
Emmad Usmani
0139fd780d allow re-ordering and re-naming pie chart slices (#46607)
* allow re-ordering and re-naming pie chart slices

* aggregate rows with same dimension value

* show warning when dimension has unaggregated values

* change colors from sidebar

* implement renaming

* styles for slice name widget

* handle numeric slice keys for binned values relative dates etc

* implement slice disabling

* remove old colors setting

* implement merging new and removing existing rows from query results

* fix formatting bugs

* port settings to static viz

* fix bug with unaggregated data

* address todos

* add loki test

* fix measure column settings widget erroring

* fix settings sidebar crashing

* add e2e tests

* update snapshots

* fix pie_chart.cy.spec.js CI-only flakes

* fix #21504 repro failure

* fix click action value

* use nestedSettings instead of seriesSettings

* fix settings sidebar crashing

* fix row with 0 key not being draggable

* fix flaky test

* filter other slices from sidebar
2024-08-29 15:57:36 +00:00
Ryan Laurie
badd7d0803 Combine filter header buttons (#46984)
* combine filter header buttons

* refined styling

* unit tests

* another import conflict

* omg another one

* remove double border for filter button

* use vars and update imports
2024-08-29 09:45:22 -06:00
Thomas Schmidt
5edd793d5b Minor schema fixes before pushing to Snowcat Cloud (#47403) 2024-08-29 17:38:10 +02:00
Thomas Schmidt
6becc1a78f Add new generic analytics event and bring types to trackSchemaEvent (#46972) 2024-08-29 15:35:53 +00:00
dpsutton
3f8317ad5b Increase log level to INFO from error (#47397)
* Increase log level to INFO from error

Closes #47396

logs before:
```
2024-08-29 08:37:03,836 INFO db.liquibase :: Checking if Database has unrun migrations...
2024-08-29 08:37:04,045 INFO db.liquibase :: Database has unrun migrations. Checking if migration lock is taken...
2024-08-29 08:37:04,047 INFO db.liquibase :: No migration lock found.
2024-08-29 08:37:04,047 INFO db.liquibase :: Migration lock acquired.
2024-08-29 08:37:04,167 INFO db.liquibase :: Running 83 migrations ...
```

logs after:

```
2024-08-29 08:39:45,019 INFO db.liquibase :: Running 83 migrations ...
...
2024-08-29 08:39:45,166 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:00::calherries ran successfully in 0ms
2024-08-29 08:39:45,182 INFO liquibase.changelog :: Columns is_defective_duplicate(boolean) added to metabase_field
2024-08-29 08:39:45,182 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:01::calherries ran successfully in 14ms
2024-08-29 08:39:45,199 INFO liquibase.changelog :: Custom SQL executed
2024-08-29 08:39:45,200 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:02::calherries ran successfully in 16ms
2024-08-29 08:39:45,202 INFO liquibase.changelog :: Foreign key fk_field_parent_ref_field_id dropped
2024-08-29 08:39:45,202 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:03::calherries ran successfully in 1ms
2024-08-29 08:39:45,204 INFO liquibase.changelog :: Foreign key constraint added to metabase_field (parent_id)
2024-08-29 08:39:45,205 INFO liquibase.changelog :: ChangeSet migrations/001_update_migrations.yaml::v49.2024-06-27T00:00:04::calherries ran successfully in 2ms
...
```

* empty commit to bump CI
2024-08-29 11:20:19 -04:00
Ngoc Khuat
9adbbb9a57 Fix failed to backfill cache config due to number overflow (#47390)
* handle cache config overflowed

* fix root too

* do not comment out test

* make cljfmt happy

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-08-29 11:09:25 -04:00
Noah Moss
37162aa2fa Exclude inactive tables from the perms cache, and block queries over inactive tables in the QP (#47363) 2024-08-29 10:48:48 -04:00
metamben
f2ef2de94b Make metric metadata keep the metric's name (#47313)
* Make metric metadata keep the metric's name

This is a fix for the problem reported in #40355, which is fixed separately for v50 and backported to v49.

* Patch broken test

* Normalize dataset-query

* Normalize legacy queries only
2024-08-29 17:25:43 +03:00
Ryan Laurie
9fdc1f9f01 Add Malay Language Support (#47138) 2024-08-29 14:17:28 +00:00
Ryan Laurie
a8599337a4 Update milestone check workflow (#47377) 2024-08-29 07:39:19 -06:00
Nicolò Pretto
76b0a3f513 locale query string support on public links and static embeds (#47186)
* keep locale in url query params

* e2e tests

* ugly fix for the missing baseUrl error

* applies suggestion from Kelvin to make code more demure

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

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>

* remove it.skip added by mistake

* sort imports

* handle native question/ SyncedParametersList too

* shorter and more accurate comment 😅

* Update e2e/support/helpers/e2e-embedding-helpers.js

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

---------

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-08-29 15:14:41 +02:00
Alexander Solovyov
66df724997 update slack-web-api in release helper (#47385) 2024-08-29 13:20:01 +03:00
Alexander Solovyov
036513db84 update aws-java-sdk-core: brings in new jackson with fixed vulnerability (#47384) 2024-08-29 13:05:19 +03:00
Ngoc Khuat
5d4d797d44 Fix formatting on master (#47382) 2024-08-29 07:15:11 +00:00
Ngoc Khuat
1ccdce4c90 Record field usage (again) (#46704) 2024-08-29 04:20:52 +00:00
metamben
b6602d562c Support multiple bucketings of a column in nested queries (#47362)
* Support multiple bucketings of a column in nested queries

Fixes #46644

* Fix e2e test
2024-08-29 01:41:07 +03:00
Chris Truter
f49407fcbd Fix CSV uploads for non-ASCII headers (#47297) 2024-08-28 21:59:58 +00:00
Nick Fitzpatrick
0352066fe3 Adding schema name to recents, search results in CP (#47255)
* Adding schema name to recents, search results in CP

* adding unit test

* fixup tests + clarify recent item schema

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
2024-08-28 15:17:41 -03:00
Nick Fitzpatrick
5626216aea Support ctrl + click on command palette links again (#47328)
* remove prevent default on CP links

* unit flakes?
2024-08-28 15:17:24 -03:00
Noah Moss
f5eecf02e7 Populate permission cache only for one DB at a time (#47332) 2024-08-28 14:16:50 -04:00
Phoomparin Mano
41b7f329aa feat(sdk): generate sample Express.js api and user switcher components via cli (#47060)
* ask for tenancy isolation columns

* deny all permissions for all users group

* create new collections

* add jwt group mappings

* add the permissions step

* add multi-tenancy message in helper text format

* add permission graph

* wire together permissions

* use schema permissions

* use fields from table metadata from query_metadata

* add tenancy field reference

* remove log messages

* deny access to unsandboxed tables

* make permission graph more explicit

* deny access to sample database for customer groups

* add unit test for permission graph

* split permission groups and sandboxes

* jwt settings and hard-coded user attributes

* handle errors when updating sso mappings

* add express api and user switcher

* only fallback to api keys when license is invalid

* add util to sample tenancy column values

* conditional BASE_SSO_API imports

* improve embedding error message

* setup jwt configuration after license step

* setup permissions at the last step

* add missing import

* update steps that requires license

* fix incorrect imports

* add missing useContext

* handle permission update error

* remove tenancyIsolationEnabled field

* add tenancy column sampling

* differentiate tenancy column query error

* rename tenancyColumnValues to tenantIds

* assign sampled tenant ids to user attributes

* add tenant ids

* define collection permissions

* reference sandboxing group by name

* update snippet to be same as the README

* extract ask for tenancy columns to a separate step

* use the customer_id attribute

* query the table query metadata at origin

* append tables correctly

* improve error handling in table scanning

* add retry logic to metadata fetching

* only query metadata for selected fields

* fix race condition with retry

* update loading state and retries

* update comments on jwt license

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

* filter the target table by id

* highlight last selected tenant column

* use breakout to get list of ids

* temporary workaround to reload the whole page

* update row value types

* update row value types

* block non-selected tables

* remove the source-field from sandboxing

* use the fk_target_field_id as instead of target.id

* update unit test

* remove source-field as we only reference our own column

* make native permission types more strict

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-29 00:05:10 +07:00
Phoomparin Mano
c574c09dd7 feat(sdk): setup permissions and sandboxing for embedding cli (#46857)
* ask for tenancy isolation columns

* deny all permissions for all users group

* create new collections

* add jwt group mappings

* add the permissions step

* add multi-tenancy message in helper text format

* add permission graph

* wire together permissions

* use schema permissions

* use fields from table metadata from query_metadata

* add tenancy field reference

* remove log messages

* deny access to unsandboxed tables

* make permission graph more explicit

* deny access to sample database for customer groups

* add unit test for permission graph

* split permission groups and sandboxes

* jwt settings and hard-coded user attributes

* handle errors when updating sso mappings

* add util to sample tenancy column values

* improve embedding error message

* setup jwt configuration after license step

* setup permissions at the last step

* handle permission update error

* add tenancy column sampling

* differentiate tenancy column query error

* rename tenancyColumnValues to tenantIds

* define collection permissions

* reference sandboxing group by name

* extract ask for tenancy columns to a separate step

* query the table query metadata at origin

* append tables correctly

* improve error handling in table scanning

* add retry logic to metadata fetching

* only query metadata for selected fields

* fix race condition with retry

* update loading state and retries

* filter the target table by id

* highlight last selected tenant column

* use breakout to get list of ids

* update row value types

* block non-selected tables

* remove the source-field from sandboxing

* use the fk_target_field_id as instead of target.id

* update unit test

* remove source-field as we only reference our own column

* make native permission types more strict

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-28 23:13:58 +07:00
Ryan Laurie
68f3d1b782 Quieter Patch Releases (#47356) 2024-08-28 10:12:47 -06:00
Anton Kulyk
48749a2eff Fix crash when navigating between bookmarked dashboards (#47311) 2024-08-28 16:00:33 +00:00
Oisin Coveney
5ec1821711 Split and convert ViewFooter elements to TS (#47126) 2024-08-28 18:45:03 +03:00
lbrdnk
bd2d8479d9 Revert "Add :legacy/merge-indents? to .cljfmt.edn (#47345)" (#47357)
This reverts commit 3759c8d46a.
2024-08-28 15:32:41 +00:00
Raphael Krut-Landau
ca29573958 fix(admin/performance): Ensure that the strategy form is not considered dirty if the user changes an empty field to that field's default value, or vice versa (#46543) 2024-08-28 10:10:03 -04:00
lbrdnk
3759c8d46a Add :legacy/merge-indents? to .cljfmt.edn (#47345) 2024-08-28 15:54:31 +02:00
Braden Shepherdson
cb222495ce [QP] Return datetimes in SQL Server, even with date-sized truncation (#47248)
Previously, truncating a `:type/DateTime` column by `:month` or `:day`
would return a `:type/Date`, which subtly broke the query.

In particular, if you try to order-by the breakout column `Created At (month)`
then it would not get de-duplicated, causing a SQL error about conflicting
ORDER BY clauses.

Fixes #46992.
2024-08-28 09:18:09 -04:00
Uladzimir Havenchyk
d50d19021e replace webpack with Rspack for the main app (#46366) 2024-08-28 12:22:28 +03:00
Alexander Polyankin
1cf14d8c83 Add isDateOrDateTime and fix isTemporal and isDateWithoutTime usages (#47250) 2024-08-27 22:30:26 -04:00
Aleksandr Lesnenko
d4e284eb85 fix stacked row tooltip shows null values (#47333) 2024-08-28 01:59:53 +00:00
Jeff Bruemmer
533711e014 docs - clarify caching doc (#47330)
* clarify caching doc

* edit
2024-08-27 21:16:09 +00:00
John Swanson
8a7cc88512 Speed up calculation of effective_ancestors (#47324)
Previously, `visible-collection-ids` was effectively "free" in that we'd
cached `collection-id->collection` for *all* collections, within a
single request, and then locally filtered it for permissions without
needing to hit the database again.

To be honest, there is probably a better fix for this - we're repeatedly
calling `visible-collection-ids` when we probably could just save a
single copy of it and use it when calculating the effective location of
every collection.

However, this is a very quick and low-risk fix, and I want to prioritize
getting this done, and then we can improve it later.

Locally, I copied down the database from stats and timed the
`/api/search?model_ancestors=true` endpoint.

Before my "speedup" PR (https://github.com/metabase/metabase/pull/46942)
it took ~7 seconds to return results.

After my "speedup" PR, it took ~15s to return results. :grimace:

With this change, it takes 818ms to return results. 🎉
2024-08-27 20:56:40 +00:00
Alexander Polyankin
e144032025 Summarize step changes for metrics (#47200) 2024-08-27 19:25:49 +00:00
appleby
52284e622b Ensure that CI checks fail if cljs tests fail (#47192)
* Fix typo in expression-clause-normalization-test

s/time-interval/relative-time-interval/

* Add missing table-id to card def to fix failing legacy-ref-test

* Ensure that if yarn test-cljs fails it fails the CI checks

When configured to autorun, the command

   shadow-cljs compile test

will exit success even if test failures occur in the node test. See

   https://github.com/thheller/shadow-cljs/issues/425

In order to ensure our CI checks fail when cljs tests fail, we need to invoke
node directly. To prevent running the tests twice, remove `:autorun true` from
the `:test` target in shadow-cljs.edn.
2024-08-27 19:15:50 +00:00
Raphael Krut-Landau
5880661213 fix(questions + admin/performance): Improve Clear cache button text and question refresh button tooltip (#46791) 2024-08-27 14:16:43 -04:00
Jeff Bruemmer
7046722c5c docs - notes on public links (#47315) 2024-08-27 17:31:00 +00:00
appleby
458084407e zoom-in-timeseries-drill: do not include :hour and :minute for DATE columns (#46997)
* zoom-in-timeseries-drill: do not include :hour and :minute for DATE columns

When the user attempts to drill through a DATE column, we should not return :hour or :minute drill throughs from
available-drill-thrus. Previously we did, which resulted in an error being displayed when the user attempted to select
them.

Modify next-breakout-unit in zoom_in_timeseries.cljc to not return :hour or :minute units for :type/Date columns,
which prevents these from being returned by available-drill-thrus, which prevents them appearing in UI context menus.

* Use lib.temporal-bucket/available-temporal-buckets

Per review feedback, use lib.temporal-bucket/available-temporal-buckets to get the valid-current-units in
metabase.lib.drill-thru.zoom-in-timeseries.

* Do not construct zipmap just to lookup the next unit

Rather than constructing a zipmap from `valid-current-units', which requires iterating over the seq twice, just
traverse the seq once and return the next item in the seq (if any).

Constructing a zipmap made sense in the old code because it was constructed once from static data and used many times
for lookup. In the new version, the vec of `valid-current-units` is dynamic and dependent on the type of the breakout.

* PR suggestion: use threading macro rather than nested sexps

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

* PR suggestion: use threading macro rather than transducer / eduction

* PR suggestion: reduce boilerplate in zoom-in-timeseries tests

Reduce code dup by looping over aggregation and bucketing options rather than having a separate deftest for each.

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
Fixes #39366
2024-08-27 17:27:47 +00:00
Nicolò Pretto
e441f1d58c poc of using loki to test png/pdf exports (#45650)
* use loki to test png exports on questions

* try to put the img in the body to see if it fixes the scrollbar issues in ci

* fix linting issues

* let's try again in ci

* Attempt to make CI wait before taking a snapshot for downloaded PNGs

* Use the snapshots from CI for PNG downloads

* pdf export test thanks to kelvin suggestion about just testing the png

* refactored the code to extract a util function

* remove pdf tests as they broke in ci 🤷

* Update frontend/src/metabase/env.ts

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

* Update frontend/src/metabase/lib/loki-utils.ts

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-08-27 18:09:52 +02:00
John Swanson
f749c695a4 oops: enable relevant feature before a test (#40973) 2024-08-27 08:55:57 -07:00
Tim Macdonald
e9a28c250f Disable query analysis queueing for query changes in prod (#47231)
Analyze queries synchronously on save
2024-08-27 14:38:53 +00:00
Chris Truter
c5912a5286 Delete old serialization extension points and fallbacks (WIP) (#47273) 2024-08-27 14:00:22 +00:00
Luis Paolini
9fe5a85e91 Bump MS SQL Driver to 12.8.1 (#47264)
Lotsa fixes for this
2024-08-27 10:47:27 -03:00
bryan
339ff2433d Entity id translation service (#47094)
* entity id translation + tests

* add api level test

* simplify definition of eid-table->model + add test

* update tests to take keywords

* improve comment

* generate the eid-table->model map

* delete now-obsolete test

* make it work in oss

* put the resulting response into a key, so we can add more information later

* formatting

* use model names without the model/ prefix as keys

* Creates list of `api/model->db-model`

- update keys for util/entity_id request
- update shape of util/entity_id response
- add test for not-found eids

* formatting

* Respond to code review feedback

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-08-27 13:45:42 +00:00
github-automation-metabase
6e191b74e3 Add v0.49.24 to the list of releases (#47300) 2024-08-27 09:30:44 -04:00
github-automation-metabase
3a60853f38 Add v0.50.22 to the list of releases (#47275)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-27 09:17:17 -04:00
Ngoc Khuat
73e9a8a3b9 Fix flaky test update-db-to-never-scan-values-on-demand-test (#47295) 2024-08-27 12:16:05 +00:00
Chris Truter
2ba5c4d93e Stop serializing LegacyMetric (#47268) 2024-08-27 11:11:09 +00:00
Uladzimir Havenchyk
de7ff21dfd add uladzimirdev to querying team (#47298) 2024-08-27 11:05:05 +00:00
Chris Truter
ebf18f35b2 Use Serialization spec for Collection (#47240) 2024-08-27 11:05:57 +02:00
Chris Truter
b7cac603ae More logging around serialization error (#47278) 2024-08-27 08:52:44 +00:00
Kamil Mielnik
ccd3b577fb Refactor e2e helpers and commands to TypeScript function helpers (#47237)
* Convert e2e-custom-column-helpers to TS

* Refactor createTimeline, createTimelineEvent & createTimelineWithEvents to TS

* Fix circular imports
2024-08-27 08:36:11 +00:00
appleby
c73c198a7b Remove failing assertion in CLJS diagnose-expression-test (#47271)
Failing after changes in 13983247ee

Per slack conversation, ok to disable:

https://metaboat.slack.com/archives/C013N8XL286/p1724711461313089?thread_ts=1724414568.662469&cid=C013N8XL286
2024-08-27 00:37:18 +00:00
Chris Truter
f984a3e039 Track query analysis failures (#47216) 2024-08-26 23:35:01 +00:00
John Swanson
da2a0a1b7c Don't encrypt boolean settings (by default) (#47179)
* Don't encrypt boolean settings (by default)

We have tooling to disable encryption on settings even when the
`MB_ENCRYPTION_SECRET_KEY` is set. Turn it on by default for all boolean
settings, which don't need to be encrypted.

I also optimized the code that decrypts settings on startup because I
didn't want to delay startup if someone had set a bunch of boolean
settings. With 20 set, the old version added about 200+ ms to startup,
about 10ms per boolean setting, whether or not it was encrypted or in
the DB already. The optimized version selects all the never-encrypt
values from the database at once (a bit silly, but we also just exclude
raw `true` and `false` values so we don't bother checking them) and
updates them if they're encrypted - this adds ~40ms to startup with 20
encrypted boolean settings (about 2ms per boolean setting) and ~5ms to
startup on subsequent runs, when no encrypted values are in the DB.
2024-08-26 22:48:04 +00:00
Braden Shepherdson
13983247ee [MBQL lib] Disable expression type checking entirely (#47245)
This testing is too strict to support some legitimate use cases that
have no workaround at present. We can bring back this type-checking
eventually, once it's possible to correctly express things like
automatic coercion of strings to numbers in `SUM` aggregations.

Fixes #44431.
2024-08-26 17:44:18 -04:00
Uladzimir Havenchyk
f28ea99c64 fix import order in the files with disabled rules (#47217)
* fix import order in the files with disabled rules

* remove hack

* minor
2024-08-26 23:36:56 +03:00
Jeff Bruemmer
42caad57a3 docs - locale for static and public links (#47194) 2024-08-26 16:34:33 -04:00
Alex Yarosh
e8904acf4b docs: serialization clarification (#45480)
* serialization clarification

* Update docs/installation-and-operation/serialization.md

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

* Update docs/installation-and-operation/serialization.md

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

* Update docs/installation-and-operation/serialization.md

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

* Update docs/installation-and-operation/serialization.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-26 16:23:23 -04:00
Paul Leclercq
db21f7ed40 Docs: migrate down using docker compose command (#39497)
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-08-26 12:54:35 -07:00
Daksh Shah
aceaac27c8 Update upgrade instructions for Azure (#38638) 2024-08-26 12:52:39 -07:00
Bruno Ferreira
151334aac1 Adds missing glue:GetCatalogImportStatus (#41388)
Seems that `glue:GetCatalogImportStatus` is also needed for the integration with Amazon Athena because there's multiple AccessDenied on cloudtrail if this permission is missing:
```
{
    "eventVersion": "1.09",
    "userIdentity": {
        "type": "IAMUser",
        "principalId": "***********************",
        "arn": "arn:aws:iam::*************:user/metabase",
        "accountId": "**********************",
        "accessKeyId": "*******************",
        "userName": "metabase"
    },
    "eventTime": "2024-04-11T08:29:00Z",
    "eventSource": "glue.amazonaws.com",
    "eventName": "GetCatalogImportStatus",
    "awsRegion": "eu-west-1",
    "sourceIPAddress": "***********",
    "userAgent": "DriverVersion/02.00.35.1001/JDBCVersion/4.2/PluginName/IAM, aws-sdk-java/1.12.339 Linux/5.10.213-201.855.amzn2.x86_64 OpenJDK_64-Bit_Server_VM/11.0.22+7 java/11.0.22 clojure/1.11.1 vendor/Eclipse_Adoptium cfg/retry-mode/legacy",
    "errorCode": "AccessDenied",
    "errorMessage": "An unknown error occurred",
    "requestParameters": null,
    "responseElements": null,
    "requestID": "*************************************",
    "eventID": "*************************************",
    "readOnly": true,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "*************************************",
    "eventCategory": "Management",
    "tlsDetails": {
        "tlsVersion": "TLSv1.3",
        "cipherSuite": "TLS_AES_128_GCM_SHA256",
        "clientProvidedHostHeader": "glue.eu-west-1.amazonaws.com"
    }
}
```
2024-08-26 12:52:18 -07:00
Tony-metabase
565f70c7e7 Update appearance.md (#36538)
* Update appearance.md

Adding information about how colors are selected by Metabase because there is the confusion that the order in which you select colors is the order you get on the chart

* Update appearance.md

Removed code reference and tried to simplify the context

* Update docs/configuring-metabase/appearance.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-26 12:50:56 -07:00
İbrahim Gurses
7a5133398c Add Peaka community driver link to documentation (#44152)
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-08-26 12:48:30 -07:00
Raphael Krut-Landau
45d8be7ef1 fix(dashboard): In dashboard value source modal, after closing question picker modal, don't also close the first modal (#47242) 2024-08-26 15:33:33 -04:00
John Swanson
af6d6e7fe4 Much better collection permission performance (#46942)
There are a few separate changes here:

- Migrations: add and populate indexed columns perm_value, perm_type, and collection_id to permissions

These fields allows us to efficiently run queries based on collection permissions in the DB without string manipulation. Keeping the table as permissions allows us to do this migration in-place. Note that in some cases collections may have been deleted from the database without deleting the associated permissions row (since there was no foreign key before). We need to be defensive here: if we have a permissions row without a corresponding collection, delete the row before running the rest of the migration.

- Write perm_value, perm_type, and collection_id for new collection permissions

A very simple before-insert method sets these fields before a collection permission is written to the DB.

- Replace collection/permissions-set->visible-collection-ids and collection/visible-collection-ids->honeysql-filter-clause with collection/honeysql-filter-clause

Previously, just about everywhere we used permissions-set->visible-collection-ids, what we were essentially doing was an in-app join: select all the collection IDs you have permission on, then convert it to a SQL clause like WHERE collection_id IN ( all of those collection IDs).

Replace both of these with honeysql-filter-clause, which uses the new fields we added to permissions above to construct a honeysql filter representing "all the collections I have permissions on", without needing to round-trip them to the application and back to the DB.

Of course, we can then write a function visible-collection-ids, which uses honeysql-filter-clause, for those cases where we do actually need the whole bunch in the application (we use this, for example, when constructing the effective-location for a collection).

I also added one more toggle to the VisibilityConfig that's passed into the honeysql-filter-clause (and used to be passed to permissions-set->visible-collection-ids), allowing you to select only the effective children of some collection.
2024-08-26 12:06:29 -07:00
metamben
8b1f884059 Support dashboard filters targeting multiple stages in QP (#46935)
* [MBQL lib] Map dashboard filters to last stage w/aggregations

Originally we used the last stage's columns for dashboard filters, but
then if you eg. use a custom expression to clean up the results of the
aggregation, then you can't filter at the most useful spot - before the
aggregations.

Fixes #19744. Related to #26244, #33958.

* Add stage-number option to the dimension not to the field

* Remove FE changes

* Support negative stage numbers

* Add tests for multi-stage parameter expansion

* Specify schema for dimension options

* Fix legacy MBQL schema

* Append stage when running cards with top level summary

* Fix schema

* Only ensure filter stage when the parameters say it's used

* Implement ensure-filter-stage

* Format clj

* Add ensure-filter-stage test

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-08-26 20:16:00 +03:00
Raphael Krut-Landau
118e713d82 Fix error message in Create API Key modal (#47161) 2024-08-26 12:15:19 -04:00
Alexander Solovyov
879195def7 [serdes] query action depends on stuff in its dataset_query (#47220) 2024-08-26 17:59:39 +02:00
Noah Moss
0dd4013dc0 Use more precise query contexts when recording execution of public downloads (#47201) 2024-08-26 11:27:05 -04:00
John Swanson
1926bf93cb Re-add creator to query validation API (#47183) 2024-08-26 07:50:28 -07:00
Alexander Polyankin
84e5008bc8 Remove unneeded index.ts files in querying (#47190) 2024-08-26 14:13:52 +00:00
lbrdnk
b75577b529 Fix DateTimeRange substitution for open ranges (#47175)
* Fix DateTimeRange substitution for open ranges

* Add E2E repro for #47172

* cljfmt

* Add test for datetime column

* Update range boundary for open range

* Update test names

* Apply suggestions from code review

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

* Fix e2e

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-08-26 14:51:45 +02:00
lbrdnk
ed509b5306 Add database type adjustments to server side generated temporal values (#47039)
* Add database type adjustments to server side generated temporal values

* Speculative base type change

* Infer timezone only from _actual_ user, not global user level

* Set timezone for actual user in test extensions

* Add test case

* Update type info generation

* Adjust server side relative datetime

* Update src/metabase/driver/sql/query_processor.clj

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

* Fix base type logic

* Fix typo

* Fix formatting

* Update user name handling

* cljfmt

* Address review comments

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-08-26 12:36:15 +02:00
Chris Truter
61ca125c7e Add logging catch around query analysis worker (#47206) 2024-08-26 10:25:16 +00:00
github-automation-metabase
2bb3eedecb Update Readme version references and published npm version to 0.1.32 (#47174)
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-08-26 07:23:57 +00:00
Alexander Solovyov
9b614cabda [serdes] a few improvements, instance_analytics cleanup script (#47136) 2024-08-24 05:04:00 +00:00
Cam Saul
d2034416e0 Fix mu/fn and mu/defn support for map schemas on key-value args (#47153)
* Fix #46846

* Don't use `-v` to check if script has arg since it doesn't work on all bash versions

* Fix typo
2024-08-23 17:25:23 -06:00
Aleksandr Lesnenko
b30af986d3 fix echarts tooltip positioning (#47202) 2024-08-23 22:27:00 +00:00
Case Nelson
25d30ca9aa feat: BigQuery nested fields (#47106)
* feat: BigQuery nested fields

Updates dataset definitions to allow `nested-fields`

Adds the `::sql.qp/nfc-path` to include nfc-path in the field
identifier.

* Add bigquery to nested-fields feature. Rework geographical-tips to allow adding to bigquery

* Parse RECORD type into maps

* Fix tests

* Fix tests

* Fix formatting

* Handle arrays of records

* Fix formatting

* Conditionally add nested-fields

* Fix test

* Update docs/developers-guide/driver-changelog.md

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

* Update docs/developers-guide/driver-changelog.md

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

* Update modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk.clj

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

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-08-23 22:05:17 +00:00
metamben
001b8890d7 Strip expression metadata for field expression (#47155)
* Strip expression metadata for field expression

Fixes #44940.
2024-08-23 21:30:29 +00:00
Sloan Sparger
83fea34fb8 [Permissions] Data permissions graph utils reorganization (#47023)
* reorganizes data-permissions.ts to be a folder split by a file per concern, moves some logic out into other utils files where it makes sense

* pr feedback and fix lints
2024-08-23 14:07:13 -05:00
Raphael Krut-Landau
af24dd9110 feat(admin/performance): In Admin / Performance, add a tab where you can manage the caching policies of dashboards and questions (#42990)
Closes #42567
2024-08-23 14:57:54 -04:00
Alexander Polyankin
17bff867ce Fix issues with column matching for multiple breakouts of the same column (#46979)
* Fix binning matching

* Add tests

* Add tests

* Add tests

* typo

* Update src/metabase/lib/equality.cljc

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

* Fix alignment

* Fix alignment

* Update src/metabase/lib/js.cljs

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

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-08-23 17:21:46 +00:00
Nick Fitzpatrick
839717c961 Fix padding prop on Mantine Modals (#46900)
* move default modal padding to general modal component

* small adjustments. Using base modal where apropriate

* shame
2024-08-23 11:57:52 -03:00
Raphael Krut-Landau
da829723b9 fix(browse): Remove some dead code (#46861) 2024-08-23 10:25:11 -04:00
Chris Truter
0d50f7b1e6 Lower logging level for query analysis (#47178) 2024-08-23 14:00:50 +00:00
Alexander Polyankin
7e879221af Add subfolders in metabase/querying (#47160)
* Add subfolders in querying

* Add subfolders in querying

* Add subfolders in querying

* Remove FilterContent

* Remove FilterContent

* Remove FilterContent

* Remove FilterContent

* Remove FilterContent
2024-08-23 09:39:47 -04:00
Ngoc Khuat
42dc5239db [serialization] extract subtree should hydrate entities (#47171) 2024-08-23 12:59:02 +00:00
Jeff Bruemmer
e9c4972229 update env vars (#47072) 2024-08-23 12:49:11 +00:00
Mahatthana (Kelvin) Nomsawadi
d6a938f131 Update UTM tags in static embed modal links (#47116)
* Update interactive embedding CTA UTM tags

* Make the UTM tags more readable

* Update static embed doc UTM tags

* Update static embed appearance customization doc UTM tags

* Update font upsell UTM tags

* Update tests

* Fix wrong upgrade URL

* Update tests
2024-08-23 13:31:26 +01:00
Phoomparin Mano
852ddc274a fix(sdk): apply the default viz height only in visualization view (#47169)
* only use viz height for visualization view

* move the default viz height fallback

* default to full-height if height is zero or unavailable

* remove test wrapper
2024-08-23 18:56:35 +07:00
Oleksandr Yakushev
743ae09aca perf: [insights] Use direct conversions in ->millis-from-epoch to avoid clojure.java-time overhead (#47145) 2024-08-23 09:53:08 +03:00
Oleksandr Yakushev
4935863049 perf: [date-2.parse] Add a fastpath for timestamps that are likely ISO instants (#47143) 2024-08-23 05:55:31 +00:00
Jeff Bruemmer
65b3ef01d4 docs - api docs update (#46373) 2024-08-22 19:07:33 -04:00
Nick Fitzpatrick
e10bf5f950 extending table component features (#47030)
* extending table component features

* adding unit tests

* PR Feedback

* PR Feedback

* unit test adjustment
2024-08-22 15:31:43 -03:00
Noah Moss
3685eb4b2a Properly detect when Snowflake is using a local key file when expanding connection properties (#46348) 2024-08-22 14:08:21 -04:00
bryan
6eecf77e7d recents updates to better support metrics (#47032)
* recents updates to better support metrics

allows updating metric views through the API
improves parent_collection calculation

* add 2 tests for metrics
2024-08-22 17:48:02 +00:00
Cam Saul
31f209f33e Cljfmt config part 4 (#47047) 2024-08-22 16:24:16 +00:00
Aleksandr Lesnenko
418a20fd70 fix pivot table overflow (#47102)
* fix pivot tables overflow & edit styles

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-22 15:55:47 +00:00
Romeo Van Snick
8dd2eeefff Simplify finding metrics in Summarize (#46887)
* Use global search for aggregation picker

* Add names to aggregation picker items so they can be searched

* Render info icon metric descriptions

* Add unit tests for global aggregation picker search

* Add test for searching metrics

* Add a test for metrics descriptions

* Sort metrics

* Fix e2e test

* Use Flex from metabase/ui

* Handle markdown in metric description

* Add test for sorted metrics

* Update Markdown styling in metric description

* Fix clojure formatting

* Test for markdown in the Metric description

* Fix lint

* Fix test for markdown

* Use simpler equality test

* Fix overflow in test
2024-08-22 16:35:03 +02:00
John Swanson
5c0800aca4 Don't allow viewing a timeline without coll perms (#46863)
If we don't have access to the collection, we shouldn't have access to
the timelines.
2024-08-22 06:38:04 -07:00
Alexander Solovyov
35d73f950f [serdes] extract result_metadata.fk_target_field_id (#47122) 2024-08-22 16:24:24 +03:00
Chris Truter
5944b20bfb Bump macaw to 0.2.6 (#47119) 2024-08-22 13:05:48 +00:00
Alexander Solovyov
372fd8d9b3 [serdes] keep nulls in export when there are nulls in the db (#47121)
this retains previous behavior
2024-08-22 13:05:30 +00:00
Ngoc Khuat
22a80f2cb2 Fix n+1 when getting field values for dashboard (#47113) 2024-08-22 12:49:54 +00:00
Uladzimir Havenchyk
88ac0ed7c1 handle warnings from reselect about broken selectors rules (#47076)
* handle reselect warnings about wrong usage of selectors

* return stable references

* add a comment

* address excellent review
2024-08-22 11:22:41 +00:00
Chris Truter
0030c91580 Add support for pipe separator in CSVs (#47114) 2024-08-22 11:09:01 +00:00
Mahatthana (Kelvin) Nomsawadi
b3c72d9cec Fix iframe resizer not working (#47115) 2024-08-22 11:49:02 +01:00
Kamil Mielnik
6a5faa8bac Fix SchemaItem type (#47068) 2024-08-22 07:21:22 +00:00
bryan
00ff56e8ee Ensure blocked tables downgrade into blocked dbs (#47093)
* tests ensure blocked tables downgrade > blocked db

* implement the blocked table -> blocked db rollback

- move/add tests for it
2024-08-21 19:22:38 -06:00
adam-james
8bed390b6e Add missing day in :minute timestamp formatter (#47104) 2024-08-21 22:48:05 +00:00
Nemanja Glumac
a4e55cf4c9 Repro #42773: "-modified" suffix briefly shown in a model's name input during creation (#47103) 2024-08-21 21:52:10 +00:00
Noah Moss
c985f362fc Make sure we insert special segmented permission paths for sandboxed tables on downgrade to 49 (#47085) 2024-08-21 17:43:38 -04:00
Vamsi Peri
1fe4c5c176 removing cal (#47096) 2024-08-21 22:25:10 +02:00
Roman Abdulmanov
74e9d6971f Add notification about closed Epics (#47099) 2024-08-21 22:24:09 +02:00
Cam Saul
80813cb5de Cljfmt config part 3 (#47046)
* Cljfmt config part 2

* Part 3 WIP

* Part 3 WIP

* Part 3 WIP

* Part 3 WIP

* Part 3 WIP

* Use fork with https://github.com/weavejester/cljfmt/pull/348 and https://github.com/weavejester/cljfmt/pull/350

* Backport updated config and linter fork from part 3

* Update formatting

* Reformat

* Fix bad indentation from #47064
2024-08-21 19:27:08 +00:00
Ryan Laurie
3964d71e02 Create Question and Dashboard Sharing Menu (#46593)
* QuestionAlertWidget to FC + TS

* update e2e tests

* use regular alert for unsubscribes

* Create Question and Dashboard Sharing Menu

* Handle some edge cases

* top notch unit tests

* more testing and tweaking

* fix imports

* more tests

* add alerts to question sharing menu

* add tests for alerts

* update e2e tests

* use Oisin's toolbarbutton

* fix rebase

* prompt to save before sharing questions

* show prompt to set up notification channels

* fix import

* update tests and hide on notebook screen

* fixes

* clean up pulse types

* update e2e tests

* fix a bunch more tests

* more e2e test fixes

* maybe green now? 🤞

* last one 🥺

* design updates

* make channel setup modal nicer

* simpler component props

* lint fix

* lint fixes
2024-08-21 19:08:54 +00:00
metamben
cb12f351b6 Prevent metrics from being returned for inaccessible collections (#46994) 2024-08-21 21:45:52 +03:00
Mahatthana (Kelvin) Nomsawadi
ccec5ce938 Fix docker-compose not available on Mac (#47054) 2024-08-21 19:06:34 +01:00
Alex Yarosh
b7a867ab49 docs: Update MongoDB Atlas connection instructions (#47088)
* mongodb connection

* mongodb connection info

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-21 17:39:35 +00:00
Cam Saul
457392bd3b Cljfmt config part 2 (#47035)
* Cljfmt config part 2

* Backport updated config and linter fork from part 3

* Update formatting
2024-08-21 17:29:41 +00:00
Oisin Coveney
0a6d0a1928 feat(sdk): Edit Question (#46894) 2024-08-21 18:15:53 +03:00
Chris Truter
9e08c3e949 Improve Query Analysis sweeper scheduling (#47064) 2024-08-21 15:15:19 +00:00
Jeff Bruemmer
0ec737a7c6 docs - blocked at table level (#46937)
* blocked at table level

* edits

* note on sql questions
2024-08-21 11:12:31 -04:00
Uladzimir Havenchyk
ae0359f7f8 dx: forbid imports from storybook testing-library outside stories (#47056) 2024-08-21 17:55:31 +03:00
github-automation-metabase
47b8b4cbbf Add v0.50.21 to the list of releases (#47073)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-08-21 10:53:00 -04:00
Oisin Coveney
6d52d18be5 fix(#46893) - Sharing popover in query builder view should be next to button (#47065) 2024-08-21 17:36:12 +03:00
Luis Paolini
d275c0bb53 Bump presto driver to v288 (#47071) 2024-08-21 11:28:50 -03:00
Nicolò Pretto
270db4c6e3 bump onboarding version to 1.3.0 (#47055) 2024-08-21 16:23:17 +02:00
Alexander Polyankin
9108dd750c Rearrange buttons in the dashboard editing panel (#46809) 2024-08-21 09:31:39 -04:00
Chris Truter
468bed10cc Strip model cache tables from query analysis (#47063) 2024-08-21 12:17:50 +00:00
Roman Abdulmanov
a6116b85b4 Add notification about closed Epics (#47062) 2024-08-21 12:38:33 +01:00
Nicolò Pretto
8132d87efa skip analytics opt out step for people on cloud (#46965)
* poc of removing data usage step for the tech plan

* pretend it's not cloud if hasAddedPaidPlanInPreviousStep is true

* split the jest tests files to simulate pro cloud, pro selfhosted and starter cloud scenarios
2024-08-21 12:57:42 +02:00
Phoomparin Mano
4453abb13a feat(sdk): embedding cli opens the metabase store to get trial token and applies the license (#46810)
* open metabase store to get trial token

* remove license env from instance setup as we provide the license key later

* activate metabase license

* fix password field missing

* fix formatting for generated component files message

* activate license key

* add missing auth options for postgres

* add function to print with padding

* prevent infinite loop and update section representation

* show the activate license error in red

* rename variable
2024-08-21 17:36:53 +07:00
Chris Truter
1b9a267551 Bump Macaw to 0.2.3 and improve logging (#47031) 2024-08-21 10:20:19 +00:00
Nemanja Glumac
75629e969e Include collection path in the app bar for metrics (#47051) 2024-08-21 11:23:06 +02:00
Romeo Van Snick
63c074d2a2 Allow editing the breakout bin from the compare aggregation picker and provide presets (#46844)
* Add offset presets

* Render OffsetPresets initially

* Add BucketInput

* Render BucketInput and do not rely on referential equality for Lib.Bucket

* Make sure the currently selected bucket shows in the presets

* Lift label into CompareAggregations

* Fix spacing of label

* Fix labels based on comparison type

* Use Switch for include current period

* Include current bucket in CurrentPeriodInput label

* Fix unit tests

* Add more unit tests for CompareAggregations

* Update e2e test for column compare to handle presets

* Group offset tests

* Add tests for moving average

* Add tests to verify changing the bucket works

* Fix type

* Make sure temporal columns are buckatable before picking them

* Make getPreferredPresets more clear

* Add test for temporal expression column

* Fix lint
2024-08-21 11:11:42 +02:00
Alexander Solovyov
62fdd015f9 [serdes] move Action to using spec (#46973) 2024-08-21 11:33:33 +03:00
Mahatthana (Kelvin) Nomsawadi
f07084aa80 Improve text contrast in object detail in static embed (#46968)
* Theme object detail texts

* Add loki tests
2024-08-21 09:24:43 +01:00
Nicolò Pretto
d3777b3ed8 fix padding on setup completed step when on cloud (#47021) 2024-08-21 09:41:06 +02:00
Alexander Solovyov
c5e85d17b1 [serdes] move most of the models over to using spec (#46966) 2024-08-21 09:49:38 +03:00
Aleksandr Lesnenko
b259818634 hide echarts tooltip on scroll (#46996)
* hide echarts tooltip on scroll

* lint
2024-08-21 03:59:45 +00:00
Aleksandr Lesnenko
b8a88121c0 fix echarts tooltip issues (#46946)
* fix echarts tooltip issues

* fix types

* use another merge-ref package
2024-08-20 22:30:24 -04:00
Alex Yarosh
cba3922ddf clean up Azure AD references (#47041) 2024-08-20 19:05:15 -04:00
Alex Yarosh
1a7fec770c docs: bring back code highlighting (#47029)
* highlight 1

* highlight 2
2024-08-20 16:02:22 -04:00
Uladzimir Havenchyk
16291a0f99 fix: upgrade elliptic to resolve security issues (#47014) 2024-08-20 22:31:13 +03:00
Nemanja Glumac
ed8de16f26 refactor: Simplify question data source (#46989)
* Split utils from `QuestionDataSource`

* Do the computation inside the component

* Compute query only once

* Fix imports order
2024-08-20 21:22:48 +02:00
Cam Saul
ef42d3067c Update cljfmt config and add to GH Actions (#46998)
* Cljfmt

* Fix new GH action
2024-08-20 18:23:16 +00:00
Uladzimir Havenchyk
9c75ad629f remove pnpm lockfile (#47024) 2024-08-20 20:42:49 +03:00
lbrdnk
a556e1cd8e Update later stage stale references on clause removal (#46926)
* Add update-stale-references and test

* Update test
2024-08-20 18:18:01 +02:00
Uladzimir Havenchyk
92d615073a refactor: sort import members inside destructuring (#47009)
* refactor: sort import members inside destructuring

* Show an error message when the temporal unit is not applicable to a dashboard card (#46983)

* Fix tests

* Add tests

* Add tests

* Fix types

* Fix types

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-08-20 17:29:08 +03:00
Jeff Bruemmer
a5fe34ef23 docs - locked filter note (#46940) 2024-08-20 08:54:41 -04:00
Uladzimir Havenchyk
eb43ebfbd0 hide terminal-report logs from console (#46891)
* hide terminal-report logs from console

* disable html output from testing-library-dom

* revert failing code
2024-08-20 15:50:22 +03:00
Nicolò Pretto
e0a0734c62 make the newsletter signup a checkbox instead of a button (#46783)
* make the newsletter signup a checkbox instead of a button

* update copy on unit test

* fix describe nesting

* update the ui to be like the design

* make tests use userEvent.click to avoid warning about missing act

* use the subscribeToNewsletter function

* add basic e2e test for newsletter subscription

* move wait to the end of the test to see if it passes in ci

* remove async to see if it fixes the issue

* trying to mock the response

* make it clear why we're mocking the response

* use getUserEmail as suggested by Sloan

* inline var a suggested on code review
2024-08-20 14:28:39 +02:00
Nemanja Glumac
49db9a9b77 Fix 46221: Wrong collection shown in ad-hoc model-based questions (#47008)
* Remove `Collections` entity loader

* Load collections directly within the component

* Add E2E repro for #46221
2024-08-20 14:15:13 +02:00
Alexander Polyankin
fff6e35c3e Show an error message when the temporal unit is not applicable to a dashboard card (#46983)
* Fix tests

* Add tests

* Add tests

* Fix types

* Fix types
2024-08-20 07:49:10 -04:00
Nemanja Glumac
07c1e2549a Remove extra bottom margin from summarized ad-hoc question (#46993) 2024-08-20 09:01:19 +02:00
Cam Saul
ee25e763e3 Test defn/defmacro exclamation point linter should also use :parallel/disallowed (#46943)
* Kondo Config cleanup

* Restore warnings for with-log-messages-for-level until #28827 is merged

* Updated clojure.test hooks

* Fix kondo warning

* Test defn/defmacro exclamation point linter should also use :parallel/disallowed (part 1)

* WIP

* Time for me to learn to spell

* Finish the cleanup

* Remove code I was typing as an example

* Fix renamed var

* Fix the SAML tests

* Fix Kondo warning
2024-08-20 12:10:08 +07:00
Nemanja Glumac
bcb10910e3 tech: Delete old analytics code (#46986) 2024-08-20 00:41:33 +02:00
bryan
2bbcf745c8 Add no-access table-level and schema-level permission (#46542)
* allow `:blocked` to be saved for table level perms

* Adds 2 tests for table level blocked permission settings

- N.B. these are NOT ENFORCED YET

* update test that asserted we cannot set block on tables (we can)

* WIP: Pairing on making perms checking less wild

* cleanup, update docs, and add a test for view-data perm only

- Added a test where we have data permissions, but not create query, and
  I think it is failing when we have create query and blocked data
  permissions.
- renamed some functions from check-x -> has-x? since they return a
  value instead of throwing now

* Revert "WIP: Pairing on making perms checking less wild"

Keep the same behavior, but stick with the saner flow control

This reverts commit 63bcb5b401138555a081378574b15d6506469e60.

* update docs

* update test to be passing

- TODO: make sure it's correct w.r.t. perm settings

* Allow schema level blocked setting in permgraph

* remove invalid test cases

- continue to have a forcing function to test newly added perms

* conform function output

* ensure a single blocked table blocks native queries to its DB

* update error message

- we now catch this error in `metabase.models.query.permissions/has-perm-for-query?`

* we now check for data permissions to process query for card

* add more explanation to what we are testing

- to help see why it fails on CI and passes locally

* remove excess `def`

* Add test for table-level data X collection perms

- update test found to be in-error

* update param values qp permission check style

* set view-data and create-query explicitly

* set viewdata and createquery explicitly in qp test

* Respond to review comments (which fixes a case)

* setting a table to blocked: leave other tables the same

* [Permissions] Add "No access" schema/table permission (#46509)

* first pass

* refactors downgrading native permission logic and updates calculation so that "No access" downgrades native permissions to "No"

* stub for permissions help info on table block

* modal changes wip, updates downgrading create queries permissions to all happen at a single call site

* clean up, sandboxing modal copy changes, removes rekoke/limit access modal changes to make the diff smaller and move code to a seperate PR

* updates permissions help section to contain the final copy

* sandboxing copy fix and remove modal that was dropped from requirements

* adds blocked at the schema level, updates no access copy to blocked, updates permissions help section to contain new blocked and schema level changes

* fixes failed unit and e2e tests after sandboxing copy changes

* improve the block e2e test to include table blocking

* fixes failing blocked test, fixes other schemas create queries permissions getting correct with one schema was droped to blocked view data access, fixes a bug that prevents the save bar from going away when all permissions for group are set to the default values

* clean up

* remove color changes

* prevents parent being set to blocked preventing edits for children entities

* add new hasPermissionValueInSubgraph fn, adds modal to warn users we have to upgrade the view data permissions when they upgrade create queries permissions when a child entity is set to blocked

* adds test coverage for new modal

* removes unused function, adds new updateEntityPermission fn to help consolidate some logic elsewhere

* unit test fix and type fix

* most pr feedback

* updates the confirmation modal copy when changing a parent entity that contains a child with blocked permissions and/or sandboxed children, adds test coverage for that, adds test coverage for permission view data column not appearing in oss

* type fix

* [Permissions] Add e2e test coverage for blocked permissions enforcements (#46663)

* adds test coverage for enforcement of blocked permissions

* moves tests around based on pr feedback

* copy changes

* adds fix to make sure that blocked permissions are not removed from sibling tables that have the create queries permissions upgraded (#46854)

* Fix table name lookup for dbs w/ 1 schema per db

* add test for blank schema identifiers

* Refine sandboxed user perms for query builder access (#46939)

* Refine sandboxed user perms for query builder access

- Limit create-queries permissions to unblocked tables only
- Check user permissions for each table before granting query builder access
- Prevent querying of blocked joined tables from query builder for sandboxed users

* Adjust permissions for sandboxed users

- Grant view-data permissions only for unblocked tables
- Revert create-queries permissions to all tables in sandbox
- Remove unnecessary intermediate variable

* when sandboxing we no longer grant unrestricted view perms for blocked tables

* Update enterprise/backend/src/metabase_enterprise/sandbox/query_processor/middleware/row_level_restrictions.clj

remove blank line

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

* - make coalesce-test exhaustive (except for sandbox)

* Update enterprise/backend/src/metabase_enterprise/sandbox/query_processor/middleware/row_level_restrictions.clj

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

* t2/select ... -> database/table-id->database-id

* update comment

* [Permissions] Prevent "Granular" option in DB View Data options from changing permissions to unrestricted (#46976)

* fix

* adds back most of the code and limits it to only happen with impersonations, updates test to handle differing logic between the two flows

* removes test that is not longer needed

* more sandbox join table perms tests

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-08-19 16:33:43 -05:00
Mahatthana (Kelvin) Nomsawadi
668b6f36ed Update outdated loki snapshots (#46950)
* Update outdated loki snapshots

* Update the line snapshot using the one from CI

* try bumping the timeout to reduce flake

* Revert the linechart snapshot since it's still flaking

* skip the flaking story for themed line chart

* skip the flaking story for line chart

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Phoomparin Mano <phoomparin@gmail.com>
2024-08-19 14:41:30 -06:00
Oleksandr Yakushev
ce972eea52 perf: Remove redundant fetching of field values during DB sync (#46674) 2024-08-19 23:16:34 +03:00
Alex Yarosh
7cb5c14421 docs: special field filter syntax (#46982)
* field filter syntax

* Update docs/questions/native-editor/sql-parameters.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-19 19:36:27 +00:00
Nemanja Glumac
2899046d8c tech: Remove the last GoogleAnalytics tracking bits and references (#46980)
* Remove simple references to `trackStructEvent`

* Remove `withAnalytics` entities helper

* Remove `trackLoginSSO`

* Remove auth trackers

* Remove permissions trackers

* Remove performance trackers

* Remove settings trackers

* Remove pulse trackers

* Remove undo trackers

* Remove click actions trackers

* Remove `trackStructEvent`

* Remove GoogleAnalytics from the server security middleware

* Remove GoogleAnalytics from Kondo config

* Fix type failures

* Revert "Remove GoogleAnalytics from Kondo config"

This reverts commit 363557c44f.
2024-08-19 17:25:44 +00:00
John Swanson
57e1a4fba0 Allow missing Content-type header on GeoJSON (#46920)
If the content-type header is missing entirely, let it through. We're
not trying to be overly restrictive here, just prohibit things that are
clearly not GeoJSON.

Fixes https://github.com/metabase/metabase/issues/46918
2024-08-19 08:53:06 -07:00
github-actions[bot]
7bbf91fdb4 Update Translations for v50.21 (#46609)
* Add new strings for v50.20

* update translations for 50.21

---------

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-08-19 15:44:40 +00:00
lbrdnk
4b31f83c03 Throw reasonable error when incompatible temporal unit is used in time unit parameter (#46525)
* Throw reasonable error when incompatible temporal unit is used in time unit param

* Remove redundant function

* Add :curated flag to catch exceptions

* Update test/metabase/query_processor_test/date_bucketing_test.clj

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

* Address review remarks

* Update test

* Make vars private

---------

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-08-19 17:28:40 +02:00
Ryan Laurie
c78b46d62b Remove unnecessary calls to /api/collection (#46752)
* use ee api to find custom reports collection

* remove deprecated hook

* fix race condition

* add unit tests

* fix circular dependency

* fix unit tests

* another plugin strategy
2024-08-19 14:48:54 +00:00
Kamil Mielnik
65ac2f18ca Remove unused @ts-expect-error directive (#46959)
- use createQuestionAndDashboard helper instead of command
- sort imports
2024-08-19 11:58:08 +00:00
Chris Truter
df1b106f52 Simple util to measure allocations for single-threaded code (#46951) 2024-08-19 10:41:43 +00:00
Kamil Mielnik
2aad9b407b Refactor e2e JavaScript API commands to TypeScript function helpers (#46934)
* Remove unused file

* Refactor getCurrentUser command to a TS function util

* Refactor createAlert command to a TS function util

* Refactor createModerationReview command to a TS function util

* Reuse createModerationReview

* Refactor createPulse command to a TS function util

* Remove references to deleted files

* Improve typing
2024-08-19 09:14:31 +00:00
Cam Saul
23725b4e9d Misc Kondo Config cleanup (#46907)
* Kondo Config cleanup

* Restore warnings for with-log-messages-for-level until #28827 is merged

* Updated clojure.test hooks

* Fix kondo warning

* Time for me to learn to spell
2024-08-16 16:48:13 -07:00
dpsutton
5e70671108 Include missing opts arg for transform->nested (#46944)
was missing from the call.

Also had to disable hooks to commit:

```
✖ clj-kondo --config ./.clj-kondo/config.edn --config-dir ./.clj-kondo --parallel --lint:
metabase/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj:458:20: warning: Unresolved var: ts/extract-one
metabase/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj:1691:8: warning: Unresolved var: mbc/ensure-audit-db-installed!
metabase/enterprise/backend/test/metabase_enterprise/serialization/v2/extract_test.clj:1757:18: warning: Unresolved var: ts/create!
linting took 247ms, errors: 0, warnings: 3
error Command failed with exit code 1.
```
2024-08-16 16:47:39 -06:00
Aleksandr Lesnenko
c6141aa747 use echarts tooltip (#46359)
* use ECharts tooltip on cartesian charts

* fix tooltip lag when changing hovered series

* facelift tooltip

* fix static viz crashes due to tooltip option

* facelift

* pie chart echarts tooltip

* facelift

* facelift

* facelift

* tweaks

* e2e specs

* return back the pie other slices tooltip

* more specs

* specs

* fix pie total

* fix tooltip overflow

* fix specs

* fix infinite rerender in embedding mode for charts that have warnings

* Update Loki Snapshots

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-08-16 11:39:07 -04:00
Alexander Solovyov
3b0e3a6b9c [serdes] extract-nested instead of relying on hydration (#46912) 2024-08-16 15:36:31 +00:00
Cam Saul
d959430ab9 Beautiful log message capturing ⭐ 😻 (#28827)
* Beautiful log message capturing ⭐ 😻

* Don't have log.cljs try to load log.capture, don't know how to make that work

* Remove restriction against use in parallel tests

* Fix tests using invalid syntax

* Port legacy tests

* Make this stuff work with Cljs

* Fix bad syntax

* Convert usages of old version of with-log-messages-for-level to new version

* Update other stuff to use the updated macro

* Fix stuff

* Fix Cljs tests

* Fix world's largest test

* Appease Kondo

* Fix comment

* ClojureScript: only emit capture code in dev builds
2024-08-16 17:17:45 +03:00
github-automation-metabase
d48bfdb7f7 Update Readme version references and published npm version to 0.1.31 (#46931) 2024-08-16 14:14:32 +00:00
Oleksandr Yakushev
6b9b5d9836 Fix warnings/errors in memoized-supports? when SnakeHatingMap is passed as database (#46868) 2024-08-16 16:50:08 +03:00
Jeff Bruemmer
4bc9b1fbaa docs - notes on memory usage (#46156)
* notes on memory usage

* typo

* Update observability-with-prometheus.md

* Update running.md

* update link

---------

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
2024-08-16 08:34:49 -05:00
Roman Abdulmanov
62e7619798 Update team.json (#46922) 2024-08-16 14:15:28 +01:00
Denis Berezin
b9ba40d88a feat(sdk): Add CreateDashboardModal component and hook (#46802) 2024-08-16 13:10:59 +00:00
Nemanja Glumac
9c887592be MS4: E2E sandboxing test coverage for "Link to the data source from notebook" project (#46903)
* Add sandboxing E2E tests

* Fix types

* Ignore TS error for now
2024-08-16 11:55:47 +00:00
Oisin Coveney
8394213df0 feat(sdk): Create Question (#46618) 2024-08-16 14:17:57 +03:00
Ngoc Khuat
147985f1a3 no top level trs (#46911) 2024-08-16 10:11:48 +00:00
Anton Kulyk
8272ac4760 Fix public dashboards are cut when printing (#46829)
* Fix public dashboards are cut when printing

* Add comment
2024-08-16 10:18:13 +01:00
Uladzimir Havenchyk
0f306ca5eb fix CSP error in prod (#46890) 2024-08-16 11:42:29 +03:00
Chris Truter
28e5fac967 Put a band-aid around flake with spec generator (#46762) 2024-08-16 10:08:10 +02:00
Ngoc Khuat
015ca44ea5 Fix unable to send pulse with multi-series (#46908) 2024-08-16 13:59:10 +07:00
Oleksandr Yakushev
2c3a214f31 perf: Optimize CSV exporting (#45757)
* perf: Use more efficient iteration and formatting in CSV export

* perf: Replace clojure.data.csv functions with more efficient implementations

* fix: Fix formatting for integer numbers in scientific notation
2024-08-15 22:24:27 +00:00
bryan
a43b09cdfe skip some troubleshooting stats when hosted (#46749)
* skip some troubleshooting stats when hosted

* fix typo

* just skip "system-info" and "app db details"
2024-08-15 19:16:18 +00:00
Chris Truter
10ecdd7ccf Remove double prefix (#46884) 2024-08-15 19:28:53 +02:00
Uladzimir Havenchyk
606a163086 ci: enable cypress-terminal-report only at CI (#46866)
* disable cypress-terminal-report locally

* one more check

* cleanup
2024-08-15 20:26:04 +03:00
Alex Yarosh
d842fad9b3 docs: concat clarification (#46851)
* concat

* we fixed this!

* format

* links

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-08-15 12:06:11 -04:00
Chris Truter
d2fc33a3b5 Add missing field to serialization exception (#46883) 2024-08-15 10:37:22 +00:00
Uladzimir Havenchyk
bb79405630 ci: deduplicate e2e-tests clojure cache (#46770) 2024-08-15 13:03:58 +03:00
Mahatthana (Kelvin) Nomsawadi
acf87c0cdb Remove incorrect logic to hide hidden db fields (#46876) 2024-08-15 09:23:27 +00:00
Oleksandr Yakushev
1e9bd94d9b perf: Reuse ZoneRegion/UTC instead of creating new object when parsing dates (#46871) 2024-08-15 12:15:34 +03:00
Chris Truter
121b89ab07 Clean up serdes v2 exceptions (#46577) 2024-08-15 09:07:06 +00:00
Nicolò Pretto
e79b57b11e reduce logs during setup tests (#46834)
* refactor: memoize getSteps selector

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

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

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

* Fix all tests using hardcoded driver names

* Test fixes 🔧

* Appease Kondo

* Remove normal-drivers-except

* Test fix 🔧

* Test fixes 🔧

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

* migrate Recipient Picker

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

* Add tests

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

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

* Adjust offset input labels based of comarison type

* Pass comparisonType to column picker

* Add current period picker

* Use deepCompareEffect to avoid rerender loops

* Add moving average helpers

* Add moving average clause to query

* Prevent less than 1 period moving average from being created

* Fix unit test for CompareAggregations

* Use the ComparisonType type for the comparisonType arg

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

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

* Remove unused parameter

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

* Use expression parts in test

* Use named arguments for movingAverage

* Fixup test for moving average offset input

* Fix type issue

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

* update question state

* reload metadata for runQuestionOnNavigate

* fix runnable queries

* fix cannot run question

* extract question predicate functions to question.ts

* update types

* create utils subfolder for query builder

* fix query builder predicate imports

* naming tweaks to be more self-explanatory

* document the non-intuitive loadQuestion useEffect

* change imports to support metric

* remove unused import

* revert originalQuestion check to try to fix e2e failures

---------

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

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

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

* Add test

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

* Add helper to pick default breakout

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

* Add updateQuery to AggregationPicker props

* Add tests for creation and reordering of temporal breakouts

* Reuse defaultTemporalBucket in withDefaultTemporalBucket

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

* Remove dependency on referential equality of breakout

* Rename updateQuery to onQueryChange

* Remove onAddAggregations and onUpdateAggregation for onQueryChange

* Extract query update in to separate function

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

* Remove aggregations from summarize details

* Fix e2e tests

* Remove conflicting test

* Fix recent clause in unit tests

* Fix superflouous check for columnAndBucket

* Future proof breakout check

* Remove reliance on details in the useSummarize hook

* Remove details in unit tests

* Removal of default summarization should not trigger a query change
2024-08-14 10:25:22 +02:00
Mahatthana (Kelvin) Nomsawadi
763ebb7421 Fix exported png got different backgrounds based on screen density (#46769) 2024-08-14 08:15:16 +01:00
github-automation-metabase
e2bcdb1462 Add v0.50.20 to the list of releases (#46804)
* Add v0.50.20 to the list of releases

* Update releases.md

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2024-08-14 00:54:12 +00:00
metamben
e4d8849516 Fix handling explicit joins in metrics (#46798) 2024-08-14 02:43:30 +03:00
Alexander Polyankin
a7e59b9863 Expect broken field refs in filter drills (#46691)
* Handle column matching errors

* Fix test

* Fix test

* Fix test

* Fix test

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

* Try to fix dashboard-filters-number flake

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

* Add `multiline` prop to `Ellipsified`

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

* relax constraints on migration timestamps

* more migration rewrites

* fix bug in migration

* fix another bug and remove extraneous logging

* reorder migrations to fix ID validation

* start adapting the changes to mysql as well

* wip

* add more ANALYZE calls

* revert logging changes

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

* create H2 versions of migrations without the ANALYZE calls

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

* fix mysql syntax

* fix another mysql bug

* another mysql fix

* Don't exclude inactive tables for data_access

* Don't write rows for Administrators group

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

* disable triggers before perms migration

---------

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

* fix settings definition

* update environment variables for cli

* handle instances not being ready

* update error messages

* add more specific loading messages

* loading spinner state

* improve error message

* use a fixed demo setup token

* remove extraneous spinner

* update status checks

* update container messages

* update wait timing

* create api keys

* extract constants

* remove manual steps

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

* Modify SDK for better structure

* remove line from print.ts

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

* Add types and add quick note

* Fix a typo

* Add index file, simplify types, use an array

* Add safer json parsing

* use delay of 100ms between each setup call

* Suggestions from review

* ensure that cli works

* Attempt to fix jest errors

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

* add database connection

* add connection details handling

* refactor asking for database connection info

* apply actual database id for syncing schema

* fix failing database sync step

* allow table selection

* create model for each table

* handle errors in model creation

* fix incorrect model display name

* create x-rays based on user data

* consolidate instance setup message

* workaround for inquirer eventemitter issue

* add sample components

* fix yarn.lock file

* add sample components

* set spinner to fail state when instance setup fails

* use a transparent background by default

* update cli welcome messages

* add import notice

* refactor imports

* update snippet to add dashboard dropdown

* cli add credential file to users .gitignore

* add docs on quickstart

* clear screen with console.clear

* address code review feedback

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

* allow node 18 lts

---------

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

* debug conventional commit reminder

* debug conventional commit reminder

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

* Fix snapshot now showing the tooltips and dropdowns

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

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

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

* Show new model loading state while fetching

* Add unit test

* Use `DelayedLoadingSpinner` instead

* Update the test

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

* Prettier

---------

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

WIP

Fixes 46244

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

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

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

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

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

* add test to show that insights are computed

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

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

* Add testcase

* Make auxillary formatter private

* Catch a more specific exception

* Throw IllegalArgumentException on invalid dates

* Use strict resolver and fix test

* Empty commit to assign credit where it's due

---------

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

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

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

Partially implements: #28144

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

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

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

* add test confirming the default limit works

* fix test to use the download-row-limit

* address review feedback

* Update src/metabase/public_settings.clj

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

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

---------

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

* Remove type casts

* Improve dimension instantiation

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

This reverts commit 5375347e33.

* humanize coercion strategies, add e2e test

* unit test adjustment

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

* fix lint errors

* use ts-deepmerge

* don't throw an error

* use correct type

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

* check for download status in the container

* try fixing flakes again

* try again

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

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

* Open browse model links safely on a subpath

* Uniform naming

* Use the existing URL helper

* Trim url

* Add unit tests

* Add one more test case

* Fix test name 😅

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

WIP

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

Fixes #27374

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

* number formatter merges settings from columns too

* column formatting on aggregated cols works in xlsx now too

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

* Fix wrong colors when passing empty SDK `colors`

* Clean up CSS custom properties

* Add missing color mapping to the SDK

* Add missing colors to the main app

* Only override additional dynamic colors when values are passed

* Fix unit tests

* Address review

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

---------

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

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

* Fix missing icon property

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

* Update copy in tests

* Add test for questions with no temporal columns

* Fix unit test for AggregationPicker

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

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

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

* Update copy in tests for actions and drills

* Move canAddTemporalAggregation to CompareAggregation utils

* Use aggregations from the query always

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

Fixes #46368

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

* Update src/metabase/query_processor/dashboard.clj

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

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

---------

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

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

In #45575 we introduced casting uuid fields for drilldowns.

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

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

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

* Conditionally display tooltip

* Add unit tests for the data step

* Add unit tests for the join step

* Move the abstraction to the NotebookDataPicker

* Cover the tooltip behavior with E2E test

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

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

* updating tests

* unit tests

* e2e test

* PR Feedback

* log questions / models

* Accept :dataset instead of :model

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

* Add e2e for collection moving error

---------

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

* Rename test and add assertions

* Add broken test for models

* Add unit of time tests

* Deduplicate code

* Add date parameter tests

* Add test for multiple stages

* Fix model test setup and refactor getColumnsInfos

* Remove redundant assertions

* Format codee

* Extract createQuestion and createModel

* Add unit of time model tests

* Add test for model

* Extract constants

* Add a warning

* Build dataset queries with mbql

* Introduce queryOrders

* Revert redundant change

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

* Disable broken test

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

* [DEBUG] trigger conventional commit reminder

* fix syntax errors

* Mock update

* mock another update

* 3rd update

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

* Remove all code relating to testing

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

* Make hover and selected state consistency

* Fix wrong embed frame border color

* Refactor: extract props

* Fix border color

* Fix pivot table cell hover color

* Fix smart scalar text contrast

* Add smart scalar tests + update text color design

* Theme dashboard card menu

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

* Fix storybook background color for dark theme

* Update loki snapshots

* Disable untestable tests

* Make sure all storybook inherit all necessary base styles

* Skip untestable tests

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

* fix settings definition

* update environment variables for cli

* handle instances not being ready

* update error messages

* add more specific loading messages

* loading spinner state

* improve error message

* use a fixed demo setup token

* remove extraneous spinner

* update status checks

* update container messages

* update wait timing

* create api keys

* extract constants

* remove manual steps

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

* Modify SDK for better structure

* remove line from print.ts

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

* Add types and add quick note

* Fix a typo

* Add index file, simplify types, use an array

* Add safer json parsing

* use delay of 100ms between each setup call

* Suggestions from review

* ensure that cli works

* Attempt to fix jest errors

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

* add database connection

* add connection details handling

* refactor asking for database connection info

* apply actual database id for syncing schema

* fix failing database sync step

* allow table selection

* create model for each table

* handle errors in model creation

* fix incorrect model display name

* create x-rays based on user data

* consolidate instance setup message

* workaround for inquirer eventemitter issue

* fix yarn.lock file

---------

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

* Fix Metabase badge color

* Fix wrong mixed brand colors

* Add mistakenly removed colors

* Update comments

* Correct `brand-light` color

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

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

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

Fixes #38051
Fixes #36262
Fixes #11755

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

* try fixing pie e2e flake

* try fixing pie e2e flakes

* last resort

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

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

* fix loki-update command

* Update Loki Snapshots

---------

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

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

== How to test ==

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

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

* add story

* Update Loki Snapshots

* add e2e test

---------

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

* Handle non-numeric values in NumberFingerprint

* Be more realistic about NumberFingerprintDisplayInfo type

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

* fix settings definition

* update environment variables for cli

* handle instances not being ready

* update error messages

* add more specific loading messages

* loading spinner state

* improve error message

* use a fixed demo setup token

* remove extraneous spinner

* update status checks

* update container messages

* update wait timing

* create api keys

* extract constants

* remove manual steps

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

* Modify SDK for better structure

* remove line from print.ts

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

* Add types and add quick note

* Fix a typo

* Add index file, simplify types, use an array

* Add safer json parsing

* use delay of 100ms between each setup call

* Suggestions from review

* ensure that cli works

* Attempt to fix jest errors

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

* fix yarn.lock file

* revert capture groups change

---------

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

* fix env

* fix env

* fix refname

* create invalidation

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

* enable video recording

* revert error

* add a comment

* Update e2e/support/cypress.js

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

---------

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

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

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

== How to test ==

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

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

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

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

Before this change:

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

After:

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

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

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

* Add relativeDateFilterPartsRelativeTimeInterval

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

* Update desugar-relative-time-interval

* Define relative-time-filter op

* Add or update tests

* Update tests

* Update display-name-method

* Update test

* Fix positive relative-time-interval shift

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

* Update var name

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

* Update dataset kondo hook

* Generate cache required for kondo hooks in kondo.sh

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

* Fix selectors and getSubmittableQuestion

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

* add repro for 40750

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

* WIP

* Implement the new functionality with `pickerInfo`

* Use destructured value

* Add the simplest possible E2E test as PoC

* Smoke test

* Add basic coverage for questions

* Add basic coverage for models

* Source question has been archived scenario

* Add basic permissions test

* Expand to the user without wite query permissions

* Fix title

* Add another permission scenario

* Add E2E coverage for a source being native

* Add coverage for the native model

* Address review comment re: `pickerInfo`

* Extract `getUrl` to utils

* Add support for the middle/scroll click

* Add unit tests

* Add a negative test case

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

* Remove old getColumnKey

* Remove old getColumnKey

* Fix export

* Change comment

* Change comment

* Change comment

* Change comment

* Add RemoveFieldRefsFromDashboardCardColumnSettings

* fix

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* chore

* Fix

* Fix

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Update loki

* Update loki

* Fix the homepage dashboard being loaded everywhere

* Fix the homepage dashboard being loaded everywhere

* Fix tests

* Fix tests

* Fix tests

* Fixes

* Fix tests

* Fix tests

* Fix tests

* Fix

* Fix

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fixes

* Fix typo

* Fix types

* Improve migration performance

* Fixes

* Revert changes

* Revert changes

* Revert changes

* Revert changes

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

couple things come together here.

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

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

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

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

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

,,,

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

And this later has unescaped curlies.

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

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

* Bump Malli version

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

Fixes #46259

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

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

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

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

* Throw away `collection_id` when marking archived

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

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

---------

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

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

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

* Add filter visual tests

* Simplify embed CSS colors

* [WIP] theme filter popover

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

* Fix embed colors

* Theme part of ParameterFieldWidget

* Add story for parameter with dropdown

* Update loki snapshots

* Update more popover style

* Update loki snapshots

* Remove outdated snapshots

* Update loki snapshots with production build

* Fix loki not working with `userEvent`

* Theme mantine popover

* Improve dark theme text-brand visibility

* Update loki snapshots from master change

* Fix new colors not working in SDK

* Fix flaky Loki tests

* Filter popover dark theme part 2 (#46284)

* Theme Date all options

* wip add month and year filter

* Fix wrong CSS custom property declaration

* Test hover state

* Update Loki snapshots

* Theme date month and year

* Add quarter and year tests

* Theme date single and date range

* Style relative date

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

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

---------

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

* Complete theming filter popover night mode (#46365)

* Style unit of time and number widget

* Attempt to fix flaky Loki snapshots

* Address white background checkbox on dark theme

* Style search filter single value

* Fix mis color

* Update snapshots

* Remove duplication on play functions since they're long

* Milestone 2 polishing (#46382)

* Matches the footer padding with header padding

* Update snapshots

* Add E2E to prevent further problem

* Try to reduce flaky Loki tests

* Remove unused color shades (#46421)

* Update no results illustration to work better on dark theme

* Update loki snapshots

---------

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

* Reuse existing helper

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

* Merge TS command definitions into a single file

* Export types

* Make dashboardDetails optional

* Export StructuredQuestionDetails

* Remove duplicated function

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

* Reuse const

* Add test for unit of time parameters

* Improve assertions

* Extract createDashboardWithParameters

* Add tests for time parameters

* Fix hardcoded parameter_mappings ids

* Format code

* Extract checkButtonVisible

* Improve test names

* Add tests for location parameters

* Reuse const

* Update test name

* Add WidgetStatusButton

* Add unit tests for WidgetStatusButton

* Rename handler

* Remove redundant assertions

* Add iconSize prop

* Fix styling

* Replace WidgetStatusIcon with WidgetStatusButton
- Remove WidgetStatusIcon

* Fix tooltip issue

* Fix tooltip for good

* Use default compact button size

* Prevent overflow

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

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

* Update unit tests

* Rename WidgetStatusButton to WidgetStatus

* Explicitly specify what is a button

* Update helpers in tests

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

* Simplify label

* Remove utils

* Adjust padding

* Update reset icon

* Make the button gray when color is undesired

* Remove old definitions

* Add missing export

* Remove unused type

* Add test for location (single value)

* Add test for id (single value)

* Add more assertions

* Add test for id (multiple values)

* Improve name

* Add tests for number (single and multi value)

* Add tests for text (single and multi value)

* Rename file

* Update comment

* Update test name

* Use unique ids

* Use new color name

* Add a test for chevron icons alignment

* Lift className up

* Make types more specific

* Sort attributes

* Revert "Make types more specific"

This reverts commit 2e6994b5ed.

* Revert "Use new color name"

This reverts commit 2cc68df6ba.

* Remove TODO

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

* Connect label to the default value input in ParameterSettings

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

* Add parameter sidebar tests for unit of time

* Add parameter sidebar tests for date filters

* Extract checkParameterSidebarDefaultValue

* Add parameter sidebar tests for location - single values

* Add parameter sidebar tests for location - multiple values

* Use constants for test case names

* Add parameter sidebar tests for id parameters - single values

* Add parameter sidebar tests for id parameters - multi values

* Add parameter sidebar tests for number parameters - single values

* Add parameter sidebar tests for number parameters - multi values

* Add parameter sidebar tests for text parameters - single values

* Add parameter sidebar tests for text parameters - multi values

* Extract checkDashboardFilters

* Use checkDashboardFilters in time parameters

* Use checkParameterSidebarDefaultValue in checkDashboardFilters

* Use checkDashboardFilters everywhere

* Sort helpers

* Rename checkDashboardFilters to checkDashboardParameters

* Rename checkOnlyOneButtonVisible to checkStatusIcon

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

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

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

* Add test for sql filters - date

* Remove unused things, rename placeholder to labelOrPlaceholder

* Apply label only to 1 input

* Add test for sql filters - field parameters

* Fix date tests

* Make all sql filters tests work

* Add assertions for required without default in text filters

* Add assertions for required without default in date filters

* Add assertions for required without default in field filters

* Allow clearing required SQL filters without default value

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

* Update unit test

* Update helper

* Update e2e tests

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

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

* Add button boilerplate

* Add getCanResetFilters selector

* Move canResetFilters to utils

* Add explicit return types

* Implement the button action

* Rename

* Simplify action

* Optimize: use single action

* Use parameterHasNoDisplayValue to account for empty strings

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

* Rename getHiddenParameterSlugs to getTabHiddenParameterSlugs

* Take all tabs into account

* Add unit tests for canResetFilter

* Format test name

* Fix non-human-friendly aria-label

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

* Unnest helpers from describe

* Add a test for comma-separated values

* Improve typing

* Fix typing

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

* Improve test name

* Remove redundant util

* Remove redundant condition

* Verify card results get filtered

* Test that all tabs are affected

* Fix test case with autoApplyFilters: false

* Add tests for resetting to default value

* Fix wrong initial state in reduce

* Fix updated parameters not being applied

* Add reset all filters assertions

* Remove unused attribute

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

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

* Reuse existing helper

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

* Merge TS command definitions into a single file

* Export types

* Make dashboardDetails optional

* Export StructuredQuestionDetails

* Remove duplicated function

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

* Reuse const

* Add test for unit of time parameters

* Improve assertions

* Extract createDashboardWithParameters

* Add tests for time parameters

* Fix hardcoded parameter_mappings ids

* Format code

* Extract checkButtonVisible

* Improve test names

* Add tests for location parameters

* Reuse const

* Update test name

* Add WidgetStatusButton

* Add unit tests for WidgetStatusButton

* Rename handler

* Remove redundant assertions

* Add iconSize prop

* Fix styling

* Replace WidgetStatusIcon with WidgetStatusButton
- Remove WidgetStatusIcon

* Fix tooltip issue

* Fix tooltip for good

* Use default compact button size

* Prevent overflow

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

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

* Update unit tests

* Rename WidgetStatusButton to WidgetStatus

* Explicitly specify what is a button

* Update helpers in tests

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

* Simplify label

* Remove utils

* Adjust padding

* Update reset icon

* Make the button gray when color is undesired

* Remove old definitions

* Add missing export

* Remove unused type

* Add test for location (single value)

* Add test for id (single value)

* Add more assertions

* Add test for id (multiple values)

* Improve name

* Add tests for number (single and multi value)

* Add tests for text (single and multi value)

* Rename file

* Update comment

* Update test name

* Use unique ids

* Use new color name

* Add a test for chevron icons alignment

* Lift className up

* Make types more specific

* Sort attributes

* Revert "Make types more specific"

This reverts commit 2e6994b5ed.

* Revert "Use new color name"

This reverts commit 2cc68df6ba.

* Remove TODO

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

* Connect label to the default value input in ParameterSettings

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

* Add parameter sidebar tests for unit of time

* Add parameter sidebar tests for date filters

* Extract checkParameterSidebarDefaultValue

* Add parameter sidebar tests for location - single values

* Add parameter sidebar tests for location - multiple values

* Use constants for test case names

* Add parameter sidebar tests for id parameters - single values

* Add parameter sidebar tests for id parameters - multi values

* Add parameter sidebar tests for number parameters - single values

* Add parameter sidebar tests for number parameters - multi values

* Add parameter sidebar tests for text parameters - single values

* Add parameter sidebar tests for text parameters - multi values

* Extract checkDashboardFilters

* Use checkDashboardFilters in time parameters

* Use checkParameterSidebarDefaultValue in checkDashboardFilters

* Use checkDashboardFilters everywhere

* Sort helpers

* Rename checkDashboardFilters to checkDashboardParameters

* Rename checkOnlyOneButtonVisible to checkStatusIcon

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

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

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

* Add test for sql filters - date

* Remove unused things, rename placeholder to labelOrPlaceholder

* Apply label only to 1 input

* Add test for sql filters - field parameters

* Fix date tests

* Make all sql filters tests work

* Add assertions for required without default in text filters

* Add assertions for required without default in date filters

* Add assertions for required without default in field filters

* Allow clearing required SQL filters without default value

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

* Update unit test

* Update helper

* Update e2e tests

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

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

* Use parameterHasNoDisplayValue to account for empty strings

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

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

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

* Render the correct label in the dropdown for number inputs

* Mock paramter values endpoint in number input test

* Add test for custom labels on number input

* Fix number input test

* Allow entering comma separated values using labels

* Only show custom labels in popover

* Use getLabel and getValue helpers to avoid indexing confusion

* Remove calls to parameter endpoints for number input

* Do not parse the value from the label

* Add support for number parameters in the source picker modal

* Filter number values

* Add e2e test for number parameters with custom source

* Remove card option for number parameters

* Set the correct initial value for number parameters without fields

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

* Fix e2e tests for number lists

* Remove e2e tests for card source dashboard filters

* Add tests for native filter custom source

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

* Clear values_source_config when changing parameter type

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

* Clear and restore values_source_config for template tags when chaning type

* Add e2e test for restoring of template tag sources_value_config

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

* Fix input type for numbers

* Fix broken test

* Display labels for ParameterValuePicker too

* Clear and restore values_source_type when changing parameter type

* Clear and restore values_source_type for tag parameters

* Clear and restore values_query_type when changing parameter type

* Clear and restore value_query_type for parameters tags

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

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

* add unit spec

* add stories

* Update Loki Snapshots

* add placeholder text

---------

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

* spec

* Update Loki Snapshots

---------

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

* fix a lot of tests

* fix more tests

* fix unit tests

* remove comment

* update tests and formatting

* add debug code

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

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

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

* use the actual url for stale

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

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

* impls pr feedback

* fixes

* fixes failing unit test

* completes pr feedback from raffi

* implements second round of feedback from raffi

* adds tests and couple of small fixes / feedback

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

* finish main base case e2e test

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

* better handling of min-height on smaller screens

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

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

* pr feedback

* further cleanup

* unit test fix

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

---------

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

* test notebook button visibility for new questions

* move brand new check inside shouldRender

* test embedding SDK notebook button

* update unit tests

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

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

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

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

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

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

* Fix hardcoded collection ID

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

* Add test

* Update values-from-card-query

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

* disable clear button when set by env var

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

* add unit tests for SMTP connection form

* BONUS: fix console error for jt keys

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

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

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

* make unit tests pass

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

* fix unit test

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

* copy schema file for better diff

* adds downloads field to appearance in embed_flow schema

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

* fix test for dwonloads: false

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

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

* copy schema for better diff

* adds `dashboard_accessed_via` to the `dashboard_pdf_exported` event

* download_results_clicked event (#46132)

* adds download_results_clicked event + e2e tests

* make strings nullable

* adds maxLength

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

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

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

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

* edit comment

* adds test for ad-hoc-question

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

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

* makes describe message more consistent

* "else if" => if

* fix describe block name

* convert downloads event to use enum for download_type and export_type

* resource_type should be an enum too

* fix line added in the wrong place during merges

---------

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

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

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

* adds enum schema to dashboard_accessed_via

* fix accessed_via for sdk embeds

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

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

* remove un-needed async/await from saveAsPDF function

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

* fix cy.log message

---------

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

* change download pdf button color to brand color

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

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

* add e2e test

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

* refactor args

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

* fix db connection form icons

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

* Use :default temporal-unit

* Simplify logic, update comments

* Update substitute-field-filter-test

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

* Update field-filter-date-test

* Use end-excludding gte lt filter for DateTime fields

* Update substitute-field-filter-test

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

* Update field-filter-date-test

* Update bigquery test + comment

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

* Add guard for unexpected date string format

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

* Address review remarks

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

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

* better error handling

* update schedule

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

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

* Fixup bad git merge on test expectation

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

* Update releases.md

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
2024-08-01 09:35:32 -04:00
lbrdnk
72a201819b Add :relative-time-interval mbql function (#46211)
* Add :relative-time-interval mbql function

* Add relativeDateFilterPartsRelativeTimeInterval

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

* Update desugar-relative-time-interval

* Define relative-time-filter op

* Add or update tests

* Update tests

* Update display-name-method

* Update test

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

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

* Add `effective_ancestors` to collection data

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

* Consolidate effective ancestors

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

- it never has the Root Collection, and

- the ancestors don't have a `personal_owner_id`

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

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

* setup rendering pipeline for static pie chart

* remove more donut code from BE

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

* compute viz settings for static pie chart

* create chartModel for pie chart (#43549)

* create chartModel for pie chart

* render static pie chart (#43550)

* render static pie chart

* render static pie chart legend (#43551)

* disable animation

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

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

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

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

* echarts pie

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

* add loki specs

* save snapshots

* fix small slices disappearing

* update snapshots

* add repro story for exteremely small slice

* add snapshot

* fix rounded total

* fix percent formatting in legend

* fix date dimension formatting

* fix binned and relative date dimension labels on legend

* add specs and snapshots for null and unaggregated dimensions

* hide overlaping labels on chart

* fix null dimension color

* show error when metric column has a negative value

* move legend to botom

* make dot margin smaller

* add columns to legend

* sort legend vertically

* dont use grid if only one row for legend

* never hide legend in static viz

* fix empty column culling

* show single legend item

* add long dimension name story

* fix long dimension name in legend

* right justify percentages in legend

* remove negative error and re-add stories

* handle negative values

* create chart definition for dynamic pie chart

* render chart with responsiveness

* add comment for borderWidth calculation

* center legend

* fix legend centering

* add story for missing currency formatting

* fix missing currency formatting

* fix graalvm crashing

* fix column settings computation

* add another currency formatting repro

* fix wrong order of col settings computations

* convert colors to hex

* fix colors missing from viz settings

* temp todo comment

* fix colors in dynamic viz

* update snapshots

* fix crashing due to invalid dimension/metric setting

* fix chart crashing for boolean dimension with labels on chart

* add repro

* fix regression in label formatting

* fix labels on small slices

* update specs

* emphasis state for slice hover

* recreate old label hiding logic

* include height measurement in getIsLabelVisible

* move d3 slices to chart model

* fix labels on static viz

* wip basic hover state and tooltip

* fix emphasis style getting stuck by memoizing everything

* update total display value

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

* handle other slice in tooltip

* fix bugs in total graphic

* use OTHER_SLICE_KEY const in static viz legend

* implement legend and connect to hover state

* implement click actions

* fix slice not clickable

* handle all zero slices

* add repro

* update specs

* update pie_chart.cy.spec.js

* update chart_drill.cy.spec.js

* add repro for single column legend

* use minimum 2 legend columns

* fix legend text overlap

* use more margin for single row legend

* update specs

* add repro for 28568

* add repro for 38424

* fix percent label not showing on large slices

* hide total text when chart is small

* replace comment about animations

* show warning for mixed positive and negative values

* delete old chart files

* fix type errors

* update d3 import

* update specs

* remove branch from uberjar.yml

* dont put single slice into other

* fix lint errors and pie render test

* update more d3 imports

* remove unused settings

* revert preview-card-width change

* remove unused import

* remove majorWidth option from formatting

* use debounceLeading refresh mode in ChartWithLegend

* remove TOTAL_GRAPHIC_OPTION constant

* delete unit test for pie chart

* fix failing test by doing set comparison instead

* fix typo in comment

* remove SUNBURST_SERIES_OPTION constant

* fix lint by removing unused eslint-disable

* move default color computation to getValue

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

* update pie border color for night mode and embedding

* fix styles for embedding case and add stories

* skip embedding stories

---------

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

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

* import updated translations

---------

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

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

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

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


---------

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

* Improve the test structure and assertions

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

* upgrade jest

* drop useless types

* drop babel-jest

* fix types

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

* Update naming

* Update naming

* Add client header for embedded context

* Add client header for embedded context

* Add sdk version header

* Fix e2e

* Fix storybook build

* Refactor to inject version in build step

* Fix unit tests

* Self review

* Fix e2e

* Fix e2e

* Fix e2e

* Fix e2e

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

* deduplicate webpack deps

* add ^

---------

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

* specs, public dashboards

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

* Restore fancy color hover states

* Add css modules

* oh the cleverness of me

* better var name

---------

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

**Better basic memoization**

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

**Bounded memoization**

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

**Fast JVM versions**

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

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

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

* Only assert the resize down

* Refactor repro 31701

* Remove flaky tag

* Better organize describe blocks

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

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

* Reuse existing helper

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

* Merge TS command definitions into a single file

* Export types

* Make dashboardDetails optional

* Export StructuredQuestionDetails

* Remove duplicated function

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

* Reuse const

* Remove old definitions

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

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

* Fix

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

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

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

* e2e test disabled moving search and recent items

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

* include api tests for query_execution and view_log

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

- disambiguate names used in tests

* pass test + cleanup test helper

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

* Remove unused properties

* Remove comment

* Experiment

* Simplify

* general cleanup and adding dashboard links handling

* fix tests, link cards; sort output

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

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

* Fix tests

---------

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

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

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

---------

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

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

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

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

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

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

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

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

* I missed a linter warning

* fix tab rendering

* fix test

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

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

---------

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

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

* migration adding embedding_client and embedding_version to qe and vl tables

* clarify function api

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

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

* update update migrations

* add predconditions to migrations

* fix tablenames + dataset_test

* Code Review responses

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

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

* Remove the Trash Collection from serialization

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

* fix: automatic Tusk self-review

---------

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

* use new built-in mu/defn-

* mu/defn- preserves metadata

---------

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

* Add TODO for the remaining tasks

* Make a test name consistent with others

* Finish the E2E test for #27643

* Fix the test to use PostgresDB

Since H2 originally doesn't fail the test

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

* Create QA snapshot with fully synced field metadata

* Fix failed tests from field metadata change

* Simplify question scenarios

* Simplify dashboard scenarios

* Fix permissions

* Rework titles

* Add comment about PG

* Add limit to speed things up

* Fix and improve dashboard assertions

* Fix and improve question assertions

---------

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

Fixes 45953

WIP

* use new-page in values-iterator

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

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

Fixes #41640

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

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

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

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

This fixes it by just taking last instead of destructuring.

* correct comparison to always use abs value in conditonal check

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

* Fix `PublicOrEmbeddedDashboardPage` tests

* Add tests

* Remove redundant dataset error checks

* Revert "Remove redundant dataset error checks"

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

* Fix syntax

* Add qa_db to workflow summary

* Only run necessary containers

* Fix QA DB snapshots running when QA_DB_ENABLED=false

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

* Make the whitespace linter happy

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

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

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

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

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

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

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

* Speed up the test by limiting the number of rows

* Make the repro more correct, and more resilient

* Remove intercepts

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

* Fix the test

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

* Update docs/permissions/data.md

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

---------

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

* add requirements checking

* docker check

* docker start command

* port checks

* add getting started steps

* add final install message

* cleanup cli text

* handle force-closing prompt

* build the cli when running build-embedding-sdk

* wording updates

* add redundant prompt in case of small terminals

* remove redundant instruction

* make sure the user confirms the step

* change container name to metabase-enterprise-embedding

* migrate cli to es modules instead of webpack

* add shebang line for npx

* add cli dependencies to devDependencies

* Revert "add cli dependencies to devDependencies"

This reverts commit 5d5e952c2b.

* Revert "add shebang line for npx"

This reverts commit 766fdda09e.

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

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

* Update existing tests

* Fix table hovercards E2E flake

* Fix repro 37009

* Update repro 30680

* Add comment

* Fix nested question flake

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

Fixes: #40292

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

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

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

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

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

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

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

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

* Embed preview should always use params from the token

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

* for previews, merge the embedding params sources instead

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

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

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

* fix an e2e test

* fix up last 2 failing e2e tests

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

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

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

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

- first, run the hydration method without counting DB queries

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

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

* Add e2e repro

* E2E repro

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

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

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

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

---------

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

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

* address review comments feedback

* extract useSdkContext

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

* adds the shim

* use ReactDOM.render instead of createRoot for backwards compat

* use createRoot for React 18 environment

* refactor renderRoot compatibility

* remove semver dependency

* add small test for version

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

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

* more notes

* edits

* update app db page

* file-based db mention

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

* clean output

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

* Revert "what does this break?"

This reverts commit 93e09edeb3.

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

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

* uncomment

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

* Refactor test

* Add repro for 'on' filter

* Fix metabase#39487

* Refactor test

* Change order of tests

* Improve assertions

* Group tests

* Add tests for filter pills

* Refactor tests

* Rename helpers

* Add filter modal tests

* Add tests for filter drill

* Add notebook tests

* Fix test

* Add one more repro

* Fix typo

* Optimize tests

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

* Update tests

* Improve comment

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

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

* Add comment

* Make ace editor slightly more resilient to re-renderings

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

* Update E2E tests

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

* Add bucketing to expression references

* Restore original schema

* Update e2e test

* Update test as per review remarks

* Apply suggestions from code review

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

* Remove alignment

* Rename ::field-type-info

* Update log level

* Remove redundant log

---------

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

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

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

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

* Refactor assertions

* Add repro for #33708

* Fix typo

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

* Remove Replay config

* Install and use custom Chrome v111

* Simplify comment

* Set a specific Chrome version commit

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

Fixes #37074

* Only change alias if conditions or table changed

* Fix test

* Fix fe test

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

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

* Fix right section in MultiSelect

* Update MultiSelect.styled.tsx

* Add a test

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

* Remove can_run_adhoc_query from the FE

* Disable can_run_adhoc_query on dashboard

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

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

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

* Fixup test from disabling can_run_adhoc_query

---------

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

* PR feedback

* PR feedback

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

* add foreground color test

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

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

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

* don't show unjoinable things in recents either

* unskip repro

* fix types

* fix repro

* fix tests in model/recent_views

* add unit test for invalid join in recents

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

* update type

* improve unit tests

---------

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

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

- updated whenever the QP processes a query for a dashcard

---------

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

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

This reverts commit a8b511fa28.

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

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

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

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

* Disable :foreign-keys on Mongo

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

* Update implicit joins tests

* Adjust sync-fields-test

* Update implicit joins feature check test

* Transform post-sync-hook to normal function

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

* Update test to handle Oracle correctly

* Split convoluted fn

* Avoid unnecessary computations for datasets with no fks

* Update docstring

* Fix driver usage

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

* Update sync_test.clj

* Update driver_test.clj

* Update moviedb.clj

* Update dataset_definition_test.clj

* Update fetch_metadata.clj

* Update fields_test.clj

* Update driver.clj

* Update driver/sql.clj

* Set sql driver join support to true for all joins

Deriving drivers are expected to set to false where applicable.

* Update sqllite.clj

* Remove foreign-keys from spark

* Remove :foreign-keys from presto

* Remove :foreign-keys from Athena

* Remove foreign-keys from big query

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

* Update test_metadata.cljc

* Set key-constraints to false for bigquery

* Add foreign keys to sqlite manually until sync is fixed

* Return driver require to Athena

* Correct typo

* Add naive primary key heuristic

* Update pk fk logic to handle name components correctly

* Add alias escaping to presto

* Add ordering to test

* Add order by to test

* Update test

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

* Add exception to alias forcing

* Different approach to exception from alias forcing

* Alternative approach for prefixing idents in bigq

* All seelcted fields by desired alias

* Rewrite only fields not from this source table

* Update test

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

* Add feature comment

* Explicit joins tests foreign-keys removal

* Update nested_queries_test.clj

* Update remapping tests

* Update tests

* Update tests to handle sqlite results format

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

* Address remarks

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

* Update bigquery test

* Update tests

* Adjust row level restrictions

* Add parameterized-sql feature

* Update comment

* Update leftovers

* Order keys

* Remove foreign keys from frontend

* Fix FE unit

* Update driver changelog

* Address review remark

* Update test/metabase/query_processor/test_util.clj

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

* Update docs/developers-guide/driver-changelog.md

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

* Update docs/developers-guide/driver-changelog.md

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

* Update modules/drivers/bigquery-cloud-sdk/src/metabase/driver/bigquery_cloud_sdk/query_processor.clj

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

* Update docs/developers-guide/driver-changelog.md

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

* Update test

* Update comment and reduce expression

* Update comment

* Address remarks

* Fix merge

---------

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

Fixes #44807.

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

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

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

---------

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

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

* Add driver feature

* Fix tests

* Remove ambiguous alias for sqlite

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

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

* Handle left-join support weirdness

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

* add to flaky group anyway

* add to flaky group anyway

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

* Update URL management (WIP)

* Fix tests failing because of whitespace changes

* Fix tests failing because of parameter order

* Use one hook for parameters and tab URL management

* Fix tests failing because of parameter order

* Fix test failing because of whitespace changes

* Revert

* Fix DashboardTabs tests

* Fix tests failing because of parameter order

* Fix test

* Fix test failing because of whitespace changes

* Remove unit tests that should be e2e tests now

* Fix tab navigation

* Fix string encoding/decoding

* Revert test changes

* Consistent question search params

* Update DashboardTabs tests

* Fix `SyncedParametersList`

* Fix e2e tests

* Fix nav usage

* Fix types

* Remove `useSyncedQueryString`

* Fix test

* Move slug utils to dashboard utils

* Fix nav

* Revert nav change

* Fix e2e tests

* Fix public/embedded dashboards, handle site url

* Add repro test

* Bring back and fix `PublicOrEmbeddedDashboardPage` tests

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

* Add a unit test

* Render time if 0

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

* Remove unused data-testid

* Remove redundant id and aria-labelledby

* Remove redundant props spread

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

* Fix navigation issue

* Add a repro for first issue

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

* Add a repro for second issue

* Refactor tests
- Fix not enough history entries issue

* Change order of tests to start with simpler one

* Fix invalid request issue

* Add more assertions

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

* make popover z-index customizable

* make the popover z-index customizable

* add tests for popover z-index

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

* Revert silly change

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

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

* B I G  improvements

* Appease Kondo

* Test fixes 🔧

* More test fixes 🔧

* Fix dataset-already-loaded?-test

* Fix test

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

* Postgres test fix 🔧

* Fix compilation errors

* MySQL fixes 🔧

* Fix syntax error

* MySQL fixes 🔧

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

* Fix Redshift

* Fix Presto JDBC

* Vertica test fix 🔧

* Fix Oracle dataset-already-loaded?

* Test fixes and parallelize some API tests.

* Test fixes 🔧

* Oracle test fix? 🔧

* Another test fix 🔧

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

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

* The most test fixes 🔧

* 3 or 4 test fixes 🔧

* Add schemas around stuff to catch errors

* Appease Kondo

* Implement dataset-already-loaded? for vertica

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

* Only test returned values in CI

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

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

* Add tests, support where available

* Add empty/null tests

* Adjust test query for athena

* Reset logging

* Fix comments

* Add Athena uuid conversion

* Address PR review

* Add comments

* Address PR comments

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

---------

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

* add e2e test

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

Fixes 27643

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Remove dead code

* Remove values same as default options

* Simplify hook API: Removing unused argument

* review: Remove redundant code

* Update look and feel copy (#44277)

* Update static embed tab name

* Update copies + rearrange settings

* Use Mantine Select

* Fix E2E tests by applying new copies

* Fix unit tests

* Fix more E2E tests

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

* Adjust spacing and relevant tests

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

* Reorder the function to match the visual order

* Make function name consistent

* Introduce the new background option (do nothing yet)

* Remove redundant exports

* Tighten up values to reduce confusion

* Make the parameters order consistent

* Only show background option on dashboads (spec)

* Allow dashboard embed background to be transparent

* Make filter background and header/footer transparent

* Fix type error

* Fix unit tests

* Fix E2E tests

* Fix checkerboard pattern not showing when no background

* Add unit tests

* Add missing copy update

* Remove remnants from outdated solutions within the PR

* Improve code comment references

* Fix E2E tests since the last copy change

* Fix type errors from merging master

* Update light theme style (#44488)

* Add background to dashboard filter on light theme

* Make position sticky works with transparent background

* Fix sticky filters not working on theme=transparent

* Fix unit tests

* Simplify IntersectionObserver components + fix E2E tests

* Add storybook for embedded dashboard

* Clarify the use of ExplicitSize context

* Remove unused code

* Formatting

* Review: Better mock `isWithinIframe`

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

* Update light theme checkerboard colors

* Update checkerboard colors

* Consolidate dashboard light/dark border style

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

* Update embed dashboard dark theme primary color

* Migrate dashboard text-secondary color

* Migrate text-tertiary color

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

* Fix failed e2e tests

* Fix static viz not working

* Update loki snapshots

* Remove unnecessary CSS custom property

* Make diff more consistent

* Address review: reusing type

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

* Match preview query with the actual code query

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

* Add unit tests

* Address review: Make tests less repetitive

* Update Metabase banner upsell UI (#45424)

* Prepare folder for nested components

* Update upsell UI

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

* Fix Upsell banner having horizontal scroll on full width

* Add new Metabase banner upsell component

* Fix unit tests

* Address review: Fix typo

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

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

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

* Remove unnecessary ESLint disable comment

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

* Address review: remove default value property

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

* Address review: Extract magic number

---------

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

* More UI updates (#45450)

* Update dark theme text colors to match the new design

* Update powered by metabase logo

* Update loki snapshots

* Fix unit tests

* Fix formatting

* Fix wrong dark theme metabase logo badge color

* Address review: Compress SVG with svgo

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

* Fix E2E tests

* Update loki snapshots

* Clarify Metabase base colors with comments

---------

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

* Add more tests (#45628)

* Add static embed question stories

* Add loki snapshots

* Add transparent theme for static dashboard tests

* Add transparent theme tests for static questions

* Assert `background` option in analytics tests

* Remove tests for logic that has been moved

* Update loki snapshots

* Fix failed E2E tests from merging master

---------

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

* Remove unused data-testid

* Remove redundant id and aria-labelledby

* Remove redundant props spread

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

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

* More taps

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

* add defendpoint dox

* make style consistent

* respond to review comment

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

Fixes #43597

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

* moving function to metabase global

* removing alert, adjusting e2e test

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

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

polish up pre-release milestone check

add and trigger new github action

handle already fixed issues

updates

* cleanup

* replace global imports

* prettier install

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

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

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

* fix types

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

* refactor: exportTabAsPdfButtonText function

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

* exportTabAsPdfButtonText -> getExportTabAsPdfButtonText

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

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

* Flag to hide download buttons (#44206)

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

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

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

* PLUGIN_DOWNLOADS_ENABLED -> PLUGIN_RESOURCE_DOWNLOADS

* adds comment to areDownloadsEnabled function to explain what it does

---------

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

* logic to handle downloads url parameter (#44363)

* minimal support for downloads url parameter

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

* fix prettier mistakes

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

* fix eslint issues

* update embedding snippets e2e

* update embedding questions e2e

* try to clean up the mess of downloads/downloadsEnabled

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

* adds TODOS for analytics

* unit tests for downloads flag (#45178)

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

* unit tests for downloads flag on dashboards and questions

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

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

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

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

* wip e2e tests

* make downloadUtils ts friendly

* assertNotEmpty function

* adds tests for public questions

* e2e tests for static embed downloads

* publicUid -> publicUuid

* fix assertNotEmpty

* fix parameter not renamed

* Apply suggestions from code review

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

* remove duplicated test

* fix another typo i forgot to rename

* fix another rename issue

* convert e2e-downloads-helpers to ts

* refactor: put method calculation in getEndpoint function

* adds note to downloadUtils

---------

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

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

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

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

* makes downloadsEnabled prop more consistent across components

* colocate downloadsEnabled with hideDownloadButton in embed-display-options

* defaults displayOptions.downloads to true to simplify logic

* remove unused queryString parameter in tests setup function

* reword TODO

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

This reverts commit aebf4cf3cf.

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

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

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

* remove comments

---------

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

* Add e2e repro for #37893

* Put the guard higher

* Fix unrelated test

* Go back to keeping the logic in `shouldRender`

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

* Optimize input in FilterModal

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

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

* Fix types

* Mock Range.prototype.getBoundingClientRect

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

* Have a test for archiving a question and a collection

* Refactor cy.createCollection and cy.archiveCollection to TS

* Refactor collection and user helpers to TS

* Keep collection helpers together

* Sort code

* Format code

* Use new createCollection helper

* Add return type to createCollection

* Fix typing

* Fix #32252

* Fix typing

* Deprecate openNewCollectionItemFlowFor

* Revert "Fix typing"

This reverts commit ecf3179868.

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

* try to update loki reference image

* change scalar to number

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

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

* update unit test

* update docs

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

* Refactor collection and user helpers to TS

* Keep collection helpers together

* Sort code

* Format code

* Add return type to createCollection

* Fix typing

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

* Fix #43219

* Create questions in parallel

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

* Fix assertion

* Be more specific which element is to be scrolled

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

* Remove redundant `tableMetadata`

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

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

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

* fixes failing unit tests

* pr feedback

---------

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

Closes: #44361

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

* This is the way

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

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

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

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

* updates

* remove release-list babashka script 😢

* Revert "remove release-list babashka script 😢"

This reverts commit 372a570f9af030abd6f297116e14568b3b51afa6.

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

* add reviewer to PR

* auto translate

* auto-translate works!

* update

* automate translation updates in CI

* fixes

* whitespace

* sort scripts

* just checkout the branch to begin with

* fix tests!

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

* Simplify fetchSegments selector

* Fix breadcrumbs

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

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

* remove extra install from frontend unit tests

* use the right dir

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

* Tighten up more

* Missed a spot

* More encapsulation

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

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

* fix reference

* fix export

* Move more reducers

* move parameterValues

* fixup! move parameterValues

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

* sdk parameter values

* use parameters to construct parameter input

* add a unit test for passing the correct parameters

* fix parameter parsing

* move TEST_PARAM to top of file

* update readme docs

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

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

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

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

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

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

* namespace should be a keyword

* decode the keyword

* add a typehint to avoid reflection

* Adds test for skip_graph

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

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

* Fix

* Fix

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

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

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

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

* respond to code review

* add + uses ExecutorCompletionService map function

* rename test

* more tests

* no concurrency for cljs

* fix timeout + add more tests

* use claypoole

* cleanup

* add kondo hooks for claypoole

* cleanup

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

Revert "add kondo hooks for claypoole"

This reverts commit 9d93b55b28.

* ignore unused value

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

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

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

* more flake fix

* fix slack message

* tired_face

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

* Fix deselecting the last join column

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

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

* Fix reference

---------

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

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

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

**Rebuilt query logic**

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

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

**Return a reducible result**

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

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

**Verifying**

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

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

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

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

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

* Invert events logic and update documentation

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

* store question result in sdk context

* remove dataset data type

* update question

* handle navigate to new card

* add loading states

* fix on query change

* update question change logic

* refactor question loading and query params

* fix ad-hoc question in dashboards

* extract useLoadQuestion into a separate hook

* cleanup run question on load

* revert changes in interactive question component

* store original question in the question result state

* turn the question into ad-hoc questions

* refactor run question methods

* add a separate isQueryRunning state for better ux

* isQueryRunning should default to false

* simulate re-running the query in unit tests

* add tests for rendering multiple valid questions

* refactor sync question method

* extract raw series and computed pivot logic

* add getCardAfterVisualizationClick

* separate single and multiple question tests

* fix import paths

* is question native

* pass queryResult instead of queryResults

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

* Add repro for #34574

* Use real `Tab` instead of a blur

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

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

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

* add summary and workflows

* adjust recent flake period

* code cleanup and add tests

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

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

---------

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

* Remove empty line

* Fix

---------

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

Fixes: #44962

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

* pass proper args

* put args back in proper order.

oops

* change form back to previous, but keep preview check

* autocorrect mistake? Or perhaps a silly typo?

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

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

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

* - Make revision-number consistent

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

* get id from the perms revision entity

* Move the revision id creation into the transaction

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

* write a test that checks the incomplete revision

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

* Sorting out types... I think?

* remove unneeded comment

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

* catching and throwing error

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

This allows you to use

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

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

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

* wip improving test util fns

* add subscription attachment util fn

* add tests to catch download/export differences

* viz-settings from card and dashcard  merged properly

* revert these changes which probably aren't needed

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

* normalize viz-settings no matter their origin

* Update test/metabase/api/downloads_exports_test.clj

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

* Incorporate some review feedback

* rendered table cards also respect column names

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

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

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

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

---------

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

* Adding modal and banner, user setting for dismissable banner

* copy changes

* adjust so modal only appears on data permission page

* e2e adjustments, adding banner test

* never show the modal or banner on new instances

* add test

* e2e adjustments, copy update

* more PR feedback

* move modal/banner settings & tests + clarify tests

* query for v50 migration execution works on mysql

- move changelog lookup into metabase.db.liquibase

* no race conditions in changelog-table-name

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

* revert changelog-table-name

- simply lookup the changlog row

---------

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

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

* Verify font is mentioned in HTML

* Bring back working assertions

* Add wait

* Disable speedy

* Disable CSP and emotion cache

* Revert "Disable CSP and emotion cache"

This reverts commit 573e99bfa4.

* Revert "Disable speedy"

This reverts commit 6f9962b869.

* Don't use local fonts

* Revert "Don't use local fonts"

This reverts commit 17c58aa73d.

* Force Lato

* Fix storybook file name

* ESLint

* Add more !important

* Revert !important

* Add font-family assertion

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

* restore legacy metrics

* its not legacy in v43

* Dont got echarts either

* newfangled echarts

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

* enable slack message

* don't always run cross-version tests

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

* provide a default implementation for refreshing auth tokens

* rename getRequestToken to fetchRequestToken

* add docs on customizing jwt authentication

* clarify docs, add error handling and failing tests

* update tests to pass

* re-export FetchRequestTokenFn type

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

* Refactor to redux state

* Fix logic with load with cards data

* Fix nasty e2e fails

* Fix nasty e2e fails

* Add global events

* Fix issue with loading event

* Fix issue with loading event

* Review fixes

* Add unit tests

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

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

* Add wildcard on interceptions

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

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

And now it will correctly log

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

Why no tests?
====

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

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

Testing metabase.db.liquibase-test

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

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

But this _passes_ in CI:

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

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

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

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

* changing text, adding unit tests

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

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

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

* Use focus method to do initial focus

* Use focus method for other _editor.focus calls

* Move focus to componentDidMount

* Cancel focus timeout  on unmount

* Add delay to broken test

* Switch to requestAnimationFrame

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

* fix mock column was not metric

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

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

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

- fix unused oldValue -> _oldValue

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

* fix test + disallow setting nested queries from code

* we cannot set enable-nested-queries

- set the env var instead

* add checks for the enable-nested-queries setting

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

* fix recents uri interception

* return enable_nested_queries setting to client

* adjust fetchmock url matcher

---------

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

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

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

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

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

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

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

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

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

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

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

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

* add preConditions to a few v51 migrations

---------

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

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

* Fix syntax error

* Test fixes 🔧

* Test fix??? 🔧

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

* Add repro for #44754

* Use theme spacing units

* Tweak the design slightly

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

* Add table prefetching

* Add test comparing call counts of select

* Update comment

* Add exception handling

* Add nil handling

* Handle possibye empty table-ids

* Update exception handling and test case

* Update src/metabase/models/card.clj

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

---------

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

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

Fixes #41464

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

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

* drop comment

* fix pattern order

* Use one version of typescript

* use :focus not :outline

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

* Use mb-color-focus for focus color

* Drop dead code

---------

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

Fixes #43793

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

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

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

* Split values at comma

WIP: Parse values using json

* Add label to ParameterValue and add ParameterValue to value config

* Use custom label in FieldValuesWidget

* Allow passing displayValue from outside of RemappedValue

* Allow passing displayValue in ParameterFieldWidgetValue

* Get custom value label in FormatterParameterValue

* Allow rendering custom displayValue in FieldValuesWidget

* Add custom ParameterValue types

* Fix ParameterValuePicker type

* Fix jest import for csv-stringify

* Add missing RTKQ exports for paramters

* Use direct implementation of useGetParameterValues

* Fix ValueSourceModal tests

* Add tests for value parsing and stringifying

* Use custom label in list too

* Render the custom label in a parameter value

* Setup parameter mocks in embed test

* Add info about splitting values with comma

* Add model hint when user is using labels

* Add test for cusom labels on dashboards

* Handle label-value pairs in test

* Test custom labels in parameter search input

* Use the label to parse the value for text inputs

* Fix comma's to commas

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

* Use strong instead of styling link

* Use getInput instead of ignoring eslint rule

* Use arrow function

* Add newlines between tests

* Use uppercase for test value

* Name value

* Use getLabel and getValue helpers to avoid indexing confusion

* Pull out confusing condition

* Move out getLabel helper

* Be more explicit about non-existent config values

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

* Move setupParameterValuesEndpoints to setup

* Add loading state

* Do not use alert to implement info box

* Fix formatting

* Remove undefined from getValue signature

* Use getLearnUrl

* Remove dependency on column

* Make custom field labels work in the absence of fields

* Support custom values for non-field parameters

* Add test for native question parameters

* Add newline in test

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

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

* Add test for loading state of FormattedParameterValue

* Do not fetch custom label for FormattedParameterValue

* Add table with ip addresses

* Add test for IPAddress filter with custom labels

* Add test for custom labels on type/Quantity fields

* Remove getInput helper in test

* Remove unused hasCustomLabel value

* Split up into common and premium tests

* Make fieldValues a map for performance

---------

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

Fixes #42829

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

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

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

* Move skip to top-level again

* Remove superflouous click

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

* Make the test description more descriptive

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

* Move question details to a variable

---------

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

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

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

Fixes: #43001

Might be related: #44858

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

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

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

* alter test to check for uniqueness across dashboard

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

* adjust migration to pass linter rules

* remove the extra rollback on migration

* Update src/metabase/models/user_parameter_value.clj

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

* Update src/metabase/models/user_parameter_value.clj

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

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

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

---------

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

* Test fix

* Make `format-honeysql` a multimethod

* Add test for #32543

* Test also fixes #44915

* Add explicit test for #44915

* Better test for #44915

* More test fixes 🔧

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

* Improve comment

* Improve comment

* Format code

* Update existing tests

* Extract helpers

* Update unit tests

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

* fix css

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

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

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

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

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

**Dashboard loads**

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

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

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

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

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

* Add repro for #39771

* Add explanatory comment

* Fix z-index

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

* Revert "Fix z-index"

This reverts commit 951e3dca86.

* Revert "Fix #39771"

This reverts commit 4165da5022.

* Update repro to new tooltip

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

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

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

* Convert the comment to JSDoc

* Add E2E reproduction

* Fix mapping

* Add test scenarios for the public sharing and embedding

* Simplify API payload

* Extract and significantly expand the reproduction scope


---------

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

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

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

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

* tests and optimizations

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

* fix typo

* add e2e test

* fix BE test

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

* last fixes

---------

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

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

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

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

* Hack an e2e test around an existing bug

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

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

* Appease Kondo

* Test fixes 🔧

* Overhauled Card metadata calculation code

* Test fixes 🔧

* Kondo fix 🔧

* Ok maybe I fixed stuff

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

* Maybe fixx the Cypress tests

* Experimental possible e2e test fix 🔧

* Test fixes 🔧

* Do things a little differently.

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

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

* Add repro for #42385

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

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

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

* add github action

* remove test code

* fix whitespace

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

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

* fix copy

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

* fix funnel bar row display setting

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

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

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

* Use saveQuestion instead of clicking trough the UI

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

* Use openOrdersTable instead of manually clicking through the ui

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

* Create question programmatically in test

---------

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

* Add a repro for #28106

* Format code

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

* Improve assertions

* Add comments

* Use saveQuestion helper

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

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

Fixes: #38753

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

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

This leaves Lato in place for other characters.

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

* stub installed fonts test

* typo

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

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

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

* add test checking that glyphs render correctly

* Add a test that directly checks the wrapping fn

* Change the string to keep the linter quiet

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

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

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

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

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

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

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

* Cope with driver specific failure modes

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

* Fixup some dependencies

* Fix textarea styles

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

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

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

---------

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

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

* Comment out failing assertions

* Skip repro

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

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

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

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

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

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

```

Simple repro:

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

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

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

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

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

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

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

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

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

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

* impls pr feedback

* impls more pr feedback

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

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

* make defsetting docstring formatting consistent

* log-direction is a string

* add test for enabling / disabling saml slo

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

* add jar instructions

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

* Update test to handle all drivers

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

* add missing useSyncURLSlug

* remove cardTitled prop that's not needed

* remove DashboardControls

* remove @ts-expect-error for dashboardId

* move props destructuring at the top

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

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

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

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

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

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

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

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

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

---------

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

* Update comment
2024-06-27 19:09:02 +07:00
Anton Kulyk
de786c3188 Fix graph.metrics sync after adding a new query stage (#44697)
* Add repro

* Accept non-aggregation cols in graph metrics sync

* Address feedback
2024-06-27 11:19:56 +01:00
Cal Herries
5260e2a333 Memoize driver.u/supports? (#44719) 2024-06-27 10:17:12 +02:00
Anton Kulyk
e0381e9bc9 Fix FE crash for line/area/bar charts with no data (#44769)
* Add test

* Fix `xDomain` calculation in QB selectors

* Make database `features` optional

* Update reproductions-3.cy.spec.js

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-27 08:26:05 +01:00
Denis Berezin
7091c9eb47 feat(sdk): Improve dashboard to question navigation (#44648)
* Add dashboard question header

* Add dashboard data preserve after question drill

* Review fixes

* Review fixes

* Potential fix for e2e

* Potential fix for e2e

* Add basic unit tests

* Fix Dashboard reloading on unmount, fix ad hoc question title in SDK

* Move dashboard reset to SDK component

* Fix issue with dashboard rerender

* Fix one more reported issue with rerender
2024-06-27 00:23:36 +00:00
Uladzimir Havenchyk
a4a68f426d Add a repro for 'Visible Columns errors when source query is a table joined on itself' (#44737)
* Add a repro for 'Visible Columns errors when source query is a table joined on itself'

* verify warning icon is not rendered
2024-06-26 17:53:55 +00:00
Uladzimir Havenchyk
6667721ac0 Add a repro for 'Cannot change question data source to raw data after selecting saved question' (#44757)
* Add a repro for 'Cannot change question data source to raw data after selecting saved question'

* Update e2e/test/scenarios/question-reproductions/reproductions-2.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Update e2e/test/scenarios/question-reproductions/reproductions-2.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Update e2e/test/scenarios/question-reproductions/reproductions-2.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-26 19:42:56 +03:00
Jesse Devaney
f84e0d2321 Update default map.type display for breakouts with un-binned coordinates (#44717)
* fix map default display type with un-binned coordinates

- default to `"map.type"` = "pin" when coordinates are not binned
- default to `"map.type"` = "grid" when coordinates are binned

* add tests

* refactor breakouts usage
2024-06-26 16:03:44 +00:00
Alexander Polyankin
c0f10581e6 Allow clicking "Remove all" for the first group in FieldPanel and omit removing the first field in the group (#44645) 2024-06-26 15:54:55 +00:00
Alexander Polyankin
ca72311518 Fix broken field normalization in metadata (#44721)
* Fix broken field normalization in metadata

* Handle Fields.actionTypes.UPDATE action in tables reducer to keep table's original_fields in sync

* Add an e2e test for fields

* Format code

* Use a different table, since accounts table is not available in e2e tests

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-26 11:50:19 -04:00
Jesse Devaney
7ade61330d Fix invalid API request fired on chart legend click (#44579)
* remove invalid else conditional

* fix RowChart firing invalid API request on legend item click

* fix clicking on non-breakout legend on dashboards

* add E2E test to validate and enforce the desired behavior
2024-06-26 11:12:24 -04:00
Alex Yarosh
08be787014 docs: add 50.7 to releases (#44712) 2024-06-26 17:01:13 +02:00
Nemanja Glumac
fea908d474 Unskip the repro for #18770 (Post-aggregation filters) (#44748) 2024-06-26 16:30:05 +02:00
Noah Moss
cfb3de0231 Skip unecessary quartz job deletion migration (#44652) 2024-06-26 10:17:07 -04:00
Alexander Polyankin
03ca0ec174 Add missing tests for temporal unit parameters parsing and fix issues (#44685) 2024-06-26 09:11:38 -04:00
Chris Truter
fb4bbfa6e7 Fix appends for long column names (#44727) 2024-06-26 15:00:24 +02:00
Mahatthana (Kelvin) Nomsawadi
dd7996b756 Remove the workflow until we figured out a better workflow (#44749) 2024-06-26 12:55:13 +01:00
github-automation-metabase
68c2fbf023 Update Readme version references and published npm version to 0.1.14 (#44746) 2024-06-26 11:45:16 +00:00
Arkadi Yaroslavtsev
726589d824 Pass enterprise version to cloud issues (#44701) 2024-06-26 07:43:37 -04:00
Anton Kulyk
a03d3a85d2 Remove description length check from copy question form (#44736) 2024-06-26 12:37:12 +01:00
Chris Truter
48b6f349b7 Opt out of non-reserved SQL keywords (#44609) 2024-06-26 11:36:33 +00:00
Romeo Van Snick
d145a24747 Add reproduction for "Closing Drop-down in Join column selector causes non-drop-down columns to disappear" (#44675)
* Add reproduction for #19894

* Use startNewQuestion
2024-06-26 13:09:01 +02:00
Phoomparin Mano
43a9a796ea docs(sdk): remove vite incompatibility from sdk docs (#44729) 2024-06-26 17:54:34 +07:00
Anton Kulyk
9ce72a44cd Bump dashboard description max length limit to 1.5K (#44470)
* Bump dashboard description max len limit to 1.5K

* Extract `DASHBOARD_DESCRIPTION_MAX_LENGTH` const

* Handle description max length in dashboard sidebar

* Add red border to dashboard description box

* Add test
2024-06-26 11:31:16 +01:00
Uladzimir Havenchyk
5f4c2638f2 Remove repro for #40223 that's not valid anymore (#44682) 2024-06-26 12:08:53 +02:00
Oisin Coveney
e1ffb582f0 Split SummarizeContent from SummarizeSidebar (#44539) 2024-06-26 09:54:04 +00:00
Alexander Solovyov
a91a363a60 enable-query-caching is now default true (#44227) 2024-06-26 12:27:11 +03:00
Alexander Solovyov
c7e2a0078a [cache] surface last run time and make sure "nocache" won't use cache (#44679) 2024-06-26 11:10:19 +03:00
Phoomparin Mano
87914fd870 fix(sdk): upgrade D3.js to the latest version for Vite compatibility (#44562) 2024-06-26 14:06:57 +07:00
Sloan Sparger
6665c0a4f0 Fix trash banner icon color regression (#44304)
* fixes spacing and color issue of trash icon in archive banner

* css var for color

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-06-25 18:59:15 -05:00
Emmad Usmani
45b4b1b247 fix pivot table horizontal scrollbar not appearing (#44514)
* fix pivot horizontal scroll

* fix scroll on dashboard

* add e2e test

* fix unit tests

* fix e2e test
2024-06-25 22:56:17 +00:00
Alexander Polyankin
b6a307d00b E2E test for custom date expression error (#44694) 2024-06-25 17:49:02 -04:00
Alexander Polyankin
7e74dd2279 Add E2E repro for convertTimezone (#44705) 2024-06-25 17:48:54 -04:00
Alexander Polyankin
22baa028fb Add repro for 32804 (#44709) 2024-06-25 17:48:35 -04:00
Alex Yarosh
091f94b160 add 49.18 (#44699) 2024-06-25 20:51:29 +02:00
Cal Herries
52b23ee2f7 Fix testing week-of-year extraction in general-timezone-support-test (#44583) 2024-06-25 12:15:13 -06:00
Aleksandr Lesnenko
3e554323a7 bump echarts (#44695) 2024-06-25 17:14:43 +00:00
Nemanja Glumac
6a68804eb6 Repro #35043: Date range filter - from newer to older date (#44687) 2024-06-25 18:54:09 +02:00
Nicolò Pretto
eaf1e80dec refactor DashboardControls (#44558)
* WIP PublicOrCustomEmbedDashboardPage without using dashboard controls

* add usePublicDashboardEndpoints instead of WithPublicDashboardEndpoints

* fix type error by setting null as default value for hide_parameters and hide_download_button

* use usePublicDashboardEndpoints inside WithPublicDashboardEndpoints

* also migrate embed

* i don't think we need useDashboardNav public/static embed

* SetTitle component to use instead of the `title` hoc

* wrap setEmbedDashboardEndpoints/setPublicDashboardEndpoints in useEffect as per PR comment

* after the fix for metabase#38640 we don't need the public routes in the main app

* renamed test file

* change tests to use PublicOrEmbeddedDashboardPage

* remove PublicOrEmbeddedDashboardControlled and change imports for PublicOrEmbeddedDashboardPage

* remove debug prop left by mistake
2024-06-25 17:02:20 +02:00
Noah Moss
e7e4fd6f87 Fix parsing of MB_JETTY_SKIP_SNI (#44651) 2024-06-25 10:00:23 -04:00
Alexander Polyankin
e5e0c2ccd0 Fix expressions with the same name as their base column (#44641)
* Pass expressionPosition

* Add a test

* Update e2e/test/scenarios/question-reproductions/reproductions-3.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Rename expressionPosition to expressionIndex

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-25 13:25:42 +00:00
Alexander Polyankin
113d95366d Add e2e repro (#44656) 2024-06-25 09:12:22 -04:00
Ngoc Khuat
191d845941 Fix flaky test: update-db-to-never-scan-values-on-demand-test (#44658) 2024-06-25 19:26:30 +07:00
Oisin Coveney
d8a54827ee Split content from FilterModal into FilterContent (#44534) 2024-06-25 15:26:20 +03:00
Romeo Van Snick
3e54ff961e Add reproduction for "Result inconsistencies with Preview in GUI editor #40399" (#44630)
* Add e2e test to verify that step previews only care about the step being previewed

* Use getNotebookStep and find preview button using cy.icon

* Remove empty line

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-06-25 14:21:04 +02:00
Nemanja Glumac
7b706ff9e6 Repro #33330: Cumulative count breaks in certain situations (#44671) 2024-06-25 13:47:36 +02:00
Uladzimir Havenchyk
689f8d7e58 refactor: drop old and unused endpoint (#44629)
* Drop old and not used  endpoint

* fixup! Drop old and not used  endpoint

* fixup! fixup! Drop old and not used  endpoint
2024-06-25 13:41:28 +03:00
Mahatthana (Kelvin) Nomsawadi
1fa5a933c6 refactor(sdk): Make sense of dashboard and embed code (#44636)
* Make the code makes more sense

* Fix type error
2024-06-25 10:25:43 +01:00
Nemanja Glumac
f43a15076d Refactor: Time-series chrome component (#44568)
* Move SimpleSpecificDatePicker to the form

* Extract `isSpecificValue` helper

* Integrate the toggle into `SimpleDateIntervalPicker`

* Make DateOperatorPicker do only one thing

Separation of concerns - lift SimpleRelativeDatePicker up to the form.

* Fix unit tests

* Add back the test for the `SimpleSpecificDatePicker`

* Keep the rendering logic in the `SimpleDatePicker`
2024-06-25 11:17:18 +02:00
Ryan Laurie
3fcc0f6e14 Tag core-release group in pre-release messages (#44663) 2024-06-25 02:11:04 -06:00
Phoomparin Mano
70eea1167b fix(sdk): missing css variables when rendering under a portal (#44473)
* apply css variables injection right under the public component

* refactor css variables

* fix name changes

* apply css variables to global styles

* update path

* render component wrapper as full-width

* move style resets to public component styles wrapper

* update unit tests for global styles
2024-06-25 12:51:52 +07:00
Cal Herries
a57718bd52 Fix querying TIMESTAMP WITH LOCAL TIME ZONE for oracle (#44456) 2024-06-24 20:16:22 -06:00
adam-james
a27c151078 Sanitize SVG before parsing with Batik to prevent render failures when invalid characters are in the SVG content (#44516)
* Add Temporal Units List to Dashboard Parameters Schema

Closes: #44361

This adds an entry to the Dashboard Parameter schema so that we can validate
the list of temporal_units that might be passed from the frontend when adding
or updating the `Unit of Time` type parameters.

* Sanitize the SVG before parsing it with Batik

WIP

Fixes: #43677

There are characters that are invalid according to the Batik XML Parser. This sanitizes the svg string to strip out
some of those characters so that the render can continue.

* Use the xml 1.0 spec allowed unicode chars list for the regex

* Remove accidentally merged code

* still miseed a line
2024-06-24 21:52:09 +00:00
Case Nelson
6317927039 fix: dont always optimize between expressions (#44493)
* fix: dont always optimize between expressions

Fixes #42291

The frontend produces expressions like

```
[:between
 [+ [:field ... {:temporal-bucket :day] [:interval 2 :day]]
 [:relative-datetime -1 :week]
 [:relative-datetime 0 :week]]
```

This should not be optimized because of the mixed `:day` and `:week`
units. However, it was being optimized since the compatible units
weren't being properly picked up by the match.

* Disable suspcicios args eastwood lint, kondo does it better

* Stop autobucket to day when adding a time interval
2024-06-24 14:18:53 -06:00
Case Nelson
8198461c9b perf: disable view log and card used updates during metadata fetches (#44502)
* perf: disable view log and card used updates during metadata fetches

* Disable writes for view_count and last_used_at

* Disable view_count tests

* Disable last-used-at tests

* Disable view_count test

* Fix view count test

* Disable view_count e2e testing
2024-06-24 10:21:34 -06:00
Alexander Polyankin
9b305a03e6 Add a try-catch for MBQL lib diagnoseExpression (#44628) 2024-06-24 16:07:58 +00:00
Alexander Polyankin
1d5d9cb430 Fix the operator list for type/TextLike PKs (#44569)
* Fix the operator list for `type/TextLike` PKs

* Fix the bug with using wrong operators

* Fix the bug with using wrong operators

* Update test/metabase/lib/filter_test.cljc

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>

* Test FKs too

* Update test/metabase/lib/filter_test.cljc

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>

---------

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2024-06-24 16:00:09 +00:00
Nemanja Glumac
172c7cc3af Repro #44550: Missing display name for the filter with an offset (#44624) 2024-06-24 16:53:56 +02:00
Jeff Bruemmer
d3aa47a58d fix link (#44622) 2024-06-24 10:23:04 -04:00
Nemanja Glumac
dc4a553056 Visually improve time-series chrome component (#44554)
* Get rid of the styled component

* Stack date operator on top of actual filter pickers

* Use the existing `CurrentDatePicker`

* Fix unit test

* Conditionally apply padding to the `CurrentDatePicker`

* Remove the custom prop
2024-06-24 14:18:21 +00:00
Denis Berezin
e74f0bbf41 Migrate ViewTitleHeader and its children to TS (#44513)
* part 1

* part 1

* part 2

* part 3

* part 4

* Self review

* Self review

* Fix merge conflicts

* Fix e2e

* review fixes

* review fixes
2024-06-24 17:12:36 +03:00
Uladzimir Havenchyk
f21ad7da0a test: add a test for the edge case in mapping on parameter change (#44610)
* test: add a test for the edge case in mapping on parameter change

* fixup! test: add a test for the edge case in mapping on parameter change
2024-06-24 16:41:59 +03:00
Mahatthana (Kelvin) Nomsawadi
1c2b5cc346 refactor: Create static embed view components (#44555)
* Remove `this` reference from the markup

* Move functions inline

* Introduce a view component making it purer

* Introduce question embed view component

* Address review: Don't lie about types

Co-authored-by: Nicolò Pretto <info@npretto.com>

* Address review: Make code consistent

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-06-24 14:30:13 +01:00
Ngoc Khuat
f135ea4f07 Tidy pulse code, remove unused methods (#44603) 2024-06-24 20:27:45 +07:00
Alexander Polyankin
4bda202926 Fix new column shortcuts overwriting viz settings (#44582) 2024-06-24 09:08:32 -04:00
Alexander Polyankin
1f74c4312a Fix setting the join strategy for not yet existing join clauses (#44557) 2024-06-24 09:07:13 -04:00
Alexander Polyankin
8954c23632 Fix setting the temporal bucket of columns in a join condition to "Don't bin" (#44564) 2024-06-24 09:06:33 -04:00
Nemanja Glumac
bf5df6cd2b Increase the Codecov frontend target (#44613)
* Fix the comment

* Update the threshold for the front-end
2024-06-24 14:44:55 +02:00
Alexander Polyankin
b34b9607c4 Fix model metadata editing for SQL models with manually sorted columns (#44574) 2024-06-24 08:37:29 -04:00
Uladzimir Havenchyk
b228f16bb6 refactor: split DashCardCardParameterMapper into smaller components to reduce complexity (#44526)
* Exrtract 'useResetParameterMapping'

* Extract 'DashCardCardParameterMapperButton'

* Extract 'DashCardCardParameterMapperContent'

* cleanup

* Drop if/else

* cleanup
2024-06-24 13:16:42 +03:00
lbrdnk
260f8b0392 Add role to spec even if used in :connection-uri (#44397)
This PR removes `:role` removal from spec, even if it was added in `:connection-uri`.
It seems that `:connection-uri` is ignored on `do-with-connection-options` code path.
Hence use of non-default roles is again available on Snowflake.
2024-06-24 12:12:37 +02:00
lbrdnk
ba42baaf0f Adjust distinct aggregation expansion on Mongo (#44442)
This commit adds `$size` operator wrapping to `$addToSet`. That enables use of `:distinct`
clause in expressions on Mongo.
2024-06-24 12:10:11 +02:00
Ryan Laurie
452382bcca Fix infinite backport PR recursion in milestone setter (#44593)
* fix infinite backport PR recursion

* dedupe issue numbers
2024-06-24 01:57:22 -06:00
Alexander Solovyov
ea69066d83 add a test to check that openapi definitions can be generated (#44586) 2024-06-24 10:40:33 +03:00
Alexander Solovyov
839f1f775c xray should not filter again models with filters (#44547)
This not only does not make sense, but also fails for models with aggregations (and thus not having those fields for filtering available).
2024-06-24 10:13:15 +03:00
Ryan Laurie
2f6e5d7fcd Update Milestone Setter (#44521) 2024-06-23 23:28:46 -06:00
Alexander Solovyov
bdf67dbe3f [openapi] do not die when :query-params is not a map (#44549) 2024-06-22 11:32:26 +02:00
Uladzimir Havenchyk
981d69ab2a refactor: Rework undo to typescript (#44479)
* refactor: Rework undo to typescript

* fixup! refactor: Rework undo to typescript

* fixup! fixup! refactor: Rework undo to typescript

* Convert UndoListing to ts

* fixup! Convert UndoListing to ts

* Update frontend/src/metabase/redux/undo.ts

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* address review

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-22 07:22:46 +00:00
Jeff Bruemmer
674ac9787c notes on upload perms (#44575) 2024-06-21 17:02:40 -04:00
Denis Berezin
dbcd84484c Add global styles to storybook, fix default fonts display (#44559)
* Add global styles to storybook, fix default fonts display

* Update loki testing screenshots
2024-06-21 22:45:52 +03:00
adam-james
998b28cddb Disable Pivot Export Post Processing Step (#44561)
This PR disables the 'make exports look pivoted' post processing step for csv and xlsx exports.

This is in response to a reported issue that Large Pivot Table downloads are failing entirely: #44556

A more hollistic fix and improvement to the post processing feature will be worked on, so the post processing code is
left untouched in this PR.

The dynamic vars in the csv and xlsx namespaces each default `false` and disable the export from running any post
processing. The var should remain `false` until we've got a plan for these types of exports, and there is no way for
users (either through ENV or UI) to change this, so the feature is effectively disabled.
2024-06-21 18:28:27 +00:00
Jeff Bruemmer
7a83278718 docs - actions and public dashboards (#44551) 2024-06-21 18:16:34 +00:00
Cam Saul
89f12e7c01 Set useLocalSessionState=true for MySQL DW connections [PERFORMANCE BOOST] (#44509)
* Set `useLocalSessionState=true` for MySQL DW connections

* Fix GH issue number

* Test fixes 🔧

* Lint fix 🔧
2024-06-21 10:04:22 -07:00
github-automation-metabase
e2670a1567 Update Readme version references and published npm version to 0.1.13 (#44553) 2024-06-21 16:13:22 +00:00
Nicolò Pretto
ecce383824 convert embed.ts to ts and to use createSlice from rtk (#44496)
* convert embed.ts to use createSlice from rtk

* only store in the state what we care about for interactive embedding

* use DEFAULT_EMBED_OPTIONS keys to filter searchOptions

* removed unused hash parameter

* adds basic unit test
2024-06-21 16:04:21 +00:00
John Swanson
0637fefa67 Fix dev migrate! command (#44545)
There were two problems here:

- wrong args to `mdb/migrate!` (passing the db-type as well as the data
source), and

- in MySQL, the changelog table name is not `:databasechangelog`. Use
`metabase.db.liquibase/changelog-table-name` to get the actual table name.
2024-06-21 14:41:23 +00:00
Mahatthana (Kelvin) Nomsawadi
74b2c11ea5 refactor: Extract refactor code out of feature branch to avoid conflicts (#44540)
* refactor: Simplify code (#44275)

* Remove dead code

* Remove values same as default options

* Simplify hook API: Removing unused argument

* review: Remove redundant code

* Refactor
2024-06-21 15:22:28 +01:00
Anton Kulyk
ce48b30e16 Revert graph settings sync change (#44535)
* Skip repro for 10493

* Add repro for 44532

* Remove `ensureMetricsAndDimensions`
2024-06-21 14:34:05 +01:00
Kamil Mielnik
fa192d940b Fix - Missing schema name in data picker (#44468)
* Show table's schema name when available

* Add a test

* Add a test for empty table schema
2024-06-21 20:19:57 +07:00
Phoomparin Mano
dbaddac9cb add demo video to the sdk readme (#44531) 2024-06-21 20:18:14 +07:00
Oisin Coveney
0b9bfbd21d Split FilterModal components into separate files and folders (#44530) 2024-06-21 12:38:01 +00:00
Oisin Coveney
bd6391cef0 Make notebook props explicit (#44529)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-06-21 12:11:35 +00:00
Oisin Coveney
27fc6ae43e Convert ViewTitleHeaderRightSide and associated components to TS (#44368) 2024-06-21 14:53:30 +03:00
Nicolò Pretto
2c04840477 convert browser.js to typescript (#44524)
* file renamed to .ts

* fixed ts errors in browser.ts
2024-06-21 12:17:45 +02:00
Kamil Mielnik
3565d5e2b8 Update browserslist-db (#44522)
- Run "npx update-browserslist-db@latest"
2024-06-21 08:38:59 +00:00
Ryan Laurie
db3b8979c5 ci: Move cloverage to run nightly (#44365)
* move cloverage to a nightly run

* what a mess
2024-06-21 00:54:21 -06:00
Chris Truter
0e8787805f Track metabase.nqa module dependencies (#44464) 2024-06-21 05:58:51 +02:00
Noah Moss
c966918bda Don't run sandboxing rollback test on mysql (#44515)
* Don't run sandboxing rollback test on mysql

* Update test/metabase/db/schema_migrations_test.clj
2024-06-21 02:03:17 +00:00
Cam Saul
1dceed32b8 Make the App DB transaction isolation level READ_COMMITTED for MySQL [MEGA PERFORMANCE BOOST] (#44505)
* Make the App DB transaction isolation level READ_COMMITTED for MySQL/MariaDB [MEGA PERFORMANCE BOOST]

* Add test
2024-06-21 01:44:34 +00:00
Mateusz Burzyński
514564290f Update @replayio/cypress (#44396) 2024-06-20 23:18:29 +02:00
John Swanson
cb055ac9de Don't sort official collections first in trash (#44322)
Add a new query parameter to `/api/collection/:id/items` and
`/api/collection/root/items`. If `official_collections_first` is passed,
we'll sort official collections first, or not, as requested. If it isn't
passed, we'll default to `false` for the trash collection, or `true` for
normal collections.
2024-06-20 21:17:38 +00:00
Nick Fitzpatrick
7f9e369c34 Fix crash on restoring bookmarked items, update bookmarks on restore (#44414)
* Fix crash on restoring bookmarked items, update bookmarks on restore

* adding bookmark assertions to e2e tests

* removing unintended createDashboard change
2024-06-20 17:55:03 -03:00
Cam Saul
08c841f3ef Oops fix the order we attempt to set DW transaction isolation in (#44501) 2024-06-20 20:41:10 +00:00
Jeff Bruemmer
d0096dc0fa clarify database vs driver (#44503) 2024-06-20 16:16:21 -04:00
Noah Moss
dce9879067 Fix rollback when sandboxing is configured (#44481) 2024-06-20 14:24:26 -04:00
Nemanja Glumac
442cedd5b9 Fix flaky E2E segments test (#44487) 2024-06-20 12:04:51 -06:00
Nicolò Pretto
105a72a008 remove code from useDashboardUrlParams and related files (#44426)
* simplify bordered logic

* 🧹 setTitled

* 🧹 setHideDownloadButton

* 🧹 setHideParameters

* inline useEmbedDisplayOptions

* move DEFAULT_EMBED_DISPLAY_OPTIONS to costants file so we can remove use-embed-display-options.ts

* move consts up in the file

* update deps of useEffect

* fix ts error in the sdk

* use useEmbedFrameOptions in useDashboardUrlParams

* embed frame should not touch the `embed` slice, which is used for interactive embedding
2024-06-20 17:05:35 +02:00
Mahatthana (Kelvin) Nomsawadi
05417a3a6c Add a link to embedding SDK changelog (#44480) 2024-06-20 15:35:48 +01:00
Alexander Polyankin
b3749f8fe5 E2E tests for click behaviors with temporal unit parameters (#44436) 2024-06-20 10:29:28 -04:00
Raphael Krut-Landau
79c8e9bd82 fix(admin): Add e2e tests of the database caching policy form's basic functionality (in Admin / Performance) (#44416)
Closes #44478
2024-06-20 10:14:44 -04:00
Ngoc Khuat
4a03070a9b Fix unable to sync json column with value is an array (#44465) 2024-06-20 14:05:00 +00:00
Raphael Krut-Landau
7e7414e86e fix(cache): Add missing question mark in the 'Clear cache' confirmation modal (#44453) 2024-06-20 07:47:20 -05:00
Phoomparin Mano
dab2d85277 fix(sdk): font size, color and padding in viz (#44283)
* funnel start color should be text-dark

* change pivot table font size unit to em for scaling

* change funnel and legend item unit to em

* change funnel font size to em

* change object detail font size to em

* change gauge font size to em

* add cartesian chart padding config

* update docs

* remove isEmbeddingSdk prop

* simulate the 0.875em base font size

* chart padding override should apply in query builder

* add cartesian padding to stories

* update readme docs

* fix collection browser option in readme docs

* fix pivot table font size scaling

* update loki

* update loki

* use em for smart scalar

* update chart default padding

* revert smart scalar font size scaling due to measurement

* dynamic font family and font size as defaults

* pivot table

* add more properties to sdk docs

* make FONT_SIZES constant local

* link to discussion on query builder extra spacing

* enforce that font is passed to getLeftHeaderWidths
2024-06-20 19:14:09 +07:00
Phoomparin Mano
992b2e899f fix(sdk): load custom font files when font is set to custom (#44432)
* load custom font family

* always return custom font family

* add tests for returning custom font family
2024-06-20 18:26:43 +07:00
github-automation-metabase
488e08a7dd Update Readme version references and published npm version to 0.1.12 (#44466) 2024-06-20 09:56:14 +00:00
Uladzimir Havenchyk
5638d79768 Adjust undo toast timeout 12s -> 8s (#44422)
* Adjust undo toast timeout 12s -> 8s

* typo

* Address review
2024-06-20 11:48:46 +03:00
Alberto Perdomo
0081f202bc Update SDK README.md (#44427)
Remove warnings about not using MB versions in production. This is a left over from the time we were pointing to builds off master and RCs.
2024-06-20 07:33:48 +00:00
Raphael Krut-Landau
e5c14e16ae fix: Use an indicator-agnostic testid (#44265)
* Use an indicator-agnostic testid

* Run sed

* Use correct testid
2024-06-19 20:32:15 -04:00
Case Nelson
523ea2488b fix: populate param-fields for named fields on public dashboards (#44440)
* Update e2e test

* Update e2e test

* fix: populate param-fields for named fields on public dashboards

* Add name to public hydration

* Add tests

* Add tests

* Fix tests

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-06-19 17:26:25 -06:00
Raphael Krut-Landau
08613cb3b6 fix(cache): Fix two bugs in Admin / Performance (#44255)
Ensures that minimum query durations are correctly displayed in the form post-save (#44249) and that all times can be used in the Schedule component  (#44257)
2024-06-19 18:53:03 -04:00
Raphael Krut-Landau
c006657dce feat: Use skeletons to indicate that the main navigation sidebar is loading (#44010) 2024-06-19 18:38:05 -04:00
Cal Herries
3f788bbaf2 Exclude native query matches in search scoring when the search should exclude native queries (#43982)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-06-19 22:06:02 +00:00
adam-james
bbde99dd31 User parameter value json fix (#44420)
* UserParameterValue transforms wrapped to properly escape string vals

The `json-in` and `json-out` functions used for toucan model transforms do not perform any string escaping logic. This
makes sense as we don't want to make assumptions about the shape of data flowing in/out of the db. But, this did mean
that for the User paramter values table, string values were causing an error to be logged. This doesn't break
anything, as the function will still correctly return the string, but it can clutter up logs.

So, this PR wraps all incoming values in a map and unwraps it for outgoing values.

* Add migration to wrap existing user param values with ::wrapper key

Since the in/out transform for UserParameterValues is updated, we need to migrate any existing values to have this wrapping.

* Simplify the solution to the problem.

Since we're already getting what we need from the json-in/json-out *except* that it's logging a parse error, we can
create a json-out that works the same way (tries to parse and returns the string as-is if it fails) without logging an
error at all.

* take away the arg and keywordize inside the json-out fn

* remove irrelevant comment

Signed-off-by: Adam James <adam.vermeer2@gmail.com>

* Add a little more test coverage for different value types

* faster test thanks to Dan!

* Add a comment about the data being tested

---------

Signed-off-by: Adam James <adam.vermeer2@gmail.com>
2024-06-19 21:50:47 +00:00
Alexander Polyankin
80c34c673d Disable parameter mapping to native models (#44372) 2024-06-19 21:21:57 +00:00
adam-james
89bdaa2fa8 XLSX Pivot Table Downloads have 'Native' Pivot Table (#43791)
* XLSX Pivot Table Downloads have 'Native' Pivot Table

Addresses: #2473

The xlsx downloads work fine for regular tables. However, on Pivot Table downloads, the resulting file isn't pivoted
and is formatted somewhat strangely (it contains additional rows related to totals, has an extra 'pivot-grouping'
column).

Now, the downloaded xlsx file contains 2 sheets:
- the data sheet containing the question's rows unpivoted. If you were constructing a pivot table yourself, you would
probably start with this shape of data.
- the pivot sheet containing a 'native' Pivot table whose reference points to the data on the data sheet, and whose
columns, rows, and values align with the cols, rows, and measures set up in Metabase

* Silly typo!

* Exported Pivot uses correct aggregation (sum, count, stddev, avg, min, max)

* data for pivot exports now also uses the formatting

* Add a test asserting that a pivot table exists in the xlsx file

* add-row! is a method dispatching on sheet class

* remove unnecessary hint

* address review feedback:

 - consolidate the aggregation function key fns into one function in the .xlsx namespace
   this was moved out of postprocessing so that the xlsx specific fns don't litter the post processing namespace at
   this time

 - clean up an unnecessary destructiring inside the native-pivot function
 - don't shadow 'name' inside the body of a fn

* Add tests that confirm zero-col and zero-row situations work

* Consolidate the atoms used to store pivot rows/options
2024-06-19 21:14:05 +00:00
Alex Yarosh
301ab32cef docs: Serialization API uses POST (#44439)
* call attention to POST

* wording
2024-06-19 16:24:01 -04:00
Nemanja Glumac
737c24af95 MS2: Expose "Include this {period}" in time-series chrome (#44247)
* Expose "Include this {period}" in timeseries chrome

* Fix type errors

* Simplify type guards

* Add unit tests

* Remove Flex wrapper around Switch

* Extract `IncludeCurrentSwitch` component

* Add E2E smoke tests

* Cover the toggle behavior with E2E tests

* Simplify test with a simple helper
2024-06-19 20:14:47 +00:00
Chris Truter
870dcd6c4a Don't analyse non-SQL cards with Macaw (#44350) 2024-06-19 12:48:15 -06:00
Denis Berezin
fa32093271 feat(sdk): Add interactive dashboards to embedding SDK (#44161)
* Temp

* Add support for saved questions

* Try to fix question not found issue

* Try to fix question not found issue

* Fix unit tests

* Add basic unit test

* Fix unit tests

* Fix unit tests, fix question not found issue

* Review fixes

* Review fixes

* Refactor components structure, review fixes

* Adjust readme
2024-06-19 18:05:19 +00:00
Anton Kulyk
4f53b0b9a9 Fix updating table questions in the notebook editor before running a query (#44428)
* Add repro test

* Fix null check
2024-06-19 18:33:02 +01:00
Braden Shepherdson
3ccf4d411c [QP] Fix breakouts on a nested model (#44418)
Fixes #43993 for real.

The earlier fix #44182 was needlessly restricting the
"nominal refs" check to fields which were using numeric IDs,
when really any match on nominal refs is valid.
2024-06-19 17:24:00 +00:00
Braden Shepherdson
891260cb57 [MBQL lib] Put :fields :all on joins on deleting last aggregation/breakout (#44321)
Part of #44298.
2024-06-19 17:09:42 +00:00
Mahatthana (Kelvin) Nomsawadi
863bc82af1 Clarify SDK release workflow (#44385) 2024-06-19 17:51:05 +01:00
github-automation-metabase
6f5c43d358 Update Readme version references and published npm version to 0.1.11 (#44421) 2024-06-19 16:50:54 +00:00
Mahatthana (Kelvin) Nomsawadi
0a550944f6 docs(sdk): Update readme pointing to the most recent v50 version (#44411)
* Update readme pointing to newer 50 release

* Update enterprise/frontend/src/embedding-sdk/README.md

Co-authored-by: Phoomparin Mano <poom@metabase.com>

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-06-19 17:22:50 +01:00
Ryan Laurie
9e4cbda477 ci: Automatically add milestones to prs and issues (#44357)
* automatically add milestones to prs and issues

* test code

* test code

* test commit (#3138)

* test commit (#43320)

* test commit (#44357)

* remove test code

* add newlines

* prefer older version milestones
2024-06-19 09:54:36 -06:00
Alex Yarosh
f0db81fccd docs: change paid to pro/enterprise (#44383)
* docs: change paid to pro/enterprise

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-06-19 15:28:12 +00:00
Jeff Bruemmer
5efb56c065 docs - add 50.6 to list of releases (#44399)
* add 50.6 to list of releases

* 49.17
2024-06-19 10:33:51 -04:00
Ryan Laurie
c643f094f1 Send five flakiest tests to flake job (#44402) 2024-06-19 14:24:16 +00:00
dependabot[bot]
c17bb33f0e Bump ws from 7.5.9 to 7.5.10 (#44345)
Bumps [ws](https://github.com/websockets/ws) from 7.5.9 to 7.5.10.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.9...7.5.10)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-19 17:16:28 +03:00
Uladzimir Havenchyk
400a1a2a10 fix: Do not pass template variables to findColumnIndexesFromLegacyRefs (#44377)
* fix: Do not pass template variables to findColumnIndexesFromLegacyRefs

* Add repro
2024-06-19 16:57:46 +03:00
Alexander Solovyov
f284a522e3 [openapi] fix query parameter detection and add default/description handling (#44239)
Also OpenAPI generation now handles parameter renaming, like in `{c :count}` destructuring.
2024-06-19 16:24:35 +03:00
Uladzimir Havenchyk
b41a5e840f Make dashboard filter auto-wire less presumptuous - add toast animation and hint messages (#44378) 2024-06-19 16:11:19 +03:00
github-automation-metabase
0e9076c0ff Update Readme version references and published npm version to 0.1.10 (#44398) 2024-06-19 13:07:43 +00:00
Kamil Mielnik
6daecbc66b Upgrade RTK to v2 (#44339)
* Upgrade @reduxjs/toolkit from ^1.9.3 to ^2.2.5

* Fix typing

* Upgrade redux-actions and @types/redux-actions

* Fix type errors

* Fix type errors

* Upgrade react-redux from ^8.0.5 to ^9.1.2
- remove @types/react-redux as it's no-longer-needed

* Upgrade redux-promise from ^0.5.0 to ^0.6.0
- upgrade @types/redux-promise

* Remove unused @types/redux-logger

* Revert "Upgrade redux-actions and @types/redux-actions"

This reverts commit 65005a0053.

* Remove createWeakSelector as weakMapMemoize is the default memoization strategy now

* Do not call unsubscribe if it does not exist

* Do not subscribe

* Remove console.log

* Make DelayedLoadingSpinner always render something with data-testid="spinner" so that tests can be aware of when things are loading

* Fix JoinStep unit tests

* Fix AddToDashSelectDashModal unit tests

* Fix SegmentApp unit tests

* Bring back original subscription logic

* Fix DataUsageStep unit tests

* Fix ManageApiKeys unit tests

* Simplify comment

* Fix MainNavbar unit tests

* Fix HomeRecentSection unit tests

* Use afterEach instead of afterAll to reset mocks

* Remove explanatory variable
2024-06-19 18:04:34 +07:00
Ngoc Khuat
613318f786 Metabase channel (#43924) 2024-06-19 09:25:42 +00:00
Ryan Laurie
35f97092e0 ci:Pass enterprise version to ee-extra build (#44386) 2024-06-19 02:38:34 -06:00
Nemanja Glumac
ce95331f30 Rename date/time empty filter options in the simple mode (#44102)
* Rename "empty" date/time filter options

* Add repro for #44101
2024-06-19 10:35:21 +02:00
Oisin Coveney
7de0faa635 Split View Header components into separate files (#44347) 2024-06-19 11:16:03 +03:00
adam-james
37abc08449 Pivot Tables with no Pivot Columns should still download (#44329)
* Pivot Tables with no Pivot Columns should still download

Fixes #44159

Pivot Tables can still be valid without columns, and therefore the download should respect such a query and be
successfully exported.

In this PR, the postprocessing of pivot results into 'visual pivot' exports for csv takes into account the zero-column
configuration and the download no longer fails.

* add a test to confirm that zero cols and >1 measures works as well

* Handle the case where there are zero pivot-rows.

This is a similar problem to the zero pivot-cols case, just with rows.

The app actually doesn't render these tables correctly, but that's a separate frontend bug
2024-06-18 13:20:00 -07:00
Benoit Vinay
6622470420 Add upload button for attached data warehouse (#43511)
* DWH plans added

* UploadCSV button component created

* Comments added

* Main nav bar updates

* Misc

* Align main nav bar button with link

* Misc comment

* Upload package created

* Various upload cleanup

* Misc

* Display button rule cleaned up

* Tracking added to upload CSV button

* Misc comment

* e2e tests WIP

* More comments

* e2e tests basic created

* NEw tracking schema

* e2e tests updated / Tracking WIP

* Analytics cleanup for button

* Misc

* Misc e2e tests Snowplow

* Removed forced Upload CSV button in FE

* Upload helpers created

* Misc unit tests updates

* Updated analytics

* Fix for e2e tests

* Upload fixture paths updated

* Misc for Snowplow

* Misc for plan

* More tests cleanup

* Misc

* Source added to analytics

* Plan unit tests fixed

* Update frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

* Update frontend/src/metabase/components/upload/constants.ts

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

* Misc imports

* Retrieving `uploads-settings` DB

* Remove default UploadCSV component export

* Misc

* Button copy updated

* Analytics updated with optional properties

* Default upload file input id updated

* csvupload schema updated

* Removed before

* No bad Snowplow events added

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-06-18 12:48:32 -04:00
Romeo Van Snick
4f6bf67629 Add RTK endpoints for loading and searching parameters (#44291)
* Add RTK endpoints for loading and searching parameters

* Add Parameter API types

* Move types to metabase-types

* Add return type to normalizeQuery
2024-06-18 18:02:06 +02:00
Oisin Coveney
cc17b9e88e fix(sdk): Fix spacing between collection browser and breadcrumbs (#44342) 2024-06-18 18:35:55 +03:00
Anton Kulyk
1b78f5a361 Fix timeline events filtering in the query builder (#44355)
* Add repro test

* Fix timeline events filtering

* Don't include first date of next interval
2024-06-18 16:23:04 +01:00
Alexander Polyankin
bdbaee5a2a E2E repro for "Fix field values remapping with models & custom dropdown source in public dashboards" (#44315) 2024-06-18 14:09:27 +00:00
John Swanson
d6873e86d5 Fix missing can_restore on collections (#44287)
I'd fixed the `can_restore` on non-collections to always be present, but
forgot about fixing it for collections as well.
2024-06-18 07:01:48 -07:00
Nick Fitzpatrick
413efacef5 [Bug Fix] Use effective location when building initial path in entity picker (#44327)
* use effective location when building initial path in entity picker

* unit test adjustment

* more unit test adjustments
2024-06-18 10:59:14 -03:00
Nemanja Glumac
bc78552d5f Fix metabase lib returning the string "null" as the drill through value (#44234)
* Convert drill-through (CLJ) values to JS

* Convert the drill-through `:null` to an actual `null`

Resolves #44232

* Use new function in `filter-drill-details`

* display-info->js should check for nil before seqable?

* fix js object comparison

* Add test for the `drill-value->js` function

* Simplify the test

* Fix the JS object equality in the test

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-06-18 15:56:36 +02:00
Nemanja Glumac
cb9fac1ddd Update Past to Previous in date filters (#44299) 2024-06-18 15:55:54 +02:00
Alexander Polyankin
191572d90f E2E repro for "Fix issue with root collection in QuestionPicker" (#44318) 2024-06-18 09:33:07 -04:00
Alexander Polyankin
9c18d099ce Add auto-wiring e2e tests for temporal unit parameters (#44326) 2024-06-18 09:30:29 -04:00
Nemanja Glumac
844188a97e Preemptively fix the E2E flake in alerty types (#44344) 2024-06-18 15:15:31 +02:00
Roman Abdulmanov
4ab0cfca9c Mark external PRs with the label (#44343) 2024-06-18 15:44:13 +04:00
Oisin Coveney
8cb98be8af fix(sdk): Remove night mode toggle from SDK static dashboards (#44284) 2024-06-18 11:44:04 +03:00
Oisin Coveney
f57be777d4 fix(sdk): Add theming options for Collection Browser's empty content message (#44281) 2024-06-18 11:05:28 +03:00
Ngoc Khuat
4d907fe8fb dev/rollback! n migrations (#40488) 2024-06-18 14:58:29 +07:00
Ngoc Khuat
62e8739fed Writing migration notes (#44116)
* Writing migration notes
2024-06-18 05:57:19 +00:00
Alexander Polyankin
337dbbe074 Fix remapped values in public dashboards (#44254) 2024-06-17 21:34:35 -04:00
Nick Fitzpatrick
1c83904ee2 Search events 1-1-0 (#44314)
* search events 1-1-0

* backwards compatible adjustment

* making context optional
2024-06-17 18:33:00 -03:00
Jesse Devaney
7f19247f7f Fix incorrect goal line plotting when using non-linear y-axis scales (log/pow) (#44320)
* refactor: de-duplicate variable usage

* fix incorrect goal-line plotting in pow and log y-axis scales

* add Loki variants to validate and enforce desired behavior

* update loki snapshots
2024-06-17 20:57:02 +00:00
Case Nelson
ea9dfd1d2b Change run to make-run in process-query-for-card (#44244)
* Change run to make-run in process-query-for-card

Fixes #44160

There were two levers where a card could change how it was run.

`qp` this is basically `qp/process-query` with some optional userland
flags and constraints marked on the passed in query.
In the case of pivot tables in the
`/pivot/:card-id/query` endpoints it was `qp.pivot/process-query`

'run' this defaults to a streaming response that takes the `qp` param
and `export-format` and passes a query to qp. Most often this is
overriden to not stream the response.

Unfortunately, if `run` is overwritten, then `qp` is thrown away, and
the caller who overrides `run` must determine the correct `qp` to use.

However, when running `process-query-for-dashcard` it is difficult to properly set
`qp` for all of the dashcards without doing card lookups. So [this commit](https://github.com/metabase/metabase/blob/release-x.50.x/src/metabase/query_processor/card.clj#L230-L232) did a check to swap the runner in the presence of a pivot query that calls the **default** runner with a `qp.pivot/run-pivot-query`. The problem is that pulse needs to use a non-default runner, but there's no way for `process-query-for-card` to do both.

This commit changes `run` to `make-run` which raises the abstraction to
a function that produces a runer given a `qp`. This allows
`process-query-for-card` to change the `qp` as needed while keeping the
passed in runner.

There's really three things going on that could be teased apart
further/better.

1. `qp` - this conflates the processor (`qp/process-query` `qp.pivot/run-pivot-query`)
  and modifying query (`qp/userland-query`,
  `qp/userland-query-with-default-constraints` `(update query :info merge info)`)
2. `make-run` - How the above are processed: (streaming/realized)

* Fix tests
2024-06-17 11:29:57 -07:00
Alberto Perdomo
66a189f77f Update SDK README.md (#44292)
Tweak the callout about the SDK still being in development
2024-06-17 18:27:37 +01:00
Alex Yarosh
f8298e49e2 remove audit mentions (#44309) 2024-06-17 11:29:01 -04:00
Raphael Krut-Landau
01db0a2a70 fix: Remove references in the FE to the deprecated enable-query-caching setting (#44263)
* wip

* Remove references to the old enable-query-caching setting

* remove fixme

* linter

* remove some more instances

* fix imports
2024-06-17 10:06:52 -05:00
Alexander Polyankin
a0dfc99c41 E2E repro for "Dashboard filters do not work with SQL models" (#44297) 2024-06-17 14:51:12 +00:00
Ryan Laurie
a72afa4751 Rework slow test group (#44286)
* skip super slow xray test

* unmark not very slow tests
2024-06-17 08:49:18 -06:00
Nemanja Glumac
5fd247c5a1 MS1: Elevate "include this {period}" and "starting from" in the relative date picker (#44279)
* Elevate include this period in the relative date picker (#44179)

* Mock new row with "include {period}"  string

* Implement "include this" using a toggle

* Elevate "starting from" option in the relative date picker (#44242)

* Elevate "Starting from" option in the filter picker

* Tweak the date offset close icon

* Fix tests
2024-06-17 15:59:01 +02:00
Jeff Bruemmer
fdc0b71512 add 50.5 (#44293) 2024-06-17 09:33:18 -04:00
Ryan Laurie
13c71cd054 ci(release): Fix ee-extra trigger in release script (#44282) 2024-06-17 11:43:58 +00:00
Raphael Krut-Landau
93334133ea fix: Remove help email from error diagnostic modal (#44165) 2024-06-15 03:36:04 +00:00
Jesse Devaney
aac751c212 Fix tool-tip values not being scaled in waterfall charts (#44180)
* fix column scaling issues in waterfall chart

- refactor dataset scaling to behave like scatter and cartesian chart models

* add E2E test
2024-06-14 21:12:53 -03:00
Raphael Krut-Landau
9a68f25867 fix(webapp): Tweak dashboard move toast to add internal spaces and ttag context (#44191) 2024-06-14 17:17:59 -04:00
Jeff Bruemmer
9ac932ae16 Note on SQLite and cloud (#44237) 2024-06-14 15:42:51 -04:00
Aleksandr Lesnenko
74e73d2b6a fix charts crash in safari when dataset timezone is not in iana format (#44193)
* fix charts crash in safari when dataset timezone is not in iana format

* Update Loki Snapshots

* better fix: apply offset instead of finding a timezone with such offset

* remove unused specs

* Update Loki Snapshots

* review

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-06-14 19:18:58 +00:00
Cal Herries
dd1eb6cb4d Fix fields from Amazon Athena Tables failing to sync if there is not an underscore in the Table Name (#44032) 2024-06-14 18:26:21 +00:00
John Swanson
27e1ff6452 Fix collection id on collection items endpoint (#44236)
* Fix a potential bug in `hydrate-can-restore`

I had a bug here. I wanted to hydrate `:collection` on the items and
then return the original items, but instead I was `dissoc`ing
`:collection` from the items. If the original items passed in already
had `:collection` keys this would break them.

AFAIK this didn't cause any issues, but it could have - so fixing it here.

* Add a test

* Present collection items in the collection

When fetching collection items, we need to fetch the true
`collection_id` in order to figure out things like `can_restore` and
`can_delete`, but set it to the displayed/effective `collection_id` when
we actually send it out.

This fixes a bug where collections had their `collection_id` match their
`id` when returned by this endpoint.
2024-06-14 18:22:50 +00:00
Ryan Laurie
6d87ed281e ci(release):Tag tech writers in release message (#44216) 2024-06-14 08:39:25 -06:00
Jeff Bruemmer
7d2112e697 Update partner-and-community-drivers.md (#44218) 2024-06-14 11:16:03 -03:00
Sloan Sparger
f702aee6a0 Sort trash collection by last_edited_at desc (#44181) 2024-06-14 09:04:49 -05:00
Alex Yarosh
8c416bd9ab update list of releases (#44217) 2024-06-14 09:56:40 -04:00
Phoomparin Mano
dd00df1a06 Replace usage of color-mod with color-mix and remove the postcss function (#44175)
* replace color-mod with color-mix

* update alpha values to round to 5%

* add deprecation notice to lighten, darken and alpha

* update loki reference image

* add alpha value css variables to storybook preview

* update loki reference image
2024-06-14 13:29:13 +00:00
Abed Habli
0e8469f4b0 capitalize the ‘U’ in user interface (#44196) 2024-06-14 09:12:06 -04:00
Ryan Laurie
e1ade5c665 Trigger ee extra build (#44138) 2024-06-14 06:40:15 -06:00
John Swanson
e677eb7ad2 Always provide can_restore (#44124)
Previously we were just adding this when the item was archived. Instead,
always send a value - if the item is not archived, it can't be restored,
so it will be `false` in this case.

Making this change will make fixing a frontend bug easier, because the
frontend will be able to just trust the `can_restore` value coming in
from the backend.
2024-06-14 05:25:03 -07:00
github-automation-metabase
012a763522 Update Readme version references and published npm version to 0.1.9 (#44212) 2024-06-14 12:13:41 +00:00
Oisin Coveney
d7a1e86798 fix(sdk): Update README to move Embedding the collection browser to Features currently supposed (#44208) 2024-06-14 11:46:42 +00:00
Ryan Laurie
4bbc3163e2 Better Release Slack Notifications (#44195)
* add additional release slack message

* trigger slack messages from build

* fixes

* remove silly var name
2024-06-14 05:35:30 -06:00
Ryan Laurie
c769688711 Update release script to trigger ops issue creation (#39634)
* update release script to trigger ops issue creation

* update secret vars
2024-06-14 05:27:35 -06:00
Kamil Mielnik
5258ec54f8 Fix background-color usage in CSS-in-JS (#44204) 2024-06-14 11:25:30 +00:00
Ryan Laurie
4f25a4720b Combine collections e2e specs (#43841)
* combine collections e2e specs

* obey the linter
2024-06-14 05:12:09 -06:00
Raphael Krut-Landau
1bfcdf8c90 fix(admin): Rename some variables (#43817) 2024-06-14 06:40:19 -04:00
Oisin Coveney
7854e07a62 fix: Ensure interactive embedding CTA matches instance features (#44197) 2024-06-14 13:32:50 +03:00
Oisin Coveney
81a586df95 fix(sdk): Add theming to collection browser breadcrumbs (#44066) 2024-06-14 12:19:04 +03:00
Nemanja Glumac
884901f20a Remove "is empty" and "not empty" from time-series chrome (#44164)
* Remove "is empty" and "not empty" from time-series chrome

* Fix unit test
2024-06-14 11:00:58 +02:00
Phoomparin Mano
9decd3e8ed docs(sdk): add theming changes to embedding SDK docs (#44172)
* docs update

* add dashboard.backgroundColor
2024-06-14 08:58:04 +00:00
Romeo Van Snick
62123c073e Use MultiAutocomplete in dashboard filters (#43293)
* Use MultiAutocomplete in dashboard filters

* Handle prefix on MultiAutocomplete

* Remove unnecessary tests for empty values

* Remove input className

* Handle numbers in MultiAutocomplete

* Accept number values in MultiAutocomplete

* Use MultiAutocomplete in NumberInputWidget

* Filter out empty items

* Do not expect formatted number in values

* Do not allow adding multiple values when multi is false

* Handle undefined values

* Make value optional

* Fix MultiAutocomplete types

* Make MultiAutoComplete generic in its value type

* Refine MultiAutocomplete type in NumberInputWidget

* Refine MultiAutocomplete type in FieldValuesWidget

* Fix typo

* Fix MultiAutocomplete tests

* Add helpers to work with MultiSelect and MultiAutocomplete inputs

* Handle MultiAutocomplete input in tests

* Fix filter helper

* Use multiAutocompleteInput helper

* Find the value remove button in test

* Fix tests for NumberInputWidget

* Fix tests for DefaultPicker

* Fix type in NumberInput

* Fix dasboard test

* Fix embedding test

* Add helpers to remove values

* Fix chained filter test

* Fix nested test

* Fix embedding tests

* Fix filter tests

* Use removeMultiAutocompleteValue

* Use removeMultiAutocompleteValue

* Remove unused variable

* Use multiAutocompleteInput helper

* Handle comma's in values

* Handle multiselect

* Fix filter test

* Add filter

* Format field value

* Fix embedding tests

* Allow rendering custom label for item

* Use renderValue in FieldValuesWidget

* Fix data prop type

* Be more explicit about broken types in FieldValuesWidget

* Fix default behaviour for label

* Fix embedding tests

* Force click

* Fix sharing test

* Use removeMultiAutocompleteValue

* Handle multiautocomplete inputs

* Force click filter

* Close the suggestions menu

* Fix email test

* Fix sharing filter

* Set viewport in test

* Fix sharing test

* Remove debugging logs

* Use removeMultiAutocompleteValue

* Close the suggestions menu using blur

* Remove commented out code

* Remove the unused color prop

* Move shared types to types file

* Rename ValueType to TValue

* Add missing forwardRef

* Add tests for filter and renderValue

* Use TokenField for single value parameters

* Fix single value test

* Be more specific about when to select a single input

* Fix single value e2e test

* Handle undefined parameter

* Accept all RowValue types in MultiSelect

* Accept all RowValue types in ListField

* Accept all RowValue types in SingleSelectListField

* Be more precise about the FieldValuesWidget value types

* Be more specific about when to render normal input

* Remove duplicate import

* Remove maxSelectedValues from MultiAutocomplete

* Parse values in FieldValuesWidget

* Remove parsing complexity from MultiAutocomplete

* Be more strict when parsing numbers

* Do not use multiselect when arity is 1

* Remove spurious changes

* Pass prefix from FieldValuesWidget

* Remove number MultiAutocomplete story

* Remove renderValue from MultiAutocomplete

* Add custom component to MultiAutocomplete

* Add missing data prop

* Remove spurious changes in MultiAutocomplete

* Remove SelectItem reference

* Use renderValue in FieldValuesWidget
2024-06-14 10:04:18 +02:00
Nick Fitzpatrick
a8d5ea6437 fix(command-palette): fix docs url (#44113) 2024-06-13 22:49:44 -04:00
Raphael Krut-Landau
a95ff7f595 fix: Remove console warnings in cache-related code (#44173)
This PR removes:
- a warning about missing React keys in the `Schedule` component
- a warning about invalid props in the `StrategyFormLauncher` component
2024-06-13 22:32:54 -04:00
Raphael Krut-Landau
e33acdc6b6 feat(admin/cache): Use distinct routes for each performance tab (#44139) 2024-06-14 00:38:32 +00:00
Raphael Krut-Landau
1088baf011 [Browse] Add skeletons to Browse models (#44008)
* adds a shimmer effect to the skeletons
* adds a `natural` prop that makes the skeletons have a random width between 50% and 80%
* adds a skeleton to Browse models

Closes #44111
2024-06-13 20:33:56 -04:00
Braden Shepherdson
ba182e1745 [QP] Fix :fields clauses in nest-query with extra aggs outside model (#44182)
Fixes #43993.
2024-06-13 22:55:07 +00:00
Sloan Sparger
458fbf9efb fixes coloring for bulk actions bar button (#44178) 2024-06-13 17:14:59 -05:00
Nick Fitzpatrick
4772b5e249 Adding snippets back into getCollection (#44097)
* adding snippets back into getCollection

* e2e test

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-06-13 17:01:58 -05:00
Phoomparin Mano
04a08d3304 replace css variables in static viz (#44131) 2024-06-14 03:04:15 +07:00
Noah Moss
2e94093025 Don't sync JWT registered claims as login attributes (#43976) 2024-06-13 19:10:53 +00:00
Noah Moss
d971a83601 Minor refactoring in JWT/SAML tests (#43866)
* little bit of refactoring in sso test code

* use :once instead of :each
2024-06-13 14:22:37 -04:00
Noah Moss
16599b223e Relax constraints on GET /api/user/:id endpoint (#44100) 2024-06-13 14:13:18 -04:00
Noah Moss
c7bf7d1def Fix login_history indexed columns (#44091) 2024-06-13 14:13:01 -04:00
Phoomparin Mano
d843973a8e feat(sdk): option to hide dashboard card title (#43859)
* expose card title settings

* Add dashboard test skeleton

* add a sample dashcard to the test

* dashboard grid should have card title by default

* add unit test for card title

* remove unused delay in unit test

* fix width and height being smaller than min values

* flip grid layout condition

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-06-14 00:54:01 +07:00
Raphael Krut-Landau
c7e46dc961 fix(ui-library): Don't animate Buttons (micro-PR) (#44137) 2024-06-13 16:10:33 +00:00
Phoomparin Mano
ee38f0e449 feat(sdk): apply theme options to tables in static dashboard (#44007)
* apply cell background color

* add id column overrides

* do not add transparency to id column cell when overridden

* fix static dashboard theming

* update loki reference image

* add style resets and regenerate loki snapshots

* add style resets and regenerate loki snapshots
2024-06-13 21:34:26 +07:00
Aleksandr Lesnenko
6e87cb9306 Fix invalid areas when line style is step (#44107)
* fix area step

* specs
2024-06-13 11:08:22 -03:00
Chris Truter
68bd9781ae Update Macaw to fix double blank lines (#44119) 2024-06-13 15:20:53 +02:00
Alex Yarosh
c5ef3fe772 [docs] update the list of releasts for 50.3 and 49.16 (#44125) 2024-06-13 09:11:19 -04:00
Anton Kulyk
ffbad1d6ae Fix broken line/area/bar charts after adding a second stage filter (#44053)
* Rework column sync to work with series objects

* Reuse previous metrics and dimensions if available

* Add repro test
2024-06-13 13:57:43 +01:00
Alexander Polyankin
3afe4821a0 Fix issue with root collection in QuestionPicker (#44081) 2024-06-13 03:52:09 +00:00
dpsutton
8824bd9a19 Handle errors when inferring separator of csv (#44073)
* Handle errors when inferring separator of csv

This file

```
"c1","c2"
"a,b,c","d"
```

was failing to upload for a silly reason: when we were checking for
which separator it used, we had a parse error when using a semi-colon
and that blew up the whole pipeline.

* Use cal's helpful test suggestions
2024-06-12 17:21:52 -05:00
Raphael Krut-Landau
e2144d140d Remove dead props in getButtonOverrides (#44082) 2024-06-12 16:55:17 -04:00
John Swanson
837beda619 Set can_delete to false for unarchived items (#44088)
Although a user may have the necessary permissions to delete an item, if we're not going to allow deleting unarchived items, can_delete should be false for them too.
2024-06-12 20:24:22 +00:00
Jeff Bruemmer
eb9bb2dad7 docs - minor edit (#44089) 2024-06-12 16:14:52 -04:00
Raphael Krut-Landau
6240dee136 [Browse] Use a loading skeleton instead of a spinner for Browse models in the nav (#43970)
* Add our first Mantine Skeleton

* Sort

* Simplify Skeleton.tsx
2024-06-12 15:16:34 -04:00
Alexander Polyankin
bab6387cdf Consolidate temporal unit pickers between dashboards and timeseries chrome (#44061) 2024-06-12 18:47:13 +00:00
Raphael Krut-Landau
44cfdf48e2 Make model persistence tab available on OSS (#44059) 2024-06-12 14:36:26 -04:00
Anton Kulyk
0cce65e2cb Move syncColumnSettings to metabase/visualization (#44074)
* Move `syncColumnSettings` to metabase/visualization

* Remove unused `SettingsSyncOptions`

* Fix type errors
2024-06-12 19:14:05 +01:00
Sloan Sparger
edcd2ff7c9 Fix "Manage database" perms incorrectly show up on the schema-level permissions page (#43601) 2024-06-12 13:02:01 -05:00
Jeff Bruemmer
fa8c7a2361 docs - release list 50.1 (#44076) 2024-06-12 13:26:21 -04:00
Alexander Solovyov
d638e94971 certain settings should be decrypted for cache config migration to run (#44048) 2024-06-12 11:22:04 -06:00
Ryan Laurie
d7bd5603bc Combine and reorganize admin e2e specs (#43853)
* combine and reorganize admin specs

* fix import and reorganize more
2024-06-12 11:20:47 -06:00
Ryan Laurie
acd7c31f22 Combine embedding e2e specs (#43843) 2024-06-12 11:20:25 -06:00
Ryan Laurie
cbda131e84 Combine native e2e specs (#43844) 2024-06-12 11:20:01 -06:00
Ryan Laurie
121054b293 Update how we run maildev in pre-release testing (#44072) 2024-06-12 10:27:22 -06:00
Oisin Coveney
fad00d4346 Convert Badge and CollectionBadge (#43997) 2024-06-12 17:18:15 +03:00
Alexander Polyankin
084dd3b2ae Allowlist for temporal unit parameters (#43967) 2024-06-12 10:05:24 -04:00
Ngoc Khuat
937e3daac1 Fix get card query_metadata and dashboard query_metadata throws 500 when users don't have view perms on any tables (#44052) 2024-06-12 15:53:50 +02:00
Nemanja Glumac
01e9387f62 Fix broken filter E2E test (#44051)
* Fix broken E2E test

* Remove linter warning
2024-06-12 12:31:03 +00:00
Oisin Coveney
14db7aeeac feat(sdk): Add collection browser (#43606) 2024-06-12 11:37:42 +03:00
Uladzimir Havenchyk
f7502d96e7 Restore icons in the new filter popup (#44025)
* Restore icons in the new filter popup

* it.each
2024-06-12 07:40:48 +00:00
Ivan Križnar
bae0aedf2c Fix scrollbar interaction in the custom expression suggestion list (#43995)
* Fix dismissing popup

* Undo revert

* Merge refs

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorTextfield/ExpressionEditorTextfield.tsx

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorSuggestions/ExpressionEditorSuggestions.tsx

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorSuggestions/ExpressionEditorSuggestions.tsx

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>

* Use semantically correct HTML

* Fix popmenuTarget type

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-06-12 09:07:40 +02:00
Aleksandr Lesnenko
ae2c960913 fix single series bar hover (#43984)
* fix single series bar hover

* prefer reduced motion
2024-06-12 01:17:09 +00:00
Case Nelson
febfe4a5aa [Metrics V2] Metrics with filters on implicitly joined columns produce query error when added in a Summarize block (#43987)
* [Metrics V2] Metrics with filters on implicitly joined columns produce query error when added in a Summarize block

* Handle multiple metrics with same implicit join

* Address PR feedback
2024-06-11 16:12:51 -06:00
Nemanja Glumac
9ebb679f6d Fix "collection items sorting" E2E flake (#44023)
* Fix "collection items sorting" E2E flake

* Add comments

* Remove the `@flaky` tag
2024-06-11 19:45:45 +00:00
Nemanja Glumac
ce5d2547e7 Remove the custom resize handle from the notebook native query preview sidebar (again) (#44021) 2024-06-11 19:25:02 +00:00
Jeff Bruemmer
6c1458ff2f uploads in config file (#43891) 2024-06-11 14:13:32 -04:00
Nemanja Glumac
8af1555502 Fix the dashboard drill E2E flake (#44016) 2024-06-11 17:02:41 +00:00
bryan
7b849da346 Make recents understand context (#43478)
* adds the endpoint and a test

* add recents endpoint, todo: tests

* add post recents endpoint

* return recent views for both lists, but make the endpoint work

* Make recent-views context aware

- pruning is context aware, only checks for the recently-inserted
  context
- Adds endpoints:
    - POST to create selection recents,
    - GET activity/recents
      - requres context query param to be one of:
      - all, views, selections

- Adds context arg to update-users-recent-views!
- Cleans up arg schema for update-users-recent-views

* impl GET api/activity/recents

- return recent-selections and recent-views from
- send context == collection from pinned card reads

* update callsites of recent-views/update-users-recent-views!

- to use :view param where necessary

* fixes models/recent-view tests

* adds more activity/recent-view tests

* wip

- fix whitespace linter

* Fix command palette e2e test

- reuse util snake-keys

* updates fe to use new recents endpoints

* fixes fe type issue

* snake-keys -> deep-snake-keys

- I've been betrayed by lsp rename

* snake-keys -> deep-snake-keys

- I've been betrayed by lsp rename

* log selection events for created collections

* mysql doesn't allow default values for TEXT types

* log a recent view on data-picker selection

* decouple view-log context from card-event view context

* fix a doc typo

* stop double logging recent-views on POST

* maybe fixes some tests

* some e2e fixes

* fix mysterious divide by zero during score search

* fix divide by zero possibilities everywhere in score-items

metabase.api.activity/score-items used to throw when there weren't any
items being scored (even though there's a `(when (seq items) ...)` check)

* more test fixes

* fix more e2e tests, + rename endpoint in tests

* fix oopsie

* fixes a few more tests

* address review comments/questions

* allow for a comma delimited list in qps like ?context=views,selections

returns all recent view items with those contexts, most recent first
under the `:recents` key.

* refactors FE around new endpoint

* fixes for unit tests

* use ms/QueryVectorOf for context

* fix models/recent_views tests

* use multiple query params instead of comma delimited value on FE

* ignore timestamp when deduping recents

* review comments + test fixing

* update docstring

* fix api/activity_test s

* actually dedupe

* add test for deduping by context

* e2e fix: shows up-to-date list of recently viewed items after another page is visited

* e2e fix: should undo the question replace action

* e2e fix: should replace a dashboard card question (metabase#36984)

* e2e fix: should preselect the most recently visited dashboard

* fix 6 more e2e tests

* fixes fe type check and unit failure

* renames unit test mocking function

* fix a flaky e2e test

* widen Item to accept str or kw where sensible

- allow strings or keywords for moderated_status, and authority_level

* simplify impl + add test

* add view-log to events schema

* add collection context to view log

* fix the final 2 failing e2e tests

* click dashboard tab when the user has can-read? on recent entities

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-06-11 10:12:29 -06:00
John Swanson
7374e61ed7 Improve the Trash data model (#42845)
* Improve the Trash

Ok, so I had a realization at the PERFECT time, immediately after the RC
cutoff. Great job, brain!

Here's the realization. For the Trash, we need to keep track of two
things:

- where the item actually is located in the hierarchy, and

- what collection we should look at to see what permissions apply to the
item.

For example, a Card might be in the Trash, but we need to look at
Collection 1234 to see that a user has permission to Write that card.

My implementation of this was to add a column,
`trashed_from_collection_id`, so that we could move a Card or a
Dashboard to a new `collection_id`, but keep track of the permissions we
actually needed to check.

So:

- `collection_id` was where the item was located in the collection
hierarchy, and

- `trashed_from_collection_id` was where we needed to look to check
permissions.

Today I had the realization that it's much, much more important to get
PERMISSIONS right than to get collection hierarchy right. Like if we
mess up and show something as in the Trash when it's not in the Trash,
or show something in the wrong Collection - that's not great, sure. But
if we mess up and show a Card when we shouldn't, or show a Dashboard
when we shouldn't, that's Super Duper Bad.

So the problem with my initial implementation was that we needed to
change everywhere that checked permissions, to make sure they checked
BOTH `trashed_from_collection_id` and `collection_id` as appropriate.

So... there's a much better solution. Instead of adding a column to
represent the *permissions* that we should apply to the dashboard or
card, add a column to represent the *location in the hierarchy* that
should apply to the dashboard or the card.

We can simplify further: the *only time* we want to display something in
a different place in the hierarchy than usual is when it was put
directly into the trash. If you trash a dashboard as a part of a
collection, then we should display it in that collection just like
normal.

So, we can do the following:

- add a `trashed_directly` column to Cards and Dashboards, representing
whether they should be displayed in the Trash instead of their actual
parent collection

- use the `collection_id` column of Cards and Dashboards without
modification to represent permissions.

There's one main downside of this approach. If you trash a dashboard,
and then delete the collection that the dashboard was originally in,
what do we do with `dashboard.collection_id`?

- we have to change it, because it's a foreign key

- we can't set it to null, because that represents the root collection

In this initial implementation, I've just cascaded the delete: if you
delete a dashboard and then delete a collection, the dashboard will be
deleted. This is not ideal. I'm not totally sure what we should do in
this situation.

* Rip out all the `trashed_from_collection_id`

* Migration to delete trashed_from_collection_id

* fixes

* don't move collections

And don't allow deleting collections

* only show cards/dashboards with write perms

* Show the correct archived/unarchived branch

* some cleanup

* add a todo for tomorrow

* Fix for yesterday's TODO

* more wip

* refactor

* memoize collection info

* move around memoization a bit

* fix schema migration test

* oops, delete server.middleware.memo

* Use a migration script (postgres only for now)

* Fix some tests

* remove n+1 queries in `collection-can-restore`

* fix test

* fix more tests, and x-db migration script

* fix h2 rollback

* fix mysql/mariadb migration

* lint

* fix some mariadb/mysql tests

* fix h2 rollback

* Fix mysql rollback

* Fix Postgres migration

* "Real" `trash_operation_id` UUIDs from migration

* fix mariadb migration

* Separate MySQL/MariaDB migrations

* trashed directly bit->boolean

* Remove `trashed_from_*` from migrations

* Rename `api/updates-with-trashed-directly`

Previously named `move-on-archive-or-unarchive`, which was no longer
accurate since we're not moving anything!

* Add `can_delete`

* Delete test of deleted code

* Can't move anything to the Trash

The Trash exists as a real collection so that we can list items in and
such without needing special cases. But we don't want anything to
_actually_ get moved to it.

* integrates can_delete flag on FE

* Update src/metabase/models/collection.clj

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

* Update src/metabase/search/impl.clj

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

* Better name for `fix-collection-id`

Also consolidated it into a single function. It takes the
trash-collection-id as an argument to prevent a circular dependency.

* s/trashed/archived/ on the backend

In the product, we want to move to "trashed" as the descriptor for
things that are currently-known-as-archived.

It'd be nice to switch to that on the backend as well, but that'll
require quite a lot of churn on the frontend as we'd need to change the
API (or have an awkward translation layer, where we call it `trashed` on
the backend, turn it into `archived` when sending data out via the API,
and then the FE turns around and called it "trashed" again).

For now, let's just be consistent on the backend and call it `archived`
everywhere. So:

- `archived_directly` instead of `trashed_directly`, and
- `archive_operation_id` instead of `trash_operation_id`

* Fix up a couple docstrings

* Rename `visible-collection-ids` args

for `collection/permissions-set->visible-collection-ids`:

- `:include-archived` => `:include-archived-items`

- `:include-trash?` => `:include-trash-collection`

* select affected-collection-ids in the tx

* Stop dealing with `:all` visible collection ids

This used to be a possible return value for
`permissions-set->visible-collection-ids` indicating that the user could
view all collections. Now that function always returns a set of
collection IDs (possibly including "root" for the root collection) so we
don't need to deal with that anymore.

* Don't use separate hydration keys for collections

Dispatch on the model of each item (but still keep them in batches for
efficiency.)

* vars for collectable/archived-directly models

* Round up loose `trashed_directly`s

* Fix a test

* Use `clojure.core.memoize` instead of handrolled

It's slightly different (TTL instead of exactly per-request) but that
should be fine.

* FE lint fixes

* 😭 e2e test fix

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-06-11 11:31:14 -04:00
Phoomparin Mano
a742b3408b feat(sdk): theme option to customize the dashboard card border (#43963)
* add option to customize dashcard border

* use the shadow CSS variable

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* make the shadow and border decoration call more explicit

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* pass in theme as argument

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-06-11 22:14:46 +07:00
Romeo Van Snick
d876627b24 Unary number parameter (#43921)
* Allow picking arity of number parameters

* Limit to input to have arity 1 when multi is false

* Use MultiAutocomplete in NumberInputWidget when arity is 1

* Add test cases for single value numbers

* Only change arity when it is n

* Fix unit tests for NumberInputWidget

* Move arity check for numbers to getNumberParameterArity
2024-06-11 16:57:14 +02:00
Jeff Bruemmer
64f82436ef docs - updates for 50 (#44002) 2024-06-11 10:38:15 -04:00
Nemanja Glumac
28fc332064 Fix "line/bar chart" tooltip flake (#43975)
* Fix the typo

* Replace `realHover` with the `mouseMove` trigger

* Be explicit when targetting elements by their index

* fix combo chart tooltip e2e specs

* cy.wait as a last resort

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-06-11 14:09:24 +00:00
Aleksandr Lesnenko
6ec9de852e move stackable settings (#43978) 2024-06-11 13:42:56 +00:00
Nemanja Glumac
eebf4b5239 Fix E2E flake in the native_subquery spec (#43991)
* Re-work `startNewNativeQuestion` helper

* Fix native_subquery flakes

* Simplify the helper

* Remove the `flaky` tags
2024-06-11 14:10:58 +02:00
Kamil Mielnik
c0a804bfe6 Copy question link from dashboard (#43816)
* Improve typing in Question

* Remove dead CSS

* Improve typing in getUrlWithParameters

* Add LegendLabel

* Drop navigateToNewCardFromDashboard in PublicOrEmbeddedDashboard

* Extract getNewCardUrl and move getParametersMappedToDashcard closer to it

* Add link to dashboard chart title

* Update title-drill tests

* Format code

* Update test

* Add HrefMemo

* Use state to memoize href

* Recompute state on getHref prop change

* Format code

* Refactor href computation

* Update test

* Use selector instead of useMemo

* Fix unit tests

* Ensure type safety

* Revert getDashCardById type change to not make this PR too large

* Use complete dashboard

* Add a workaround for metabase#43990
2024-06-11 17:39:45 +07:00
Kamil Mielnik
40ef144430 Revert "Fix scrollbar interaction in the custom expression suggestion list (#…" (#43992)
This reverts commit a297e9a6ad.
2024-06-11 10:14:33 +00:00
Phoomparin Mano
6113998662 apply full width to static dashboard (#43954) 2024-06-11 17:05:35 +07:00
Mahatthana (Kelvin) Nomsawadi
ddb6299993 Release a test from the flaky test jail (#43946) 2024-06-11 09:06:03 +01:00
Mahatthana (Kelvin) Nomsawadi
459429985c ci(sdk): Remind SDK PR author to use conventional commits PR title (#43932)
* Remind embedding SDK PR author to use conventional commits

* Only remind PR author when PR title isn't conventional commits

* Add branch for testing

* Fix gh cli command

* Fix getting wrong user login

* Ensure we don't create more than 1 comment

* Improve comment format

* Add more info for non-changelog related type

* Check non-changelog related types

* Update the comment for consistency

* Revert "Add branch for testing"

This reverts commit 4a1be68828.
2024-06-11 07:30:35 +01:00
Chris Truter
a46b9d7fc2 More precise migration range logs (#43962) 2024-06-11 08:21:58 +02:00
Denis Berezin
e8fedf0164 feat(sdk): SDK theming part 6 - text-brand, text-dark, text-light, text-medium, admin-navbar, accentX (#43687)
* Migrate text-brand

* Migrate text-dark

* Migrate text-light

* Migrate text-medium

* Migrate admin-navbar

* make compact formatting consistent across all series (#43472)

* make compact formatting consistent across all series

* fix rebase

* [Browse] Show Browse models link in nav only when there are models (#43286)

* Upgrade to TypeScript v5.4 (#43736)

* use correct github api for CI (#43750)

* update list of releases (#43754)

* Multi Series Dashcards Render with Filters Applied To All Series (#43428)

* Multi Series Dashcards Render with Filters Applied To All Series

Fixes: #39083

Multi-series dashcards now properly render when a subscription is set up with filters that impact the values of each
card in the multi-series card.

* Small refactor for executing dashcards in a pulse context.

- move execute-dashboard-subscription to pulse.util
- this fn now will also execute all card series cards
  and put those results into a list on the key :series-results in the dashcard
  which is then used in the render multimethod to send the correct data to the javascript context

A small todo was taken care of as well, we can now use :dashboard-subscription in the :context key

* Fix up render fn

The shape of hte data going into the javascript was a bit unclear before. This keeps things a little more
understandable.

Next step is probably to create some Malli schemas inside the js_svg namespace to document and enforce the needed data shapes

* pull :data up a level from :result in the series cards

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

* Remove unneeded let

* set/rename-keys won't work here because we raise the :data key

I've realised a suggested change to just use set/rename-keys won't do what we need. We need instead to raise :data
from within the result key up to the same level (and dissoc result).

I've renamed the helper function to make its purpose a bit clearer

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

* Hydrate can_run_adhoc_query and address review comments (#43747)

This is a followup on #43625.

* Consolidate dashboard-card specs (#43716)

* Consolidate joins specs (#43717)

* Update translations for v50 and add Danish Language Support (#43314)

* update translations for v50

* add Danish

* update translations for v50 release

* alphabetical order is nice

* Move database role to url parameters from connection properties on Snowflake (#43602)

* Move role to url parameters from connection properties

* Fix test

* Fix width of save button in cache sidebar (#43755)

* Remove dead code (#43603)

* Combine search e2e specs (#43718)

* Highlight the table cell data in dashboards when the cell is an ID column (#43728)

* highlight id cell column

* add simpletable stories

* add simple table test data

* add loki reference image

* Update frontend/src/metabase/visualizations/components/TableSimple/TableCell.styled.tsx

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* Remove old repro for 39150 (#43749)

* Fix remaining `tinyint` booleans in MySQL (#43296)

* Correct type for `report_card.dataset`

This was missed in the original migration of boolean types to
${boolean.type} in MySQL/MariaDB, and then missed again by me when I
migrated `collection_preview` over a week ago.

* Change all boolean types to `bit(1)` in MySQL

Liquibase changed their boolean type in MySQL from `bit(1)` to
`tinyint(4)` in version 4.25.1. Our JDBC driver does not recognize these
as booleans, so we needed to migrate them to `bit(1)`s.

As discussed [here](#36964), we
changed all existing `boolean` types that were in the
`001_update_migrations.yml` but not the SQL initialization file.

For new installations, this works: things in the SQL initialization file
get created with the `bit(1)` type.

However, for existing installations, there's a potential issue. Say I'm
on v42 and am upgrading to v49. In v43, a new `boolean` was added.

In this case, I'll get the `boolean` from the liquibase migration rather
than from the SQL initialization file, and it need to be changed to a
`bit(1)`.

I installed Metabase v41 with MySQL, migrated the database, and then
installed Metabase v49 and migrated again. I made a list of all the
columns that had the type `tinyint`:

```
mysql> SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_TYPE,        COLUMN_DEFAULT, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_TYPE = 'tinyint' AND TABLE_SCHEMA='metabase_test';
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| TABLE_SCHEMA  | TABLE_NAME                   | COLUMN_NAME       | COLUMN_TYPE | COLUMN_DEFAULT | IS_NULLABLE |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| metabase_test | core_user                    | is_datasetnewb    | tinyint     | 1              | NO          |
| metabase_test | metabase_field               | database_required | tinyint     | 0              | NO          |
| metabase_test | metabase_fieldvalues         | has_more_values   | tinyint     | 0              | YES         |
| metabase_test | permissions_group_membership | is_group_manager  | tinyint     | 0              | NO          |
| metabase_test | persisted_info               | active            | tinyint     | 0              | NO          |
| metabase_test | report_card                  | dataset           | tinyint     | 0              | NO          |
| metabase_test | timeline                     | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline                     | default           | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | time_matters      | tinyint     | NULL           | NO          |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
10 rows in set (0.01 sec)
```

Then wrote migrations. For each column, we:

- turn it into a `bit(1)`,

- re-set the previously existing default value, and

- re-add the NOT NULL constraint, if applicable.

* Change author and add missing `dbms`

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>

* Add ts-pattern library (#43752)

* Add events to measure search performance (#43135)

* new_search_query event

* Filters in object, search click event

* updating event schema

* type and event schema adjustments

* delete comments BE code

* adjusting tests

* PR feedback

* typos and spacing

* Fixup missing colors

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: SakuragiYoshimasa <ysrhsp@outlook.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
2024-06-10 22:13:47 +00:00
Aleksandr Lesnenko
8936df34fb fix bar normalized stacking breaks line charts (#43957)
* fix bar normalized stacking breaks line charts

* spec
2024-06-10 21:24:30 +00:00
Emmad Usmani
80d33f6869 remove unused timeseries interval (#43421)
* remove two year timeseries interval

* use two year instead of five year interval

* update binning e2e spec
2024-06-10 21:17:15 +00:00
Nemanja Glumac
c62003fff3 Fix the flaky "bookmark" E2E test (#43965)
* Fix the flaky "bookmark" E2E test

Resolves #43871

* Remove the `flaky` tag
2024-06-10 22:27:02 +02:00
Alexander Polyankin
f530b0fd31 E2E tests for temporal unit parameters (#43688) 2024-06-10 16:24:51 -04:00
lbrdnk
f971c42ada Add connection string parsing to Snowflake (#43923)
* Add connection string parsing

* Add test case with role suffixed key
2024-06-10 22:04:10 +02:00
metamben
be9740ca70 Enable Clojure logging in the browser (#43959)
Messages at INFO level and higher will appear in the browser console.
2024-06-10 22:39:47 +03:00
Uladzimir Havenchyk
dc4614151c [Dashboard] Replace automatic wiring of the cards with opt-in variant (#43827) 2024-06-10 22:19:17 +03:00
Nemanja Glumac
84fd549fff Fix "CC typing suggestion" E2E flake (#43956)
* Fix E2E flake "cc-typing-suggestion"

Resolves #43872

* Remove `@flaky` tag

* Improve the assertion
2024-06-10 20:34:46 +02:00
Cal Herries
a2f3d74950 Actually validate view_log.context matches ::view-log/context on insert (#43801) 2024-06-10 18:04:08 +00:00
Nemanja Glumac
121fe66f67 Fix flaky E2E test "sidebar should be resizable" (#43947)
* Fix flaky E2E test "sidebar should be resizable"

* Remove the `flaky` tag

* Remove unused intercept
2024-06-10 17:35:36 +00:00
Ivan Križnar
a297e9a6ad Fix scrollbar interaction in the custom expression suggestion list (#43837)
* Expose `ExpressionEditorSuggestions` ref

* Add popup ref

* Prevent popup being dismissed when active

* Update displayName
2024-06-10 19:08:15 +02:00
metamben
8609c02bb6 Bulk load data for can_run_adhoc_query and table metadatas (#43899) 2024-06-10 19:47:31 +03:00
Raphael Krut-Landau
46215d51fc Remove classnames (#43869) 2024-06-10 12:33:38 -04:00
Raphael Krut-Landau
752749f79e [Cache] Fix save button bug and several smaller issues (#43810) 2024-06-10 15:49:25 +00:00
Chris Truter
5fc87983ff Avoid guessing Liquibase table name (#43928) 2024-06-10 15:29:09 +00:00
Raphael Krut-Landau
b6dea77ab0 Use the metric icon for metrics (#43893)
Closes #43894
2024-06-10 10:48:26 -04:00
Anton Kulyk
f106ffa776 Fix stacked redirects to homepage dashboard crashing the app (#43836)
* Add repro test

* Move home selectors to `metabase/selectors/app`

* Prevent unnecessary redirects to home dashboard

* Rename

* Handle navbar home link

* Fix unit tests

* Fix navigating away from an archived dashboard

* Handle sub-root Metabase URLs
2024-06-10 15:30:07 +01:00
Chris Truter
2cf666d9af Rename 'direct' fields references to 'explicit' (#43823) 2024-06-10 13:58:41 +00:00
Cal Herries
67fec430a5 Change the uploads-enabled setting's visibility to internal (#43849) 2024-06-10 07:54:03 -06:00
Denis Berezin
7046fef3c4 feat(sdk): SDK theming part 5 - success, summarize, warning, white, text-white, bg-white (#43676)
* Migrate success

* Migrate summarize

* Migrate warning

* Migrate white

* Add colors to storybook

* Fix CI

* Fix CI

* Codereview fixes

* Convert warning color
2024-06-10 16:34:51 +03:00
Jeff Bruemmer
88734ca33c note on locked filters (#43886) 2024-06-10 08:34:32 -04:00
Kamil Mielnik
897a22f298 Time-over-time comparison - e2e tests (#43724)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Add tracking helpers

* Add new schema

* Add tracking in column header

* Add tracking in plus modal

* Add tracking in aggregation picker

* Fix destructuring

* Add functionsUsedByExpression

* Fix schema number

* Add tests boilerplate

* Implement test for notebook editor

* Add test for column header

* Add a test for summarize sidebar

* Add a test for the plus button

* Add expectNoBadSnowplowEvents call in afterEach

* Format code

* Add missing redux store state in tests

* Add data for tests

* Move createQuestion call out of beforeEach

* Add tests for labels when there are no aggregations

* Add describe

* Add group helper

* Revert "Add group helper"

This reverts commit e047a223e9.

* Optimize: use cy.log() instead of it()

* Format code

* Add tests for 1 breakout, add helpers

* Add test for non-binned datetime column text

* Add test for non-datetime column text

* Nest tests

* Add test for multiple aggregations and no breakout, fix getTitle in this case

* Add all text tests

* Reduce nesting

* Enable test

* Format code

* Add tests

* Rename function

* Format code

* Simplify code

* Add assertions

* Format code

* Add column assertions

* Run tests with all 3 aggregations

* Remove logs

* Introduce CUSTOM_EXPRESSIONS_USED

* Avoid force click

* Remove explicit assertion

* Use be.visible instead of exist

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-10 11:56:46 +00:00
Ngoc Khuat
35b8b8b814 Fix flaky skip-if-empty-test by making sure pulse card follow ordres (#43913) 2024-06-10 08:05:22 +00:00
Uladzimir Havenchyk
8f399a1b3e Replace deprecated option from typescript v5 with eslint rule (#43767) 2024-06-10 10:43:50 +03:00
Ngoc Khuat
7b919f8b27 Task history sorted by started at (#43809) 2024-06-10 06:17:16 +00:00
Ngoc Khuat
51098a6cfa If there is an error in sync processes, make sure we catch the right exception (#43821) 2024-06-10 05:39:12 +00:00
Jesse Devaney
c93403e98f Fix stacked bar chart tool-tips when total value is negative (#43883)
* fix stacked bar chart tooltips when total value is negative

* add E2E test
2024-06-10 03:01:19 +00:00
Nick Fitzpatrick
92242d99b0 43475 command palette icon tweaks (#43652)
* Initial commit

* unit test, always white on active

* Run Prettier 🙄

* removing yellow color from verified model icon

* linter and type fix
2024-06-09 10:14:10 -06:00
Nick Fitzpatrick
7f4fd36b4e Refresh on login when user locale is different from site locale (#43775) 2024-06-09 09:08:28 -06:00
Braden Shepherdson
522b0df40a [MBQL lib] Move the field_ref matching hack from #43848 (#43902)
I'm not sure it's any less hacky in the CLJS but it keeps the TS
wrappers thin.

Context:
- #43799 is the original issue
- #43848 added the hack being removed here
2024-06-08 11:15:33 -04:00
Aleksandr Lesnenko
85ba3ac755 add line symbol on hover (#43887) 2024-06-07 21:04:57 -03:00
Ryan Laurie
f54fd3b1b6 Combine actions e2e specs (#43846) 2024-06-07 17:07:37 -06:00
Alexander Polyankin
6dff2dfe7e Fix parameter mapping with models (#43848) 2024-06-07 22:47:49 +00:00
Raphael Krut-Landau
74500ba310 Micro-edit: spaces not white spaces (#43860)
This PR simplifies a bit of text used in the cache cron schedule component: we can say "spaces" (which is normal English) not "white spaces" (which is developerese)
2024-06-07 18:07:33 -04:00
Raphael Krut-Landau
4e81aed3fb Fix unit test (#43895) 2024-06-07 18:02:03 -04:00
Aleksandr Lesnenko
f307977168 reset series displays when changing card display (#43868) 2024-06-07 21:12:41 +00:00
Nemanja Glumac
1d904a7eff Use params instead of body in RTK Query GET requests (#43786)
Resolves #41511
2024-06-07 22:59:50 +02:00
Jeff Bruemmer
9e191a48e6 docs - line charts updates (#43845) 2024-06-07 20:59:21 +00:00
Raphael Krut-Landau
95adc26b34 recents (#42138) 2024-06-07 16:28:10 -04:00
Raphael Krut-Landau
1b164bf49d [Browse] Remove Metabase analytics models from Browse models (#43778)
Closes #43251
2024-06-07 16:24:24 -04:00
Noah Moss
2cb5dd1919 Move around audit content to make perm checks more consistent + general cleanup (#43693) 2024-06-07 15:52:45 -04:00
Nemanja Glumac
19e92f3ee0 Use RTK Query to obtain task/job information (#43798)
* Type `TaskInfo`

* Re-write `JobInfoApp` to use RTK Query

* Re-write `JobTriggersModal` to use RTK Query

* Remove unused `fetchJobInfo` action

* Remove `TaskApi` from `services.js`

* Remove `JobApp` styled component

* Simplify fetching logic
2024-06-07 19:20:50 +00:00
Nemanja Glumac
bbde8ff568 Upgrade @testing-library/cypress to v10.0.2 (#43842) 2024-06-07 21:03:32 +02:00
Jeff Bruemmer
e34d653777 docs - update upload setting metadata (#43855) 2024-06-07 19:01:01 +00:00
Sloan Sparger
296636e5a6 Fix CloudPanel unit flake (#43856) 2024-06-07 18:36:20 +00:00
Raphael Krut-Landau
9f27f3775f Fix typo (#43808)
Fixes a small typo
2024-06-07 14:35:18 -04:00
Mahatthana (Kelvin) Nomsawadi
dfdaab03b3 ci(sdk): Automate merging SDK doc PR (#43751)
* Automate SDK doc PR

* Prevent auto merge

* Dry run npm publish for testing

* Speed up testing by not building jars

* Fix auto approve step

* disable concurrency so I could test multiple runs in parallel

* Test auto-merge

* Fix auto merge

* Revert "disable concurrency so I could test multiple runs in parallel"

This reverts commit 60e90076eb.

* Revert "Speed up testing by not building jars"

This reverts commit 4e53a54414.

* Revert "Dry run npm publish for testing"

This reverts commit 9b5d761c8d.

* Enable all commented out steps

* Remove unnecessary steps
2024-06-07 17:18:14 +01:00
github-automation-metabase
e13c64ec2c Update Readme version references and published npm version to 0.1.8 (#43832) 2024-06-07 16:56:25 +01:00
Mahatthana (Kelvin) Nomsawadi
905625eb5a ci(sdk): Ensure we append new release to the chaneglog instead of overwriting it. (#43729)
* Mock that the changelog is different from the one in master

* Apply changelog patch incase the changelog is created from another branch

* Dry run npm publish so I could test

* Fix failed patch

* Speed up testing by not building jar

* Fix adding new changelog to master

* feat(sdk): A placeholder for an actual feature in the changelog

* Mock that the changelog diverges from master

* Revert "Speed up testing by not building jar"

This reverts commit acb80d7465.

* Revert "Dry run npm publish so I could test"

This reverts commit f4e679efd9.

* Revert "Mock that the changelog diverges from master"

This reverts commit 0e77a68e1b.
2024-06-07 16:15:53 +01:00
Phoomparin Mano
40d11066a9 Customize dashboard, dashcard and question background color for embedding SDK (#43618)
* dashcard background color

* add bg-dashboard and bg-dashboard-card

* rename background-visualization to background-question

* apply bg-question to embedded questions

* use CSS variables along with theme object

* add css variables to more places

* add ability to reference design system colors for defaults

* use CSS variables for defaults

* fix chart skeleton test

* fix legend item title
2024-06-07 22:07:27 +07:00
Alexander Solovyov
33df115357 [sync] parse naked json values (#43812) 2024-06-07 17:42:16 +03:00
Alexander Polyankin
2b01d9fd3c Remove unused containers/DataPicker (#43802) 2024-06-07 10:31:49 -04:00
Ryan Laurie
4520bf9324 Run smaller smoke test suite for pre-release check (#43633)
* run smaller smoke test suite for pre-release check

* fix run command
2024-06-07 08:14:12 -06:00
Alex Yarosh
0d4c0e7850 format sql (#43753) 2024-06-07 09:59:32 -04:00
Romeo Van Snick
ceeac2912c Merge combine column components (#43593)
* Move expressionClause to handleSubmit

* Allow passing the first column as a prop and allow auto picking of columns

* Use CombineColumns component in header drills

* Remove duplicate CombineColumnsDrill component and helpers

* Allow separators to be null

* Calculate example in Example component to avoid useMemo call

* Fix test reference in test

* Append suffix to duplicate columns

* Rename parameter to something more expressive

* Enable autoPickColumn for all instances of the combine column popover

* Fix tests

* Fix notebook tests

* Make test typescript

* Correct types of openTable function
2024-06-07 12:38:56 +02:00
Mahatthana (Kelvin) Nomsawadi
dd30ead9a8 Add single CORS origin limitation (#43805) 2024-06-07 09:08:21 +00:00
Cal Herries
3c97497126 Change MySQL ENUM columns to have base_type=type/TextLike (#43533) 2024-06-06 22:10:17 -06:00
Nemanja Glumac
25c4cb0bd8 Fix milestone reminder (#42861)
* Add a helper to extract linked issues from PR body

* Add tests

* Tweak the workflow

* Fix the workflow

* Delete obsolete code

* Improve the message

* Fix whitespace error
2024-06-07 00:44:55 +02:00
Jesse Devaney
f54e3d5a76 Fix RowChart X-Axis ticks formatter (#43783)
* fix RowChart XAxis ticks formatter

- remove scaling from x-axis tick values like we did for y-axis tick values in ECharts charts

* add loki variant
2024-06-06 18:26:54 -04:00
Jesse Devaney
486e3370af hide "show_series_values" setting when "show_values" setting is disabled (#43785) 2024-06-06 21:54:35 +00:00
Ryan Laurie
1e50d9f3a8 Send more tests to flake jail (#43761)
* mark more tests as flaky

* all the flakes
2024-06-06 15:40:05 -06:00
Aleksandr Lesnenko
e3f166bf7b fix timeline events covers series (#43780) 2024-06-06 21:00:03 +00:00
Nick Fitzpatrick
6d0f5e69d6 Add events to measure search performance (#43135)
* new_search_query event

* Filters in object, search click event

* updating event schema

* type and event schema adjustments

* delete comments BE code

* adjusting tests

* PR feedback

* typos and spacing
2024-06-06 17:40:27 -03:00
Sloan Sparger
c7048cf89e Add ts-pattern library (#43752) 2024-06-06 14:58:18 -05:00
SakuragiYoshimasa
49b126efcd Fix remaining tinyint booleans in MySQL (#43296)
* Correct type for `report_card.dataset`

This was missed in the original migration of boolean types to
${boolean.type} in MySQL/MariaDB, and then missed again by me when I
migrated `collection_preview` over a week ago.

* Change all boolean types to `bit(1)` in MySQL

Liquibase changed their boolean type in MySQL from `bit(1)` to
`tinyint(4)` in version 4.25.1. Our JDBC driver does not recognize these
as booleans, so we needed to migrate them to `bit(1)`s.

As discussed [here](#36964), we
changed all existing `boolean` types that were in the
`001_update_migrations.yml` but not the SQL initialization file.

For new installations, this works: things in the SQL initialization file
get created with the `bit(1)` type.

However, for existing installations, there's a potential issue. Say I'm
on v42 and am upgrading to v49. In v43, a new `boolean` was added.

In this case, I'll get the `boolean` from the liquibase migration rather
than from the SQL initialization file, and it need to be changed to a
`bit(1)`.

I installed Metabase v41 with MySQL, migrated the database, and then
installed Metabase v49 and migrated again. I made a list of all the
columns that had the type `tinyint`:

```
mysql> SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_TYPE,        COLUMN_DEFAULT, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_TYPE = 'tinyint' AND TABLE_SCHEMA='metabase_test';
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| TABLE_SCHEMA  | TABLE_NAME                   | COLUMN_NAME       | COLUMN_TYPE | COLUMN_DEFAULT | IS_NULLABLE |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| metabase_test | core_user                    | is_datasetnewb    | tinyint     | 1              | NO          |
| metabase_test | metabase_field               | database_required | tinyint     | 0              | NO          |
| metabase_test | metabase_fieldvalues         | has_more_values   | tinyint     | 0              | YES         |
| metabase_test | permissions_group_membership | is_group_manager  | tinyint     | 0              | NO          |
| metabase_test | persisted_info               | active            | tinyint     | 0              | NO          |
| metabase_test | report_card                  | dataset           | tinyint     | 0              | NO          |
| metabase_test | timeline                     | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline                     | default           | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | time_matters      | tinyint     | NULL           | NO          |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
10 rows in set (0.01 sec)
```

Then wrote migrations. For each column, we:

- turn it into a `bit(1)`,

- re-set the previously existing default value, and

- re-add the NOT NULL constraint, if applicable.

* Change author and add missing `dbms`

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-06-06 21:55:33 +02:00
Nemanja Glumac
2473fa2f8b Remove old repro for 39150 (#43749) 2024-06-06 21:53:50 +02:00
Phoomparin Mano
ea2d0a7e03 Highlight the table cell data in dashboards when the cell is an ID column (#43728)
* highlight id cell column

* add simpletable stories

* add simple table test data

* add loki reference image

* Update frontend/src/metabase/visualizations/components/TableSimple/TableCell.styled.tsx

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-06-07 02:20:44 +07:00
Ryan Laurie
8cb8d6405d Combine search e2e specs (#43718) 2024-06-06 12:05:33 -06:00
Raphael Krut-Landau
df62bb0cb4 Remove dead code (#43603) 2024-06-06 13:56:09 -04:00
Raphael Krut-Landau
e199d76e6f Fix width of save button in cache sidebar (#43755) 2024-06-06 13:53:02 -04:00
lbrdnk
4a88a0c86a Move database role to url parameters from connection properties on Snowflake (#43602)
* Move role to url parameters from connection properties

* Fix test
2024-06-06 19:34:06 +02:00
Ryan Laurie
2cdae6bc9a Update translations for v50 and add Danish Language Support (#43314)
* update translations for v50

* add Danish

* update translations for v50 release

* alphabetical order is nice
2024-06-06 17:30:05 +00:00
Ryan Laurie
7a9767e110 Consolidate joins specs (#43717) 2024-06-06 11:14:54 -06:00
Ryan Laurie
3d1cbd3b8e Consolidate dashboard-card specs (#43716) 2024-06-06 11:14:43 -06:00
metamben
8eeacc60c4 Hydrate can_run_adhoc_query and address review comments (#43747)
This is a followup on #43625.
2024-06-06 20:07:30 +03:00
adam-james
b8907454c9 Multi Series Dashcards Render with Filters Applied To All Series (#43428)
* Multi Series Dashcards Render with Filters Applied To All Series

Fixes: #39083

Multi-series dashcards now properly render when a subscription is set up with filters that impact the values of each
card in the multi-series card.

* Small refactor for executing dashcards in a pulse context.

- move execute-dashboard-subscription to pulse.util
- this fn now will also execute all card series cards
  and put those results into a list on the key :series-results in the dashcard
  which is then used in the render multimethod to send the correct data to the javascript context

A small todo was taken care of as well, we can now use :dashboard-subscription in the :context key

* Fix up render fn

The shape of hte data going into the javascript was a bit unclear before. This keeps things a little more
understandable.

Next step is probably to create some Malli schemas inside the js_svg namespace to document and enforce the needed data shapes

* pull :data up a level from :result in the series cards

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>

* Remove unneeded let

* set/rename-keys won't work here because we raise the :data key

I've realised a suggested change to just use set/rename-keys won't do what we need. We need instead to raise :data
from within the result key up to the same level (and dissoc result).

I've renamed the helper function to make its purpose a bit clearer

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-06-06 09:58:58 -07:00
Alex Yarosh
60bb8d6158 update list of releases (#43754) 2024-06-06 12:44:51 -04:00
Ryan Laurie
5a481f98b8 use correct github api for CI (#43750) 2024-06-06 10:12:51 -06:00
Sloan Sparger
18d5388de0 Upgrade to TypeScript v5.4 (#43736) 2024-06-06 11:04:10 -05:00
Raphael Krut-Landau
080efbc837 [Browse] Show Browse models link in nav only when there are models (#43286) 2024-06-06 15:43:15 +00:00
Aleksandr Lesnenko
b9c10c5178 make compact formatting consistent across all series (#43472)
* make compact formatting consistent across all series

* fix rebase
2024-06-06 15:32:32 +00:00
metamben
2bfaab28e6 Batch load card metadata (#43625) 2024-06-06 11:04:46 -04:00
github-automation-metabase
56b3b5054f Update Readme version references and published npm version to 0.1.7 (#43734) 2024-06-06 16:04:34 +01:00
Mahatthana (Kelvin) Nomsawadi
3164995660 Reference new Metabase 50 RC version (#43735) 2024-06-06 15:26:14 +01:00
Ngoc Khuat
13e51d4ecc add mt/inbox as testing context for test helpers' (#43731) 2024-06-06 21:22:00 +07:00
Alexander Solovyov
74e524c057 do not output exceptions used only for tests (#43723) 2024-06-06 17:03:06 +03:00
Jeff Bruemmer
18581104b9 docs - models and caching (#43681) 2024-06-06 09:45:08 -04:00
Ryan Laurie
01840901fe Backport reminder bot (#43637)
* WIP backport reminder bot

* polish and automate backport reminder

* do better english
2024-06-06 07:12:46 -06:00
Ryan Laurie
4b66bdbabc Fix OSS tests in CI (#43660)
* fix OSS tests in CI

* update tests that went on vacation for a while

* do safer cypress things

* better helper name
2024-06-06 07:02:46 -06:00
Oisin Coveney
b87281c531 Update README to reflect API changes in Static Dashboard (#43727) 2024-06-06 13:00:09 +00:00
Alexander Polyankin
855c840bc2 Fetch ad-hoc query metadata on the BE (#43675)
* adhoc-query-metadata

* Get ad-hoc query metadata from the BE

* Fix broken ad-hoc queries

* Fix broken ad-hoc queries

* Fix tests

* Add a test

* Add tests

* Add tests

* Fix whitespace

* Fix whitespace

* Fix tests
2024-06-06 07:13:19 -04:00
Kamil Mielnik
49360f68bf Analytic events for time-over-time comparison (#43589)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Add tracking helpers

* Add new schema

* Add tracking in column header

* Add tracking in plus modal

* Add tracking in aggregation picker

* Fix destructuring

* Add functionsUsedByExpression

* Fix schema number

* Add tests boilerplate

* Implement test for notebook editor

* Add test for column header

* Add a test for summarize sidebar

* Add a test for the plus button

* Add expectNoBadSnowplowEvents call in afterEach

* Format code

* Add missing redux store state in tests

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-06 18:03:32 +07:00
Kamil Mielnik
54d9fb2257 Time-over-time comparison - Unit tests (#43653)
* Use createQueryWithClauses in createQueryWithCountAggregation

* Support column-specific aggregations in createQueryWithClauses

* Add tests for compare option presence

* Fix case

* Add a test for onAdd

* Split tests

* Rename tests

* Add boilerplate for CompareAggregations unit tests

* Fix assertion

* Add more tests

* Add offset input tests

* Add tests

* Update frontend/src/metabase/query_builder/components/CompareAggregations/CompareAggregations.unit.spec.tsx

* Update tests after merge

* Use constants instead of factory functions
2024-06-06 07:44:54 +00:00
Mahatthana (Kelvin) Nomsawadi
ac6bb7b452 Followed-up tasks for changelog generation (#43656)
* Check git tag for an exact match

* Set npm publish to dry run, so I can test

* Uses new github automation account for creating a PR

* Remove unnecessary step

* Automatically set `no-backport` on the SDK doc version bump PR

* Fix step to edit PR with correct permission

* Remove npm dry run after finished testing
2024-06-06 08:42:24 +01:00
Denis Berezin
e430b776e3 feat(sdk): SDK theming part 4 - danger, dark, error, filter, focus, saturated, shadow (#43608)
* Migrate danger

* Migrate dark

* Migrate error

* Migrate filter

* Migrate focus

* Migrate saturated

* Migrate shadow

* Fix CI

* Fix CI

* Fix CI
2024-06-06 03:26:18 +03:00
metamben
0ade074b53 Remove serdes support for legacy metrics (#43272) 2024-06-05 23:17:17 +00:00
Ryan Laurie
7789ce34bf move github-slack-map to fix release script build (#43692) 2024-06-05 21:48:57 +00:00
Denis Berezin
6fcbf23e54 feat(sdk): SDK theming part 3 - brand, brand-light, brand-lighter (#43598)
* Migrate brand

* Migrate brand-light, brand-lighter

* Fix unit tests

* Code review fixes

* Fix CI
2024-06-06 00:17:00 +03:00
Jesse Devaney
6ac4fe977f Fix column scaling ("Multiply by a number") bugs (#43668)
* return empty string so non-empty labels do not get hidden by empty labels

* fix function name

* apply scaling in transformed dataset

* add missing option to OptionsType

* fix double scaling

* add column scaling to waterfall transformed dataset

* add column value scaling to dataset transform

* fix stacked bar segment labels not responding to column scaling

* fix tooltip values displayed

* since scaling as added to transformedDataset, use transformedDataset for formatters

* revert changes to display percentage instead of absolute value

* fix stacked data labels

* add loki variant for custom y-axis range with column scaling

* fix stack segmented label formatters compact calculation

* scale original dataset and use that instead of modifying transformedDataset

* update loki snapshots

* fix scatter plot dataset scaling

* fix tooltip values being double scaled

* add E2E test to validate behavior

* add helper for not duplicating the column scaling

* port multiple y-axis metrics with column scaling fixes to RowChart

* add waterfall and scatterplot loki variants

* fix type errors and failing unit tests

* fix failing unit tests

* update loki snapshots
2024-06-05 16:47:49 -04:00
Nemanja Glumac
5bf50a2131 Add E2E reproduction for #39150 (#43610)
* Add E2E reproduction for #39150

* Fix typo in the test title

* Move the viewport config to the `describe` block

* Add the second repro scenario as per the review comment

* Scope the variable to the relevant test
2024-06-05 22:47:38 +02:00
Anton Kulyk
c7c5b3568b Fix long field names handling for series names and in the model editor (#43394)
* Fix long names in model editor

* Fix long names in series name input
2024-06-05 19:04:01 +00:00
Alexander Polyankin
13aae6632d Performance fix for getUrlWithParameters when there are no parameters (#43626)
* Simple performance fix for getUrlWithParameters

* Fix tests
2024-06-05 14:50:55 -04:00
Jeff Bruemmer
f05fa8e607 column heading options (#43409) 2024-06-05 14:09:09 -04:00
Dennis Schridde
937e30fbed Expose attached-dwh token feature flag to frontend (#43657)
This allows frontend code to conveniently check whether the feature
flag is enabled or disabled.  This is in addition to the raw flag's
presence (or absence) in `(:features token-status)`.

References: https://github.com/metabase/metabase/issues/42381
References: https://github.com/metabase/metabase/pull/43511
2024-06-05 19:55:17 +02:00
Denis Berezin
8659846f0b feat(sdk): SDK theming part 2 - bg-error, bg-medium, bg-night, bg-white, border (#43512)
* Migrate bg-error

* Migrate bg-medium

* Migrate bg-night

* Migrate bg-white

* Migrate border

* Fix CI

* Fix unit tests

* Fix unit tests

* Code review fixes

* Code review fixes
2024-06-05 20:26:09 +03:00
Chris Truter
50e4cf7798 More wiring and documentation around Macaw (#43580) 2024-06-05 17:02:05 +00:00
Chris Truter
2a260cc9ff Demonstrate nesting dynamic redefines (#43496) 2024-06-05 18:42:52 +02:00
Kamil Mielnik
f61a065796 Previous period comparison shortcut in chill mode - column headers (#43500)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Fix destructuring

* Fix tests

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-05 15:53:51 +00:00
Oisin Coveney
5c5f6c39a1 fix(sdk): Fix static dashboard API (#43581) 2024-06-05 18:36:47 +03:00
Ryan Laurie
a691754a94 Add team devex (#43662)
* Add DevEx to team.json

* no trailing commas in json
2024-06-05 09:20:47 -06:00
Ryan Laurie
7251aa834c Put New Tests in Flake Jail + Parole Well Behaved Tests (#43623)
* tag flakiest tests as such

* let well behaved tests out of flake jail

* more bad actors off the streets

* add another flake

* sandboxes re-offended already
2024-06-05 07:40:45 -06:00
Alexander Polyankin
f28991450a Temporal unit parameters in dashboards (#43212) 2024-06-05 08:39:31 -04:00
Aleksandr Lesnenko
f025758d8f Set min bar height for non-zero bars (#43485)
* set min bar height for non-zero values

* fix y-axis split logic uses transformed dataset instead of actual data
2024-06-05 11:41:28 +01:00
Aleksandr Lesnenko
0fb138af86 Fix RowChart shrinks on hover (#43634)
* fix memoization

* extend the basic row chart e2e spec
2024-06-05 11:22:43 +01:00
Tim Macdonald
4ec415a024 Use a more obvious test error message (#43642)
(When scrolling through CI logs I always do a double-take when I see a
huge stack trace with "Just an error". I think this is a little
clearer?)
2024-06-05 10:15:18 +00:00
Oisin Coveney
7c636450c2 Convert Pagination Controls to TS (#43586) 2024-06-05 13:04:25 +03:00
Ngoc Khuat
b561b0111c Add inbox as testing context to debug flaky pulse tests (#43570) 2024-06-05 09:36:07 +00:00
Mahatthana (Kelvin) Nomsawadi
44fb3171f4 Fix flaky interactive-embedding.cy.spec.js (#43588)
* Fix flaky test

* Fix the flake for real

* Fix stress test failing because of mismatched height

* Review: Move viewport setting to shared config
2024-06-05 08:01:36 +00:00
Alexander Solovyov
1e4fe0f1b8 [cache] config should be editable if entity is accessible (#43522) 2024-06-05 08:35:41 +03:00
Ryan Laurie
03d60d8fed Make Backports Automerge Again (#43635) 2024-06-05 01:14:28 +00:00
Sloan Sparger
b97d9791ec uses data-autofocus attribute to avoid mantine modal moving focus to the modal close button (#43546) 2024-06-04 18:07:48 -05:00
Ryan Laurie
75fbccb765 Consolidate permissions e2e specs (#43552) 2024-06-04 15:52:39 -06:00
Ryan Laurie
68938adb0c Consolidate custom column e2e specs (#43616) 2024-06-04 15:52:00 -06:00
Ryan Laurie
fa0cf11b25 Combine e2e native filter specs (#43527)
* consolidate e2e native filter specs

* fix helper

* fix runQuery call
2024-06-04 15:51:47 -06:00
Ryan Laurie
590be77299 Consolidate dashboard e2e specs (#43613)
* consolidate dashboard e2e specs

* fix import
2024-06-04 15:51:35 -06:00
Ryan Laurie
ce5b1cfe2f Consolidate chart viz e2e specs (#43619) 2024-06-04 15:51:17 -06:00
Ryan Laurie
384af8167e Release from tagged test jars (#43545)
* allow releasing from tagged test jars

* always listen to nemanja

* use java 17
2024-06-04 15:29:55 -06:00
Jeff Bruemmer
5b5b05973e docs - license step (#43534) 2024-06-04 16:55:58 -04:00
Phoomparin Mano
9d61985fcc feat(sdk): font size scaling and adjustment for visualizations (#43264)
* support test utilities in sdk import

* add relative unit default chart font size in embedding defaults

* make font size follow sdk root

* feat(sdk): add font size settings to axis ticks

* feat(sdk): add font size settings to series labels

* re-add hasTimelineEvents from merge commits

* apply default font size at the theme level

* add table header cell font size

* calculate cell font size based on 12.5px

* rename theme.chart to theme.cartesian

* refactor visualization theme

* refactor default viz theme

* remove chart style config

* add goal line

* pass font size to chart measurements

* use px as reference unit

* support row chart viz

* add missing echarts font size

* add table cell font sizes

* use css variables for funnel color

* fix theme type in smart scalar story

* add bar chart to storybook for visual test

* add line chart to storybook for visual test

* add loki reference images

* add loki reference images for row chart

* add loki shared reference images to stories filter

* update loki reference image

* synchronize base font size

* add theme provider to funnel test setup

* add missing default visualization theme

* add unit test for get size in px

* update loki reference image

* fix static viz build error
2024-06-05 03:36:49 +07:00
Nick Fitzpatrick
7d0357d983 remove modified padding on ellipsifyed sidebar items (#43585) 2024-06-04 17:21:27 -03:00
Aleksandr Lesnenko
a727faddda loki CI improvements (#43607) 2024-06-04 15:49:00 -03:00
Jeff Bruemmer
d9aaa9fd43 docs - caching updates (#42857) 2024-06-04 13:25:10 -04:00
Case Nelson
cefd7a61e8 Add can_run_adhoc_query to Card hydration (#43464) 2024-06-04 11:04:03 -04:00
Jeff Bruemmer
c5404ea285 Docs env var info (#43150) 2024-06-04 14:43:18 +00:00
Raphael Krut-Landau
8b6a4c966e [Browse] Add brand-colored dot to filter icon when the filter is active (#43350)
Closes #42964
2024-06-04 10:33:42 -04:00
Ryan Laurie
91b4bd6b34 Add build requirements for v50 (#43537) 2024-06-04 08:07:11 -06:00
Ryan Laurie
d53b0a7a80 Consolidate sharing e2e specs (#43514) 2024-06-04 08:06:49 -06:00
Nicolò Pretto
fea8f89a57 temporarily removes the SameSite=None suggestion box (#43524)
* temporarily removes the SameSite=None suggestion box

* fix copy
2024-06-04 13:05:06 +02:00
Oisin Coveney
ecad0c94b5 fix(sdk): Fix map visualizations breaking (#43491) 2024-06-04 13:43:26 +03:00
dependabot[bot]
237a663b3a Bump mysql2 from 3.9.7 to 3.9.8 (#43446)
Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.9.7 to 3.9.8.
- [Release notes](https://github.com/sidorares/node-mysql2/releases)
- [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md)
- [Commits](https://github.com/sidorares/node-mysql2/compare/v3.9.7...v3.9.8)

---
updated-dependencies:
- dependency-name: mysql2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-06-04 11:18:03 +01:00
Kamil Mielnik
0da1dd1662 Previous period comparison shortcut in chill mode - "+" button (#43493)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Do not navigate to chart view

* Add type attribute to all ListItems
2024-06-04 09:53:55 +00:00
Kamil Mielnik
6763b13cfc Update dead jetty docs links (#43573)
* Update dead jetty docs link

* Update dead jetty docs link
2024-06-04 16:43:22 +07:00
Nicolò Pretto
816e1b0dbc refactor public/embed reducers and related code (#43495)
* move parameters and dashboard reducers to the common ones as they're used everywhere

* convert reducers-{common,main,public}.js to typescript, done with --no-verify

* convert reducers to named exports
2024-06-04 10:39:00 +02:00
Kamil Mielnik
3305c815b0 Previous period comparison shortcut in notebook mode (#43220)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Add type attribute to all ListItems
2024-06-04 08:15:47 +00:00
Raphael Krut-Landau
2f0bc49783 [Browse] Don't show filter icon when no models have been verified (#43284)
On the Browse models page we have a filter icon which opens a popover with a switch that toggles "Show only verified models". With this change, the icon is not rendered if there are no verified models at all.
2024-06-03 22:21:22 -04:00
Raphael Krut-Landau
85e113420d [Browse] Unify breadcrumbs into one link (#43313)
* [Browse] Unify breadcrumbs into one link

* Avoid !important
2024-06-03 22:08:48 -04:00
Aleksandr Lesnenko
95d4179e28 Amend stack values labels control copy (#43553) 2024-06-04 01:53:49 +00:00
Emmad Usmani
9c7e96a857 fix data labels under trend/goal lines (#42928)
* fix data labels under trend/goal lines

* fix fontFamily missing

* update specs

* fix type errors

* snapshots

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-06-03 22:09:06 +00:00
Cal Herries
9f73b0ceb8 Skip fingerprinting or scanning field values for fields with base_type=type/* (#43483) 2024-06-03 15:49:13 -06:00
Jeff Bruemmer
12e25b65a1 notes and links to relevant docs (#42975) 2024-06-03 16:56:24 -04:00
Jeff Bruemmer
3206c87a61 docs - druid jdbc and json unfolding (#43267) 2024-06-03 16:49:34 -04:00
Sloan Sparger
4c2aed648f Fix bulk action delete button hover contrast (#43518) 2024-06-03 15:19:31 -03:00
Ryan Laurie
f10ab55f8a Combine tabular viz e2e specs (#43519) 2024-06-03 11:34:07 -06:00
Nemanja Glumac
97fe4c437c Use actions/checkout@v4 everywhere (#43525) 2024-06-03 19:14:01 +02:00
Nemanja Glumac
34b6159658 Use actions/github-script@v7 everywhere (#43526) 2024-06-03 19:13:43 +02:00
Aleksandr Lesnenko
cb4264c6b3 measure auto compactness on correct values (#43477)
* measure auto compactness on correct values

* snapshots
2024-06-03 16:22:33 +00:00
Cal Herries
5c8de49521 Don't throw an exception when a non-existent setting is in the config file (#43425) 2024-06-03 09:44:32 -06:00
Cal Herries
6bf7bfca9a Catch exceptions from driver/database-supports? outside driver code (#43429) 2024-06-03 09:44:06 -06:00
Denis Berezin
d228123152 feat(sdk): SDK theming part 1 - black, bg-light, bg-dark, bg-black (#43413)
* Convert black

* Convert bg-light

* Convert bg-dark

* Convert bg-black

* Fix CI

* Fix CI

* Fix tests

* Update visual test fixtures

* Fix visual tests
2024-06-03 18:29:33 +03:00
Ryan Laurie
32011873b1 Tag slack users by github handle (#43420)
* tag slack users by github handle

* sort users
2024-06-03 08:49:29 -06:00
Aleksandr Lesnenko
d19ad598b2 fix stacked data labels on ordinal charts (#43469) 2024-06-03 11:20:53 -03:00
Chris Truter
fa90376b08 Populate Macaw options based on database type (#43460) 2024-06-03 16:06:16 +02:00
Noah Moss
2c3c328472 Populate collection search results with effective parent (#43331)
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-06-03 09:55:59 -04:00
Kamil Mielnik
81621016d4 Revert "Copy question link from dashboard (#42892)" (#43499)
This reverts commit e7948a7249.
2024-06-03 13:49:35 +00:00
Nemanja Glumac
d67f3f5d99 Fix invalid input in the "build for release" action (#43492) 2024-06-03 13:28:37 +02:00
Ngoc Khuat
03d5dec982 Fix mariadb failed to migrate due to having deep nested revision (#43434) 2024-06-03 05:23:54 +00:00
Jesse Devaney
72443c62b1 Fix data labels too dense with large single series (#42985)
* remove unused variable

* conditionally render labels sparsely if large amount of data points

* update loki snapshots

* refactor data label formatter conditions

* setup intelligent label plotting

* handle the case when there are no labels

* add sparse data label rendering to bar charts

* do not compute if no labels need to be shown or hidden

* add sparse data labeling to waterfall charts

* adjustment for large series waterfall labels

* revert change

* refactor name

* add sparse labels to stacked bar and area

* improve scaleFactor

* fix type errors

* remove unused labelFormatter

* update snapshots

* patch ECharts

- labels with no text, i.e. "", were still being considered as plot-able labels which was causing labels with real text "asdfec.." to be hidden because of overlap.
- This patch makes it so that labels with no text, i.e. "", are not considered to be candidates for overlap checking.

* update loki snapshots

* only loop over dataset once for getWaterfallChartDataDensity

* improve performance of chart data density calculations

* update loki snapshots

* update E2E spec

* update E2E spec

* increase cartesian label density allotment

* update loki snapshots

* update loki snapshots

* comment out node_modules cache since it cannot be skipped by commit and is breaking CI

* fix type errors

* Reset node modules if patches are changed

* refactor type naming

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-01 06:05:22 +00:00
Cal Herries
2c1333ebb6 Only log views for cards in a dashboard if the user views the tab (#43102) 2024-05-31 17:51:41 -06:00
Case Nelson
68435f9091 Single metadata endpoint for cards (#43405) 2024-05-31 23:32:44 +00:00
Sloan Sparger
d5280c6bcf Fixes LDAP admin settings form not allowing modification if a custom port is set (#43476) 2024-05-31 23:26:37 +00:00
Ryan Laurie
7038b2e4c2 Combine Filters Reproduction into new e2e job (#43328)
* combine reproductions into new filters e2e job

* fix import

* gee thanks sloan
2024-05-31 14:16:40 -06:00
Cam Saul
3d0bc85a5b Kondo linter tests for :metabase/validate-logging (#43104)
* PoC Kondo linter test

* Log linter tests

* Remove fail-test
2024-05-31 20:12:28 +00:00
Vamsi Peri
a3f19cd8c5 Updated the QPD team board (#43466) 2024-05-31 18:02:31 +00:00
Chris Truter
70c1474c87 Handle MySQL quotes when resolving analyzed fields (#43447) 2024-05-31 17:42:30 +00:00
metabase-bot[bot]
6b59534f39 Update SDK version to 0.1.6 (#43457)
* Update Readme version references and published npm version to 0.1.6

* Update SDK Changelog

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alberto Perdomo <albertoperdomo@users.noreply.github.com>
2024-05-31 17:13:53 +00:00
Uladzimir Havenchyk
e5aa995590 Optimize dashcard rendering in edit mode (#43431)
* Avoid unnecessary re-renderings in dashcards

* replace useCallback with useMemo

* Optimize dashcard rendering in edit mode
2024-05-31 16:58:12 +00:00
Ryan Laurie
557e6ead6a Add Advanced Cache Upsell (#43099)
* add hook to check token features

* add cache upsell to performance page

* upsell cards are white

* fix rebase
2024-05-31 10:30:58 -06:00
Oisin Coveney
d711251a70 fix(sdk): Add Static Dashboards to README (#43392)
* fix(sdk): add Static Dashboards to README

* Add more clarification comments for API

* Clarify dashboard ID type

* Prevent crashing SDK static dashboard if not provided optional values

* Document fallback behavior for `font`

---------

Co-authored-by: Mahatthana Nomsawadi <mahatthana.n@gmail.com>
2024-05-31 16:12:28 +00:00
Uladzimir Havenchyk
55c00bdd90 Avoid unnecessary re-renderings in dashcards (#43323)
* Avoid unnecessary re-renderings in dashcards

* replace useCallback with useMemo
2024-05-31 18:33:28 +03:00
Kamil Mielnik
1947328ed9 Repro #37380 - Users with no self-service access may update pivot tables and leave them in a non-working state (#43437)
* Fix crash and remove redundant casting

* Add repro for metabase#37380

* Be extra-safe with an empty array
2024-05-31 15:16:10 +00:00
Mahatthana (Kelvin) Nomsawadi
78db8c4916 ci(sdk): Autogenerate changelog on build (#43364)
* Auto tag embedding team for PR review + dry run npm publish

* Install changelog generation package

* Add the initial changelog

* feat(sdk): This is an empty commit. For testing purposes.

* Update SDk build script to include changelog

* Check if a tag exists

* Ensure changelog is in the released package

* Fix workflow

* Remove unnecessary step

* Ensure we can have access to release utils script when checking out master

* Fix the step to create a PR updating readme and changelog

* Fix changelog generation

* Fix couldn't download changelog

* Clean up steps
2024-05-31 16:03:06 +01:00
Emmad Usmani
c1f1d98381 remove accidental comment from scatterplot model (#43423) 2024-05-31 07:58:17 -07:00
Nick Fitzpatrick
ead905b105 React 18 (#41975)
* initial commit with most types sorted

* admin, binning, collections, custom-column and dashboard-cards suites

* Filters, Joins, Metrics, Models, Native and Native filters suites

* rest of e2e specs

* filters, actions, onboarding and custom column will hopfully be green?

* fixing static viz, brush filtering, login redirecting, and a few other tests

* types green

* linter green

* hopefully fixes filter tests

* I don't often cry, but when I do it's because of filter-types

* hopfully sorted the last test that's failing CI

* PR Feedback

* yarn prettier

* React 18 Upgrade - Unit Tests (#41577)

* fixes for most unit tests to work with react 18 + upgraded rtl to v15

* fixes all unit tests locally

* fixes from rebasing

* linter shames me

* fix flake in maps.cy.spec.js

---------

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-05-31 11:56:05 -03:00
Noah Moss
86b8825996 Bump nippy to 3.4.2 (#43444) 2024-05-31 14:50:01 +00:00
Romeo Van Snick
af6cecb863 Show the columns for the correct stage when using combine/extract in the presence of an aggregation (#43226)
* Do not use asReturned to determine columns for extractions and combine columns

* Add reproduction for #43226 for combine columns

* Add reproduction for #43226 for extract columns

* Remove commented out code

* Only render extraction shortcut when there are extractions

* Only render combination shortcut when there are combinations

* Use hasCombinations from CombineColumns

* Add hasExtractions from ExtractColumn

* Use appendStageIfAggregated over Lib.asReturned

* Only show combine column shortcut when there are two or more columns to be combined

* Lift appendStageIfAggregated to top-level drill

* Add test for extraction on table with just breakout

* Add test for combinations on table with just breakouts

* Disable the 2-column requirement for combinations

* Remove Lib.asReturned in appendStageIfAggregated

* Remove + 1 to stageIndex in appendStageIfAggregated

* Check for empty breakouts too in as-returned

* Switch back to Lib.asReturned

* Fix test for combine column on breakouts

* Reference the correct query and stageIndex

* add CLJS unit tests for as-returned with only aggs, breakouts

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-05-31 16:49:21 +02:00
Kamil Mielnik
9378e28ed4 Fix unit tests running multiple times in watch mode (#43445)
* Fix unit tests running multiple times in watch mode

* Ignore even more
2024-05-31 14:44:54 +00:00
Oisin Coveney
c3c65abdf0 #41973 Improvements + Convert PublicQuestion to TS (#43361) 2024-05-31 17:11:17 +03:00
Uladzimir Havenchyk
862ca7ea27 Optimize imports from collection (#43241) 2024-05-31 13:50:48 +00:00
Alexander Polyankin
780532543c Move loading of linked targets metadata to the BE (#43380) 2024-05-31 09:26:44 -04:00
metamben
3b6def1eb7 Support string operations on postgres UUIDs (#43417)
Fixes #40176.
2024-05-31 14:45:22 +03:00
Braden Shepherdson
54c8f9bac4 [QP] Drop last stage aggregations for questions in chain filtering (#43274)
Models are treated as opaque here, but for a saved question we expose
filters on the query before its final aggregation step.

This drops the aggregation clauses and gets the possible values for the
column of interest.

Fixes #43154.
2024-05-31 07:43:19 -04:00
Cam Saul
d6381501e9 Rework Kondo defendpoint custom macro to be a custom hook instead (#43411) 2024-05-31 13:26:24 +02:00
Nicolò Pretto
ea7bd55939 PublicDashboard -> PublicOrEmbeddedDashboard (#43302)
* PublicDashboard -> PublicOrEmbeddedDashboard

* file renames and some fixes for PublicOrEmbeddedDashboard

* PublicQuestion -> PublicOrEmbeddedQuestion (file renames)

* PublicDashboard -> PublicOrEmbeddedDashboard

* isPublic prop -> isPublicOrEmbedded in Dashboard and Dashcard
2024-05-31 12:45:04 +02:00
Mahatthana (Kelvin) Nomsawadi
0e8d4f8acf Add SDK changelog (#43433) 2024-05-31 09:04:44 +00:00
Phoomparin Mano
badf8b957b Update the SDK docs to point to v1.50.0-RC1 and add note on height customization (#43383)
* update jar and docker version in sdk readme

* add notes on customizing the component height
2024-05-31 12:55:07 +07:00
metamben
67ae7aded0 Remove redundant field from select (#43396)
This is just removing a duplicate field from a select clause.
2024-05-30 23:35:40 +00:00
Sloan Sparger
2bd4c9b59a Improve haveDashboardCardsChanged util permformance (#43422) 2024-05-30 23:21:03 +00:00
adam-james
42b6edb8c4 Multiple Measures Requires Additional Header Row in Pivot Exports (#43322)
* Multiple Measures Requires Additional Header Row in Pivot Exports

Mulitple measures can be set in our pivots. We indicate these properly in the fronted with a header row that shows
which measure is reprsented in that particular column.

The header builder fn in the pivot export post processing didn't handle this case, but after this PR, it correctly
adds the final header when necessary.

* Fix up header tests

* Remove comment form; the tests are derived from that work already
2024-05-30 21:52:24 +00:00
Aleksandr Lesnenko
642a704e66 support stacked series values labels (#42803) 2024-05-30 20:59:50 +00:00
Braden Shepherdson
246f9b55ac [drivers] Enable :regex feature for MySQL (and MariaDB) (#43269)
These databases previously had impoverished support for regular
expressions. The `:regex` driver feature requires advanced,
"Perl-compatible" regular expressions that can do things like lookahead
assertions.

- MySQL supports this from 8.0.4; we recommend 8.0.33+.
- MariaDB supports this from 10.0.5; we recommend 10.4+.

Fixes #43180.
2024-05-30 16:13:29 -04:00
Aleksandr Lesnenko
f83080071b fix waterfall chart timezone issues, bar widths (#41671) 2024-05-30 17:04:32 -03:00
Ryan Laurie
f143179759 Fix merge-conflicted e2e tests (#43404) 2024-05-30 19:50:30 +00:00
Romeo Van Snick
378f0de215 Fix timeseries chrome overflow (#42761)
* Avoid overflowing dropdown menus

* Hide most bucket picker items behind a More... button

* Add test for More… button on TimeseriesBucketPicker

* Add color to More... button

* Add test for showing all columns when a lower bucket is picked
2024-05-30 21:23:55 +02:00
metamben
e53aeff946 Move models.interface test to the right namespace (#43398) 2024-05-30 19:00:28 +00:00
Anton Kulyk
a39055459c Fix duplicate filter panels in fullscreen dashboards (#43370) 2024-05-30 19:58:40 +01:00
Cam Saul
52d5ccfaff Remove Google Analytics driver (#43352)
* Remove Google Analytics driver

* Remove more GA-related tests

* Un-remove tests that aren't related to GA
2024-05-30 18:22:11 +00:00
Chris Truter
6f2535e8d5 Update macaw for qualified rename support (#43195) 2024-05-30 17:24:35 +00:00
bryan
3b2736c22e CRU card events will log recent-views, and get returned through the API (#43037)
* Handles card events for CRU (not D) => recent view

* add tests

* avoid some errors in dev

We expect recent-views/post-process to return nil occasionally (for
permissions reasons, or more), so let's filter those out instead of
printing a noisy unactionable warning

* uncomment and fix test

* fix some cypress tests + docs improvements

* update more cypress tests

* more cypress test updates

* adding a card puts it into your recents now

* fix notebook-data-source

* fix notebook-data-source

* fixing more e2e tests

* fix command palette e2e tests

* run prettier

* fix style issue

* update notebook-data-source tests

* update homepage e2e tests

* Next question is in recents, now

* update command palette: skip the first pagedown, since it is a noop

* check the buttons for their respective names

* ensure that the model is there, and no questions are
2024-05-30 11:05:30 -06:00
Sloan Sparger
63ecb0a303 Prep unit tests for React 18 upgrade (#43375)
* pulls out test changes from react 18 / rtl 15 refactor that are comptable with react 17 / rtl 12

* impls pr feedback
2024-05-30 16:53:51 +00:00
Anton Kulyk
b1eca0f9b7 Keep a single null dimension value (#43246)
* Keep a single null dimension value

* Add Loki test

* Remove Loki test

* Throw an error if dataset is empty after filtering

* Extract error message into a constant
2024-05-30 17:11:59 +01:00
Romeo Van Snick
a4add27807 Minor design updates to multi select (#43292)
* Add color to icon directly

* Remove unused css file

* Only show info icon when the field is focussed

* Use metabase blue for background on value tags

* Use larger font size for value labels

* Make the value labels bold

* Tweak padding on search input

* Move custom MultiAutocomplete styles to MultiSelect overrides and adapt to accept xs size too
2024-05-30 15:16:30 +00:00
Uladzimir Havenchyk
beba8d5c01 Optimize DashboardHeader rendering by using selector (#43123) 2024-05-30 15:14:53 +00:00
Uladzimir Havenchyk
b62726d36d Avoid heavy calculations on dashboard fetching (#43340) 2024-05-30 17:33:56 +03:00
Anton Kulyk
1610201fba Revalidate x-axis scale when graph.dimensions change (#43254) 2024-05-30 15:30:13 +01:00
Alexander Polyankin
0975be548c Force loading metadata before queries (#43369) 2024-05-30 10:24:49 -04:00
metamben
24ec71c88e Leave viz-setting part as is if normalization fails (#43336)
Fixes #43089.
2024-05-30 16:46:04 +03:00
Ryan Laurie
b77443a410 Combine models repro specs (#43342) 2024-05-30 07:10:24 -06:00
Ryan Laurie
f134831a71 Combine question e2e reproductions into fewer specs in a different job (#43271)
* combine question reproductions into one spec

* split question reproductions

* split reproductions three ways

* fix sample db id
2024-05-30 07:10:12 -06:00
Alexander Polyankin
520c7dc94f Fix getMappingOptionByTarget perf (#43339) 2024-05-30 12:37:26 +00:00
Anton Kulyk
7463c67887 Fix relative/internal links in table viz (#43303)
* Use internal Link for relative and same-origin URLs

* Update frontend/test/metabase/lib/formatting.unit.spec.js

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

* Update frontend/test/metabase/lib/formatting.unit.spec.js

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-05-30 13:04:27 +01:00
Alexander Polyankin
85b053b77f Load metadata before queries (#43354) 2024-05-30 11:32:42 +00:00
Phoomparin Mano
b55e141fe8 feat(sdk): pivot table color customizations (#43201)
* feat(sdk): colors for pivot tables

* fix theme type

* feat(sdk): basic pivot table theming

* fix emphasis hover color

* customizable row toggle color

* add storybook story and refactor hover color logic

* add sdk visualization wrapper

* make theme values with defaults internally non-optional but externally optional

* update test to render with providers

* update test wrapper to have height container

* update pivot table loki reference image

* update theme names

* make all theme options optional in the public config

* update readme

* readme update for consistency
2024-05-30 11:24:43 +00:00
metabase-bot[bot]
7737d3c857 Update Readme version references and published npm version to 0.1.5 (#43035)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-05-30 12:05:48 +01:00
lbrdnk
127d2626e5 Backfill :effective-type for coerced fields (#43144)
- Update how base type and effective type is added in query-method :mbql/query.
- Base type and effective type is added also during the conversion of query-method :query.
- Adds warning suppression for expressions to places where normalize is 
  called something that does not conform schme (eg. ->pMBQL :dispatch-type/map called
  in query-method :query).
2024-05-30 09:31:01 +02:00
Cal Herries
07dae0a6b6 Fix not being able to upload to a table if the uploads database has switched (#43026) 2024-05-30 00:11:34 +00:00
Sloan Sparger
bee66b406b [WIP] Cloud migration v3 (#43047)
* syncs with BE better for using prod/staging store links

* updates init step, fixes tests

* updates start confirmation modal design

* copy changes

* adjusting unit test

* removing unneeded code

* PR feedback, updating tests

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-05-29 23:26:02 +00:00
Case Nelson
f811b08b6d Single metadata endpoint for a dashboard (#43283) 2024-05-29 21:21:04 +00:00
Alexander Polyankin
84952a7f2b Do not use MBQL lib for parameter fields in dashboards when possible (#43312) 2024-05-29 15:44:43 -04:00
Braden Shepherdson
a672996a96 [MBQL lib] Add preview-query to truncate a query for Notebook preview (#42836)
Fixes #42831.

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-29 19:24:22 +00:00
Aleksandr Lesnenko
4c2d2400f9 fix edit hash is not removed after editing a dashboard (#43213) 2024-05-29 14:45:28 -03:00
Oisin Coveney
d0314b2e9c feat(sdk): Add static dashboards to embedding SDK (#41973) 2024-05-29 20:40:30 +03:00
Filipe Silva
96b357a625 cloud migration rc1 (#43082) 2024-05-29 18:11:58 +01:00
Anton Kulyk
10fee384b2 Add font fallbacks to charts rendering context (#43315)
* Use `useBrowserRenderingContext` in most charts

* Add font family fallbacks
2024-05-29 17:14:53 +01:00
John Swanson
8cfca2c6ef Allow disabling encryption for settings (#43085)
* Allow disabling encryption for settings

For two settings, we want to disable encryption entirely.

On the way out of the data source, we don't need to worry - the
decryption is already backwards-compatible with non-encrypted data.

On the way in, things are a bit less straightforward. The core of the
change is replacing the `t2/deftransform` that *always* runs
`encryption/maybe-encrypt` on the value with:

- a define-after-select that always tries to decrypt the value (so we
can handle existing encrypted values in the db)

- a define-before-insert that encrypts the value if the `defsetting`
told us to, and

- a define-before-update that does the same thing.

For now, set two settings to be never-encrypted: `analytics-uuid` and
`anon-tracking-enabled`.
2024-05-29 08:41:50 -07:00
Kamil Mielnik
cb828242f3 Time-over-time comparison aggregation helpers (#43081)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Use displayName instead shortName
2024-05-29 21:41:42 +07:00
Romeo Van Snick
c25c32a552 Update expression suggestion design (#43232)
* Use sentence case for suggestion headers

* Remove suggestion group dividers

* Highlight suggestions when mousing over them

* Remove unused hoverparent

* Remove custom highlighting for icons

* Allow passing color to metadata info icon

* Make suggestions icons have a consisten color

* Update documentation suggestion style

* Add margin to suggestion sections

* Reorder suggestion sections

* Add test for mouse over highlight on suggestions

* Fix test for suggestion footers

* Remove debugging true

* Rename 'Most used functions/aggregations' to 'Common functions/aggregations'

* Highlight suggestion on mouse move

* Only call onHighlightSuggestion if it is not already highlighted

* Use arrow functions

* Fix test for suggestion highlight
2024-05-29 11:00:55 +00:00
Romeo Van Snick
58867ab701 Correctly place "Add column" button and allow using it when summarizing (#43189)
* Do not render 'Add column' shortcut when viewing a raw table

* Do not show 'Add column' shortcut when a query has aggregations

* List shortcut guards out of component

* Make 'Add column' icon sticky in the header

* Add test for hiding the column shortcut

* Remove Number wrapper

* Move padding to a constant

* Use actions directly to determine if there are any shortcuts

* Make sure there are expressionable columns for the combine columns shortcut

* Make sure there are extractable columns for the extract column shortcut

* Remove padding when not overflowing

* Do not shadow query in popover components

* Allow combine and extract for raw tables

* Add test for combining summarization columns

* Add test for combining summarization columns

* Use a more precise way of calculating the offset for the 'Add column' button

* Handle null question

* Change to the outline button

* Use actual column widths to calculate total width

* Handle empty mode

* Remove extra measure call

* Move shortcutColumn to separate method and avoid looping over all available actions when possible
2024-05-29 11:02:53 +02:00
Nicolò Pretto
d187cadbde Fix multiple origins support by handling invalid origins (#43170)
* Revert "Revert "minimal support for multiple values for Access-Control-Allow-Origin (#42888)" (#43125)"

This reverts commit a4312230a8.

* refactor: extracted parse-approved-origins + supported "*" without special case

* fix: parse-approved-origins won't break on multiple spaces in a row

* handles invalid urls in the origins + some formatting

* log instead of throwing in parse-url + simplify the logic in parse-approved-origins

* simplify parse-approved-origins logic by splitting on "at least one space"

* remove extra boolean call

* approved-origins -> approved-origins-raw to better reflect that it's a raw string

* swap the order of the arguments to `is` in the tests

* indentation 🙃
2024-05-29 07:59:33 +02:00
Phoomparin Mano
fdfcf63573 support test utilities in sdk import (#43242) 2024-05-29 12:53:20 +07:00
Raphael Krut-Landau
505d43496b Move model caching form to Admin / Performance (#43143) 2024-05-29 03:15:24 +00:00
metamben
dcb9713d56 Return card type in GET /api/table/card__:id/query_metadata (#43203)
* Return card type in GET /api/table/card__:id/query_metadata

Also, stop requesting card metadata in dependent-metadata.
2024-05-29 02:10:57 +03:00
Ryan Laurie
61c778c1cd Improve models table performance (#43149)
* improve models table performance

* add loading state for large sets of models

* less icon padding
2024-05-28 22:53:30 +00:00
Raphael Krut-Landau
b9d037f60b Tweak appearance of cache page and form (#42856)
* squashed branch

* fix form buttons and formpadding

* fix some tests
2024-05-28 17:30:50 -04:00
Aleksandr Lesnenko
c75cbe65da use automation user PAT when creating commits in CI workflows (#43250) 2024-05-28 18:29:52 -03:00
Anton Kostenko
35a6544b79 Add Git repo SHA to the final image for future tracking (#43260) 2024-05-28 20:47:23 +00:00
Ryan Laurie
cd53c8af5d entityPicker in technicolor (#43161)
* entityPicker in technicolor

* more precise import

* add unit test
2024-05-28 20:45:58 +00:00
Chris Truter
bc3ce713db Upgrade zx from 7.2.3 to 8.1.0 (#43054) 2024-05-28 14:04:56 -06:00
Cal Herries
2c75a0c66a Fix a couple of flaky tests using with-call-count (#43248) 2024-05-28 13:22:06 -06:00
Alexander Polyankin
1712e03e79 Fix parameter matching with model columns (#43204) 2024-05-28 14:36:15 -04:00
Ryan Laurie
0e66b0d19a Use table2 icon for questions (#43095)
* use table2 icon for questions

* update e2e tests
2024-05-28 11:05:44 -06:00
Jeff Bruemmer
1670832a39 docs - app db note (#43239) 2024-05-28 13:04:47 -04:00
Cal Herries
8b82721dc9 A couple of changes to the sample content (#43200) 2024-05-28 16:24:25 +00:00
Jesse Devaney
8770ea27f0 Implement graceful error handling for trend charts (#43090)
* fix trend charts erroring on latest value being null

* refactor previousRowIndex calculation

* handle errors gracefully

* refactor error messages

* update computeTrend unit tests

* add error handling integration test

* add E2E test to check that errors are gracefully handled

* add integration test to enforce the fix

* fix static viz

* display more meaningful error on static-viz trend charts

* move error handling out of trend chart and fix error handling in Visualization.tsx

* update compute.unit.spec.js

* update SmartScalar.unit.spec.js

* use separate error handler for ErrorBoundary errors in Visualization.jsx

* update E2E test

* update error handling

* update compute.unit.spec.js

* fix react state change error in render function

* show generic error message for ErrorBoundary caught errors

* revert ErrorBoundary changes

* remove generic error border for visualizations
2024-05-28 11:41:31 -04:00
Jeff Bruemmer
cebf9a9622 add 49.12 to list of releases (#43236) 2024-05-28 15:04:03 +00:00
Phoomparin Mano
8fc52d228b feat(sdk): expose color and typography options for smart scalar in embedding SDK (#42915)
* feat(sdk): allow overriding positive and negative values

* docs(sdk): add positive and negative colors to docs

* feat(sdk): add smart scalar font size

* feat(sdk): add smart scalar line height settings

* feat(sdk): get rid of custom embedding mantine theme type

* wip: setup storybook and loki for smart scalar

* fix missing state for rendering visualizations

* docs(sdk): add scalar customizations to readme

* test(sdk): add test cases to loki

* add smart scalar reference image

* use css variables for brand

* make embedding theme options partial

* fix scalar value wrapper line height

* update loki snapshot

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-05-28 14:17:58 +00:00
Kamil Mielnik
3b3dcd8647 Disable offset() in custom columns (#43224)
* Disable offset in custom columns

* Remove .only

* Update CLJS tests
2024-05-28 21:08:37 +07:00
Uladzimir Havenchyk
33bb0759c5 Do not ignore icon prop on the Filter button (#43229) 2024-05-28 16:30:49 +03:00
Oisin Coveney
ed3cfb6087 Convert ParametersList to TS (#42822) 2024-05-28 15:20:20 +03:00
Alexander Solovyov
0bd7db0f18 [serdes] unify snowplow analytics in a single event (#43218) 2024-05-28 12:18:22 +00:00
Anton Kulyk
cc660510ed Fix rare axis ticks for timeseries axes (#43127)
* Fix typos

* Tweak `maxTicksForChartWidth` calculation

* Update Loki screenshots

* Tweak `PIXELS_PER_CHARACTER`

* Update test
2024-05-28 13:15:13 +01:00
Romeo Van Snick
b6bb9d184e Allow creating new items by inserting comma in MultiAutocomplete (#42824)
* Pass current values to shouldCreate

* Allow comma to create new item

* Simplify getAvailableSelectItems

* Add unit test for MultiAutocomplete input

* Use text instead of Text in paste

* Handle spaces in MultiAutocomplete

* Remove cast

* Reuse last var

* Use haveLastBeenCalledWith over haveBeenCalledWith

* Handle pasting when there is text in the input already

* Accept quote-delimited values

* Add info icon

* Handle tab as a separator

* Fix test cases for unsanitized parseValues

* Add csv-parse

* Use csv-parse to parse values

* Apply the correct color to the info icon

* Rename util to utils

* Break up tooltip text

* Only return unique values

* Be more accepting around quotes in the middle of unescaped values

* provide Buffer for csv-parse package in storybook

* Use browser-friendly version of csv-parse

* Remove unused eslint rule

* Add specital case for csv-parse to jest config

* Put uniqueness check in each state update

* Only add partial value if it is valid

* Only add partial value if it is valid

* Fix test case for FilterValuePicker

* Just use Set

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Allow parsing more than one value

* Use isValid everywhere it makes sense

* Add test for RTL languages

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-28 13:43:10 +02:00
Kamil Mielnik
e7948a7249 Copy question link from dashboard (#42892)
* Remove dead CSS

* Use proper types

* Properly type parameterValues

* Add href prop support to LegendCaption

* Extract getNewCardUrl
- move getParametersMappedToDashcard

* Use href in CartesianChart

* Handle RowChart

* Handle Funnel

* Format code

* Fix types

* Update first test in title-drill

* Update test

* Update test

* Update tests
- pass questionId in createQuestionAndDashboard

* Add test for links

* Fix createDashboardWithQuestions

* Add missing click handler

* Fix crash

* Fix typo

* Add a workaround for #42999

* Fix tests

* Fix hover color

* Update comment

* Get rid of mapStateToProps in DashboardGrid

* Invert condition

* Use useCallback instead useMemo

* Do not pass getNewCardUrl down if navigateToNewCardFromDashboard is not present
- Remove default noop for navigateToNewCardFromDashboard in PublicDashboard

* Remove explicit undefined prop
2024-05-28 18:23:51 +07:00
Phoomparin Mano
8cbacf7511 feat(sdk): override chart colors (#42960)
* add color types for chart sdk colors

* simplify chart color types

* chart color mappings

* apply mapping to master branch

* add chart mapping to mantine

* feat(sdk): apply chart accent colors to mantine and color getter

* rename tint and shade

* remove chart color logic from mantine

* add a color mapping test

* docs(sdk): add chart customizations to readme

* add type comments on MappableSdkColor

* cleanup sdk colors
2024-05-28 16:56:01 +07:00
Mahatthana (Kelvin) Nomsawadi
0c6b9355a7 Fix typo (#43194) 2024-05-28 09:05:39 +01:00
Cal Herries
92daf0cc7f Fix flaky migration rollback test for mysql: metabase.db.custom-migrations-test/migrate-uploads-settings-test-1 (#43210) 2024-05-28 04:06:25 +00:00
Cal Herries
83b55b99d6 Don't allow executing archived pivot-table cards in a public dashboard (#43206) 2024-05-27 16:51:53 -06:00
Alexander Polyankin
c45307cc9f Omit checks for dashboard metadata when not needed (#43197) 2024-05-27 14:39:39 -04:00
Case Nelson
a306b35715 [Metrics V2] Remove legacy-metric metadata (#43134)
* [Metrics V2] Remove legacy-metric metadata

Fixes #43131

* Don't mock metric

* Drop definition_description hydration on legacy metric

* Remove defintion_description tests

* Update src/metabase/lib/metadata.cljc

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-05-27 12:04:14 -06:00
Cal Herries
f3ddcb66a7 Migrate uploads settings to the db-level behind the scenes, so the uploads DB can be set by the config file (#42869) 2024-05-27 17:18:46 +00:00
Phoomparin Mano
a9d0596fcf docs(sdk): update color reference (#43086) 2024-05-27 15:07:52 +00:00
Uladzimir Havenchyk
057cb3f386 Avoid unnecessary re-renderings in dashboard - dashboard controls (#43169)
* Avoid unnecessary re-renderings in dashboard - dashboard controls

* Comment
2024-05-27 15:16:02 +03:00
Kamil Mielnik
e532b95fc6 Fix missing React key prop (#43179)
* Fix missing React key prop

* Fix missing React key prop

* Fix order of conditions and make the code easier to follow
2024-05-27 11:58:52 +00:00
Uladzimir Havenchyk
5f33a31dbd Restructure parameters e2e tests - separate auto-wiring (#42820) 2024-05-27 14:20:25 +03:00
Kamil Mielnik
4f37d5607a Enable running tagged tests defined in TS (#43172)
* Update & tag a test

* Run tests also on TS files

* Update mongo test
2024-05-27 18:11:20 +07:00
Alexander Solovyov
80687b8a42 [serdes] nested fields should be properly serialized (#43066) 2024-05-27 11:19:06 +03:00
Cal Herries
f4f2d45b23 Fix connection impersonation when jdbc spec is passed (#43147) 2024-05-25 01:02:31 +00:00
metamben
d208d800c3 Migrate metrics with display setting scalar (#43160) 2024-05-24 22:57:10 +00:00
metamben
1416017caa Remove api/legacy-metric (#43133) 2024-05-25 01:47:13 +03:00
metamben
e50a22f971 Remove unused card related endpoints (#43141) 2024-05-24 23:59:27 +03:00
Alexander Polyankin
b18e9caa42 Optimize initial dashboard load - load dashboard metadata in parallel with the query (#43101) 2024-05-24 20:38:53 +00:00
Nick Fitzpatrick
5e29f434a0 Add media query to search button (#43084)
* add media query to search button

* useSmallScreen hook
2024-05-24 16:48:02 -03:00
Ryan Laurie
abf9004160 Allow recent command palette items with the same name (#43098) 2024-05-24 13:04:02 -06:00
Ryan Laurie
c77f7f23d9 Hide creation buttons on search and recents tabs (#42977)
* hide creation buttons on search and recents tabs

* update e2e tests
2024-05-24 13:03:38 -06:00
Oisin Coveney
e1e845afa4 Convert DashboardControls to TS hooks (#42777)
* Convert DashboardControls to TS hooks

* fix types

* Modify dashboard url params to ensure that we keep hash options that haven't changed

* Fix PublicDashboard and DashboardTabs tests

* Use synced dashboard tabs for automatic dashboard, and use normal tabs for those with DashboardControls

* reduce hash option location changes to only the ones we can change through the UI

* Add comment on state management

* Remove console

* Attempt to solve more tests

* Remove loadDashboardParams as a passed prop

* Fix some tests, but will cause unit test to break

* Change names to reflect actual usage

* Fix lint and type issues

* Add simpler url param control, simplify types, and simplify fullscreen hook

* Add two way binding with url params to attempt to fix tests

* Fix unit test + types

* Move folders and fix imports

* Use Record<string, unknown> for refresh hook

* Remove console.log

* Clear query parameters when ParametersList unmounts

* Add comment

* Revert DisplayTheme changes

* Fix weird reloading problem

* Fix reducers test

* add code comments on selecting the tab once tab data is loaded

* add code comments on unsyncing parameters

* Fix e2e tests, move url reset to tabs context

* Fix e2e tests

* Hotfix

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-05-24 21:58:34 +03:00
Raphael Krut-Landau
adb7ff58a4 [Cache] Only show "Adaptive" and "Don't cache" options on OSS page (#43122)
* Limit options on OSS Admin/Performance page

* simplify

* simplify

* simplify

* divide constants to avoid circular imports

* divide constants to avoid circular imports

* divide constants to avoid circular imports

* simplify

* simplify

* simp

* fix

* simplify

* simplify

* fix test
2024-05-24 13:44:03 -04:00
Aleksandr Lesnenko
a4312230a8 Revert "minimal support for multiple values for Access-Control-Allow-Origin (#42888)" (#43125)
This reverts commit bf6fd9ef25.
2024-05-24 11:33:03 -04:00
Aleksandr Lesnenko
9194a1baca fix bars width when chart has two y-axes (#43100) 2024-05-24 12:29:29 -03:00
Uladzimir Havenchyk
1cb339e833 [Dashboard] Optimize rendering by reducing the number of props passing down to from the very top (#43114)
* Avoid unnecessary re-renderings in dashboard - getEmbeddedParameterVisibility

* Avoid unnecessary re-renderings in dashboard - favicon, page title

* Exclude isLoadingComplete from passing down

* Avoid unnecessary re-renderings in dashboard - metadata

* Drop metadata from Public Dashboard

* Avoid unnecessary re-renderings in dashboard - dashcardData
2024-05-24 18:20:04 +03:00
Nicolò Pretto
bf6fd9ef25 minimal support for multiple values for Access-Control-Allow-Origin (#42888)
* minimal support for multiple origins in security middleware

* if -> when to be more idiomatic

* adds tests for parse-url

* if -> when

* add missing new line in tests

* split the logic of validation in functions

* adds tests for the small functions

* use namespace in tests instead of :refer
2024-05-24 15:48:57 +02:00
Romeo Van Snick
2ab5debac0 Remove fixed height on popover (#43058) 2024-05-24 15:16:01 +02:00
Romeo Van Snick
2145b3cf9e Fix breakout pivot tether (#43060)
* Limit the height of the breakout popover

* Allow the click action popover to untether to prevent overflowing the screen

* Add reproduction for #43075

* Rename breaktrhough to breakout

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Use findAllByTestId

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Remove copy pasted question name

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Remove unused api intercept

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-24 14:01:58 +02:00
Romeo Van Snick
023ca9d1e9 Fix bucket trigger position (#43061)
* Make accordion list item content 100% wide

* Remove unused Dot component

* Move bucket popover trigger to the end of the item

* Revert QueryColumnPicker styles to what they were before adding the info icons

* Fix the height of the bucket picker
2024-05-24 08:36:39 +00:00
Uladzimir Havenchyk
14a42893a8 [UI] Fix styles for disabled Switch (#43091) 2024-05-24 09:19:03 +03:00
Case Nelson
5ad73d6fe6 [Metrics V2] Port Legacy metric tests and fixes (#43094)
* [Metrics V2] Port Legacy metric tests and fixes

Fixes #43093

* Address pr review
2024-05-23 16:39:57 -06:00
Alexander Polyankin
3713a16283 Optimize initial dashboard load (#42901) 2024-05-23 21:57:41 +00:00
metamben
e5e879afd4 Stop returning archived metrics in available metrics (#43031)
* Stop returning archived metrics in available metrics
* Add archived metric test
* Migrate legacy metric tests
* Delete lib/legacy_metric.cljc
2024-05-24 00:29:57 +03:00
metamben
1754ddcfaa Prevent returning metrics v2 migration backup field (#43087) 2024-05-23 18:39:43 +00:00
Emmad Usmani
1ea2b05fa3 refactor scatter plot to separate code path (#43032)
* refactor scatter plot model to separate function

* (2/3) refactor scatter plot option to separate function (#43033)

* use getScatterPlotOption

* use buildEChartsScatterSeries directly

* remove hoveredSeriesDataKey from scatter

* (3/3) improve chart model types (#43034)

* create WaterfallChartModel type

* create ScatterPlotModel type

* rename BaseCartesianChartModel to CartesianChartModel

* simplify chartModel creation in hook
2024-05-23 16:58:26 +00:00
Nick Fitzpatrick
ef28ff992c 42592 new modal adding database (#42966)
* modal built

* code cleanup, removing unused components

* whitespace shame

* adjusting unit test

* removing px shame
2024-05-23 11:40:37 -03:00
Ngoc Khuat
c9f2ffe99e Fix flaky test send-pulses-exceed-thread-pool-test (#43050) 2024-05-23 13:46:12 +00:00
Chris Truter
20cdd7cc1b Fix a bunch of small typos (#43055) 2024-05-23 13:39:52 +00:00
Kamil Mielnik
73e1b12679 Add repro for #42999 (#43000) 2024-05-23 19:56:05 +07:00
Noah Moss
5597f0febd Rework popular_items to use recent_views and view_count columns (#43041) 2024-05-23 08:45:02 -04:00
Alexander Polyankin
0e157dc8fb Revert "Load dashcard metadata in parallel with the query (#42953)" (#43063)
This reverts commit a0a4a26fdf.
2024-05-23 12:29:50 +00:00
Ryan Laurie
eee1c7e5b8 Properly show parent DBs in entity picker recents and search (#43016) 2024-05-23 05:32:02 -06:00
Tim Macdonald
4f7f55807c [ParseSQL] Find-and-replace with optional tags (#43013)
* Support find-and-replace with optional tags

[Fixes #42583]
2024-05-23 09:55:29 +00:00
Tim Macdonald
925454f14c [ParseSQL] Find-and-replace for snippets (#43011)
* Support F&R for snippets

[Fixes #42648]
2024-05-23 09:47:18 +01:00
Kamil Mielnik
dc4d78f16c Add a repro for #36508 (#43002) 2024-05-23 15:18:08 +07:00
Alexander Polyankin
59859a16b6 Flaky e2e fix (#43048) 2024-05-23 09:16:01 +02:00
Kamil Mielnik
41f6d17519 Fix - Empty collections shown in Data Picker (#42959)
* Generate different shouldShowItem for different pickers

* Add repro for #42957

* Update test to use models instead of metrics
2024-05-23 13:57:27 +07:00
Uladzimir Havenchyk
848fd9303e Drop props spreading to DashboardHeader (#42887) 2024-05-23 09:52:17 +03:00
bryan
ba7eae7554 bump saml20 - fix azure SLO (#43022) 2024-05-22 23:25:57 +00:00
Alexander Polyankin
a0a4a26fdf Load dashcard metadata in parallel with the query (#42953)
* Split card data and query

* Split card data and query

* Split card data and query

* Fix loading state

* Postpone card check

* Postpone card check

* Postpone field check

* Postpone field check

* Postpone field check

* Postpone field check

* Postpone field check

* Add await

* Add await

* Add await

* Add await

* Fix tests

* Fix data loading

* Fix data loading

* Fix data loading

* Fix data loading

* Revert "Fix data loading"

This reverts commit 2b782b9936.

* Fix data loading

* Fix test

* Fix test

* Fix embedding

* Fix xrays

* Fix xrays
2024-05-22 18:05:11 -04:00
Sloan Sparger
bdb006be00 Update link to docs about "No self-service" deprecation (#43038) 2024-05-22 21:22:18 +00:00
Nick Fitzpatrick
bd48581c81 42934 entity picker create collection root (#43005)
* NewCollectionDialog adjustment and unit test

* adding unit test for NewDashboardDialog
2024-05-22 17:28:08 -03:00
Alberto Perdomo
7deaf0d4ae Improvements to embedding sdk readme (#43021)
* SDK readme: update available and planned features

* SDK readme: general improvements
2024-05-22 20:46:48 +01:00
Ryan Laurie
f52078550b simplify db strategy editor markup (#42986)
* simplify strategy editor markup

* make it work for OSS too 😁
2024-05-22 13:41:17 -06:00
bryan
b2cf93c671 Effective location on collection recent items (#43018)
* add effective_location to recent-collection-items

* cleanup
2024-05-22 12:51:39 -06:00
Alexander Polyankin
93b83ab52f Add data source specific icons to data and join steps in the notebook editor (#42982) 2024-05-22 14:26:23 -04:00
Case Nelson
a68a4da67a [Metrics V2] Handle clashing expression names when adjusting metrics (#42984)
* [Metrics V2] Handle clashing expression names when adjusting metrics

Fixes #42782

* Address PR review
2024-05-22 11:51:32 -06:00
Ryan Laurie
bd552424ae update required checks copy documentation (#43003) 2024-05-22 08:58:10 -06:00
Jeff Bruemmer
ac639eaaef docs - download diagnostics (#42930) 2024-05-22 10:57:46 -04:00
Braden Shepherdson
acbfc6b5cc Drivers: Update the driver changelog with new features (#43004)
These were added in #42602 but I neglected to update the changelog.
Their defaults should serve for most drivers.
2024-05-22 10:18:27 -04:00
Uladzimir Havenchyk
933fd547f6 Cleanup annoying console warning from emotion (#42819) 2024-05-22 13:05:59 +00:00
Tim Macdonald
12bb81b528 Handle native query find-and-replace for queries with card refs (#42939)
* Handle native query find-and-replace for queries with card refs

[Fixes #42582]

c.f. limitiations in #42938

* wee cleanup
2024-05-22 10:44:18 +00:00
Cam Saul
340ea839d0 Tests for #15131 (#42972)
* Tests for #15131

* Appease Kondo
2024-05-22 11:23:58 +02:00
Romeo Van Snick
946974fb77 Limit the height of actions popover (#42946)
* Limit the height of actions popover

* Use Box instead of custom wrapper

* Add rem import
2024-05-22 10:58:16 +02:00
bryan
9dbfae2e17 the ' makes the doseq do nothing (#42988) 2024-05-22 04:45:50 +00:00
Cam Saul
d5a32ecb57 metabase.search namespace (#42487)
* Search API namespace

* Search API namespace

* Search API namespace

* Fix Kondo warnings

* Fix typo

* Finally solve the MySQL ^:parallel test failures <3

* Make some search tests REPL-friendly

* Did I finally fix `^:parallel` MySQL tests?

* Ok I give up just make the search tests single-threaded for MySQL/MariaDB.

* Revert the stuff to make paralell tests work for MySQL... for now.

* Keep new name

* Revert deps-graph changes

* Remove unused namespaces

* Fix Kondo linter for log/info + format

* Misc fixes 🔧

* Test fixes 🔧
2024-05-21 20:44:00 -07:00
Cam Saul
618b8c28aa metabase.analyze API namespace (#42469)
* Squashed commit

* Update config

* Backport the kondo ignore stuff from other PR.

* `metabase.analyze` API namespace
2024-05-22 02:56:04 +00:00
Cal Herries
a2b85e4b75 Tidy api-changelog.md (#42992) 2024-05-21 20:32:48 -06:00
John Swanson
1279a73ae2 Fix report_card.collection_preview in v49 (#42950)
This is a bit painful. I merged this change, but realized we need to
backport the fix to v49. However:

- we don't want to have two versions of the migration (one with a v49
id, one with a v50 id) because then if someone upgrades to 50, then
downgrades to 49, the `rollback` will run and change the type back,
leading to a bug.

- we don't want to push a v51 changeSet ID to v49 or v50, because we
give the user a helpful notice when their database needs a downgrade.
We do this by checking for the latest *executed* migration in the
database and comparing it to the latest migration that Liquibase knows
about, and making sure the executed isn't bigger than the known (e.g.
you can't have executed a v51 migration if it isn't in the local
migration yaml). That would all work fine, except that then we want to
tell you how to downgrade your database, and we use the latest-executed
version for that. So if, for example, someone upgraded from 48 to 49 and
got a v51 changeset, then downgraded back to 48, they would get an error
telling them to run the *v51* jar to roll back their DB.

In this case though, I think it's fine to just move the migration around
to v49, then we can backport it to 49 and 50.
2024-05-21 23:34:16 +00:00
Ryan Laurie
8615540e38 add snowplow tracking for upsells (#42955)
* add snowplow tracking for upsells

* add upsell snowplow test

* appease the linter
2024-05-21 16:49:10 -06:00
Emmad Usmani
139e421771 highlight hovered timeline event (#42969)
* highlight hovered timeline event

* add e2e test

* use TIMELINE_EVENT_DATA_NAME constant

* add test case for clicking icon
2024-05-21 15:23:18 -07:00
bryan
790a6479c8 Fixing a couple Recents API corner cases (#42813)
* handle visibilty_type on tables

- remove def wtf
- uncomment + fix tests

* make sure parent colls exist on report_cards

- official is a string
- ensure the database for a recent table exists

* remove def + improve arg name

* docstring

* improve + extract valid parent collection check

* grab the entity's colllection id and use that for the validity test

- This seems like something that should never happen, but I've seen it
happen. I think it might be possible from a down/up migration.

* fix tests

* fix more tests

* cleanup

* fixing another test

* add error-avoider, to filter bad items in prod instead of throwing

- improve recent view testing for table

* remove wrap (it double prints the value)
2024-05-21 16:07:43 -06:00
Denis Berezin
89bef96b93 feat: Add utm parameters to embedded OSS Metabase footer link (#42968)
* Add utm params to  link

* Fix e2e, add url domain

* Fix e2e
2024-05-21 21:34:27 +00:00
Case Nelson
8f9b9c3a13 [Metrics V2] Backfill viz settings for compatible-series (#42970)
* [Metrics V2] Backfill viz settings for compatible-series

Fixes #42575

The BE should rely on the query when there is no corresponding viz setting.
If there is no graph.metrics setting, assume that all last-stage aggregations are used.
No graph.dimensions -> use breakouts.

* Fix tests

* Unskip e2e test

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-21 21:20:32 +00:00
Jeff Bruemmer
64aa52ea12 docs - command palette (#42397) 2024-05-21 17:13:17 -04:00
Case Nelson
4fd9d7ae21 [Metrics V2] Adjust expression clauses in metric refs (#42962)
Fixes #42360
2024-05-21 13:49:55 -06:00
Jesse Devaney
6270bb4bc6 Fix overly frequent line series dots (#42735)
* hide symbols for charts with too many of them

* update loki

* prevent series dots showing up after manually disabling another series

* update loki snapshots

* refactor conditional

* update loki snapshots
2024-05-21 19:30:54 +00:00
metamben
9771eaa290 Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc (#42653)
* Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc
* Fix test-runner: druid should not exclude druid-jdbc
* Implement set-parameter and unprepare-value for LocalDateTime for druid-jdbc
2024-05-21 18:58:47 +00:00
Nick Fitzpatrick
c69596ab0b changing button height and CP input placeholder (#42770)
* changing button height and CP input placeholder

* adjusting search button size

* translate new placeholder
2024-05-21 15:39:59 -03:00
Denis Berezin
a3c3193474 fix(sdk): Various fixes for InteractiveQuestion theming (#42932)
* Fixes for InteractiveQuestion theming

* Update readme

* Fix for unset filter theme color

* Fix unit tests

* Fix unit tests
2024-05-21 18:31:17 +00:00
Sloan Sparger
eca94e12d8 Fix c method of ttag not showing strings as tagged in debug mode #42965 2024-05-21 17:50:57 +00:00
Alexander Polyankin
4be9fcf47f Revert "Fix failing offset tests" (#42961)
* Revert "Fix failing offset tests (#42944)"

This reverts commit fca30b1ae5.

* Fix e2e
2024-05-21 17:33:25 +00:00
Phoomparin Mano
2e9a53a778 feat(sdk): apply user interface color overrides to the sdk (#42834)
* feat(sdk): apply ui color overrides to the sdk

selector state

set global embedding colors

rename the method

* test(sdk): add unit test on color overrides
2024-05-21 17:29:24 +00:00
Kamil Mielnik
bbaa180303 Fix - Admin Email does not Display on Question Timeout Page (#42937)
* Extract EmailAdmin and add tests for it

* Rename EmailAdmin to AdminEmail

* Remove redundant async

* Add a test case for no email
2024-05-21 17:26:15 +00:00
Romeo Van Snick
1424a6ea70 Fix icon colors in column picker (#42945)
* Make icons 16px in data picker

* Use text-light in DataPicker to match other icons
2024-05-21 17:18:31 +00:00
Kamil Mielnik
fca30b1ae5 Fix failing offset tests (#42944)
* Fix failing offset tests

* Fix flaking test
2024-05-21 15:24:34 +00:00
Cal Herries
ccb4942b6a [forward-port] More upload test changes for clickhouse (#42531) (#42715) 2024-05-21 07:46:44 -06:00
Cal Herries
9da95541f1 CSV uploads: Add test for appending duplicate data (#42918) 2024-05-21 07:46:02 -06:00
Alexander Polyankin
4b7f04a8bc Cleanup DataPicker initialization (#42916) 2024-05-21 08:31:22 -04:00
Uladzimir Havenchyk
c09ec3ddeb Drop props spreading to DashboardSidebars (#42907) 2024-05-21 12:48:02 +03:00
Kamil Mielnik
9384525278 Repro #36631 - A "Default period" is appended for Date columns within Custom Columns when using Question as Source Data (#42876)
* Add a repro for #36631

* Do not wrap id
2024-05-21 13:38:18 +07:00
Kamil Mielnik
802b0d915f Cover Offset() in custom expressions with e2e tests (#42756)
* [MBQL lib] Reject broken uses of `offset` in expressions, filters (#42662)

- Using `offset` in custom expressions is supported only when there is
  an order-by defined on that stage.
- Using `offset` in custom filters is not supported at all, currently.

* Support `Offset()` in custom columns [frontend] (#42326)

* Only nest expressions referenced in breakouts or aggregations

* Support Offset() as expression with no breakouts

* Test fixes 🔧

* Oracle test update

* Improved Oracle test

* Test update 🔧

* Fix busted test

* Add naive support for Offset() in expressions

* Introduce MBQLClauseFunctionReturnType

* Add "window" to MBQLClauseFunctionReturnType and use it for the offset function

* Handle offset type inference

* Remove unused export

* Use "expression" instead of "window" return type
- Rename identifiers in isCompatible
- Make isCompatible accept a clause object instead of just the type
- Handle offset as a special case in isCompatible

* Use any type

* Rename expectedArgumentType to expectedType

* Format code

* Sort types

* Do not suggest offset function in filters

* Fix offset not working in case

* Revert "Do not suggest offset function in filters"

This reverts commit e63790b780.

* Fix order of adjustments

---------

Co-authored-by: Cam Saul <github@camsaul.com>
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>

* Disable offsets in filters expressions

* Group existing aggregations-specific tests

* Remove repro for a closed issue

* Use findByText instead of contains

* Add a test for filter expressions

* Add a test for aggregation expressions suggestions

* Disable offsets in filters expressions (#42755)

* Add a test for custom column suggestions

* Add "typing" to enterCustomColumnDetails

* Use enterCustomColumnDetails, improve assertions

* Add more assertions

* Optimize queries

* Add typing for offset expressions

* Add a repro for metabase#42764

* Add a TODO

* Add a TODO

* Add a TODO

* Use NumericLiteral

* Post-merge fixes

* Update test

* Add tests for other custom expressions

* Test drills

* Format code

* Update test name

* Add an assertion

* Add assertions for the preview

* Unskip fixed issue

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
Co-authored-by: Cam Saul <github@camsaul.com>
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-21 13:37:45 +07:00
metamben
09c557cdf7 Fix flaky adjust-mixed-multi-source-test (#42926) 2024-05-21 09:10:26 +03:00
Sloan Sparger
cf97acdaeb Split out Search e2e tests and Record Pre-Release Sanity Checks with Replay (#42933)
* add replay recordings to sanity check e2e tests during pre-release workflow

* split out search tests from onboarding folder

* parallelize pre-release testing

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-20 23:33:19 +00:00
John Swanson
b76e26fac3 Correct type for report_card.collection_preview (#42919)
In v49, we converted all boolean types to `bit(1)` on mysql/mariadb. It
looks like we missed this one, so when you `GET` a card it has
`"collection_preview": 1`. Then we get an error when trying to save,
because `collection_preview` should be a boolean.

I verified that after this migration, `GET`ting a card results in a
boolean `"collection_preview"`.
2024-05-20 15:20:05 -07:00
Jesse Devaney
f436b5b066 fix trend charts spacing (#42860) 2024-05-20 20:41:09 +00:00
Sloan Sparger
32421f2e39 Remove flaky / redundant e2e test (#42920) 2024-05-20 20:19:05 +00:00
Jeff Bruemmer
1ef312845f small edits (#42923) 2024-05-20 20:17:37 +00:00
metamben
9cb18c0056 Fix comment (#42906)
* Fix comment
2024-05-20 19:27:40 +00:00
Kamil Mielnik
fb4b8ca2a6 Create the new Metric entity (Metrics v2) (#38457) 2024-05-20 13:47:00 -04:00
Roman Abdulmanov
d80667fe36 revert embed board (#42911) 2024-05-20 17:44:49 +00:00
Uladzimir Havenchyk
3999e8ebe4 Drop props spreading to DashboardGrid (#42875) 2024-05-20 20:43:58 +03:00
Sloan Sparger
375cb63200 Disable popular items e2e home page test in OSS (#42896)
* disables testing for home page popular items in oss

* Update e2e/test/scenarios/onboarding/home/homepage.cy.spec.js

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-05-20 12:23:52 -05:00
Sloan Sparger
45622180e1 asserts values match current expectations of values which hopefully solves race conditions that might be happening (#42905) 2024-05-20 12:23:02 -05:00
Denis Berezin
0278b8d221 fix(sdk): Use theme font in charts and tooltips (#42855)
* Allow charts font override in SDK

* Fix default not configured font
2024-05-20 16:57:49 +00:00
Ryan Laurie
36d03247f3 Improve db setup tests more (#42899)
* improve db setup test

* improve embedding test
2024-05-20 11:04:33 -05:00
Ryan Laurie
3697804c3c Remove utm from source plan in upsell links (#42890) 2024-05-20 15:15:42 +00:00
Ryan Laurie
5e562cd86c Make Metabot Cool Again (#42797)
* Make Metabot Cool Again

* update tests
2024-05-20 07:32:55 -06:00
Uladzimir Havenchyk
5d795be2c8 Exclude jspdf and html2canvas from the bundle (#42536)
* Exclude jspdf and html2canvas from the bundle

* cleanup
2024-05-18 13:03:29 +03:00
John Swanson
930777e1a4 Add a type to collections returned by search (#42535)
Under:

- `item.type`

- `item.collection.type`, and

- `item.collection.effective_ancestors.*.type`
2024-05-17 15:36:56 -07:00
Cal Herries
b300002061 Use db argument in driver/database-supports? for uploads (#42851) 2024-05-17 21:43:22 +00:00
John Swanson
80d8e87242 Update API Changelog (#42864) 2024-05-17 21:14:01 +00:00
Jeff Bruemmer
9be96be978 docs - csv upload replace (#42529) 2024-05-17 16:59:36 -04:00
Denis Berezin
7f6ba3e374 Restore default styles for subtle button (#42854) 2024-05-17 20:29:12 +00:00
metabase-bot[bot]
443203b41c Update Readme version references and published npm version to 0.1.4 (#42852)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-05-17 19:22:00 +00:00
Noah Moss
fb9da630b3 Fix schema error in recent views query (#42844) 2024-05-17 18:07:31 +00:00
Sloan Sparger
8477f8db86 Fix homepage flaky test (#42839)
* fixes homepage flaky test

* take 2

* better fix
2024-05-17 17:52:03 +00:00
Nick Fitzpatrick
f74b0e3fbb fixing e2e flakes in search-snowplow and recently-viewed specs (#42840) 2024-05-17 17:10:56 +00:00
Ryan Laurie
eaab3ba2ce Improve db connection setup test (#42838) 2024-05-17 11:54:33 -05:00
Nemanja Glumac
3b5258d7ea Remove GoogleAnalytics specific logic from the FE (#42827) 2024-05-17 18:01:23 +02:00
Oisin Coveney
01e45b8471 Review suggestions from #42768 (#42830) 2024-05-17 14:44:09 +00:00
Romeo Van Snick
147b9f7dad Scroll to created column when extracting or combining columns in chill mode (#42650)
* Set scrollToLastColumn ui control from column extract action

* Scroll to last column when the uiControl is set

* Scroll to last column when combining a column

* Scroll to last column when combining a column via the + shortcut

* Scroll to last column when extracting a column via the + shortcut

* Remove all references to settingsSyncOptions

* Check that the column is added at the end

* Disable scrollToLastColumn once used

* Add test that verifies scrollToLastColumn ui control has been reset
2024-05-17 16:23:03 +02:00
Ngoc Khuat
29a1713df7 Add task history status (#42372) 2024-05-17 14:06:21 +00:00
Denis Berezin
a6035a1aff Add custom theming support for SDK InteractiveQuestion component (#42663)
* Add proper brand colors to drills menu

* Add theming for filters and drills

* Fix css vars

* Fix table css

* Add SDK theme colors interface and remapping

* Fix dashboard brand color issue

* Fix theme colors interface

* Fix default theme table cell background

* Fix typo

* Fix for qb filters panel custom border
2024-05-17 13:40:28 +00:00
Nemanja Glumac
c64187b17b Drop the "frozen" frontend install during build when in CI (#42771) 2024-05-17 15:26:10 +02:00
Oisin Coveney
2cf2955f91 Convert RefreshWidget to Mantine, CSS modules, and TS (#42768) 2024-05-17 13:24:48 +00:00
Kamil Mielnik
784e869891 Data picker (#41175)
* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 38ac092335.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 2b8fe78ed4.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 219506f0e0.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 9430478bdf.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 8c6cdd9068.

* Table Picker (#40509)

* Generic types

* Generic types

* Generic types + make generateKey a prop

* Generic types

* Extract AutoScrollBox.styled.tsx

* Move AutoScrollBox to a separate directory

* Generic types

* Generic types

* Generic types

* Unhookify searchFilter

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Finish dealing with a cast

* Destructure import

* Inline type

* Generic types

* Remove cast

* Remove commented code

* Remove redundant fallback

* Move CollectionPicker out of EntityPicker

* Avoid as unknown

* Remove TODOs

* Rename TisFolder to IsFolder

* Fix any

* Fix anys

* Remove NestedItemPicker's storybook

* Remove a cast

* Remove a cast

* Remove a cast

* Revert "Remove a cast"

This reverts commit b762d0f076.

* Use extends SearchModelType instead of extends string everywhere

* Revert "Use extends SearchModelType instead of extends string everywhere"

This reverts commit 708190d63e.

* Fix SearchResult["available_models"] type

* Handle options.allowCreateNew

* Add missing description attribute to Database type

* Move allowCreateNew to CollectionPickerOptions

* Add missing description attribute in Database mock

* Add types

* Add TableList component

* Add SchemaList component

* Fix naming

* Add DatabaseList component

* Add NotebookDataItemPickerResolver

* Fix typing

* Add TablePicker and NotebookDataPickerModal

* Update types

* Fix types

* Add folder type

* Fix initial state

* Update title

* Make query model-dependent

* Render tables

* Fix schema icon

* Adjust key generation

* Rename utilts to utils

* Use ItemList error prop

* Use value prop

* Rename NotebookDataPickerModal to DataPickerModal

* Automatically open datapicker if there is no value

* Highlight current item

* Rename value to initial value

* Fix item highlighting

* Rework TablePicker state

* Leave TODOs for names

* Fix selecting items

* Fix highlighting selected item

* Hide confirmation button

* Add fetchMetadata to tableApi

* Fix Table['schema'] type

* Fetch table metadata upon selection

* Remove options from DataPickerModal

* Fix collectionId typing in Question

* Add collectionId prop

* Remove title prop

* Add todo

* Fix confirmation button

* Remove old DataSourceSelector

* Bring back useSchemaListQuery

* Fix crash

* Fix picker not opening

* Hide dbs list and schemas list if there's only 1

* Remove unused ref

* Remove unused DataPickerListResolver

* Remove unused types

* Change conditional rendering to allow for loading state

* Revert collection-related changes

* Use RTK

* Avoid using stale data

* Fix highlighted db

* Remove todo

* Remove unused type

* Remove useSchemaListQuery

* Rename Value to TablePickerValue

* Move isValueEqual to utils and rename it to isTablePickerValueEqual

* Improve TODO

* Remove unused options prop

* Introduce tablePickerValueFromTable

* Avoid having 2 table metadata requests

* Update comment

* Update comment

* Remove unused function

* Allow null in tablePickerValueFromTable

* Extract helpers

* Rename schemaId to schemaName

* Remove description

* Improve naming

* Simplify types

* Add explanatory comments

* Fall back to empty state when there are no items

* Account for null schemas

* Account for null schema in tests

* Revert "Account for null schema in tests"

This reverts commit 0c96d1cb88.

* Revert "Account for null schemas"

This reverts commit 4f5c4e99ee.

* Improve typing around schema name

* Refactor auto-select logic

* Refactor

* Avoid comment

* Make useAutoSelectOnlyItem generic

* Do not enforce presence of at least 1 tab with TypeScript

* Fix types

* Remove obsolete comment

* Post-merge fix

* Integrate QuestionPicker in DataPicker (#42268)

* Add question and model pickers to Data Picker

* Add model attribute to data picker value

* Introduce DataPickerValue

* Start with the right tab when opening data picker modal

* Do not use stale sourceCard value

* Fix switching tabs when a table is selected

* Use undefined instead of null for consistency

* Do not show models/questions tabs when there are no models/questions

* Fix selecting models/questions in search results

* Remove dead code

* Remove dead code

* Ignore selecting collections

* Refactor useHasModels and useHasQuestions into useAvailableData

* Use models param to speed up the query

* Do not require `onConfirm` prop in `EntityPickerModal` (#42317)

* Make onConfirm prop optional

* Add a test for onConfirm prop assertion

* Table does not appear selected in single-schema dbs (#42336)

* Convert useAutoSelectOnlyItem arguments to param object

* Disable auto-selection when there already is a selection

* Use `DataPicker` in `JoinTablePicker` (#42330)

* Refactor DataStep:
- rename handleTableSelect to handleTableChange
- extract value and memoize it

* Remove redundant fragment

* Add new DataPicker props

* Use DataPickerModal in JoinTablePicker

* Remove initialTab prop since the default tab is always the models tab anyway

* Limit table selection to particular database

* Limit search results to a given database

* Support databaseId in useAvailableData

* Filter collection items by databaseId

* Use databaseId prop only for CollectionItemList component

* Fix types

* Fix filtering

* Use useLatest for onChange

* Fix typing

* Introduce shouldShowItem and use it instead of databaseId prop

* Improve PickerInfo type

* Use MLv2 to generate DataPickerModal value in JoinTablePicker

* Fix title

* Add isModel to TableDisplayInfo

* Add a hack to populate query metadata with info that table is a model

* Remove NewQuestionView & QuestionDataSelector (#42562)

* Temporarily disable recents tab in the data picker

* Update Data Picker tests (#42565)

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Fix metadata loading

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test and make it pass

* Update test

* Update tests

* Update test

* Use entityPickerModal() instead of modal()

* Use entityPickerModal() instead of modal()

* Update test

* Update test

* Update test

* Revert change that broke tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Remove test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Rename createDatabaseIdItemFilter to createShouldShowItem

* Update test

* Update and skip a test

* Remove test

* Update tests

* Update tests

* Update tests

* Remove test

* Update tests

* Update test

* Update test

* Update test

* Extract utils

* Use helpers

* Extract helpers

* Update test

* Update test

* Update test

* Update test

* Update test

* Filter out collections that do not have card or dataset

* Improve filtering

* Always show root and personal collections, see https://github.com/metabase/metabase/issues/42687

* Remove failing assertion

* Update tests

* Use entityPickerModalTab

* Accept strings in pickEntity

* Use entityPickerModalLevel

* Use entityPickerModalTab

* Use entityPickerModalTab

* Update tests

* Update test

* Update tests

* Update test

* Fix assertion

* Update test

* Update tests

* Update test

* Update tests

* Update tests

* Update test

* Update test

* Update tests
- ensure database list gets loaded like in a real app

* Update test

* Update test

* Integrate Recents tab in Data Picker (#42821)

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Fix metadata loading

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test and make it pass

* Update test

* Update tests

* Update test

* Use entityPickerModal() instead of modal()

* Use entityPickerModal() instead of modal()

* Update test

* Update test

* Update test

* Revert change that broke tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Remove test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Rename createDatabaseIdItemFilter to createShouldShowItem

* Update test

* Update and skip a test

* Remove test

* Update tests

* Update tests

* Update tests

* Remove test

* Update tests

* Update test

* Update test

* Update test

* Extract utils

* Use helpers

* Extract helpers

* Update test

* Update test

* Update test

* Update test

* Update test

* Filter out collections that do not have card or dataset

* Improve filtering

* Always show root and personal collections, see https://github.com/metabase/metabase/issues/42687

* Remove failing assertion

* Update tests

* Use entityPickerModalTab

* Accept strings in pickEntity

* Use entityPickerModalLevel

* Use entityPickerModalTab

* Use entityPickerModalTab

* Update tests

* Update test

* Update tests

* Update test

* Fix assertion

* Update test

* Update tests

* Update test

* Update tests

* Update tests

* Update test

* Update test

* Update tests
- ensure database list gets loaded like in a real app

* Update test

* Enable recents tab and update tests

* Update test

* Update tests

* Add Recents-related assertions

* Update test

* Clean up mocks

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-17 12:53:29 +00:00
Uladzimir Havenchyk
752bf845fc Add missing tests for user-level filter state in dashboards (#42826)
* Add missing tests for user-level filter state in dashboards

* Update e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-17 12:41:41 +00:00
Raphael Krut-Landau
5ac502a58c rebase (#42808) 2024-05-17 08:30:47 -04:00
Raphael Krut-Landau
95722dcbe3 New copy for strategyform (#42815) 2024-05-17 08:13:37 -04:00
Raphael Krut-Landau
918327bb34 Remove dead code (#42823) 2024-05-17 08:13:15 -04:00
Raphael Krut-Landau
12ae82f084 Fix BucketPickerPopover test (#42811) 2024-05-17 08:09:19 -04:00
Phoomparin Mano
74ec3eeec7 feat(sdk): document theming options in readme (#42784)
* add font size example

* feat(sdk): document theming options in readme
2024-05-17 17:16:42 +07:00
Sloan Sparger
7460cad859 [Feature branch] Make Trash Usable (#42339)
* Migration to add `trashed_from_*` (#41529)

We want to record where things were trashed *from* for two purposes:

- first, we want to be able to put things back if they're "untrashed".

- second, we want to be able to enforce permissions *as if* something is
still in its previous location. That is, if we trash a card or a
dashboard from Collection A, the permissions of Collection A should
continue to apply to the card or dashboard (e.g. in terms of who can
view it).

To achieve this, collections get a `trashed_from_location` (paralleling
their `location`) and dashboards/cards get a
`trashed_from_collection_id` (paralleling their `collection_id`).

* Create the trash collection on startup (#41535)

* Create the trash collection on startup

The trash collection (and its descendants) can't have its permissions
modified.

Note that right now, it's possible to move the Trash collection. I'll
fix this when I implement the API for moving things to the Trash.

* s/TRASH_COLLECTION_ID/trash-collection-id/g

* Add a comment to explain null comparison

* Move archived items to the trash (#41543)

This PR is probably too big. Hopefully documenting all the changes made here will make it easier to review and digest. So:

Tables with a `collection_id` had `ON DELETE SET NULL` on the foreign key. Since we only deleted collections in testing and development, this didn't really affect anything. But now that we are actually deleting collections in production, it's important that nothing accidentally get moved to the root collection, which is what `SET NULL` actually does.

When we get an API request to update the `archived` flag on a card, collection, or dashboard, we either move the item *to* the trash (if `archived` is `true`) or *from* the trash (if `archived` is `false`). We set the `trashed_from_collection_id` flag as appropriate, and use it when restoring an item if possible.

Because moving something to the trash by itself would have permissions implications (since permissions are based on the parent collection) we need to change the way permissions are enforced for trashed items.

First, we change the definition of `perms-objects-set-for-parent-collection` so that it returns the permission set for the collection the object was *trashed from*, if it is archived.

Second, when listing objects inside the Trash itself, we need to check permissions to make sure the user can actually read the object - usually, of course, if you can read a collection you can read the contents, but this is not true for the trash so we need to check each one. In this case we're actually a little extra restrictive and only return objects the user can *write*. The reasoning here is that you only really want to browse the Trash to see things you could "act on" - unarchive or permanently delete. So there's no reason to show you things you only have read permissions on.

Because previously the Collections API expected archived collections to live anywhere, not just in a single tree based in the Trash, I needed to make some changes to some API endpoints.

This endpoint still takes an `exclude-archived` parameter, which defaults to `false`. When it's `false`, we return the entire tree including the Trash collection and archived children. When it's `true`, we exclude the Trash collection (and its subtree) from the results.

Previously, this endpoint took an `archived` parameter, which defaulted to `false`. Thus it would only return non-archived results. This is a problem, because we want the frontend to be able to ask for the contents of the Trash or an archived subcollection without explicitly asking for archived results. We just want to treat these like normal collections.

The change made to support this was to just default `archived` to the `archived` status of the collection itself. If you're asking for the items in an archived collection, you'll only get archived results. If you're asking for the items in a non-archived collection, you'll only get unarchived results.

This is, for normal collections, the same thing as just returning all results. But see the section on namespaced collections for details on why we needed this slightly awkward default.

No change - this endpoint still takes an `archived` parameter. When `archived=true`, we return the Trash collection, as it is in the root collection. Otherwise, we don't.

* Make Trash Usable - UI (#41666)

* Remove Archive Page + Add `/trash` routing (#42226)

* removes archive page and related resources, adds new /trash route for trash collection, adds redirects to ensure consistent /trash routing instead of collection path

* fixes unit + e2e tests, corrects links generated for trash collection to use /trash over /collect/:trashId route

* updates comment

* Serialize trash correctly (#42345)

Also, create the Trash in a migration rather than on startup. Don't set a specific trash collection.id, instead just select based on the `type` when necessary.

* Fix collection data for trashed items (#42284)

* Fix collection IDs for trashed items

When something is in the trash, we need to check permissions on the
`trashed_from_collection_id` rather than the `collection_id`. We were
doing this. However, we want the actual collection data on the search
result to represent the actual collection it's in (the trash). I added
the code to do this, a test to make sure it works as intended, and a
comment to explain what we're doing here and why.

* Refactor permission for trashed_from_collection_id

Noah pointed out that the logic of "what collection do I check for
permissions" was getting sprinkled into numerous places, and it felt a
little scary. In fact, there was a bug in the previous implementation.
If you selected a collection with `(t2/select [:model/Collection ...])`,
selecting a subset of columns, and *didn't* include the
`trashed_from_collection_id` in that set of columns, then called
`mi/can-write?` on the result, you'd get erroneous results.
Specifically, we'd return `nil` (representing the root collection).

I think this is a reasonable fix, though I'm pretty new to using fancy
multimethods with `derive` and such. But basically, I wanted a way to
annotate a model to say "check these permissions using
`:trashed_from_collection_id` if the item is archived." And in this
case, we'll throw an exception if `:trashed_from_collection_id` is not
present, just like we currently throw an exception if `:collection_id`
is not present when checking permissions the normal way.

* Move existing archived items to the trash (#42241)

Move everything that's archived directly to the trash. It's not ideal
because we're wiping out the existing collection structure, but the
existing Archive page also has no collection structure.

* lint fixes from rebase

* Fix backend tests (#42506)

`can_write` on collection items was wrong because we didn't have a
`trashed_from_collection_id` - the refactor to ensure we didn't make
that mistake worked! 🎉

* Add an /api/collections/trash endpoint (#42476)

This fetches the Trash in exactly the same way as if we'd fetched it
with `/api/collection/:id` with the Trash ID. I hadn't realized that the
frontend was doing this with the previously hardcoded Trash ID.

* Make Trash Usable - Dynamic Trash Collection Id (#42532)

* wip

* fixes hardcoded reference to trash id in sidebar

* remove TRAHS_COLLECTION

* fixes line and e2e tests

* fix invert logic mistake and fixes lint

* Make Trash Usable - Search Filter UI (#42402)

* adds filtering for archived items on the search page

* fix typing mistake

* Make Trash Usable - Bug Bash 1 (#42541)

* disables reordering columns in archived questions, disables modifying archived question name in question header, collection picker no longer defaults to archived item, keeps trashed collection from appearing collection picker search results, shops showing empty area in trashed dashboard info sidebar, disables uploading csvs to trashed collections

* impls pr feedback

* fix e2e failure

* Localize the name of the Trash (#42514)

There are at least two spots where we can't just rely on the
after-select hook, and select the collection name directly from the
database: the Search and Collection API.

In these cases we need to call `collection/maybe-localize-trash-name`,
which will localize the name if the passed Collection is the Trash
collection.

* Update migration IDs

Migration IDs need to be in order.

* Fix failing mariadb:latest test (#42608)

Hooooly cow. Glad to finally track this down. The issue was that
booleans come back from MariaDB as NON BOOLEANS, and clojure says 0 is
truthy, and together that makes for FUN TIMES.

We need to turn MariaDB's bits to booleans before we can work with them.

* Make Trash Usable: Add `can_restore` to API endpoints (#42654)

Rather than having two separate implementations of the `can_restore`
hydration for cards and dashboards, I set up automagic hydration for the
`trashed_from_collection_id`. Then the hydration method for
`can_restore` can just first hydrate `trashed_from_collection` and then
operate based on that.

* fix can_restore for collections trashed from root

* Fix `trashed_from_location` for trashed subcols

We were setting `trashed_from_location` on subcollections to the
`trashed_from_location` of the ancestor that was trashed - which is
wrong.

This would have caused bugs where collections would be restored to the
root collection, regardless of where they were originally trashed from.

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>

* Fix Trash rollbacks (#42710)

* Fix Trash rollbacks

There were a few errors in my initial implementation.

First, we can't simply assume that `trashed_from_location` and
`trashed_from_collection_id` are set for anything in the archive. They
should be set for things *directly* trashed, but not for things trashed
as part of a collection.

Therefore, we need to set `location` and `collection_id` to something
like "if the item is in the trash, then the `trashed_from` - otherwise,
don't modify it".

Second, because `trashed_from_collection_id` is not a foreign key but
`collection_id` is, we have a potential problem. If someone upgrades,
Trashes a dashboard, then Trashes and permanently deletes the collection
that dashboard _was_ in, then downgrades, how do we move the dashboard
"back"? What do we set the dashboard's `collection_id` to?

The solution here is that when we downgrade, we don't actually move
dashboards, collections, or cards out of the Trash collection. Instead
we just make Trash a normal collection and leave everything in it.

* Make Trash Usable - Bug Bash 2 (#42787)

* wip

* fixes access to property on null value

* pr clean up

* more clean up

* Fix up tests

- permissions will check the archived from location. So recents need to
select :report_card.trashed_from_collection_id and
:dash.trashed_from_collection_id to satisfy mi/can-read?
- some commented out code with `(def wtf (mt/user-http-request
...))`. Restore tests.
- probably commented out because the recent views come back in an order
but we don't care about the order. And it was asserting against an
ordered collection. Just go from [{:id <id> :model <model>} ...] to a
map of {<id> <model>} and then our comparison works fine and is not
sensitive to order.

* put try/finally around read-only-mode

ensure the setting read-only-mode! to false happens in a finally
block. Also, set read-only-mode to false in

```clojure
(deftest read-only-login-test
  (try
    (cloud-migration/read-only-mode! true)
    (mt/client :post 200 "session" (mt/user->credentials :rasta))
    (finally
      (cloud-migration/read-only-mode! false))))
```

But worryingly, I think we have a lurking problem that I'm not sure why
we haven't hit yet. We run tests in parallel and then put all of the
non-parallel tests on the same main thread. And when one of these puts
the app in read-only-mode, the parallel tests will fail. HOPEFULLY since
they are parallel they won't be hitting the app-db necessarily, but
there could be lots of silly things that break.

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: dan sutton <dan@dpsutton.com>
2024-05-17 06:01:30 -04:00
Luiz Arakaki
dc4c56174d Update Metabase Analytics content for v50 (#42799)
* update metabase analytics with cache dashboardtab and subscriptions and alerts dashboard

* update yamls without view_count

* fix metabase analytics namespace
2024-05-17 09:51:28 +00:00
Uladzimir Havenchyk
d5bd7cac1f Maintain user-level state in dashboards for filters (#39813) 2024-05-17 12:37:14 +03:00
Nick Fitzpatrick
8fd90abb5a defaultToRecentsTab added (#42800) 2024-05-17 15:06:39 +07:00
Oisin Coveney
e2828c7902 Bump screenfull version to 6.0.2 (#42776) 2024-05-17 10:23:53 +03:00
Jesse Devaney
c747c1709c Move series data label formatters from option to the model (#42616)
* move series data label formatters to the model

- TODO: move stacked data label formatters to the model

* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* remove unused formatting options parameter

* move stacked labels formatter to model

* fix stacked combo chart label display for non-stacked lines

* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* fix waterfall chart labels

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-05-17 07:02:41 +00:00
Raphael Krut-Landau
c059690297 rebase (#42788) 2024-05-17 00:22:38 -04:00
Cal Herries
0fd6da0b1f Remove some columns from serialized card and table entities (#42812) 2024-05-16 21:44:09 -06:00
Raphael Krut-Landau
6cfb3b5f21 Add cache invalidation configuration form to question info sidebar (#42729) 2024-05-16 23:33:06 -04:00
Cam Saul
7a9b6acca8 Fix sorting by Offset() custom expression aggregation (#42737)
* Fix sorting by `Offset()` custom expression aggregation

* Unskip test

* Revert breaking change to `mt/id` and related
2024-05-17 02:56:23 +00:00
Cal Herries
c7b5cddbdd Exclude view_count columns from serialized dashboard and card (#42801) 2024-05-17 01:18:01 +00:00
Alexander Polyankin
4e50783cd2 Fix filters with is-null and not-null operators crashing the QB (#42796) 2024-05-17 00:44:10 +00:00
bryan
7ab065f2e3 Recents API Improvements (#42660)
* handle recent view for non-existant entity

* test that recent views works with missing entities

- just doesn't return them.

* dont count on there being entities in the app-db

* Query for the entity data upfront for recent-views

- Still need to check for the model_object due to popular-items calls

* cleanup, fix ellide logic

memoize get-parent-coll

* more cleanup

* rewire half of the queries

* rewrite the other queries, and improve docs

* align some queries

* lookup all entities ahead of time

- always return effective parent collections

* seperate n+1 tests

* use = instead of a set

* no need for a vector

* fixup simple table test

* go from effective-location-path to id instead of hydrating
2024-05-16 23:19:58 +00:00
Filipe Silva
b7253af4f2 Cloud Migration Feature (#41317)
* feat: cloud migration endpoints

* fix: don't leave open conn behind when checking migrations

`unrun-migrations` would open a new connection but not close it.
Since `with-liquibase` is happy enough using a data-source the fix is straightforward.

You can verify this by running the following code:

```
(comment
  (require '[metabase.cmd.dump-to-h2 :as dump-to-h2]
           '[metabase.analytics.prometheus :as prometheus])

  (defn dump []
    (-> (str "cloud_migration_dump_" (random-uuid) ".mv.db")
        io/file
        .getAbsolutePath
        dump-to-h2/dump-to-h2!))

  (defn busy-conns []
    (-> (prometheus/connection-pool-info)
        first
        second
        :numBusyConnections))

  ;; each dump leaves behind 1 busy conn

  (busy-conns)
  ;; => 0

  (dump)
  (busy-conns)
  ;; => 1

  (dump)
  (busy-conns)
  ;; => 2

  (dump)
  (busy-conns)
  ;; => 3

  )
```

* fix: flush h2 before returning from dump

* rfct: move code to models.cloud-migration

* test: add login while on read-only test

* fix: assorted cloud_migration fixes from review

* test: allow overriding uploaded dump

* fix: add UserParameterValue to read-only exceptions

Also make the list a little bit nicer.

* fix: only block dumped tables on read-only

* fix: recover on startup if read-only was left on

* feat: block migration when hosted already

* test: test settings for migration

* feat: cloud migration supports retries and multipart

* test: sane dev defaults for migration

* fix: upload 100% shouldn't be migration 100%

* chore: make up a new migration id after merge

* Cloud Migration FE (#42542)

* it's a start

* ui wip

* wip

* dynamic polling intervals, and custom modal for migrate confirmation modal

* cleans out most of the remainig UI TODOs

* adding progress component

* impls team feedback

* makes component more testable, starts some a unit test for the CloudPanel

* finish unit testing

* reverts api changes

* update progress styling

* fix type issues

* fix e2e failure, fix feature unit tests by holding last migration state in fetchMock if more requests than expected happen at the end of a test, remove white spacing change in clj file

* second pass at fixing tests

* fix copy from ready-only to read-only

* copy fix

* Update frontend/src/metabase/admin/settings/components/CloudPanel/MigrationError.tsx

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* Update frontend/src/metabase/admin/settings/components/CloudPanel/MigrationInProgress.tsx

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* adding e2e test

* pr feedback

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

---------

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-05-16 18:05:32 -05:00
Alexander Polyankin
606686c3c4 Use is-empty and not-empty for string columns in quick filter drill (#42804) 2024-05-16 22:51:38 +00:00
Ryan Laurie
4308410389 Basic Upsell System Setup + Hosting Upsell (#42785)
* Basic Upsell System Setup

* Hosting Upsell

* add upsell to updates page

* update utms

* update copy, utms and text
2024-05-16 16:12:28 -06:00
Raphael Krut-Landau
f225c92795 Allow license tokens that start with airgap_ (#42733)
Accept license tokens with an `airgap_` prefix, besides the already accepted 64-character long tokens.

This weakens the validation in the FE. Rigorous validation of tokens beginning with `airgap_` occurs in the BE. See this [Slack message](https://metaboat.slack.com/archives/C064EB1UE5P/p1715813885703249?thread_ts=1715813614.437989&cid=C064EB1UE5P).
2024-05-16 17:58:24 -04:00
Raphael Krut-Landau
430df7ee49 Browse-related heading changes (#42779)
Rename "Browse data" to "Browse databases"

Closes #42781
2024-05-16 17:56:46 -04:00
Aleksandr Lesnenko
8b9e15266a combo stacked chart (#42085)
* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* show show data values setting on normalized charts that have a line series

* fixes
2024-05-16 18:40:46 -03:00
adam-james
672fa62e47 Area Bar Combo Stacked Viz Settings Migration (#42740)
* Area Bar Combo Stacked Viz Settings Migration

Per: https://www.notion.so/metabase/Migration-spec-e2732e79215a4a5fa44debb272413db9

This addresses the necessary migrations for area/bar/combo stacked viz settings.

* Custom migration test works

* Check that non area/bar/combo charts also remove stack_display
2024-05-16 14:36:41 -07:00
Braden Shepherdson
d46c23fe55 [MBQL lib] Add canPreview and use it from the notebook (#42791)
* [MBQL lib] Add `canPreview` and use it from the notebook

* Fix previewQuery

* Apply can-preview across stages; add unit tests

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-16 21:27:36 +00:00
Jeff Bruemmer
02e42f32e3 49.11 to list of releases (#42794) 2024-05-16 16:30:59 -04:00
adam-james
2f30a47ffc Correct Data Shape for Multi-Series Static Viz (#42730)
* Correct Data Shape for Multi-Series Static Viz

Fixes: #41787

During the echarts migration, some backend tests needed fixing. In this process, the shape of data (eg. list of cards
and their data results from execution) were altered.

This was done to fix failing tests and renders for single series cards (all Questions and many dashcards), but didn't
correctly handle a multi-series card.

This conditionally adds back the expected shape.

Perhaps in a follow on PR it's worth inspecting the implementation of the :javascript_visualization render method to
clean it up. Probably worth putting some Malli schemas around it too to make it clearer what shape we need.

* Make sure card/data maps going into static-viz are distinct

* Add a test util to render dashcards, add multiseries card test

We haven't made a 'unit' (perhaps more like a small integration test at this point) test for multi series dashcards
yet.

In most other cases, making sure a card (Question) renders properly is sufficient, but the multi series dashcards are
a special case. It's probably useufl to have a test or two, and the dashcards test util should hopefully help future
test writing a bit now too.
2024-05-16 13:05:23 -07:00
Kamil Mielnik
cd007ba6ac Offset in custom expressions (#42751) 2024-05-16 19:23:16 +00:00
Aleksandr Lesnenko
361f568ee1 drop percy (#42303) 2024-05-16 13:37:29 -03:00
Nemanja Glumac
54d7a3b559 Remove the last traces of BuildJet from the CI (#42758) 2024-05-16 16:42:28 +02:00
Oisin Coveney
d58cb8a6cc Fix unmounted node error on ExplicitSize (#42766) 2024-05-16 14:15:04 +00:00
Alexander Polyankin
0147c695a7 Fix broken pivot table questions that had out of date viz settings (#42698) 2024-05-16 09:53:14 -04:00
Mahatthana (Kelvin) Nomsawadi
3dbeb3bfbd Automate releasing embedding SDK (#42516)
* WIP some workflows

* Add reminder todo comment

* Complete the workflow

* Fix YAML syntax error

* Trigger the workflow

* Fix resuable workflow

* Fix uberjar workflow

* Add missing steps before testing

* Pass recrets to resuable workflow, so it could run

* Fix sdk artifact location

* Remove unneeded output

* fetch tags, so it doesn't fail on push

* Only running EE uberjar in SDK workflow

Because OSS is never needed

* Fix incorrect syntax

* Shuffle workflow so it failed fast

* Fix syntax error

* Attempt to bulid only EE jar

* Fix the error handling step

* Fix failing to upload to s3

* Fix create a PR step

* Fix the last temporary command, so the build looks green

* Remove hack to trigger the workflow

* Remove completed todo comment

* Clean up S3 step

* Add todo comment

* Upload correct docker image name

* Bump the package version before building SDK

* Fix uploading the correct Metabase dev container name

* Fix one too many double quote

* Push the correct docker image

* Fix PR creation step

* Dry run publishing SDK

* Use a separate uberjar workflow for SDK

* Remove a bunch of unused steps

* Update variable names, step names

* Improve tag error message

* Correct m2-cache-key to be unique

* Fix the push tag failure step to only run when failed to push tag

* Fix changed artifact name

* Improve env name for clarity

* Fix extra trailing empty line

* Remove conditions from running certian steps

* Removing npm publish dry-run
2024-05-16 13:21:09 +00:00
Tim Macdonald
34900091e5 [ParseSQL] Find-and-replace for variables and field filters (#42703)
* Add a simple replace-names test

* Support find-and-replace in cards with variables and field filters

[Fixes #42580]

[Fixes #42581]

* Add models.card/replace-fields-and-tables!

* Docstring fix

* Little cleanup
2024-05-16 13:13:59 +01:00
Mahatthana (Kelvin) Nomsawadi
44cb385c40 Upgrade redshift dependency version (#42746) 2024-05-16 06:03:22 +00:00
Cal Herries
0843dafbd9 Realize DB transient rows in after-select hook before calling driver.u/features (#42744) 2024-05-16 04:07:33 +00:00
Luis Paolini
4a6dfe409b Bump SQL Server driver for v50 (#41021)
same compatibility of the previous one but this is compatible with JDK 21
https://learn.microsoft.com/en-us/sql/connect/jdbc/release-notes-for-the-jdbc-driver?view=sql-server-ver16

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-15 20:45:23 -03:00
Nick Fitzpatrick
62754d5b88 42701 search type ahead cp (#42716)
* respect search-typeahead-enabled

* updating unit test

* adding e2e test
2024-05-15 18:48:15 -03:00
Raphael Krut-Landau
95d5a829de Move createMockModelResult to browse folder (#42690)
* Move createMockModelResult to browse folder

* fix
2024-05-15 17:23:28 -04:00
Jeff Bruemmer
95db580178 docs - update appearance settings (#42388) 2024-05-15 17:09:19 -04:00
Jeff Bruemmer
7bdfafc822 docs - offset (#42484) 2024-05-15 17:08:54 -04:00
Nick Fitzpatrick
f37c417b89 replace search bar with command palette toggle (#42603)
* replace search bar with command palette toggle

* e2e test part one

* onboarding suite

* green e2e

* unit tests

* delete shame
2024-05-15 17:26:45 -03:00
Alex Yarosh
e8d6f86ccd [docs] Jessica's onboarding feedback (#42670)
* update collections

* feedback

* links

* Update docs/questions/native-editor/sql-parameters.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-15 19:28:31 +00:00
John Swanson
9aa572cbc1 remove TODOs from metabase.models.setting (#40020)
3 TODOs were removed here:

- "a way to SET Database-local values." More like TODONE :haaa:

- "we should probably also bind this [that is, *database-local-values*]
in sync contexts e.g. functions in [[metabase.sync]]" I think we don't
need to do this. The full set of maybe-database-local settings right now
is `aggregated-query-row-limit`, `unaggregated-query-row-limit`,
`database-enable-actions`, and `persist-models-enabled`. None of these
need to be set when `sync`ing. If at some point we do add a db-local
setting that should affect the way syncing works, we will need to do
this - but I don't think this TODO will help figure that out.

- "settings sent via an env var aren't returned for security purposes.
It is an open question whether we should obfuscate them and still show
the last two characters like we do for sensitive values that are set via
the UI." I think if it's been this way for 5 years, it no longer
qualifies as an "open question." We can reopen if down the road if this
is something we want.
2024-05-15 12:10:16 -07:00
adam-james
a52450c38a Pivot table exports (#41668)
* PoC Pivot table exporting.

Works so far!

This just hacks a couple things in. I added the :query via format_rows, which should instead have its own proper
middleware

Pivot export should probably not just be in the middleware namespace but in qp.pivot.

Should not break the streaming results writer for non-pivots... obviously this breaks ordinary results, so that needs
to be handled properly.

Better documentation about how the logic actually works. Pivot tables are hard to remember/easy to forget, so some
very clear diagrams/examples would probably be good.

* adjust csv export to export a pivot table when pivot options exist

* post processing of pivot table rows for card/dashcard downloads

* WIP on getting pivot exports to work with unsaved questions

* WIP getting pivot exports working on unsaved questions

The dataset POST /pivot endpoint is used to get the pivot data to the frontend, but also to get the pivot query.

The query that is returned by the POST comes from the json_query, which is populated by the userland-query stuff with
the last run query. The pivot qp runs mulitple queries and each query runs through the regular userland query qp, so
we'll 1. see lots of executions recorded and 2. end up with the wrong query in the POST return. It'll look mostly
correct, but due to how the pivot qp works won't necessarily have all of the fields.

That incorrect pivot query is passed to the /:export-format endpoint and we don't end up seeing correct results.

Since that json_query gets fed back to the backend when doing an export, we do need it to be correct, like the query
that was sent to /pivot in the first place.

Since this is a WIP, I've just passed the query as a string to :original-query in :info, and if that exists, use that
to fill the :json_query key.

Then, also add a :was-pivot flag so that the dataset download endpoint can look at it and use the pivot qp instead of
the regular qp. Even if we have the correct 'top level' query, we need to run it through the pivot qp to get the full,
correct pivoted results.

* Pivot Export Test

Here I've added a pivot export test that has various assertions trying to capture the correct output from the pivot
csv export.

I've done my best to explain the tests with comments, but have also left a (comment ) form with a function
`explore-pivot` to help *show* rather than tell what the expected pivot output should be.

I've created this new namespace to first capture this pivot export test with the intent to add tests that can improve
our confidence that ALL exports/downloads in ALL places behave as we expect in the future. It just seemed nice to
start fresh here with the pivot export test first.

* Don't need to make this public.

* Add lots of comments to hopefully make this a bit easier to follow

* Added an explore-raw-pivot fn in comment form

* Update test/metabase/api/downloads_exports_test.clj

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>

* begin addressing feedback

- finish an unfinished docstring
- merge info instead of assoc
- use a native query to build the pivot data instead of using a custom dataset, to keep test speed ok

* Create a new ns for the pivot post processing utils

Separate the post processing fns into their own namespace. This means I can easily add a test namespace for the post
processing specifically as well.

* Add pivot postprocessing test ns, not complete, but decent start

* fix mistake in endpoint. Only add original query to first pivot q

* Figured out how to keep the original query without storing as a string

* Perhaps this'll fix things properly?

---------

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-15 17:47:58 +00:00
Romeo Van Snick
3506941ec8 Design update for extract examples (#42399)
* Move the extract examples inline

* Use ui Button for ClickAction and render examples inline
2024-05-15 17:23:12 +00:00
Phoomparin Mano
c16ff2be32 Support basic theming in interactive data tables for embedding SDK (#42411)
* support theming in table

* theme injection with hoc

* reasonable default theme options

* customizable text color

* theming table header

* table theming

* change theme configuration order

* apply sorted cell color directly

* gutter background

* remove header theming for now

* fix: id column styling

* id column borders

* border color

* add cell hover color

* conditional hover color

* use brand color to accent

* add default theme values to unit test

* cell background should default to white

* update unit test

* remove unused properties

* remove duplicated color declaration as inner cell data styles it

* remove duplicate fallback

* remove unused use-embedding-theme hook

* use theme color from Mantine for css variables

* update defaults

* inject default component theme

* add notes on cell data theme

* update unit tests

* update unit tests

* remove no-op text-brand hover color

* remove no-op is sorted cell color
2024-05-16 00:13:03 +07:00
Raphael Krut-Landau
13bbb9d0c7 Add cache configuration form to dashboard sidebar (#42192) 2024-05-15 12:42:45 -04:00
Raphael Krut-Landau
413872d243 Don't explicitly set the dimensions of the verified model icon (#42702) 2024-05-15 12:40:44 -04:00
Raphael Krut-Landau
e23e654c65 Use new icon for verified models (#42689) 2024-05-15 09:23:26 -04:00
Nemanja Glumac
5333bd946a Require an explicit knob to allow uploading ReplayIO recordings (#42649)
* Explicitly decide whether to upload or not

* Upload in the main e2e workflow, but skip uploading in stress-test workflow

* Do not record runs in the stress-test workflow

* Add Replay API key

Even though we're not using it in this workflow. 🤷

* Omit env var from the stress-test workflow
2024-05-15 14:10:29 +02:00
Alexander Solovyov
5cfc079d1d json unfolding: parse incrementally instead of using cheshire (#42638)
this lowers memory usage 100x for 50kb strings (our limit before this change) and speeds up parsing by an order of magnitude.

For example, results for parsing 42kb string (already in memory):

Before: Time per call: 6.32 ms    Alloc per call: 8,732,850b
After:  Time per call: 55.16 us   Alloc per call: 83,254b
2024-05-15 13:08:32 +03:00
Romeo Van Snick
214a59894e Info icon design update (#42557)
* Render item icon inline with column icon

* Use inline info icon in field picker

* Use new QueryColumnInfoIcon on filter columns picker

* Use new QueryColumnInfoIcon on suggestions dropdown

* Use new QueryColumnInfoIcon aggregations dropdown

* Use new QueryColumnInfoIcon filter modal

* Use new QueryColumnInfoIcon in BreakoutColumnListItem

* Use new QueryColumnInfoIcon in FieldList

* Use new QueryColumnInfoIcon in DataSelectorFieldPicker

* Update TableInfoIcon to render fallback too

* Use new TableInfoIcon in DataSelector

* Use new TableInfoIcon in ViewHeader

* Fix types in breakout column

* Move aria-label to wrapper

* Move binning back to the right

* Always give info icon full opacity

* Remove asDot props everywhere
2024-05-15 08:48:18 +02:00
Uladzimir Havenchyk
90f7e62f58 Optimize getColumnCardinality by using cache correctly (#42664) 2024-05-15 06:01:06 +00:00
Ngoc Khuat
fe1f5950fb An one time job to init send-pulse trigger and migration down to clean up send-pulse triggers (#42316)
* Add a job to init send pulse trigger only once

* Send pulse triggers should respect report timezone (#42502)
2024-05-15 05:42:44 +00:00
Aleksandr Lesnenko
e9f3f490f5 fix static combo chart crashes when viz settings are invalid (#42669)
* fix static combo chart crashes when viz settings are invalid

* spec
2024-05-14 23:20:30 +00:00
Emmad Usmani
f401054091 remove percent change tooltip from waterfall chart (#42658) 2024-05-14 19:42:51 -03:00
Jeff Bruemmer
342ed573bb docs - view data and create queries (#42121) 2024-05-14 16:31:47 -04:00
Braden Shepherdson
a6039a0fcb [MBQL lib] Add native queries to the shared tests for all drills (#42478)
Follow up to #42424.

This enforces that all drills do not appear on native stages.
Also fixes one more drill on top of the two in #42424 that were wrongly
showing up for native queries.
2024-05-14 20:20:22 +00:00
Uladzimir Havenchyk
df92623dda Optimize isVisualizationClickable check in TableInteractive (#42639)
* Optimize isVisualizationClickable check in TableInteractive

* Destructure question

* Mode is nullable
2024-05-14 22:51:19 +03:00
Alexander Polyankin
1519acb6c9 Fix metadata loading issues after tabs (#42655) 2024-05-14 15:04:20 -04:00
Braden Shepherdson
50a03a1956 [Drivers] New features to replace hard-coded driver lists in tests (#42602)
- `:metadata/key-constraints` for those databases which formally track
  PK and FK key constraints. Some databases (eg. Presto/Athena/Starburst
  family) don't support constraints like that, but do support querying
  based on foreign keys (which is the `:foreign-keys` feature).
- `:connection/multiple-databases` for databases where a single
  connection can connect to many databases. This is the case for Athena,
  since it connects to an S3 bucket and exposes all files in the bucket
  as databases through that single connection.
- Also removed a troublesome "all DBs except a huge list" case in the
  SSH tunnel tests with a shorter list of supported drivers.
2024-05-14 13:06:35 -04:00
Anton Kulyk
706a553550 Use icons for "Line style" viz settings (#42637)
* Add icons

* Use icons
2024-05-14 18:01:11 +01:00
Nemanja Glumac
f4c7b9f0fc Fix broken metric revision API call (#42634)
* Fix broken metric revision API call

Fixes #42633

* Add E2E repro for #42633

* Fix metrics revision history in the data reference

* Add repro for #42633 for the reference page

* Consolidate tests

* Do not use hard coded id

* Fix lint errors
2024-05-14 16:27:20 +00:00
Ryan Laurie
5437e3d34d Disable Error Diagnostic Modal In Embedding (#42641)
* Disable Error Diagnostic Modal In Embedding

* add e2e test for diagnostic modal
2024-05-14 09:36:16 -06:00
bryan
60888cc593 handle RecentViews for non-existant entites (#42643)
* handle recent view for non-existant entity

* test that recent views works with missing entities

- just doesn't return them.

* dont count on there being entities in the app-db
2024-05-14 15:32:37 +00:00
Ryan Laurie
52d32c15e0 Recents Picker Tab (#42079)
* add recents tab

type updates

fix unit test

change where we filter recents

WIP Recents Tab

wip recents

design updates

update recents design to match search

use new recents format

initial recents implementation

fix types

* fix e2e tests

* update more e2e tests

* allow recents filters

* update test mocks

* add unit tests for recents tab

* update e2e tests

* add e2e tests for recents picker tab

* fix lost access test
2024-05-14 09:19:28 -06:00
Nemanja Glumac
47b3f17292 Remove unused @visx libraries (#42624)
* Remove `@visx/event`

* Remove `@visx/legend`

* Remove `@visx/responsive`

* Remove `@visx/mock-data`

* Remove `@visx/tooltip`
2024-05-14 16:15:38 +02:00
Ngoc Khuat
b6b67a6158 Delete pulses when archive dashboard (#42558) 2024-05-14 14:09:51 +00:00
Ngoc Khuat
11c985398d Fix migration fail with encryption key (#42617) 2024-05-14 21:09:15 +07:00
Raphael Krut-Landau
8b6e0bf15f Fix column widths in Browse models (#42601) 2024-05-14 09:40:51 -04:00
Chris Truter
c594662969 Fix reflection on newer JVM versions (#42630) 2024-05-14 10:05:08 +00:00
Nemanja Glumac
f52e02ff58 Remove unused SettingsBatchForm component (#42627)
* Remove unused `SettingsBatchForm` component

* Remove `react-collapse` and its types
2024-05-14 09:05:17 +00:00
Nemanja Glumac
1a44a83c3a Allow multiple values for string operators in the dashboard (#42013)
* Expand the single or multi-selectable string filter choices

* Mark operators as `multi`

* Wrap an existing test in a separate `describe` block

* Test multiple values settings

* Expand repro to include multiple dashboard filter values

* Ease the load by limiting the card results

* Switch to the more flexible data structure for the dashboard filters

* Expand the assertions

* Fix typo

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-14 10:46:44 +02:00
Romeo Van Snick
50e64abfac Prevent the suggestion popover from flipping to the top (#42625) 2024-05-14 10:35:23 +02:00
Uladzimir Havenchyk
2555eebaa7 Avoid unnecessary re-renderings in column settings sidebar (#42595) 2024-05-14 11:22:44 +03:00
Nemanja Glumac
1d1bcdff9f Remove number-to-locale-string (#42590) 2024-05-14 06:53:41 +02:00
Aleksandr Lesnenko
0ecb5b085c allow description columns to be dimensions of charts (#42539) 2024-05-14 03:12:50 +00:00
Emmad Usmani
47148ce79b add + symbol to percent change tooltip (#42614) 2024-05-13 23:29:45 -03:00
Emmad Usmani
090222677a refactor legend components to use items prop (#42417)
* refactor legend components to use items prop

* update RowChart

* add types

* add key to type

* fix type errors

* fix legend.unit.spec.ts
2024-05-14 01:35:58 +00:00
bryan
2b91354fd4 New Recents API Format (#42239)
* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* ellide inactive tables

* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* New Recents + Popular API Format - Frontend (#42305)

* fix tests

* new API payload format for recents and populars

* update url generation

* update recents components

* update tests

* only show 5 recents in command palette

* remove unused types

* update tests

* obey the linter

* type updates

* fix unit test

* change where we filter recents

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>

* fix modelToUrl types

* respond to review comments

* post merge test fix

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-13 22:55:58 +00:00
Raphael Krut-Landau
cc0a4231f4 Ellipsify descriptions properly in Browse models (#42456)
* Ellipsify descriptions properly in Browse models

* Simplify
2024-05-13 20:47:44 +00:00
Jeff Bruemmer
e6213e4b45 add 49.10 (#42599) 2024-05-13 20:26:31 +00:00
adam-james
127a62f640 Don't use the slugify util for filenames (#42475)
* Don't use the slugify util for filenames

* Fix tests that looked for incorrect filenames

* add a test

* fix filename in pulse test util
2024-05-13 13:21:22 -07:00
Noah Moss
9d968d9eef SCIM-scoped API key (#42086) 2024-05-13 15:49:30 +00:00
Nemanja Glumac
dcc5587ff7 Remove classlist-polyfill (#42588) 2024-05-13 15:44:07 +00:00
Ngoc Khuat
35a487d367 Static viz get background color thread safe (#42548) 2024-05-13 22:17:44 +07:00
Nemanja Glumac
3820cf05f0 Remove color-harmony (#42577) 2024-05-13 15:05:13 +00:00
Uladzimir Havenchyk
1fe63c52bf Partially fix columns and viz settings mismatch (#42344)
From now we allow mismatch between `base-type` if we need to match columns and columnSettings
2024-05-13 14:35:14 +00:00
Romeo Van Snick
9665e569f1 Combine/extract shortcuts snowplow events (#42445)
* Copy question event to new version

* Add new events for adding column via plus modal

* Add plus modal variants

* Track combine column via plus header

* Track extract column via plus header

* Add test for combine question event

* Add e2e test for extract column shortcut snowplow events
2024-05-13 15:52:54 +02:00
Romeo Van Snick
e3dffcc497 Combine column shortcut (#42442)
* Add index file to CombineColumns

* Add CombinColumnAction

* Add CombinColumnsAction to default and embedding modes

* Fix outdated --color-brand references

* Set up sequenced close handler in combine columns

* Allow outside clicks to happen when popover is not open

* Add e2e test for combine column shortcut

* Remove unused prop

* Rename file to match component name: CombineColumnsAction

* Simplify test assertion

* Set width on combine columns action

* Remove superflouous ? check
2024-05-13 14:16:05 +02:00
Kamil Mielnik
f596f0b00f Cover Offset() in aggregations with e2e tests (#42455)
* Add repro for 32323

* Fix offset not working in case

* Make offset function return any

* Add a repro for #42377

* Fix order of adjustments

* Revert unrelated changes

* Remove commented code

* Revert unrelated changes

* Refactor test

* Type offset aggregation

* Add a test for no order by or breakout clause

* Add a basic test for breakout clause

* Fix assertion

* Remove problematic dependency

* Fix uuids generation

* Remove redundant limit

* Add a test for multiple breakouts

* Update test names

* Extract OFFSET_SUM_TOTAL_AGGREGATION

* Add a repro for metabase#42509

* Add a test for multiple aggregations and breakouts

* Remove unused intercept

* Move uuid utils to separate file
- it wasn't possible to import the utils file in e2e tests without it

* Make isUuid a type guard

* Add tests for sorting

* Tag the test

* Add extra assertion to verify expression parsing

* Add a complex scenario

* Reverse isFirst logic
2024-05-13 11:04:20 +00:00
Nemanja Glumac
38d540a91f Remove code related to GoogleAnalytics tracking (#42556) 2024-05-13 12:01:41 +02:00
Ngoc Khuat
77fccd8b63 Quartz: auto delete jobs without a class during scheduler initialization (#42383) 2024-05-13 16:07:48 +07:00
Phoomparin Mano
e8dc5ec5a6 Migrate smart scalar and night mode to support Mantine theming (#42347)
* migrate smart scalar to css modules

* lighten theme color

* adjust margin

* map space 1 to xs

* use c prop instead of color

* use rem unit

* use rem unit

* add y margin

* return null when no children

* comment on text variation

* cleanup unused components and add dark mode todo

* remove todo comment

* support night mode in embedding

* lift dashboard theme to redux

* make theme non-nullable with default

* use component prop instead of title tag

* optional display theme

* restore tooltip state

* add default mock state

* remove theme from embed

* replace handleActions with createReducer
2024-05-13 08:57:16 +00:00
Nemanja Glumac
f8474255e8 Upgrade Cypress to v13.9.0 (#42507)
* Upgrade Cypress to `v13.9.0`

* Upgrade `@replayio/cypress` to `v2.1.0`

* Upgrade `cypress-real-events` to `v1.12.0`

* Upgrade `esbuild` to `v0.21.1`
2024-05-13 09:55:04 +02:00
Nicolò Pretto
84519c835b remove google analytics (#42515) 2024-05-13 09:44:35 +02:00
Phoomparin Mano
6cc0f2bc9c bump to 0.1.3 (#42519) 2024-05-13 07:18:35 +00:00
Romeo Van Snick
eca348eab9 Extract column shortcut (#42261)
* Render plus button in interactive table header

* Add columnShortcuts on ClickObject

* Dispatch click action for columnShortcuts on plus button

* Make onCancel an optional prop

* Add ExtractColumn action

* Add ExtractColumn action to Default and Embedding mode

* Use arrow_split icon for extract column action

* Add title to extract column popover

* Add e2e test for Extract column shortcut

* Use asReturned in extract column

* Rename to Extract part of column

* Add a custom title to the new column shortcut

* Add onClose to ExtractColumn popover

* Hide shortcuts icon when question is not editable

* Fix null error

* Do not use submodules in import

* Scroll more in test
2024-05-13 08:26:52 +02:00
adam-james
932781aa95 Format Rows toggle also applies to Column Names (#42543)
* Format Rows toggle also applies to Column Names

Fixes: #42500
When format-rows is false, we want to also pass that true/false value to the title column formatting.

That is, if a column is renamed and formatting is applied, we want to use that column's name. But, if a column is
renamed and the user exports unformatted csv or json, the custom column name should NOT be used, as was the behaviour
in prior versions.

* write a better test explanation
2024-05-10 23:39:04 +00:00
Jesse Devaney
f1e110856c Fix pie chart display when switching from notebook editor (#42430)
* fix pie chart display when switching from notebook editor

* remove hack

* fix missing pie chart display

* fix missing pie chart display

* address feedback

* fix type error
2024-05-10 21:56:05 +00:00
Emmad Usmani
562defa9a9 remove unused viz series utils (#42422) 2024-05-10 17:09:13 -04:00
Ryan Laurie
f6522a5d45 Fix disabled state for bulk actions buttons (#42533) 2024-05-10 21:07:37 +00:00
Raphael Krut-Landau
17852e5fa3 [Browse] Improve model sorting (#42493)
Ensures that models are sorted as follows in Browse models:

* Models are sorted by collection, by default
* When models are sorted by collection, they are secondarily sorted by name (so that models with the same collection path appear in alphabetic order)
2024-05-10 14:46:28 -04:00
Aleksandr Lesnenko
e308d73cac use echarts tree shaking api (#42520)
* use echarts tree shaking api

* fix specs

* update types

* move echarts module registration back to individual components

* Transpile echarts in jest

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
2024-05-10 15:40:04 -03:00
Braden Shepherdson
a785b1685b [QP] Handle variadic :contains etc. in dashboard filters (#42404)
These params were failing to match. This matches them up and puts the
options in the correct place. (`[:contains x y opts]` but `[:contains opts x y z]`).
2024-05-10 10:50:29 -07:00
Emmad Usmani
8e17e13e8a fix percent change across daylight savings (#42482)
* fix percent change across DST

* add e2e tests
2024-05-10 10:44:07 -07:00
Alex Yarosh
6d6555462e add 48.13 (#42522) 2024-05-10 13:42:14 -04:00
Alex Yarosh
7ed624b9a9 [docs] Serialization docs update (#42439)
* serialization update

* anchor links

* more anchor links

* correct curl call

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* review feedback

* links

* Update docs/installation-and-operation/serialization.md

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-10 18:56:37 +02:00
Ngoc Khuat
e8201e38b7 Thread safe static viz (#42494) 2024-05-10 16:22:09 +00:00
Cam Saul
59e7b3d1cb metabase.xrays API namespace (#42491)
* Remove unused `metabase.api.transform`

* Copy the deps graph improvements from my other PR

* New combined X-Rays API namespace

* Fix kondo error
2024-05-10 09:13:59 -07:00
Raphael Krut-Landau
c68b889d29 Fix drill FK test flake by removing unneeded wait for /api/dataset (#42501) 2024-05-10 12:12:51 -04:00
Alex Yarosh
3ef530dbf3 [docs] Clarify how optional SQL vars work (#42490)
* how optional clauses work

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-10 16:06:28 +00:00
Raphael Krut-Landau
aec41f458b squash (#42111) 2024-05-10 12:03:28 -04:00
Emmad Usmani
4036d86ad2 fix pie chart tooltip (#42465)
* fix pie chart tooltip

* add unit test
2024-05-10 16:01:34 +00:00
Raphael Krut-Landau
1175ee6ef9 Put bulk actions above popovers in collections (#42512)
* q

* Restore margin-left adjustment
2024-05-10 11:57:28 -04:00
Cal Herries
ef15d0e32b Allow drivers to not automatically add a PK column for CSV uploads (50) (#42466) 2024-05-10 15:08:10 +00:00
Alex Yarosh
52ee28578f add bq troubleshooting to the guide (#42492) 2024-05-10 08:27:35 -06:00
Alexander Solovyov
7e90c2ddca [serdes] handle circular dependencies in dashboards (#42267) 2024-05-10 16:49:02 +03:00
Kamil Mielnik
3e9f4ac515 Fix - diagnose-expression throws when Offset is nested (#42497)
* Fix offset not working in case

* Make offset function return any

* Add a repro for #42377

* Fix order of adjustments

* Revert unrelated changes

* Remove commented code

* Revert unrelated changes
2024-05-10 20:39:09 +07:00
Nemanja Glumac
a522cd88c0 Remove unused exportCardQuery endpoint definition from DashboardApi (#42499) 2024-05-10 12:14:25 +00:00
Phoomparin Mano
82e41b7652 Update embedding SDK readme to remove height CSS workaround (#42453)
* update readme as height is now optional

* remove other wrapper
2024-05-10 18:05:06 +07:00
Mahatthana (Kelvin) Nomsawadi
b4ed5a3bf7 Fix SDK interactive question showing no question error incorrectly (#42400)
* Fix loading showing when it's not supposed to

* Add unit test

* Review: Improve code clarity
2024-05-10 07:52:28 +01:00
Raphael Krut-Landau
521fe4d929 Tweak the Model explanation banner (#42413) 2024-05-10 04:11:56 +00:00
Ngoc Khuat
2e5847f44a Prioritize sending fast pulses (#42331) 2024-05-10 01:45:18 +00:00
Alex Yarosh
54d9ae7555 [docs] see publicly shared content (#42488)
* see shared content

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-09 21:25:35 +00:00
Alex Yarosh
c5033b8c20 fix format (#42485) 2024-05-09 14:54:59 -06:00
Cam Saul
5fcceaad01 metabase.metabot API namespace (#42468)
* Squashed commit

* Update config

* Backport the kondo ignore stuff from other PR.

* Metabot API namespace
2024-05-09 22:13:27 +02:00
Alex Yarosh
1bce4cb647 add 49.9 (#42481) 2024-05-09 14:12:33 -06:00
Braden Shepherdson
6eb213461c [QP] Fix error with :!= "Is Not" filter on expression (#42461) 2024-05-09 18:43:17 +00:00
Uladzimir Havenchyk
6864bc7e1a Disable cypress log to bypass out of memory issue (#41472) 2024-05-09 12:31:30 -06:00
Cam Saul
6799062a1b Enumerate the current state of the world with regards to module namespaces (#42437)
* Squashed commit

* Update config

* Backport the kondo ignore stuff from other PR.
2024-05-09 17:45:42 +00:00
Braden Shepherdson
0dbe2761f2 [Drills] Only show "Extract" and "Combine" actions on MBQL stages (#42424)
They don't work correctly on a native stage.
2024-05-09 13:03:16 -04:00
Tim Macdonald
2bac5512d4 Use official version of Marginalia (#42204)
For Reasons™ we had been using my fork, but now that I've taken over the
project the officially-deployed version does what we need.
2024-05-09 16:40:46 +01:00
Oisin Coveney
4fe8e0466c Convert PublicDashboard to TS (#41972)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-05-09 18:36:03 +03:00
Ryan Laurie
06cd458d43 Allow Admins to clean up uploaded tables in bulk (#42183)
* add upload management API

* add upload management interface

* remove trailing slash

* add e2e upload management test

* add upload management to token_features

* jsdoc cleanup

* fixes tests

- include :upload_management in session_test
- fix list-url in upload management
- ensure local tests have upload management disabled
  (causes tests locally to 422 instead of 402: it has sufficient
  permissions from a local token to try to delete the table but the
  table is not an upload table, so you get a 422)

* add card archive param

* update tests

* use common component

* add success/error toasts

* test success/error notifications

* update e2e tests

* address review comments

* make sure we have fresh data

---------

Co-authored-by: dan sutton <dan@dpsutton.com>
2024-05-09 15:27:46 +00:00
Raphael Krut-Landau
e9b43787a1 Make Browse models table sortable (#42113)
* squash

* Reset change

* Fix name column width
2024-05-09 11:04:13 -04:00
Mahatthana (Kelvin) Nomsawadi
14d6cc9ad3 Fix not allow using both react 17 and 18 in the SDK (#42457)
* Fix not allow using both react 17 and 18 in the SDK

* Review: Fix not including React 17 🤦
2024-05-09 15:44:34 +01:00
Raphael Krut-Landau
962c32a36b Remove dead API keys code (#42418) 2024-05-09 14:41:25 +00:00
Jacob Joseph
c380a5a323 [docs] Update environment-variables.md: fix typo re: MB_JETTY_SKIP_SNI (#42432) 2024-05-09 08:58:09 -04:00
Kamil Mielnik
6c9099bfd5 Fix flaky question management e2e test (#42444)
* Fix flaky question management test

* Update assertions order to reduce probability of a flake

* Use explicit assertions

* Change assertion order

* Decrease flakiness
2024-05-09 12:02:25 +00:00
Ryan Laurie
7ce866130e Remove Dead Pickers (#41801)
* update e2e tests

* rework linked entity picker

* remove deprecated pickers

* remove dead picker code

* another one bites the dust

* remove create collection on the go

* update linkedEntityPicker unit tests-

* update timeline move modal

* remove unused import
2024-05-09 05:49:16 -06:00
Mahatthana (Kelvin) Nomsawadi
ee936cbb55 Fix axios security issue by updating the upstream library version (#42448) 2024-05-09 11:44:04 +00:00
Ngoc Khuat
958cceb377 Fix mysql with multiple most recent revision (#42285) 2024-05-09 11:26:44 +00:00
Nemanja Glumac
2b9e81671f Consolidate engine utilities (#42211)
* Remove unused functions

* Remove `export` from a local function

* Remove googleanalytics related engine code

* Use `getEngines` selector instead of the deprecated Metabase `Settings`

* Use `getDefaultEngineKey`

* Use `formatSQL` function locally

* Remove unused `getEngineLogo` function

* Convert to TS

* Remove unused export

* Fix types

* Expand test coverage

* Update type

* Remove `googleanalitics` from an assertion

* Address review comment

* Expand types

* Add tests for `isDeprecatedEngine`

* Expand tests
2024-05-09 11:16:22 +02:00
Romeo Van Snick
3a33bbacfd Use the correct icon for the extract column shortcut (#42415) 2024-05-09 10:54:16 +02:00
Cam Saul
252c942335 Add metabase.actions.core module API namespace (#42433) 2024-05-09 10:09:20 +03:00
Ngoc Khuat
11594d8cef fix malli error in defendpoint (#42089)
* fix malli error in defendpoint

* fix a couple more error print-outs

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
2024-05-09 05:10:14 +00:00
Aleksandr Lesnenko
3bfd11f1ba allow using urls from other columns in link templates (#42438) 2024-05-09 01:50:29 +00:00
Ryan Laurie
0c1a1f50f8 Remove Extraneous Style Props (#42431)
* remove in modeluploadmodal

* remove unnecessary padding from new collection dialog
2024-05-08 17:39:38 -06:00
Ryan Laurie
1c5e5998bb Dashboard Picker (#41559)
* wip dashboard picker

* use in homepage selector

* remove dead code

* remove generateKey prop

* add unit tests

* cleanup

* WIP unit tests

* update personal/public interactions and tests

* update e2e tests

* allow disabling items in dashboardPicker

* add new dashboard tag invalidation

* use rtk in dashboardpicker

* use collection_id from api

* horrendous way of disabling read only items

* remove badness

* disallow selecting read-only dashboards in dashboard picker search

* pass search filter as prop

* update types and tests

* update types and tests

* address review comments
2024-05-08 17:39:12 -06:00
bryan
0468c9a7f5 adds the new watch alias, which reloads BE on file changes (#42371)
* adds watch alias, which reloads BE on file changes

* watch dev, src, test + every path in `:extra-paths`
2024-05-08 16:53:26 -06:00
Raphael Krut-Landau
54c1e07613 Add table of models to the "Browse models" page (#41954) 2024-05-08 18:08:54 -04:00
bryan
6ca8393fcb convert SocketChannelEndpoint to SocketChannel (#42419)
* convert `SocketChannelEndpoint` to `SocketChannel`

* Remove fatal logging (used for debugging)

* check for nil channel + log on unknown type

* only log unexpected transport types once
2024-05-08 20:52:44 +00:00
Ryan Laurie
3d1265641e Fix another flaky question picker unit test (#42421) 2024-05-08 20:18:26 +00:00
Cam Saul
1e9e60a0fb Cam's module linter 5000 (#42250)
* Cam's module linter 5000

* Get Kondo passing

* Revert changes to usage of mdb.setup/setup-db!

* Check ns shapes

* Add ns :require shape linter; PR feedback

* Linter fixes 🔧
2024-05-08 20:16:40 +00:00
Noah Moss
f418e685fc Allow disabling health check logging via env var (#42357) 2024-05-08 20:14:17 +00:00
Phoomparin Mano
1f416069d0 Reserve component height with defaults from visualization type in embedded questions (#42212)
* prop to reserve height and use full height by default

* require height to be passed

* add default height based on viz type

* default to 250px

* reserve table height

* remove memoization

* rely on the card size defaults constant

* multiply by a fixed constant

* correct vis to viz
2024-05-08 18:18:58 +00:00
adam-james
2455537bc1 Dashboard Param Values Common Impl for Embedding/Preview Embedding (#42052)
* Dashboard Param Values Common Impl for Embedding/Preview Embedding

Refactor the embedding api namespace to allow a bit of reuse between the embedding api and the embedding preview
api. In some cases, the implementations are not identical (in terms of the shape of data expected/endpoints
available), so this is a first step to making them the same.

Related:

https://www.notion.so/metabase/Make-embedding-preview-behave-consistently-with-actual-static-embeds-855353d8e5e8411d8164c7ac563c7d2f

* Add a test to verify that preview-embed param-values endpoint works

* Use preview embed endpoint and fix relevant tests

* Add tests

* Change name to reflect what actually happens in the function

---------

Co-authored-by: Mahatthana Nomsawadi <mahatthana.n@gmail.com>
2024-05-08 17:54:17 +00:00
Ryan Laurie
0bcba904e3 Fix flaky frontend question unit test (#42412) 2024-05-08 17:46:56 +00:00
Raphael Krut-Landau
b0bc469dfe Port CollapseSection to ts (#42333)
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-08 11:36:51 -04:00
Mahatthana (Kelvin) Nomsawadi
e678ed6de0 Support custom font in SDK (#42342)
* Support custom font in SDK

* Update component after merging master
2024-05-08 16:31:14 +01:00
Nicolò Pretto
1a7879031d attempt to type the return value of actions created by createThunkAction (#42328)
* attempt to type the return value of actions created by createThunkAction

* use built in Awaited instead of custom AwaitedIfPromise
2024-05-08 16:44:51 +02:00
Jeff Bruemmer
0d4043fb32 docs - fix broken link (#42391) 2024-05-08 10:39:53 -04:00
Uladzimir Havenchyk
6704d9e70a Fix overflow problem in Filter Modal sidebar (#42386) 2024-05-08 17:32:04 +03:00
Uladzimir Havenchyk
09cc197a0b Do not allow cy.pause() to go into commit (#42387) 2024-05-08 17:28:46 +03:00
Phoomparin Mano
c1862e9325 Option to customize base font size in React embedding (#42322)
* allow customizable base font size

* pass in fontSize in mantine theme

* only apply font size if it exists
2024-05-08 21:18:29 +07:00
dpsutton
5d0ad01a36 bump methodical (#42361)
now:

```clojure
❯ clj -M:"$ALIASES"
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
2024-05-07 19:55:25,167 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
```

no logs about recur targets unboxing
2024-05-08 08:26:28 -05:00
Nemanja Glumac
a91f3c0490 Remove unused useNativeQuery util (#42384) 2024-05-08 12:36:54 +00:00
Abed Habli
ca280a8f8b [docs] Updating table settings (#42324)
* updating the first section

* updating the column header formatting screenshot

* Typo

* Update docs/questions/sharing/visualizations/table.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* 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-05-08 13:09:30 +02:00
Chris Truter
8509a8d6a0 Remove trailing slash from API route (#42320) 2024-05-08 11:52:44 +01:00
Cal Herries
07a22a8818 Increment view_count on card and dashboard views (#41882) 2024-05-08 09:56:31 +00:00
Mahatthana (Kelvin) Nomsawadi
4f25760eab Simplify code (#42374) 2024-05-08 10:17:15 +01:00
Mahatthana (Kelvin) Nomsawadi
ad9db46b10 Bump published SDK version (#42340) 2024-05-08 08:55:13 +01:00
Ngoc Khuat
faa0eebd8d Fix failed to upgrade when instances have obsolete 3rd party drivers (#42369) 2024-05-08 14:30:23 +07:00
Nemanja Glumac
f6493678db Allow multiple values for string operators in the query builder (#42101) 2024-05-08 09:07:55 +02:00
Alexander Solovyov
7f5a5d8abb Backfill QueryField on Metabase startup (#42279) 2024-05-08 09:51:24 +03:00
Cam Saul
53ee757545 Don't optimize temporal filters with unbucketed exprs against relative datetimes (#42310)
* Don't optimize [:between <expr w/ :default bucketing> <relative-datetime> ...] filters

* Update tests 🔧
2024-05-07 20:09:48 +00:00
Cam Saul
5406087e5f Support Offset() as an expression with no breakouts [backend] (#42132)
* Only nest expressions referenced in breakouts or aggregations

* Support Offset() as expression with no breakouts

* Test fixes 🔧

* Oracle test update

* Improved Oracle test

* Test update 🔧

* Fix busted test

* Fix running and saving Offset over the REST API

* Remove stray :wow

* More test fixes 🔧
2024-05-07 20:05:27 +00:00
Ryan Laurie
2c1decae01 Make Z-indexes a bit more sane (#42272)
* Add back entity picker search item tooltip

This reverts commit 7fbf839e41.

* make z-indexes a bit more sane

* fix rebase
2024-05-07 13:53:09 -06:00
Cam Saul
b67ca77bdb Only nest expressions referenced in breakouts or aggregations (#42302)
* Only nest expressions referenced in breakouts or aggregations

* Test fixes 🔧

* Oracle test update

* Improved Oracle test
2024-05-07 15:04:31 -04:00
Romeo Van Snick
7249b7df31 Allow duplicate "combine column" columns in chill mode (#42314)
* Add suffix to name if column already exists

* Add test for duplicate combine columns

* Use direct question in test

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Fix formatting

* Use createQuestion for other tests too

* Fix table references

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-07 18:00:32 +02:00
Nick Fitzpatrick
1488757b85 41901 command palette search view all (#42179)
* initial attempt

* search button

* small adjustments

* adding back the search bar

* adding an extra check in e2e

* i18n adjustment

* impls pr feedback

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-05-07 10:51:07 -05:00
dpsutton
64ac0d76ef Silence abs warning on startup (#42311)
before:

```clojure
❯ clj -M:"$ALIASES"
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.algo.generic.math-functions, being replaced by: #'clojure.algo.generic.math-functions/abs
2024-05-07 04:39:37,890 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
```

after:

```clojure
❯ clj -M:"$ALIASES"
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
2024-05-07 04:40:42,561 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
```

Now no warning about `abs`
2024-05-07 10:21:16 -05:00
Mahatthana (Kelvin) Nomsawadi
7277c0c1a6 Fix Embedding SDK calling admin endpoint (#42327) 2024-05-07 16:04:00 +01:00
Aleksandr Lesnenko
6e71432b7a add chart logging own env var (#42334) 2024-05-07 14:53:21 +00:00
Mahatthana (Kelvin) Nomsawadi
4443033cef Update the README to document some SDK quirks (#42332)
* Update the README to document some SDK quirks

* Address review
2024-05-07 15:24:02 +01:00
Kamil Mielnik
18313cd703 Remove snippets from search types (#42315)
* Remove snippets in search models
- They're not supported, see model-to-db-model in search/config.clj

* Fix TS error

* Fix TS error
2024-05-07 19:50:30 +07:00
Ngoc Khuat
bb8f00bda1 fix sync dynamic table (#42312) 2024-05-07 19:17:23 +07:00
Romeo Van Snick
e2c219b0f9 Fix combine extract column drill icons (#42297)
* Use extract column icon for column extraction drill thru

* Use combine column icon for column combine drill thru
2024-05-07 10:47:39 +02:00
Ngoc Khuat
96984ed0ab Send pulses in parallel (#41772) 2024-05-07 07:30:02 +00:00
Tim Macdonald
a2282dfb2f Remove unusued code paths for automagic filtering (#42098)
* Remove unusued code paths for automagic filtering

All the way from 2018!

* Use pre-computed value
2024-05-07 14:26:57 +07:00
Ryan Laurie
2205ece6cb Basic Table Component (+ use it for API Keys) (#42287)
* add basic table component

* use basic table in api keys UI

* tweak padding

* replace test id

* update e2e test ids
2024-05-06 17:58:08 -06:00
Aleksandr Lesnenko
41bf0f9639 fix tooltip shows data for different X value (#42299) 2024-05-06 23:48:08 +00:00
Ryan Laurie
0f8beaf4a4 Entity picker/new search item component (#42009)
* add new entity picker result item

* simplify types

* enterprise icon fixes

* unit test fixes

* design updates

* address PR comments

* remove poorly implemented tooltip

* fix unit test

* simplify spinner situation
2024-05-06 16:50:29 -06:00
Ryan Laurie
a3b1d79580 Make bulk action bar reusable (#42296)
* Make bulk action bar reusable

* unify bulk action usage

* skip obsolete test
2024-05-06 15:53:25 -06:00
Aleksandr Lesnenko
bd96fa2566 Fix x-axis time series interval computation when x-values include nulls (#42292)
* add chart model logging

* fix x-axis time series interval computation when x-values include nulls
2024-05-06 19:23:56 +00:00
bryan
013a6c512a new version fixes saml20 issues (#42286) 2024-05-06 13:22:41 -06:00
bryan
f80ae194bf adds diagnostic info to troubleshooting (#42283) 2024-05-06 13:18:16 -06:00
Uladzimir Havenchyk
1ff80213fe Improve types for ParameterSettings (#42269) 2024-05-06 21:48:45 +03:00
Emmad Usmani
9a2fa4a8dd add percent change to timeseries tooltip (#42059)
* add percent change to timeseries tooltip

* move computeChange to lib/numeric

* cleaning up code in numeric.js

* color text

* add unit to key

* move change to tooltip footer

* fix extra bottom spacing

* remove color

* handle gaps in data

* clean up code

* add change to funnel tooltip

* move retained to footer in funnel

* update copy

* remove min decimal count

* rename events.tsx -> events.ts

* add test cases to line-bar-tooltips.cy.spec.js

* add specs for edge cases

* readd exports to fix numeric.unit.spec.js

* don't show for change for scatterplot

* translate retained

* use parseTimestamp instead of String

* handle quarter interval

* remove redundant dayjs calls

* handle quarter with Feburary correctly
2024-05-06 18:48:07 +00:00
John Swanson
1a5d9e82fc Add can_write to cards/dashboards in Search (#42276) 2024-05-06 11:22:52 -07:00
Jeff Bruemmer
2efdee2485 docs - field type metadata (#41223) 2024-05-06 14:10:41 -04:00
Alexander Polyankin
649de4ffde Fix wrapping in QueryColumnPicker (#42246) 2024-05-06 08:32:26 -04:00
Abed Habli
9c058c64aa Added Key Authentication Option to SSH Tunneling Docs (#42206)
* Update ssh-tunnel.md

Add SSH key authentication option to SSH tunneling docs

* Update docs/databases/ssh-tunnel.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Update docs/databases/ssh-tunnel.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Update docs/databases/ssh-tunnel.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-06 14:05:57 +02:00
Cal Herries
03381ef359 Use database-supports? instead of hard-coded driver in dataset-with-custom-pk-test (#42224) 2024-05-06 09:04:54 +01:00
lbrdnk
baa9b81bd7 Add new Druid JDBC driver (#40293) 2024-05-05 16:01:53 +02:00
bryan
47eae5a505 fix a regex validation (#42251) 2024-05-04 02:44:00 +00:00
John Swanson
60657636f0 Add can_write to /collection/:id/items (#42184)
For dashboards and cards/models only.
2024-05-03 20:50:24 +00:00
Vamsi Peri
e1469c74e1 Update feature_request.md (#42232)
Remove the language for how important is this feature to you
2024-05-03 14:10:22 -04:00
Uladzimir Havenchyk
395c89846f Adjust styles of the single active tab in parameter sidebar (#42209) 2024-05-03 20:51:26 +03:00
Jeff Bruemmer
30416f6861 docs - update filter docs (#42169) 2024-05-03 13:43:20 -04:00
Alex Yarosh
ccc9fe647d [docs] A bit more details about API (#42137)
* api details

* 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-05-03 17:30:21 +00:00
Phoomparin Mano
8e96f386fa Define public metabase theme and Mantine transformer for embedding SDK (#42207)
* public metabase theme type

* add tests for transforming embedding theme

* export public types

* load transformed theme override into theme provider

* migrate font family inside theme configuration

* add assertion for font family

* update README to add font family in theme options

* add font enum, fix tuple type and cleanup tests

* color tuple argument name

* use fill for colortuple
2024-05-04 00:12:15 +07:00
Nicolò Pretto
5550010892 Embed homepage, MS4 (#41990)
* use css modules instead of inline styles for cursor: default (#41644)

* add toast notification after the feedback (#41575)

* fix modal submit sending data while button says skip (#41784)

* fix: it should not send the feedback if button says skip

* add comment explaining why we check that getLastFeedbackCall() is undefined

* embedding homepage analytics (#41725)

* rename defaultTab -> initialTab

* add events schema for embedding-homepage

* fix stories

* add analytics, e2e tests and fix typo in dismiss reason

* copy embed_flow schema for better diff in the next commit

* adds isExampleDashboard to trackStaticEmbedPublished

* utm tags

* fix bug of is_example_dashboard

* better test names

* refactor embed homepage status type

* "() => {}" => "_.noop"

* add "Setup embedding" to the admin setup checklist (#41638)

* add setup embedding to the admin setup checklist

* restore whitespace as it was before

* i miss prettier (whitespace again)

* Clean up check list for embedding

Largely making a new entry for the embedding info just to fight long
lines. `:embedding-homepage-dismissed-as-done` just made the maps really
long. If we have a `:done?` under an `:embedding` keyword it reads much
more naturally.

Also, The previous diff was calling `boolean` on a var rather than
invoking the var:

```clojure
:embedding-app-origin (boolean embed.settings/embedding-app-origin)
;;                             ^^^^^^^^^^^^^^ needs to be (invoked)
```

---------

Co-authored-by: dan sutton <dan@dpsutton.com>

* Change utm tags for embedding homepage links (#42042)

* update utm tags

* utm_media -> utm_content

* add description to the checklist setup step (#42200)

---------

Co-authored-by: dan sutton <dan@dpsutton.com>
2024-05-03 18:39:25 +02:00
Mahatthana (Kelvin) Nomsawadi
b890780c5d Update readme adding more ways to run Metabase (#42217)
* Update readme adding more ways to run Metabase

* Remove running from `master` because it could break

* Update enterprise/frontend/src/embedding-sdk/README.md

Co-authored-by: Alberto Perdomo <albertoperdomo@users.noreply.github.com>

* Update disclaimer, makes it more obvious

---------

Co-authored-by: Alberto Perdomo <albertoperdomo@users.noreply.github.com>
2024-05-03 15:52:56 +00:00
Anton Kulyk
434e42023e Add viz settings to manage line style and thickness to line/area charts (#42043)
* Rename "Line style" to "Line shape"

* Add "line.style" viz setting

* Add "line.size" viz setting

* Apply new viz settings in line/area charts

* Clean up `ChartSettings` test suite

* Fix default values not applied

* Add visual test

* Add E2E test

* Rework default values

* Use constant S/M/L values for "line.size" setting
2024-05-03 16:33:23 +01:00
Mahatthana (Kelvin) Nomsawadi
166248d6c4 Fix InteractiveQuestion loader show no question before loaded (#42208)
* Fix InteractiveQuestion loader show no question before loaded

* Add tests

* Unskip a test
2024-05-03 16:03:28 +01:00
Raphael Krut-Landau
5f3cca25f4 Enable customization of columns in ItemsTable (#41777)
Lets the `ItemsTable` component have customizable columns.

The logic for this is contained in `BaseItemsTable`. This is preliminary work for #41614

This doesn't introduce any new UI, but there is a unit test for the new logic.

The main thing to check is whether the table on the collections page stills work correctly. Note how the columns adjust as you resize the viewport horizontally. (In fact, the columns will sometimes adjust as you close and open the sidebar, because the width they are paying attention to is the width of the area to the right of the sidebar.)

Closes #41908
2024-05-03 10:42:59 -04:00
Ngoc Khuat
84a7859d76 Fix Bigquery can't sync materialized views (#42092) 2024-05-03 12:47:34 +00:00
Braden Shepherdson
bf5eb3a013 Add a few tests for time granularity parameters (#42119)
The API/model schemas for dashboard parameters are general enough
that they just work for this new type, which doesn't look very different
from a value parameter right now.

Part of #42118.
2024-05-03 12:42:34 +00:00
Romeo Van Snick
3b4af16356 Add snowplow event for combining columns via chill mode header (#42173)
* Add snowplow event for column combine via header

* Add test for snowplow event

* Remove unnecessary within wrapper

* Fix linting issues
2024-05-03 13:41:13 +02:00
Romeo Van Snick
021c35aa92 Snowplow event for extract action via notebook shortcut (#42095)
* Add helper to track column extractions

* Track column extractions

* Add text for column extraction

* Pass correct extraction to trackColumnExtractViaShortcut
2024-05-03 13:40:52 +02:00
Romeo Van Snick
0691779dda Fix broken test in drill extraction (#42202) 2024-05-03 12:00:09 +02:00
Phoomparin Mano
bf6a6d3381 remove chart root padding when in embedding environment (#42164) 2024-05-03 14:35:46 +07:00
Romeo Van Snick
a616d3b6ab Add tests for url and email columns (#42144)
* Add test for email extractions

* Fix swapped domain and host examples

* Add tests for URL columns

* Fix examples for shortcut too

* Use arrow function instead of function
2024-05-03 08:48:28 +02:00
Cam Saul
3829b2ce38 MLv2: Simplify MetadataProvider protocols (16 methods/3 protocols => 7 methods/2 protocols) (#42070)
* Simplified MetadataProvider protocol

* Test fix

* Ok make CachedMetadataProvider a separate schema again after all.

* Consolidate the Metadata schemas

* Clean Kondo warnings

* Malli-ify the stuff in metabase.lib.metadata.protocols

* Fix Kondo warnings

* Test fix 🔧

* PR feedback
2024-05-03 05:41:07 +00:00
Aleksandr Lesnenko
876ff91252 fix replace missing values with zeros on time series (#42058) 2024-05-02 23:12:08 -03:00
Cam Saul
a4e4e11aff Fix LegacyMetric/Segment macroexpansion with definitions using ancient MBQL (#42087)
* Fix LgeacyMetric/Segment macroexpansion with definitions using ancient MBQL 2

* Remove stray println

* PR feedback
2024-05-03 00:54:20 +00:00
Cam Saul
69fc2b2a03 Window functions should use all breakouts except first for partitioning (#42131)
* Window functions should use all breakouts except first for partitioning

* Update the offset() test

* Update tests

* Rework how we use driver escape-alias in MLv2; fix Oracle

* PR feedback

* Test fixes 🔧
2024-05-03 00:50:45 +00:00
Jeff Bruemmer
c4ff50f25d docs - generate environment variables (#41802) 2024-05-02 18:13:42 -04:00
Uladzimir Havenchyk
c3d237899c Cleanup parameters popover (#42107)
* Cleanup parameters popover

* Convert to ts

* Drop comment

* Convert dashboard-options to TS
2024-05-02 21:23:21 +00:00
Braden Shepherdson
4fa57785b6 [QP] Support :temporal-unit parameters on MBQL queries (#42116)
This is a new parameter `:type` (and `:widget-type`) to choose a time
granularity (a `:temporal-unit`, eg. `month`, `day`, `day-of-week`)
which should replace the unit on the target field for the parameter.

The target field should be a breakout with a temporal type (date,
datetime) that's compatible with the input unit. The value of the
parameter should be a string or keyword naming one of the units:
`"month"`, `:month`.

Part of #42118.
2024-05-02 17:03:33 -04:00
Uladzimir Havenchyk
ebe0e58f07 Restore mapping and filter settings when user switches operator type to the saved (#42076) 2024-05-02 23:40:41 +03:00
Noah Moss
d1de1e5666 Optimize loading of admin permissions pages (add skip_fields flag to database metadata endpoint) (#42062)
* add skip_fields flag to database metadata endpoint

* skips loading fields on database metadata requests while on admin permissions pages

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-05-02 15:03:32 -05:00
Alex Yarosh
a330f612b7 [docs] Add TOC to a few articles (#42181)
* add TOC to Jetty article

* add ToC for debian article

* vvariables

* Update docs/installation-and-operation/running-metabase-on-debian.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-02 20:03:05 +00:00
Romeo Van Snick
50ef456400 Add analytics event for extract column in chill mode (#41774)
* Add trackColumnExtractViaHeader helper

* Add Lib.extract wrapper

* Track column extractions via header

* Fix analytics event name

* Add tests for extract action analytics

* Set up extractions metadata helper

* Use functionsUseByExtraction in analytics

* Add custom type for ExtractionTag

* Use ExtractionTag in analytics

* [MBQL lib] Add `Lib.columnExtractDrillExtractions`

This gets the extractions from a column-extract drill, which is needed
in the UI.

* Add extractionExpression wrapper

* Add extractionsForDrill helper

* Fix type signature of extractionExpression

* Use expressionParts for getting expression function

* Walk expression to get functions used

* Simplify ColumnExtractionTag

* Fix expected expression

* Be more explicit with what the guard does

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-05-02 21:14:09 +02:00
Alex Yarosh
81daa11189 remove trailing slash (#42177) 2024-05-02 12:56:00 -06:00
Nick Fitzpatrick
6cc670bf52 42078 palette search links (#42167)
* Items as links

* unit tests
2024-05-02 15:40:42 -03:00
Jeff Bruemmer
a9e0b014ed add 49.8 to list of releases (#42174) 2024-05-02 14:39:07 -04:00
Abed Habli
bc7c52c520 [docs] Add Pathway for Email Settings Configuration (#42091) 2024-05-02 13:55:48 -04:00
Nemanja Glumac
ad864aa398 Fix E2E Repro #42065 failure (#42161)
* Explicitly wait for the result to load

* Remove the drill-through part from the repro
2024-05-02 16:23:05 +00:00
Phoomparin Mano
ca1dbdaa57 Apply mantine color palette to cartesian chart labels (#42148)
* use palette for rendering

* add unit tests for chart label colors

* cleanup test code

* update unit test name

* cleanup color handler

* use theme.fn.themeColor to get color
2024-05-02 15:39:07 +00:00
Nick Fitzpatrick
f852b48fc8 41994 command pallet search descriptions (#42117)
* Adding Descriptions to search results in palette

* Palette Results List component

* adjusting e2e and unit tests

* type fix

* removing duplicate theme font

* fix typo, palette types adjustment
2024-05-02 11:17:51 -03:00
Nemanja Glumac
6d2ae82bed Enable Mongo tests to run in the stress-test action (#42162) 2024-05-02 16:11:27 +02:00
Phoomparin Mano
f25830b906 Verify Metabase's theme is merged with user-supplied theme overrides (#42142)
* ensures metabase theme override is merged with user-supplied theme

* ensure both metabase and user themes are merged

* ensure existing theme override is applied

* add tests for default text colors
2024-05-02 13:59:25 +00:00
Nemanja Glumac
43c0ce979a Fix/update the hard coded description fields in containers action (#42149) 2024-05-02 15:02:00 +02:00
Ngoc Khuat
3db638f8f6 Fix mongo OOM during sync (#42140) 2024-05-02 12:15:53 +00:00
lbrdnk
33f6325c51 Skip flaky test (#42120) 2024-05-02 14:07:39 +02:00
Ngoc Khuat
eaff18734a Comment out failing snowflake test sync-dynamic-tables-test (#42145)
* Comment out failing snowflake test sync-dynamic-tables-test

* unrelated indent
2024-05-02 06:54:14 -04:00
Uladzimir Havenchyk
4a76da0b10 Fix typo in the file name (#42102) 2024-05-02 12:57:01 +03:00
Phoomparin Mano
b2cc510966 Expose theme property to metabase provider in embedding SDK (#42050)
* expose theme property in MetabaseProvider

* add more descriptions on what the theme overrides are for
2024-05-02 16:31:16 +07:00
Aleksandr Lesnenko
44ceb9eb19 support unpinning line charts from zero, pinning scatter charts to zero (#41672) 2024-05-01 21:35:27 +00:00
Alex Yarosh
2c6b94d634 [docs] Use SQL questions as sources for other questions (#42077)
* sql questions

* Update docs/questions/native-editor/writing-sql.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* Update docs/questions/native-editor/writing-sql.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-01 21:28:26 +00:00
Alex Yarosh
4a0514b598 [docs] Custom destinations in static embedding (#42080)
* custom destinations in static embedding

* Update docs/embedding/static-embedding.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-01 21:25:14 +00:00
Alex Yarosh
e09397cafc cast (#42064) 2024-05-01 15:24:57 -06:00
Alex Yarosh
7329a9d857 [docs] Add "check table visibility" to troubleshooting guide (#42072)
* check visibility

* more precise

* Update docs/troubleshooting-guide/cant-see-tables.md
2024-05-01 15:24:40 -06:00
Alex Yarosh
191b59d44b surface dashboard width in toc (#42083) 2024-05-01 15:23:19 -06:00
Alex Yarosh
892006e525 [docs] use SSO for MFA (#42084)
* mfa

* plans
2024-05-01 15:21:27 -06:00
Uladzimir Havenchyk
766c1201f4 Drop unused isDashboardParameterWithoutMapping function (#42103) 2024-05-01 18:51:20 +00:00
Romeo Van Snick
0dc75042d9 Combine columns (#42021)
* [MLv2] Add `preview-expression` to eval an expression on sample data

This is needed to show the previews in the UX for the combining columns
epic #39977.

Fixes #39979.

* [MBQL lib] Add "Combine columns" drill-thru

This is following the original plan of using a drill for this. It's hard
to combine that with the "preview" functionality.

See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569)
for discussion of how we might approach that issue.

Fixes #39978.

* [MBQL lib] Add "Combine columns" drill-thru

This is following the original plan of using a drill for this. It's hard
to combine that with the "preview" functionality.

See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569)
for discussion of how we might approach that issue.

Fixes #39978.

* [MLv2] Add `preview-expression` to eval an expression on sample data

This is needed to show the previews in the UX for the combining columns
epic #39977.

Fixes #39979.

* [MLv2] Add `preview-expression` to eval an expression on sample data

This is needed to show the previews in the UX for the combining columns
epic #39977.

Fixes #39979.

* Revert "Merge branch 'mblib-preview-expressions' into combine-columns"

This reverts commit dac17f84aa, reversing
changes made to 2934fab19d.

* Revert "Merge branch 'mblib-preview-expressions' into combine-columns"

This reverts commit 2934fab19d, reversing
changes made to 6a43c22e78.

* Revert "Merge branch 'mblib-preview-expressions' into combine-columns"

This reverts commit 6a43c22e78, reversing
changes made to 2257333a8a.

* [FE] "Combine columns" drill thru (#40082)

* Type Section['icon'] properly, including the hack for summarize section

* Add combine columns section

* Add types for combine columns drill

* Add combine columns drill component stub

* Mock combine columns drill

* Add component stub

* Encapsulate typing hacks

* Extract CombineColumnsDrill

* Extract ColumnAndSeparatorRow

* Improve naming, add button to edit separators

* Translate string

* Improve styling

* Separator input

* Handle removing columns

* Rename lib.ts to utils.ts

* Implement onSubmit

* Add getNextColumnAndSeparator

* Use form for a11y

* Handle vertical overflow

* Handle horizontal overflow

* Extract formatSeparator

* Use proper translations

* Adjust min/max sizes

* Fix scrollbar being unnecessarily shown

* Display source column name

* Avoid serializing the entire column and putting it into DOM

* Use module.css extension

* Format code

* Improve a11y

* Mock combineColumnsDrillExpression and previewExpression

* Add Preview component

* Move preview logic to Preview component

* Style Preview

* Format code

* Move styles to CSS modules

* Update UI to latest designs
- move "Add another column" button
- remove "Separated by X" button
- always show separator inputs

* Remove displayInfo mock

* Add asReturned

* Update CombineColumnsDrillThruInfo

* Integrate new way of working with combine columns drill

* Fix generating expression names

* Integrate drill with click actions

* Integrate new preview workflow

* Revert "Update UI to latest designs"

This reverts commit cda039dffe.

* Use previewExpression interface correctly

* Use new preview_expression API

* Make sure columns are created with original query and stage index

* Extract usePreview and handle preview errors

* Update popover title

* Move add column button

* Fix outline being cut off

* Style preview label as per design

* Format empty separator

* Make preview scrollable

* Use project convention

* Simplify ScrollArea usage

* Use ScrollArea in CombineColumnsDrill

* Update comment

* Remove Lib.previewExpression

* Clean up the preview after removing Lib.previewExpression

* Implement getPreview

* Change default column preview to 'text'

* Remove usePreview hook which is no longer in use

* Rename Preview to Example

* Use different placeholder for separator input

* Add whitespace placeholder

* Add ColumnPicker boilerplate

* Export Input

* Use QueryColumnPicker for ColumnPicker

* Pass width to AccordionList

* Add sequences popover events with tippy

* Remove unused ColumnOption helpers

* Add testid to Example

* Add e2e test for combine column in header

* Select content of separator input on focus

* Reduce padding on example

* Add monospace variant to Text

* Use monospace variant in Example

* Use monospace font in textinput

* Match faux-select label styles to our TextInput label styles

* Add missing color

* Remove !important

* Use pre whitespace so consecutive spaces show up

* Remove empty default

* Add example for boolean

* Remove !important

* Use should.have text over contain

---------

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>

* Remove duplicated code

* Export useMantineTheme from metabase/ui

* Use useMantineTheme instead of reading theme directly

* Remove setTimeout in popover

* Use plain t instead of jt

* Move Popover dropdown sequence hack to metabase/ui

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-01 18:22:11 +02:00
lbrdnk
9887f2222d Add string like filtering capabilities to filter widget (#42065)
* Add string like filtering capabilities to filter widget

* Address the review suggestions

* Add e2e test

* Address review suggestions

* Update mongo e2e test id so it hopefully corresponds to CI data

* Update e2e test to use id gathered from actual data

* Expand and improve the E2E reproduction

* Explicitly reference the underlying issues we're reproducing

* Update frontend/src/metabase/querying/components/FilterPicker/FilterPickerBody/FilterPickerBody.tsx

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

* Fix parens

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2024-05-01 17:14:00 +02:00
Braden Shepherdson
d142da9984 [QP, lib] Allow multiple arguments to :contains, :starts-with, etc. (#41958)
These string matching clauses only allowed two arguments previously.
Typically `[:contains field x]` to match a field against a literal.

This adds similar desugaring for `:contains`, `:does-not-contain`,
`:starts-with` and `:ends-with` that is currently done for
multi-argument `:=` and `:!=`:

```clojure
[:contains field x y z] ;; ->
[:or [:contains field x] [:contains field y] [:contains field z]]

[:does-not-contain field x y z] ;; ->
[:and [:does-not-contain field x]
      [:does-not-contain field y]
      [:does-not-contain field z]]
```
2024-05-01 12:53:03 +00:00
Anton Kulyk
bdb1a02236 Fix flaky dashboard repro tests (issue 39863) (#42046) 2024-05-01 10:35:23 +00:00
Anton Kulyk
df7a85339b Fix flaky dashboard subscription test (#42051) 2024-05-01 10:26:28 +00:00
Romeo Van Snick
5f2e323414 Notebook text extraction shortcut (#41578)
* Add shortcuts to suggestions

* Add shortcuts group

* Add split icon

* Start implementing extract column modal

* Pass alwaysExpanded from prop to accordion items

* Allow disabling search on QueryColumnPicker

* Only render columns that support extraction

* Add columnExtractions helper to Lib

* WIP

* Add examples for column extraction

* Use Lib.columnExtractions to create extraction picker

* WIP: Create clause from extraction

* Use mb- prefix in color

* Add extract wrapper

* Use updated column extraction types

* WIP: extract clause

* Use JSDoc for todo

* Handle extract column submit in expression editor

* Set name based on extract expression

* Suffix column displayNames to avoid conflicts

* Rename combine test to disambiguate it from extract test

* Add e2e test for column extractions

* Correctly render button as button

* Add tests for email extractions

* Use correct font in expression button

* Remove error when selecting an extraction

* Use last expression

* Use handleExpressionChange

* Add tests for url extractions

* Rename to lastExpression

* Add issue link to the todo

* Move Button into ExtractColumn

* Use unstyled button for ExtractColumnButton
2024-05-01 10:59:26 +02:00
lbrdnk
ddc0f98ff1 Add cancelation exception for vertica (#42047) 2024-05-01 10:07:06 +02:00
Ngoc Khuat
7f53ac9343 Capture card's last_used_at (#41006) 2024-05-01 07:34:17 +00:00
Cam Saul
856b449626 Fix Snowflake/Redshift filtering on date for timestamp with time zone columns (#41864)
* Fix Snowflake filtering on date for `timestamp with time zone` columns

* Snowflake should just generate raw SQL for literals

* Go ahead and fix other Snowflake stuff and reenable a bunch of disabled tests

* Snowflake test fixes 🔧

* Minor test improvements

* Fix Redshift and Vertica as well.

* Address PR feedback
2024-05-01 03:24:17 +00:00
Cam Saul
2b5d207f2d Add kondo hook so LSP can jump to driver definition (#41856) 2024-05-01 00:49:34 +00:00
Noah Moss
7ed6b66d02 Add docs link to perms email (#42004) 2024-04-30 21:24:24 +00:00
Alex Yarosh
ba0d786bdd [docs] Update the slack channel settings (#42071)
* update the option name

* Update docs/configuring-metabase/slack.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-04-30 21:08:58 +00:00
Alex Yarosh
fecc05925a note about default users (#42067) 2024-04-30 15:07:10 -06:00
Nemanja Glumac
0a84028335 Remove unused endpoint reference from the services.js (#42040) 2024-04-30 22:05:44 +02:00
Uladzimir Havenchyk
9228c5eb7a Update codecov github action (#42034) 2024-04-30 21:33:46 +03:00
Phoomparin Mano
30b90a8909 migrate sdk reducers to use builder callback (#42038) 2024-04-30 16:50:21 +00:00
Nemanja Glumac
389886d90c Remove native dataset from services (#41209)
* Use RTK Query endpoint to fetch native dataset in preview query modal

* Remove unused selector

* Remove endpoint from `services`

* Fix type error

* Use `getLearnUrl` selector instead of the deprecated MetabaseSettings

* Fix the error potentially being undefined when passed to a helper

* Fix weird destructuring syntax
2024-04-30 17:26:50 +02:00
Phoomparin Mano
341882cff7 Bump react-embedding-sdk version and copy README to output (#42020)
* bump react embedding sdk version to 0.1.0

* publish to metabase-embedding-sdk-react using version 0.1.1

* add commands to copy LICENSE and README files to output

* use the scoped metabase package

* rename file content variable

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* update embedding sdk package description

* update content variable in script

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-04-30 15:16:10 +00:00
Mahatthana (Kelvin) Nomsawadi
868ccdf26e Fix "react" typo (#42032)
It should be capitalized
2024-04-30 15:44:32 +01:00
adam-james
2d29f05f20 Store Parameter Values Set by User on a per-user basis (#40415)
* Store Parameter Values Set by User on a per-user basis

This is a WIP for #28181 and the notion doc:

https://www.notion.so/metabase/Tech-Maintain-user-level-state-in-dashboards-for-filters-fc16909a3216482f896934dd94b54f9a

Still to do:

- [ ] validate the table/model design
- [ ] hook up the endpoints mentioned in the doc (2 in api/dashboard)
- [ ] return the user specific parameter values on /api/dashboard/:dashboardID endpoints
- [ ] write a few tests to capture the intent of this feature

* Accidentally deleted a digit in the change ID timestamp

* first pass at writing user param values to the db.

It's in a doseq here which is probably not the correct way to go yet, but it's a step in the right direction.

* Hydrate dashboard response with `:last_used_param_values` key

If the user has previously set a parameter's value, it will show up in the map under that parameter id.

If the user has no parameter value set, that entry will be 'null'.

* Use proper fn name

* Only save or retreive user params if there's a current user id

* Add model to necessary lists

* Only run query when there are parameter ids to run it with

* Add a test to confirm that last_used_param_values works

* Add models test namespace for CRUD test

* The hydration is checked in the dashboard api test already
2024-04-30 14:19:10 +00:00
Cal Herries
34e22f90dc Move away from deprecated slack upload endpoints (#41974) 2024-04-30 14:18:59 +00:00
Nemanja Glumac
1cead3a86a Remove "dataset duration" endpoint (#42025)
* Remove `dataset_duration` from MetabaseApi

* Remove unused endpoint
2024-04-30 16:08:28 +02:00
Mahatthana (Kelvin) Nomsawadi
3c8ec9648f Fix invalid reducer key warning in frontend unit test's initial state (#42022)
* Fix `sdk` key not expected on a reducer

* Use existing type instead

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Add default SDK state when using `renderWithProvider` with `sdk` mode

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-04-30 14:33:23 +01:00
Uladzimir Havenchyk
8f0b21b47d Update copy for native questions wihtout variables during column mapping (#41650) 2024-04-30 13:28:49 +00:00
Ryan Laurie
085767de68 Revert "Fix default font in mantine (#41858)" (#41968)
* Revert "Fix default font in mantine (#41858)"

This reverts commit 131594bc62.

* define font fallbacks
2024-04-30 12:57:17 +00:00
Raphael Krut-Landau
39ba5192b3 Move ItemsTable components to a higher-level folder (#41952)
Since `ItemsTable` will be used in Browse models, this PR moves that file and related components to `metabase/components/ItemsTable`.
2024-04-30 08:51:38 -04:00
Mahatthana (Kelvin) Nomsawadi
7e215b7e46 Revert "Update SDK to use a temparay npm package name (#42023)" (#42026)
This reverts commit e86366562f.
2024-04-30 12:22:07 +00:00
Mahatthana (Kelvin) Nomsawadi
e86366562f Update SDK to use a temparay npm package name (#42023)
We should change this back once we can publish the package with the
desired name.
2024-04-30 13:04:33 +01:00
Romeo Van Snick
a8c6aace75 Add analytics event for combining/extracting columns (#41767)
* Add analytics event for combine columns shortcut

* Add new version for question analytics schema

* Add column_combine_via_shortcut event

* Add custom_expressions_used field

* Use trackSchemaEvent to track combine column event

* Move trackColumnCombineViaShortcut to separate file

* Fix typo in event key

* Add column_combine_via_column_header

* Add column_extract_via_shortcut

* Add column_extract_via_column_header

* Add database id for question

* Move analytics file to frontend/src/metabase/query_builder

* Allow null for custom_expressions_used

* Add test for snowplow event

* Fix typo in schema

* Add max length to custom expressions

* Add description to list item
2024-04-30 14:03:42 +02:00
Mahatthana (Kelvin) Nomsawadi
912b5e51fd Fix Line or bar chart not rendering in SDK (#42015) 2024-04-30 10:38:10 +01:00
Oisin Coveney
253fd4b39e Add customization for loader and error components (#41828) 2024-04-30 11:49:27 +03:00
Alexander Solovyov
858aa15082 serdes: do not die on unreadable yamls (#41887) 2024-04-30 08:26:07 +00:00
Alexander Polyankin
256835b0c0 Load card metadata recursively (#41963) 2024-04-29 19:59:58 -04:00
dpsutton
5df74763ff Revert "Store fields used in MBQL cards in QueryField (#41821)" (#42005)
* Revert "Store fields used in MBQL cards in QueryField (#41821)"

This reverts commit 0da8100558.

* comment out test
2024-04-29 17:10:09 -05:00
lbrdnk
6581a28ea3 Make resolve-private-key include private-key-options in database details (#41941)
* Update resolve-private-key and add test
2024-04-29 23:30:43 +02:00
Braden Shepherdson
435d823aad [MBQL lib] Add Lib.extractionExpression to get the expression directly (#41885)
Previously they could only be added to the query with `Lib.extract`, but
this returns the expression the extract would add.
2024-04-29 21:05:45 +00:00
Cam Saul
dd0f14a55f Add Offset() expression (BE + FE) (Part 1) (#41346)
* Fix add-alias-info matching for nominal field literal refs

* Minor cleanup

* Minimize diff

* A bit more cleanup

* Cumulative aggregations w/ multiple breakouts should reset counts (#2862)

* Update dox

* Do the nesting FIRST before adding alias info.

* Remove unused

* FE for Offset()

* Cleanup stray code

* Prettier

* Kondo

* Test fixes 🔧

* Better error message when no breakout

* Support offset as an expression with no breakouts. Still require an ORDER BY tho.

* Fix most stuff

* Hack city??????

* Revert nest-query changes and disable the offset-no-breakout test for now.

* Appease TypeScript

* Test fix 🔧

* Oracle & MySQL test fixes

* Test fixes 🔧

* Remove maxWorkers for FE unit tests
2024-04-29 16:52:08 -04:00
Jeff Bruemmer
799b7df38e docs- sql sidebar (#41442) 2024-04-29 16:32:23 -04:00
Nemanja Glumac
815ac5c779 Add tag type mapping for the pulse (#41992)
Resolves #41467
2024-04-29 22:26:22 +02:00
Luis Paolini
c683f3fdf6 Bump MongoDB driver for 50 (#41894) 2024-04-29 21:10:48 +02:00
Nemanja Glumac
d38e1faf69 Re-wire the Collections entity to use RTK Query under the hood [WIP] (#41825) 2024-04-29 20:41:44 +02:00
Noah Moss
6ea128a130 Add entity_id columns to users and groups (#41816) 2024-04-29 14:33:05 -04:00
Phoomparin Mano
d6d1fe23f0 Add metabase commercial license to embedding-sdk (#41768)
* add metabase commercial license to embedding-sdk

* attach commercial license file to npm package

* refactor license file generation
2024-04-29 17:42:31 +00:00
Alex Yarosh
7d64ca2623 cleanup (#41965) 2024-04-29 10:31:32 -06:00
Jeff Bruemmer
a77ce0ec7f fix period, update headings (#41961) 2024-04-29 12:30:36 -04:00
Uladzimir Havenchyk
a9e641a675 Use 4 cores running jest tests on CI (#41939) 2024-04-29 19:15:06 +03:00
Raphael Krut-Landau
afd75eeaa5 Port code relating to moderation to ts #41756 (#41903)
preliminary work for https://github.com/metabase/metabase/pull/41614
2024-04-29 11:01:15 -04:00
Tim Macdonald
6a5efe5e7b Native Query Analyzer cleanup (#41950)
* Missing sentence for NQA documentation

* Add a test for optional field filter parsing
2024-04-29 15:40:57 +01:00
Aleksandr Lesnenko
2555075350 remove echarts branch from the uberjar workflow (#41921) 2024-04-29 10:36:29 -03:00
Mahatthana (Kelvin) Nomsawadi
48e48889bf Add Embedding SDK readme (#41776)
* Add Embedding SDK readme

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Nicolò Pretto <info@npretto.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* Clarify the result from `useQuestionSearch`

* Remove the mentioning of API key

Since we want to drop API key support for embedding SDK

* Add more detail

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Phoomparin Mano <poom@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Remove private GH repo

* Remove the compatibility table until we've made the first release

* Fix typo

* Add details how to run with locally built SDK

* Correct Metabase Embedding SDK case

* Make the instruction more concise

* Add a disclaimer

* Update config removing deleted property

* Add Oisin suggestion that was missed from rebasing

* Clarify plugin section

* Tweak SDK Readme

* Polish the limitation section

* Update the code sample into 4 sections making it easier to read

* Tweak overview and features section of README

* Add metabase configuration section

* Clean up section

* Replace the doc in the root embedding SDK directory

* Some tweaks and improvements to SDK README

* Tweaks to SDK README: wording, change flow, add section on running MB from master

* Update enterprise/frontend/src/embedding-sdk/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Feedback section

* Add simple InteractiveQuestion example

* SDK README: Tweak Slack wording

* Standardize fullstops + fix typo

* Clean up formatting

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Oisin Coveney <oisin@metabase.com>
Co-authored-by: Alberto Perdomo <alberto.perdomo@gmail.com>
2024-04-29 14:09:30 +01:00
Mahatthana (Kelvin) Nomsawadi
fe3d71af8d Fix SDK style overridden by CSS reset (#41891) 2024-04-29 15:39:21 +04:00
Cal Herries
9a8ddfef39 Mitigate redshift flakes by not dropping view in test (#41876) 2024-04-29 10:13:01 +01:00
Romeo Van Snick
647f8f7f92 Add case for boolean columns in example (#41889) 2024-04-29 11:11:30 +02:00
Aleksandr Lesnenko
246c8a8387 dc.js to echarts migration (#41395)
Co-authored-by: Emmad Usmani <emmadusmani@berkeley.edu>
Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: Mark Bastian <markbastian@gmail.com>
Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>
Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-04-26 20:14:40 -03:00
John Swanson
a536c2d7bf Add collection.effective_ancestors to model search results (#41746)
* Add `collection.effective_ancestors` to search

Fixes #41909

The ultimate goal here is to be able to display a UI that showed the entire (effective) path to each collection.

This was a bit more painful than I'd hoped. The primary issue is that we
tied two things together:

- scoring results

- "serializing" results (really, partially serializing results, because
we do more work to shape the data later)

Why is this a problem? The `top-scorers` function took a transducer and
returned the *serialized* top scorers. Later, when we need to operate
on *all* the top results (in this case, to collect all the collection
IDs and names that we know of), we're looking at the serialized results.

In our case, we needed some data (collection location) that wasn't
included after serialization. We could add it, of course, but it's
frustrating to need to change the API of what data is *returned* from
the endpoint for purely internal purposes (changing the data available
during *processing*).

I ended up pulling serialization out of the scoring function. At some
point down the road, we should go ahead and move the `serialize`
function out of the `search.scoring` namespace entirely - there's really
no reason for it to belong there as far as I can tell.
2024-04-26 22:47:05 +00:00
Sloan Sparger
b460b29fd2 fixes db perms error when permissionEditor is null (#41900) 2024-04-26 15:51:52 -05:00
Ryan Laurie
54aa214798 Remove Popular Items Entity (#41851)
* remove popular items entity

* support secondary icons
2024-04-26 14:48:00 -06:00
Ryan Laurie
131594bc62 Fix default font in mantine (#41858) 2024-04-26 14:47:36 -06:00
Ryan Laurie
552c10139e Remove defunct form components (#41902)
* remove defunct form components

* fix lil type errros
2024-04-26 14:33:15 -06:00
Ryan Laurie
7fd5d3ff6b Remove Recents Entity (#41846)
* add entity agnostic getIcon function

* remove recent items entity

* fix tests and support secondary icon

* fix display name
2024-04-26 13:52:14 -06:00
Cam Saul
b0a9b11ca1 Fix cumulative aggregations in queries with filters and breakouts (#41792) 2024-04-26 22:40:50 +03:00
Nick Fitzpatrick
e89012f35e Command Palette - Prioritize recent items, do not filter search results (#41854)
* prioritize recent items, do not filter search results

* fixing unit test
2024-04-26 15:34:45 -03:00
Nick Fitzpatrick
0e70276ff7 removing form props from entities and EntityForm component (#41849) 2024-04-26 15:04:13 -03:00
Nick Fitzpatrick
fda53853af Migrate DatasetFieldMetadataSidebar to new Forkmik components (#41571)
* temp

* rework DatasetFieldMetadataSidebar to use new form components

* temp

* removing unneeded import

* fixing display name form field

* temp

* more temp

* onChange for form elements

* e2e adjustment
2024-04-26 15:04:01 -03:00
Denis Berezin
5b6a926a0f SDK - Add Reset button for InteractiveQuestion + drills popover styles fix (#41860)
* Button

* Reset button

* Skip failing unit test

* Fixes after merge
2024-04-26 17:30:17 +00:00
Alexander Solovyov
dd66a69a26 sql parsing: more correct field matching (#41781) 2024-04-26 14:46:25 +00:00
Braden Shepherdson
a24abaeae1 [QP, lib] Add expression functions for month, quarter, weekday names (#41548)
The new expressions `:month-name`, `:quarter-name` and `:day-name`
return the (user localized) names for these units, given the
corresponding number.

For example, 4 yields `"Apr"`, `"Q4"` or `"Wednesday"` respectively.

The `column-extract` drill uses these new expressions, rather than
generating its own `:case` clauses for them.

Note that `:day-of-week` and `:month-of-year` are tricky cases for i18n, but there are tests that exercise them thoroughly.

Part of the follow-up for Extract Column epic #38964.
2024-04-26 14:09:35 +00:00
Oisin Coveney
e35b346c58 Fix Interactive Question Loading state (#41880) 2024-04-26 14:02:17 +00:00
Nemanja Glumac
40b17c926c Remove the ace editor gutter line number highlight (#41881) 2024-04-26 15:40:07 +02:00
Romeo Van Snick
8e111abc09 Static extract examples (#41778)
* Add subTitle to ClickActions

* Add examples to column extractions

* Add test for examples

* Add test for examples

* Use rem helper

* Use JSDoc for todo

* Disambiguate between ColumnExtraction and ColumnExtractionInfo

* Update type of getExample

* Use rem helper
2024-04-26 15:26:57 +02:00
Alexander Solovyov
0da8100558 Store fields used in MBQL cards in QueryField (#41821) 2024-04-26 15:25:49 +03:00
Cal Herries
3a80be379f Add view_count for cards and dashboards and populate it from view_log (#41840) 2024-04-26 12:07:40 +00:00
Nemanja Glumac
19efc5cd8b Remove the custom resize handle from the notebook native query preview sidebar (#41877)
* Remove the custom resize handle

* Increase the handle width
2024-04-26 13:59:31 +02:00
Romeo Van Snick
304308e7de Notebook custom expression editor "combine columns" shortcut (#41872)
* Notebook combine columns (#41379)

* Add CombineColumns dialog component

* Add combine columns to the expression editor widget

* Add placeholder for empty and space to the input

* Drop the first separator

* Remove empty string from eventual concat

* Add example to Combine Colunmns builder

* Show example in monospace

* Do not collapse spaces in example

* Use monospace in separator input

* Reorganise column flatten helper

* Add back button on combine buttons modal

* Select text when focussing separator input

* Add minimum height to example

* Use that same separator as the last row

* Use ExpressionWidgetHeader instead of hand-rolled header

* Fix type when generating example

* Correctly update default separator when a url column gets set

* Swap url and email checks

* Move column input into separate component

* Use QuerySelector for column select

* WIP: customise dropdown

* Export Input

* Use a button to render the column selector

* Add combine icon

* Use shortcut suggestion shortcut for combine columns

* Allow interacting with buttons inside the popover

* Use longDisplayName for button label

* Add asReturned

* Use asReturned in CombineColumns modal

* Make faux-select button styles match normal input

* Return focus to button when select closes

* Fix type of focus event

* Move ColumnInput component to a separate file

* Only show combine column shortcut on custom column

* Add missing test ids

* Add e2e test for combine column shortcut

* Remove white fill from paths

* Add color to combine icon

* Use function expression, not declaration

* Remove comment

* Move initial default separator to constant

* Remove unused select option helpers

* Add isInteger helper to Lib

* Add case for integer columns

* Add unit tests for util

* Add SuggestionShortcut type to props for Suggestions

* Remove {enter} which broke test

* Do not use !important

* Simplify classname into object-style

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

* Use direct override on Button instead of class

* Fix formatting issue

* Use .select() to select input

* Avoid selecting placeholder text

* Avoid losing focus when window loses focus

* Rename evt to event

* Add monospace variant to Text

* Use monospace variant in Example

* Use monospace font from theme

* Match faux-select label styles to our TextInput label styles

* Remove empty default variant

* Add limit to the test case

* Remove unnecessary within wrapper

* Use rem

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>

* Remove intercept we're not waiting for

* Use have.text instead of contain

* Use cy.button

* Expand cancel test

* Remove duplicate title

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-04-26 11:21:10 +00:00
Ngoc Khuat
4542696805 Fix format-rfc3339 uses 12 hour format (#41870) 2024-04-26 17:51:20 +07:00
Nemanja Glumac
09b56609c4 Fix broken E2E reproduction for #39221 (#41875)
* Re-write E2E repro for 39221

* Convert to TS
2024-04-26 12:48:33 +02:00
dependabot[bot]
a73a0a7400 Bump mysql2 from 3.9.4 to 3.9.7 (#41823)
Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.9.4 to 3.9.7.
- [Release notes](https://github.com/sidorares/node-mysql2/releases)
- [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md)
- [Commits](https://github.com/sidorares/node-mysql2/compare/v3.9.4...v3.9.7)

---
updated-dependencies:
- dependency-name: mysql2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-26 08:40:55 +00:00
Ngoc Khuat
efb8de81f1 Fix the flake in add-required-filter-if-needed-test due to field order (#41815)
* Fix the flake in add-required-filter-if-needed-test due to field order

* /s/oredered-filter/ordered-filter
2024-04-26 08:28:25 +00:00
Braden Shepherdson
dd9e126bb6 [MBQL lib] Add column-extractions to the top level (#41525)
Column extractions are "canned" expressions based on a column's
type. For example, we might extract the weekday from a temporal column,
or the domain from an email or URL column.

This logic already existed inside the `column-extract` drill; this pulls
it out as a top-level concept, since extractions are also being
integrated into the notebook editor apart from drills.

Part of the follow-up for Extract Column epic #38964.
2024-04-25 19:28:12 +00:00
Noah Moss
9950139325 Add a note about perms graph changes to the API changelog (#41836) 2024-04-25 17:44:50 +00:00
Luis Paolini
7a6ef85777 Bump snowflake driver (#41790)
I need to test a bugfix with a customer (Fixed an issue with parsing large responses (greater than 16MB)) in 49.7
2024-04-25 19:36:27 +02:00
Tim Macdonald
c3c7f52cfd Clean up Native Query Analyzer documentation (#41830)
Also add the replace-names fn, which is a simple pass-through to Macaw #modularity
2024-04-25 16:06:53 +00:00
Oisin Coveney
53ecef5b6a Remove SDK API keys from existence (#41780) 2024-04-25 15:54:19 +00:00
Tim Macdonald
0c0eab21f4 Remove stale cards endpoint (#41826)
(It's coming back in similar form, but EE-only)
2024-04-25 14:46:42 +00:00
Noah Moss
90591f3baf Fix Cloverage failures on master (#41799) 2024-04-25 14:22:02 +00:00
Ryan Laurie
4cbae2ee70 Use RTK in entity picker (#41735)
* use rtk in entity picker

* use rtk for collection creation

* fix tricky entity shenanigans

* update collection_id type
2024-04-25 07:31:49 -06:00
Cal Herries
aec91c4bb9 Remove driver-specific code from sync-fields! (#41588) 2024-04-25 12:42:49 +01:00
Nemanja Glumac
53cf083fe5 Re-wire the Pulses entity to use RTK Query under the hood (#41775)
* Throw on `Pulse.api.delete`

* Add boilerplate `subscriptionApi`

* Add `unsubscribe` endpoint

* Add types

* Delete unused `Pulses.objectActions`

* Re-wire `Pulses` entity to use RTK Query for `objectActions`

* Re-wire `Pulses.api` to use RTK Query under the hood

* Add cache invalidation

* Fix `setArchived` objectAction

* Update DELETE response type

* Fix `params`
2024-04-25 12:54:45 +02:00
Oisin Coveney
cac42f2190 Add SDK test scaffolding and tests for use-init-data + SDK components (#41695) 2024-04-25 12:15:41 +03:00
Alexander Solovyov
400b554999 Revert "Store fields used in MBQL cards in QueryField (#41623)" (#41820)
This reverts commit f5bd634428.
2024-04-25 09:14:02 +00:00
Jeff Bruemmer
86ecf6c5b1 update list of releases (#41804) 2024-04-24 20:06:32 -04:00
John Swanson
6ead51550d Add collection ID to /collection/:id/items (#41757)
Pretty much does what it says on the tin.
2024-04-24 21:59:01 +00:00
Nick Fitzpatrick
c4134211ac Migrate SMTPConnectionForm to Form Provider (#41703)
* Migrate SMTPConnectionForm to Form Provider

* e2e test adjustment

* updaing setting mock

* PR feedback
2024-04-24 18:22:31 -03:00
Tim Macdonald
48b63228ef Upgrade to Macaw 28 (#41769)
It has a slightly different API shape. We're not using it right this
minute, but we're about to and it seemed nice to separate this out into
its own PR
2024-04-24 19:28:46 +00:00
Denis Berezin
ba014a5d02 SDK plugins system PoC (#41560)
* Isolate click actions

* Self review fixes

* Add global plugin config

* Review fixes

* Drill with custom view

* Review fixes
2024-04-24 13:51:07 +00:00
Alexander Solovyov
f5bd634428 Store fields used in MBQL cards in QueryField (#41623) 2024-04-24 16:38:59 +03:00
Romeo Van Snick
9e9e310d72 Export input wrapper and remove label hack (#41728)
* Export Input

* Move TextInput overrides to Input

* Remove the :not(:only-child) hack the Schedule component

* Remove the :not(:only-child) hack from  DateInput

* Remove the :not(:only-child) hack from FileInput

* Remove the :not(:only-child) hack from Select

* Remove the :not(:only-child) hack from TextArea

* Remove the :not(:only-child) hack from TimeInput

* Reproduce pre-hack margin in Schedule component

* Undo overzealous refactor
2024-04-24 15:26:27 +02:00
Nemanja Glumac
be35a04c37 Re-wire the PersistedModels entity to use RTK Query under the hood (#41686)
* Add persisted info types

* Keep exports sorted alphabetically

* Add boilerplate `perist` API

* Use RTK Query for the `PersistedModels.list`

* Throw for unused `PersistedModels` endpoints

* Update types

* Re-wire PersistedModels `get` requests to use RTK Query

* Fix the endpoint

* Refresh model cache using RTK Query

* Add cache invalidation

* Fix `PersistedModels.api.get` endpoint options

* Remove stray TODO comment

* Explain the difference between the `persisted-info` and the `persisted-model` tags

* Invalidate `persisted-info` list upon refreshing a single model
2024-04-24 14:43:09 +02:00
Mahatthana (Kelvin) Nomsawadi
e9fd9a4054 Render click actions popover inside the embedding SDK root (#41726) 2024-04-24 12:56:30 +01:00
Cal Herries
325b9827b4 Test for sample database having sync scheduled (#41752)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-04-24 10:10:13 +01:00
Cal Herries
48f739255e Track public and embedded card views, and collection views in the view log (#41748) 2024-04-24 09:14:20 +01:00
Cal Herries
5dee3b828f Fix missing permissions for sample DB (#41724) 2024-04-24 08:58:16 +01:00
Emmad Usmani
3a7d577555 allow scientific notation (e) in ChartSettingInputNumeric.tsx (#41755)
* allow scientific notation (`e`) in `ChartSettingInputNumeric.tsx`

* update spec

* update comment
2024-04-23 18:18:37 -07:00
Sloan Sparger
0d6bb3a1f2 Fix flaky perms EE to OSS downgrade test (#41759) 2024-04-23 21:47:22 +00:00
Nick Fitzpatrick
f72048575a tabbing through save question modal (#41729) 2024-04-23 17:02:22 -03:00
Chris Truter
719fc4f750 Invalidate model caching when updating upload table (#41653) 2024-04-23 17:14:00 +00:00
Jesse Devaney
8fc3dd1b72 Fix queries being re-run because of broken parameters comparison (#41659)
* fix queries being re-run because parameters were being compared with different sorts

* add test to validate and enforce behavior
2024-04-23 13:01:59 -04:00
LeAnn
8d9d49c035 Update environment-variables.md (#40040) 2024-04-23 12:42:54 -04:00
Ryan Laurie
73a90baa43 dont use buildjet for e2e or frontend tests (#41733)
* dont use buildjet for e2e

* dont use buildjet for frontend either
2024-04-23 15:44:57 +00:00
Romeo Van Snick
ab287b053a Be more consistent with borders and avoid double borders (#41565)
* Be more consistent with borders and avoid double borders

* Mark the aggregation 'Custom Expression' button as an action

* Remove color from action headers

* Remove bottom border from last child

* Remove top border from first child

* Make section header classes consistent

* Add border to search header

* Use correct color for borders

* Add props to enable borders in AccordionList

* Add borders to column picker elements
2024-04-23 17:33:34 +02:00
Mahatthana (Kelvin) Nomsawadi
b5f952f39f Remove unused function (#41720) 2024-04-23 16:11:20 +01:00
Nemanja Glumac
585b4ea46b Remove unused monospaceText prop (#41721) 2024-04-23 16:02:37 +02:00
Nick Fitzpatrick
5a43dffdac Migrate Entity Copy Modal away from EntityForm (#41534)
* CopyQuestionForm

* CopyDashboardForm

* inital values adjustment, e2e tests

* FormObserver
2024-04-23 10:16:37 -03:00
Alexander Solovyov
bb3194ba5f move cache business logic to model from api (#41677) 2024-04-23 12:52:42 +00:00
Oisin Coveney
03db4e387b Replace isLoggedIn and isInitialized with LoginStatus (#41637) 2024-04-23 15:07:47 +03:00
Cal Herries
dc90d8de22 Exclude internal content from admin checklist and usage stats (#41697) 2024-04-23 10:54:01 +00:00
Cal Herries
6964931a99 Improve test coverage for describe-fks and describe-fields (#41528) 2024-04-23 11:29:36 +01:00
adam-james
5834ebf561 Note the format_rows changes in the api changelog (#41268) 2024-04-23 10:48:17 +02:00
Nemanja Glumac
4b71e9aa64 Use the proper case for a "year" token format (#41715)
* Use proper case for year date format

Fixes #40493

* Add regression test for specific filters in different locales

* Actually use the locale
2024-04-23 10:31:45 +02:00
Mahatthana (Kelvin) Nomsawadi
9d2503b15d Fix TippyPopover default text color not visible after migration (#41716) 2024-04-23 09:30:07 +01:00
Oisin Coveney
5b96078a0d Add dynamic fonts to embedding SDK (#41179) 2024-04-23 10:14:29 +03:00
Noah Moss
39627a3acb New default permissions for groups (#41323) 2024-04-22 19:22:05 -04:00
adam-james
97861b154c Dates Binned by Week Export Formatting Matches App (#41619)
* Dates Binned by Week Export Formatting Matches App

Fixes: #41492

Before, the dates binned by week would be formatted as follows in CSV and JSON exports:

`Week 1 - 2024`

But that doesn't match the App's format of a Date Range:

`January 1, 2024 - January 7, 2024`

So, now the exports will apply formatting in this same way.

Note that a second bug (#41616) exists on the Frontend preventing the column formatting being applied in the app. This is
frontend only, and the csv and json exports will match the column formatting settings (eg. abbreviated dates and
alternative separators will be used in the export).

* add test and change default week style

* Week format test change

* also fix incorrect :hour formatting
2024-04-22 21:47:49 +00:00
A. Marius Rabenarivo
faab06e3de [tech debt] Stop using ms/BooleanString and only use ms/BooleanValue (#41390)
* [tech debt] Stop using ms/BooleanString and only use ms/BooleanValue

ms/BooleanString will coerce to a string, and we should probably get rid of it and only ever use ms/BooleanValue which will always coerce to a boolean
We want the coercion layer to give us values that are helpful, and true is more helpful than "true".
So we should remove ms/BooleanString and calls to parseBoolean

* Remove ms/BooleanString usage in api/native_query_snippet.clj

* Remove test case related to ms/BooleanString

* Remove the BooleanString schema def as no longer used
2024-04-22 13:13:29 -06:00
Raphael Krut-Landau
d73067b4bb Port six collection-related components to TypeScript (#41632)
BaseItemsTable
BaseTableItem
BulkActions
CollectionContentView
CollectionCopyEntityModal
ItemsTable
2024-04-22 17:17:49 +00:00
Oisin Coveney
ea9a8f56e5 Modify JWT session token logic to use immediate return value from action (#41694) 2024-04-22 17:04:17 +00:00
bryan
b8166365ea add validated migration checksums 45 46 47 and 48 (#41662) 2024-04-22 09:50:18 -06:00
Nemanja Glumac
f6d5db166f Re-wire the Snippets entity to use RTK Query under the hood (#41656)
* Throw for `Snippets.api.delete`

* Add boilerplate `snippet` RTK API

* Add boilerplate RTK-compatibility layer for main `Snippets.api` endpoints

* Add types

* Add cache invalidation
2024-04-22 15:30:50 +02:00
Mahatthana (Kelvin) Nomsawadi
82d90d043c Fix not sending necessary HTTP headers when downloading results (#41633)
* Fix not sending necessary HTTP headers when downloading results

* Fix fail E2E tests

* Add E2E test

* Fix failed tests

* Fix unit tests

* Fix download on subpath

* Fix unit tests for subpath
2024-04-22 12:30:12 +01:00
Tim Macdonald
68fc6f4477 Rename 'mac' alias to 'macaw' (#41680) 2024-04-22 10:58:27 +00:00
Nemanja Glumac
aee64bb9e4 Re-wire the Revisions entity to use RTK Query under the hood (#41558)
* Add RTK Query `revision` API

* Re-wire `Revisions` entity `list` to work with RTK Query

* Re-wire the `Revisions` entity `revert` to work with RTK Query
2024-04-22 09:11:02 +02:00
Noah Moss
42f73a056a New default DB permissions (#40869) 2024-04-19 17:16:43 -04:00
Braden Shepherdson
e435824b20 [QP, lib] Add new expression functions for host, domain, subdomain (#41540)
These functions are implemented with hairy regular expressions, and
it's more user-friendly and future-proof to name those functions in MBQL
rather than baking the `regexextract` and regex into the user's query.

It lets us evolve the regexes in the future if we detect a bug, and it
improves the UX since the user sees a meaningful function instead of

    regexextract([My URL Column], "(?<=[@\.])(?!www\.)[^@\.]+(?=\.[^@\.]{1,3}\.[^@\.]+$|\.[^@\.]+$)")

Also refactors the regexes somewhat so that they work for emails as well as URLs, and there's always just one layer of `:regex-match-first`.
Previously this was separated into two steps: URL or email to host, and host to (sub)domain.

Part of the follow-up for Extract Column epic #38964.
2024-04-19 14:49:53 -04:00
Noah Moss
46c4805157 Add a new migration to clean up deprecated perm types (#41649) 2024-04-19 14:00:52 -04:00
Uladzimir Havenchyk
f7f0282087 Reset mapping after change of operator for native questions (#41615)
* Reset mapping after change of operator for native questions

* Add a basic test

* Better name for a test
2024-04-19 20:01:01 +03:00
lbrdnk
271bbdf4f9 Remove defaultauthdb portion of mongo connection string (#41553) 2024-04-19 18:12:05 +02:00
Alex Yarosh
c6b7bda2ef [docs] Revise Okta SAML docs (#41493)
* okta docs

* clarifying group mapping methods

* links

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* review feedback

* Typo

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-04-19 09:59:20 -06:00
Kamil Mielnik
5169036492 Account for non-hydrated properties in GET /api/dashboard (#41622)
* Account for non-hydrated properties in GET /api/dashboard

* Fix provideTags

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2024-04-19 15:58:55 +00:00
Nicolò Pretto
f570c4ab79 add withUndos option to renderWithProviders to render Undos during … (#41576) 2024-04-19 17:35:09 +02:00
lbrdnk
2072e0602a Use dbname from database details instead of stats returned from Mongo (#41549)
* Use dbname from details instead of from stats

* Add mongo sharded cluster CI job
2024-04-19 17:32:16 +02:00
Nemanja Glumac
435f9acbad Re-wire the Groups entity to use RTK Query under the hood (#41480)
* Delete unused endpoint from `PermissionsApi`

* Add group tag helpers

* Define RTK Query 5 main endpoints for `permissionApi` (group)

* Re-wire 5 main api methods in groups entity to work with RTK Query

* Re-wire `clearMember` action to work with RTK Query

* Add `Groups.api.update`

* Update types

* Fix membership failing to update after `CREATE_MEMBERSHIP`

* Make sure `members` is not undefined

* Fix cache invalidation
2024-04-19 16:28:49 +02:00
Noah Moss
79583b9892 [Feature branch] Split data access and query builder access (#41581)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
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>
2024-04-19 10:13:38 -04:00
Kamil Mielnik
e6fa8f9058 Fix Dispatch type (#41631)
* Fix Dispatch type

* Fix typing

* Fix types
2024-04-19 11:38:53 +00:00
Mahatthana (Kelvin) Nomsawadi
855b32452b Add prefix to CSS custom properties (#41574)
* Migrate --border-*

* Migrate *breadcrumb*

* Migrate --color-bg-black

* Migrate --color-bg-dark

* Migrate --color-bg-light

* Migrate --color-bg-medium

* Migrate --color-bg-white

* Migrate --color-border

* Migrate --color-brand*

* Migrate --color-error

* Migrate --color-focus

* Migrate --color-shadow

* Migrate --color-success

* Migrate --color-text-dark

* Migrate --color-text-light

* Migrate --color-text-medium

* Migrate --color-text-white

* Migrate --color-white

* Migrate --default-border-radius

* Migrate --default-button-border-radius

* Migrate --default-font-family

* Migrate --default-font-size

* Migrate --default-header-margin

* Migrate --gap-1

* Migrate --icon-width

* Migrate --input-border-color

* Migrate --input-border-radius

* Migrate --margin-*

* Migrate --muted-color

* Migrate --padding-*

* Migrate --page-header-padding

* Migrate --subtitle-color

* Migrate --title-color

* Reset to master

* Remove unused --color-text-default

* Remove unused --color*

* Remove unused CSS custom properties

* Prefix only necessary CSS custom properties
2024-04-19 12:18:49 +01:00
Oisin Coveney
8e4632208a Convert EmbeddingContext to Sdk Store slice (#41585) 2024-04-19 13:59:35 +03:00
Uladzimir Havenchyk
5b9522cfc9 Add a way to update filter type and operator from parameter sidebar (#41555) 2024-04-19 12:01:45 +03:00
Nemanja Glumac
2ab84940ed Introduce task api using RTK Query and use it to replace Tasks entity (#41452)
* Throw for unused Tasks endpoints

* RTK Query `taskApi`

* Wire tasks entity list and get endpoints to use RTK Query

* Fix typo

* Expose `taskApi`

* Rework `TaskModal` to use RTK Query api

* Throw on `Tasks.api.get`

* Rework `TaskApp` to use RTK Query api

* Delete `Tasks` entity

... which never should've been an entity in the first place.

* Delete unused `TaskApi` entry

* Fix next pagination page not being properly disabled

* Do not export `isLastPage` function

* Convert TasksApp to TS

* Use Mantine Tooltip

* Remove stray comment

* Add empty lines for better legibility

* Update the response type

* Define `task_details` type more strictly

* Use the existing `DatabaseId` type

* Provide tags for `list` and `get` endpoints

* Address code review

* Handle error and loading in the `TasksApp`

* Handle error and loading in the `TaskModal`

* Extract the page size into a variable

* Index databases without mutation

* Refactor TaskModal
2024-04-19 00:54:04 +00:00
John Swanson
370671017c Don't say we'll cache archived models (#41329)
When we actually run the job to cache models, we select "refreshable
models", which selects `PersistedInfo` where:

- the `state` is something refreshable, and

- the question marked for caching is actually a model, and

- the question hasn't been archived.

However, when we selected `PersistedInfo`s to display to the user, we
didn't apply any conditions. Instead, we included PersistedInfo where
the question was not a model, or where the question had been archived.

To prevent confusion, let's hide these.

Fixes https://github.com/metabase/metabase/issues/41318
2024-04-18 13:57:34 -07:00
Ryan Laurie
427fbc1c82 Fix invisible user items in search filters (#41604) 2024-04-18 20:20:02 +00:00
Raphael Krut-Landau
96f9d6c14e [Cache] Add "Invalidate cache now" button (#40972) 2024-04-18 18:26:57 +00:00
Denis Berezin
198ebcf5d1 Fix Embedded dashboard parameters parse runtime error (#41545)
* Fix parameters parse

* Add e2e test

* Add e2e test
2024-04-18 17:15:56 +00:00
Jeff Bruemmer
9797a74c21 add redshift to list of dbs that support uploads (#41594) 2024-04-18 13:01:26 -04:00
Cal Herries
091c4a68d8 Fix null characters in JSON breaking CardRevisionAddType for postgres (#41584) 2024-04-18 16:59:34 +00:00
Raphael Krut-Landau
470df0bf7f [Cache] Schedule strategy follow up (#41420)
* Put Schedule in two columns
* Simplify timezone display
* Support 24-hour format
* Fix bugs
2024-04-18 12:03:02 -04:00
Kamil Mielnik
6bf0ada3c3 Bump dompurify in yarn.lock (#41583) 2024-04-18 15:38:33 +00:00
Ryan Laurie
784c26ac7a Question + Model Picker (#40207)
* WIP questionpicker

* use to replace dashcard content

* much better stuff

* question picker

* values source card modal

* create action form

* awesome hacky fix for crashing model detail page

* use entity picker in sandboxing modal

* deprecate ye olde question picker

* keep old question picker in add-card dashboard sidebar

* better last level check

* update types

* make stuff better

* fix rebase conflicts

* better initial value handling

* update e2e tests

* sweet sweet unit tests

* fix sandbox tests

* fix tests

* type fix

* fixes

* search style improvements

* remove unused prop

* safer path detection

* delayed loading spinner

* change confirm default

* set default collection for placeholder card

* address review comments

* update unit tests

* update e2e tests

* fix re-rebase

* add some happy little comments
2024-04-18 15:25:05 +00:00
Braden Shepherdson
8ff9805d9d [MBQL lib] Allow more filtering options for string PKs (#41477)
The filters for _numeric_ PK and FK filters are slightly different than a general numeric column. That's fine for numeric keys, but with string keys that same set of numeric filters was being returned, and then the ones for strings were removed. That left only `Is` and `Is Not` for a string PK or FK.

This PR allows more flexibility in filtering by string PKs and FKs, by checking the base type of the column and using the right set of filters for the type of key.

Closes #40665.
2024-04-18 08:46:01 -04:00
Mahatthana (Kelvin) Nomsawadi
14f1e19a91 Bump dompurify (#41564) 2024-04-18 13:33:37 +01:00
Nemanja Glumac
ee80dea28a Introduce pagination to RTK list endpoints (#41538)
* Add the pagination type

* Add the pagination helper

* Update types

* Update `user` API

* Update `collection` API

* Update `search` API

* Update `UserListQuery` type

* Explicitly define default pagination inputs

* Remove the pagination helper

* Update and fix types

`limit` and `offset` are actually nullable.

* Separate types (again)

* Fix `PaginationResponse` type
2024-04-18 12:21:16 +00:00
Chris Truter
d521d628ca Increase timeout for with-dynamic-redefs test (#41516) 2024-04-18 12:30:48 +02:00
Alexander Solovyov
fcca920e95 migrate caching settings over to the new cache_config table (#41462) 2024-04-18 13:03:09 +03:00
Lena
e9f1142287 Link the process in the CODEOWNERS file (#41507) 2024-04-18 11:36:48 +02:00
Phoomparin Mano
e21201cb4b Links to metabase URLs should open in the same window in link cards (#41508)
* external link cards should apply the correct target attribute

* add unit tests for absolute and relative question links in link cards
2024-04-18 09:32:17 +00:00
Chris Truter
4a3cdd0e51 Test that delete CSV argument is passed through (#41562) 2024-04-18 09:27:45 +00:00
Cal Herries
8e3ac99a85 Exclude sample content and "Metabase Analytics" content from usage stats (clone) (#41522) 2024-04-18 09:18:59 +00:00
Nicolò Pretto
c288e4d9f3 Feedback for the Embedding Homepage (#40746)
* FeedbackModal for the Embedding Homepage

* add source and change to correct endpoint

* fix tests, adding await and fixing endpoint

* use toEqual to also check for the source

* addresses PR feedback

* button becomes Send when email is written

* make 'comments' optional, trim inputs and refactor tests

* product-feedback endpoint (#40974)

* mvp of the proxy endpoint for the product feedback

* cleanup and fixes

* email :string -> ms/NonBlankString

* revert my solution

* Dan diff file

* makes fields other than source optional

* don't use default value in dev, to not spam the prod endpoint

* change from setting to function for product-feedback-url, as it's not meant to be changed by end users

* changed endpoint as per https://metaboat.slack.com/archives/C010ZSXQY87/p1712918951362979?thread_ts=1704910781.153589&cid=C010ZSXQY87

* fix wrong dismiss reason sent for 'I'm not interested right now'

* Update frontend/src/metabase/home/components/EmbedHomepage/EmbedHomepage.tsx

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* renamed field: feedback -> comment

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-04-18 10:04:41 +02:00
Mahatthana (Kelvin) Nomsawadi
80ada89391 Scope html styles and CSS custom properties (#41527) 2024-04-18 09:01:14 +01:00
Cal Herries
f02b79a621 Add curate permissions for "All Users" for example collection (#41512) 2024-04-18 07:28:57 +00:00
Ngoc Khuat
d1a7cec69c Count Field usage (#39671) 2024-04-18 03:45:36 +00:00
Kamil Mielnik
dee6226ea9 Migrate dashboards to RTK (#41311)
* Add provideDashboardListTags and provideDashboardTags

* Keep the utils sorted alphabetically

* Include collection tags in dashboard tags

* Add getDashboard

* Migrate basic CRUD dashboard endpoints to RTK

* Migrate remaining dashboard endpoints to RTK

* Fix save dashboard action

* Remove unused favorite/unfavorite dashboard endpoints

* Fix copy dashboard action

* Move types to types file

* Type dashboard API requests

* Fix get

* Fix typo

* Pass body

* Add a comment

* Support noEvent option to fix a failing test
2024-04-17 22:40:24 +00:00
Uladzimir Havenchyk
152ca0e500 Fix formatting of pre-release.yml (#41497) 2024-04-18 00:41:32 +03:00
Noah Moss
39cf70c334 Revert "[Feature branch] Split data access and query builder access (#39209)" (#41552)
This reverts commit e0e4ade04e.
2024-04-17 16:11:22 -05:00
Braden Shepherdson
20efd0e6f8 [MBQL lib] Github auto nag on metabase.lib.js changes (#41251)
Add a Github workflow to nag on a PR that changes `metabase.lib.js` without updating `docs/developers-guide/mbql-library-changelog.md` as well.

You can set the `.metabase-lib/no-change` label to override for a change that edits the namespace without materially changing the API.
2024-04-17 16:38:17 -04:00
Alexander Solovyov
75f669b227 [cache] log query hash during calculation of eligibility (#41530) 2024-04-17 23:10:32 +03:00
lbrdnk
6f14f039aa Cancel statement on completion of execute-reducible-query (#41470)
* Cancel statement on completion of execute-reducible-query

* Address review remarks
2024-04-17 20:53:42 +02:00
Chris Truter
83cbaae024 EE endpoint for deleting CSV uploads (#41293) 2024-04-17 18:35:59 +00:00
Noah Moss
e0e4ade04e [Feature branch] Split data access and query builder access (#39209)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
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>
2024-04-17 14:32:17 -04:00
Romeo Van Snick
42ce333d51 Fix broken test in FilterPicker (#41523) 2024-04-17 17:59:31 +02:00
Cal Herries
09e16f6fc8 Use fk-metadata instead of table-fk-metadata everywhere (#41375) 2024-04-17 15:36:05 +00:00
Nicolò Pretto
cb6075a569 fix: border appearing on night theme if bordered=false (#41514) 2024-04-17 16:06:43 +02:00
Mahatthana (Kelvin) Nomsawadi
a2cdc1345d Migrate float.modules.css (#41510)
* Migrate .floatLeft, .floatRight

* Remove unused components
2024-04-17 13:48:10 +00:00
Braden Shepherdson
0bde1fc9eb [MBQL lib] Column Extract from URL, email requires regex support (#41484)
Not all drivers support regular expressions. Don't return the
Column Extractions for URL -> (sub)domain and email -> domain unless the
database can support the regular expression matches.

Part of the follow-up for Extract Column epic #38964.
2024-04-17 12:59:00 +00:00
Uladzimir Havenchyk
320307f765 Remove not flaky tests from flaky group (#41496) 2024-04-17 15:26:11 +03:00
Mahatthana (Kelvin) Nomsawadi
81db2adb17 Migrate .clearfix (#41509) 2024-04-17 13:21:16 +01:00
Ngoc Khuat
d2905f89e2 Revert "Add BEC team codeowner (#41500)" (#41505)
This reverts commit 9b0e2817ca.
2024-04-17 09:38:22 +00:00
Ngoc Khuat
9b0e2817ca Add BEC team codeowner (#41500) 2024-04-17 15:29:36 +07:00
Nicolò Pretto
2b126f5ddb add unit tests for #41440 (#41465) 2024-04-17 09:05:53 +02:00
Oisin Coveney
d1e8e441f6 Convert EmbedFrame.module.css to CSS modules (#41367) 2024-04-17 09:16:46 +03:00
Denis Berezin
caac0cb646 Embedding SDK - Fix table header styles calculation (#41449)
* Fix table styles calculation

* Review fixes

* Fix unit tests
2024-04-17 00:55:09 +03:00
Braden Shepherdson
8c2c556ad3 Use cached Malli validators/explainers; make :fn schemas cacheable (#39947)
This improves our Malli performance substantially! Many of our code paths were calling vanilla `malli.core/validate` or `malli.core/explain`; these redo the (possibly expensive) compilation of the schema into a validator or explainer for every call.

We should use the caching versions in `metabase.util.malli.registry` everywhere, and our runtime performance will be much improved.

However when I started using these cached versions, I found that the memory use was growing out of control. Eventually I tracked this down to `:fn` schemas. Functions are only comparable by pointer equality, so they make poor cache keys. `(fn ...)` or `comp` calls in a schema on a `mu/defn` function **get re-created for every call of the `mu/defn`'d function**! That's a big time sink recompiling the schemas if we're *not* caching, and a huge memory sink if we *are* caching!

This PR pulls every such schema I could find out into a `def` so it uses the same closure and is cacheable. I'd like to automate that in some part of the Malli pipeline, or maybe a linter rule, but I haven't found a good way to do it yet.

Part of #39946.
2024-04-16 13:16:24 -04:00
Nemanja Glumac
093308d23d Re-wire the Users entity to use RTK Query under the hood (#41312)
* Define the types for the `create` user request

* First draft for the create user API using RTK Query

* Export RTK user API

* Define explicit `create` api for the user entity

* Define `updatePassword` mutation

* Wire users entity `resetPasswordManual` to use RTK under the hood

* Use `updatePassword` mutation

* Wire users list calls

* Remove unused `update_password` from services

* Fix the dispatch used to list users

* Dispatch the action type and the payload

* Wire `deactivateUser` to work with RTK

* Wire `reactivateUser` to work with RTK

* Delete unused entries from `UserApi`

* Convert the reducer to use `switch` statement

* Remove unused user `send_invite` endpoint from FE

* Wire `resetPasswordEmail` in users entity to work with RTK

* Provide cache invalidation for the `userApi`

* Add `provideUserListTags` helper

* Pass `email` as a sole argument

* Throw on `get` a user

This endpoint hasn't been used in a long itme.
Removed in https://github.com/metabase/metabase/pull/41334/files#diff-241e0afa11f03a0942eb322aa47695e58496379b0b6d42e6e59ecf6a20fe623cL448

* Use RTK Query to `updateUser`

* Fix wrong syntax

* Use RTK Query to `getUser`

It was used by `.load` and `fetch` after all.

* Export `useUpdateUserMutation`

* Refactor `getRecipientsList`

* Fix response type for the `getUser`

* Pass user id as a sole argument instead of in an object

* Fix users entity `get` method

* Fix the user update password form

* Fix unit tests

* Fix deactivate and reactivate query invocations

See e949812.

* Adjust types according to the feedback

* Order utils alphabetically

* Throw on `delete`

* Revert "Fix unit tests"

This reverts commit 2c329e8364.

* Fix FE unit test mocks

* Rename imports to use plural for consistency

* Fix one last remaining FE unit test
2024-04-16 15:48:05 +00:00
Nemanja Glumac
da9125f8b0 Fix double await syntax in a FE unit test (#41435) 2024-04-16 16:18:48 +02:00
Romeo Van Snick
176f631782 Add most used functions to suggestions when they open (#41267)
* Add list of most popular functions and aggregations

* Render 'All functions' link on expression dropdown

* Suggest popular functions when no input is given

* Do not return focus to search bar

* Default to not matching any substring

* Open suggestions when the expression editor opens

* Group expressions by group

* Render group titles in dropdown

* Match the expression suggestions height to the design

* Add tests for popular functions

* Convert tests to it-style

* Only return supported popular functions

* Limit most used functions group to 5 items

* Make the suggestion footer keyboard-accessible

* Make a different group for popular aggregations

* Remove padding on suggestion list

* Resize list

* Add test for popular functions in suggest

* Move showMetabaseLinks into args

* Remove unneeded optional chain

* Clarify popup issue in ACE hack

* Use correct target for links

* Reference correct method in comment

* Split up popular expressions

* Remove Set around popular functions/aggregations

* Do not allow interacting with suggestion header

* Do not use _ prefix for variable

* Add verb in test

* Remove unused async in test

* Test if functions are in document

* Move tests for suggestWithFooter to separate file

* Use correct target in link

* Fix typo in key

* Allow picking suggestion when textbox is empty

* Remove unnecessary cast

* Avoid double scroll bars

* Only show link to all functions when editor is empty

* Split up popular functions between expressions and filters

* Fix type of popular variable

* Use the same heuristic for footer as for popular expressions

* Close suggestions when the editor is not focused

* Add missing open prop in test

* Simplify test

* Add selector for expression editor widget

* Fix e2e tests

Fix e2e tests

* Avoid non-interactive clicks from closing the dropdown

* Use custom expression helpers in broken test

* Fix test

* Remove should exist check for selector
2024-04-16 16:16:14 +02:00
Chris Truter
d95e990284 Add test for how uploads sanitize similar columns (#41412) 2024-04-16 14:05:53 +02:00
Uladzimir Havenchyk
03e9e1c63f [e2e] Unify dashboard filter editing (#41443) 2024-04-16 10:38:51 +00:00
Alexander Solovyov
801445b1e1 global setting to enable/disable native sql parsing (#41315) 2024-04-16 13:21:49 +03:00
Ngoc Khuat
10f892ff25 missing test case for update scan field values schedule (#41459) 2024-04-16 09:36:08 +00:00
Oisin Coveney
e5a0255909 Refactor and convert DataSelector.module.css to CSS modules (#41362) 2024-04-16 11:01:15 +03:00
Nicolò Pretto
c393df2a72 revert dashcard border to put back transparency for transparent embed… (#41432) 2024-04-16 09:02:11 +02:00
Phoomparin Mano
585f49ddb8 add heypoom to the embedding team in team.json (#41458) 2024-04-16 13:42:19 +07:00
Oisin Coveney
19420a2b49 Convert rounded.module.css to CSS modules (#41357) 2024-04-16 09:26:08 +03:00
Ngoc Khuat
9b8df36dde Migration to remove scan field values triggers for DBs that turn it off (#41348) 2024-04-16 04:52:58 +00:00
Braden Shepherdson
6f5b24c6ed [MBQL lib] Add "Combine columns" drill-thru, lib/as-returned, API changelog (#41060)
The drill-thru is mostly a stub to put an entry in the context menu. Most of the logic for this is built on the FE using the existing functions for consuming and creating expressions.

See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569) for a lot more context.

This also adds `docs/developer-guide/mbql-library-changelog.md` and documents adding this function to the library as the first change in the API. I'll follow up in another PR with Github automation to expect the changelog to be updated whenever `src/metabase/lib/js.cljs` changes.

Fixes #39978.
2024-04-15 17:21:29 -04:00
Jesse Devaney
7eb6bf61ce Fix progress bar display error in query builder (#41330)
* fix progress bar in query builder

* add spec to verify regression fix
2024-04-15 17:14:32 -04:00
Jeff Bruemmer
793e5130d1 docs - note on model caching (#41446)
* note on model caching

* update link

* blockquote
2024-04-15 13:36:40 -07:00
Jeff Bruemmer
263534f965 docs - note on internal metabase account (#41207) 2024-04-15 13:20:15 -07:00
Chris Truter
b829cb7d6d Fix reflection getting Liquibase URL (#41411) 2024-04-15 16:35:36 +00:00
Tim Macdonald
6e0f5059ae Move QueryField creation to the card's after-update (#41421) 2024-04-15 17:32:55 +01:00
Alex Yarosh
e9256fda39 [docs] Static embedding description (#41282)
* static embedding

* Update docs/embedding/start.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-04-15 10:19:27 -06:00
Denis Berezin
7d19cb3d68 Convert TableInteractive.module.css (#41294) 2024-04-15 18:20:01 +03:00
Ngoc Khuat
616cfb1adb Fix unable to disable scan field values (#41170) 2024-04-15 14:20:42 +00:00
Cal Herries
e0e95863e5 Fix resources/sample-content.edn (no such file or directory) error running jar (#41408) 2024-04-15 16:51:41 +03:00
Chris Truter
af442cbf6c Fix infinite loop attack for bouncycastle (#41406)
See: https://security.snyk.io/vuln/SNYK-JAVA-ORGBOUNCYCASTLE-6612984
2024-04-15 11:52:10 +00:00
Nicolò Pretto
d952d779a0 fix header being rendered (with its border) on dashboard embedded with titled=false and only one tab (#41399)
* fix header being rendered (with its border) on dashboard embedded with titled=false and only one tab

* embedframe-header -> embed-frame-header
2024-04-15 11:35:13 +00:00
Uladzimir Havenchyk
d7e839dad5 [Parameters] Add "Disconnect from cards" button (#41380) 2024-04-15 11:14:47 +00:00
Chris Truter
0660f2a88c Release migration locks during shutdown (#41089) 2024-04-15 10:32:08 +00:00
dependabot[bot]
bf68fbd480 Bump mysql2 from 3.6.3 to 3.9.4 (#41398)
Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.6.3 to 3.9.4.
- [Release notes](https://github.com/sidorares/node-mysql2/releases)
- [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md)
- [Commits](https://github.com/sidorares/node-mysql2/compare/v3.6.3...v3.9.4)

---
updated-dependencies:
- dependency-name: mysql2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-15 10:17:35 +00:00
Oisin Coveney
688ef2ce21 Convert transitions.module.css to CSS modules (#41361) 2024-04-15 13:10:49 +03:00
Oisin Coveney
6a5a27bf0e Convert shadow.module.css to CSS modules (#41360) 2024-04-15 13:10:30 +03:00
Oisin Coveney
803c79c4f9 Convert legend.module.css to CSS modules (#41355) 2024-04-15 11:10:07 +03:00
Oisin Coveney
22525bad0e Convert width.module.css to CSS modules (#41359) 2024-04-15 11:09:50 +03:00
Cal Herries
de043add81 Log errors fetching sync metadata (#41376) 2024-04-15 10:07:10 +03:00
Raphael Krut-Landau
8006c2c68e Add Schedule strategy to Admin > Performance (#41230)
Adds a Schedule strategy to the Admin / Performance page

![image](https://github.com/metabase/metabase/assets/130925/d78ff74d-df1c-477a-b157-a0c3f21a861b)

[Loom](https://www.loom.com/share/5623cd5d772e417ba2e58c29ae1b8c14?sid=9844f0db-5bb1-4d35-af9b-206d263f5516)

As discussed with @luizarakaki, rather than modify the legacy `SchedulePicker` to work with this use case, I made a new version of it - a `Schedule` component - that uses Mantine and a better (though imperfect) approach to localization. For now, the dropdowns are not vertically aligned in this Schedule picker - something I can try to remedy later if that is important.

Tests for the Schedule component will be added in a follow-up PR.
2024-04-12 23:13:03 -04:00
adam-james
f826a28fc2 Bugfix 37914 wrong filters UI in embedding (#41342)
* Keep Filter Values for enabled Parameters in Embedding

Fixes: #37914

Previously, we removed locked parameters entirely. This is to prevent leaking potentially sensitive values.

However, for the situation where the same field backs 1 locked or disabled paramter and 1 enabled parameter, we do
still want to send the paramater values, because the enabled parameter implies that the values are permissible to see
in the embed.

So, this change will still remove parameters based on their 'disabled/locked/enabled' status, but will NOT remove the
linked field ids if they're also being used by 'enabled' parameters.

This results in the backend correctly sending necessary parameter values to the embed, where the frontend can then
render the appropriate UI instead of falling back to just text filters.

* test the case where a locked and enabled param share same field

* Address feedback. Added comment to explain classify fn
2024-04-12 21:49:50 +00:00
Denis Berezin
bec3d589db Add interactive question component with drill down (#41106)
* Add interactive question component

* Remove excess click actions for embedding

* Disable non-working drills

* Cleaner components api

* Clean up

* Review fixes

* Fix lint error

* Review fixes

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-04-12 22:41:32 +03:00
Uladzimir Havenchyk
ade34797d8 Render parameter type and operator in parameter sidebar (#41218) 2024-04-12 22:27:12 +03:00
lbrdnk
5d8cc872fa Exclude implicitly joinable columns from visible-columns in fk-columns-to (#41274)
* Exclude implicitly joinable columns from visible-columns in fk-columns-to

* Add test

* Update description
2024-04-12 20:59:01 +02:00
Cam Saul
b93e99dcd6 [P1 BUG FIX] Cumulative aggregations with multiple breakouts should reset counts when values of breakouts other than change (#41340)
* Fix add-alias-info matching for nominal field literal refs

* Minor cleanup

* Minimize diff

* A bit more cleanup

* Cumulative aggregations w/ multiple breakouts should reset counts (#2862)

* Update dox

* Do the nesting FIRST before adding alias info.

* Remove unused
2024-04-12 18:48:03 +00:00
Cal Herries
bdb34a3309 Sample content (#40753) 2024-04-12 19:21:54 +03:00
Nick Fitzpatrick
e57313a1f4 No implicit any on callbacks (#41314)
* no implicit any on callbacks

* cleaning up use of any

* small adjustments

* PR feedback and unit test adjustment

* typing click handler
2024-04-12 12:58:33 -03:00
Cal Herries
423a02fa45 Log sync errors in CI to debug redshift flakes (#41022) 2024-04-12 15:27:32 +00:00
Cal Herries
92181ab153 Add INFO log for each table being fingerprinted (#41365) 2024-04-12 17:50:41 +03:00
Cal Herries
bcf8ddb1e2 Mitigate redshift flakes by not dropping tables in upload tests (#41366) 2024-04-12 17:49:04 +03:00
Romeo Van Snick
b355cc240c Expression editor suggestion improvements (#41304)
* Add help text icon in expression editor suggestions (#41092)

* Add helptext to expression suggestions

* Deduplicate getDatabase calls

* Allow customising popover width

* Split out help text content component

* Render an info icon with the help text

* Remove duplicated defaults for popover

* Explicitly wait for suggestion items in test

* Remove commented out code

* Use React imports directly

* Rename e to evt

* Inline getHelpText when creating suggestions

* Avoid overlapping content

* Remove unnecessary Fragment

* Avoid selecting item when clicking link or button inside element

* Allow shifting popover

* Stop Popover mouse events for bubbling

* Use onMouseDown instead of onMouseDownCapture to avoid clicks inside popover from triggering select

* Add help text to all suggestions that are know mbql functions

* Expression suggestions clean up (#41236)

* Move ExpressionEditorSuggestions to tsx

* Convert ExpressionEditorSuggestions to functional component

* Simplify suggestion match component

* Move ExpressionEditorSuggestions a separate folder

* Remove default export

* Use Popover instead of Tippy for suggestions list

* Fix suggestions tests

* Remove data-ignore-outside-clicks

* Add default for suggestions

* Fix e2e test

* Move helptext wrapper to ExpressionEditorTextfield

* Switch to metabase/ui for Button

* Use arrow function
2024-04-12 16:39:59 +02:00
Cal Herries
1c5e14884d Correct sync error handling in redshift tests (#41363) 2024-04-12 17:07:40 +03:00
Oisin Coveney
2051da0be7 Convert Formula component to TS (#41349) 2024-04-12 16:42:28 +03:00
Nicolò Pretto
baf69d50f1 embed-homepage ms2: connect example dashboard (#41180)
* connect the example dashboard id setting to the embedding homepage (#41138)

* connect the example dashboard id setting to the embedding homepage

* fix types

* Update frontend/src/metabase/home/components/EmbedHomepage/StaticTabContent.tsx

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* use isNotNull

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-04-12 13:04:45 +00:00
Cam Saul
dd40ac5f74 Fix add-alias-info matching for nominal field literal refs (#41326)
* Fix add-alias-info matching for nominal field literal refs

* Minor cleanup

* Minimize diff

* A bit more cleanup
2024-04-12 14:20:49 +02:00
Oisin Coveney
85f486c2ea Convert AccountHeader to TS (#41181)
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-04-12 10:36:35 +03:00
Nemanja Glumac
450ab94d9b Remove unused keys from UserApi (#41334) 2024-04-12 09:01:50 +02:00
Raphael Krut-Landau
639aa29c4a In Admin > Performance, display minimum query duration in seconds (#40970) 2024-04-11 21:35:36 +00:00
Cam Saul
bb97466c43 Convert auto-bucket-datetimes middleware to MLv2 (#41157)
* Convert `auto-bucket-datetimes` middleware to MLv2

* New Kondo rule time.

* Test & lint fixes 🔧

* Fix typos

* Apply suggestions from code review

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-04-11 18:24:44 +00:00
Mahatthana (Kelvin) Nomsawadi
9e88fb35fd Migrate bordered.module.css (#41307)
* Migrate .bordered

* Migrate .borderBottom, .borderTop

* Fix typo

* Remove unused classes

* Migrate .borderRight

* Migrate .borderLeft

* Migrate .borderLight

* Migrate .borderError

* Migrate .borderSuccess

* Migrate .borderBrand

* Migrate .borderTransparent

* Migrate .borderless

* Migrate .borderMedium

* Review: Add missing CS import
2024-04-11 18:38:47 +01:00
Nick Fitzpatrick
29ef29e99a 40895 entity path in palette (#40985)
* collection and db breadcrumbs

* compact breadcrumbs

* adding navigation keybindings

* recent_views and search changes to always include collection or db name

* removing breadcrumbs, display parent name

* removing unneeded components

* e2e and FE unit tests

* waitFor

* e2e tests for keybindings

* help

* be tests passing

* PR feedback and type adjustments

* unit test adjustment
2024-04-11 17:14:35 +00:00
Jeff Bruemmer
f1ca96647c docs - drop note on sandboxes (#41220)
* drop note on sandboxes

* model caching

* reinstate model caching sandbox warning
2024-04-11 13:24:17 -03:00
Chris Truter
8441ffc233 Don't return nil schema, and test more table fields (#41169)
* Test created_at and schema fields
* Coerce nil schema to empty string
2024-04-11 16:06:33 +02:00
Oisin Coveney
9f5e92e431 Add JWT auth flow to Embedding SDK code (#40902)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-04-11 17:04:45 +03:00
Alexander Polyankin
bd9c63c55d Migrate alerts to RTK (#41190)
* Replace AlertApi

* Replace AlertApi

* Replace AlertApi

* Fix bugs

* Fix bugs

* Fix typo

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-11 12:49:18 +00:00
dependabot[bot]
4b97c42702 Bump tar from 6.1.11 to 6.2.1 (#41306)
Bumps [tar](https://github.com/isaacs/node-tar) from 6.1.11 to 6.2.1.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v6.1.11...v6.2.1)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-11 12:23:09 +00:00
Uladzimir Havenchyk
926e572588 Render correct parameter sidebar tab content after switching parameter (#41144) 2024-04-11 10:26:43 +00:00
Cal Herries
4dcc6bc9fa Re-enable Redshift uploads and make uploads tests faster (#41088) 2024-04-11 09:47:14 +00:00
Uladzimir Havenchyk
85e2e8cd6a Rework parameters sidebar to mantine (#41130) 2024-04-11 09:37:23 +00:00
Oisin Coveney
2c21fa99a0 Convert colors.module.css to CSS Modules (#40366) 2024-04-11 12:14:36 +03:00
Nemanja Glumac
9d19c4b69c Preserve the original question name in a "save question" modal (#41197)
* Keep the original question name in the save modal where possible

Resolves #41196

* Update tests

* Append "- Modified" to a suggested question name

* Preserve the original question description

* Address reviews - adjust the translation string

* Add E2E reproduction

* Remove extra space

* Improve assertions
2024-04-11 09:43:19 +02:00
Nicolò Pretto
99d15b0416 add env var to enable css modules classnames linting (#41173)
* .eslintrc -> .eslintrc.js

* This might work?

* add env for linting css modules class names

* avoid extending postcss-modules/recommended, specify just the used rule instead

* add missing . on comment

* Remove unused .detailName references

* Fix ManageApiKeys and GuiQueryEditor

* Fix SettingText and DashboardControls

* fix missing textUnspaced class

* remove usave of S.headerButton, that's actually never used because we never pass headerLink to ReferenceHeader

* Remove flexNoShrink

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-04-11 08:54:22 +02:00
Kamil Mielnik
32a328a054 Update offset on EntityPickerModal (#41183) 2024-04-11 06:15:42 +00:00
Raphael Krut-Landau
d839a4d4e6 Localize 'How often should we check for results?' (#41254) 2024-04-10 20:20:37 +00:00
adam-james
9cdf2340a8 Fix embed download endpoint (#41264)
* Fix embed download endpoint

We have added format_rows as a query parameter. In most endpoints this just works fine.

Here, however, the problem is that we use query parameters to pass parameter values. We run some validation over these
provided parameter values (eg. don't allow a user to over ride a 'locked' parameter). Since we have these 2 different
use cases for query parameters, the validation was failing on :format_rows, which isn't expected to exist at all.

Here, I dissoc the :format_rows key prior to this validation step, so normal validation can continue.

* Add test that uses this card embedding endpoint
2024-04-10 17:30:10 +00:00
Alexander Solovyov
3a220a796c Migration to backfill QueryField for native cards (#41188) 2024-04-10 17:01:19 +00:00
dpsutton
2a8e19b222 Nested queries have limits which can defeat their purpose (#41051)
* Nested queries have limits which can defeat their purpose

Consider a query

```sql
select count(*) from {{#199}}
```

This query should return the number of distinct rows in the query
defined by 199. But it's actually limited by the excel limit of
1048575. And that's because when the value of `{{#199}}` is expanded it
has that limit applied as normal.

```clojure
qp=> (let [card-id 199] ;; use a valid card id for you
       (-> {:database 1,
            :type :native,
            :native {:query "select count(*) from {{ref}}"
                     :template-tags {:ref {:card-id card-id
                                           :type :card
                                           :name "ref"
                                           :display-name "ref"}}}
            :middleware {:disable-max-results? true}}
           qp.compile/compile
           :query
           (metabase.db.query/format-sql )
           println))
select
  count(*)
from
  (
    SELECT
      "PUBLIC"."ORDERS"."ID" AS "ID",
      "PUBLIC"."ORDERS"."TOTAL" AS "TOTAL"
    FROM
      "PUBLIC"."ORDERS"
    LIMIT
      1048575
  )
```

But we can suppress this limit when substituting a query inside yielding

```sql
select
  count(*)
from
  (
    SELECT
      "PUBLIC"."ORDERS"."ID" AS "ID",
      "PUBLIC"."ORDERS"."TOTAL" AS "TOTAL"
    FROM
      "PUBLIC"."ORDERS"
  )
```

And this is proper because we want to limit the _outer_ query, not
internal queries.

* Remove limit from test expectation

* stupid trailing space

* another subquery test

* Use helper function to disable limit middleware
2024-04-10 10:17:22 -05:00
Cal Herries
51142efc8b Fix snowflake's delete-old-datasets! for tests (#41249) 2024-04-10 15:08:00 +00:00
dpsutton
b1e835415c Fix #39138 again (#40936)
* Fix #39138 again

Fixes #40934

Got unfixed somehow in #40578. seems like some file renames caught it off guard

But the long and short is that its possible for a persisted model to end
up in the state "refreshing" (possible an instance restart during
refreshing). The refreshing job doesn't look for these so they become
effectively invisible.

Since the job to refresh them will only run one at a time cluster wide,
any jobs that are in the "refreshing" state when the refresher begins to
refresh are necessarilly stuck (no one else could currently be
refreshing them). So we can just add them to the queue of models to
refresh.

```clojure
(jobs/defjob ^{org.quartz.DisallowConcurrentExecution true ;; <----
               :doc "Refresh persisted tables job"}
  PersistenceRefresh [job-context]
  (refresh-job-fn! job-context))
```

* Ensure ee/oss pathways are taken in tests

Annoying little footgun here. CI does not run with an ee token, so in
order to ensure that test pathway goes through ee version of a
defenterprise we _must_ use the `mt/with-premium-features
{:cache-granular-controls}`,  but we also want to ensure that it goes
through the oss version.

So two options, a `doseq` on both features (empty set and the feature
that triggers this). But want a test in the enterprise folder as well to
ensure.

The real trickiness comes from running tests at a repl and CLI. My REPL
always has an ee token in it. My command line always lacks that as
well. So want to be explicit about the token features in effect at test
time.

That's why I'm essentially duplicating tests (ee in ee folder, oss in
regular pathway)
2024-04-10 09:44:48 -05:00
Noah Moss
514f9e0575 Remove -Xmx4g option from :cloverage alias (#41253) 2024-04-10 14:15:32 +00:00
Tim Macdonald
34954c8d64 [ParseSQL] Support queries with {[variable}}s and {{field filter}}s in them (#41193)
* Support parsing {{variable}}s and such in queries

[Fixes #39954]

[Fixes #39953]
2024-04-10 13:46:29 +00:00
Nick Fitzpatrick
eb8109de09 increase activation distance for dashboard parameter dragging (#41123)
* increase activation distance for dashboard parameter dragging

* updating drag sensitivity for other places

* adjusting e2e tests
2024-04-10 10:28:51 -03:00
Cal Herries
cfb86ef85e Faster driver/describe-database for redshift (#41068) 2024-04-10 13:28:23 +00:00
Cal Herries
59aa80bd9a Comment out flaky rollback test for MySQL (#41244) 2024-04-10 13:05:16 +00:00
Nick Fitzpatrick
830b8faf9b Upgrading react-dnd and react-draggable (#41212) 2024-04-10 09:16:44 -03:00
Mahatthana (Kelvin) Nomsawadi
3c0f8181ac Migrate base.module.css (#41246)
* Migrate .pointerEventsNone

* Remove unused global class

* Migrate .faded, .fadeInHover

* Migrate .circle

* Remove unreachable code

* Remove unused props
2024-04-10 11:57:16 +00:00
Oisin Coveney
489edea4ad Convert PreviewPane to TS (#40961) 2024-04-10 13:14:06 +03:00
Denis Berezin
fc2ff55743 Restore tabs display for embedded dashboard without title (#41204)
* Restore tabs display for embedded dashboard without title

* Add unit test

* Remove empty file

---------

Co-authored-by: Mahatthana Nomsawadi <mahatthana.n@gmail.com>
2024-04-10 08:35:20 +00:00
Mahatthana (Kelvin) Nomsawadi
f3d161382d Upgraded xlsx module (#41231) 2024-04-10 07:11:54 +00:00
Cal Herries
4c00bc4982 Mitigate some redshift flakes (#41191) 2024-04-10 09:48:34 +03:00
Cam Saul
82dd157aca <datetime expression> = <date literal string> should do something sane (#36068)
* H2 compilation improvements: avoid unneeded casting

* Legacy MBQL schema improvements

* Add additional test for wrap-value-literals

* Simpler version of the fixes from #36068

* Test and lint fixes 🔧
2024-04-09 22:59:04 +00:00
Cam Saul
f901b5ae5f Improved pivot QP: use MLv2 and avoid recursive preprocessing (performance improvement) (#40141)
* Pivot QP use MLv2

* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* PR feedback

* Resurrect remove-all-breakouts

* Test fixes 🔧
2024-04-09 22:32:02 +00:00
Raphael Krut-Landau
91486ae41c Use DelayedLoadingAndErrorWrapper component in Admin > Performance (#41103) 2024-04-09 22:25:26 +00:00
Cam Saul
63910c89d6 Bump backend tests -Xmx from 2 GB to 12 GB (#41213) 2024-04-09 21:28:45 +00:00
Jeff Bruemmer
184cb81275 typo (#41205) 2024-04-09 11:01:51 -07:00
Braden Shepherdson
15b90a0281 [MBQL lib] Don't enforce expression types when converting from legacy (#41147)
These type checks are useful when constructing clauses with full MLv2
metadata available, but when converting from legacy the `:field` refs
have only `:base-type`.

If a column has its metadata overridden to eg. coerce a string or
integer into a date, its `:base-type` will remain `:type/Integer` or
`:type/Text` and the `:effective-type` will be `:type/Date` etc.

This change skips the type check while converting from legacy, and
while checking `can-run`. Eventually this should be replaced with
tracking `:effective-type` on refs or using real metdata, instead of
relying on the `:base-type` only.

Fixes #41122.
2024-04-09 17:42:27 +00:00
Romeo Van Snick
1eacf8e674 Be more specific about which sections need a seperator (#41137) 2024-04-09 18:43:12 +02:00
Cal Herries
db6013d82a Fix coercing multiple columns from int to float in H2 (#41139) 2024-04-09 18:30:42 +03:00
Mahatthana (Kelvin) Nomsawadi
fef3ba6e11 Migrate components/modal.module.css (#41091)
* Remove unused CSS custom properties

* Migrate .ModalContainer

* Migrate .Modal

* Migrate .ModalBackdrop

* Migrate Modal transition classes

* Migrate modal sizes

* Fix tests

* Add missing classes from migration

* Address review: use `data-testid`

* Remove unused classes

* Revert the util that selects Mantine modal
2024-04-09 15:29:25 +01:00
Abed Habli
4aaf880a46 Fix exporting-results list.md (#41167)
I have edited the list of "Download results."
2024-04-09 07:06:07 -07:00
Alexander Polyankin
2500b207d3 Fix tags for self-referencing entities (#41129) 2024-04-09 13:10:52 +00:00
Nemanja Glumac
71a3226267 Improve the fetching logic in a notebook native preview (#41141)
* Improve the fetching logic in a notebook native preview

* Rely on `isFetching` always

* Show a disabled convert button when there's no query
2024-04-09 12:30:01 +00:00
Nemanja Glumac
a160d8b7ae Convert ui actions to TypeScript (#41080)
* Convert `ui` actions to TypeScript

* Make sure fetched user is not `null`
2024-04-09 11:35:31 +00:00
Tim Macdonald
e1d3c48e90 Bump Macaw (now with sanitization) (#41166) 2024-04-09 10:49:15 +00:00
Nemanja Glumac
f016befaef Rename native query preview sidebar component (#41082) 2024-04-09 10:37:54 +02:00
Alexander Solovyov
1504b86572 serialize result metadata for any card (#41131)
We need to serialize it for any card, since when a normal question depends on a native question - their result_metadata won't be updated when opening a dashboard, which leads to front-end not understanding how to connect the parameters from a dashboard to a card, and errors during queries.
2024-04-09 09:50:10 +03:00
adam-james
2d98cd74b7 Bugfix 38839 manually set axis position (#41143)
* Group axes with the correct map shape.

Prior to this, any time axes were all explicitly set :left or :right by the user, the `group-axes-at-once` function
would incorrectly return the map in the following form:

`{:left ["a" "b" "c"]}` which is incorrect. It must instead look like this:

`{"a" :left "b" :left "c" :left}`

This fixes the map shape and permits the user to explicitly set all axes to the left or to the right.

* Add a test to confirm the axis settings are respected and do render
2024-04-08 23:24:54 +00:00
Cam Saul
a871940545 More Metric => LegacyMetric renaming (#40418)
* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Rename `metabase.mbql` to `metabase.legacy-mbql`

* Fix Kondo warnings

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* Fix import

* Another fix 🔧

* Merge

* FIXES

* Add another missing REQUIRE

* More Metric => LegacyMetric renaming

* metabase.models.metric-important-field => metabase.models.legacy-metric-important-field

* Even more renaming

* More renaming

* Even more fixes.

* More renaming

* Wow, even more renaming!!
2024-04-08 22:32:06 +00:00
Cam Saul
a6291809a6 Use window functions for cumulative sum and cumulative count [BigQuery] (#40982)
* Use window functions for SQL drivers for cumulative count and sum

* H2/Snowflake/Redshift implementation

* Test fixes 🔧

* Use SELECT expression positions as the default window function implementation

* Some test fixes.

* Fix bugs in add-alias-info

* MongoDB fixes

* Another pass

* BigQuery should use positions?

* BigQuery almost works 100% now.

* MLv2 fix conversion behavior for expressions with type info

* Add transformations for nesting cumulative aggregations in expressions

* Minor tweaks

* MLv2 should escape aliases using driver/escape-alias (dynamically bind this)

* Kondo fix

* Lint fixes 🔧

* More test fixes and revert test changes

* Update some tests to use correct case for nominal Field literal refs

* Wow! BigQuery is fixed! Remove upgrade-field-literals middleware

* Disable tests for the failing drivers, we can fix in follow-on PRs.

* Enable BigQuery :window-functions

* Extra info

* Add GH issue numbers

* Update more GH issue numbers

* Fix SQL Server!!!! wooo

* I THOUGHT WE WERE DISABLING SPARK SQL!!!!!!!!!!1

* Cleanup to get things ready for review.

* Snowflake + Vertica shouldn't use output column numbers for ORDER BY in OVER

* Code cleanup

* Snowflake + Vertica shouldn't use output column numbers for ORDER BY in OVER

* Code cleanup

* Test fixes 🔧

* Much simpler BigQuery implementation

* Add GH issue context

* Remove commented-out code

* Remove unused add-stage-at-index

* Documentation

* Test fix? 🔧

* Test fix 🔧
2024-04-08 21:41:53 +00:00
Cam Saul
6c515648da Legacy MBQL documentation (#40657)
* Legacy MBQL documentation

* Do not commit dox

* Subject the legacy MBQL stuff to the same stricter linting rules as MLv2

* PR feedback
2024-04-08 21:03:15 +00:00
Jeff Bruemmer
e9f0cb0e8a docs - notes on events and timelines (#41102) 2024-04-08 13:03:31 -07:00
Nemanja Glumac
dd8e0728b6 Preserve notebook native preview user preferences (#41064)
* Add new user-local setting `notebook-native-preview-preferences`

* Update user settings on FE

* Use two distinct setting entries

* Update FE types

* More explicit `notebook-native-preview-sidebar-width` definition

* Add selectors

* Initialize QB uiControls based on the BE settings

* Rename QB store entry

`isNativePreviewSidebarOpen` -> `isShowingNotebookNativePreview`

* Rename QB store entry

`nativePreviewSidebarWidth` -> `notebookNativePreviewSidebarWidth`

* Add Redux actions

* Dispatch user settings on top of Redux store

* Fix test title typo

* Add E2E test to make sure sidebar is resizable

* Expand the E2E test to cover persisting settings across sessions

* Be more explicit that we're resizing along x axis

* Store window breakpoint as a variable

* Calculate handle's left position more explicitly
2024-04-08 20:40:56 +02:00
Alexander Solovyov
8c46de0168 cache invalidation test was over-specific (#41132) 2024-04-08 17:02:24 +00:00
Oisin Coveney
d93af458dc Fix bad spacing on notebook action buttons (#41134) 2024-04-08 19:29:59 +03:00
Ryan Laurie
9be788d110 Make Collection Picker child-aware (#40655)
* make collectionpicker child-aware

* update unit tests

* add another unit test

* move test some place more sensible

* fix rebase
2024-04-08 16:23:31 +00:00
Cal Herries
89dc03f2c7 Refactor: move fingerprinting and classifier code from sync directory (#39436) 2024-04-08 15:37:34 +00:00
Alexander Polyankin
28689319f6 Allow to change RHS table in each join (#40891) 2024-04-08 15:32:58 +00:00
Romeo Van Snick
177a70ef78 Quickfix heigth on row picker (#41063)
* Make the height of the rows consistent when there is no info icon

* Limit the amount of connected tables shown

* Use Array.from({ length })

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>

* Use a regex to find connected tables in test

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-04-08 16:16:09 +02:00
Romeo Van Snick
15e5ca6c86 Move search to toplevel in accordionlist (#40008)
* Make canSelectSection a function

* Use a custom type for actions in the accordionlist

* Add the globalSearch prop to AccordionList

* Improve AccordionList tests

* Enable globalSearch in the AccordionPicker on the FilterColumn and QueryColumn picker

* Assume alwaysVisible for action sections

* Add state for empty search results

* Fix test case

* Allow passing globalSearch to Select

* Set globalSearch in semantic type picker

* Handle search when a section does not have items

* Rename variable to be more descriptive

* Add borders to headings in select

* Add border to back button too
2024-04-08 15:59:03 +02:00
Braden Shepherdson
40c4d7f46e [MBQL lib] suggestedJoinConditions accepts a join position for edits (#41035)
This optional fourth argument will disregard all joins at `position` and
later when suggesting conditions. This is useful when editing a join's
RHS, which wipes out the condition. We don't want to generate a
suggested condition that's based on keys from the RHS of the join we
just edited, or from later joins.

Fixes #40916. Part of #40890.
2024-04-08 13:45:29 +00:00
Braden Shepherdson
29f9a88f00 [API] Ensure the :schema is returned as an empty string, not nil (#41052)
Fixes #41023.
2024-04-08 13:31:05 +00:00
Alexander Solovyov
846425172d cache invalidation (#40774)
New endpoint accepts entity and entity ids in form of `database=1&dashboard=2&question=3`. If you don't supply
`&include=overrides`, then it tries to find configs directly referencing supplied entities and updates their
`invalidated_at`. If you supply `&include=overrides`, all the referenced cards are
updated (`report_card.cache_invalidated_at`).

Cache strategies then select the maximum `invalidated_at` in their logic. EE-only.

resolves #40548
2024-04-08 15:00:22 +03:00
Chris Truter
c53ac13ec5 Remove unused driver argument passed around (#41100) 2024-04-08 13:46:17 +02:00
Chris Truter
17ce608985 Add endpoint to list uploaded tables (#41117) 2024-04-08 13:45:40 +02:00
Nick Fitzpatrick
2596b73ebc React Testing Library V12 (#40981)
* update deps

* adjusting tests to work with new RTL

* removing testing-library/no-unnecessary-act:off
2024-04-08 07:44:28 -03:00
Alexander Polyankin
2834f048a3 Migrate timeline and timeline events to RTK (#41020) 2024-04-08 13:12:44 +03:00
Alexander Polyankin
840f2eca2a Migrate search to RTK (#41040) 2024-04-08 13:11:58 +03:00
Nemanja Glumac
f85e17245a Make notebook native preview sidebar resizable (#40984)
* Display sql preview on sizes less than 1280px

* Handle min notebook width using Mantine responsitve style prop

* Display the resizable sidebar on sizes >= 1280px

* Set sidebar width on resize

* Add custom handle

* Simplify window resizing with `useWindowSize` hook

* Use "white" from the theme colors

* Improve sidebar semantics with `aside`

* Define the `NativeQueryPreviewSidebar` as `aside`

* Use Mantine style props instead of CSS module

* Run the E2E test again using regular browser

We removed the nested media query that ReplayIO doesn't support.
Now this test can run using Replay Chromium as all other tests do.

* Add some breathing room between the scrollbar and the resizable sidebar
2024-04-08 11:19:09 +02:00
Oisin Coveney
3c97894b93 Convert PublicError and PublicNotFound to TS (#40956) 2024-04-08 11:54:09 +03:00
Tim Macdonald
15709fa8eb Remove lingering Joda Time references (#40958)
[Fixes #13922]
2024-04-08 08:28:01 +00:00
Alexander Solovyov
6a8f24ccdb make qp.middleware.cache-test/min-ttl-test pass consistently (#41008) 2024-04-08 10:20:13 +03:00
Oisin Coveney
44b576c96c Convert spacing.module.css to CSS Modules (#40518) 2024-04-08 10:18:11 +03:00
Noah Moss
707ad07238 Ignore internal user when initializing from config file (#41097) 2024-04-06 12:03:44 -04:00
Cam Saul
f0cb822bc7 MLv2 normalization: add :lib/uuid automatically to options maps if missing (#40466)
* MLv2 normalization: add :lib/uuid automatically to options maps if it's missing

* Remove unneeded normalization code in QP

* Fix 🔧

* Ignore invalid metadata providers when passed in from the REST API
2024-04-06 02:01:02 +00:00
Nicolò Pretto
9402bd68b9 embed-homepage - ms1 PR (#40382)
* create ui for the full embedding homepage, without any logic (#40251)

* wip ui for the full embedding homepage

* adds missing link + fix keys

* remove done TODO

* Update frontend/src/metabase/home/components/EmbedHomepage/InteractiveTabContent.tsx

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* destructure props in the function arguments

* rename customerFacingAnalyticsDocsUrl to analyticsDocsUrl

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* add new settings for embedding homepage (#40455)

* remove old minimal version

* adds new embedding homepage settings and sets them at the end of the setup

* comment e2e test

* add tests for embedding homepage flags

* more tests

* remove unit tests related to old minimal version

* fixes flags descriptions

* :keyword for embedding-homepage

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>

* replace reloadSettings and refreshSettingsList with initializeSettings

* `value => value === true` -> `Boolean`

* toMatchObject -> toEqual for more strict tests

* remove useless undefined check for settings, the component is conditionally rendered based on a setting so it means they're loaded anyway

* fix: use :hidden as we changed the type to :keyword

* specifically check for the `embedding` feature in the tokenFeatures object instead of checking if any feature is active

* remove double \n

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

* connect settings to the embed homepage and show it (#40528)

* fix nested a warnings in browser console

* connect settings to the embed homepage and show it

* fix stories

* remove localStorage.clear() as we're not using it in the logic anymore

* dismiss without feedback for the embedding homepage (#40587)

* feat: add dismiss functionality to the embed homepage

* update setup e2e to check for the dismissal of embedding homepage

* use List from metabase/ui (#40638)

* set embedding-secret-key when embedding is enabled (#40813)

* set embedding-secret-key when embedding is enabled

* use "named" setters and getters as suggested by Noah

* Fix tests for ms1 after updating on master (#41069)

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-04-05 23:25:47 +03:00
Cam Saul
9d112756ff Use window functions for cumulative sum and cumulative count (#40752)
* Use window functions for SQL drivers for cumulative count and sum

* H2/Snowflake/Redshift implementation

* Test fixes 🔧

* Use SELECT expression positions as the default window function implementation

* Some test fixes.

* Fix bugs in add-alias-info

* MongoDB fixes

* Another pass

* BigQuery should use positions?

* Disable tests for the failing drivers, we can fix in follow-on PRs.

* Extra info

* Add GH issue numbers

* Update more GH issue numbers

* Fix SQL Server!!!! wooo

* I THOUGHT WE WERE DISABLING SPARK SQL!!!!!!!!!!1

* Cleanup to get things ready for review.

* Snowflake + Vertica shouldn't use output column numbers for ORDER BY in OVER

* Code cleanup

* Test fix? 🔧
2024-04-05 13:03:24 -07:00
Uladzimir Havenchyk
15bc33492b Fix flaky object-detail e2e test (#41096) 2024-04-05 19:04:28 +00:00
Cam Saul
697ac34dae Do not i18n the logs (#41067) 2024-04-05 18:53:27 +00:00
Romeo Van Snick
a91f3d8636 No error message on preview api error (#40996)
* Correctly pass an error string to Vizualization

* Fix error layout for preview vizualization

* Do not animate preview vizualization height

* Add reproduction for #40724

* Fix test description

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Rename coerceError to getErrorMessage

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-05 11:42:10 -04:00
Alexander Polyankin
56469a29db Fix loading metadata for models (#41074) 2024-04-05 18:30:21 +03:00
Chris Truter
c8bbe47189 Tighten metabase.upload interface (#41075) 2024-04-05 15:18:40 +00:00
Alexander Polyankin
30f3acd49a Fix question schema notebook (#41078) 2024-04-05 13:35:26 +00:00
Mahatthana (Kelvin) Nomsawadi
7649bba353 Migrate list.module.css (#41030)
* Moved a CSS rule, so we could only migrate 1 CSS file

* Migrate .ListSectionHeader

* Migrate .ListItem

* Migrate .ListItemArrow

* Migrate .ListSectionHeaderCursor

* Migrate .ListSectionToggleAble

* Migrate .ListSectionTitle

* Migrate .ListSectionExpanded

* Migrate .ListSectionIcon

* Migrate .ListItemCursor

* Migrate .ListItemDisabled

* Migrate .ListItemSelected

* Migrate .ListItemTitle

* Migrate .ListItemDescription

* Migrate a CSS class used in tests

* Fix tests from migrating global CSS classes
2024-04-05 13:49:32 +01:00
Mahatthana (Kelvin) Nomsawadi
7c344da791 Migrate LineAreaBarChart.module.css (#41018)
* Migrate .LineAreaBarChart

* Migrated .LineAreaBarChartRenderer

* Migrate .mute-*

* Fix tests that rely on a static class

* Fix wrong DOM query selector syntax

* Address review: Remove CSS comment noise
2024-04-05 13:49:19 +01:00
Jeff Bruemmer
398f85181c docs - dash card notes (#41057) 2024-04-05 08:41:26 -04:00
Cal Herries
b9464c30e9 Simple sync exceptions (#41066) 2024-04-05 15:16:23 +03:00
Mahatthana (Kelvin) Nomsawadi
1c42af3740 Fix flaky test (#41073) 2024-04-05 13:05:53 +01:00
Jeff Bruemmer
16ab6a833a remove redirect (#41049) 2024-04-05 07:54:38 -04:00
dependabot[bot]
f7f864d6a1 Bump follow-redirects from 1.15.4 to 1.15.6 in /release (#40612)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-05 11:55:25 +03:00
Braden Shepherdson
199e069c4d [MLv2] First pass of docs improvements in metabase.lib.js (#40679)
Goal is to properly document the interface between MLv2 and the FE. In
particular I want to call out the health and fate of each function. Some
of them only exist to support legacy compatibility, for example, and
that should be documented to discourage new usage and make clear the
conditions for removing the functions.
2024-04-04 22:09:09 +00:00
Romeo Van Snick
c4b3e79200 Make info icons less obtrusive (#40865)
* Hide info icons when no description exists

* Move defaults for InfoIcon to separate file

* Add open delay to popover

* Remove inverted background from type label

* Fix margin on semantic type label

* Make semantic type not be bold

* Fix unit tests for hidden info icons

* Rename file to constants

* Remove unused showIfEmpty prop altogether

* Fix the height of the expression suggestions that don't have an info icon

* Fix padding on filter modal

* Fix the height on dataref
2024-04-04 20:10:24 +00:00
Aleksandr Lesnenko
8fe94af974 asynchronously load libraries for png and pdf exports (#41036) 2024-04-04 15:31:27 -03:00
Jeff Bruemmer
f7b7bda730 docs - update public sharing (#41044) 2024-04-04 14:09:18 -04:00
Denis Berezin
1f93ba5c6c Add types generation for embedding SDK package (#40975)
* Add manual imports fixup

* Fixes

* Fixes

* Review fixes

* Review fixes
2024-04-04 16:56:03 +00:00
lbrdnk
ee6f4ac163 Enable not emptyable arguments for is-empty and not-empty clauses (#40957)
* Enable not emptyable arguments for is-empty and not-empty clauses

* Add review remarks

* Shorten dataset name so it is usable with some drivers

* Disable test for Athena

* Handle possibly missing base type

* Update comment

* Missing base type field is treated as not emptyable

* Update desugar middleware

Now middleware adds base type to fields with integer id that are missing that first. This ensures correct function of is-empty expansion.

* Update desugar middleware

Cleanup base types necessary for desugaring is-empty

* Update desugar middleware cleanup

* Update test

* Adjust tests

* Remove now redundant e2e test

* Update comment
2024-04-04 18:51:10 +02:00
Nicolò Pretto
7d16a878b0 Revert "fix: padding not working on <Modal> component" (#41029)
This reverts commit 88a36a6a6d.
2024-04-04 16:12:27 +00:00
Kamil Mielnik
7603ad8a9d Repro #23103 - Wrong number of distinct values in a native model (#41027)
* Repro #23103 - Wrong number of distinct values in a native model

* Fix flake
2024-04-04 16:05:28 +00:00
Jeff Bruemmer
4879d7d614 docs - mention of raw unformatted results (#41033) 2024-04-04 11:53:28 -04:00
Braden Shepherdson
4bad50337f [MLv2] Handle nested "Zoom In" drills on binned columns (#40965)
The first time you zoom in on a bin in a binned query, it works fine.

For example, Orders COUNT by SUBTOTAL auto-binned has a bin for 40-60.
If you zoom in on that, it correctly shows the range 40 to 60 broken
down into smaller bins which are 2.5 units wide. If you then try to
zoom in on one of these smaller bins, say 50-52.5, there are two
problems:

1. The filters from the first zoom (`>= 40` and `< 60`) are still
   there, and so are the new ones (`>= 50` and `< 52.5`).
2. The new filter is actually wrong; it uses the big width (20)
   from the original bins, not the width of the nested bins (2.5),
   so the new filters are `>= 50` and `< 70`.

This PR fixes both issues, so nested bins (1) remove the old filters,
and (2) use the correct width for the nested bins.
2024-04-04 11:03:06 -04:00
Alexander Solovyov
c059d8d585 do not print stacktrace when client closes connection too early (#40834) 2024-04-04 14:57:27 +03:00
Chris Truter
321e2d0d55 Testing parity for appending to and replacing uploads (#40899) 2024-04-04 11:50:46 +00:00
Chris Truter
862daf338a Break out upload.types namespace (#40741) 2024-04-04 10:30:28 +00:00
Mahatthana (Kelvin) Nomsawadi
2d281d2c84 Fix flaky test caused by unmounted HoverCard (#40966)
* Fix flaky test caused by unmounted HoverCard

* Remove unused test util
2024-04-04 10:18:39 +01:00
Nicolò Pretto
88a36a6a6d fix: padding not working on <Modal> component (#40748) 2024-04-04 11:04:02 +02:00
Oisin Coveney
4e7d6f4584 Convert cursor.module.css to CSS modules (#40522) 2024-04-04 11:42:06 +03:00
Alexander Polyankin
a5759d7681 Fix question_id in question schema 1-0-3 (#41002) 2024-04-04 09:23:07 +03:00
Braden Shepherdson
cb506458ee [QP] Correctly find joined fields in the previous stage (#40933)
This logic was trying to match `[name join-alias]` pairs previously, but
that won't work since the later stage field doesn't have a `:join-alias`
on it. This falls back to matching on only the ID or name, but only if
it's unambiguous.

Fixes #40252.
2024-04-03 22:01:43 +00:00
Alex Yarosh
7a4b2fb07e [docs] some format fixes (#40938)
* fix indent in referencing models

* remove syntax highlighting for now
2024-04-03 15:22:10 -06:00
John Swanson
cce183e7ce Don't throw when sent non-int limit/offset (#40821)
This middleware shouldn't throw exceptions when `limit` or `offset`
query parametesr aren't integers.
2024-04-03 13:30:10 -05:00
Lena
8386526374 Make Noah the codeowner for permissions et al (#40919)
* Make Noah the codeowner for permissions et al

et al = `integrations` (OSS google auth, LDAP and Slack integrations) + `enterprise` (audit, advanced SSO, advanced config stuff).  `enterprise` also has LLM which doesn't really have a codeowner now, but it also doesn't need one.

* Correct the paths and the scopes
2024-04-03 19:10:55 +02:00
Raphael Krut-Landau
c1f4bff840 Basic cache admin UI (#39234)
Adds:
* Performance tab 
* Data caching settings tab
* Two-panel strategy editor
* "Don't cache" strategy
* "TTL" strategy
* "Duration" strategy
* "Use default" option for databases
* OSS page
* Unit tests

[Loom](https://www.loom.com/share/b1b173a52be9401588ffb63f718e052a?sid=bed4bdf5-f967-4d93-af55-9b96b6b52730)
2024-04-03 12:04:23 -04:00
Nemanja Glumac
9a8e0a088e Add analytics events for the native code preview in a notebook (#40962)
* Bump the question schema and update it with the new events

* Enable snowplow tracking on the frontend

* Add E2E test for tracking snowplow events related to native preview sidebar

* Fix question id type in the schema
2024-04-03 17:59:54 +02:00
Mahatthana (Kelvin) Nomsawadi
a583764b74 Fix embedding (#40841)
* Fix overflow static dashboard

* Fix `frame` event's height for interactive dashboards

* Fix E2E tests

* Fix test names to match the correct GitHub issue numbers

* Use `data-element-id` for consistency

* Make the test selector more consistent
2024-04-03 16:32:50 +01:00
Ngoc Khuat
d84764c51e comment out flaky caching test (#40963) 2024-04-03 15:28:53 +00:00
Ngoc Khuat
7866f7e20b Fix unable to search field values from partitioned tables (#40767) 2024-04-03 15:27:25 +00:00
Lena
359a8dacc6 Clarify that backport/no-backport is an internal thing (#40954)
* Clarify that backport/no-backport is an internal thing

A few times per month, external contributors ask about the notion doc they can't access and about the labels they are not expected to set. This is not the experience we should give to people who not only take their time to contribute to metabase, but also actually read the PR template.

(slightly duplicated condition in the beginning and the end of the paragraph — "For those employed [...] If you're not employed [...]" — is on purpose)

* Add linebreaks in PR template

Co-authored-by: Tim Macdonald <tim@metabase.com>

---------

Co-authored-by: Tim Macdonald <tim@metabase.com>
2024-04-03 16:12:57 +02:00
Nick Fitzpatrick
9c477a75f3 Command Palette UI adjustments (#40650)
* Command Palette UI adjustments

* move search to end of results list

* ellipsis long command palette items, min icon size and showing debounced text

* setting fixed width. adjusting admin result icons and text

* fixing e2e test
2024-04-03 10:21:28 -03:00
Alexander Polyankin
1235d9a8ee Deprecate MLv1 metadata (#40947) 2024-04-03 16:11:26 +03:00
Jeff Bruemmer
7e899cff28 add 49.3 to list of releases (#40943) 2024-04-03 08:55:05 -04:00
Uladzimir Havenchyk
54ed754436 Fix row id mapping in object detail modal displaying (#40874)
* Map row id on object detail id

* Add a fallback

* Add e2e test

* Add a limit

* Provide a fix for #34070

* Simplify test
2024-04-03 12:32:30 +00:00
Nemanja Glumac
2cf943207c Use MLv2 to determine whether a query can be previewed (#40609)
* Use MLv2 to determine whether a query can be previewed

* Add E2E repro for #40608

* Expand E2E repro

* Fix test

* Make sure the step is active and visible before offering to preview its query

* Expand E2E test

* Address review comment - use `getNotebookStep` helper
2024-04-03 11:09:53 +00:00
Jeff Bruemmer
9521828422 docs - formatting exports (#40921) 2024-04-03 06:53:21 -04:00
Uladzimir Havenchyk
d12c549a1f Do not put js code into page title (#40901)
* Do not put js code into page title

* Typecheck

* Add e2e test

* Update e2e/test/scenarios/question/document-title.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-03 10:48:39 +00:00
Mahatthana (Kelvin) Nomsawadi
af54379afa [MS2] 1. Analytics (#40681)
* Remove old config + fix typo

* Add new analytics for 4 new illustration settings
2024-04-03 11:21:55 +01:00
Cal Herries
e5f9d2c412 Create the internal user in a migration (#40907) 2024-04-03 10:11:50 +00:00
Mahatthana (Kelvin) Nomsawadi
f94ec2cce8 Migrate dashboard.module.css (#40918)
* Migrate .DashEditing

* Migrate .CardTitle

* Migrate .PinMap

* Migrate .PinMapUpdateButtonDisabled

* Migrate .BrandColorResizeHandle

* Migrate .VisualizationSlowSpinner

* Migrate .AddSeriesModal

* Migrate 2 more classes
2024-04-03 10:07:17 +01:00
Mahatthana (Kelvin) Nomsawadi
1299f251a1 Remove unused CSS files (#40908)
* Fix default export

* Remove unused classes

* Remove unused components
2024-04-03 10:06:40 +01:00
Mahatthana (Kelvin) Nomsawadi
715174d314 [M1] Metabase illustration settings (#40219)
* Add login page illustration (#39299)

* Move Metabot setting to a new place

* Add setting for login page illustration

* fix UI styling

* Fix not able to upload the same file twice

* Update the admin > appearance > conceal metabase copy

* Prepare the component for tests

* Add some unit tests

* Prevent settings not saved sometimes

After setting the value to/from `custom` one of the setting could be
failed to save, I suspect this happens because the race condition from
trying to save the setting values relatively at the same time.

* Make unit tests easier to read

* Add all unit test test cases

* Add basic E2E test

* Show fallback icon for broken images

* Make use of the proper component

* Update the comment to affect the reality

* Add an error message when file size is over 2MB

* Show an error message when the file size > 2MB

* Add the error message tests

* Preserve the preview image aspect-ratio

* Detect corrupted images

* Fix failing unit tests

* Address feedback: Type

* Feedback: Create meaningful variables

* Feedback: Make selector API more sensible

* Prevent race condition

Makes sure we save the settings completely before making other actions
that also change settings otherwise, there could be race conditions.

* Feedback: tighten up a type

* Feedback: Fix inconsistency callback calls

* 2. Add the rest 3 illustration settings (#40487)

* Add the rest 3 illustration settings

* Don't make the X icon feel lonely

* Fix illustration widget saving

* Fix type error

* 3. Update the select UX to match new design (#40491)

* Update the select UX to match new design

* Move info dot next to file upload button

* Simplify IllustrationWidget API

* Update setting title copy

* Clean up test comments

* Feedback: Clarify `any` type

* Feedback: Use shorthand object creation

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* Feedback: Use global CSS glass instead of inlining values

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* Feedback: Remove unnecessary curly brackets in JSX

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>

* 4. Connect illustrations to new setting values (#40139)

* Wire landing page illustration to the setting value

* Wire the unsubscribe page to the setting value

* Prepare no rows error to be wired to the setting value

* Wire no question results illustration to the setting value

* Wire no search results illustration to setting value

* Fix error from fixing conflict

* Fix required unnecsseary prop on Image

* Use Image component

* Link dashboard card no results image to the setting value

* Move the no data results to more a generic directory

* Link collection picker no results image to the setting value

* Make illustrations more accessible

* Fix failed tests

* Test unscribe page illustration + test no illustration

* Add landing page tests

* Simplify Cypress selectors

* Refactor: Rename settings to match the new requirements

No question data -> No Data
No search results -> No object

These changes are made so, these 2 settings are generic enough to
include other illustrations later on.

* Add no data illustration test

* Add no object illustration tests

* Fix unsubscribe page background style

* Fix not able to build static viz

* 5. Follow-up on milestone 1 (#40710)

* Update custom background illustration scale behavior

* Remove the need to put an SVG file in static folder

* Fix test from rebasing off master with @testing-library/user-event upgrade

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-04-03 09:07:54 +01:00
dpsutton
12ea8d42b5 Creator sentiment emails iterate (#40922)
* Send creator emails every week

mod the email by 52 instead of by 12 and use the current week as an
anchor

```clojure
user=> (require '[java-time.api :as t])
nil
user=> (let [every-day (take 1000 (t/iterate t/plus (t/local-date 2024 1 1) (t/days 1)))
             f         (fn [d]
                         (let [wf (java.time.temporal.WeekFields/of (java.util.Locale/getDefault))]
                           (.get d (.weekOfWeekBasedYear wf))))]
         (sort (keys (frequencies (map f every-day)))))
(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
 40 41 42 43 44 45 46 47 48 49 50 51 52)
```

```clojure
user=> (metabase.util.cron/cron-string->schedule-map "0 0 2 ? * 7")
{:schedule_minute 0,
 :schedule_day "sat",
 :schedule_frame nil,
 :schedule_hour 2,
 :schedule_type "weekly"}
```

* fix typo in creator sentiment email, clean up a bit

typo: had `:verison` instead of `version`.

And while I'm in there, make the payload all in one file and have the
email namespace json->bytes->b64-encode so the data is all in one place
and the setting that allows it to be present or not is co-located.
2024-04-02 14:34:56 -05:00
Nick Fitzpatrick
32c0bf9e06 command palette trigger in app bar search (#40747)
* command palette trigger in app bar search

* remove tabbing to the trigger button
2024-04-02 14:48:26 -03:00
Nemanja Glumac
e36669d9c6 SQL in a sidebar - Milestone 2: Visual tweaks (#40694)
* Move all notebook containers styles to one place

* Make NotebookStep wide again

* Tweak sidebar width and breakpoints

* Remove top margin from NotebookSteps

* Stop line wrapping in an ace editor

* Uniform width between step header and step body

* Remove stray styles

* Scroll content independently

* Use named export

* Use Mantine button for "Visualize"

* Convert notebook step width to rem

* Adjust the position of the step close button

* Adjust notebook step max-width to 1200px

* Remove the `cx` where not needed

* Use HTML 5 `aside` element for the sidebar

* Use Mantine responsive styles

* Fix E2E test
2024-04-02 17:42:57 +00:00
Denis Berezin
9526eaa937 CI for Embedding SDK (#40629) 2024-04-02 17:38:47 +00:00
Maz Ameli
be3a46b854 fix instance analytics typo (#36596) 2024-04-02 10:27:07 -07:00
Chris Truter
8db8b43059 Fix bumping minor version past 10 (#40859) 2024-04-02 19:02:19 +02:00
Ryan Laurie
5b19999dfc Use RTK Query instead of entity framework for DatabaseCandidates (#40403)
* use RTK Query instead of entity framework for DatabaseCandidates

* use skipToken to tighten up API request types
2024-04-02 16:49:46 +00:00
Alexander Polyankin
69353015bb Replace Questions.loadList with RTK (#40896) 2024-04-02 18:46:23 +03:00
Uladzimir Havenchyk
a4fb40e496 Add repro test for a model that uses another model and both have custom column with the same name (#40851)
* Add repro test for a model that uses another model and both have custom column with the same name

* Skip test

* Update e2e/test/scenarios/models/reproductions/39150-model-with-same-custom-column-name.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Update e2e/test/scenarios/models/reproductions/39150-model-with-same-custom-column-name.cy.spec.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Convert to ts and add question

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-02 15:40:21 +00:00
Alexander Polyankin
c27b0a35f4 Migrate metrics entity to RTK (#40900) 2024-04-02 18:36:40 +03:00
Chris Truter
61f7c7f243 Make generated_columns optional for csvupload events (#40880) 2024-04-02 16:55:32 +02:00
Jeff Bruemmer
250058711c docs - notification perms (#40692) 2024-04-02 10:48:11 -04:00
Nemanja Glumac
03aaf47d77 Add breakpoints to the Mantine theme overrides (#40903) 2024-04-02 14:36:32 +00:00
Mahatthana (Kelvin) Nomsawadi
4ac74859b0 Migrate frontend/src/metabase/components/Popover/Popover.module.css (#40730)
* Migrated .PopoverContainer, .PopoverBody

* Make global CSS more prominent

* Migrate 2 classes

* Remove unused class

* Migrate .PopoverBodyWithArrow

* Remove unused class

* Migrate .PopoverBodyMarginBottom

* Remove unused class

* Migrate .PopoverFooter

* Remove unused class

* Preserve classes order for easier review

* Fix unit tests
2024-04-02 14:30:31 +01:00
Alexander Polyankin
28640cfd93 Show query execution time in the QB header for MBQL queries (#40889) 2024-04-02 12:30:42 +00:00
Uladzimir Havenchyk
27fbc96829 Add repro for "Dashboard filters do not work with custom columns on saved questions used in models" (#40784) 2024-04-02 14:45:53 +03:00
Uladzimir Havenchyk
ee28134c9b Add a repro for 'GUI model joining native ones break with column not found error' (#40772)
* Add a repro for 'GUI model joining native ones break with column not found error'

* Rename test

* Add await

* Skip test
2024-04-02 14:44:50 +03:00
Alexander Polyankin
de322a10aa Migrate schema entity to RTK (#40785) 2024-04-02 11:41:56 +00:00
Leo Paillier
d9d8c688e3 Fixes code snippet typo with extra closing parenthsis in case expression (#40873) 2024-04-02 07:07:30 -04:00
Jeff Bruemmer
f52d2f09f5 fix typo (#40858) 2024-04-02 07:06:57 -04:00
Oisin Coveney
215c0bc197 Convert BrowserCrumbs to TS (#40847) 2024-04-02 13:10:46 +03:00
Ryan Laurie
80e690534a Update Translations Strings for 49.3 (#40780)
* put new strings in the pot

* update some more strings

* add new translated strings
2024-04-01 13:20:14 -06:00
Jeff Bruemmer
dacca2446d update releases (#40862) 2024-04-01 15:14:25 -04:00
Jeff Bruemmer
53884aebf5 remove doc updates (#40028) 2024-04-01 18:57:37 +00:00
Romeo Van Snick
49926dbabf Handle null value for field in CategoryFingerprint (#40861) 2024-04-01 18:23:47 +00:00
Roman Abdulmanov
cfca498700 Team json update (#40855) 2024-04-01 19:19:00 +03:00
Anton Kulyk
69b63e89ea Update query results download tooltip copy (#40849) 2024-04-01 17:13:33 +01:00
Anton Kulyk
45b2f147e8 Fix x-ray dashboards run some queries twice on load (#40844)
* Fix parameter values comparison in x-rays

* Skip rerun when `parameterValues` are not initialized

* Remove not used code
2024-04-01 17:07:28 +01:00
Uladzimir Havenchyk
48863d24c3 Remove flakiness from ListPicker spec (#40832) 2024-04-01 17:55:16 +03:00
Uladzimir Havenchyk
6d146ab82d Do not update Pie chart state unnecessary (#40840) 2024-04-01 17:43:34 +03:00
Ryan Laurie
8a9a0a162b Properly Handle Other Users' Personal Subcollections in CollectionPicker (#40822) 2024-04-01 14:04:36 +00:00
Ryan Laurie
d68187e1fc Allow CollectionMover to display API errors (#40700)
* HELP

* Help delivered

* allow entityPicker to display api errors

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-04-01 08:00:44 -06:00
Oisin Coveney
6655faa047 Convert hide.modules.css to CSS modules (#40574) 2024-04-01 11:14:30 +03:00
Alex Yarosh
6ec4282d39 [docs] creating a HAR file (#40734)
* add link

* create HAR

* formatting

* periods

* more formatting

* feedback
2024-03-29 13:00:29 -06:00
Raphael Krut-Landau
34d35b84ca Fix model card overflow bug (#40736) 2024-03-29 18:29:10 +00:00
Anton Kulyk
bd33c86a8d Don't rerun dashcard queries when switching tabs without parameter changes (#40783)
* Add E2E test

* Move `getDatasetQueryParams` to `data-fetching.js`

* Use `null` as a parameter value when missing

* Fix missing default `datasetQuery`
2024-03-29 17:19:52 +00:00
Alexander Polyankin
97ba53dfe6 Fix adding a filter for a UUID PK column (#40777) 2024-03-29 16:31:46 +00:00
Ryan Laurie
9423ca83c0 fix timing test flake (#40786) 2024-03-29 10:58:25 -05:00
Alexander Polyankin
7f147bdf15 Migrate database and some field endpoints to RTK (#40701) 2024-03-29 13:33:19 +00:00
Nicolò Pretto
f8d3566137 enableMouseEvents on EmbedModal to allow selecting with the mouse on … (#40771) 2024-03-29 12:10:16 +00:00
Alexander Polyankin
b3e900b24b Allow saving native questions with required parameters without defaults (#40739) 2024-03-29 14:04:32 +03:00
Nick Fitzpatrick
589a665eb4 Fix for userEvents 14 on Master (#40761)
* Nick is sad

* tests passing
2024-03-28 22:53:48 +00:00
John Swanson
c451e286bc Fix :dataset_query (#40652)
... among other things.

The order of arguments was wrong here, causing the default
implementation of `post-process-collection-childre` to be called. The
implementation for `:card` ends up removing the `:dataset_query`
entirely, which is what was intended.
2024-03-28 15:43:35 -07:00
John Swanson
9961c354af Add location and effective_location to search (#40687)
For collections retrieved from the Search API, attach `location` and
`effective_location` so the frontend knows... where they're located.
2024-03-28 15:43:21 -07:00
dpsutton
e0d2407749 Throttle reset_password endpoint (#40760) 2024-03-28 17:30:28 -05:00
adam-james
23bda114fa Cards with Results Should Show up in Subscriptions (#40743)
* Cards with Results Should Show up in Subscriptions

Fixes: #40726

This PR fixes a bug where setting 'Hide thie card if there are no results' in a Dashcard's viz-settings would hide the
card even when there were results.

* adjust test to show that the setting is respected

Before, the setting would always hide the card. Now, the card is only hidden when there are no results. This test sets
up 4 cards: 2 are normal, 2 have no results, but 1 has the setting to hide empty. THerefore, we should expect to see 3 results.
2024-03-28 21:19:26 +00:00
Sloan Sparger
3522a5ccf2 Upgrade @testing-library/user-event to v14 (#40269)
* upgrades @testing-library/user-event to v14, updates test to accomidate events always returning promises and other breaking API changes

* Fixing up broken suites. Half way

* rest of tests

* green plz

* Fix new entries of userEvent usage

* unit test adjustments

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
2024-03-28 18:24:23 +00:00
adam-james
347c5ef47c Make format export optional (#40606)
* Make Formatting on Exports Optional

Formatting on exports can be turned off via a middleware key:

`:format-export?` which will control if the 'app style' formatting will be applied to the exported results.
`:format-export? false` will return the file as in previous Metabase versions.

* format_export's default value provided in the QP middleware

Should still default to formatted for v. 49, as the formatting is intended as a feature. This default value should be
provided in a central place, so is added to the middleware and is therefore not necessary for the API to provide a default.

* weird indentation

* Add format_export param to dashboard dashcard query endpoint

* Add format_export option to embedded dashboard downloads endpoint

* Move default true value to the streaming-results-writer impls

* Default true but for real this time

* Add format_export to the public Question endpoint

* Add test to card api

* Dashboard exports endpoint test

* Add test to dashboard embeds

Test still fails and I don't know why yet

* the dangers of println debugging....

Well, I was passing a string false the whole time. Turns out the problem was me

* Public Card downloads endpoint now has format_export and test

* export_format also works for adhoc queries using api/dataset

* Let defendpoint do the boolean parsing

* Embed endpoint should now work too.

* Unify format-rows and format-export middlewares

* Sneaky endpoint!

* In xlsx, always parse temporal strings so that viz-settings formatting is applied

* Snuck in an incomplete change by accident. removed it.

* Can now specify format/no format on subscriptions

* Fix and move migration

* default format rows to true in attachments

* Ok, I think that should actually work for subscriptions.

* Change endpoints to use format_rows instead of confusing format_export

* format_rows everywhere

* Fix more test failures

* redef'd function had wrong signature

* Make format export optional (FE part) (#40643)

* Refactor download URL builder code

Need to handle query `params` and request `body` separately

* Export `useHover` from `metabase/ui`

* Add unformatted export for dashboard cards

* Add unformatted export for saved questions

* Fix POST body encoding

* Add unformatted export for ad-hoc questions

* Ensure `format_export` is always false for Excel

* Add unformatted export to public questions

* Add unformatted export to embedded questions and dashboards

* Fix behavior for PNG format

* Add tests for `QueryDownloadPopover`

* Fix e2e downloads helper (allow URL query params)

* Rework alt key handling

* Add e2e test

* Switch to `format_rows` instead of `format_export`

* Add unformatted export option to subscriptions

* Fix `isHoldingAltKey` initial state

* Rework e2e test to use Total column

* Fix initial checkbox state for subscriptions

* Use "Alt" in tooltip label for Windows/Linux

* Show the subscriptions toggle only for CSV attachments

---------

Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>

* Address review feedback

---------

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-03-28 17:59:21 +00:00
Jeff Bruemmer
6bf8b21cdf docs - update info collection page (#40197) 2024-03-28 13:08:13 -04:00
Alex Yarosh
036de06748 fix typo (#40744) 2024-03-28 10:43:58 -06:00
Oisin Coveney
dac5a001cd Fix wrong icon (#40738) 2024-03-28 18:21:05 +02:00
Kamil Mielnik
907a416009 Fix some warnings in JS console (#40727)
* Fix warning about passing a ref to a function component
- this didn't work and fortunately was not used (anymore) at all

* Move comment where it belongs

* Fix warning that functions cannot be react children
2024-03-28 15:38:40 +00:00
Alexander Polyankin
0b27a96fb0 Do not sort suggested columns, metrics, segments by name (#40636) 2024-03-28 16:24:06 +02:00
Oisin Coveney
3fbfeddf3d Convert text.module.css to CSS modules (#40582)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-03-28 16:15:00 +02:00
Oisin Coveney
153e039685 Convert scroll.module.css to CSS modules (#40621) 2024-03-28 16:11:38 +02:00
dpsutton
bcfe9e44a1 clear errors in success pathway (#40672)
if a previous run had an error, it will remain present but the state
would be "indexed". We should just clear that error.
2024-03-28 09:02:31 -05:00
Oisin Coveney
06c664ae79 Convert layout.module.css to CSS modules (#40561)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-03-28 14:32:26 +02:00
Oleg Gromov
bb04cccad2 Native query default parameter values: ParameterValuePicker for list values (#39852) 2024-03-28 11:31:45 +00:00
Alexander Polyankin
ce4af92c59 Trim clipboard data in filter widgets (#40718) 2024-03-28 10:55:32 +00:00
Tim Macdonald
df1366e128 ParseSQL: select * (#40637)
* Parse wildcards in native queries

Add query_field.direct_reference

* Do away with old Model refs in Card model test

* Do not show stale cards with a select *
2024-03-28 09:54:05 +00:00
Mahatthana (Kelvin) Nomsawadi
bee426d232 Update dependencies (#40713) 2024-03-28 09:21:06 +00:00
Chris Truter
0e0f5bb92d Strip tsv file extension (#40702) 2024-03-28 08:59:54 +00:00
Anton Kulyk
7efd8d3627 Fix dashcards from other tabs displayed after leaving editing mode (#40696) 2024-03-28 00:07:49 +00:00
Chris Truter
e63d82ef3e Accept TSV files for upload (#40566) 2024-03-27 22:18:42 +02:00
Sloan Sparger
c6c8ec0d3c Correct issue where EE only LDAP user provisioning feature is breaking OSS instances (#40685) 2024-03-27 14:39:00 -05:00
Ryan Laurie
70ec6d8615 Handle invalid file drop (#40690) 2024-03-27 13:35:55 -06:00
Raphael Krut-Landau
b426fe7eee Remove database prompt banner (#40648) 2024-03-27 13:51:46 -04:00
Ryan Laurie
a016ecca40 Collection moving with EntityPicker (#39869)
* wip - collection moving

fix subcollection detection

make stuff nice

update e2e tests

prettier

new e2e coverage

fix unit tests

fix stacked modals

cleanup

less diff

sneaky-ass modal wrappers

fix some e2e tests

* rebase rejigger

* fix tricky e2e flake
2024-03-27 10:22:04 -06:00
Uladzimir Havenchyk
0c9e3d55f9 Upgrade node to 18.20 (#40661)
* Upgrade node to 18.20

* Trigger CI

* Try 20 again

* Revert "Try 20 again"

This reverts commit 8f4b39e7a6.

* Revert change

* Add nvmrc to the frontend_sources list
2024-03-27 16:00:59 +00:00
John Swanson
c6dd2765b0 Allow group managers to view all people (#40619)
Fixes #40328

[Our documentation](https://www.metabase.com/docs/latest/people-and-groups/managing#group-managers) states that:

> Group managers can:
>
> - View all people in the Admin settings > People tab.

This fixes enforcement to be aligned with the documentation. This behavior makes sense, because as the docs also state, Group Managers should be allowed to *add* people to the group they manage, which they can only do if they can see those people!

Initially, I also removed a faulty test, which was described as:
```
;; Non-segmented users are allowed to ask for a list of all of the users in the Metabase instance. Pulse email lists
;; are an example usage of this. Segmented users should not have that ability. Instead they should only see
;; themselves. This test checks that GET /api/user for a segmented user only returns themselves
```

but actually failed to test this in a relevant way (because it was testing the `GET /api/user` endpoint rather than the `GET /api/user/recipients` endpoint). The test had continued to pass only because the user was the only member of the group they managed.

I initially thought this behavior wasn't desired, but as it turns out, it *is* in fact documented behavior to disallow sandboxed users from seeing any email suggestions. Investigating, I found that a bug was allowing sandboxed users to see all users on the `/api/user/recipients` endpoint if the user-visibility setting was set to `:all`.

Thus, the second commit fixes the bug and re-adds the (fixed) test. A sandboxed user now only sees their own user when hitting `/api/user/recipients`.
2024-03-27 15:40:27 +00:00
Oisin Coveney
9a0fdd429a Convert hover.module.css to CSS modules (#40575) 2024-03-27 17:08:41 +02:00
Uladzimir Havenchyk
16e5553ed6 Use a released version of source-map-js (#40667) 2024-03-27 14:14:01 +00:00
Noah Moss
7d2e51946a Custom migration to delete old truncate-audit-log quartz job (#40649) 2024-03-27 10:06:30 -04:00
Kamil Mielnik
244a19da32 Deprecate entity hooks (#40666)
* Deprecate entity hooks still in use

* Remove unused entity hooks

* Move entity framework hooks to a separate directory
2024-03-27 20:45:06 +07:00
Anton Kulyk
a6684ac137 Fix filters disappeared from dashboard PDFs (#40664) 2024-03-27 13:05:43 +00:00
Oisin Coveney
bf2bb2421a Convert headings.module.css to CSS modules (#40570) 2024-03-27 12:59:33 +02:00
Nemanja Glumac
cc1f9f038f Trigger a query limit update on blur while in notebook mode (#40630)
* Trigger the query limit change on blur

* Use named export

* Add a unit test

* Fix E2E tests

* Fix unit tests

* Additional E2E test fix

* Address review comments
2024-03-27 08:09:50 +00:00
Raphael Krut-Landau
a43261f2c6 Restore Models in Browse data (#40633)
* Revert "Remove Models from Browse data (#40108)"

This reverts commit 45a2e8689f.

* Make rtl friendly

* Add 'no description' for blank-description models

* Fix vertical position of collection header toggle

* Move FixedSizeIcon into metabase/ui and increase height of empty state

* Move FixedSizeIcon back into BrowseModels.styled.tsx

* Localize 'No description'

* Add comment

* Fix type issue
2024-03-26 23:43:40 -04:00
Ryan Laurie
5fb43f2663 Tag Flaky Tests (#40654) 2024-03-26 23:53:10 +00:00
Denis Berezin
98f6cd824e Embedding SDK - integration commit (#40198)
* Minimal SDK code

* Fix viz, styles

* Move SDK code to enterprise folder

* Fix files structure

* Clean-up

* Review fixes

* Review fixes

* Review fixes

* Remove elementid

* Reuse some options from main webpack config

* Actualize package.json

* Actualize package.json
2024-03-26 23:10:40 +00:00
Alexander Polyankin
65e527cdb3 Resolve crash due to missing stageIndex parameter in available-metrics (#40614) 2024-03-26 21:46:09 +00:00
Nemanja Glumac
b777f58d48 Remove readonly notebook view (#40641) 2024-03-26 21:22:25 +01:00
dpsutton
564e642f8a Raise model index limit (#40642)
* Use expression fix on both pk-ref and value-ref

The gist: inside the query expressions are referred to as [:expression
"foo"]. But as a nested query, it's just another field, and the fact
that it was an expression is irrelevant and should not leak from that
stage. So "downstream" should just be [:field "foo" base-type].

Oddly, if you just fix one field or the other, the query would be
"valid", would log an error, but no valid values would be returned.

It seems like the invalid expression reference was just dropped so we
only selected a single column and those were removed (we run `(filter
valid-tuples?)` as we only want valid key/value pairs).

So let's add a `(> (count values) 0)` which was failing previously.

* Fix indexing error

When updating the model index, it diffs the existing values vs the new
values and deletes appropriate and adds the new values. But it was using
the wrong column when updating the model index values. It used `pk_ref`
but that table uses `model_pk`. This led to the following errors on
stats:

```sql
select pk_ref, value_ref, state, error from model_index where state = 'error'

pk_ref,value_ref,state,error
"[""field"",563028,null]","[""field"",563018,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
"[""field"",534030,null]","[""field"",534037,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
"[""field"",545945,null]","[""field"",545948,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
```

Now those errors will be fixed and the model indexes will correctly
track the values

* Bump indexing threshold to 25,000

Had been limited to 5,000 rows of model indexing. This was a made up
number as we went into this endeavor. But it's proving to be far too
small. Bumping to 25,000

* Parititon deletions and inserts

With a higher limit need to ensure that we don't send too large of a
query.

```clojure
model-index=> (t2/insert! ModelIndexValue
                          (map (fn [id]
                                 {:name           (str (gensym "value"))
                                  :model_pk       id
                                  :model_index_id 1})
                               (range 25000)))
Execution error (PSQLException) at org.postgresql.jdbc.PgPreparedStatement/<init> (PgPreparedStatement.java:105).
PreparedStatement can have at most 65,535 parameters. Please consider using arrays, or splitting the query in several ones, or using COPY. Given query has 75,000 parameters
```

* move comment and fix test failure explanation

comment should be next to the number? check. and also need to use
`mc/explain` which returns info rather than `mc/validate` which returns
a bool:

```clojure
;; bad
model-index-test=> (let [values [[1 "foo"] [2 "foo"] ["foo" "foo"]]]
                     (-> (mc/validate [:sequential [:tuple number? string?]] values)
                         (me/humanize)))
nil
;; good
model-index-test=> (let [values [[1 "foo"] [2 "foo"] ["foo" "foo"]]]
                     (-> (mc/explain [:sequential [:tuple number? string?]] values)
                         (me/humanize)))
[nil nil [["should be a number"]]]
```
2024-03-26 15:22:12 -05:00
Cam Saul
4543a7fd9b Fix filtering on LocalDates (#40530)
* Split from #40146: only the filter changes

* Don't include format-rows changes here.

* Test fixes 🔧

* Test fix 🔧

* Misc test fixes 🔧

* Test fix 🔧

* Tweak SQL Server fix
2024-03-26 13:57:52 -06:00
Braden Shepherdson
b9f6cdb29d [MLv2] Return correct drill-thrus for single-row aggregates (#40462)
They were showing "break out by" and quick filters, when they should be
showing "break out by" and "See these Orders".

These are the `pivot` and `underlying-records` drills, internally.

Fixes #40174.
2024-03-26 12:54:16 -06:00
Ryan Laurie
49864834cd CSV Replacement Frontend (#40480)
* add UI for CSV replace

* update e2e tests

* update unit tests

* use enums everywhere + delete commented code block

* all the enums
2024-03-26 17:08:18 +00:00
Tim Macdonald
79f06ef9d0 Add the dev debug page to the docs (#40626) 2024-03-26 16:48:04 +00:00
Alexander Polyankin
4afee8dbed Use RTK beneath the database entity (#40560) 2024-03-26 16:14:18 +00:00
Ryan Laurie
b770bd58ab Collection Moving Cleanup (#40388) 2024-03-26 09:58:14 -06:00
Aleksandr Lesnenko
0b179262b4 fix normalized chart crashes when trend lines enabled but there is no insights data (#40624) 2024-03-26 12:17:21 -03:00
dependabot[bot]
826d632136 Bump express from 4.17.1 to 4.19.2 (#40618)
Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.1...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-03-26 14:13:22 +00:00
Nemanja Glumac
a07d90935a Show generated SQL in a side bar automatically - Milestone 1 (#40595)
* Show SQL in a notebook sidebar [PoC/task-1] (#40279)

* Display SQL in the notebook sidebar

* Remove unused modal

* Rename the component to `SQLPreviewSidebar`

* Hide the close button in a SQL sidebar

* Rename the component to `NativeQueryPreviewSidebar`

* Toggle a native query sidebar preview [PoC/task-2] (#40327)

* Use Mantine components where possible

* Rename the button to `ToggleNativeQueryPreview`

* Toggle the native query preview sidebar on and off

* Update the button tooltip based on the sidebar state

* Shorten var names

* Read the state directly from the store

* Re-enable the button that converts a query into its native counterpart [PoC/task-3] (#40362)

* Re-enable the button that converts a query into its native counterpart

* Use Mantine button

* Remove references to the modal

* Fix tests

* Use RTKQuery for API calls in the native preview sidebar [PoC/extras] (#40430)

* Use RTKQuery for API calls

* Fetch question inside the component

* Export named component

* Add type guard

* Use RTK query for the native dataset endpoint

* Improve semantics around error message

* Improve native sidebar basic styling [PoC/task-4]  (#40463)

* Refactor sidebar to use `AceEditor`

* Fix the query display condition

* Style the code as in the native query editor

* Style the toggle icon

* Make native preview usable on small screens

* Cover "Show SQL/native query in a sidebar" with E2E tests [PoC/task-5] (#40540)

* Fix query formatting for Mongo

* Add initial smoke tests

* Cover "converting a question to SQL" scenarios

* Cover "converting a question to a native query" scenarios

* Add test that covers behavior on small screens

* Adjust the viewport width to counter CI's behavior

* Revert "Adjust the viewport width to counter CI's behavior"

This reverts commit 370a76b621.

* Add E2E repro for #38181

* Add repro for #40557

* Try a workaround for the failing test in CI

* Show empty sidebar if query has no data source

* Add E2E coverage for an empty sidebar state
2024-03-26 15:02:10 +01:00
Oisin Coveney
be6c90d5ce Fix width issue in Embed Code sample (#40616) 2024-03-26 15:16:23 +02:00
Chris Truter
d8694f1a3a Bump follow-redirects from 1.15.5 to 1.15.6 (#40615)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-26 12:37:43 +00:00
Oisin Coveney
1ba18765d0 Convert link.module.css to CSS modules (#40584) 2024-03-26 14:20:58 +02:00
Nicolò Pretto
9cf856f2a9 export List from metabase/ui (#40348)
* export List from metabase/ui

* fix text color

* adds WithIcon example

* fix typos
2024-03-26 11:30:47 +01:00
Mahatthana (Kelvin) Nomsawadi
ba74c6bff3 Fix e2e util cypressWaitAll (#40572)
* Fix e2e utils

* Update e2e/support/commands/api/composite/createDashboardWithQuestions.js

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

* Remove unnecessary return

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-03-26 10:01:05 +00:00
Oisin Coveney
743f4ff9d7 Remove SaveQuestionModal.module.css and replace with general CSS modules (#40500) 2024-03-26 09:44:24 +00:00
Oisin Coveney
fa45b738d1 Convert grid.module.css to CSS modules (#40564) 2024-03-26 11:27:54 +02:00
John Swanson
dc279fde80 Sort official collections first in API endpoints (#40598)
* Sort official collections first in API endpoints

For both `/api/collection/tree` and `/api/collection/items`, sort
collections with official collections coming first.


Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-03-25 23:26:28 +00:00
Case Nelson
b4203948a5 Fix case-sensitive option leaking to string/= (#40535)
Fixes #40383

If a native query parameter is set up with a string widget type that
supports a `case-sensitive` option, and that parameter is tied to a
dashboard filter that did not support that option, the option was still
leaking into the filter as an option where options were not expected.

For instance the native query parameter used `string/contains` and the
dashboard used `string/=`, the QP would try to build a filter like `[:=
field value {:case-sensitive false}]` which is an illegal filter.
2024-03-25 15:23:54 -06:00
Alexander Solovyov
e3b360cde8 caching -> cache (#40578) 2024-03-25 22:53:06 +03:00
Jeff Bruemmer
113a9222e2 docs - update serialization.md (#40594) 2024-03-25 14:24:57 -04:00
Alexander Polyankin
73c5a96b17 Use can-save for models (#40586) 2024-03-25 20:14:28 +02:00
Jeff Bruemmer
2012647375 remove mention of fingerprinting (#40591) 2024-03-25 11:25:42 -06:00
Jeff Bruemmer
67cb98f23b fix anchor links (#40588) 2024-03-25 13:14:42 -04:00
Alexander Solovyov
815b2a7308 make cache config available for OSS version (#40512) 2024-03-25 14:57:33 +00:00
Alexander Polyankin
e74cf9f571 Migrate /api/password_reset_token_valid to RTK (#40568) 2024-03-25 16:32:13 +02:00
Bryan Ricker
f302f221e1 typo fix (#40467) 2024-03-25 10:29:32 -04:00
Chris Truter
9d0d0c8daf Use mb/once for relevant upload tests (#40499) 2024-03-25 13:50:03 +00:00
Alexander Polyankin
62df05aef1 Deprecate Entity Framework (#40563) 2024-03-25 15:20:28 +02:00
Chris Truter
2a68dfabc1 Fix parsing integers after floats in CSV upload (#40552) 2024-03-25 11:53:58 +00:00
Chris Truter
b206d85b44 Implement CSV separator inference (#40525) 2024-03-25 11:41:26 +00:00
Chris Truter
135f8c7fd0 Prevent NPE when formatting geographic coords (#40550) 2024-03-25 11:22:51 +00:00
Tim Macdonald
d52d4fe18a Bump next.jdbc (#40452) 2024-03-25 10:50:43 +00:00
Ngoc Khuat
8b728bec35 Fix unable to migrate to 49 due to v49.00-059 migration (#40547)
* In #37160 we added a migration to convert all datetime columns to
timestamp with time zone by using a fixed list of what to convert. but
it turns out some customer instances has a different list. So this PR
removed the fixed list and use a query to get a list of all datetime
columns.
2024-03-25 10:49:39 +00:00
Ngoc Khuat
9b941d8a35 Add tests for checking partial table privileges on PG (#40549) 2024-03-25 10:40:54 +00:00
Tim Macdonald
760d1196c9 Backend dep bump for 50 (#40372)
* Remove unused marginalia aliases

* Upgrade deps.edn

From `neil deps upgrade`

* Un-bump jetty-server

* Downgrade H2 due to many problems

* Dep bumping for Athena

* Dep bumps for BigQuery

* Dep bumps for Presto

* Dep bumps for Redshift

* Dep bumps for Snowflake

* Dep bumps for SQLite

* Upgrade to Mongo 5

* Bump next.jdbc
2024-03-25 08:32:57 +00:00
Nicolò Pretto
f1194b2494 remove enum from step_number on setup event schema (#40456) 2024-03-25 09:25:49 +01:00
Eric Jensen
13df79cd1c Include postgresql tables that are visible through column grants instead of full table grants for simple questions (#40034)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-03-25 09:15:57 +01:00
Ngoc Khuat
4e9d14b19c Postgres: Sync table row count (#39494) 2024-03-25 07:55:54 +00:00
Ngoc Khuat
6176fe4d8f Homebrew getTables for postgres (#39670) 2024-03-25 04:36:05 +00:00
adam-james
3133edce33 Funnel Chart Static-Viz should handle row data more robustly (#40114)
* Funnel Chart Static-Viz should handle row data more robustly

The row data coming into the funnel chart render method can evidently have a few slightly different shapes, and may
need to be 'coordinated' with the :funnel.rows key from viz-settings (names and order are specified there).

This is a WIP to make the method more robust to different row data shapes. For example:

[[1 100] [2 200]] should work as well as [["A" 100] ["B" 200]] and correctly handle the viz-settings

WIP because I need to add a test or two, try to get a handle on the exact schema that is allowed for 'row shape' and
the funnel.row viz key, and see if there are failing cases that I haven't considered yet.

* Funnel rows should now work more effectively with possible raw-rows

* Add a test that checks the success of the render and correct order

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>

* Addressing feedback from the review

 - renamed build-funnel-rows to funnel-rows
 - used 'funnel-viz' as the binding for the {:key "asdf" :name "asdf" :enabled true} maps from the viz settings
 - added docstring to the function to try clarify its 2 branches (keys vs indices on the rows)

---------

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-03-22 21:15:32 +00:00
Alexander Polyankin
ea498e809b Migrate filter field values to RTK (#40515) 2024-03-22 20:35:49 +00:00
Alex Yarosh
79c947d45c [docs] mention reordering on charts (#40409)
* note about reorder

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-03-22 14:17:12 -06:00
Alexander Solovyov
e2dd8a8a44 fix t2.hydrate import in dev (#40508) 2024-03-22 19:25:25 +02:00
adam-james
aab6657198 Trend Chart Viz Should Use Proper Card execute in Rendering (#40464)
* Trend Chart Viz Should Use Proper Card execute in Rendering

WIP

Fixes: #39854

The trend chart follows a code path shared with multi-series static-viz. This means there was an implicit expectation
that a dashcard is associated with the card at all times. This isn't true for alerts, so the code is fixed to remove
the failure.

* Add a test

* add missed :breakout that actually made the test work

oops

* Adding comments to try clarify what's going on
2024-03-22 09:24:09 -07:00
Denis Berezin
b4fa0de3c0 Global to local css migration - form (#40133)
* Migrate form.module.css

* Self review fixes
2024-03-22 14:34:27 +00:00
Nick Fitzpatrick
fbcd986ce2 Command palette/main (#39268)
* Command Palette

* small adjustments

* unit tests for results

* removing dupe component

* removing unneeded webpack config

* fix linting issue

* fixing scroll behavior for settings

* moving search results message, adding embedding e2e test

* unit tests for palette utils
2024-03-22 14:16:12 +00:00
Cal Herries
1409c7bdf4 Skip mysql for rollback test: add-join-alias-to-visualization-settings-field-refs-test (#40505) 2024-03-22 15:58:18 +02:00
Oisin Coveney
2f7952b5f6 Convert calendar.module.css to CSS Modules (#40353) 2024-03-22 15:40:46 +02:00
Cal Herries
68625a4fad Relax public action execution throttler to allow 10 requests every second (#40465) 2024-03-22 13:29:24 +00:00
Oisin Coveney
99f2595570 Convert overflow.module.css to modules (#40498) 2024-03-22 15:05:03 +02:00
Ngoc Khuat
c772c0ae89 Redshfit: sync tables with partial select permission (#40421) 2024-03-22 12:20:14 +00:00
Cal Herries
060e6d466b Add back describe-database test coverage for redshift (#40446) 2024-03-22 14:15:32 +02:00
Oisin Coveney
f2960b1f1b Convert flex.module.css to CSS modules (#40457) 2024-03-22 14:07:03 +02:00
Chris Truter
e861d18bb6 Basic version of CSV replacement, with only basic testing (#40363) 2024-03-22 11:40:49 +00:00
Ngoc Khuat
1e759755c0 move the detect n+1 hydration to dev ns (#40486) 2024-03-22 07:58:31 +00:00
Kamil Mielnik
c6cd140efb Refactor types in CollectionPicker (#40377)
* Generic types

* Generic types

* Generic types + make generateKey a prop

* Generic types

* Extract AutoScrollBox.styled.tsx

* Move AutoScrollBox to a separate directory

* Generic types

* Generic types

* Generic types

* Unhookify searchFilter

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Finish dealing with a cast

* Destructure import

* Inline type

* Generic types

* Remove cast

* Remove commented code

* Remove redundant fallback

* Move CollectionPicker out of EntityPicker

* Avoid as unknown

* Remove TODOs

* Rename TisFolder to IsFolder

* Fix any

* Fix anys

* Remove NestedItemPicker's storybook

* Remove a cast

* Remove a cast

* Remove a cast

* Revert "Remove a cast"

This reverts commit b762d0f076.

* Use extends SearchModelType instead of extends string everywhere

* Revert "Use extends SearchModelType instead of extends string everywhere"

This reverts commit 708190d63e.

* Fix SearchResult["available_models"] type
2024-03-22 13:53:56 +07:00
Ngoc Khuat
a03dd0955b Detect N+1 hydration and throw an exception (#40272) 2024-03-22 02:27:08 +00:00
Alex Yarosh
b277fcc701 [docs] Organize and add undocumented custom expressions (#40050)
* sort expression functions by use case

* custom expression edits

* formatting cleanup

* fix link

* Apply suggestions from code review

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

* address comments

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-03-21 17:39:11 -06:00
Nick Fitzpatrick
21ec7d6850 correcting input ref on ListSearchField (#40453) 2024-03-21 18:21:59 -03:00
Nick Fitzpatrick
ca83975013 40232 sortable with popovers (#40378)
* custom sensor

* e2e test, moving sortable

* e2e test adjustment

* combining props
2024-03-21 18:21:37 -03:00
bryan
5c946b30c2 Often SLO won't be setup on the IdP but we should still delete the session. (#40459)
* Often slo won't be setup, but we should still delete the session

* test that we delete the session even when "/handle_slo" is not called

* cleanup test

* take the cookie from the session, not as a parameter
2024-03-21 20:38:11 +00:00
Nemanja Glumac
ca82de8137 Remove the aggregation item tooltips (#40461)
* Remove the aggregation item tooltips

* Fix relevant unit test
2024-03-21 19:18:04 +01:00
Tim Macdonald
017afe5bfa Git-ignore all Marginalia-generated docs (#40458) 2024-03-21 14:02:36 -04:00
John Swanson
defd5cee28 /api/collection/:id/items gets here and below (#40203)
* /api/collection/:id/items gets `here` and `below`

During postprocessing of `collection` children retrieved by
`/api/collection/:id/items`, annotate each of the children with `below`
and `here` keys representing the presence of questions, models, or
collections at this level of the hierarchy or below it.

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-03-21 09:54:14 -07:00
Alexander Polyankin
6e81c48abc Cleanup can-save (#40448) 2024-03-21 15:46:32 +00:00
Denis Berezin
6be91c5a36 Embedding SDK - add CORS header for API endpoints (#40394)
* Add CORS solution for SDK

* Review fixes

* Linter fixes
2024-03-21 18:46:16 +03:00
Kyle Doherty
b2bc74fafa Small bit of api doc styling (#40443)
* tweak styling to better match MB

* add Lato as rapidoc font

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-03-21 11:25:28 -04:00
adam-james
104f18ccaf Formatter Gives correct year for dates near start/end of Year (#40410)
Fixes: #40306

Our datetime formatter relies on the `java-time.api`, for which there are many different, sometimes confusing, formatter patterns: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#appendPattern-java.lang.String-

In this case, 'YYYY' is a week-of-year style year, which calculates which week a date falls into before returning the
year. Sometimes days near the start/end of a year will fall into a week in the wrong year.

For example, apparently 2023-12-31 falls into the 1st week of 2024, which probably not the year you'd expect to
see. What we probably do want is 'yyyy' which calculates what day of the year the date is and then returns the year
based off of that instead of the week number.

For an explanation, you can check out this SO answer: https://stackoverflow.com/a/46395342 provides an explanation.
2024-03-21 08:09:17 -07:00
Alexander Polyankin
f41cd82f5b Fix missing columns after query fields update (#40398) 2024-03-21 15:07:41 +00:00
Oisin Coveney
3690baaf6f Convert animation.module.css to CSS modules (#40228) 2024-03-21 14:25:30 +00:00
Mahatthana (Kelvin) Nomsawadi
63ba56fdf0 Fix flaky whitelabel test (#40441)
* Fix flaky whitelabel test

* Update another test for `landing-page`
2024-03-21 14:16:06 +00:00
Oisin Coveney
bf43aa2162 Convert arrow.module.css to CSS Modules (#40289) 2024-03-21 16:04:15 +02:00
Alexander Polyankin
850024ac6d Fix models utils using mbql directly (#40438) 2024-03-21 15:39:17 +02:00
Jeff Bruemmer
17c7d1c6af add 49.1 to list of releases (#40439) 2024-03-21 08:59:28 -04:00
Raphael Krut-Landau
c06291d657 Restore logo margin (#40417) 2024-03-21 06:31:23 -04:00
Abed Habli
3f42b5ac09 adding a new section "How x-ray works" (#40248)
Thanks, Jeff and Alex!
2024-03-21 10:41:49 +01:00
Ngoc Khuat
0eb75595bd Fix N+1 in checking write permission for collection (#40345) 2024-03-21 16:07:51 +07:00
Cal Herries
c1cfdd9f37 Revive flaky redshift tests (#40391) 2024-03-21 08:36:35 +00:00
Alexander Polyankin
fc8711b727 Filter operator defaults (#40352) 2024-03-21 10:30:12 +02:00
Mahatthana (Kelvin) Nomsawadi
5cee34ede5 Add data-display/Image to "metabase/ui" (#40373)
* Add data-display/Image to "metabase/ui"

* Add `position` API to accompany `fit` API

* Feedback: Make file name consistent with the codebase
2024-03-21 08:03:33 +00:00
Alexander Polyankin
00341d07a4 Add tests (#40423) 2024-03-21 10:01:07 +02:00
Cam Saul
0a15637f13 Rename metabase.mbql to metabase.legacy-mbql (#40158)
* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Rename `metabase.mbql` to `metabase.legacy-mbql`

* Fix Kondo warnings

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* Fix import

* Another fix 🔧

* Merge

* FIXES

* Add another missing REQUIRE
2024-03-21 05:38:41 +00:00
Chris Truter
b4949f7c82 Restore lost csvupload snowplow schema (#40277) 2024-03-21 04:52:20 +00:00
Cam Saul
efffd5898d E2E support for CRUD + running pMBQL queries; new MLv2 normalization [WIP] (#39969)
* E2E support for CRUD + running pMBQL queries; new MLv2 normalization

* More work on improved normalization

* Update schema references

* Test fixes 🔧

* Move the MBQL parameters schema

* Performance improvements

* Improved pivot code etc.

* Clean namespaces

* Fixes 🔧

* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Split pivot stuff off

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* Test fix

* Another fix

* Test fix 🔧
2024-03-21 01:16:11 +00:00
bryan
bcda846895 Feature branch for airgap-token: Milestone 1 (#39733)
* decrypt and read values from airgap token

- Adds notion of "AirgapToken"
- Adds max-users and company optional fields to `TokenStatus`
- Adds branch to `fetch-token-status*` for handling airgapped tokens

* Add support for handling airgap tokens

- validate airgap token valid-thru date

* enforce user creation limits using airgap token

* fix airgap token reads + fill in the token data

* in oss mode don't try to read the airgap_ token

* use airgap-token? helper

* tighten the user-creation logic

- make the check correct
- account for archived users

Co-authored-by: John Swanson <john.swanson@metabase.com>

* check airgap user count

setting premium-embedding-token
app startup

* move decryption code into ee namespace

* add some tests for token decryption

* fix tests and add tests

* move ee features into ee tests

* add typehint + warn on reflection

* add a check for missing public key resource

* respond to review

- add docstring to AirgapToken
- remove outdated comment
- fix off-by-1 error

* valid-now? takes a TokenStatus instead of a :map

* revert usage of mt/with-temporary-setting-values

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-03-20 15:31:25 -06:00
Ryan Laurie
61a2a60e21 RTKQuery integration: login history (#39273)
* wip

* refreshes list through tag invalidation rather than prop drilling refresh list fn

* invalidate count, added invalidation utils, general clean up

* custom fetcher that makes use of our api service

* reorganizes files and impls util to createEntityApis more easily

* documents different approaches

* moves main file

* wip

* stash

* clean up

* further clean up

* type annotations clean up

* fixes api key unit test

* pull out api keys feature from branch

* moves files core rtkquery files into metabase/api

* replace trivial loginHistory entity

* export hook too

* fix rebase

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-03-20 15:15:08 -06:00
Alex Yarosh
01a1d4cb06 [docs] better surface docker compose (#40407)
* surfacing docker compose

* Update docs/installation-and-operation/running-metabase-on-docker.md

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-03-20 15:13:32 -06:00
Jeff Bruemmer
58b667d9bc docs - mb_no_surveys (#40400) 2024-03-20 17:04:59 -04:00
Anton Kulyk
9f4e9137ec Fix a flaky test in revision history suite (#40359)
* Clean up test

* Fix race condition

* Wait for GET dashboard + for sidebar to close

* Add wait

* Add a sad comment
2024-03-20 21:02:23 +00:00
bryan
61cacd7faf Windows doesn't know what a UnixPath is: use Path (#40384) 2024-03-20 20:27:23 +00:00
Raphael Krut-Landau
7216c2ed91 Accommodate wide icons in nav and admin nav (#40386) 2024-03-20 19:58:29 +00:00
Cal Herries
cd1de02f9b Fake test dataset isolation for redshift (#40310) 2024-03-20 21:57:04 +02:00
Denis Berezin
43fbe75e3b Global to local css migration - Query Builder, Dashboard (#40106)
* Global styles refactor

* Add missing test change

* Fix e2e

* Migrate buttons

* Migrate buttons

* Migrate query builder

* Migrate dashcards

* Review fixes

* Review fixes

* Review fixes
2024-03-20 18:42:54 +00:00
Alexander Solovyov
22e3963b2e OpenAPI docs (#40162) 2024-03-20 20:22:36 +03:00
adam-james
49d76b6a3f Autodescribe Question Prompt adjustments (#40319)
In a working meeting, some prompt adjustments were tried. This change felt like the best incremental improvement,
considering feedback from users on stats.

We attempted to guide the LLM to return descriptions that:

 - don't state the chart type as if its *very* important (we can see what it is already, so its not that important)
 - do call out caveats and important specifics as implied by the question's filters, aggregations, and breakouts
 - are descriptive but not verbose
 - try not to state caveats too strongly
2024-03-20 10:17:05 -07:00
Luis Paolini
caa50d98c6 Add formatted values (#40389) 2024-03-20 14:08:59 -03:00
Alexander Solovyov
4eadd09e70 Fix caching tests flakes (#40379) 2024-03-20 16:36:25 +00:00
Chris Truter
4eea9108d6 Rename load-from-csv to create-from-csv (#40367) 2024-03-20 15:29:01 +00:00
metamben
8e89c578ac Rename metric to legacy-metric (#39232)
* Rename :model/Metric to :model/LegacyMetric
* Rename ::lib.schema.metadata/metric tp ::lib.schema.metadata/legacy-metric
* Rename models.metric/Metric to models.metric/LegacyMetric
* Move /api/metric endpoints to /api/legacy-metric
2024-03-20 15:03:26 +00:00
Nick Fitzpatrick
841d902b43 SettingsSetting to Functional Component (#40318)
* SettingsSetting FC, change to named export

* adding unit test
2024-03-20 11:53:17 -03:00
Nemanja Glumac
703ee9ec78 Expand and explain the NativeQueryForm type (#40358) 2024-03-20 14:24:58 +00:00
Nemanja Glumac
9a60d3949d Update dataset RTKQuery API (#40356)
* Rename api to just `dataset`

We're going to use this api for both structured and native endpoints.

* Fix the input type
2024-03-20 15:07:21 +01:00
Alexander Solovyov
4f04b6b18c Caching: new strategies and configuration API (#38400) 2024-03-20 15:22:45 +03:00
Nick Fitzpatrick
4a7903dd53 Moving new item modals to be global (#40315)
* moving new item modals to be global

* adjusting unit tests
2024-03-20 09:19:06 -03:00
Nemanja Glumac
6473241a24 Prevent QB header from jumping between modes (#40335) 2024-03-20 12:18:52 +00:00
Alexander Polyankin
4c0d0ea8b4 Fix UX for picking multiple values in filters (#40278) 2024-03-20 12:18:18 +00:00
Oisin Coveney
25bac882cf Convert inputs.module.css to CSS Modules (#40163) 2024-03-20 11:53:31 +02:00
Oleg Gromov
37b4269d1b Fix: allow running native queries with required parameters and no defaults (#40288) 2024-03-20 09:48:41 +00:00
Nemanja Glumac
2ad88d074b Rename QueryViewNotebook to NotebookContainer (#40316)
* Use Mantine Flex for the NotebookContainer

* Rename the component to `NotebookContainer`

* Convert to TS

* Explain the delay

* Use regular div

* Destructure the import type

* Simplify styling

* Shorten the prop name to `isOpen`
2024-03-20 09:40:06 +00:00
Nicolò Pretto
0ea451bfc1 v2 of minimal embed homepage (#40168)
* v2 of minimal embed homepage

* useState instead of useMemo, fix unit tests

* address pr feedback
2024-03-20 09:19:56 +01:00
Ngoc Khuat
2f816f1812 Convert simple hydration to batched hydration (#40217) 2024-03-20 12:36:32 +07:00
Ngoc Khuat
0e17e3b581 Redshift and Oracle test sync: do not use hack (#40052) 2024-03-20 05:08:10 +00:00
Ryan Laurie
bc88692513 RTKQuery Implementation: AuditInfo (#39266)
* use rtk for auditInfo

* destructured hook export

* fix rebase

* remove unused services definition
2024-03-19 23:15:57 +00:00
Sloan Sparger
6212151bec Split setup process into atomic stages (#39287) 2024-03-19 18:13:45 -05:00
Ryan Laurie
835a4495f7 Handle double escape in entityPicker (#40151)
* handle double escape in entityPicker

* escape key test

* use fancy hook
2024-03-19 22:53:15 +00:00
Jeff Bruemmer
c69e08faf7 add 48.9 to list of releases (#40324) 2024-03-19 16:00:03 -04:00
Jesse Devaney
4c28763287 Fix null values being applied to filters with click behavior custom URL links (#40023)
* do not pass null values to link url

* update null check to include query builder nulls replaced with "(empty")

* add test to verify behavior

* replace magic string with constant

* fix breakout in cypress spec
2024-03-19 19:33:14 +00:00
Nemanja Glumac
e7e35973ef createNativeDataset API using RTK query (#40286) 2024-03-19 20:21:51 +01:00
Chris Truter
af6cbeb8a0 Preserve sign on parenthesized zero floats when parsing (#40309) 2024-03-19 18:46:47 +00:00
Braden Shepherdson
18701ae3c6 [MLv2] Allow any arithmetic sub-clauses in an aggregation (#40259)
This issue was previously punted, because the schema for aggregation
clauses allowed the tag to be `:any`. Now it's a short list of permitted
arithmetic expressions, but that list is too short and excludes things
like `:round`.

This change searches for an aggregation clause transitively in the
expression, and so allows any arithmetic expression.
2024-03-19 18:45:18 +00:00
Chris Truter
30bbf73392 Fix float-to-int type coercion for CSV appends (#40275) 2024-03-19 17:47:00 +00:00
Cal Herries
84735b5571 Revert "Revert updating FKs during metadata sync (#39679) (#39924)" (#40233) 2024-03-19 18:59:05 +02:00
Cal Herries
f2e8df68a3 Fix flaking tests using mt/with-temp-copy-of-db (#40291) 2024-03-19 18:37:43 +02:00
Alexander Polyankin
17f960c0d0 Dimension field error handling (#40300)
* Add try-catch in Dimension.field()

* Fix the bug

* Fix the bug

* Fix the bug
2024-03-19 18:34:29 +02:00
Kamil Mielnik
80effffd0a Fix e2e search tests running out of memory (#40294)
* Move search-related snowplow tests to a separate file

* Update test names

* Move filters-related search tests to a separate file

* Extract search helpers into a separate file

* Revert test rename
2024-03-19 15:55:17 +00:00
Oisin Coveney
71ff518a2e Convert AdminPaneLayout and AdminPaneTitle to TS (#40285) 2024-03-19 17:34:14 +02:00
Ryan Laurie
ec847fd6be RTK Implementation: store/billing info API (#39270)
* use rtk query for billing info
2024-03-19 15:03:35 +00:00
Ryan Laurie
6e48b65512 Remove instance settings from error diagnostics (#40245) 2024-03-19 07:58:57 -06:00
Ryan Laurie
8768079543 Diagnostic Modal Updates (#40149)
* capture more frontend errors

* improve fallback error experience
2024-03-19 07:53:21 -06:00
Oisin Coveney
5b63015ef1 Convert admin.module.css to CSS modules (#40081) 2024-03-19 14:08:31 +02:00
Kamil Mielnik
08f8952a68 [E2E] Refactor question commands to function helpers (#40236)
* Extract question function helpers

* Move question helpers

* Remove cy.archiveQuestion

* Replace cy.createQuestion usages in TS files

* Format code in JSDocs
2024-03-19 18:36:35 +07:00
Alexander Polyankin
e2bcb38c9a Compose dataset mbql follow-ups (#40281)
* Fix comment

* Try removing Visualization hack for composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion
2024-03-19 13:26:04 +02:00
Chris Truter
99758685e9 Log warnings when we redact database details (#39638) 2024-03-19 09:38:02 +00:00
Alexander Solovyov
f38617d179 uncomment migration tests (#40230)
mysql seems to have stopped flaking on them
2024-03-19 12:28:04 +03:00
Alexander Polyankin
448a4f3dca Migrate composeDataset and composeThisQuery to MBQL lib (#40181) 2024-03-19 11:10:45 +02:00
Nemanja Glumac
51a20b15f6 SQL in a sidebar prep: NativeQueryPreview component (#40268)
* Export named `NativeCodePanel`

* Export named `NativeQueryModal`

* Rename `NativeQueryModal` to `NativeQueryPreview`

* Do not use styled components in the `NativeQueryPreview`
2024-03-19 09:46:32 +01:00
Alexander Polyankin
41c9c50120 Fix dnd clause composition (#40274) 2024-03-19 08:07:12 +00:00
Denis Berezin
2fd5d6ebef Global to local css migration - grabber (#40007) 2024-03-18 22:12:00 +00:00
Braden Shepherdson
15a411c241 [MLv2] Support Extract to get the domain from emails (#40200)
Milestone 3 of #38964.
2024-03-18 22:02:05 +00:00
John Swanson
918878ebd2 return collections in same order from /api/collections/tree and /api/collections/:id/items (#40044)
There were two problems here:

- one endpoint was sorting in the database, but not putting 'analytics'
last.

- one endpoint was sorting in the database, but then sorting again in
clojure, which had subtly different behavior for special characters

Fixes #39965
2024-03-18 14:12:32 -07:00
Case Nelson
341e4b4c60 Fix time-interval-expression-test flake (#40253) 2024-03-18 14:29:32 -06:00
adam-james
fef2e75d3c Lock :display when using 'zoom' in Dashboard (#38496)
* Use proper :display when using 'zoom' in Dashboard

Fixes: #38307

WIP, I want to change at a different call site so that defaults are still used in case there is no :display set.

* Lock Display so that drill through doesn't overwrite it with defaults

* Lock display only when drill action coming from a dashboard

* Use isDashboard properly

* Add test to confirm Display is locked from Dashboards

* minor changes to the test

* Lock Display specifically for zoom-in-binning and timeseries

* Fix wrong string quotes

* Try a simple change to see if the e2e test will pass in CI

* Fix test

* Minor refactor

* Wait for dashcard queries in e2e test

* Wait for loading spinner to be gone

* Fix type errors

* Fix incorrect dashboard ID used in test

---------

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-03-18 13:24:59 -07:00
Chris Truter
a767fd31c9 Support appending new CSV fields (#39951) (#40220) 2024-03-18 18:21:45 +00:00
Braden Shepherdson
7a4918d062 [MLv2] Support Extract action for (sub)domains from URLs (#40188)
Milestone 2 of #38964.
2024-03-18 18:02:49 +00:00
Sloan Sparger
b04e1a3568 RTKQuery integration: API Keys (#40043) 2024-03-18 11:59:27 -05:00
Chris Truter
6710930a62 Publish snowplow events on CSV append success / failure (#39944) 2024-03-18 16:16:56 +00:00
Cal Herries
ad9016f938 Comment out failing time-interval-expression-test (#40238) 2024-03-18 14:41:51 +00:00
Nemanja Glumac
936e38a10a E2E test coverage for "Highlight the selected data source in the notebook editor" project (#40199)
* Add the initial test for the empty app db

* Add reproduction for #25142

* Add test that covers only saved questions

* Cover scenarios with a table as a source

* Add tests that cover nested questions and models

* Add test for simple model's source table

* Remove intercepted schema routes

* Improve assertion

* Fix the test failing on enterprise instance

* Add E2E reproduction for #40223

* Remove superfluous code block

* Avoid casting
2024-03-18 15:28:44 +01:00
Sloan Sparger
ee131b5f71 Upgrade to React 17 (#40144)
* upgrade to react 17

* fix popovers

* upgrade formik to fix types

* fix sso nested form failures

* fix WindowModal failing unit test

* update RowChart test to accommodate changes to event pooling in react 17

* updates input blur change components to use layout effect to ensure input ref is available at the time of unmount

* fixes failing map visualization e2e test
2024-03-18 09:11:34 -05:00
Alexander Polyankin
c98419c9ce Disable saving models without up-to-date result_metadata (#40087) 2024-03-18 13:55:27 +02:00
Oleg Gromov
0f1873f4b3 eslint: Disable testing-library/no-unnecessary-act (#40084) 2024-03-18 11:42:50 +00:00
Nemanja Glumac
6fe41dd437 Provide more room for the "Expected behavior" in bug reports (#40222) 2024-03-18 10:43:29 +01:00
8563 changed files with 1211556 additions and 429097 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,204 +0,0 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]))
(defn- node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(let [resolved (hooks/resolve {:name sexpr})]
(when-not (= :clj-kondo/unknown-namespace (:ns resolved))
(symbol (name (:ns resolved)) (name (:name resolved))))))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(def ^:private white-card-symbols
'#{;; these toucan methods might actually set global values if it's used outside of a transaction,
;; but since mt/with-temp runs in a transaction, so we'll ignore them in this case.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/>!!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; Definitely thread safe
metabase.test.util.dynamic-redefs/patch-vars!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions/perform-action!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.api.public-test/add-card-to-dashboard!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.core/ensure-audit-db-installed!
metabase.db.schema-migrations-test.impl/run-migrations-in-range!
metabase.db.setup/migrate!
metabase.db.setup/setup-db!
metabase.db/migrate!
metabase.db/setup-db!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.email-test/reset-inbox!
metabase.email/send-email!
metabase.models.action/insert!
metabase.models.collection.graph-test/clear-graph-revisions!
metabase.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.models.field-values/create-or-update-full-field-values!
metabase.models.model-index/add-values!
metabase.models.moderation-review/create-review!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.models.permissions/grant-application-permissions!
metabase.models.permissions/grant-collection-read-permissions!
metabase.models.permissions/grant-collection-readwrite-permissions!
metabase.models.permissions/grant-full-data-permissions!
metabase.models.permissions/grant-native-readwrite-permissions!
metabase.models.permissions/grant-permissions!
metabase.models.permissions/revoke-application-permissions!
metabase.models.permissions/revoke-data-perms!
metabase.models.permissions/update-data-perms-graph!
metabase.models.permissions/update-group-permissions!
metabase.models.persisted-info/ready-database!
metabase.models.revision/revert!
metabase.models.setting-test/test-user-local-allowed-setting!
metabase.models.setting-test/test-user-local-only-setting!
metabase.models.setting.cache/restore-cache!
metabase.models.setting/set!
metabase.models.setting/validate-settings-formatting!
metabase.permissions.test-util/with-restored-perms!
metabase.pulse/send-notifications!
metabase.pulse/send-pulse!
metabase.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data/try-to-extract-sample-database!
metabase.setup/create-token!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.sync/sync-database!
metabase.task.index-values/job-init!
metabase.task.persist-refresh/job-init!
metabase.task.persist-refresh/refresh-tables!
metabase.task.persist-refresh/schedule-persistence-for-database!
metabase.task/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-test-data-db!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.integrations.ldap/start-ldap-server!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.util.ssh-test/start-mock-servers!
metabase.util.ssh-test/stop-mock-servers!})
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node}]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
(f form)
(doseq [child (:children form)]
(walk f child)))]
(walk (fn [form]
(when-let [qualified-symbol (node->qualified-symbol form)]
(when (and (not (contains? white-card-symbols qualified-symbol))
(end-with-exclamation? qualified-symbol))
(hooks/reg-finding! (assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`."
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))
node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))

View File

@@ -1,249 +0,0 @@
(ns hooks.clojure.test
(:require [clj-kondo.hooks-api :as hooks]
[clojure.string :as str]))
(def ^:private disallowed-parallel-forms
"Things you should not be allowed to use inside parallel tests. Besides these, anything ending in `!` not whitelisted
in [[allowed-parallel-forms]] is not allowed."
'#{clojure.core/alter-var-root
clojure.core/with-redefs
clojure.core/with-redefs-fn
metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.sandbox.test-util/with-gtaps-for-user!
metabase-enterprise.sandbox.test-util/with-user-attributes
metabase-enterprise.test/with-gtaps!
metabase-enterprise.test/with-gtaps-for-user!
metabase-enterprise.test/with-user-attributes
metabase.actions.test-util/with-actions
metabase.actions.test-util/with-actions-disabled
metabase.actions.test-util/with-actions-enabled
metabase.actions.test-util/with-actions-test-data
metabase.actions.test-util/with-actions-test-data-and-actions-enabled
metabase.actions.test-util/with-actions-test-data-tables
metabase.email-test/with-expected-messages
metabase.email-test/with-fake-inbox
metabase.test.data.users/with-group
metabase.test.data.users/with-group-for-user
metabase.test.persistence/with-persistence-enabled
metabase.test.util.log/with-log-level
metabase.test.util.log/with-log-messages-for-level
metabase.test.util.misc/with-single-admin-user
metabase.test.util/with-all-users-permission
metabase.test.util/with-column-remappings
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-column-remappings
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.query-processor.store/store-database!})
(defn- node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(when-let [resolved (hooks/resolve {:name sexpr})]
(symbol (name (:ns resolved)) (name (:name resolved)))))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(defn- warn-about-disallowed-parallel-forms [form]
(letfn [(error! [form message]
(hooks/reg-finding! (assoc (meta form)
:message message
:type :metabase/validate-deftest)))
(f [form]
(when-let [qualified-symbol (node->qualified-symbol form)]
(cond
(disallowed-parallel-forms qualified-symbol)
(error! form (format "%s is not allowed inside a ^:parallel test or test fixture" qualified-symbol))
(and (not (allowed-parallel-forms qualified-symbol))
(str/ends-with? (name qualified-symbol) "!"))
(error! form (format "destructive functions like %s are not allowed inside a ^:parallel test or test fixture. If this should be allowed, add it to the whitelist in .clj-kondo/hooks/clojure/test.clj"
qualified-symbol)))))
(walk [form]
(f form)
(doseq [child (:children form)]
(walk child)))]
(walk form)))
(defn- deftest-check-parallel
"1. Check if test is marked ^:parallel / ^:synchronized correctly
2. Make sure disallowed forms are not used in ^:parallel tests"
[{[_ test-name & body] :children, :as _node}]
(let [test-metadata (:meta test-name)
metadata-sexprs (map hooks/sexpr test-metadata)
combined-metadata (transduce
(map (fn [x]
(if (map? x)
x
{x true})))
(completing merge)
{}
metadata-sexprs)
parallel? (:parallel combined-metadata)
synchronized? (:synchronized combined-metadata)]
(when (and parallel? synchronized?)
(hooks/reg-finding! (assoc (meta test-name)
:message "Test should not be marked both ^:parallel and ^:synchronized"
:type :metabase/validate-deftest)))
;; only when the custom `:metabase/deftest-not-marked-parallel` is enabled: complain if tests are not explicitly
;; marked `^:parallel` or `^:synchronized`. This is mostly to encourage people to mark everything `^:parallel` in
;; places like `metabase.lib` tests unless there is a really good reason not to.
(when-not (or parallel? synchronized?)
(hooks/reg-finding!
(assoc (meta test-name)
:message "Test should be marked either ^:parallel or ^:synchronized"
:type :metabase/deftest-not-marked-parallel-or-synchronized)))
(when parallel?
(doseq [form body]
(warn-about-disallowed-parallel-forms form)))))
(def ^:private number-of-lines-for-a-test-to-be-considered-horrifically-long
200)
(defn- deftest-check-not-horrifically-long
[node]
(let [{:keys [row end-row]} (meta node)]
(when (and row end-row)
(let [num-lines (- end-row row)]
(when (>= num-lines number-of-lines-for-a-test-to-be-considered-horrifically-long)
(hooks/reg-finding! (assoc (meta node)
:message (str (format "This test is horrifically long, it's %d lines! 😱 " num-lines)
"Do you really want to try to debug it if it fails? 💀 "
"Split it up into smaller tests! 🥰")
:type :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests)))))))
(defn deftest [{:keys [node cljc lang]}]
;; run [[deftest-check-parallel]] only once... if this is a `.cljc` file only run it for the `:clj` analysis, no point
;; in running it twice.
(when (or (not cljc)
(= lang :clj))
(deftest-check-parallel node))
(deftest-check-not-horrifically-long node)
{:node node})
;;; this is a hacky way to determine whether these namespaces are required in the `ns` form or not... basically `:ns`
;;; will come back as `nil` if they are not.
(defn- approximately-equal-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.approximately-equal/=?-report}))
'metabase.test-runner.assert-exprs.approximately-equal))
(defn- malli-equals-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.malli-equals/malli=-report}))
'metabase.test-runner.assert-exprs.malli-equals))
(defn- warn-about-missing-test-expr-requires-in-cljs [{:keys [children], :as _is-node}]
(let [[_is assertion-node] children]
(when (hooks/list-node? assertion-node)
(let [[assertion-symb-node] (:children assertion-node)]
(when (hooks/token-node? assertion-symb-node)
(let [assertion-symb-token (hooks/sexpr assertion-symb-node)
warn! (fn [ns-to-require]
(hooks/reg-finding!
(assoc (meta assertion-symb-node)
:message (format "You must require %s to use %s in ClojureScript"
ns-to-require
assertion-symb-token)
:type :metabase/missing-test-expr-requires-in-cljs)))]
(condp = assertion-symb-token
'=?
(when-not (approximately-equal-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.approximately-equal))
'malli=
(when-not (malli-equals-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.malli-equals))
nil)))))))
(defn- warn-about-schema= [{[_is assertion-node] :children, :as _is-node}]
(let [{[assertion-symb-node] :children} assertion-node]
(when (and (hooks/token-node? assertion-symb-node)
(= (hooks/sexpr assertion-symb-node) 'schema=))
(hooks/reg-finding! (assoc (meta assertion-symb-node)
:message "Use =? or malli= instead of schema="
:type :metabase/warn-about-schema=)))))
(defn is [{:keys [node lang]}]
(when (= lang :cljs)
(warn-about-missing-test-expr-requires-in-cljs node))
(warn-about-schema= node)
{:node node})
(defn use-fixtures [{:keys [node]}]
(warn-about-disallowed-parallel-forms node)
{:node node})

View File

@@ -1,371 +0,0 @@
(ns hooks.common
(:require [clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
as the current version of kondo will use the whole form by default."
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-node)))))
;;; This stuff is to help debug hooks. Trace a function and it will pretty-print the before & after sexprs.
;;;
;;; (hooks.common/trace #'calculate-bird-scarcity)
(defn- trace* [f]
{:pre [(fn? f)]}
(fn traced-fn [node]
(println \newline)
(clojure.pprint/pprint (hooks/sexpr (:node node)))
(let [node* (f node)]
(println '=>)
(clojure.pprint/pprint (hooks/sexpr (:node node*)))
node*)))
;;; this doesn't seem to work with SCI. Use [[defn-traced]] instead.
;; (defn trace [varr]
;; {:pre [(var? varr)]}
;; (when-not (::traced? (meta varr))
;; (alter-var-root varr trace*)
;; (alter-meta! varr assoc ::traced? true)
;; (println "Traced" varr)))
(defmacro defn-traced
"Replace a hook [[defn]] with this to trace the before and after sexprs."
[fn-name & fn-tail]
`(do
(defn fn# ~@fn-tail)
(def ~fn-name (trace* fn#))))
;;;; Common hook definitions
(defn do*
"This is the same idea as [[clojure.core/do]] but doesn't cause Kondo to complain about redundant dos or unused values."
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(for [arg args]
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(with-meta (meta node)))]
{:node node*}))
(defn with-one-binding
"Helper for macros that have a shape like
(my-macro [x]
...)
=>
(let [x nil]
...)
Binding is optional and `_` will be substituted if not supplied."
[{{[_ {[x] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-bindings
"Helper for macros that have a shape like
(my-macro [x y]
...)
=>
(let [x nil, y nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-three-bindings
"Helper for macros that have a shape like
(my-macro [x y z]
...)
=>
(let [x nil, y nil, z nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y z] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)
(or z (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-four-bindings
"Helper for macros that have a shape like
(my-macro [a b c d]
...)
=>
(let [a nil, b nil, c nil, d nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-five-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-six-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-seven-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f g]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil, g nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f g] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)
(or g (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-one-top-level-binding
"Helper for macros that have a shape like
(my-macro x
...)
=>
(let [x nil]
...)"
[{{[_ x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-top-level-bindings
"Helper for macros that have a shape like
(my-macro x y
...)
=>
(let [x nil, y nil]
...)"
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)
y (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn let-one-with-optional-value
"This is exactly like [[clojure.core/let]] but the right-hand side of the binding, `value`, is optional, and only one
binding can be established.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {[binding value] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[binding (or value (hooks/token-node 'nil))])
body))]
{:node node*}))
(defn- let-second-inner [body bindings]
(let [binding-infos (for [[model {[binding value] :children}] (partition 2 bindings)]
{:model model
:binding binding
:value (or value
(hooks/token-node 'nil))})]
(-> (hooks/vector-node
[(hooks/vector-node (map :model binding-infos))
(-> (hooks/list-node (list* (hooks/token-node `let)
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(with-meta (meta body)))])
(with-meta (meta body)))))
(defn let-second
"Helper for macros that have a shape like
(my-macro x [y]
...)
where the let is for second arg.
=>
(let [y nil]
...)"
[{:keys [node]}]
(let [[_ first-arg-ref binding+opts & body] (:children node)]
{:node (let-second-inner body [first-arg-ref binding+opts])}))
(defn let-with-optional-value-for-last-binding
"This is exactly like [[clojure.core/let]] but the right-hand side of the *last* binding, `value`, is optional.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {bindings :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
(into []
(comp (partition-all 2)
(mapcat (fn [[binding value]]
[binding (or value (hooks/token-node 'nil))])))
bindings))
body))]
{:node node*}))
(defn with-ignored-first-arg
"For macros like
(discard-setting-changes [setting-1 setting-2]
...)
=>
(do ...)
where the first arg ought to be ignored for linting purposes."
[{{[_ _x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'do)
body))]
{:node node*}))
(defn with-used-first-arg
"For macros like
(with-drivers (filter pred? some-drivers)
...)
=>
(let [_1234 (filter pred? some-drivers)]
...)
where the first arg should be linted and appear to be used."
[{{[_ arg & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
{:node node*}))

View File

@@ -1,29 +0,0 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common :as common]))
(defn route-fn-name
"route fn hook"
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defn defendpoint
"defendpoint hook"
[{:keys [node]}]
(let [[method route & body] (rest (:children node))]
{:node
(hooks/vector-node [;; register usage of compojure core var
(common/with-macro-meta (hooks/token-node (symbol (str "compojure.core")
(str method)))
node)
;; define function with route-fn-name
(hooks/list-node
(list* (common/with-macro-meta (hooks/token-node 'clojure.core/defn)
node)
(route-fn-name (hooks/sexpr method) (hooks/sexpr route))
body))])}))

View File

@@ -1,68 +0,0 @@
(ns hooks.metabase.mbql.schemas.macros
(:require [clj-kondo.hooks-api :as hooks]))
(defn- unwrap-defclause-clause-name
"The `clause-name-form` can be either a plain symbol, or a vector like `[var-name mbql-clause-name]`. For the vector
form, we are only interested in the `var-name`. For a plain symbol, the two names are the same. Return a token node."
[clause-name-form]
(-> (if (hooks/vector-node? clause-name-form)
(first (:children clause-name-form))
clause-name-form)
(with-meta (meta clause-name-form))))
(defn- collect-defclause-body-schemas
"Collect the argument schemas in the body of a `defclause` form into a vector node.
The body is a sequence of <argument-name> <argument-schema> pairs. We can ignore the argument names.
<argument-schema> can optionally be wrapped be `(optional ...)` or `(rest ...)`... we can ignore these."
[arg-specs]
(hooks/vector-node
(for [[_arg-name arg-schema] (partition-all 2 arg-specs)
:let [arg-schema (if (and (hooks/list-node? arg-schema)
('#{optional rest} (hooks/sexpr (first (:children arg-schema)))))
(-> (second (:children arg-schema))
(with-meta (meta arg-schema)))
arg-schema)]]
arg-schema)))
(defn defclause
"e.g.
(defclause [ag:var var] field-or-expression FieldOrExpressionDef)
=>
(def ag:var [FieldOrExpressionDef])"
[{:keys [node]}]
(let [[_defclause clause-name-form & arg-specs] (:children node)]
{:node (-> (hooks/list-node
(list
(hooks/token-node 'def)
(unwrap-defclause-clause-name clause-name-form)
(hooks/string-node "Docstring.")
(collect-defclause-body-schemas arg-specs)))
(with-meta (meta node)))}))
(comment
(defn- defclause* [form]
(hooks/sexpr
(:node
(defclause
{:node
(hooks/parse-string
(with-out-str
(clojure.pprint/pprint
form)))}))))
(defn- x []
(defclause* '(defclause [ag:var var]
field-or-expression FieldOrExpressionDef)))
;; =>
(def ag:var "Docstring." [FieldOrExpressionDef])
(defn- y []
(defclause* '(defclause var
x (some-list-schema)
y (optional FieldOrExpressionDef)
z (rest (some-other-schema)))))
;; =>
(def var "Docstring." [(some-list-schema) FieldOrExpressionDef (some-other-schema)]))

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,5 +1,7 @@
(ns macros.metabase.api.common)
(defmacro define-routes [& args]
(defmacro define-routes
"Macro for api.common/define-routes"
[& args]
`(do (def ~'routes "docstring" nil)
~@args))

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,16 +0,0 @@
(ns macros.metabase.domain-entities.malli)
(defmacro define-getters-and-setters [schema & defs]
`(do
(comment ~schema) ;; Reference the schema
~@(for [[sym _path] (partition 2 defs)]
`(do
(defn ~(vary-meta sym
assoc :export true)
"docs" [_x#] nil)
(defn ~(vary-meta (symbol (str "with-" (name sym)))
assoc :export true)
"docs" [x# _new#] x#)
(defn ~(vary-meta (symbol (str (name sym) "-js"))
assoc :export true)
"docs" [x#] x#)))))

View File

@@ -0,0 +1,9 @@
(ns macros.metabase.models.query-analysis-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
`(let [~(macros.common/ignore-unused 'card-id) 1
~(macros.common/ignore-unused 'table-id) 2
~(macros.common/ignore-unused 'tax-id) 3
~(macros.common/ignore-unused 'total-id) 4]
~@body))

View File

@@ -1,9 +0,0 @@
(ns macros.metabase.models.query-field-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
`(let [~(macros.common/ignore-unused 'card-id) 1
~(macros.common/ignore-unused 'table-id) 2
~(macros.common/ignore-unused 'tax-id) 3
~(macros.common/ignore-unused 'total-id) 4]
~@body))

View File

@@ -0,0 +1,13 @@
(ns macros.metabase.task.setup.query-analysis-setup
(:require [macros.common]))
(defmacro with-test-setup!
"Set up the data required to test the Query Analysis related tasks"
[& body]
`(let [~(macros.common/ignore-unused 'c1) 1
~(macros.common/ignore-unused 'c2) 2
~(macros.common/ignore-unused 'c3) 3
~(macros.common/ignore-unused 'c4) 4
~(macros.common/ignore-unused 'archived) 5
~(macros.common/ignore-unused 'invalid) 6]
~@body))

View File

@@ -1,5 +1,5 @@
(ns macros.metabase.test.persistence)
(defmacro with-persistence-enabled [[persist-fn-sym] & body]
(defmacro with-persistence-enabled! [[persist-fn-sym] & body]
`(clojure.core/let [~persist-fn-sym (fn [])]
~@body))

View File

@@ -0,0 +1,16 @@
(ns macros.metabase.xrays.domain-entities.malli)
(defmacro define-getters-and-setters [schema & defs]
`(do
(comment ~schema) ;; Reference the schema
~@(for [[sym _path] (partition 2 defs)]
`(do
(defn ~(vary-meta sym
assoc :export true)
"docs" [_x#] nil)
(defn ~(vary-meta (symbol (str "with-" (name sym)))
assoc :export true)
"docs" [x# _new#] x#)
(defn ~(vary-meta (symbol (str (name sym) "-js"))
assoc :export true)
"docs" [x#] x#)))))

View File

@@ -0,0 +1,6 @@
(ns macros.metabase-enterprise.advanced-permissions.api.util-test
(:require [macros.common]))
(defmacro with-impersonations! [impersonations-and-attributes-map & body]
`(let [~(macros.common/ignore-unused '&group) ~impersonations-and-attributes-map]
~@body))

View File

@@ -0,0 +1,12 @@
(ns macros.metabase-enterprise.query-reference-validation.api-test
(:require [macros.common]))
(defmacro with-test-setup! [& body]
`(let [~(macros.common/ignore-unused 'card-1) 1
~(macros.common/ignore-unused 'card-2) 2
~(macros.common/ignore-unused 'card-3) 3
~(macros.common/ignore-unused 'card-4) 4
~(macros.common/ignore-unused 'card-5) 5
~(macros.common/ignore-unused 'coll-2) 100
~(macros.common/ignore-unused 'coll-3) 200]
~@body))

View File

@@ -0,0 +1,320 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]))
;;; TODO -- seems silly to maintain different blacklists and whitelists here than we use for the deftest `^:parallel`
;;; checker... those lists live in the Clj Kondo config file
(def ^:private symbols-allowed-in-fns-not-ending-in-an-exclamation-point
'#{;; these toucan methods might actually set global values if it's used outside of a transaction,
;; but since mt/with-temp runs in a transaction, so we'll ignore them in this case.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/>!!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; Definitely thread safe
metabase.test.util.dynamic-redefs/patch-vars!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions/perform-action!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.api.public-test/add-card-to-dashboard!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.core/ensure-audit-db-installed!
metabase.db.schema-migrations-test.impl/run-migrations-in-range!
metabase.db.setup/migrate!
metabase.db.setup/setup-db!
metabase.db/migrate!
metabase.db/setup-db!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.email-test/reset-inbox!
metabase.email/send-email!
metabase.models.action/insert!
metabase.models.collection.graph-test/clear-graph-revisions!
metabase.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.models.field-values/create-or-update-full-field-values!
metabase.models.model-index/add-values!
metabase.models.moderation-review/create-review!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.models.permissions/grant-application-permissions!
metabase.models.permissions/grant-collection-read-permissions!
metabase.models.permissions/grant-collection-readwrite-permissions!
metabase.models.permissions/grant-full-data-permissions!
metabase.models.permissions/grant-native-readwrite-permissions!
metabase.models.permissions/grant-permissions!
metabase.models.permissions/revoke-application-permissions!
metabase.models.permissions/revoke-data-perms!
metabase.models.permissions/update-data-perms-graph!
metabase.models.permissions/update-group-permissions!
metabase.models.persisted-info/ready-database!
metabase.models.revision/revert!
metabase.models.setting-test/test-user-local-allowed-setting!
metabase.models.setting-test/test-user-local-only-setting!
metabase.models.setting.cache/restore-cache!
metabase.models.setting/set!
metabase.models.setting/validate-settings-formatting!
metabase.permissions.test-util/with-restored-perms!
metabase.pulse/send-notifications!
metabase.pulse/send-pulse!
metabase.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data/try-to-extract-sample-database!
metabase.setup/create-token!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.sync/sync-database!
metabase.task.index-values/job-init!
metabase.task.persist-refresh/job-init!
metabase.task.persist-refresh/refresh-tables!
metabase.task.persist-refresh/schedule-persistence-for-database!
metabase.task/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-default-dataset!
metabase.test.data.impl.get-or-create/set-test-db-permissions!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.integrations.ldap/start-ldap-server!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.util.ssh-test/start-mock-servers!
metabase.util.ssh-test/stop-mock-servers!})
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node} config]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
(f form)
(doseq [child (:children form)]
(walk f child)))]
(walk (fn [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(when (and (not (contains? symbols-allowed-in-fns-not-ending-in-an-exclamation-point qualified-symbol))
(or (end-with-exclamation? qualified-symbol)
(contains? (get-in config [:linters :metabase/validate-deftest :parallel/unsafe]) qualified-symbol)))
(hooks/reg-finding! (assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`. [:metabase/test-helpers-use-non-thread-safe-functions]"
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))
node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang config]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node config))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
(when (and (hooks/list-node? node)
(let [first-child (first (:children node))]
(and (hooks/keyword-node? first-child)
(= (hooks/sexpr first-child) :require))))
node))
(:children ns-form-node)))
(defn- lint-require-shapes [ns-form-node]
(doseq [node (-> ns-form-node
ns-form-node->require-node
:children
rest)]
(cond
(not (hooks/vector-node? node))
(hooks/reg-finding! (assoc (meta node)
:message "All :required namespaces should be wrapped in vectors [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker))
(hooks/vector-node? (second (:children node)))
(hooks/reg-finding! (assoc (meta node)
:message "Don't use prefix forms inside :require [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))
(defn- require-node->namespace-symb-nodes [require-node]
(let [[_ns & args] (:children require-node)]
(into []
;; prefixed namespace forms are NOT SUPPORTED!!!!!!!!1
(keep (fn [node]
(cond
(hooks/vector-node? node)
;; propagate the metadata attached to this vector in case there's a `:clj-kondo/ignore` form.
(vary-meta (first (:children node)) (partial merge (meta require-node) (meta node)))
;; this should also be dead code since we require requires to be vectors
(hooks/token-node? node)
(vary-meta node (partial merge (meta require-node)))
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
args)))
(defn- ns-form-node->ns-symb [ns-form-node]
(some-> (some (fn [node]
(when (and (hooks/token-node? node)
(not= (hooks/sexpr node) 'ns))
node))
(:children ns-form-node))
hooks/sexpr))
(defn- module
"E.g.
(module 'metabase.qp.middleware.wow) => 'metabase.qp"
[ns-symb]
(some-> (re-find #"^metabase\.[^.]+" (str ns-symb)) symbol))
(defn- ignored-namespace? [ns-symb config]
(some
(fn [pattern-str]
(re-find (re-pattern pattern-str) (str ns-symb)))
(:ignored-namespace-patterns config)))
(defn- module-api-namespaces
"Set API namespaces for a given module. `:any` means you can use anything, there are no API namespaces for this
module (yet). If unspecified, the default is just the namespace with the same name as the module e.g.
`metabase.db`."
[module config]
(let [module-config (get-in config [:api-namespaces module])]
(cond
(= module-config :any)
nil
(set? module-config)
module-config
:else
#{module})))
(defn- lint-modules [ns-form-node config]
(let [ns-symb (ns-form-node->ns-symb ns-form-node)]
(when-not (ignored-namespace? ns-symb config)
(when-let [current-module (module ns-symb)]
(let [allowed-modules (get-in config [:allowed-modules current-module])
required-namespace-symb-nodes (-> ns-form-node
ns-form-node->require-node
require-node->namespace-symb-nodes)]
(doseq [node required-namespace-symb-nodes
:let [clj-kondo-ignore (some-> (meta node) :clj-kondo/ignore hooks/sexpr set)]
:when (not (contains? clj-kondo-ignore :metabase/ns-module-checker))
:let [required-namespace (hooks/sexpr node)
required-module (module required-namespace)]
;; ignore stuff not in a module i.e. non-Metabase stuff.
:when required-module
:let [in-current-module? (= required-module current-module)]
:when (not in-current-module?)
:let [allowed-module? (or (= allowed-modules :any)
(contains? (set allowed-modules) required-module))
module-api-namespaces (module-api-namespaces required-module config)
allowed-module-namespace? (or (empty? module-api-namespaces)
(contains? module-api-namespaces required-namespace))]]
(when-let [error (cond
(not allowed-module?)
(format "Module %s should not be used in the %s module. [:metabase/ns-module-checker :allowed-modules %s]"
required-module
current-module
current-module)
(not allowed-module-namespace?)
(format "Namespace %s is not an allowed external API namespace for the %s module. [:metabase/ns-module-checker :api-namespaces %s]"
required-namespace
required-module
required-module))]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/ns-module-checker)))))))))
(defn lint-ns [x]
(lint-require-shapes (:node x))
(lint-modules (:node x) (get-in x [:config :linters :metabase/ns-module-checker]))
x)

View File

@@ -0,0 +1,160 @@
(ns hooks.clojure.test
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]))
(defn- warn-about-disallowed-parallel-forms [form config]
(letfn [(error! [form message]
(hooks/reg-finding! (assoc (meta form)
:message message
:type :metabase/validate-deftest)))
(f [form]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(cond
(contains? (:parallel/unsafe config) qualified-symbol)
(error! form (format "%s is not allowed inside a ^:parallel test or test fixture [:metabase/validate-deftest]" qualified-symbol))
(and (not (contains? (:parallel/safe config) qualified-symbol))
(str/ends-with? (name qualified-symbol) "!"))
(error! form (format "destructive functions like %s are not allowed inside a ^:parallel test or test fixture. If this should be allowed, add it to the whitelist in the Kondo config file [:metabase/validate-deftest]"
qualified-symbol)))))
(walk [form]
(f form)
(doseq [child (:children form)]
(walk child)))]
(walk form)))
(defn- deftest-check-parallel
"1. Check if test is marked ^:parallel / ^:synchronized correctly
2. Make sure disallowed forms are not used in ^:parallel tests"
[{[_ test-name & body] :children, :as _node} config]
(let [test-metadata (:meta test-name)
metadata-sexprs (map hooks/sexpr test-metadata)
combined-metadata (transduce
(map (fn [x]
(if (map? x)
x
{x true})))
(completing merge)
{}
metadata-sexprs)
parallel? (:parallel combined-metadata)
synchronized? (:synchronized combined-metadata)]
(when (and parallel? synchronized?)
(hooks/reg-finding! (assoc (meta test-name)
:message "Test should not be marked both ^:parallel and ^:synchronized"
:type :metabase/validate-deftest)))
;; only when the custom `:metabase/deftest-not-marked-parallel-or-synchronized` is enabled: complain if tests are
;; not explicitly marked `^:parallel` or `^:synchronized`. This is mostly to encourage people to mark everything
;; `^:parallel` in places like `metabase.lib` tests unless there is a really good reason not to.
(when-not (or parallel? synchronized?)
(hooks/reg-finding!
(assoc (meta test-name)
:message "Test should be marked either ^:parallel or ^:synchronized"
:type :metabase/deftest-not-marked-parallel-or-synchronized)))
(when parallel?
(doseq [form body]
(warn-about-disallowed-parallel-forms form config)))))
(defn- deftest-check-not-horrifically-long
[node {:keys [max-length], :as _config}]
(let [{:keys [row end-row]} (meta node)]
(when (and row end-row)
(let [num-lines (- end-row row)]
(when (and max-length
(>= num-lines max-length))
(hooks/reg-finding! (assoc (meta node)
:message (str (format "This test is horrifically long, it's %d lines! 😱 " num-lines)
"Do you really want to try to debug it if it fails? 💀 "
"Split it up into smaller tests! 🥰")
:type :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests)))))))
(defn- ignore? [node error-type]
(when-let [ignores (some-> node meta :clj-kondo/ignore hooks/sexpr)]
(when-let [ignores (cond
(coll? ignores) (set ignores)
(keyword? ignores) #{ignores})]
(contains? ignores error-type))))
(defn deftest-check-no-driver-keywords [node {:keys [drivers], :as _config}]
;; fail fast after we see the first error, where we see one hardcoded driver name there are likely several more and we
;; don't need multiple warnings for a single test.
(letfn [(f [node]
(when (and (hooks/keyword-node? node)
(set? drivers)
(contains? drivers (hooks/sexpr node)))
(hooks/reg-finding! (assoc (meta node)
:message (format "Do not hardcode driver name %s in driver tests! [:metabase/disallow-hardcoded-driver-names-in-tests]"
(hooks/sexpr node))
:type :metabase/disallow-hardcoded-driver-names-in-tests))
::error))
(walk [node]
(cond
(ignore? node :metabase/disallow-hardcoded-driver-names-in-tests)
nil
(= (f node) ::error)
::error
:else
(reduce
(fn [_acc child]
(when (= (walk child) ::error)
(reduced ::error)))
nil
(:children node))))]
(walk node)))
(defn deftest [{:keys [node cljc lang config]}]
;; run [[deftest-check-parallel]] only once... if this is a `.cljc` file only run it for the `:clj` analysis, no point
;; in running it twice.
(when (or (not cljc)
(= lang :clj))
(deftest-check-parallel node (get-in config [:linters :metabase/validate-deftest])))
(deftest-check-not-horrifically-long node (get-in config [:linters :metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests]))
(deftest-check-no-driver-keywords node (get-in config [:linters :metabase/disallow-hardcoded-driver-names-in-tests]))
{:node node})
;;; this is a hacky way to determine whether these namespaces are required in the `ns` form or not... basically `:ns`
;;; will come back as `nil` if they are not.
(defn- approximately-equal-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.approximately-equal/=?-report}))
'metabase.test-runner.assert-exprs.approximately-equal))
(defn- malli-equals-ns-required? []
(= (:ns (hooks/resolve {:name 'metabase.test-runner.assert-exprs.malli-equals/malli=-report}))
'metabase.test-runner.assert-exprs.malli-equals))
(defn- warn-about-missing-test-expr-requires-in-cljs [{:keys [children], :as _is-node}]
(let [[_is assertion-node] children]
(when (hooks/list-node? assertion-node)
(let [[assertion-symb-node] (:children assertion-node)]
(when (hooks/token-node? assertion-symb-node)
(let [assertion-symb-token (hooks/sexpr assertion-symb-node)
warn! (fn [ns-to-require]
(hooks/reg-finding!
(assoc (meta assertion-symb-node)
:message (format "You must require %s to use %s in ClojureScript"
ns-to-require
assertion-symb-token)
:type :metabase/missing-test-expr-requires-in-cljs)))]
(condp = assertion-symb-token
'=?
(when-not (approximately-equal-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.approximately-equal))
'malli=
(when-not (malli-equals-ns-required?)
(warn! 'metabase.test-runner.assert-exprs.malli-equals))
nil)))))))
(defn is [{:keys [node lang]}]
(when (= lang :cljs)
(warn-about-missing-test-expr-requires-in-cljs node))
{:node node})
(defn use-fixtures [{:keys [node config]}]
(warn-about-disallowed-parallel-forms node config)
{:node node})

View File

@@ -0,0 +1,423 @@
(ns hooks.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
as the current version of kondo will use the whole form by default."
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-node)))))
;;; This stuff is to help debug hooks. Trace a function and it will pretty-print the before & after sexprs.
;;;
;;; (hooks.common/trace #'calculate-bird-scarcity)
(defn- trace* [f]
{:pre [(fn? f)]}
(fn traced-fn [node]
(println \newline)
(clojure.pprint/pprint (hooks/sexpr (:node node)))
(let [node* (f node)]
(println '=>)
(clojure.pprint/pprint (hooks/sexpr (:node node*)))
node*)))
;;; this doesn't seem to work with SCI. Use [[defn-traced]] instead.
;; (defn trace [varr]
;; {:pre [(var? varr)]}
;; (when-not (::traced? (meta varr))
;; (alter-var-root varr trace*)
;; (alter-meta! varr assoc ::traced? true)
;; (println "Traced" varr)))
(defmacro defn-traced
"Replace a hook [[defn]] with this to trace the before and after sexprs."
[fn-name & fn-tail]
`(do
(defn fn# ~@fn-tail)
(def ~fn-name (trace* fn#))))
;;;; Common hook definitions
(defn do*
"This is the same idea as [[clojure.core/do]] but doesn't cause Kondo to complain about redundant dos or unused values."
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(for [arg args]
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(with-meta (meta node)))]
{:node node*}))
(defn with-one-binding
"Helper for macros that have a shape like
(my-macro [x]
...)
=>
(let [x nil]
...)
Binding is optional and `_` will be substituted if not supplied."
[{{[_ {[x] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-bindings
"Helper for macros that have a shape like
(my-macro [x y]
...)
=>
(let [x nil, y nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-three-bindings
"Helper for macros that have a shape like
(my-macro [x y z]
...)
=>
(let [x nil, y nil, z nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y z] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)
(or z (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-four-bindings
"Helper for macros that have a shape like
(my-macro [a b c d]
...)
=>
(let [a nil, b nil, c nil, d nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-five-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-six-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-seven-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f g]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil, g nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f g] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)
(or g (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-one-top-level-binding
"Helper for macros that have a shape like
(my-macro x
...)
=>
(let [x nil]
...)"
[{{[_ x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-top-level-bindings
"Helper for macros that have a shape like
(my-macro x y
...)
=>
(let [x nil, y nil]
...)"
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)
y (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn let-one-with-optional-value
"This is exactly like [[clojure.core/let]] but the right-hand side of the binding, `value`, is optional, and only one
binding can be established.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {[binding value] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[binding (or value (hooks/token-node 'nil))])
body))]
{:node node*}))
(defn- let-second-inner [body bindings]
(let [binding-infos (for [[model {[binding value] :children}] (partition 2 bindings)]
{:model model
:binding binding
:value (or value
(hooks/token-node 'nil))})]
(-> (hooks/vector-node
[(hooks/vector-node (map :model binding-infos))
(-> (hooks/list-node (list* (hooks/token-node `let)
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(with-meta (meta body)))])
(with-meta (meta body)))))
(defn let-second
"Helper for macros that have a shape like
(my-macro x [y]
...)
where the let is for second arg.
=>
(let [y nil]
...)"
[{:keys [node]}]
(let [[_ first-arg-ref binding+opts & body] (:children node)]
{:node (let-second-inner body [first-arg-ref binding+opts])}))
(defn let-with-optional-value-for-last-binding
"This is exactly like [[clojure.core/let]] but the right-hand side of the *last* binding, `value`, is optional.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {bindings :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
(into []
(comp (partition-all 2)
(mapcat (fn [[binding value]]
[binding (or value (hooks/token-node 'nil))])))
bindings))
body))]
{:node node*}))
(defn with-ignored-first-arg
"For macros like
(discard-setting-changes [setting-1 setting-2]
...)
=>
(do ...)
where the first arg ought to be ignored for linting purposes."
[{{[_ _x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'do)
body))]
{:node node*}))
(defn with-used-first-arg
"For macros like
(with-drivers (filter pred? some-drivers)
...)
=>
(let [_1234 (filter pred? some-drivers)]
...)
where the first arg should be linted and appear to be used."
[{{[_ arg & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
{:node node*}))
(defn node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(let [resolved (hooks/resolve {:name sexpr})]
(cond
(and resolved (:ns resolved))
(symbol (name (:ns resolved)) (name (:name resolved)))
;; if it wasn't resolved but is still qualified it's probably using the full namespace name rather than an
;; alias.
(qualified-symbol? sexpr)
sexpr)))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(defn format-string-specifier-count
"Number of things like `%s` in a format string, not counting newlines (`%n`) or escaped percent signs (`%%`). For
checking the number of args to something that takes a format string."
[format-string]
(count (re-seq #"(?<!%)%(?![%n])" format-string)))
(comment
;; should be 1
(format-string-specifier-count "%s %%")
;; should be 2
(format-string-specifier-count "%s %%%n%s")
;; should be 0
(format-string-specifier-count "%n%%%%")
;; should be 1
(format-string-specifier-count "%-02d"))
(defn add-lsp-ignore-unused-public-var-metadata
"Add
^{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
metadata to a node to suppress LSP warnings."
[node]
(letfn [(update-ignores [existing-ignores]
(hooks/vector-node
(cons
(hooks/keyword-node :clojure-lsp/unused-public-var)
(:children existing-ignores))))]
(vary-meta node update :clj-kondo/ignore update-ignores)))

View File

@@ -4,8 +4,8 @@
(comment
(def input (hooks/parse-string
"(with-indexed-model [{:keys [model model-index model-index-value]}
{:query :some-query}]
"(with-indexed-model! [{:keys [model model-index model-index-value]}
{:query :some-query}]
:foo :bar :body)"))
(println (hooks/sexpr input))
@@ -13,12 +13,12 @@
(let [f (load-file ".clj-kondo/hooks/metabase/api/automagic_dashboards_test.clj")]
(f {:node input})))
(defn with-indexed-model
(defn with-indexed-model!
[{node :node}]
(let [[_macro-call binding-and-query-info & body] (:children node)
[binding query-info] (:children binding-and-query-info)
node* (hooks/list-node
[(hooks/token-node 'do-with-testing-model)
[(hooks/token-node 'do-with-indexed-model!)
query-info
(hooks/list-node
(list* (hooks/token-node 'fn)

View File

@@ -0,0 +1,47 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]
[hooks.common]))
(defn route-fn-name
"route fn hook"
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defn defendpoint
[arg]
(letfn [(update-defendpoint [node]
(let [[_defendpoint method route & body] (:children node)]
(-> (api/list-node
(list
(api/token-node 'do)
(api/token-node (symbol "compojure.core" (str (api/sexpr method))))
(-> (api/list-node
(list*
(api/token-node 'clojure.core/defn)
(api/token-node (route-fn-name (api/sexpr method) (api/sexpr route)))
body))
(with-meta (meta node)))))
hooks.common/add-lsp-ignore-unused-public-var-metadata)))]
(update arg :node update-defendpoint)))
(comment
(-> {:node (-> '(api/defendpoint POST "/:id/copy"
"Copy a `Card`, with the new name 'Copy of _name_'"
[id]
{id [:maybe ms/PositiveInt]}
(let [orig-card (api/read-check Card id)
new-name (str (trs "Copy of ") (:name orig-card))
new-card (assoc orig-card :name new-name)]
(-> (card/create-card! new-card @api/*current-user*)
hydrate-card-details
(assoc :last-edit-info (last-edit/edit-information-for-user @api/*current-user*)))))
pr-str
api/parse-string)}
defendpoint
:node
api/sexpr))

View File

@@ -0,0 +1,18 @@
(ns hooks.metabase.driver
(:require
[clj-kondo.hooks-api :as api]))
(defn register!
"Register the driver keyword so LSP can jump to it."
[x]
(letfn [(update-driver-keyword [k]
(api/reg-keyword! k 'metabase.driver/register!))
(update-children [[_register! k :as children]]
(if (api/keyword-node? k)
(update (vec children) 1 update-driver-keyword)
children))
(update-node [node]
(if (api/list-node? node)
(update node :children update-children)
node))]
(update x :node update-node)))

View File

@@ -0,0 +1,69 @@
(ns hooks.metabase.legacy-mbql.schemas.macros
(:require
[clj-kondo.hooks-api :as hooks]))
(defn- unwrap-defclause-clause-name
"The `clause-name-form` can be either a plain symbol, or a vector like `[var-name mbql-clause-name]`. For the vector
form, we are only interested in the `var-name`. For a plain symbol, the two names are the same. Return a token node."
[clause-name-form]
(-> (if (hooks/vector-node? clause-name-form)
(first (:children clause-name-form))
clause-name-form)
(with-meta (meta clause-name-form))))
(defn- collect-defclause-body-schemas
"Collect the argument schemas in the body of a `defclause` form into a vector node.
The body is a sequence of <argument-name> <argument-schema> pairs. We can ignore the argument names.
<argument-schema> can optionally be wrapped be `(optional ...)` or `(rest ...)`... we can ignore these."
[arg-specs]
(hooks/vector-node
(for [[_arg-name arg-schema] (partition-all 2 arg-specs)
:let [arg-schema (if (and (hooks/list-node? arg-schema)
('#{optional rest} (hooks/sexpr (first (:children arg-schema)))))
(-> (second (:children arg-schema))
(with-meta (meta arg-schema)))
arg-schema)]]
arg-schema)))
(defn defclause
"e.g.
(defclause [ag:var var] field-or-expression FieldOrExpressionDef)
=>
(def ag:var [FieldOrExpressionDef])"
[{:keys [node]}]
(let [[_defclause clause-name-form & arg-specs] (:children node)]
{:node (-> (hooks/list-node
(list
(hooks/token-node 'def)
(unwrap-defclause-clause-name clause-name-form)
(hooks/string-node "Docstring.")
(collect-defclause-body-schemas arg-specs)))
(with-meta (meta node)))}))
(comment
(defn- defclause* [form]
(hooks/sexpr
(:node
(defclause
{:node
(hooks/parse-string
(with-out-str
(clojure.pprint/pprint
form)))}))))
(defn- x []
(defclause* '(defclause [ag:var var]
field-or-expression FieldOrExpressionDef)))
;; =>
(def ag:var "Docstring." [FieldOrExpressionDef])
(defn- y []
(defclause* '(defclause var
x (some-list-schema)
y (optional FieldOrExpressionDef)
z (rest (some-other-schema)))))
;; =>
(def var "Docstring." [(some-list-schema) FieldOrExpressionDef (some-other-schema)]))

View File

@@ -1,5 +1,7 @@
(ns hooks.metabase.models.interface
(:require [clj-kondo.hooks-api :as hooks]))
(:require
[clj-kondo.hooks-api :as hooks]
[hooks.common]))
(defn define-hydration-method
"This is used for both [[metabase.models.interface/define-simple-hydration-method]] and
@@ -14,5 +16,6 @@
(hooks/token-node 'defn)
fn-name
fn-tail))))
(with-meta (update (meta node) :clj-kondo/ignore #(hooks/vector-node (cons :clojure-lsp/unused-public-var (:children %))))))]
(with-meta (meta node))
hooks.common/add-lsp-ignore-unused-public-var-metadata)]
{:node node}))

View File

@@ -38,8 +38,6 @@
engines
enum-cardinality-threshold
follow-up-email-sent
ga-code
ga-enabled
google-auth-auto-create-accounts-domain
google-auth-client-id
google-auth-configured
@@ -92,6 +90,8 @@
metabot-get-prompt-templates-url
metabot-prompt-generator-token-limit
multi-setting-read-only
notebook-native-preview-shown
notebook-native-preview-sidebar-width
notification-link-base-url
num-metabot-choices
openai-api-key
@@ -162,7 +162,6 @@
token-status
toucan-name
uncached-setting
uploads-table-prefix
user-visibility
version
version-info
@@ -182,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))
@@ -243,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
;;
@@ -139,7 +142,7 @@
(when-not ((some-fn symbol? nil?) (hooks/sexpr table))
(hooks/reg-finding! (assoc (meta table)
:message "First arg to mbql-query should be either a table name symbol or nil."
:type ::mbql-query-first-arg)))
:type :metabase/mbql-query-first-arg)))
(let [result (replace-$id-special-tokens query)
;; HACK I'm not sure WHY it works but I ran into https://github.com/clj-kondo/clj-kondo/issues/1773 when
;; trying to get this working -- for some magical reason wrapping the whole thing in a `do` form seems to fix

View File

@@ -0,0 +1,17 @@
(ns hooks.metabase.util
(:require
[clj-kondo.hooks-api :as api]
[hooks.common]))
(defn format-color [{:keys [node], :as x}]
(let [[_format-color _color format-string-node & args] (:children node)]
(when (api/string-node? format-string-node)
(let [expected-arg-count (hooks.common/format-string-specifier-count (api/sexpr format-string-node))
actual-arg-count (count args)]
(when-not (= expected-arg-count actual-arg-count)
(api/reg-finding! (assoc (meta node)
:message (format "metabase.util/format-color format string expects %d arguments instead of %d."
expected-arg-count
actual-arg-count)
:type :format))))))
x)

View File

@@ -0,0 +1,126 @@
(ns hooks.metabase.util.log
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]
[clojure.walk :as walk]
[hooks.common]))
;;;; Checks for both log + logf
(defn- disallow-i18n [node]
(walk/postwalk
(fn [x]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol x)]
(when (and (= (namespace qualified-symbol) "metabase.util.i18n")
(or (str/includes? (name qualified-symbol) "tru")
(str/includes? (name qualified-symbol) "trs")))
(api/reg-finding! (assoc (meta x)
:message "do not i18n the logs!"
:type :metabase/validate-logging)))))
node))
(defn- check-position-of-exception-arg
"Tell people to do (info e \"whatever\") instead of (info \"whatever\" e)."
[node]
(let [[f _first-arg & args] (:children node)]
(doseq [arg args]
(when (and (api/token-node? arg)
(= (api/sexpr arg) 'e))
(api/reg-finding! (assoc (meta arg)
:message (format "pass exceptions as the first arg to %s" (api/sexpr f))
:type :metabase/validate-logging))))))
(defn- common-checks [node]
(check-position-of-exception-arg node)
(disallow-i18n node))
(defn- check-for-i18n-format-specifiers
"Make sure people aren't using things like {0} in their log messages."
[node string-node]
(when (re-find #"\{\d+\}" (api/sexpr string-node))
(api/reg-finding! (assoc (meta node)
:message "this looks like an i18n format string. Don't use identifiers like {0} in logging."
:type :metabase/validate-logging))))
;;; log only
(defn- check-not-format-string
"Make sure we're not using something like log/trace with a format string."
[{[f] :children, :as node} string-node]
(when (pos? (hooks.common/format-string-specifier-count (api/sexpr string-node)))
(api/reg-finding! (assoc (meta node)
:message (format "%s used with a format string, use %s instead."
(api/sexpr f)
(str (api/sexpr f) "f"))
:type :metabase/validate-logging))))
(defn- format-node? [node]
(when (api/list-node? node)
(let [[x] (:children node)]
(and (api/token-node? x)
(or (= (hooks.common/node->qualified-symbol x) 'clojure.core/format)
(= (api/sexpr x) 'format))))))
(defn- warn-against-log+format-instead-of-logf
"Tell people to use things like infof instead of info + format."
[{[f] :children, :as node} [x :as args]]
(when (and (= (count args) 1)
(api/list-node? x))
(when (format-node? x)
(api/reg-finding! (assoc (meta node)
:message (format "Use %s instead of %s + format"
(str (api/sexpr f) "f")
(api/sexpr f))
:type :metabase/validate-logging)))))
(defn info
"Valid log, debug, etc."
[{:keys [node], :as x}]
(common-checks node)
(let [[_f & args] (:children node)
[_e & [x :as args]] (if (and (api/token-node? (first args))
(or (api/string-node? (second args))
(format-node? (second args))))
args
(cons nil args))]
(when (api/string-node? x)
(check-for-i18n-format-specifiers node x)
(check-not-format-string node x))
(warn-against-log+format-instead-of-logf node args))
x)
;;;; logf only
(defn- check-format-string-arg-count
"Make sure the number of args passed to something like tracef match the number of format string specifiers."
[{[f] :children, :as node} format-string args]
(let [expected-arg-count (hooks.common/format-string-specifier-count (api/sexpr format-string))
actual-arg-count (count args)]
(when (zero? expected-arg-count)
(api/reg-finding! (assoc (meta node)
:message (format "Don't use %s with no format string arguments, use %s instead."
(api/sexpr f)
(str/replace (str (api/sexpr f)) #"f$" ""))
:type :metabase/validate-logging)))
(when-not (= expected-arg-count actual-arg-count)
(api/reg-finding! (assoc (meta node)
:message (format "log format string expects %d arguments instead of %d."
expected-arg-count
actual-arg-count)
:type :metabase/validate-logging)))))
(defn infof
"Valid logf, debugf, etc."
[{:keys [node], :as x}]
(common-checks node)
(let [[_f & args] (:children node)
[_e format-string & args] (if (api/string-node? (first args))
(cons nil args)
args)]
;; TODO -- maybe we can error if you did not pass a format string, e.g. (log/infof 1 2) is obviously incorrect.
(when (api/string-node? format-string)
(check-for-i18n-format-specifiers node format-string)
(check-format-string-arg-count node format-string args)))
x)

View File

@@ -0,0 +1,26 @@
(ns hooks.metabase.util.log.capture
(:require
[clj-kondo.hooks-api :as api]))
(defn with-log-messages-for-level [x]
(letfn [(update-binding [[lhs-node _rhs-node]]
[lhs-node (api/list-node
(list
(api/token-node 'clojure.core/fn)
(api/vector-node [])))])
(update-bindings [bindings-node]
(-> (api/vector-node
(into []
(comp (partition-all 2)
(mapcat update-binding))
(:children bindings-node)))
(with-meta (meta bindings-node))))
(update-node [node]
(let [[_with-log-messages-for-level bindings & body] (:children node)]
(-> (api/list-node
(list*
(api/token-node 'clojure.core/let)
(update-bindings bindings)
body))
(with-meta (meta node)))))]
(update x :node update-node)))

View File

@@ -0,0 +1,52 @@
(ns hooks.clojure.test-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.test :refer :all]
[hooks.clojure.test]))
(set! *warn-on-reflection* true)
(defn- deftest-warnings
[form]
(binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/disallow-hardcoded-driver-names-in-tests {:level :warning}}}
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(hooks.clojure.test/deftest {:node (api/parse-string form)
:config {:linters
{:metabase/disallow-hardcoded-driver-names-in-tests
{:drivers
#{:athena}}}}})
(mapv :message @(:findings clj-kondo.impl.utils/*ctx*))))
(deftest ^:parallel disallow-hardcoded-driver-names-in-tests-test
(is (= []
(deftest-warnings
"(mt/test-drivers (mt/normal-drivers)
(do-something))")))
(is (= ["Do not hardcode driver name :athena in driver tests! [:metabase/disallow-hardcoded-driver-names-in-tests]"]
(deftest-warnings
"(mt/test-drivers (mt/normal-drivers)
(when-not (= driver/*driver* :athena)
(do-something)))")))
(testing "make sure :clj-kondo/ignore is propagated correctly"
(is (= []
(deftest-warnings
"(mt/test-drivers (mt/normal-drivers)
#_{:clj-kondo/ignore [:metabase/disallow-hardcoded-driver-names-in-tests]}
(when-not (= driver/*driver* :athena)
(do-something)))")))))
(deftest ^:parallel check-driver-keywords-test
(testing "Make sure we keep hooks.clojure.test/driver-keywords up to date"
(let [driver-keywords (-> (slurp ".clj-kondo/config.edn")
edn/read-string
(get-in [:linters :metabase/disallow-hardcoded-driver-names-in-tests :drivers]))]
(doseq [^java.io.File file (.listFiles (io/file "modules/drivers"))
:when (.isDirectory file)
:let [driver (keyword (.getName file))]]
(is (contains? driver-keywords driver)
(format "hooks.clojure.test/driver-keywords should contain %s, please add it" driver))))))

View File

@@ -0,0 +1,19 @@
(ns ^:mb/once hooks.common-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.test :refer :all]
[hooks.common]))
(deftest ^:parallel node->qualified-symbol-test
(binding [clj-kondo.impl.utils/*ctx* {:namespaces (atom nil)}]
(is (= 'metabase.util.i18n/tru
(hooks.common/node->qualified-symbol (api/parse-string "metabase.util.i18n/tru"))))))
(deftest ^:parallel node->qualified-symbol-test-2
(binding [clj-kondo.impl.utils/*ctx* {:namespaces (atom {:clj {:clj '{hooks.common-test {:qualify-ns {i18n metabase.util.i18n}}}}})
:lang :clj
:base-lang :clj
:ns {:name 'hooks.common-test}}]
(is (= 'metabase.util.i18n/tru
(hooks.common/node->qualified-symbol (api/parse-string "i18n/tru"))))))

View File

@@ -0,0 +1,19 @@
(ns hooks.metabase.util.log.capture-test
(:require
[clj-kondo.hooks-api :as api]
[clojure.test :refer :all]
[hooks.metabase.util.log.capture]))
(deftest ^:parallel with-log-messages-for-level-test
(is (= '(clojure.core/let [messages-1 (clojure.core/fn [])
messages-2 (clojure.core/fn [])]
(concat (messages-1)
(messages-2)))
(-> (hooks.metabase.util.log.capture/with-log-messages-for-level
{:node (-> '(with-log-messages-for-level [messages-1 [my.namespace :debug]
messages-2 :info]
(concat (messages-1) (messages-2)))
pr-str
api/parse-string)})
:node
api/sexpr))))

View File

@@ -0,0 +1,77 @@
(ns ^:mb/once hooks.metabase.util.log-test
(:require
[clj-kondo.hooks-api :as api]
[clj-kondo.impl.utils]
[clojure.string :as str]
[clojure.test :refer :all]
[hooks.metabase.util.log]))
(defn- warnings
[form]
(let [f (if (str/ends-with? (name (first form)) "f")
hooks.metabase.util.log/infof
hooks.metabase.util.log/info)]
(binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/validate-logging {:level :warning}}}
:ignores (atom nil)
:findings (atom [])
:namespaces (atom {})}]
(f {:node (api/parse-string (pr-str form))})
(mapv :message @(:findings clj-kondo.impl.utils/*ctx*)))))
(deftest ^:parallel warn-on-missing-format-args-test
(testing "should fail, missing a format arg"
(are [form] (= ["log format string expects 1 arguments instead of 0."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock was acquired after %d retries.")
(metabase.util.log/warnf e "Migration lock was acquired after %d retries."))))
(deftest ^:parallel warn-on-too-many-format-args-test-1
(testing "should fail, too many format args"
(are [form] (= ["log format string expects 1 arguments instead of 2."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock was acquired after %d retries." 1 2)
(metabase.util.log/warnf e "Migration lock was acquired after %d retries." 1 2))))
(deftest ^:parallel warn-on-too-many-format-args-test-2
(testing "should fail, too many format args"
(are [form] (= ["this looks like an i18n format string. Don't use identifiers like {0} in logging."
"Don't use metabase.util.log/warnf with no format string arguments, use metabase.util.log/warn instead."
"log format string expects 0 arguments instead of 1."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock was acquired after {0} retries." 1)
(metabase.util.log/warnf e "Migration lock was acquired after {0} retries." 1))))
(deftest ^:parallel warn-on-format-args-without-logf-test
(testing "should fail, has format args but is warn rather than warnf"
(are [form] (= ["metabase.util.log/warn used with a format string, use metabase.util.log/warnf instead."]
(warnings (quote form)))
(metabase.util.log/warn "Migration lock was acquired after %d retries." 1)
(metabase.util.log/warn e "Migration lock was acquired after %d retries." 1))))
(deftest ^:parallel warn-on-format-without-logf-test
(testing "should fail, has format args but is warn rather than warnf"
(are [form] (= ["Use metabase.util.log/warnf instead of metabase.util.log/warn + format"]
(warnings (quote form)))
(metabase.util.log/warn (format "Migration lock was acquired after %d retries." 1))
(metabase.util.log/warn e (format "Migration lock was acquired after %d retries." 1)))))
(deftest ^:parallel warn-on-logf-with-no-format-args-test
(testing "should fail, has format args but is warn rather than warnf"
(are [form] (= ["Don't use metabase.util.log/warnf with no format string arguments, use metabase.util.log/warn instead."]
(warnings (quote form)))
(metabase.util.log/warnf "Migration lock cleared.")
(metabase.util.log/warnf e "Migration lock cleared."))))
(deftest ^:parallel warn-on-i18n-test-1
(testing "should fail -- should not use i18n/tru or i18n/trs"
(are [form] (= ["do not i18n the logs!"]
(warnings (quote form)))
(metabase.util.log/warnf (metabase.util.i18n/tru "Migration lock was acquired after {0} retries." 1))
(metabase.util.log/warnf e (metabase.util.i18n/tru "Migration lock was acquired after {0} retries." 1)))))
(deftest ^:parallel warn-on-i18n-test-2
(testing "should fail -- should not use i18n/tru or i18n/trs"
(are [form] (= ["do not i18n the logs!"]
(warnings (quote form)))
(metabase.util.log/warn (metabase.util.i18n/trs "Migration lock was acquired after {0} retries." 1))
(metabase.util.log/warn e (metabase.util.i18n/trs "Migration lock was acquired after {0} retries." 1)))))

View File

@@ -1,31 +1,339 @@
;; https://github.com/weavejester/cljfmt/blob/master/cljfmt/resources/cljfmt/indents/clojure.clj
{:extra-indents
{auto-parse [[:inner 0]]
cond-> [[:inner 0]]
check [[:inner 0]]
deferred-tru [[:inner 0]]
defprotocol+ [[:block 1] [:inner 1]]
potemkin/defprotocol+ [[:block 1] [:inner 1]]
let-404 [[:block 1]]
metabase.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,70 +20,72 @@
(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 '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 'macros/case 0))
(eval . (put-clojure-indent 'match 1))
(eval . (put-clojure-indent 'mbql.match/match 1))
(eval . (put-clojure-indent 'mbql.match/match-one 1))
(eval . (put-clojure-indent 'mbql.match/replace 1))
(eval . (put-clojure-indent 'mbql.match/replace-in 2))
(eval . (put-clojure-indent 'mbql.u/replace 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-drivers 1))
(eval . (put-clojure-indent 'mt/test-driver 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 '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 '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)
(cljr-insert-newline-after-require . t)
(cljr-print-right-margin . 118)
(clojure-docstring-fill-column . 118)
(cider-preferred-build-tool . clojure-cli)
(cider-default-cljs-repl . shadow-select)

200
.eslintrc
View File

@@ -1,200 +0,0 @@
{
"rules": {
"strict": [2, "never"],
"no-undef": 2,
"no-var": 1,
"no-unused-vars": [
"error",
{
"vars": "all",
"args": "none",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"no-empty": [1, { "allowEmptyCatch": true }],
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "moment",
"message": "Moment is deprecated, please use dayjs"
},
{
"name": "moment-timezone",
"message": "Moment is deprecated, please use dayjs"
}
]
}
],
"curly": [1, "all"],
"eqeqeq": [1, "smart"],
"import/no-default-export": 2,
"import/no-named-as-default": 0,
"import/no-commonjs": 1,
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"orderImportKind": "asc",
"caseInsensitive": false
},
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"warnOnUnassignedImports": false
}
],
"no-console": [2, { "allow": ["warn", "error", "errorBuffer"] }],
"react/no-is-mounted": 2,
"react/prefer-es6-class": 2,
"react/display-name": 1,
"react/prop-types": 2,
"react/no-did-mount-set-state": 0,
"react/no-did-update-set-state": 0,
"react/no-find-dom-node": 0,
"react/no-children-prop": 2,
"react/no-string-refs": 2,
"react/no-unescaped-entities": 2,
"react/jsx-no-target-blank": 2,
"react/jsx-key": 2,
"react/forbid-component-props": [2, { "forbid": ["sx"] }],
"react-hooks/exhaustive-deps": [
"warn",
{ "additionalHooks": "(useSyncedQueryString|useSafeAsyncFunction)" }
],
"prefer-const": [1, { "destructuring": "all" }],
"no-useless-escape": 0,
"no-only-tests/no-only-tests": [
"error",
{
"block": [
"describe",
"it",
"context",
"test",
"tape",
"fixture",
"serial",
"Feature",
"Scenario",
"Given",
"And",
"When",
"Then",
"describeWithSnowplow",
"describeEE"
]
}
],
"complexity": ["error", { "max": 54 }]
},
"globals": {
"before": true,
"cy": true,
"Cypress": true
},
"env": {
"browser": true,
"es6": true,
"commonjs": true,
"jest": true,
"jest/globals": true
},
"parser": "babel-eslint",
"plugins": ["react", "no-only-tests"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"settings": {
"import/internal-regex": "^metabase/|^metabase-lib/",
"import/resolver": {
"webpack": {
"typescript": true
}
},
"import/ignore": ["\\.css$"],
"react": {
"version": "detect"
}
},
"parserOptions": {
"ecmaFeatures": {
"legacyDecorators": true
}
},
"overrides": [
{
"files": ["*.js", "*.jsx", "*.ts", "*.tsx"],
"rules": {
"no-unconditional-metabase-links-render": "error",
"no-literal-metabase-strings": "error"
}
},
{
"files": [
"*.unit.spec.*",
"frontend/src/metabase/admin/**/*",
"frontend/src/metabase/setup/**/*",
"frontend/lint/**/*",
"*.stories.*",
"e2e/**/*",
"**/tests/*",
"release/**/*"
],
"rules": {
"no-unconditional-metabase-links-render": "off",
"no-literal-metabase-strings": "off"
}
},
{
"extends": ["plugin:@typescript-eslint/recommended"],
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"rules": {
"prefer-rest-params": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true,
"destructuredArrayIgnorePattern": "^_"
}
],
// This was introduced in 6.0.0
"@typescript-eslint/no-unsafe-declaration-merging": "off"
}
},
{
"extends": [
"plugin:jest/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
],
"plugins": ["jest", "jest-dom", "testing-library"],
"files": [
"*.unit.spec.ts",
"*.unit.spec.tsx",
"*.unit.spec.js",
"*.unit.spec.jsx"
],
"rules": {
"jest/valid-title": ["error", { "ignoreTypeOfDescribeName": true }]
}
}
]
}

250
.eslintrc.js Normal file
View File

@@ -0,0 +1,250 @@
/* eslint-disable import/no-commonjs */
/* eslint-disable no-undef */
// `postcss-modules` lints css modules class names, but it currently crashes
// eslint on vscode. If you use webstorm or want to run the lint for the cli, you
// can use this flag to enable it. This is set to true in CI
const shouldLintCssModules =
process.env.LINT_CSS_MODULES === "true" || process.env.CI;
module.exports = {
rules: {
strict: [2, "never"],
"no-undef": 2,
"no-var": 1,
"no-unused-vars": [
"error",
{
vars: "all",
args: "none",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"no-empty": [1, { allowEmptyCatch: true }],
"no-restricted-imports": [
"error",
{
paths: [
{
name: "moment",
message: "Moment is deprecated, please use dayjs",
},
{
name: "moment-timezone",
message: "Moment is deprecated, please use dayjs",
},
],
},
],
curly: [1, "all"],
eqeqeq: [1, "smart"],
"import/no-default-export": 2,
"import/no-named-as-default": 0,
"import/no-commonjs": 1,
"import/order": [
"error",
{
"newlines-between": "always",
alphabetize: {
order: "asc",
orderImportKind: "asc",
caseInsensitive: false,
},
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
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,
"react/display-name": 1,
"react/prop-types": 2,
"react/no-did-mount-set-state": 0,
"react/no-did-update-set-state": 0,
"react/no-find-dom-node": 0,
"react/no-children-prop": 2,
"react/no-string-refs": 2,
"react/no-unescaped-entities": 2,
"react/jsx-no-target-blank": 2,
"react/jsx-key": 2,
"react/forbid-component-props": [2, { forbid: ["sx"] }],
"react-hooks/exhaustive-deps": [
"warn",
{ additionalHooks: "(useSafeAsyncFunction)" },
],
"prefer-const": [1, { destructuring: "all" }],
"no-restricted-globals": ["error", "close"],
"no-useless-escape": 0,
"no-only-tests/no-only-tests": [
"error",
{
block: [
"describe",
"it",
"context",
"test",
"tape",
"fixture",
"serial",
"Feature",
"Scenario",
"Given",
"And",
"When",
"Then",
"describeWithSnowplow",
"describeEE",
],
},
],
complexity: ["error", { max: 54 }],
...(shouldLintCssModules
? {
"postcss-modules/no-undef-class": "error",
}
: {}),
},
globals: {
before: true,
cy: true,
Cypress: true,
},
env: {
browser: true,
es6: true,
commonjs: true,
jest: true,
"jest/globals": true,
},
parser: "babel-eslint",
plugins: ["react", "no-only-tests", "postcss-modules"],
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:depend/recommended",
],
settings: {
"import/internal-regex": "^metabase/|^metabase-lib/",
"import/resolver": {
webpack: {
typescript: true,
},
},
"import/ignore": ["\\.css$"],
react: {
version: "detect",
},
"postcss-modules": {
baseDir: "./frontend/src",
},
},
parserOptions: {
ecmaFeatures: {
legacyDecorators: true,
},
},
overrides: [
{
files: ["*.js", "*.jsx", "*.ts", "*.tsx"],
rules: {
"no-unconditional-metabase-links-render": "error",
"no-literal-metabase-strings": "error",
"depend/ban-dependencies": [
"error",
{
allowed: [
"underscore",
"moment",
"lodash.orderby",
"lodash.debounce",
],
},
],
},
},
{
files: [
"*.unit.spec.*",
"frontend/src/metabase/admin/**/*",
"frontend/src/metabase/setup/**/*",
"frontend/lint/**/*",
"*.stories.*",
"e2e/**/*",
"**/tests/*",
"release/**/*",
],
rules: {
"no-unconditional-metabase-links-render": "off",
"no-literal-metabase-strings": "off",
},
},
{
extends: ["plugin:@typescript-eslint/recommended"],
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
"prefer-rest-params": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/consistent-type-imports": [
"error",
{
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
destructuredArrayIgnorePattern: "^_",
},
],
// This was introduced in 6.0.0
"@typescript-eslint/no-unsafe-declaration-merging": "off",
},
},
{
extends: [
"plugin:jest/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react",
],
plugins: ["jest", "jest-dom", "testing-library"],
files: [
"*.unit.spec.ts",
"*.unit.spec.tsx",
"*.unit.spec.js",
"*.unit.spec.jsx",
],
rules: {
"jest/valid-title": ["error", { ignoreTypeOfDescribeName: true }],
},
},
],
};

12
.github/CODEOWNERS vendored
View File

@@ -1,3 +1,15 @@
# Before changing this file, make sure you have read how we use it:
# https://www.notion.so/metabase/Pull-Request-Code-Review-Guide-374f05df889748b69d67af753f9bc9b8?pvs=4#36550c04ceab40b5a8b8bee6264b090c
# TL;DR: if @camsaul hasn't been involved you're probably doing it wrong
src/metabase @camsaul
modules @camsaul
enterprise/backend @camsaul
enterprise/backend/src/metabase_enterprise/advanced_permissions @noahmoss
enterprise/backend/src/metabase_enterprise/audit_app @noahmoss
enterprise/backend/src/metabase_enterprise/sso @noahmoss
enterprise/backend/src/metabase_enterprise/task/truncate_audit_table.clj @noahmoss
enterprise/backend/src/metabase_enterprise/internal_user.clj @noahmoss
src/metabase/**/*permissions* @noahmoss
src/metabase/integrations @noahmoss
snowplow/* @metabase/data

View File

@@ -38,7 +38,7 @@ body:
validations:
required: true
- type: input
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior

View File

@@ -17,7 +17,6 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.
**How important is this feature to you?**
Note: the more honest and specific you are here the more we will take you seriously.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -1,5 +1,5 @@
> [!IMPORTANT]
> If you are merging into master, please add either a `backport` or a `no-backport` label to this PR. You will not be able to merge until you do this step. Refer to the section [Do I need to backport this PR?](https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#89f80d6f17714a0198aeb66c0efd1b71) in the Metabase Branching Strategy document for more details.
> For those employed by Metabase: if you are merging into master, please add either a `backport` or a `no-backport` label to this PR. You will not be able to merge until you do this step. Refer to the section [Do I need to backport this PR?](https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#89f80d6f17714a0198aeb66c0efd1b71) in the Metabase Branching Strategy document for more details. If you're not employed by Metabase, this section does not apply to you, and the label will be taken care of by your reviewer.
> **Warning**
>

View File

@@ -16,7 +16,6 @@ runs:
const java = 11;
const defaultRunner = "ubuntu-22.04";
const beefierRunner = "buildjet-2vcpu-ubuntu-2204";
const defaultOptions = {
"java-version": java,
@@ -36,8 +35,11 @@ runs:
["dashboard-cards", {} ],
["dashboard-filters", {} ],
["embedding", {} ],
["embedding-sdk", { context: "embedding-sdk" } ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],
["metrics", {} ],
["models", {} ],
["native", {} ],
["native-filters", {} ],
@@ -45,12 +47,14 @@ runs:
["organization", {} ],
["permissions", {} ],
["question", {} ],
["question-reproductions", {} ],
["search", {}],
["sharing", {} ],
["visualizations-charts", {} ],
["visualizations-tabular", {} ],
["oss-subset", { edition: 'oss', context: "special" } ],
["slow", { runner: beefierRunner, context: "special" } ],
["flaky", { runner: beefierRunner, context: "special" } ],
["slow", { context: "special" } ],
["flaky", { context: "special" } ],
["mongo", { context: "qa-database" } ],
];

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

@@ -8,26 +8,25 @@ inputs:
description: DockerHub password/token
required: true
maildev:
description: Maildev
description: Maildev container
required: true
default: 'false'
default: false
openldap:
description: Maildev
description: OpenLDAP container
required: true
default: 'false'
default: false
postgres:
description: Maildev
description: Postgres container
required: true
default: 'false'
default: false
mysql:
description: Maildev
description: MySQL container
required: true
default: 'false'
default: false
mongo:
description: Maildev
description: Mongo container
required: true
default: 'false'
default: false
runs:
using: "composite"
@@ -84,4 +83,11 @@ runs:
while ! nc -z localhost 27004; do sleep 1; done &&
echo -e "${G}Mongo is up and running!"
fi
if ${{ inputs.webhook }}; then
echo -e "${Y}Starting webhook test container..." &&
docker run -d -p 9080:8080/tcp tarampampam/webhook-tester serve --create-session 00000000-0000-0000-0000-000000000000 &&
while ! nc -z localhost 9080; do sleep 1; done &&
echo -e "${G}Webhook tester is up and running!"
fi
shell: bash

View File

@@ -1,12 +1,20 @@
name: Prepare cypress environment
description: Cypress preparation steps
outputs:
chrome-path:
description: Path to the custom Chrome executable
value: ${{ steps.setup-chrome.outputs.chrome-path }}
runs:
using: "composite"
steps:
- name: Install Replay.io browser
run: npx @replayio/cypress install
shell: bash
- name: Install Chrome v111
uses: browser-actions/setup-chrome@v1
with:
# https://chromium.cypress.io/linux/stable/111.0.5563.146
chrome-version: 1097615
id: setup-chrome
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}

View File

@@ -1,11 +1,17 @@
name: Prepare front-end environment
inputs:
node-version:
description: "The version of Node.js to use, overriding .nvmrc"
required: false
runs:
using: "composite"
steps:
- name: Prepare Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }} # this overrides, if present
node-version-file: ".nvmrc"
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}
run: |
@@ -18,11 +24,27 @@ runs:
with:
path: ~/.m2
key: ${{ runner.os }}-cljs-${{ hashFiles('**/shadow-cljs.edn') }}
- name: Get node_modules cache
uses: actions/cache@v4
id: node-modules-cache
if: ${{ !contains(github.event.head_commit.message, '[ci nocache]') }}
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock', '**/patches/*.patch') }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/cache@v4
if: steps.node-modules-cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile --prefer-offline
shell: bash

View File

@@ -0,0 +1,33 @@
name: Run Embedding SDK Storybook
runs:
using: "composite"
steps:
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs
shell: bash
- name: Build Storybook
run: yarn build-storybook-embedding-sdk
shell: bash
- name: Serve Storybook
run: yarn http-server storybook-static -p 6006 &
shell: bash
- name: Wait for Storybook to become available
run: |
echo "Waiting for Storybook to be served..."
while ! curl --silent --fail http://localhost:6006; do
sleep 5
echo "Retrying..."
done
echo "Storybook is being served!"
shell: bash

View File

@@ -2,7 +2,7 @@ name: Test database driver
inputs:
junit-name:
required: true
default: 'driver'
default: "driver"
test-args:
required: false
@@ -14,7 +14,7 @@ runs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: driver-${{ inputs.junit-name }}
m2-cache-key: driver
- name: Build static viz frontend
run: yarn build-static-viz
shell: bash
@@ -25,7 +25,7 @@ runs:
uses: dorny/test-reporter@v1
if: failure()
with:
path: 'target/junit/**/*_test.xml'
path: "target/junit/**/*_test.xml"
name: JUnit Test Report ${{ inputs.junit-name }}
reporter: java-junit
list-suites: failed

17
.github/auto_request_review.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# The reviewers configuration for the auto_request_review workflow
# See https://github.com/necojackarc/auto-request-review/tree/master?tab=readme-ov-file#reviewers-configuration
# for the spec
files:
# migrations related files
'resources/migrations/**':
- team:core-backend-components
'src/metabase/db/custom_migrations.clj':
- team:core-backend-components
options:
ignore_draft: true
ignored_keywords:
- DO NOT REVIEW
- WIP
enable_group_assignment: false

View File

@@ -23,24 +23,34 @@ frontend_sources: &frontend_sources
- "**/tsconfig*.json"
- "package.json"
- "babel.config.json"
- ".eslintrc"
- ".eslintrc.js"
- "postcss.config.js"
- "webpack.config.js"
- "webpack.embedding-sdk.config.js"
- "webpack.static-viz.config.js"
- ".nvmrc"
frontend_specs: &frontend_specs
- *shared_specs
- "frontend/test/**"
- "frontend/**/tests/**"
- "frontend/**/*.unit.*"
- "jest.config.json"
- "jest.config.js"
- "jest.tz.unit.conf.json"
release_source: &release_sources
- "release/**"
frontend_all: &frontend_all
- *frontend_ci
- *frontend_sources
- *frontend_specs
frontend_loki_ci: &frontend_loki_ci
- ".github/workflows/loki.yml"
- ".loki/**"
- ".storybook/**"
backend_ci: &backend_ci
- ".github/actions/prepare-frontend/**"
- ".github/actions/prepare-backend/**"
@@ -51,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
@@ -69,6 +80,7 @@ backend_specs: &backend_specs
- "modules/drivers/*/test/**"
- "test_config/**"
- "dev/**"
- "test_resources/**"
backend_all: &backend_all
- *default
@@ -98,6 +110,10 @@ e2e_specs: &e2e_specs
- "e2e/support/**"
- "e2e/snapshot*/**"
e2e_cross_version: &e2e_cross_version
- ".github/workflows/e2e-cross-version.yml"
- "e2e/test/scenarios/cross-version/**"
e2e_all:
- *default
- *e2e_ci

View File

@@ -0,0 +1,68 @@
exports.updateComment = updateComment;
/** @param {import('@types/github-script').AsyncFunctionArguments} AsyncFunctionArguments */
async function updateComment({ github, context }) {
const githubUsername = context.payload.sender.login;
const comment = `${CONVENTIONAL_COMMIT_REMINDER_COMMENT_IDENTIFIER}
@${githubUsername} You have modified embedding SDK code. Please make sure the PR title follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) style.
Here are all the supported types that will be shown in the changelog:
- \`feat\`
- \`fix\`
- \`perf\`
These types \`docs\`, \`style\`, \`refactor\`, \`test\`, \`build\`, and \`ci\` are also encouraged for non-changelog related tasks.
Please also make sure to include \`sdk\` scope, otherwise, the changelog will not include this task.
For example, these are valid PR titles:
- \`feat(sdk): Add interactive dashboard component\`
- \`feat(sdk): Support theming pie chart\`
- \`fix(sdk): Fix static dashboard crash\``;
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullRequestNumber = context.issue.number;
const comments = await github.rest.issues.listComments({
owner,
repo,
issue_number: pullRequestNumber,
});
const existingComment = getExistingConventionalCommitReminderComment(
comments.data,
);
if (existingComment) {
return await github.rest.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body: comment,
});
} else {
return await github.rest.issues.createComment({
owner,
repo,
issue_number: pullRequestNumber,
body: comment,
});
}
}
const CONVENTIONAL_COMMIT_REMINDER_COMMENT_IDENTIFIER =
"<!---conventional commit reminder comment ID-->";
/**
* @typedef Comment
* @property {string} body
*
* @param {Comment[]} comments
*/
function getExistingConventionalCommitReminderComment(comments) {
for (const comment of comments) {
if (
comment.body.startsWith(CONVENTIONAL_COMMIT_REMINDER_COMMENT_IDENTIFIER)
) {
return comment;
}
}
}

41
.github/team.json vendored
View File

@@ -1,21 +1,31 @@
{
"teams": [
{
"name": "Querying Components",
"label": ".Team/QueryingComponents",
"name": "Querying",
"label": ".Team/Querying",
"projectUrl": "https://github.com/orgs/metabase/projects/97/views/1",
"members": [
"ranquild",
"uladzimirdev",
"kamilmielnik",
"oleggromov",
"nemanjaglumac",
"romeovs"
"romeovs",
"bshepherdson",
"metamben",
"lbrdnk",
"appleby",
"uladzimirdev"
]
},
{
"name": "Drivers",
"label": ".Team/Drivers",
"members": ["snoe"]
},
{
"name": "Embedding",
"label": ".Team/Embedding",
"members": ["WiNloSt", "deniskaber", "oisincoveney", "npretto"]
"projectUrl": "https://github.com/orgs/metabase/projects/88/views/1",
"members": ["WiNloSt", "deniskaber", "oisincoveney", "npretto", "heypoom"]
},
{
"name": "BEC",
@@ -24,28 +34,21 @@
"members": [
"tsmacdonald",
"qnkhuat",
"calherries",
"piranha",
"crisptrutski"
]
},
{
"name": "Query Processor",
"label": ".Team/QueryProcessor",
"projectUrl": "https://github.com/orgs/metabase/projects/85/views/1",
"members": ["camsaul", "snoe", "bshepherdson", "metamben", "lbrdnk"]
},
{
"name": "Admin Webapp",
"label": ".Team/AdminWebapp",
"members": [
"noahmoss",
"escherize",
"iethree",
"npfitz",
"johnswanson",
"rafpaf",
"sloansparger"
"sloansparger",
"iethree"
]
},
{
@@ -54,10 +57,16 @@
"members": [
"alxnddr",
"EmmadUsmani",
"JesseSDevaney",
"kulyk",
"adam-james-v"
]
},
{
"name": "DevEx",
"label": ".Team/DevEx",
"members": [
"camsaul"
]
}
]
}

View File

@@ -11,11 +11,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tibdex/github-app-token@v2.1.0
id: generate-token
with:
app_id: ${{ secrets.METABASE_BOT_APP_ID }}
private_key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- uses: ./.github/actions/find-squashed-commit
name: Find commit
id: find_commit
@@ -82,7 +78,7 @@ jobs:
TARGET_BRANCH: ${{ steps.get_latest_release_branch.outputs.branch-name }}
ORIGINAL_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
ORIGINAL_TITLE: ${{ github.event.pull_request.title }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
COMMIT: ${{ steps.find_commit.outputs.commit }}
- name: Auto approve backport PR
@@ -96,7 +92,7 @@ jobs:
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'false' }}
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ steps.generate-token.outputs.token }}
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
pull-request-number: ${{ steps.create_backport_pull_request.outputs.backport_pr_number }}
merge-method: squash

View File

@@ -0,0 +1,21 @@
# Config is in .github/auto_request_review.yml
name: Auto Request Review
on:
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
jobs:
auto-request-review:
# Don't run on forked repos
if: ${{ !github.event.pull_request.head.repo.fork }}
permissions:
contents: read
pull-requests: write
name: Auto Request Review
runs-on: ubuntu-latest
steps:
- name: Request review based on files changes and/or groups the author belongs to
uses: necojackarc/auto-request-review@v0.13.0
with:
token: '${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}'

27
.github/workflows/backend-cloverage.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Backend-Cloverage
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * 1-5' # every weekday at 5am US eastern time
jobs:
be-linter-cloverage:
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cloverage"
- name: Build static viz frontend
run: yarn build-static-viz
- name: Collect the test coverage
run: clojure -X:dev:ci:ee:ee-dev:test:cloverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/coverage/codecov.json
flags: back-end

View File

@@ -12,9 +12,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
env:
CLJ_KONDO_VERSION: "2023.09.07"
jobs:
files-changed:
name: Check which files changed
@@ -63,28 +60,6 @@ jobs:
token: ${{ github.token }}
filters: .github/static-viz-sources.yaml
be-linter-cloverage:
needs: files-changed
if: (github.ref_name == 'master' && needs.files-changed.outputs.backend_all == 'true')
|| contains(github.event.pull_request.labels.*.name, 'run-cloverage')
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cloverage"
- name: Build static viz frontend
run: yarn build-static-viz
- name: Collect the test coverage
run: clojure -X:dev:ci:ee:ee-dev:test:cloverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v3
with:
files: ./target/coverage/codecov.json
flags: back-end
be-linter-clj-kondo:
needs: [files-changed, static-viz-files-changed]
if: |
@@ -92,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
@@ -290,3 +254,18 @@ jobs:
steps:
- run: |
echo "Didn't run due to conditional filtering"
be-cljfmt:
needs: [files-changed]
if: |
!cancelled() && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'cljfmt'
- name: Run cljfmt
run: clojure -T:cljfmt check

View File

@@ -107,8 +107,23 @@ jobs:
echo "PR has been merged, searching for a squashed commit in the base branch"
echo "searching for a commit in a ${ORIGINAL_BASE_REF} that contains pull request number ${ORIGINAL_PULL_REQUEST_NUMBER}"
SQUASHED_COMMIT=$(env -i git log ${ORIGINAL_BASE_REF} --grep="(#${ORIGINAL_PULL_REQUEST_NUMBER})" --format="%H")
echo "found commit ${SQUASHED_COMMIT}"
git cherry-pick ${SQUASHED_COMMIT}
if [ -n "${SQUASHED_COMMIT}" ]; then
echo "found commit ${SQUASHED_COMMIT}"
git cherry-pick ${SQUASHED_COMMIT}
else
echo "probably a PR wasn't merged with Squash And Merge button, searching again"
SQUASHED_COMMIT=$(env -i git log ${ORIGINAL_BASE_REF} --grep="#${ORIGINAL_PULL_REQUEST_NUMBER}" --format="%H")
if [ -n "${SQUASHED_COMMIT}" ]; then
echo "found commit ${SQUASHED_COMMIT}"
git cherry-pick ${SQUASHED_COMMIT}
else
echo "No squashed commit found for PR #${ORIGINAL_PULL_REQUEST_NUMBER}"
exit 1
fi
fi
else
echo "PR has not been merged, copying all commits"
git cherry-pick ${ORIGINAL_BASE_SHA}..${ORIGINAL_HEAD_SHA}

View File

@@ -17,30 +17,52 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send build start message
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendReleaseMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
const { sendPreReleaseMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendReleaseMessage({
stage: 'build-start',
await sendPreReleaseMessage({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
releaseSha: '${{ inputs.commit }}',
userName: '${{ github.actor }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
trigger-milestone-check:
runs-on: ubuntu-22.04
timeout-minutes: 5
needs: start-message
steps:
- name: trigger pre-release milestone check
uses: actions/github-script@v7
with:
script: | # js
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release-milestone-check.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
}
});
check-version:
runs-on: ubuntu-22.04
timeout-minutes: 10
@@ -113,7 +135,7 @@ jobs:
uses: actions/github-script@v7
id: release_branch
with:
result_encoding: string
result-encoding: string
script: | # js
const { getReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';

View File

@@ -1,80 +1,41 @@
name: Milestone Reminder
name: Automatically set milestone
run-name: Set milestone for ${{ github.event.head_commit.message }}
on:
pull_request:
types: [closed]
push:
branches:
- "master"
- release-x.**
jobs:
milestone-reminder:
if: github.event.pull_request.merged == true
name: Remind to set milestone
set-milestone:
name: Automatically set milestone
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
pull-requests: write
issues: read
issues: write
contents: read
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
ref: master # we want the logic from master, even though we're triggering on a release branch
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- uses: actions/github-script@v7
with:
script: | # js
const { setMilestoneForCommits } = require('${{ github.workspace }}/release/dist/index.cjs');
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullNumber = '${{ github.event.pull_request.number }}';
const branchName = `${{ github.ref }}`;
const commitMessage = context?.payload?.head_commit?.message ?? '';
// the github API doesn't expose linked issues, so we have to parse the body ourselves
function getLinkedIssueId(pull) {
// https://regexr.com/7sk94
const match = pull.data.body.match(/(close(s|d)?|fixe?(s|d)?|resolve(s|d)?) (#|https?:\/\/github.com\/.+\/issues\/)(\d+)/i);
return match && match?.[2];
}
function getMilestone(pullOrIssue) {
// pull has pull.data.milestone, issue has issue.milestone
return pullOrIssue?.data?.milestone || pullOrIssue?.milestone;
}
const pull = await github.rest.pulls.get({
await setMilestoneForCommits({
github,
owner,
repo,
pull_number: pullNumber,
});
if (getMilestone(pull)) {
console.log("Pull request has milestone", pull.data.milestone?.title);
process.exit(0);
}
const issueId = getLinkedIssueId(pull);
if (issueId) {
console.log('linked issue found', issueId);
const issue = await github.rest.issues.get({
owner,
repo,
issue_number: issueId,
});
const milestone = getMilestone(issue);
if (milestone) {
console.log("Linked issue has milestone", milestone.title);
process.exit(0);
}
}
console.log("No milestone found");
const author = pull.data.user.login;
const guideLink = "https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#3dea255ffa3b4f74942a227844e889fa";
const message = `@${author} Did you forget to add a milestone to the issue for this PR? _[When and where should I add a milestone?](${guideLink})_`;
await github.rest.issues.createComment({
owner,
repo,
issue_number: pullNumber,
body: message,
branchName,
commitMessages: [commitMessage],
});

View File

@@ -0,0 +1,42 @@
name: Conventional commit PR Title Reminder
on:
pull_request:
branches:
- master
paths:
- enterprise/frontend/src/embedding-sdk/**
jobs:
pr-title-reminder:
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
pull-requests: write
steps:
- name: Check if the PR title is already following Conventional Commits style
uses: actions/github-script@v7
id: is-conventional-commit
with:
result-encoding: string
script: | # js
const pullRequestTitle = context.payload.pull_request.title
const conventionalCommitRegex = /^(?<type>\w+)\((?<scope>\w+)\):/
const match = pullRequestTitle.match(conventionalCommitRegex)
if (match) {
const { type, scope } = match.groups
return ['feat', 'fix', 'perf', 'docs', 'style', 'refactor', 'test', 'build', 'ci'].includes(type) && scope === 'sdk'
}
- name: Checkout repository so `gh` CLI works
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Remind PR authors to use conventional commit in the title
if: ${{ steps.is-conventional-commit.outputs.result != 'true' }}
uses: actions/github-script@v7
with:
script: |
const { updateComment } = require(".github/scripts/conventional-commit-pr-title-reminder/utils.js")
await updateComment({github, context})

View File

@@ -0,0 +1,162 @@
name: Cross-branch migration tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "resources/migrations/**"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
migrations-h2-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: h2
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-postgres-12-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
services:
postgres:
image: postgres:12-alpine
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-postgres-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
services:
postgres:
image: circleci/postgres:latest
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mysql-8-0-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mysql:
image: cimg/mysql:8.0
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mysql-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: circle_test
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mariadb-10-2-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:10.2.23
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mariadb-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:latest
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}

View File

@@ -21,7 +21,6 @@ on:
- Athena
- BigQuery
- Druid
- Google Analytics
- Google Classpath Test
- Maria DB
- Maria DB (latest)
@@ -109,42 +108,6 @@ jobs:
junit-name: 'be-tests-druid-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-tests-googleanalytics-ee:
if: inputs.driver == 'Google Analytics'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: googleanalytics
steps:
- uses: actions/checkout@v4
- name: Test Google Analytics driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-googleanalytics-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-google-related-drivers-classpath-test:
if: inputs.driver == 'Google Classpath Test'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: 'googleanalytics,bigquery-cloud-sdk'
MB_BIGQUERY_TEST_PROJECT_ID: ${{ secrets.BIGQUERY_TEST_PROJECT_ID }}
MB_BIGQUERY_TEST_CLIENT_ID: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_ID }}
MB_BIGQUERY_TEST_CLIENT_SECRET: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_SECRET }}
MB_BIGQUERY_TEST_ACCESS_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_ACCESS_TOKEN }}
MB_BIGQUERY_TEST_REFRESH_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_REFRESH_TOKEN }}
MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON: ${{ secrets.MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON }}
steps:
- uses: actions/checkout@v4
- name: Test Google Related Drivers Classpath
uses: ./.github/actions/test-driver
with:
junit-name: 'be-google-related-drivers-classpath-test'
test-args: ':only "[metabase.query-processor-test.expressions-test metabase.driver.google-test metabase.driver.googleanalytics-test ${{ inputs.test }}] :times ${{ inputs.times }}"'
be-tests-mariadb-10-2-ee:
if: inputs.driver == 'Maria DB'
runs-on: ubuntu-22.04

View File

@@ -40,6 +40,9 @@ jobs:
MB_ATHENA_TEST_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_ACCESS_KEY }}
MB_ATHENA_TEST_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_SECRET_KEY }}
MB_ATHENA_TEST_S3_STAGING_DIR: ${{ secrets.MB_ATHENA_TEST_S3_STAGING_DIR }}
# These credentials are used to test the driver when the user does not have the athena:GetTableMetadata permission
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY }}
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- name: Test Athena driver
@@ -126,20 +129,27 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-googleanalytics-ee:
be-tests-druid-jdbc-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: googleanalytics
DRIVERS: druid-jdbc
services:
druid:
image: metabase/druid:29.0.1-json-no-ingestion
ports:
- "8888:8888"
env:
CLUSTER_SIZE: nano-quickstart
steps:
- uses: actions/checkout@v4
- name: Test Google Analytics driver
- name: Test Druid JDBC driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-googleanalytics-ee'
junit-name: 'be-tests-druid-jdbc-ee'
test-args: ":exclude-tags '[:mb/once]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
@@ -153,39 +163,6 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-google-related-drivers-classpath-test:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: 'googleanalytics,bigquery-cloud-sdk'
MB_BIGQUERY_TEST_PROJECT_ID: ${{ secrets.BIGQUERY_TEST_PROJECT_ID }}
MB_BIGQUERY_TEST_CLIENT_ID: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_ID }}
MB_BIGQUERY_TEST_CLIENT_SECRET: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_SECRET }}
MB_BIGQUERY_TEST_ACCESS_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_ACCESS_TOKEN }}
MB_BIGQUERY_TEST_REFRESH_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_REFRESH_TOKEN }}
MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON: ${{ secrets.MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON }}
steps:
- uses: actions/checkout@v4
- name: Test Google Related Drivers Classpath
uses: ./.github/actions/test-driver
with:
junit-name: 'be-google-related-drivers-classpath-test'
test-args: ':only "[metabase.query-processor-test.expressions-test metabase.driver.google-test metabase.driver.googleanalytics-test]"'
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-mariadb-10-2-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
@@ -281,7 +258,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-4-4-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -327,7 +304,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-4-4-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -361,7 +338,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-5-0-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -407,7 +384,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-5-0-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -444,7 +421,39 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-latest-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-mongo-sharded-cluster-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: mongo
services:
mongodb:
image: metabase/mongo-sharded-cluster:6
ports:
- "27017:17017"
steps:
- uses: actions/checkout@v4
- name: Test MongoDB driver (Sharded cluster)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-sharded-cluster-ee'
test-args: ':only "[metabase.driver.mongo.sharded-cluster-test]"'
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -800,6 +809,11 @@ jobs:
MB_SNOWFLAKE_TEST_WAREHOUSE: ${{ secrets.MB_SNOWFLAKE_TEST_WAREHOUSE }}
MB_SNOWFLAKE_TEST_PK_USER: METABASE PK
MB_SNOWFLAKE_TEST_PK_PRIVATE_KEY: ${{ secrets.MB_SNOWFLAKE_TEST_PK_PRIVATE_KEY }}
# RSA Role testing:
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_DEFAULT_USER: RSA_ROLE_TEST_DEFAULT_USER
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_CUSTOM_USER: RSA_ROLE_TEST_CUSTOM_USER
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_ROLE: RSA_ROLE_TEST_ROLE
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_DB: RSA_ROLE_TEST_DB
steps:
- uses: actions/checkout@v4
- name: Test Snowflake driver

View File

@@ -2,12 +2,31 @@ name: E2E Cross-version Tests
on:
schedule:
- cron: '0 9 * * 0'
- cron: '0 9 * * 1-5'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
cross-version-testing:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 60
timeout-minutes: 3
outputs:
e2e_cross_version: ${{ steps.changes.outputs.e2e_cross_version }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
cross-version-testing:
needs: files-changed
if: ${{ needs.files-changed.outputs.e2e_cross_version == 'true' || github.event_name == 'schedule'}}
runs-on: ubuntu-22.04
timeout-minutes: 20
strategy:
matrix:
version: [
@@ -52,11 +71,12 @@ jobs:
- name: Wait for Metabase to start on port 3000
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Cypress on the source
run: |
yarn cypress run \
--browser chrome \
--browser ${{ steps.cypress-prep.outputs.chrome-path }} \
--config-file e2e/test/scenarios/cross-version/source/shared/cross-version-source.config.js \
--spec e2e/test/scenarios/cross-version/source/**/*.cy.spec.js
- name: Stop Metabase ${{ matrix.version.source }}
@@ -84,7 +104,7 @@ jobs:
- name: Run Cypress on the target
run: |
yarn cypress run \
--browser chrome \
--browser ${{ steps.cypress-prep.outputs.chrome-path }} \
--config-file e2e/test/scenarios/cross-version/target/shared/cross-version-target.config.js \
--spec e2e/test/scenarios/cross-version/target/**/*.cy.spec.js
- name: Upload Cypress Artifacts upon failure
@@ -97,20 +117,11 @@ jobs:
if-no-files-found: ignore
notify-on-failure:
needs: cross-version-testing
if: ${{ always() && contains(needs.*.result, 'failure') }}
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }}
name: Cross-version test failure
runs-on: ubuntu-22.04
env:
BRANCH_NAME: ${{ github.event.workflow_run.head_branch }}
AUTHOR_NAME: ${{ github.event.workflow_run.head_commit.author.name }}
timeout-minutes: 5
steps:
- name: Generate job summary
run: |
echo "# ${{ github.event.workflow_run.name }} workflow failed! :x:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "View the failed run attempt (#${{ github.event.workflow_run.run_attempt }}) using the following link:" >> $GITHUB_STEP_SUMMARY
echo "${{ github.event.workflow_run.html_url }}" >> $GITHUB_STEP_SUMMARY
- uses: actions/setup-node@v4
with:
node-version: lts/Hydrogen # 18.x.x
@@ -119,11 +130,8 @@ jobs:
uses: actions/github-script@v7
with:
script: | # js
const FAILED_RUN_URL = "${{ github.event.workflow_run.html_url }}";
const FAILED_RUN_NAME = "${{ github.event.workflow_run.name }}";
const BREAKING_COMMIT = "${{ github.event.workflow_run.head_sha }}";
const AUTHOR = process.env.AUTHOR_NAME;
const BRANCH = process.env.BRANCH_NAME;
const FAILED_RUN_URL = "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}";
const REF_NAME = "${{ github.ref_name }}";
// notify slack of failure
const { WebClient } = require('@slack/web-api');
@@ -137,7 +145,7 @@ jobs:
"type": "header",
"text": {
"type": "plain_text",
"text": `:broken_heart: Cross-version tests are failing on ${BRANCH}`,
"text": `:broken_heart: Cross-version tests are failing on ${REF_NAME}`,
"emoji": true,
}
},
@@ -149,7 +157,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": `Commit <https://github.com/metabase/metabase/commit/${BREAKING_COMMIT}|${BREAKING_COMMIT.slice(0,7)}> has failing <${FAILED_RUN_URL}|${FAILED_RUN_NAME}> tests on the <https://github.com/metabase/metabase/commits/${BRANCH}|\`${BRANCH}\`> branch.`
"text": `See <${FAILED_RUN_URL}|failing run details>.`
}
},
]

View File

@@ -20,6 +20,15 @@ on:
type: string
required: false
default: "ee"
qa_db:
description: 'Select the type of Database you want to run your tests with'
type: choice
required: true
default: "none"
options:
- none
- sql
- mongo
jobs:
workflow-summary:
@@ -35,6 +44,7 @@ jobs:
echo '- `spec`: ${{ inputs.spec }}' >> $GITHUB_STEP_SUMMARY
echo '- `burn_in`: ${{ inputs.burn_in }}' >> $GITHUB_STEP_SUMMARY
echo '- `grep`: "${{ inputs.grep }}"' >> $GITHUB_STEP_SUMMARY
echo '- `qa_db`: "${{ inputs.qa_db }}"' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'triggered by: @${{ github.event.sender.login }}' >> $GITHUB_STEP_SUMMARY
@@ -44,8 +54,8 @@ jobs:
name: Stress test E2E flake fix
env:
DISPLAY: ""
QA_DB_ENABLED: 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
@@ -66,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
@@ -83,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
@@ -95,7 +106,7 @@ jobs:
--spec '${{ github.event.inputs.spec }}' \
--env burn=${{ github.event.inputs.burn_in }},grep='${{ github.event.inputs.grep }}' \
--config-file e2e/support/cypress-stress-test.config.js \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4

View File

@@ -4,7 +4,7 @@ on:
push:
branches:
- "master"
- 'release-**'
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
@@ -39,8 +39,39 @@ jobs:
id: e2e-matrix
uses: ./.github/actions/build-e2e-matrix
# if this is a test on a release branch, we need to check the build requirements
get-build-requirements:
if: |
!cancelled() &&
contains(github.ref, 'release-x')
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
java_version: ${{ fromJson(steps.dependencies.outputs.result).java_version }}
node_version: ${{ fromJson(steps.dependencies.outputs.result).node_version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get build dependencies
uses: actions/github-script@v7
id: dependencies
with:
script: | # js
const { getBuildRequirements, getVersionFromReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = getVersionFromReleaseBranch('${{ github.ref }}');
const requirements = getBuildRequirements(version);
return {
java_version: requirements.java,
node_version: requirements.node,
};
build:
needs: [files-changed, e2e-matrix-builder]
needs: [files-changed, e2e-matrix-builder, get-build-requirements]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
@@ -54,14 +85,19 @@ jobs:
env:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
# make sure that builds on release branches get licenses, because we use them for releases
SKIP_LICENSES: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
with:
node-version: "${{ needs.get-build-requirements.outputs.node_version }}"
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: e2e-tests
m2-cache-key: uberjar
java-version: "${{ needs.get-build-requirements.outputs.java_version || 11 }}"
- name: Build uberjar with ./bin/build.sh
run: ./bin/build.sh
@@ -87,14 +123,11 @@ jobs:
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_PULL_REQUEST_ID: ${{ github.event.pull_request.number || '' }}
COMMIT_INFO_MESSAGE : ${{ github.event.pull_request.title || github.event.head_commit.message || github.even.head.sha }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message || github.even.head.sha }}
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
CYPRESS_REPLAYIO_ENABLED: 1
RECORD_REPLAY_METADATA_FILE: /tmp/replay-metadata.json
RECORD_REPLAY_METADATA_TEST_RUN_ID: ${{ github.run_id }}
REPLAY_API_KEY: ${{ secrets.REPLAY_IO_TOKEN }}
TZ: US/Pacific # to make node match the instance tz
CYPRESS_CI: true
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.e2e-matrix-builder.outputs.matrix) }}
@@ -112,6 +145,7 @@ jobs:
postgres: ${{ matrix.name != 'mongo'}}
mysql: ${{ matrix.name != 'mongo'}}
mongo: ${{ matrix.name == 'mongo'}}
webhook: true
- name: Retrieve uberjar artifact for ${{ matrix.edition }}
uses: actions/download-artifact@v4
@@ -133,6 +167,7 @@ jobs:
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
@@ -143,24 +178,24 @@ jobs:
run: |
yarn run test-cypress-run \
--env grepTags=@OSS,grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run slow and resource-intensive Cypress tests
if: matrix.name == 'slow' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="@slow",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run Flaky Cypress tests
if: matrix.name == 'flaky' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="@flaky --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run EE Cypress tests on ${{ matrix.name }}
if: matrix.context == 'folder' && github.event_name != 'schedule'
@@ -168,18 +203,33 @@ jobs:
yarn run test-cypress-run \
--env grepTags="-@slow+-@mongo+-@flaky --@quarantine",grepOmitFiltered=true \
--folder ${{ matrix.name }} \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run E2E tests that depend on Mongo
if: matrix.name == 'mongo'
run: |
yarn run test-cypress-run \
--env grepTags="@mongo --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
env:
CYPRESS_QA_DB_MONGO: true
- name: Run Embedding SDK Storybook
if: matrix.context == 'embedding-sdk' && github.event_name != 'schedule'
uses: ./.github/actions/run-embedding-sdk-storybook
- name: Run E2E tests for Embedding SDK
if: matrix.context == 'embedding-sdk' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="-@slow+-@flaky --@quarantine",grepOmitFiltered=true \
--folder 'embedding-sdk' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
env:
CYPRESS_IS_EMBEDDING_SDK: true
shell: bash
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -217,46 +267,10 @@ jobs:
- run: |
echo "Didn't run due to conditional filtering"
visual-regression-tests:
runs-on: ubuntu-22.04
timeout-minutes: 60
pr-env:
needs: [build]
if: |
!cancelled() && needs.build.result == 'success'
name: percy-visual-regression-tests
steps:
- uses: actions/checkout@v4
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
maildev: true
- name: Retrieve uberjar artifact for ${{ matrix.edition }}
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ github.ref == 'refs/heads/master' && secrets.PERCY_TOKEN || ''}}
!cancelled() &&
contains(github.event.pull_request.labels.*.name, 'PR-Env')
uses: ./.github/workflows/pr-env.yml
secrets: inherit

39
.github/workflows/embedding-sdk.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Embedding SDK
on:
push:
branches:
- "master"
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
sdk-build:
if: contains(github.event.pull_request.labels.*.name, 'embedding-sdk-build')
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Build SDK bundle
run: yarn run build-embedding-sdk
- name: Generate SDK package.json
run: yarn run embedding-sdk:generate-package "$GITHUB_SHA"
- name: Generate .npmrc for Github npm registry
uses: actions/setup-node@v4
with:
registry-url: "https://npm.pkg.github.com"
- name: Publish package
run: yarn run embedding-sdk:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,34 @@
name: Flake Issue Creator
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1-5' # every weekday at 1am US eastern time
jobs:
flake-issue-creator:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Update flake issues
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { updateFlakeIssues } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
await updateFlakeIssues({
github,
owner: context.repo.owner,
repo: context.repo.repo,
});

35
.github/workflows/flake-status.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Flake Status Report
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 2,5' # Tuesdays and Fridays at 1am US eastern time
jobs:
flake-status-report:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Post Flake Status Report
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { summarizeFlakes } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
await summarizeFlakes({
github,
owner: context.repo.owner,
repo: context.repo.repo,
channelName: 'engineering-ci'
});

View File

@@ -4,15 +4,15 @@ on:
workflow_dispatch:
inputs:
spec:
description: 'Relative path of the target spec'
description: "Relative path of the target spec"
type: string
required: true
burn_in:
description: 'Number of times to run the test (e.g. 20)'
description: "Number of times to run the test (e.g. 20)"
type: string
required: true
grep:
description: 'Grep and filter tests to run in isolation'
description: "Grep and filter tests to run in isolation"
type: string
required: false
@@ -45,10 +45,12 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Build cljs
run: yarn build:cljs
- name: Stress-test ${{ github.event.inputs.spec }} ${{ github.event.inputs.burn_in }} times
run: |
for i in {1..${{ github.event.inputs.burn_in }}}; do
yarn test-unit \
yarn jest --runInBand --ci --silent --no-cache \
--testPathPattern '${{ github.event.inputs.spec }}' \
--testNamePattern '${{ github.event.inputs.grep }}'
if [[ "$?" != 0 ]]; then

View File

@@ -70,7 +70,7 @@ jobs:
fe-tests-unit:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.frontend_all == 'true'
runs-on: buildjet-2vcpu-ubuntu-2204
runs-on: ubuntu-22.04
timeout-minutes: 60
env:
JEST_JUNIT_OUTPUT_DIR: ./target/junit
@@ -91,10 +91,11 @@ jobs:
run: yarn run test-unit --silent
- name: Upload coverage to codecov.io
if: github.ref_name == 'master'
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: front-end
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()

69
.github/workflows/loki-update.yml vendored Normal file
View File

@@ -0,0 +1,69 @@
name: Update Loki Snapshots
on:
pull_request:
types: [labeled]
jobs:
check-label-and-update-snapshot:
if: contains(github.event.pull_request.labels.*.name, 'loki-update')
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
ref: ${{ github.head_ref }}
- 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
- name: 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 &
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!"
- name: Update Loki Snapshots
run: yarn test-visual:loki-update
- name: Commit and Push Changes
run: |
git config --global user.name "Metabase Automation"
git config --global user.email "github-automation@metabase.com"
git add .loki/**
git commit -m "Update Loki Snapshots"
git push
env:
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Remove 'loki-update' label
uses: actions/github-script@v7
with:
github-token: ${{secrets.METABASE_AUTOMATION_USER_TOKEN}}
script: |
github.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'loki-update'
})

87
.github/workflows/loki.yml vendored Normal file
View File

@@ -0,0 +1,87 @@
name: Loki Visual Regression Testing
on: [pull_request]
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
frontend_ci: ${{ steps.changes.outputs.frontend_ci }}
frontend_sources: ${{ steps.changes.outputs.frontend_sources }}
frontend_loki_ci: ${{ steps.changes.outputs.frontend_loki_ci }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
visual-test:
needs: files-changed
if: needs.files-changed.outputs.frontend_ci == 'true' || needs.files-changed.outputs.frontend_sources == 'true' || needs.files-changed.outputs.frontend_loki_ci == 'true'
runs-on: ubuntu-latest
services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 2376:2376
env:
DOCKER_TLS_CERTDIR: /certs
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/docker-certs:/certs/client
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- 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
- name: 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 &
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!"
- name: Run Loki Visual Tests
run: |
yarn test-visual:loki
- name: Generate Visual Report on Failure
if: failure()
run: yarn test-visual:loki-report
- name: Upload Artifact
id: artifact-upload-step
if: failure()
uses: actions/upload-artifact@v4
with:
name: loki-report
path: .loki/
if-no-files-found: ignore

View File

@@ -0,0 +1,32 @@
name: Update changelog for MBQL library changes
on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
paths:
- src/metabase/lib/js.cljs
jobs:
mbql-library-changelog-check:
runs-on: ubuntu-latest
if: ${{ !contains( github.event.pull_request.labels.*.name, '.metabase-lib/no-change' ) }}
steps:
# - uses: jesusvasquez333/verify-pr-label-action@v1.4.0
# with:
# github-token: '${{ secrets.GITHUB_TOKEN }}'
# valid-labels: '.metabase-lib/no-change'
# disable-reviews: true
- uses: actions/checkout@v4
- name: Check for updated MBQL library changelog
run: |
if [[ $(git show HEAD -- docs/developers-guide/mbql-library-changelog.md) ]]; then
echo "Library and changelog updated together - all good"
else
echo "metabase.lib.js namespace changed but docs/developers/guide/mbql-library-changelog.md did not"
echo "Update the changelog with the changes made to the library's API."
echo "If the edits did not change the API, add the `.metabase-lib/no-change` label."
exit 1
fi

View File

@@ -1,4 +1,4 @@
name: Migrations
name: Lint migrations
on:
push:
@@ -9,14 +9,14 @@ on:
jobs:
check-migrations:
lint-migrations:
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: check-migrations
- name: Verify Liquibase Migrations
run: ./bin/lint-migrations-file.sh
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: lint-migrations
- name: Verify Liquibase Migrations
run: ./bin/lint-migrations-file.sh

48
.github/workflows/on-epic-close.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: A New Feature Slack Notification
on:
issues:
types:
- closed
jobs:
on-epic-closed:
runs-on: ubuntu-22.04
timeout-minutes: 5
if: ${{ contains(github.event.issue.labels.*.name, '.Epic') || contains(github.event.issue.labels.*.name, 'Type:New Feature') }}
steps:
- name: Setting title
uses: actions/github-script@v6
id: vars
with:
script: |
core.setOutput('issue_title', ${{ toJson(github.event.issue.title) }}.replaceAll(/"/g, '\\"'));
- name: Extracting team name
id: team_name
run: |
team_label=$(echo "${{ join(github.event.issue.labels.*.name, ',') }}" | grep -o '\.Team/[^,]*' | head -n 1)
echo $team_label
echo "team_label=${team_label}" >> "$GITHUB_OUTPUT"
team_name=${team_label#*.Team/}
echo $team_name
echo "team_name=${team_name^^}_SLACK_EPIC_WEBHOOK_URL" >> "$GITHUB_OUTPUT"
- name: Send the issue ${{ github.event.issue.number }} to Slack
id: slack
if: ${{ steps.team_name.outputs.team_label }}
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ steps.vars.outputs.issue_title }}\n${{ github.event.issue.html_url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets[steps.team_name.outputs.team_name] }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

View File

@@ -1,91 +0,0 @@
# Triggers Percy job by "@metabase-bot run visual tests" comment in a PR
name: PercyIssueComment
on:
issue_comment:
types: [created]
jobs:
pr_info:
if: github.event.comment.body == '@metabase-bot run visual tests'
runs-on: ubuntu-22.04
outputs:
pull_request_number: ${{ fromJson(steps.fetch_pr.outputs.data).head.number }}
branch_name: ${{ fromJson(steps.fetch_pr.outputs.data).head.ref }}
commit_sha: ${{ fromJson(steps.fetch_pr.outputs.data).head.sha }}
steps:
- uses: tibdex/github-app-token@v2.1.0
id: generate-token
with:
app_id: ${{ secrets.METABASE_BOT_APP_ID }}
private_key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
ref: ${{ needs.pr_info.outputs.branch_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Membership
id: verify-membership
uses: ./.github/actions/verify-membership
with:
github_token: ${{ steps.generate-token.outputs.token }}
organization_name: metabase
username: ${{ github.event.comment.user.login }}
- run: |
result=${{ steps.verify-membership.outputs.is_member }}
if [ $result == false ]; then
echo User ${{ github.event.comment.user.login }} is not a member of Metabase organization
exit 1
fi
- name: Fetch issue
uses: octokit/request-action@v2.x
id: fetch_issue
with:
route: GET ${{ github.event.issue.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch PR
uses: octokit/request-action@v2.x
id: fetch_pr
with:
route: GET ${{ fromJson(steps.fetch_issue.outputs.data).pull_request.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
percy:
timeout-minutes: 30
runs-on: buildjet-4vcpu-ubuntu-2004
needs: [pr_info]
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MB_EDITION: ee
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.pr_info.outputs.branch_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: percy-issue-comment
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- run: ./bin/build.sh
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Run maildev
run: docker run -d -p 1080:1080 -p 1025:1025 maildev/maildev:2.0.5
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_COMMIT: ${{ needs.pr_info.outputs.commit_sha }}
PERCY_BRANCH: ${{ needs.pr_info.outputs.branch_name }}
PERCY_PULL_REQUEST: ${{ needs.pr_info.outputs.pull_request_number }}

View File

@@ -1,39 +0,0 @@
# Triggers Percy job on pull requests that contain "visual" label
name: Percy visual tests
on:
pull_request:
types: [synchronize, labeled]
jobs:
percy:
if: contains(github.event.pull_request.labels.*.name, 'visual')
timeout-minutes: 30
runs-on: buildjet-4vcpu-ubuntu-2004
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MB_EDITION: ee
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: percy-visual-label
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- run: ./bin/build.sh
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Run maildev
run: docker run -d -p 1080:1080 -p 1025:1025 maildev/maildev:2.0.5
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

17
.github/workflows/perf-test-labeled.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Perf test command
on:
pull_request:
types: [ labeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
run-perf-test:
if: ${{ github.event.label.name == 'Run-perf' }}
uses: ./.github/workflows/perf-test.yml
with:
wait_for_uberjar: true
secrets: inherit

150
.github/workflows/perf-test.yml vendored Normal file
View File

@@ -0,0 +1,150 @@
name: CI for Perf tests
run-name: Run perf test for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
inputs:
wait_for_uberjar:
description: "Wait for uberjar build"
required: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
name: Build Metabase Docker image
timeout-minutes: 60
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
with:
registries: "${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}"
- name: Wait for uberjar
id: wait_for_uberjar
if: ${{ inputs.wait_for_uberjar == true }}
run: |
## Get workflow run id for uberjar build
curl -Ls --output e2e-tests.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/e2e-tests.yml/runs?head_sha=${{ github.event.pull_request.head.sha || github.sha }}
ID=$(jq -r '.workflow_runs[0].id' e2e-tests.json)
## Wait for uberjar build to complete
while [ true ]; do
curl -Ls --output uberjar.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${ID}/jobs?filter=latest
jq -r '.jobs[] | select(.name == "build (ee)") | .steps[] | select(.name == "Prepare uberjar artifact") | .status' uberjar.json | grep -q "completed" && break
echo "Waiting for uberjar build..."
sleep 10
done
echo "run_id=$(jq -r '.workflow_runs[0].id' e2e-tests.json)" >> $GITHUB_OUTPUT
- name: Retrieve uberjar artifact for ee
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.wait_for_uberjar && steps.wait_for_uberjar.outputs.run_id || github.run_id }}
- name: Move uberjar to bin/docker
run: |
jar xf target/uberjar/metabase.jar
mv target/uberjar/metabase.jar bin/docker/metabase.jar
- name: Build container
uses: docker/build-push-action@v6
with:
context: bin/docker/
platforms: linux/amd64
network: host
tags: ${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/metabase-enterprise:pr${{ github.event.number }}
push: true
launch_perf_test:
needs: [ build ]
runs-on: ubuntu-latest
name: Launch Perf Test
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Download Deployment YAML template
run: aws s3 cp s3://metabase-pr-env/perf-test-pr.yml.tmpl ./perf-test-pr.yml.tmpl
- name: Trim SHA
env:
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
id: split
run: echo "::set-output name=fragment::${SHA:5}"
- name: Render Deployment YAML
uses: nowactions/envsubst@v1
with:
input: ./perf-test-pr.yml.tmpl
output: ./perf-test-pr.yml
env:
IMAGE_TAG: pr${{ github.event.number }}
PR_NUMBER: ${{ github.event.number }}
RUN_ID: ${{ steps.split.outputs.fragment }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
TEST_NAME: test
- name: Deploy PR Review ENV
run: |
kubectl apply -f ./perf-test-pr.yml

View File

@@ -0,0 +1,15 @@
name: PR Closed or Unlabeled
on:
pull_request:
types: [ closed, unlabeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-env:
if: ${{ github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR-Env') || github.event.label.name == 'PR-Env' }}
uses: ./.github/workflows/pr-env-destroy.yml
secrets: inherit

71
.github/workflows/pr-env-destroy.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: CI for PR Review ENV Destroy
run-name: Destroying Dynamic PR Environment for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
jobs:
destroy_pr:
runs-on: ubuntu-latest
name: PR Review ENV Destroy
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Destroy PR Review ENV
run: |
kubectl delete metabase -n hosting-pr${{ github.event.number }} hosting-pr${{ github.event.number }}
kubectl delete ns hosting-pr${{ github.event.number }}
- name: Setup psql client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Drop app database if exists
run: |
PGPASSWORD='${{ secrets.PR_ENV_DB_PASSWORD }}' \
psql \
-h ${{ secrets.PR_ENV_DB_HOST }} \
-U ${{ secrets.PR_ENV_DB_USER }} \
-d ${{ secrets.PR_ENV_DB_NAME }} \
-c "DROP DATABASE IF EXISTS hosting_pr${{ github.event.number }};"

17
.github/workflows/pr-env-labeled.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: PR-Env labeled
on:
pull_request:
types: [ labeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-env:
if: ${{ github.event.label.name == 'PR-Env' }}
uses: ./.github/workflows/pr-env.yml
with:
wait_for_uberjar: true
secrets: inherit

169
.github/workflows/pr-env.yml vendored Normal file
View File

@@ -0,0 +1,169 @@
name: CI for PR Review ENV
run-name: Building Dynamic PR Environment for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
inputs:
wait_for_uberjar:
description: "Wait for uberjar build"
required: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
name: Build Metabase Docker image
timeout-minutes: 60
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
with:
registries: "${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}"
- name: Wait for uberjar
id: wait_for_uberjar
if: ${{ inputs.wait_for_uberjar == true }}
run: |
## Get workflow run id for uberjar build
curl -Ls --output e2e-tests.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/e2e-tests.yml/runs?head_sha=${{ github.event.pull_request.head.sha || github.sha }}
ID=$(jq -r '.workflow_runs[0].id' e2e-tests.json)
## Wait for uberjar build to complete
while [ true ]; do
curl -Ls --output uberjar.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${ID}/jobs?filter=latest
jq -r '.jobs[] | select(.name == "build (ee)") | .steps[] | select(.name == "Prepare uberjar artifact") | .status' uberjar.json | grep -q "completed" && break
echo "Waiting for uberjar build..."
sleep 10
done
echo "run_id=$(jq -r '.workflow_runs[0].id' e2e-tests.json)" >> $GITHUB_OUTPUT
- name: Retrieve uberjar artifact for ee
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.wait_for_uberjar && steps.wait_for_uberjar.outputs.run_id || github.run_id }}
- name: Move uberjar to bin/docker
run: |
jar xf target/uberjar/metabase.jar
mv target/uberjar/metabase.jar bin/docker/metabase.jar
- name: Build container
uses: docker/build-push-action@v6
with:
context: bin/docker/
platforms: linux/amd64
network: host
tags: ${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/metabase-enterprise:pr${{ github.event.number }}
push: true
deploy_pr:
needs: [ build ]
runs-on: ubuntu-latest
name: PR Review ENV
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Setup psql client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Create app database if not exists
run: |
export PGPASSWORD='${{ secrets.PR_ENV_DB_PASSWORD }}'
export PGUSER=${{ secrets.PR_ENV_DB_USER }}
export PGHOST=${{ secrets.PR_ENV_DB_HOST }}
export PGDATABASE=${{ secrets.PR_ENV_DB_NAME }}
psql -tc "SELECT 1 FROM pg_database WHERE datname = 'hosting_pr${{ github.event.number }}'" \
| grep -q 1 \
|| psql -c "CREATE DATABASE hosting_pr${{ github.event.number }}"
- name: Download Deployment YAML template
run: aws s3 cp s3://metabase-pr-env/metabase.yml.tmpl ./metabase.yml.tmpl
- name: Render Deployment YAML
uses: nowactions/envsubst@v1
with:
input: ./metabase.yml.tmpl
output: ./metabase.yml
env:
IMAGE_TAG: pr${{ github.event.number }}
PR_NUMBER: ${{ github.event.number }}
MB_PREMIUM_EMBEDDING_TOKEN: ${{ secrets.PR_ENV_MB_PREMIUM_EMBEDDING_TOKEN }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Deploy PR Review ENV
run: |
kubectl apply -f ./metabase.yml
preview_links:
runs-on: ubuntu-latest
needs: [ deploy_pr ]
steps:
- uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
message: |
👋 Deploying a preview environment for commit ${{ github.event.pull_request.head.sha || github.sha }}.
✅ Preview:
https://pr${{ github.event.number }}.coredev.metabase.com
🗒️ [login instructions](https://www.notion.so/metabase/Ephemeral-PR-Environments-c74a3710c87a460dbf4fc0007a001458)

View File

@@ -5,12 +5,16 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
description: "Metabase version (e.g. v0.46.3)"
type: string
required: true
commit:
description: 'A full-length commit SHA-1 hash'
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:
@@ -91,26 +95,26 @@ jobs:
edition: [oss, ee]
java-version: [11, 17]
steps:
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
with:
java-package: jre
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- run: java -version
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Launch uberjar (and keep it running)
run: java -jar ./metabase.jar &
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
with:
java-package: jre
java-version: ${{ matrix.java-version }}
distribution: "temurin"
- run: java -version
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Launch uberjar (and keep it running)
run: java -jar ./metabase.jar &
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
run-sanity-check:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [release-artifact, check-uberjar-health]
needs: [release-artifact]
strategy:
matrix:
edition: [oss, ee]
@@ -119,59 +123,63 @@ jobs:
DISPLAY: ""
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
# disabled because of out of memory issues
# probably related to https://github.com/cypress-io/cypress/issues/27415
CYPRESS_NO_COMMAND_LOG: 1
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
TERM: xterm
services:
maildev:
image: maildev/maildev:2.0.5
ports:
- "1080:1080"
- "1025:1025"
credentials:
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: "temurin"
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact for ${{ matrix.edition }}
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Get the version info
run: |
jar xf metabase.jar version.properties
mv version.properties resources/
- name: Run a few important Cypress tests as sanity check
run: |
mkdir -p ./target/uberjar && cp metabase.jar ./target/uberjar/metabase.jar
yarn test-cypress-run --folder onboarding
maildev: true
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact for ${{ matrix.edition }}
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Get the version info
run: |
jar xf metabase.jar version.properties
mv version.properties resources/
- name: Run a few important Cypress tests as sanity check
run: |
mkdir -p ./target/uberjar && cp metabase.jar ./target/uberjar/metabase.jar
yarn test-cypress-run \
--env grepTags="@smoke",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-failed-tests-recording
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-failed-tests-recording
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
containerize:
needs: [release-artifact, run-sanity-check]
needs: [release-artifact]
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
@@ -185,71 +193,71 @@ jobs:
outputs:
image_tag: ${{ steps.target.outputs.image_tag }}
steps:
- name: Get the version
run: |
if [[ "${{ matrix.edition }}" == "ee" ]]; then
echo "VERSION=${{ needs.release-artifact.outputs.ee_version }}" >> $GITHUB_ENV
else
echo "VERSION=${{ needs.release-artifact.outputs.oss_version }}" >> $GITHUB_ENV
fi
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Move the Uberjar to the context dir
run: mv metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/local-metabase:${{ env.VERSION }}
no-cache: true
push: true
- name: Get the version
run: |
if [[ "${{ matrix.edition }}" == "ee" ]]; then
echo "VERSION=${{ needs.release-artifact.outputs.ee_version }}" >> $GITHUB_ENV
else
echo "VERSION=${{ needs.release-artifact.outputs.oss_version }}" >> $GITHUB_ENV
fi
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Move the Uberjar to the context dir
run: mv metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/local-metabase:${{ env.VERSION }}
no-cache: true
push: true
- name: Launch container
run: docker run --rm -dp 3000:3000 localhost:5000/local-metabase:${{ env.VERSION }}
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Launch container
run: docker run --rm -dp 3000:3000 localhost:5000/local-metabase:${{ env.VERSION }}
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Retag and push container image to ${{ vars.DOCKERHUB_OWNER }} staging Docker Hub repo
id: target
run: |
# SHA-1 truncated to 7 digits should be enough
SHORT_HASH=${COMMIT:0:7}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Retag and push container image to ${{ vars.DOCKERHUB_OWNER }} staging Docker Hub repo
id: target
run: |
# SHA-1 truncated to 7 digits should be enough
SHORT_HASH=${COMMIT:0:7}
IMAGE_TAG=$VERSION-$SHORT_HASH
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
IMAGE_TAG=$VERSION-$SHORT_HASH
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "Retag local image for staging"
docker tag localhost:5000/local-metabase:$VERSION $CONTAINER_IMAGE
echo "Retag local image for staging"
docker tag localhost:5000/local-metabase:$VERSION $CONTAINER_IMAGE
echo "Pushing container image $CONTAINER_IMAGE ..."
docker push $CONTAINER_IMAGE
echo "Pushing container image $CONTAINER_IMAGE ..."
docker push $CONTAINER_IMAGE
echo "Finished!"
shell: bash
env:
COMMIT: ${{ needs.release-artifact.outputs.commit }}
echo "Finished!"
shell: bash
env:
COMMIT: ${{ needs.release-artifact.outputs.commit }}
verify-docker-pull:
runs-on: ubuntu-22.04
@@ -261,22 +269,80 @@ jobs:
env:
IMAGE_TAG: ${{ needs.containerize.outputs.image_tag }}
steps:
- name: Login to Docker Hub # authenticated, to avoid being rate-throttled
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Pull the container image
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
echo "Pulling container image $CONTAINER_IMAGE ..."
docker pull $CONTAINER_IMAGE
echo "Successful!"
- name: Launch container
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
docker run --rm -dp 3000:3000 $CONTAINER_IMAGE
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Login to Docker Hub # authenticated, to avoid being rate-throttled
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Pull the container image
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
echo "Pulling container image $CONTAINER_IMAGE ..."
docker pull $CONTAINER_IMAGE
echo "Successful!"
- name: Launch container
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
docker run --rm -dp 3000:3000 $CONTAINER_IMAGE
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
trigger-auto-publish:
if: ${{ inputs.auto }}
needs: [run-sanity-check, check-uberjar-health, verify-docker-pull]
permissions:
actions: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: trigger auto publish
uses: actions/github-script@v7
with:
script: | # js
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
auto: true,
}
});
tests-complete-message:
if: always()
runs-on: ubuntu-22.04
needs: [run-sanity-check, check-uberjar-health, verify-docker-pull]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send tests complete message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendTestsCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
const allJobsSuccessful =
'${{ needs.run-sanity-check.result }}' === 'success' &&
'${{ needs.check-uberjar-health.result }}' === 'success' &&
'${{ needs.verify-docker-pull.result }}' === 'success';
await sendTestsCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
testStatus: allJobsSuccessful ? 'success' : 'failure',
}).catch(console.error);

View File

@@ -1,3 +1,8 @@
# this file uses MBA https://github.com/metabase/mba to spin up a Metabase
# instance then runs the test script in the MBA instance sharing the same
# network to interact with presto container
# TODO: get rid of MBA and use actions/prepare-backend instead
name: Kerberized Presto Integration Test
on:
@@ -5,10 +10,10 @@ on:
push:
branches:
- master
- 'release**'
- 'feature**'
- "release**"
- "feature**"
tags:
- '**'
- "**"
jobs:
files-changed:
@@ -52,7 +57,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
path: presto-kerberos-docker
- name: Bring up Presto+Kerberos cluster
run: cd presto-kerberos-docker && docker-compose up -d && cd ..
run: cd presto-kerberos-docker && docker compose up -d && cd ..
- name: Run Presto test query from command line (sanity check)
run: cd presto-kerberos-docker && ./test.sh && cd ..
# Since we are managing the Docker containers from the GitHub action container, we need to copy all the
@@ -63,6 +68,7 @@ jobs:
run: docker cp presto-kerberos:/etc/krb5.conf resources
- name: Copy client.keytab file to resources
run: docker cp presto-kerberos:/home/presto/client.keytab resources
- name: Checkout mba
uses: actions/checkout@v4
with:
@@ -74,11 +80,30 @@ jobs:
run: ls -latr mba-src
- name: Symlink mba
run: cd mba-src && sudo ln -s $(pwd)/src/main.clj /usr/local/bin/mba && chmod +x /usr/local/bin/mba && cd ..
- name: Ensure mba
run: which mba
- name: Run Metabase via MBA
run: /home/runner/work/metabase/metabase/mba-src/src/main.clj --mb . --data-db postgres-data -n example.com up
run: mba --mb . --data-db postgres-data -n example.com compose config > mba-compose.yml
- name: Adjust generated docker-compose config
uses: actions/github-script@v7
with:
script: | #js
const fs = require("fs");
const config = fs.readFileSync("mba-compose.yml", "utf8");
const newConfig = config.replace(
/name:\s+example.com/,
"name: example.com\n external: true",
);
fs.writeFileSync("mba-compose.yml", newConfig);
- name: Print compose config
run: cat mba-compose.yml
- name: Run mba
run: docker compose -f mba-compose.yml up -d
- name: Run test script in MBA instance
run: >
mba --mb . --data-db postgres-data -n example.com \
run .github/scripts/run-presto-kerberos-integration-test.sh
run: docker compose -f mba-compose.yml exec metabase .github/scripts/run-presto-kerberos-integration-test.sh

View File

@@ -0,0 +1,254 @@
name: Release Metabase Embedding SDK for React
on:
workflow_dispatch:
inputs:
# TODO: Add a version validation, so the workflow won't fail when publishing to npm
sdk_version:
description: 'SDK version (e.g. 0.1.3)'
type: string
required: true
git_ref:
description: 'A git commit hash that will be used to build the SDK'
type: string
required: true
concurrency:
# We want to ensure only one job is running at a time because
# there could be a conflict when updating the readme file.
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
check-git-tag:
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
fetch-tags: true
- name: check tags
run: |
if [ $(git tag -l | grep $tag$) ]
then
echo "::error::Tag '${{ env.tag }}' already exists. If you expect to run this workflow with the same tag, please remove the tag first and rerun this workflow again."
exit 1
else
exit 0
fi
test:
needs: check-git-tag
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "release-sdk"
- name: Run unit tests
run: yarn embedding-sdk:test-unit
build-sdk:
needs: test
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
fetch-tags: true
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "release-sdk"
- name: Update readme
run: |
./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
# NOTE: this should happen before "Build SDK bundle" as we inject SDK version into the code during build step
run: |
./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
- name: Update changelog
run: |
yarn embedding-sdk:generate-changelog -o changelog-diff
- name: Build SDK bundle
run: yarn run build-embedding-sdk
- name: Generate SDK package.json in the build directory
run: yarn run embedding-sdk:generate-package
- name: Upload built SDK package as artifact
uses: actions/upload-artifact@v4
with:
name: metabase-sdk
path: ./resources/embedding-sdk
- name: Upload changelog diff
uses: actions/upload-artifact@v4
with:
name: sdk-changelog-diff
path: ./changelog-diff
build-jar:
needs: test
uses: ./.github/workflows/uberjar-sdk.yml
with:
git_ref: ${{ inputs.git_ref }}
image_name: embedding-sdk-${{ inputs.sdk_version }}
secrets: inherit
upload-jar:
needs: build-jar
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-ee-uberjar
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Upload uberjar to S3
env:
BUCKET: ${{ vars.AWS_S3_DOWNLOADS_BUCKET }}
BUCKET_PATH: sdk/v${{ inputs.sdk_version }}/metabase.jar
FILE: ./target/uberjar/metabase.jar
shell: bash
run: |
aws s3 cp $FILE s3://$BUCKET/$BUCKET_PATH
publish-npm:
needs: [build-sdk, upload-jar]
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out master to prepare for a SDK version bump PR
uses: actions/checkout@v4
with:
# when we created version update PR, it would only have diff from 2 files SDK readme and SDK package.json template
ref: master
- name: Setup git user
run: |
git config --global user.email "github-automation@metabase.com"
git config --global user.name "Metabase Automation"
- name: Update readme
run: |
bash ./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
run: |
bash ./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
- name: Retrieve SDK changelog diff
uses: actions/download-artifact@v4
with:
name: sdk-changelog-diff
- name: Update changelog
run: |
cat changelog-diff enterprise/frontend/src/embedding-sdk/CHANGELOG.md > new-changelog
mv new-changelog enterprise/frontend/src/embedding-sdk/CHANGELOG.md
- name: Create a PR updating readme + published version, and changelog (using GitHub Metabase Automation account)
run: |
git checkout -b update-sdk-version-${{ inputs.sdk_version }}
git commit -a -m 'Update Readme version references and published npm version to ${{ inputs.sdk_version }}'
git push origin HEAD
gh pr create --base master\
--assignee "${GITHUB_ACTOR}"\
--title "Update SDK version to ${{ inputs.sdk_version }}"\
--body "Update Readme version references and published npm package version to ${{ inputs.sdk_version }}"
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.METABASE_BOT_APP_ID }}
private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- name: Edit PR adding useful information (using Metabase bot app)
run: |
gh pr edit --add-reviewer @metabase/embedding --add-label no-backport
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Auto approve PR (using GitHub Actions account)
run: |
gh pr review --approve
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable Pull request auto-merge (using GitHub Metabase Automation account)
run: |
gh pr merge --auto --squash
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Retrieve build SDK package artifact
uses: actions/download-artifact@v4
with:
name: metabase-sdk
path: sdk
- name: Publish to NPM
run: |
cd sdk
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_RELEASE_TOKEN }} > .npmrc
npm publish
git-tag:
needs: publish-npm
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
# Lightweight tags don't need committer name and email
- name: Create a new git tag
run: |
git tag ${{ env.tag }}
- name: Push the new tag
id : push-tag
run: |
git push origin ${{ env.tag }}

43
.github/workflows/release-log.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Update Release Log
run-name: Update Release Log ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Major Metabase version (e.g. 45, 52, 68)'
type: number
required: true
schedule:
- cron: '45 * * * *' # hourly
jobs:
update-release-log:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
VERSION: ${{ github.event_name == 'workflow_dispatch' && inputs.version || 50 }} # Update this for the next major release
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- uses: actions/checkout@v4
with:
fetch-depth: 0 # we want all branches and tags
- name: Install Dependencies
run: yarn --cwd release --frozen-lockfile && npm i -g tsx
- name: generate release Log
run: cd release && tsx ./src/release-log.ts $VERSION > v$VERSION.html
- name: upload release log to the web
run: |
aws s3 cp \
release/v$VERSION.html \
s3://${{ vars.AWS_S3_STATIC_BUCKET }}/release-log/v$VERSION.html
- name: Create cloudfront invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths /release-log/v$VERSION.html

View File

@@ -0,0 +1,53 @@
name: Release Milestone Check
run-name: Pre-release Milestone check for ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: "Metabase version (e.g. v0.46.3)"
type: string
required: true
commit:
description: "A full-length commit SHA-1 hash"
required: true
jobs:
check-milestone:
permissions: write-all
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: yarn --cwd release --frozen-lockfile && yarn --cwd release build
- uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const {
checkMilestoneForRelease,
sendMilestoneCheckMessage,
} = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const commitHash = '${{ inputs.commit }}';
const issueCount = await checkMilestoneForRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version,
commitHash,
});
await sendMilestoneCheckMessage({
channelName: process.env.SLACK_RELEASE_CHANNEL,
issueCount,
version,
});

Some files were not shown because too many files have changed in this diff Show More