Compare commits

...

1193 Commits

Author SHA1 Message Date
adam-james
ff11bd7f79 Merge branch 'master' into attach-render-errors-subscriptions 2024-06-03 08:04:14 -07: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
Adam James
39c81419e8 Add a card query error test 2024-05-28 17:28:44 -07:00
adam-james
0d95540349 Merge branch 'master' into attach-render-errors-subscriptions 2024-05-28 16:48:27 -07: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
Adam James
f3a26b5135 was using the wrong key here, not sure why, maybe it changed recently? 2024-05-28 15:32:30 -07: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
adam-james
a5c33e1756 Merge branch 'master' into attach-render-errors-subscriptions 2024-05-28 13:33:42 -07: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
Adam James
b89f86c568 add back some changes from master 2024-05-28 10:52:44 -07: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
Adam James
e108633f36 Fix lint errors 2024-05-27 16:57:54 -07: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
Adam James
a54ef9bc99 fix some code looking at messages when it should now be attachments 2024-05-27 15:48:52 -07:00
adam-james
9705d8976f Merge branch 'master' into attach-render-errors-subscriptions 2024-05-27 15:13:54 -07: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
Adam James
a222ac98c0 WIP on making the test actually capture the error behaviour
Not sure if this is actually doing what I need it to yet
2024-03-25 08:26:08 -07: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
520b1f6320 Merge branch 'attach-render-errors-subscriptions' of https://github.com/metabase/metabase into attach-render-errors-subscriptions 2024-03-22 16:15:36 -07:00
Adam James
4a9d63ebc7 Add test that asserts error attachment exists when error occurs. 2024-03-22 16:13:22 -07: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
adam-james
e16bfa4a76 Merge branch 'master' into attach-render-errors-subscriptions 2024-03-22 13:50:16 -07: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
adam-james
d0148baa24 Merge branch 'master' into attach-render-errors-subscriptions 2024-03-21 08:57:44 -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
Adam James
3e5d3985d8 Fix viz-settings in error attachment 2024-03-19 15:31:36 -07:00
Adam James
6a61796277 Attach Static-viz render errors to subscription emails
Fixes: #39814

Our static-viz renders an error message into subscription emails if the render failed, but it provides no further
details as to what caused the failure.

This PR adds a .txt attachment in the case of a card render or card query failure. The contents of the text file are a
short message about the problem with the card's name, the visualization_settings that the card was rendered with, and
the stacktrace.

This should be helpful if a user is reporting a render error as a bug since this can be attached or copy/pasted into
the bug report.

The attachment was used so that the actualy body of the email remains clean/legible.
2024-03-19 15:19:43 -07: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
Cam Saul
c27b676921 MLv2 normalization overhaul (#40142)
* 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
2024-03-15 23:47:36 +00:00
Nemanja Glumac
4daaa7a0ac Re-export Mantine rem util (#40184)
* Re-export `rem` helper from Mantine

* Use `rem` in a few components as a PoC
2024-03-15 21:21:21 +01:00
Sloan Sparger
edd4141554 👷‍♂️ RTKQuery integration: Setup (#39092) 2024-03-15 15:06:55 -05:00
Victor Vieux
9c44af4767 Add hostname support to snowflake (#39471)
* Add alternative hostname support to snowflake

* move hostname support out of additional details

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

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

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

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

* Update modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj

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

* opt-in

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-03-15 15:29:01 -04:00
Jeff Bruemmer
2ae6ade21d update list of releases (#40192) 2024-03-15 14:26:28 -04:00
Case Nelson
5b72f4d4eb Fix duplicate native column nesting (#39476)
* Fix duplicate native column nesting

* Try wrapping source-query in WITH statement

* Fix tests

* Fix tests

* Only wrap in with when needed

* More fixes

* Update names and comments

* Address PR review
2024-03-15 11:45:12 -06:00
Nemanja Glumac
4806e787b2 Fix notebook being unable to resize (#40136)
* Use Mantine instead of styled components

* Fix notebook being unable to resize

Fixes #33982

* Address review commments
2024-03-15 14:14:40 +00:00
Nemanja Glumac
53e220cb80 Use Mantine for DataSelector table picker (#40105) 2024-03-15 14:52:45 +01:00
Noah Moss
d01a7c8ec5 Remove activity table and model (#40017) 2024-03-15 09:06:22 -04:00
Kamil Mielnik
7a8d3ccbd7 Fix milestone name in release script (#40169)
* Fix milestone name for gold version

* Reuse getMilestoneName

* Add more tests
2024-03-15 19:48:08 +07:00
Nemanja Glumac
4f7b562c90 Fix the stale collection information when the source in the data selector changes (#40063)
* Bridge out of sync collection information between the card and the state

* Account for models

* Use existing helpers

* Create virtual schema if it doesn't exist yet

* Add E2E reproduction for #39812

* Create virtual schema if it doesn't exist yet

* Create virtual schema if it doesn't exist yet

* Create virtual schema if it doesn't exist yet

* Expand the reproduction to include the nested question scenario

* Improve assertions

* Convert E2E repro to TS

* Fix tests

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-03-15 13:40:21 +01:00
Jeff Bruemmer
4a1455a562 docs - fix anchor links (#40148) 2024-03-15 08:12:59 -04:00
Alexander Polyankin
6abe3d4d88 Fix png download in safari in embedding (#40130) 2024-03-15 13:13:50 +02:00
Braden Shepherdson
374c0bbe04 [MLv2] Offer only compatible units for "Extract" drill-thru (#40147)
Eg. for a date column without a time, don't offer "Hour of day" as a
choice. For a time column without the date, only offer "Hour of day".

Fixes #40125.
2024-03-15 12:01:14 +01:00
Nemanja Glumac
35cf89a591 Fix multi-schema data selector header styling (#40101)
* Fix multi-schema data selector header styling

- Makes spacing equal on both sides of the divider
- Changes the divider from the hyphen to the forward slash

* Change the breadcrumb divider in the Table Metadata section
2024-03-15 10:16:28 +01:00
Ngoc Khuat
04eb3949d4 Add fingerprint as a driver feature (#40155) 2024-03-15 05:23:13 +00:00
Chris Truter
22880c8252 Add test for column re-ordering (#39948) 2024-03-15 01:48:23 +00:00
Ngoc Khuat
a4d955caf7 Mention dev-scripts and UTM in dev namespace doc (#40118) 2024-03-15 00:39:30 +00:00
Denis Berezin
ac0bb151d0 Global to local css migration - Buttons (#40103)
* Global styles refactor

* Add missing test change

* Fix e2e

* Migrate buttons

* Migrate buttons

* Fix review
2024-03-14 22:41:18 +03:00
Alexander Polyankin
ed7e147b7c Add UI to swap clauses in the notebook (#39205) (#40131) 2024-03-14 16:06:59 +00:00
Denis Berezin
f73b40c5ab Global to local css migration - part of global styles (#39324)
* Global styles refactor

* Add missing test change

* Fix e2e

* Review fixes
2024-03-14 18:44:24 +03:00
Alex Yarosh
4ab6720ca7 [Docs] Fix outdated UI references (#38612) 2024-03-14 10:47:27 -04:00
Tim Macdonald
3093f7c3e9 SQL Lineage: Track field usage, expose stale queries (#39707)
* SQL Lineage: Create the QueryField model

This links Cards (with native queries) to Fields, showing us which
queries use which Fields.

QueryFields are automatically maintained as part of the Card lifecycle

Cards with stale queries (powered by QueryField info) are exposed via the `card?f=stale` API
2024-03-14 12:34:11 +00:00
Cal Herries
37b50677ed Faster sync-fields (#38828) 2024-03-14 11:54:29 +00:00
Raphael Krut-Landau
e8da11c117 Don't include blank actions in the entitymenu (#40111)
Fixes a problem introduced in #39782
2024-03-14 07:48:12 -04:00
Cal Herries
a94ece6fb4 Forward-port changes from 49 backport: Faster sync-fks for redshift (#38970) (#40092) 2024-03-14 10:27:38 +02:00
Cal Herries
b8b7674bc1 TableDefinition can define a composite PK (#40006)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-03-14 10:27:25 +02:00
Raphael Krut-Landau
45a2e8689f Remove Models from Browse data (#40108) 2024-03-13 19:09:19 -04:00
Noah Moss
4711aa3134 Don't store analytics checksum if audit loading failed (#40097) 2024-03-13 21:03:25 +00:00
Alex Yarosh
ca0ab83475 cloud doesn't support vpn (#40090) 2024-03-13 13:24:44 -06:00
Taqveer Doha
c9105d0b38 Update saml-keycloak.md (#39645) 2024-03-13 14:56:32 -04:00
Alex Yarosh
888531c9ac [docs] Explicit callouts about data download in embedding (#40049)
* explicit callout for data download

* rephrase "data download" -> "download results"

* review suggestions

* wrong link
2024-03-13 12:49:52 -06:00
Jesse Devaney
3fc34fcc1c fix sidebar border on x-rays (#40029) 2024-03-13 18:25:14 +00:00
Ryan Laurie
ec2bdffd07 Update Translations for v49 (#40089)
* updated pot file for v49

* update translations for 49
2024-03-13 12:18:55 -06:00
Nemanja Glumac
5d94143f8c Fix @cypress/grep types by upgrading the library to its latest version (#40079)
* Upgrade Cypress grep library to its latest version

* Add Cypress grep types to our E2E TS config

* PoC: Convert existing JS Cypress spec to TS
2024-03-13 16:43:23 +01:00
Alexander Polyankin
9e445bd644 Fix scrolling with filter field values (#40075) 2024-03-13 17:20:16 +02:00
Alexander Polyankin
2e9e95c085 Extract action column placement (#39958) 2024-03-13 15:19:30 +00:00
Jeff Bruemmer
1174c1130d docs - csv append (#38974) 2024-03-13 11:04:49 -04:00
Chris Truter
4e9bc02345 Clean up CSV type inference interface (#39822) 2024-03-13 14:47:09 +00:00
Cal Herries
db182076a2 Add issue links for some TODOs (#40056) 2024-03-13 14:19:09 +00:00
Alex Yarosh
7c2adc7cf0 [docs] Clarifications about dashboard subscriptions (#40045)
* some clarifications around subscriptions

* 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-13 08:12:22 -06:00
Nemanja Glumac
75340b9ca1 Correctly show a selected table (in the data selector) which comes from a multi-schema database (#39930)
* Show selected table in the data selector

Fixes #39807.

* Build schema information when table is selected

* Remove now unused method

* Update only the selected schema id information

* Obtain schema id from the state

* Introduce multiple schemas to the writable database

* Add E2E reproduction for #39807

* Fix unit test

* Fetch schema if needed according to the new condition
2024-03-13 15:01:34 +01:00
Oisin Coveney
5a1815e6b3 Add token parameter to JWT SSO (#39941)
Co-authored-by: Tim Macdonald <tim@metabase.com>
2024-03-13 15:50:53 +02:00
Jeff Bruemmer
3e476668a8 Revert "docs - update basic exploration (#39559)" (#40067)
This reverts commit 9413706bd2.
2024-03-13 09:37:34 -04:00
Romeo Van Snick
c954802b8f search display name in filter picker (#40002)
* Add reproduction for spaces breaking the search in filter pickers

* Search using display name too

* Search using display name in summarize picker
2024-03-13 14:36:58 +01:00
Alexander Polyankin
1a232f0e64 Elevate selected filter field values (#40055) 2024-03-13 15:09:57 +02:00
Ngoc Khuat
c8cb2d138e fix redshift flake by not clean up tables on some tests (#40060) 2024-03-13 18:48:03 +07:00
Cal Herries
f0afae8ca7 Faster sync-fks (#38970) 2024-03-13 12:21:27 +02:00
Alexander Polyankin
f1a8da9c0c Make static field values select searchable (#40054) 2024-03-13 08:48:54 +00:00
Alexander Polyankin
fd6fab28ca Move metabase-lib v1 to a sub folder (#39975)
* v1

* v1

* v1

* Move sync code

* Small refactor
2024-03-13 07:22:39 +00:00
Kamil Mielnik
e96f896cc7 Repro #29943 - Wrong field highlighted when editing model metadata if custom column added to left of column (#39996)
* Repro #29943 - Wrong field highlighted when editing model metadata if custom column added to left of column

* Refactor assertions

* Reuse getHeaderCell
2024-03-13 14:04:46 +07:00
Ngoc Khuat
5d33359578 Postgres: Fix sync does not recognize schema with backslashes (#38946) 2024-03-13 06:04:30 +07:00
Braden Shepherdson
8cb7f8dd74 [QP] When querying a bare model with parameters, wrap an extra stage (#39963)
This matches how models are visualized, and how the parameters are
attached to them in the first place - an extra ad-hoc query is wrapped
around the model.

Because of that wrapping, a parameter will be targeting a model's field
by name rather than by ID, but that parameter cannot be applied directly
on the model's last stage.

Fixes #39940.
2024-03-12 22:22:21 +00:00
Noah Moss
4163a2e3b6 Add LDAP logging (#40036) 2024-03-12 21:37:34 +00:00
bryan
7fedfd6d67 No view logging for oss (#39957)
* move log-enabled? into premium-features

* only `record-views!` when `log-enabled?`

* test that view-log entries arent created in oss

* simplify test

* fix new test fails: we don't log views in OSS.

* fix 3 more view logging tests (they dont do anything in oss)

* fix dashboard-read-ee-test

- check for `log-enabled?` not `ee-available?`

* fix the rest of the tests

- Only check for view logs when (premium-features/log-enabled?) is falsey

* adjusting e2e test

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-03-12 14:48:44 -06:00
adam-james
669adc3a4f Adam backend triage todo changes (#40022)
* Add issue number to todos in models.card

* Add issue number to todos in models.pulse

* Add issue number to todos in models.dashboard-card
2024-03-12 18:54:52 +00:00
Braden Shepherdson
f6769eacf8 [MLv2] Include implicit joins for breakout/order on models (#39801)
Fixes #39657.
2024-03-12 18:09:54 +00:00
Jesse Devaney
4756228932 focus the top card in newly created section (#39961) 2024-03-12 17:28:38 +00:00
Vamsi Peri
e03cc6735b Change team board for QPD team (#39987) 2024-03-12 18:15:23 +01:00
Jeff Bruemmer
2421226810 load analytics content (#40001) 2024-03-12 12:55:57 -03:00
Jeff Bruemmer
af506a9811 docs - add refresh parameter (#39452) 2024-03-12 11:28:49 -04:00
Cal Herries
cfb1a7164b Remove TODOs and warnings around hard deletes (#39994) 2024-03-12 17:22:33 +02:00
Jeff Bruemmer
4cc374999c add link (#39962) 2024-03-12 09:01:25 -04:00
Nicolò Pretto
68a232e51a setup e2e with token activation (#39931)
* setup e2e with token activation

* add assertion that the step is actually present
2024-03-12 12:39:22 +01:00
Romeo Van Snick
1845469be0 Detect the use of unsupported features in the expression editor (#39778)
* Detect the use of unsupported features in the expression editor

* Use an object to pass parameters to resolve

* Handle clauses that do not require feature

* Use postgres-12 for testing datetime functions
2024-03-12 12:20:39 +01:00
Ngoc Khuat
49293fb1e1 Tech debt issue from group 4 (#39347)
Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
2024-03-12 08:47:04 +00:00
Ngoc Khuat
8eba042efa TableDefinition can define a custom PK (#39038) 2024-03-12 08:45:40 +00:00
Romeo Van Snick
da96c24f80 Split up "Doing science..." message (#39619)
* Convert QueryVisualization to a functional component

* Add a custom message after loading for a while

* Add test for slow database message

* Loop through different custom messages

* Use cy.clock to test timeouts

* Make getLoadingMessage a function
2024-03-12 08:27:15 +01:00
Cal Herries
8243fbb5a8 Revert updating FKs during metadata sync (#39679) (#39924) 2024-03-12 08:12:34 +02:00
Ngoc Khuat
0b0ea8feb1 Fix unable to start on windows with h2 (#39739) 2024-03-12 03:33:18 +00:00
Braden Shepherdson
796256c57c [MLv2] Introduce swap-clauses to reorder aggregations, etc. (#39850)
This includes some generative testing, since that felt like
a great way to try all kinds of permutations of swapping clauses.

This also patches `metabase.types/assignable?` to memoize it.
Deeply nested `assignable?` calls made 100 tests of swapping
filters take 1600ms rather than the 50-60ms of the other clauses.

I think this is safe and reasonable on memory to cache forever,
but speak up if you're concerned. There's perhaps O(60) type
keywords, so `type X type -> Boolean` is a small space impact.

Fixes #39215.
2024-03-11 22:26:47 +00:00
Case Nelson
7a5912e1b4 [Metrics V2] query processor phase 1 (#39955)
* [Metrics V2] query processor phase 1

* Use :sources drop and :metric-dimensions for now

* Fix tests, address review comments

* Fix as bug
2024-03-11 15:58:11 -06:00
Cam Saul
5bbc0aa7ea Convert QP to MLv2 Part 2 (#39824)
* Keep fetch_source_query.clj

* Copy fetch_source_query.clj into fetch_source_query_legacy.clj

* Set back fetch_source_query.clj file

* Convert QP to MLv2, part 1

* Keep legacy implementation around for time being

* Port thru convert-to-legacy

* expand-macros is converted to legacy

* Test fixes 🔧

* Test fixes and better keys

* Test fixes

* Test fixes 🔧

* More test fixes 🔧

* Test fix? 🔧

* Wow, maybe I finally fixed everything 🔧

* Last few test fixes 🔧

* PR feedback; lib.walk should support splicing in multiple replacement stages

* Update fetch-source-query to use improved lib.walk

* Have I fixed everything now? 🔧

* Remove stray println

* Another MongoDB fix 🔧

* Convert QP to MLv2 Part 2

* Remove most of the fetch-source-query-legacy stuff

* Remove the changes to expand-macros for now, we can do that in a follow-on PR.

* Test fix

* Test fix

* TEST FIXES?! 🔧

* Kondo & test fixes

* Oops, make sure we have the updated tests

* Fixes 🔧

* Test fixes 🔧

* Convert resolve-source-table

* Appease Kondo

* Unparallelize the tests

* Another test that shouldn't be parallel

* Make tests more robust

* Test fixes 🔧
2024-03-11 16:12:12 -04:00
lbrdnk
0dc0485369 Update expression-parts to satisfy filter picker (#39650)
* Update expression-parts to satisfy filter picker

* Address review remarks and implement to-range for quarter

* Add coercion check to extensibility condition

* Make coerce-to-timestamp return nil for uncoercible arg value
2024-03-11 20:39:15 +01:00
Noah Moss
8c2792770b Clean up unused perms code (#39875) 2024-03-11 19:22:22 +00:00
dpsutton
1e7823d176 Db api (#39731)
* first move to a db api

* mdb.spec into mdb

* mdb.u/isa -> mdb.query/isa

* mdb.u/qualify -> mdb.query/qualify

* last of mbql.u -> mbql.query and 🔫mbql.u🎇

* remove last of the mdb.connection/db-type and use from mdb/db-type

* remove the last non-cmd usages of mdb.connection

had some circularity in

models.interface requires mdb/db-type for sql flavored "now"
mdb requires db/setup
which requires db/custom_migrations to ensure they are on cp
custom migration requires json functions in models.interface

so had to do a dynamic require for the db-type

* get db-type from mdb not mdb.env

* invoke `(mdb/app-db)` and not pass a var. lots of things fail

* mdb.setup/migrate! into mdb with potemkin

* remove get-connection. call .getConnection on the app-db

perhaps invites clumsy usage outside of `with-open` if it's a top level
function

* namespace docstrings

* last few and grab db.env/db-file into api ns

* lint cleanup

* addresses PR comments
2024-03-11 12:38:26 -05:00
Jeff Bruemmer
41aed8c32b docs - add filter customization (#39719) 2024-03-11 12:10:33 -04:00
Jeff Bruemmer
6966d201e7 add embedding step (#39790) 2024-03-11 11:45:23 -04:00
5519 changed files with 764016 additions and 299741 deletions

View File

@@ -1,7 +1,8 @@
{:config-paths ["macros"]
;; -*- comment-column: 100; -*-
{:config-paths ["macros" "src"]
:linters
{:aliased-namespace-symbol {:level :warning}
:invalid-arity {:skip-args [metabase.mbql.util.match/match]} ; TODO (cam): can we fix these?
:invalid-arity {:skip-args [metabase.lib.util.match/match]} ; TODO (cam): can we fix these?
:keyword-binding {:level :warning}
:main-without-gen-class {:level :warning}
:misplaced-docstring {:level :warning}
@@ -14,11 +15,20 @@
:redundant-fn-wrapper {:level :warning}
:refer-all {:level :warning, :exclude [clojure.test]}
:single-key-in {:level :warning}
:unsorted-required-namespaces {:level :warning}
:unused-referred-var {:exclude {compojure.core [GET DELETE POST PUT]}}
:use {:level :warning}
:warn-on-reflection {:level :warning}
:metabase/defsetting-must-specify-export {:level :warning}
:metabase/defsetting-must-specify-export {:level :warning}
:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests {:level :warning}
:metabase/mbql-query-first-arg {:level :warning}
:metabase/missing-test-expr-requires-in-cljs {:level :warning}
:metabase/require-shape-checker {:level :warning}
:metabase/test-helpers-use-non-thread-safe-functions {:level :warning}
:metabase/validate-deftest {:level :warning}
:metabase/validate-logging {:level :warning}
:metabase/warn-about-schema= {:level :warning}
;;
;; disabled linters
@@ -34,6 +44,7 @@
;; :docstring-leading-trailing-whitespace {:level :warning}
;; :docstring-no-summary {:level :warning}
;; :shadowed-var {:level :warning}
;; :def-fn {:level :warning}
:unresolved-symbol
{:exclude
@@ -47,14 +58,10 @@
instaparse.core/transform
(metabase.async.streaming-response/streaming-response)
(metabase.driver.druid.query-processor-test/druid-query-returning-rows)
(metabase.mbql.util.match/match)
(metabase.mbql.util.match/match-one)
(metabase.mbql.util.match/replace)
(metabase.mbql.util.match/replace-in)
(metabase.mbql.util/match)
(metabase.mbql.util/match-one)
(metabase.mbql.util/replace)
(metabase.mbql.util/replace-in)
(metabase.lib.util.match/match)
(metabase.lib.util.match/match-one)
(metabase.lib.util.match/replace)
(metabase.lib.util.match/replace-in)
(metabase.query-processor.middleware.cache-backend.interface/with-cached-results)
(metabase.util.regex/rx [opt])
(metabase.util/prog1 [<>])
@@ -118,298 +125,472 @@
{:exclude
[colorize.core]}
:unsorted-required-namespaces {:level :warning}
;; A "module" is any `metabase.x` namespace in `src`.
:metabase/ns-module-checker
{:level :warning
;; Map of module name => the "core" external public-facing API namespace(s). You have three options here:
;;
;; 1. Special sentinel value `:any` means means this module does not (yet) have external public-facing API
;; namespace(s). This is mostly a temporary placeholder until we go in and create module namespaces, which means
;; you should go create one.
;;
;; 2. A set of namespace symbols. All namespaces in other modules will only be allowed ;; to use namespaces from
;; this set. Ideally this set should only have one namespace, but restricting it to a set of several is still
;; better than `:any`.
;;
;; 3. `nil` or not listed here -- we default to assuming there is one API namespace that matches the name of the
;; module itself, e.g. the module namespace for `metabase.setup` would be `metabase.setup`.
;;
;; `nil` or an empty set Otherwise this should be a set of namespace symbols.
;;
;; PRO TIP: Check out the `dev.deps-graph` namespace for helpful tools to see where a module is used externally.
:api-namespaces
{metabase.actions #{metabase.actions.core}
metabase.analytics #{metabase.analytics.prometheus
metabase.analytics.snowplow
metabase.analytics.stats} ; TODO -- consolidate these into a real API namespace.
metabase.analyze #{metabase.analyze}
metabase.api #{metabase.api.common
metabase.api.dataset
metabase.api.permission-graph
metabase.api.routes} ; TODO -- consolidate these into a real API namespace. I think the `*current-user*` type stuff might need to be moved into a separate module.
metabase.async #{metabase.async.streaming-response
metabase.async.streaming-response.thread-pool
metabase.async.util} ; TODO -- consolidate these into a real API namespace.
metabase.bootstrap #{metabase.bootstrap}
metabase.cmd #{} ; there are no namespaces here since you shouldn't be using this in any other module.
metabase.config #{metabase.config}
metabase.core #{metabase.core.initialization-status} ; TODO -- only namespace used outside of EE, this probably belongs in `metabase.server` anyway since that's the only place it's used.
metabase.db #{metabase.db
metabase.db.metadata-queries ; TODO this should probably be separate from metabase.db
metabase.db.query ; TODO this is mostly util stuff like `metabase.db.query/query` that we don't even need anymore.
metabase.db.setup} ; TODO these are only calling `metabase.db.setup/setup-db!` and there's a slightly different version in `metabase.db`
metabase.driver :any ; TODO -- 19 namespaces!!!! CRY
metabase.email #{metabase.email
metabase.email.messages} ; TODO -- consolidate these into a real API namespace.
metabase.embed #{metabase.embed.settings}
metabase.events #{metabase.events}
metabase.formatter #{metabase.formatter}
metabase.integrations #{metabase.integrations.common
metabase.integrations.google
metabase.integrations.ldap
metabase.integrations.slack} ; TODO -- consolidate these into a real API namespace.
metabase.legacy-mbql #{metabase.legacy-mbql.normalize
metabase.legacy-mbql.predicates
metabase.legacy-mbql.schema
metabase.legacy-mbql.schema.helpers
metabase.legacy-mbql.util} ; TODO -- consolidate these into a real API namespace.
metabase.lib :any ; TODO -- :cry: 34 externally referenced namespaces, but maybe half of them are schema namespaces which technically don't need to be required.
metabase.logger #{metabase.logger}
metabase.metabot #{metabase.metabot}
metabase.models :any ; TODO -- scream, 62 namespaces used elsewhere, but to be fair a lot of these don't *need* to be required.
metabase.moderation #{metabase.moderation}
metabase.native-query-analyzer #{metabase.native-query-analyzer}
metabase.permissions #{metabase.permissions.util} ; TODO -- this is currently the only namespace in this module. Give it a real API namespace?
metabase.plugins #{metabase.plugins
metabase.plugins.classloader} ; TODO -- not 100% sure the classloader belongs here
metabase.public-settings #{metabase.public-settings
metabase.public-settings.premium-features}
metabase.pulse #{metabase.pulse
metabase.pulse.attachment
metabase.pulse.markdown
metabase.pulse.parameters
metabase.pulse.preview
metabase.pulse.render
metabase.pulse.render.image-bundle
metabase.pulse.render.js-svg
metabase.pulse.render.style} ; TODO -- consolidate these into a real API namespace.
metabase.query-processor :any ; TODO omg scream, 29 namespaces used outside of the module. WHAT THE HECC
metabase.related #{metabase.related}
metabase.sample-data #{metabase.sample-data}
metabase.search #{metabase.search}
metabase.server #{metabase.server
metabase.server.handler
metabase.server.middleware.auth
metabase.server.middleware.exceptions
metabase.server.middleware.json
metabase.server.middleware.misc
metabase.server.middleware.offset-paging
metabase.server.middleware.session
metabase.server.protocols
metabase.server.request.util} ; TODO -- consolidate these into a real API namespace.
metabase.setup #{metabase.setup}
metabase.shared #{metabase.shared.dashboards.constants
metabase.shared.formatting.constants
metabase.shared.formatting.date
metabase.shared.formatting.numbers
metabase.shared.models.visualization-settings
metabase.shared.parameters.parameters
metabase.shared.util.currency
metabase.shared.util.i18n
metabase.shared.util.internal.time-common
metabase.shared.util.namespaces
metabase.shared.util.time} ; TODO -- consolidate these into a real API namespace.
metabase.sync #{metabase.sync
metabase.sync.analyze
metabase.sync.concurrent
metabase.sync.field-values
metabase.sync.schedules
metabase.sync.sync-metadata
metabase.sync.sync-metadata.fields
metabase.sync.sync-metadata.tables
metabase.sync.util} ; TODO -- consolidate these into a real API namespace.
metabase.task #{metabase.task
metabase.task.index-values
metabase.task.persist-refresh} ; TODO -- consolidate these into a real API namespace.
metabase.troubleshooting #{metabase.troubleshooting}
metabase.types #{metabase.types}
metabase.upload #{metabase.upload}
metabase.util :any ; I think util being `:any` is actually something I am ok with. But this has 32 namespaces.
metabase.xrays #{metabase.xrays}}
;; Map of module => other modules you're allowed to use there. You have two options here:
;;
;; 1. `:any` means namespaces in this module are allowed to use any other module -- allowed modules are not
;; enforced for this module. Module API namespaces for modules that have them defined are still enforced. For
;; ones that are `nil`, please go in and add a list of allowed modules. `:any` is mostly meant a temporary
;; placeholder until we can fill these all out, so feel free to fix these.
;;
;; 2. A set of module symbols. This is the list of modules that are allowed to be referenced. An empty set means no
;; other modules are allowed to be referenced; this is the default for any modules that aren't listed here.
:allowed-modules
{metabase.actions :any
metabase.analytics :any
metabase.analyze :any
metabase.api :any
metabase.async :any
metabase.bootstrap #{}
metabase.cmd :any
metabase.compatibility :any
metabase.config #{metabase.plugins}
metabase.core :any
metabase.db :any
metabase.driver :any
metabase.email :any
metabase.embed :any
metabase.events :any
metabase.formatter :any
metabase.integrations :any
metabase.legacy-mbql :any
metabase.lib :any
metabase.logger #{metabase.config
metabase.plugins}
metabase.metabot :any
metabase.models :any
metabase.moderation :any
metabase.native-query-analyzer :any
metabase.permissions :any
metabase.plugins :any
metabase.public-settings :any
metabase.pulse :any
metabase.query-processor :any
metabase.related :any
metabase.sample-data :any
metabase.search :any
metabase.server :any
metabase.setup :any
metabase.shared :any
metabase.sync :any
metabase.task :any
metabase.troubleshooting :any
metabase.types #{metabase.util}
metabase.upload :any
metabase.util :any
metabase.xrays :any}
;; namespaces matching these patterns (with `re-find`) are excluded from the module linter. Since regex literals
;; aren't allowed in EDN just used the `(str <regex>)` version i.e. two slashes instead of one.
;;
;; this is mostly intended for excluding test namespaces or those rare 'glue' namespaces that glue multiple modules
;; together, e.g. `metabase.lib.metadata.jvm`.
:ignored-namespace-patterns
#{"-test$" ; anything ending in `-test`
"test[-.]util" ; anything that contains `test.util` or `test-util`
"test\\.impl" ; anything that contains `test.impl`
"^metabase\\.test" ; anything starting with `metabase.test`
"^metabase\\.http-client$"}} ; `metabase.http-client` which is a test-only namespace despite its name.
:consistent-alias
{:aliases
{buddy.core.hash buddy-hash
cheshire.generate json.generate
clojure.tools.logging log
clj-http.client http
clj-ldap.client ldap
clj-time.coerce time.coerce
clj-time.format time.format
clojure.core.async a
clojure.core.match clojure.core.match ; Prefer :refer [match]
clojure.data data
clojure.math.combinatorics math.combo
clojure.pprint pprint
clojure.spec.alpha s
clojure.string str
clojure.test t
clojure.tools.build.api b
clojure.tools.namespace.dependency ns.deps
clojure.tools.namespace.find ns.find
clojure.tools.namespace.parse ns.parse
colorize.core colorize
environ.core env
hf.depstar.api depstar
hiccup.core hiccup
hiccup.util hiccup.util
honey.sql sql
honey.sql.helpers sql.helpers
honeysql.core hsql
honeysql.format hformat
honeysql.helpers hh
honeysql.types htypes
java-time t
malli.core mc
malli.error me
malli.experimental mx
malli.generator mg
malli.provider mp
malli.transform mtx
malli.util mut
medley.core m
metabase-enterprise.audit-app.pages.common common
metabase-enterprise.sandbox.api.table table
metabase-enterprise.test met
metabase.analytics.stats stats
metabase.api.activity api.activity
metabase.api.alert api.alert
metabase.api.automagic-dashboards api.magic
metabase.api.bookmark api.bookmark
metabase.api.card api.card
metabase.api.card-test api.card-test
metabase.api.collection api.collection
metabase.api.common api
metabase.api.dashboard api.dashboard
metabase.api.dashboard-test api.dashboard-test
metabase.api.database api.database
metabase.api.dataset api.dataset
metabase.api.email api.email
metabase.api.embed api.embed
metabase.api.field api.field
metabase.api.geojson api.geojson
metabase.api.ldap api.ldap
metabase.api.logic-history api.login-history
metabase.api.metric api.metric
metabase.api.native-query-snippet api.native-query-snippet
metabase.api.notify api.notify
metabase.api.permission-graph api.permission-graph
metabase.api.permissions api.permissions
metabase.api.permissions-test-util perm-test-util
metabase.api.pivots api.pivots
metabase.api.premium-features api.premium-features
metabase.api.preview-embed api.preview-embed
metabase.api.public api.public
metabase.api.pulse api.pulse
metabase.api.revision api.revision
metabase.api.search api.search
metabase.api.segment api.segment
metabase.api.session api.session
metabase.api.setting api.setting
metabase.api.setup api.setup
metabase.api.slack api.slack
metabase.api.table api.table
metabase.api.task api.task
metabase.api.tiles api.tiles
metabase.api.timeline api.timeline
metabase.api.timeline-event api.timeline-event
metabase.api.transform api.transform
metabase.api.user api.user
metabase.api.util api.util
metabase.async.streaming-response.thread-pool thread-pool
metabase.automagic-dashboards.core magic
metabase.automagic-dashboards.dashboard-templates dashboard-templates
metabase.automagic-dashboards.populate populate
metabase.cmd.copy.h2 copy.h2
metabase.config config
metabase.config.file config.file
metabase.connection-pool connection-pool
metabase.db.connection mdb.connection
metabase.db.jdbc-protocols mdb.jdbc-protocols
metabase.db.metadata-queries metadata-queries
metabase.db.spec mdb.spec
metabase.db.query mdb.query
metabase.domain-entities.specs de.specs
metabase.driver.common.parameters params
metabase.driver.common.parameters.dates params.dates
metabase.driver.common.parameters.operators params.ops
metabase.driver.common.parameters.parse params.parse
metabase.driver.common.parameters.values params.values
metabase.driver.druid.client druid.client
metabase.driver.druid.execute druid.execute
metabase.driver.druid.js druid.js
metabase.driver.druid.query-processor druid.qp
metabase.driver.druid.sync druid.sync
metabase.driver.googleanalytics.client ga.client
metabase.driver.googleanalytics.execute ga.execute
metabase.driver.googleanalytics.metadata ga.metadata
metabase.driver.googleanalytics.query-processor ga.qp
metabase.driver.impl driver.impl
metabase.driver.mongo.execute mongo.execute
metabase.driver.mongo.parameters mongo.params
metabase.driver.mongo.query-processor mongo.qp
metabase.driver.mongo.util mongo.util
metabase.driver.sql driver.sql
metabase.driver.sql-jdbc.common sql-jdbc.common
metabase.driver.sql-jdbc.connection sql-jdbc.conn
metabase.driver.sql-jdbc.execute sql-jdbc.execute
metabase.driver.sql-jdbc.execute.diagnostic sql-jdbc.execute.diagnostic
metabase.driver.sql-jdbc.execute.legacy-impl sql-jdbc.legacy
metabase.driver.sql-jdbc.execute.old-impl sql-jdbc.execute.old
metabase.driver.sql-jdbc.sync sql-jdbc.sync
metabase.driver.sql-jdbc.sync.common sql-jdbc.sync.common
metabase.driver.sql-jdbc.sync.describe-database sql-jdbc.describe-database
metabase.driver.sql-jdbc.sync.describe-table sql-jdbc.describe-table
metabase.driver.sql-jdbc.sync.interface sql-jdbc.sync.interface
metabase.driver.sql-jdbc.test-util sql-jdbc.tu
metabase.driver.sql.parameters.substitute sql.params.substitute
metabase.driver.sql.parameters.substitution sql.params.substitution
metabase.email-test et
metabase.email.messages messages
metabase.formatter formatter
metabase.http-client client
metabase.lib.util lib.util
metabase.mbql.normalize mbql.normalize
metabase.mbql.schema mbql.s
metabase.mbql.util mbql.u
metabase.models.activity activity
metabase.models.application-permissions-revision a-perm-revision
metabase.models.bookmark bookmark
metabase.models.collection collection
metabase.models.collection.graph graph
metabase.models.collection-permission-graph-revision c-perm-revision
metabase.models.dashboard-card dashboard-card
metabase.models.database database
metabase.models.dependency dependency
metabase.models.field-values field-values
metabase.models.interface mi
metabase.models.moderation-review moderation-review
metabase.models.native-query-snippet native-query-snippet
metabase.models.params params
metabase.models.permissions perms
metabase.models.permissions-group perms-group
metabase.models.permissions-group-membership perms-group-membership
metabase.models.permissions-revision perms-revision
metabase.models.permissions.parse perms-parse
metabase.models.pulse pulse
metabase.models.pulse-channel pulse-channel
metabase.models.pulse-channel-recipient pulse-channel-recipient
metabase.models.query.permissions query-perms
metabase.models.setting.cache setting.cache
metabase.models.timeline timeline
metabase.models.timeline-event timeline-event
metabase.plugins.initialize plugins.init
metabase.public-settings public-settings
metabase.public-settings.premium-features premium-features
metabase.pulse pulse ; NB some conflicts with metabase.models.pulse
metabase.pulse.markdown markdown
metabase.pulse.render render
metabase.pulse.render.body body
metabase.pulse.render.style style
metabase.pulse.test-util pulse.test-util
metabase.pulse.parameters pulse-params
metabase.query-processor-test qp.test
metabase.query-processor.context qp.context
metabase.query-processor.error-type qp.error-type
metabase.query-processor.interface qp.i
metabase.query-processor.middleware.add-dimension-projections qp.add-dimension-projections
metabase.query-processor.middleware.add-implicit-clauses qp.add-implicit-clauses
metabase.query-processor.middleware.add-implicit-joins qp.add-implicit-joins
metabase.query-processor.middleware.auto-bucket-datetimes qp.auto-bucket-datetimes
metabase.query-processor.middleware.constraints qp.constraints
metabase.query-processor.middleware.cumulative-aggregations qp.cumulative-aggregations
metabase.query-processor.middleware.parameters.mbql qp.mbql
metabase.query-processor.middleware.parameters.native qp.native
metabase.query-processor.middleware.permissions qp.perms
metabase.query-processor.middleware.pre-alias-aggregations qp.pre-alias-aggregations
metabase.query-processor.middleware.resolve-fields qp.resolve-fields
metabase.query-processor.middleware.resolve-referenced qp.resolve-referenced
metabase.query-processor.middleware.resolve-source-table qp.resolve-source-table
metabase.query-processor.middleware.wrap-value-literals qp.wrap-value-literals
metabase.query-processor.pivot qp.pivot
metabase.query-processor.streaming qp.streaming
metabase.query-processor.streaming.interface qp.si
metabase.query-processor.streaming.xlsx qp.xlsx
metabase.query-processor.timezone qp.timezone
metabase.query-processor.util qp.util
metabase.related related
metabase.search.config search.config
metabase.search.filter search.filter
metabase.search.util search.util
metabase.search.scoring scoring
metabase.server.middleware.auth mw.auth
metabase.server.middleware.browser-cookie mw.browser-cookie
metabase.server.middleware.exceptions mw.exceptions
metabase.server.middleware.json mw.json
metabase.server.middleware.log mw.log
metabase.server.middleware.misc mw.misc
metabase.server.middleware.offset-paging mw.offset-paging
metabase.server.middleware.security mw.security
metabase.server.middleware.session mw.session
metabase.server.middleware.ssl mw.ssl
metabase.server.request.util req.util
metabase.server.protocols server.protocols
metabase.shared.util shared.u
metabase.shared.util.currency currency
metabase.sync.analyze.classifiers.category classifiers.category
metabase.sync.analyze.classifiers.name classifiers.name
metabase.sync.analyze.classifiers.no-preview-display classifiers.no-preview-display
metabase.sync.analyze.classifiers.text-fingerprint classifiers.text-fingerprint
metabase.sync.analyze.fingerprint fingerprint
metabase.sync.analyze.fingerprint.fingerprinters fingerprinters
metabase.sync.analyze.fingerprint.insights insights
metabase.sync.analyze.query-results qr
metabase.sync.field-values field-values
metabase.sync.interface i
metabase.sync.schedules sync.schedules
metabase.sync.sync-metadata.fields.fetch-metadata fetch-metadata
metabase.sync.util sync-util
metabase.sync.util-test sync.util-test
metabase.task.sync-databases task.sync-databases
metabase.test mt
metabase.test.data.dataset-definitions defs
metabase.test.data.env.impl tx.env.impl
metabase.test.data.impl data.impl
metabase.test.data.users test.users
metabase.test.domain-entities test.de
metabase.test.mock.util mock.util
metabase.test.sync test.sync
metabase.test.redefs test.redefs
metabase.test.util.js test.js
metabase.test.util.timezone test.tz
metabase.timeseries-query-processor-test.util tqpt
metabase.transforms.core tf
metabase.transforms.materialize tf.materialize
metabase.transforms.specs tf.specs
metabase.util.cron u.cron
metabase.util.date-2 u.date
metabase.util.date-2.common u.date.common
metabase.util.date-2.parse u.date.parse
metabase.util.embed embed
metabase.util.encryption encryption
metabase.util.encryption-test encryption-test
metabase.util.files u.files
metabase.util.honey-sql-2 h2x
metabase.util.i18n i18n
metabase.util.i18n.impl i18n.impl
metabase.util.jvm u.jvm
metabase.util.log log
metabase.util.macros u.macros
metabase.util.malli mu
metabase.util.malli.schema ms
metabase.util.password u.password
metabase.util.schema su
metabase.util.ui-logic ui-logic
metabase.util.urls urls
metabuild-common.core u
metabuild-common.output out
metabuild-common.shell shell
monger.collection mcoll
ring.mock.request ring.mock
ring.util.codec codec
ring.util.response response
ring.adapter.jetty9.servlet servlet
saml20-clj.core saml
toucan.db db
toucan.models models}}
:metabase/validate-deftest {:level :warning}
:metabase/missing-test-expr-requires-in-cljs {:level :warning}
:metabase/i-like-making-cams-eyes-bleed-with-horrifically-long-tests {:level :warning}
:metabase/warn-about-schema= {:level :warning}}
{buddy.core.hash buddy-hash
cheshire.generate json.generate
clojure.tools.logging log
clj-http.client http
clj-ldap.client ldap
clj-time.coerce time.coerce
clj-time.format time.format
clojure.core.async a
clojure.core.match clojure.core.match ; Prefer :refer [match]
clojure.data data
clojure.math.combinatorics math.combo
clojure.pprint pprint
clojure.spec.alpha s
clojure.string str
clojure.test t
clojure.tools.build.api b
clojure.tools.namespace.dependency ns.deps
clojure.tools.namespace.find ns.find
clojure.tools.namespace.parse ns.parse
colorize.core colorize
environ.core env
hf.depstar.api depstar
hiccup.core hiccup
hiccup.util hiccup.util
honey.sql sql
honey.sql.helpers sql.helpers
honeysql.core hsql
honeysql.format hformat
honeysql.helpers hh
honeysql.types htypes
java-time t
macaw.core macaw
malli.core mc
malli.error me
malli.experimental mx
malli.generator mg
malli.provider mp
malli.transform mtx
malli.util mut
medley.core m
metabase-enterprise.audit-app.pages.common common
metabase-enterprise.sandbox.api.table table
metabase-enterprise.test met
metabase.analytics.stats stats
metabase.analyze.query-results qr
metabase.analyze.classifiers.category classifiers.category
metabase.analyze.classifiers.core classifiers
metabase.analyze.classifiers.name classifiers.name
metabase.analyze.classifiers.no-preview-display classifiers.no-preview-display
metabase.analyze.classifiers.text-fingerprint classifiers.text-fingerprint
metabase.analyze.fingerprint.fingerprinters fingerprinters
metabase.analyze.fingerprint.insights insights
metabase.analyze.fingerprint.schema fingerprint.schema
metabase.api.activity api.activity
metabase.api.alert api.alert
metabase.api.automagic-dashboards api.magic
metabase.api.bookmark api.bookmark
metabase.api.card api.card
metabase.api.card-test api.card-test
metabase.api.collection api.collection
metabase.api.common api
metabase.api.dashboard api.dashboard
metabase.api.dashboard-test api.dashboard-test
metabase.api.database api.database
metabase.api.dataset api.dataset
metabase.api.email api.email
metabase.api.embed api.embed
metabase.api.field api.field
metabase.api.geojson api.geojson
metabase.api.ldap api.ldap
metabase.api.logic-history api.login-history
metabase.api.metric api.metric
metabase.api.native-query-snippet api.native-query-snippet
metabase.api.notify api.notify
metabase.api.permission-graph api.permission-graph
metabase.api.permissions api.permissions
metabase.api.permissions-test-util perm-test-util
metabase.api.pivots api.pivots
metabase.api.premium-features api.premium-features
metabase.api.preview-embed api.preview-embed
metabase.api.public api.public
metabase.api.pulse api.pulse
metabase.api.revision api.revision
metabase.api.search api.search
metabase.api.segment api.segment
metabase.api.session api.session
metabase.api.setting api.setting
metabase.api.setup api.setup
metabase.api.slack api.slack
metabase.api.table api.table
metabase.api.task api.task
metabase.api.tiles api.tiles
metabase.api.timeline api.timeline
metabase.api.timeline-event api.timeline-event
metabase.api.user api.user
metabase.api.util api.util
metabase.async.streaming-response.thread-pool thread-pool
metabase.cmd.copy.h2 copy.h2
metabase.config config
metabase.config.file config.file
metabase.connection-pool connection-pool
metabase.db.connection mdb.connection
metabase.db.jdbc-protocols mdb.jdbc-protocols
metabase.db.metadata-queries metadata-queries
metabase.db.spec mdb.spec
metabase.db.query mdb.query
metabase.driver.common.parameters params
metabase.driver.common.parameters.dates params.dates
metabase.driver.common.parameters.operators params.ops
metabase.driver.common.parameters.parse params.parse
metabase.driver.common.parameters.values params.values
metabase.driver.druid.client druid.client
metabase.driver.druid.execute druid.execute
metabase.driver.druid.js druid.js
metabase.driver.druid.query-processor druid.qp
metabase.driver.druid.sync druid.sync
metabase.driver.impl driver.impl
metabase.driver.mongo.execute mongo.execute
metabase.driver.mongo.parameters mongo.params
metabase.driver.mongo.query-processor mongo.qp
metabase.driver.mongo.util mongo.util
metabase.driver.sql driver.sql
metabase.driver.sql-jdbc.common sql-jdbc.common
metabase.driver.sql-jdbc.connection sql-jdbc.conn
metabase.driver.sql-jdbc.execute sql-jdbc.execute
metabase.driver.sql-jdbc.execute.diagnostic sql-jdbc.execute.diagnostic
metabase.driver.sql-jdbc.execute.legacy-impl sql-jdbc.legacy
metabase.driver.sql-jdbc.execute.old-impl sql-jdbc.execute.old
metabase.driver.sql-jdbc.sync sql-jdbc.sync
metabase.driver.sql-jdbc.sync.common sql-jdbc.sync.common
metabase.driver.sql-jdbc.sync.describe-database sql-jdbc.describe-database
metabase.driver.sql-jdbc.sync.describe-table sql-jdbc.describe-table
metabase.driver.sql-jdbc.sync.interface sql-jdbc.sync.interface
metabase.driver.sql-jdbc.test-util sql-jdbc.tu
metabase.driver.sql.parameters.substitute sql.params.substitute
metabase.driver.sql.parameters.substitution sql.params.substitution
metabase.email-test et
metabase.email.messages messages
metabase.formatter formatter
metabase.http-client client
metabase.legacy-mbql.normalize mbql.normalize
metabase.legacy-mbql.schema mbql.s
metabase.legacy-mbql.util mbql.u
metabase.lib.util lib.util
metabase.lib.util.match lib.util.match
metabase.models.activity activity
metabase.models.application-permissions-revision a-perm-revision
metabase.models.bookmark bookmark
metabase.models.collection collection
metabase.models.collection.graph graph
metabase.models.collection-permission-graph-revision c-perm-revision
metabase.models.dashboard-card dashboard-card
metabase.models.database database
metabase.models.dependency dependency
metabase.models.field-values field-values
metabase.models.interface mi
metabase.models.moderation-review moderation-review
metabase.models.native-query-snippet native-query-snippet
metabase.models.params params
metabase.models.permissions perms
metabase.models.permissions-group perms-group
metabase.models.permissions-group-membership perms-group-membership
metabase.models.permissions-revision perms-revision
metabase.models.permissions.parse perms-parse
metabase.models.pulse pulse
metabase.models.pulse-channel pulse-channel
metabase.models.pulse-channel-recipient pulse-channel-recipient
metabase.models.query.permissions query-perms
metabase.models.setting.cache setting.cache
metabase.models.timeline timeline
metabase.models.timeline-event timeline-event
metabase.native-query-analyzer query-analyzer
metabase.native-query-analyzer.parameter-substitution nqa.sub
metabase.plugins.initialize plugins.init
metabase.public-settings public-settings
metabase.public-settings.premium-features premium-features
metabase.pulse pulse ; NB some conflicts with metabase.models.pulse
metabase.pulse.markdown markdown
metabase.pulse.render render
metabase.pulse.render.body body
metabase.pulse.render.style style
metabase.pulse.test-util pulse.test-util
metabase.pulse.parameters pulse-params
metabase.query-processor-test qp.test
metabase.query-processor.context qp.context
metabase.query-processor.error-type qp.error-type
metabase.query-processor.interface qp.i
metabase.query-processor.middleware.add-dimension-projections qp.add-dimension-projections
metabase.query-processor.middleware.add-implicit-clauses qp.add-implicit-clauses
metabase.query-processor.middleware.add-implicit-joins qp.add-implicit-joins
metabase.query-processor.middleware.auto-bucket-datetimes qp.auto-bucket-datetimes
metabase.query-processor.middleware.constraints qp.constraints
metabase.query-processor.middleware.cumulative-aggregations qp.cumulative-aggregations
metabase.query-processor.middleware.parameters.mbql qp.mbql
metabase.query-processor.middleware.parameters.native qp.native
metabase.query-processor.middleware.permissions qp.perms
metabase.query-processor.middleware.pre-alias-aggregations qp.pre-alias-aggregations
metabase.query-processor.middleware.resolve-fields qp.resolve-fields
metabase.query-processor.middleware.resolve-referenced qp.resolve-referenced
metabase.query-processor.middleware.resolve-source-table qp.resolve-source-table
metabase.query-processor.middleware.wrap-value-literals qp.wrap-value-literals
metabase.query-processor.pivot qp.pivot
metabase.query-processor.streaming qp.streaming
metabase.query-processor.streaming.interface qp.si
metabase.query-processor.streaming.xlsx qp.xlsx
metabase.query-processor.timezone qp.timezone
metabase.query-processor.util qp.util
metabase.related related
metabase.search.config search.config
metabase.search.filter search.filter
metabase.search.util search.util
metabase.search.scoring scoring
metabase.server.middleware.auth mw.auth
metabase.server.middleware.browser-cookie mw.browser-cookie
metabase.server.middleware.exceptions mw.exceptions
metabase.server.middleware.json mw.json
metabase.server.middleware.log mw.log
metabase.server.middleware.misc mw.misc
metabase.server.middleware.offset-paging mw.offset-paging
metabase.server.middleware.security mw.security
metabase.server.middleware.session mw.session
metabase.server.middleware.ssl mw.ssl
metabase.server.request.util req.util
metabase.server.protocols server.protocols
metabase.shared.util shared.u
metabase.shared.util.currency currency
metabase.sync.analyze.fingerprint sync.fingerprint
metabase.sync.field-values field-values
metabase.sync.interface i
metabase.sync.schedules sync.schedules
metabase.sync.sync-metadata.fields.our-metadata fields.our-metadata
metabase.sync.util sync-util
metabase.sync.util-test sync.util-test
metabase.task.sync-databases task.sync-databases
metabase.test mt
metabase.test.data.dataset-definitions defs
metabase.test.data.env.impl tx.env.impl
metabase.test.data.impl data.impl
metabase.test.data.users test.users
metabase.test.domain-entities test.de
metabase.test.mock.util mock.util
metabase.test.sync test.sync
metabase.test.redefs test.redefs
metabase.test.util.js test.js
metabase.test.util.timezone test.tz
metabase.timeseries-query-processor-test.util tqpt
metabase.util.cron u.cron
metabase.util.date-2 u.date
metabase.util.date-2.common u.date.common
metabase.util.date-2.parse u.date.parse
metabase.util.embed embed
metabase.util.encryption encryption
metabase.util.encryption-test encryption-test
metabase.util.files u.files
metabase.util.honey-sql-2 h2x
metabase.util.i18n i18n
metabase.util.i18n.impl i18n.impl
metabase.util.jvm u.jvm
metabase.util.log log
metabase.util.macros u.macros
metabase.util.malli mu
metabase.util.malli.schema ms
metabase.util.password u.password
metabase.util.schema su
metabase.util.ui-logic ui-logic
metabase.util.urls urls
metabase.xrays xrays
metabuild-common.core u
metabuild-common.output out
metabuild-common.shell shell
monger.collection mcoll
ring.mock.request ring.mock
ring.util.codec codec
ring.util.response response
ring.adapter.jetty9.servlet servlet
saml20-clj.core saml
toucan.db db
toucan.models models}}}
:lint-as
{clojure.core.logic/defne clj-kondo.lint-as/def-catch-all
@@ -421,6 +602,7 @@
metabase-enterprise.serialization.test-util/with-dbs clojure.core/fn
metabase.actions.test-util/with-actions clojure.core/let
metabase.api.common/let-404 clojure.core/let
metabase.api.common/defroutes clojure.core/def
metabase.api.search-test/do-test-users clojure.core/let
metabase.async.api-response-test/with-response clojure.core/let
metabase.dashboard-subscription-test/with-dashboard-sub-for-card clojure.core/let
@@ -429,7 +611,6 @@
metabase.db.data-migrations/defmigration clojure.core/def
metabase.db.liquibase/with-liquibase clojure.core/let
metabase.db.schema-migrations-test.impl/with-temp-empty-app-db clojure.core/let
metabase.domain-entities.malli/defn schema.core/defn
metabase.driver.mongo.query-processor/mongo-let clojure.core/let
metabase.driver.mongo.connection/with-mongo-client clojure.core/let
metabase.driver.mongo.connection/with-mongo-database clojure.core/let
@@ -460,7 +641,6 @@
metabase.test/with-actions clojure.core/let
metabase.test/with-open-channels clojure.core/let
metabase.test/with-single-admin-user clojure.core/fn
metabase.test/with-temp-dir clojure.core/let
metabase.test/with-temp-empty-app-db clojure.core/let
metabase.test/with-temp-file clojure.core/let
@@ -473,6 +653,7 @@
metabase.util.malli/defn schema.core/defn
metabase.util.malli/fn schema.core/fn
metabase.util.ssh/with-ssh-tunnel clojure.core/let
metabase.xrays.domain-entities.malli/defn schema.core/defn
monger.operators/defoperator clojure.core/def
potemkin.types/defprotocol+ clojure.core/defprotocol
potemkin.types/defrecord+ clojure.core/defrecord
@@ -485,13 +666,14 @@
:hooks
{:analyze-call
{cljs.test/deftest hooks.clojure.test/deftest
{clojure.core/ns hooks.clojure.core/lint-ns
cljs.test/deftest hooks.clojure.test/deftest
cljs.test/is hooks.clojure.test/is
cljs.test/use-fixtures hooks.clojure.test/use-fixtures
clojure.test/deftest hooks.clojure.test/deftest
clojure.test/is hooks.clojure.test/is
clojure.test/use-fixtures hooks.clojure.test/use-fixtures
metabase-enterprise.advanced-config.caching-test/with-temp-persist-models hooks.common/with-seven-bindings
metabase-enterprise.cache.config-test/with-temp-persist-models hooks.common/with-seven-bindings
metabase-enterprise.advanced-permissions.models.permissions.application-permissions-test/with-new-group-and-current-graph hooks.common/with-two-top-level-bindings
metabase-enterprise.audit-app.pages-test/with-temp-objects hooks.common/with-one-binding
metabase-enterprise.serialization.test-util/with-temp-dpc hooks.toucan2.tools.with-temp/with-temp
@@ -524,10 +706,14 @@
metabase.db.schema-migrations-test.impl/test-migrations hooks.metabase.db.schema-migrations-test.impl/test-migrations
metabase.dashboard-subscription-test/with-link-card-fixture-for-dashboard hooks.common/let-second
metabase.driver.bigquery-cloud-sdk-test/calculate-bird-scarcity hooks.metabase.query-processor-test.expressions-test/calculate-bird-scarcity
metabase.driver/register! hooks.metabase.driver/register!
metabase.legacy-mbql.schema.macros/defclause hooks.metabase.legacy-mbql.schemas.macros/defclause
metabase.lib.schema.mbql-clause/define-mbql-clause hooks.metabase.lib.schema.mbql-clause/define-mbql-clause
metabase.lib.schema.mbql-clause/define-catn-mbql-clause hooks.metabase.lib.schema.mbql-clause/define-mbql-clause
metabase.lib.schema.mbql-clause/define-tuple-mbql-clause hooks.metabase.lib.schema.mbql-clause/define-mbql-clause
metabase.lib.test-util.macros/$ids hooks.metabase.test.data/$ids
metabase.lib.test-util.macros/mbql-query hooks.metabase.test.data/mbql-query
metabase.lib.test-util.macros/with-testing-against-standard-queries hooks.metabase.lib.test-util.macros/with-testing-against-standard-queries
metabase.mbql.schema.macros/defclause hooks.metabase.mbql.schemas.macros/defclause
metabase.models.collection-test/with-collection-hierarchy hooks.common/let-one-with-optional-value
metabase.models.collection-test/with-personal-and-impersonal-collections hooks.common/with-two-bindings
metabase.models.dashboard-test/with-dash-in-collection hooks.common/with-three-bindings
@@ -572,6 +758,19 @@
metabase.test/with-temp hooks.toucan2.tools.with-temp/with-temp
metabase.test/with-temp-file hooks.metabase.test.util/with-temp-file
metabase.test/with-temporary-setting-values hooks.metabase.test.util/with-temporary-setting-values
metabase.util/format-color hooks.metabase.util/format-color
metabase.util.log/trace hooks.metabase.util.log/info
metabase.util.log/tracef hooks.metabase.util.log/infof
metabase.util.log/debug hooks.metabase.util.log/info
metabase.util.log/debugf hooks.metabase.util.log/infof
metabase.util.log/info hooks.metabase.util.log/info
metabase.util.log/infof hooks.metabase.util.log/infof
metabase.util.log/warn hooks.metabase.util.log/info
metabase.util.log/warnf hooks.metabase.util.log/infof
metabase.util.log/error hooks.metabase.util.log/info
metabase.util.log/errorf hooks.metabase.util.log/infof
metabase.util.log/fatal hooks.metabase.util.log/info
metabase.util.log/fatalf hooks.metabase.util.log/infof
metabase.util.malli.registry/def hooks.metabase.util.malli.registry/def}
:macroexpand
@@ -582,6 +781,7 @@
metabase-enterprise.sandbox.test-util/with-gtaps! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.serialization.test-util/with-world macros.metabase-enterprise.serialization.test-util/with-world
metabase-enterprise.test/with-gtaps! macros.metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.advanced-permissions.api.util-test/with-impersonations! macros.metabase-enterprise.advanced-permissions.api.util-test/with-impersonations!
metabase.api.card-test/with-ordered-items macros.metabase.api.card-test/with-ordered-items
metabase.api.collection-test/with-collection-hierarchy macros.metabase.api.collection-test/with-collection-hierarchy
metabase.api.collection-test/with-some-children-of-collection macros.metabase.api.collection-test/with-some-children-of-collection
@@ -590,11 +790,11 @@
metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing macros.metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing
metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing macros.metabase.api.public-test/with-sharing-enabled-and-temp-card-referencing
metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing macros.metabase.api.public-test/with-sharing-enabled-and-temp-dashcard-referencing
metabase.domain-entities.malli/define-getters-and-setters macros.metabase.domain-entities.malli/define-getters-and-setters
metabase.lib.filter/deffilter macros.metabase.lib.filter/deffilter
metabase.lib.common/defop macros.metabase.lib.common/defop
metabase.models.params.chain-filter-test/chain-filter macros.metabase.models.params.chain-filter-test/chain-filter
metabase.models.params.chain-filter-test/chain-filter-search macros.metabase.models.params.chain-filter-test/chain-filter
metabase.models.query-field-test/with-test-setup macros.metabase.models.query-field-test/with-test-setup
metabase.models.user-test/with-groups macros.metabase.models.user-test/with-groups
metabase.query-processor.streaming/streaming-response macros.metabase.query-processor.streaming/streaming-response
metabase.related-test/with-world macros.metabase.related-test/with-world
@@ -605,7 +805,8 @@
metabase.test/with-group-for-user macros.metabase.test.data.users/with-group-for-user
metabase.test/with-persistence-enabled macros.metabase.test.persistence/with-persistence-enabled
metabase.test/with-temp-env-var-value! macros.metabase.test.util/with-temp-env-var-value!
metabase.test/with-temporary-raw-setting-values macros.metabase.test.util/with-temporary-raw-setting-values}}
metabase.test/with-temporary-raw-setting-values macros.metabase.test.util/with-temporary-raw-setting-values
metabase.xrays.domain-entities.malli/define-getters-and-setters macros.metabase.xrays.domain-entities.malli/define-getters-and-setters}}
:config-in-comment
{:linters {:unresolved-symbol {:level :off}}}
@@ -617,18 +818,18 @@
;; the following patterns are considered to be test namespaces:
;;
;; - Any namespace ending in `-test` or `-test.whatever`
;; - Any namespace ending in `test-util`
;; - Any namespace containing in `test-util`
;; - Any namespace that starts with `metabase.test`
;;
;; this list isn't exhaustive because it misses some stuff like the test runner and HTTP client but it's easier to go
;; fix those namespaces than it is to make this regex super hairy.
[{:pattern "(?:.*-test(?:\\..*)?$)|(?:.*test-util$)|(?:^metabase\\.test.*)"
[{:pattern "(?:.*-test(?:\\..*)?$)|(?:.*test-util)|(?:^metabase\\.test.*)"
:name test-namespaces}
{:pattern "^(?!.*-test(?:\\..*)?$)(?!.*test-util$)(?!^metabase\\.test.*).*$"
{:pattern "^(?!.*-test(?:\\..*)?$)(?!.*test-util)(?!^metabase\\.test.*).*$"
:name source-namespaces}
{:pattern "(?:(?:^metabase\\.cmd.*)|(?:^build.*)|(?:^metabuild-common.*)|(?:^release.*)|(?:^i18n.*)|(?:^lint-migrations-file$))"
:name printable-namespaces}
{:pattern "^metabase\\.lib\\.*"
{:pattern "^metabase\\.(?:(?:lib)|(?:legacy-mbql))\\.*"
:name metabase-lib}
;;
;; QP source namespaces: `metabase.query-processor.*`, `metabase-enterprise.sandbox.query-processor.*`, and
@@ -640,12 +841,10 @@
:config-in-ns
{test-namespaces
{:linters
{:inline-def {:level :off}
:missing-docstring {:level :off}
:private-call {:level :off}
:metabase/defsetting-must-specify-export {:level :off}
:hooks.metabase.test.data/mbql-query-first-arg {:level :error}
:metabase/test-helpers-use-non-thread-safe-functions {:level :warning}}
{:inline-def {:level :off}
:missing-docstring {:level :off}
:private-call {:level :off}
:metabase/defsetting-must-specify-export {:level :off}}
:hooks
{:analyze-call
{clojure.core/defmacro hooks.clojure.core/non-thread-safe-form-should-end-with-exclamation
@@ -686,19 +885,26 @@
metabase.test/with-temp {:message "Don't use application database inside MLv2 code"}}
:discouraged-namespace
{toucan.db {:message "Don't use application database inside MLv2 code"}
toucan.models {:message "Don't use application database inside MLv2 code"}
toucan.util.test {:message "Don't use application database inside MLv2 code"}
toucan2.core {:message "Don't use application database inside MLv2 code"}}}}
{metabase.driver {:message "MLv2 code should be independent of driver code/methods"}
metabase.test {:message "MLv2 tests should only use MLv2 test helpers"}
metabase.test.data {:message "MLv2 tests should only use MLv2 test helpers"}
metabase.util.malli.schema {:message "Prefer metabase.lib.schema schemas in MLv2 code"}
toucan.db {:message "Don't use application database inside MLv2 code"}
toucan.models {:message "Don't use application database inside MLv2 code"}
toucan.util.test {:message "Don't use application database inside MLv2 code"}
toucan2.core {:message "Don't use application database inside MLv2 code"}}}}
qp-and-driver-source-namespaces
{:linters
{:discouraged-namespace
{toucan.db {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
toucan.models {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
toucan.util.test {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
toucan2.core {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}}
{metabase.util.malli.schema {:message "Prefer metabase.lib.schema or metabase.legacy-mbql.schema schemas in QP/driver code"}
toucan.db {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
toucan.models {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
toucan.util.test {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
toucan2.core {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}}
:discouraged-var
{metabase.db.query/query {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
{medley.core/map-keys {:message "Use clojure.core/update-keys"}
medley.core/map-vals {:message "Use clojure.core/update-vals"}
metabase.db.query/query {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}
metabase.db.query/reducible-query {:message "Don't use application database directly in QP code; use QP Store/metadata provider"}}}}}}

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

@@ -0,0 +1,9 @@
(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

@@ -1,4 +1,4 @@
(ns macros.metabase.domain-entities.malli)
(ns macros.metabase.xrays.domain-entities.malli)
(defmacro define-getters-and-setters [schema & defs]
`(do

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

@@ -1,6 +1,7 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.set :as set]
[clojure.string :as str]))
(defn- node->qualified-symbol [node]
@@ -15,7 +16,7 @@
(catch Exception _
nil)))
(def ^:private white-card-symbols
(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!
@@ -68,6 +69,7 @@
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!
@@ -120,7 +122,8 @@
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.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!
@@ -157,7 +160,7 @@
(walk f child)))]
(walk (fn [form]
(when-let [qualified-symbol (node->qualified-symbol form)]
(when (and (not (contains? white-card-symbols qualified-symbol))
(when (and (not (contains? symbols-allowed-in-fns-not-ending-in-an-exclamation-point qualified-symbol))
(end-with-exclamation? qualified-symbol))
(hooks/reg-finding! (assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`."
@@ -201,3 +204,126 @@
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
(when (and (hooks/list-node? node)
(let [first-child (first (:children node))]
(and (hooks/keyword-node? first-child)
(= (hooks/sexpr first-child) :require))))
node))
(:children ns-form-node)))
(defn- lint-require-shapes [ns-form-node]
(doseq [node (-> ns-form-node
ns-form-node->require-node
:children
rest)]
(cond
(not (hooks/vector-node? node))
(hooks/reg-finding! (assoc (meta node)
:message "All :required namespaces should be wrapped in vectors [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker))
(hooks/vector-node? (second (:children node)))
(hooks/reg-finding! (assoc (meta node)
:message "Don't use prefix forms inside :require [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))
(defn- require-node->namespace-symb-nodes [require-node]
(let [[_ns & args] (:children require-node)]
(into []
;; prefixed namespace forms are NOT SUPPORTED!!!!!!!!1
(keep (fn [node]
(cond
(hooks/vector-node? node)
;; propagate the metadata attached to this vector in case there's a `:clj-kondo/ignore` form.
(vary-meta (first (:children node)) (partial merge (meta require-node) (meta node)))
;; this should also be dead code since we require requires to be vectors
(hooks/token-node? node)
(vary-meta node (partial merge (meta require-node)))
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
args)))
(defn- ns-form-node->ns-symb [ns-form-node]
(some-> (some (fn [node]
(when (and (hooks/token-node? node)
(not= (hooks/sexpr node) 'ns))
node))
(:children ns-form-node))
hooks/sexpr))
(defn- module
"E.g.
(module 'metabase.qp.middleware.wow) => 'metabase.qp"
[ns-symb]
(some-> (re-find #"^metabase\.[^.]+" (str ns-symb)) symbol))
(defn- ignored-namespace? [ns-symb config]
(some
(fn [pattern-str]
(re-find (re-pattern pattern-str) (str ns-symb)))
(:ignored-namespace-patterns config)))
(defn- module-api-namespaces
"Set API namespaces for a given module. `:any` means you can use anything, there are no API namespaces for this
module (yet). If unspecified, the default is just the namespace with the same name as the module e.g.
`metabase.db`."
[module config]
(let [module-config (get-in config [:api-namespaces module])]
(cond
(= module-config :any)
nil
(set? module-config)
module-config
:else
#{module})))
(defn- lint-modules [ns-form-node config]
(let [ns-symb (ns-form-node->ns-symb ns-form-node)]
(when-not (ignored-namespace? ns-symb config)
(when-let [current-module (module ns-symb)]
(let [allowed-modules (get-in config [:allowed-modules current-module])
required-namespace-symb-nodes (-> ns-form-node
ns-form-node->require-node
require-node->namespace-symb-nodes)]
(doseq [node required-namespace-symb-nodes
:let [clj-kondo-ignore (some-> (meta node) :clj-kondo/ignore hooks/sexpr set)]
:when (not (contains? clj-kondo-ignore :metabase/ns-module-checker))
:let [required-namespace (hooks/sexpr node)
required-module (module required-namespace)]
;; ignore stuff not in a module i.e. non-Metabase stuff.
:when required-module
:let [in-current-module? (= required-module current-module)]
:when (not in-current-module?)
:let [allowed-module? (or (= allowed-modules :any)
(contains? (set allowed-modules) required-module))
module-api-namespaces (module-api-namespaces required-module config)
allowed-module-namespace? (or (empty? module-api-namespaces)
(contains? module-api-namespaces required-namespace))]]
(when-let [error (cond
(not allowed-module?)
(format "Module %s should not be used in the %s module. [:metabase/ns-module-checker :allowed-modules %s]"
required-module
current-module
current-module)
(not allowed-module-namespace?)
(format "Namespace %s is not an allowed external API namespace for the %s module. [:metabase/ns-module-checker :api-namespaces %s]"
required-namespace
required-module
required-module))]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/ns-module-checker)))))))))
(defn lint-ns [x]
(lint-require-shapes (:node x))
(lint-modules (:node x) (get-in x [:config :linters :metabase/ns-module-checker]))
x)

View File

@@ -1,6 +1,8 @@
(ns hooks.clojure.test
(:require [clj-kondo.hooks-api :as hooks]
[clojure.string :as str]))
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common]))
(def ^:private disallowed-parallel-forms
"Things you should not be allowed to use inside parallel tests. Besides these, anything ending in `!` not whitelisted
@@ -20,6 +22,7 @@
metabase.actions.test-util/with-actions-test-data
metabase.actions.test-util/with-actions-test-data-and-actions-enabled
metabase.actions.test-util/with-actions-test-data-tables
metabase.analytics.snowplow-test/with-fake-snowplow-collector
metabase.email-test/with-expected-messages
metabase.email-test/with-fake-inbox
metabase.test.data.users/with-group
@@ -28,9 +31,7 @@
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.timezone/with-system-timezone-id
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
@@ -48,7 +49,6 @@
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
@@ -62,7 +62,6 @@
metabase.test/with-non-admin-groups-no-root-collection-perms
metabase.test/with-persistence-enabled
metabase.test/with-single-admin-user
metabase.test/with-system-timezone-id
metabase.test/with-temp-env-var-value
metabase.test/with-temp-vals-in-db
metabase.test/with-temporary-raw-setting-values
@@ -108,18 +107,9 @@
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)))
metabase.pulse/send-pulse!
metabase.query-processor.store/store-database!
next.jdbc/execute!})
(defn- warn-about-disallowed-parallel-forms [form]
(letfn [(error! [form message]
@@ -127,7 +117,7 @@
:message message
:type :metabase/validate-deftest)))
(f [form]
(when-let [qualified-symbol (node->qualified-symbol form)]
(when-let [qualified-symbol (hooks.common/node->qualified-symbol form)]
(cond
(disallowed-parallel-forms qualified-symbol)
(error! form (format "%s is not allowed inside a ^:parallel test or test fixture" qualified-symbol))

View File

@@ -1,6 +1,7 @@
(ns hooks.common
(:require [clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
(: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
@@ -369,3 +370,40 @@
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"))

View File

@@ -0,0 +1,45 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]))
(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)))))))]
(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

@@ -1,5 +1,6 @@
(ns hooks.metabase.mbql.schemas.macros
(:require [clj-kondo.hooks-api :as hooks]))
(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

View File

@@ -0,0 +1,21 @@
(ns hooks.metabase.lib.schema.mbql-clause
(:require
[clj-kondo.hooks-api :as api]))
(defn define-mbql-clause
"Register the schema keyword so LSP can jump to it."
[x]
(letfn [(update-def-keyword [k]
(-> (api/keyword-node (keyword "mbql.clause" (name (api/sexpr k))))
(with-meta (meta k))
(api/reg-keyword! 'metabase.lib.schema.mbql-clause/define-mbql-clause)))
(update-children [[_def k :as children]]
(if (api/keyword-node? k)
(update (vec children) 1 update-def-keyword)
children))
(update-node [node]
(if (api/list-node? node)
(-> (api/list-node (update-children (:children node)))
(with-meta (meta node)))
node))]
(update x :node update-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

View File

@@ -139,7 +139,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,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,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

@@ -7,7 +7,7 @@
defprotocol+ [[:block 1] [:inner 1]]
potemkin/defprotocol+ [[:block 1] [:inner 1]]
let-404 [[:block 1]]
metabase.mbql.util/match-one [[:inner 0]]
metabase.legacy-mbql.util/match-one [[:inner 0]]
merge-with [[:inner 0]]
metabase.test/dataset [[:inner 0]]
metabase.test/formatted-rows [[:inner 0]]

View File

@@ -35,6 +35,7 @@
(eval . (put 'methodical/defmulti 'clojure-doc-string-elt 2))
(eval . (put 'mi/define-simple-hydration-method 'clojure-doc-string-elt 3))
(eval . (put 'mi/define-batched-hydration-method 'clojure-doc-string-elt 3))
(eval . (put 'mr/def 'clojure-doc-string-elt 2))
(eval . (put 'mu/defn 'clojure-doc-string-elt 2))
;; Define custom indentation for functions inside metabase.
;; This list isn't complete; add more forms as we come across them.
@@ -45,25 +46,26 @@
(eval . (put-clojure-indent 'c/step 1))
(eval . (put-clojure-indent 'impl/test-migrations 2))
(eval . (put-clojure-indent 'let-404 0))
(eval . (put-clojure-indent 'lib.schema.match/match 1))
(eval . (put-clojure-indent 'lib.schema.match/match-one 1))
(eval . (put-clojure-indent 'lib.schema.match/replace 1))
(eval . (put-clojure-indent 'lib.schema.match/replace-in 2))
(eval . (put-clojure-indent 'lib.util.match/replace 1))
(eval . (put-clojure-indent 'macros/case 0))
(eval . (put-clojure-indent 'match 1))
(eval . (put-clojure-indent '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 'mt/test-drivers 1))
(eval . (put-clojure-indent 'prop/for-all 1))
(eval . (put-clojure-indent 'qp.streaming/streaming-response 1))
(eval . (put-clojure-indent 'tc/quick-check 1))
(eval . (put-clojure-indent 'u/profile 1))
(eval . (put-clojure-indent 'u/prog1 1))
(eval . (put-clojure-indent 'u/select-keys-when 1))
(eval . (put-clojure-indent 'with-meta '(:form)))
(eval . (put-clojure-indent 'tc/quick-check 1))
;; 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'
@@ -83,6 +85,7 @@
(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 }]
}
}
]
}

224
.eslintrc.js Normal file
View File

@@ -0,0 +1,224 @@
/* 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,
},
],
"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 }],
...(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",
],
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",
},
},
{
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 }],
},
},
],
};

11
.github/CODEOWNERS vendored
View File

@@ -1,3 +1,14 @@
# 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

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,9 @@
> [!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,
@@ -37,7 +36,9 @@ runs:
["dashboard-filters", {} ],
["embedding", {} ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],
["metrics", {} ],
["models", {} ],
["native", {} ],
["native-filters", {} ],
@@ -45,12 +46,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

@@ -8,23 +8,23 @@ inputs:
description: DockerHub password/token
required: true
maildev:
description: Maildev
description: Maildev container
required: true
default: 'false'
openldap:
description: Maildev
description: OpenLDAP container
required: true
default: 'false'
postgres:
description: Maildev
description: Postgres container
required: true
default: 'false'
mysql:
description: Maildev
description: MySQL container
required: true
default: 'false'
mongo:
description: Maildev
description: Mongo container
required: true
default: 'false'

View File

@@ -23,6 +23,6 @@ runs:
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') }}
- run: yarn install --frozen-lockfile --prefer-offline
shell: bash

View File

@@ -23,10 +23,12 @@ 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

86
.github/github-slack-map.json vendored Normal file
View File

@@ -0,0 +1,86 @@
{
"abdhabli": "U06BAV8JFDW",
"adam-james-v": "U02P27ZRRR8",
"agodbey": "U05UJR2C35Z",
"albertoperdomo": "U05811B1WLX",
"AlessioLaiso": "U06MAAUDTS6",
"alexandermkinn": "U023UTA4MUL",
"alexyarosh": "U06GXH3RVPU",
"alxnddr": "U01S9BUHH8X",
"brunobergher": "U01M2JJVA80",
"bshepherdson": "U03AK3B43GA",
"calherries": "U03KFGJ7X8S",
"camsaul": "U07DG6C3X",
"cbalusek": "U02M2Q0DJLD",
"cdeweyx": "U02BX2BKPQS",
"crisptrutski": "U06C5MNFF0S",
"dahyeik": "U03MG3BCS22",
"darksciencebase": "U04P2DVHG3U",
"deniskaber": "U04QX6Z5N00",
"devurandom": "U03N1ATKF7T",
"dhuniverse": "U04RRCGJPJN",
"dpsutton": "U01BP8Z3CVA",
"EmmadUsmani": "U04QX6YUP7A",
"escherize": "U02U4E60EHG",
"filipesilva": "U04S45X3FLN",
"FilmonK": "U05J39TB4A1",
"gusaiani": "U020JGYQHK8",
"heypoom": "U06TVDSUPGE",
"iethree": "U5A85JL4V",
"ignacio-mb": "U0558P1CZ5L",
"imrkd": "U02MJBX8G65",
"ixipixi": "U06C5JCNKM1",
"jeff-bruemmer": "U014JGU9XK2",
"JesseSDevaney": "U0511SK58DC",
"jessillions": "U04P2AKMX4K",
"jesusfloresmetabase": "U04MZ6TGQLA",
"jill-lafond": "U0537V0L2DN",
"johnswanson": "U0600BZ1XMK",
"jrayski": "U03C28SM11N",
"k8beeman": "U06PYT3N7EV",
"kamilmielnik": "U057ENEC60M",
"kdoh": "U078VJFED",
"kidd": "U01JM8WM6N4",
"kulyk": "U01TH98M6J2",
"lbrdnk": "U06035L3V34",
"le0li0n": "U06RDA3M6BZ",
"likeshumidity": "U047NDX34UU",
"losrebellos": "U022B12KVK6",
"luizarakaki": "U02KWASDKHC",
"margaretrimek": "U02AZVBQQU9",
"maxzheng": "U03TBN466EN",
"mazameli": "U0ALDAVHA",
"metamben": "U03AN4TRM6Y",
"mngr": "U06GXDTJQQ3",
"mwsmales": "U043FSUUSNL",
"nemanjaglumac": "U01BA9754AC",
"NevRA": "U04T9044T7G",
"ngapuileung": "U04HP1D66N4",
"noahmoss": "U01V8S8DG78",
"npfitz": "U037YBQFRR7",
"npretto": "U05K43X7RV5",
"oisincoveney": "U0511SKLXCN",
"Onlinehead": "U02S8HGAB8A",
"oreonl": "U05V7TSK1QQ",
"paoliniluis": "U01GWGPG2CF",
"perivamsi": "U05K2EFAT5G",
"piranha": "U060FQBFE5P",
"psalinasy": "U04LYLXV207",
"qnkhuat": "U02LA6FF5N1",
"rafpaf": "U0697CU8TTP",
"ranquild": "U028HG073GS",
"romeovs": "U06DHN2JA5D",
"salsakran": "U078V228G",
"sloansparger": "U06CJAUPV3K",
"snoe": "U03AG715B61",
"Somtom": "U06BREDB5V3",
"taqattack": "U06C70CJ6RM",
"Tony-metabase": "U03RFTD5SLR",
"trinya": "U06CJJB3JJZ",
"tsmacdonald": "U01BKUL0MHV",
"uladzimirdev": "U04TU6TNPLZ",
"vbenedetti": "U04MRS3JTLH",
"victoriaspek": "U02KD3E703E",
"WiNloSt": "U02MYNXD605",
"zbodi74": "U05EV72TPN2"
}

6
.github/team.json vendored
View File

@@ -7,7 +7,6 @@
"ranquild",
"uladzimirdev",
"kamilmielnik",
"oleggromov",
"nemanjaglumac",
"romeovs"
]
@@ -15,7 +14,8 @@
{
"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",
@@ -32,7 +32,7 @@
{
"name": "Query Processor",
"label": ".Team/QueryProcessor",
"projectUrl": "https://github.com/orgs/metabase/projects/50/views/1",
"projectUrl": "https://github.com/orgs/metabase/projects/83/views/8",
"members": ["camsaul", "snoe", "bshepherdson", "metamben", "lbrdnk"]
},
{

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

View File

@@ -80,8 +80,9 @@ jobs:
- 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
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/coverage/codecov.json
flags: back-end
@@ -207,7 +208,7 @@ jobs:
if: matrix.java-version != 21
run: clojure -X:dev:ci:test:${{ matrix.edition }}:${{ matrix.edition }}-dev
- name: Run tests using Java 21 on `master` only
- name: If using Java 21, only run tests on `master`
id: run-java-tests-21
if: matrix.java-version == 21 && github.ref_name == 'master'
run: clojure -X:dev:ci:test:${{ matrix.edition }}:${{ matrix.edition }}-dev

View File

@@ -113,7 +113,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

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

@@ -126,20 +126,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 +160,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 +255,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 +301,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 +335,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 +381,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 +418,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()

View File

@@ -45,6 +45,7 @@ jobs:
env:
DISPLAY: ""
QA_DB_ENABLED: true
CYPRESS_QA_DB_MONGO: true
CYPRESS_REPLAYIO_ENABLED: 1
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}

View File

@@ -4,7 +4,7 @@ on:
push:
branches:
- "master"
- 'release-**'
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
@@ -87,10 +87,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
CYPRESS_REPLAYIO_ENABLE_UPLOAD: 1
RECORD_REPLAY_METADATA_FILE: /tmp/replay-metadata.json
RECORD_REPLAY_METADATA_TEST_RUN_ID: ${{ github.run_id }}
REPLAY_API_KEY: ${{ secrets.REPLAY_IO_TOKEN }}
@@ -143,7 +144,7 @@ jobs:
run: |
yarn run test-cypress-run \
--env grepTags=@OSS,grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
- name: Run slow and resource-intensive Cypress tests
@@ -151,7 +152,7 @@ jobs:
run: |
yarn run test-cypress-run \
--env grepTags="@slow",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
- name: Run Flaky Cypress tests
@@ -159,7 +160,7 @@ jobs:
run: |
yarn run test-cypress-run \
--env grepTags="@flaky --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
- name: Run EE Cypress tests on ${{ matrix.name }}
@@ -175,7 +176,7 @@ jobs:
run: |
yarn run test-cypress-run \
--env grepTags="@mongo --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser 'replay-chromium'
env:
CYPRESS_QA_DB_MONGO: true
@@ -216,47 +217,3 @@ jobs:
steps:
- run: |
echo "Didn't run due to conditional filtering"
visual-regression-tests:
runs-on: ubuntu-22.04
timeout-minutes: 60
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 || ''}}

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

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

67
.github/workflows/loki-update.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
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@v3
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
run: 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@v3
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'
})

66
.github/workflows/loki.yml vendored Normal file
View File

@@ -0,0 +1,66 @@
name: Loki Visual Regression Testing
on: [pull_request]
jobs:
visual-test:
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@v3
- 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
run: 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 loki test
- 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,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 }}

View File

@@ -5,11 +5,11 @@ 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
jobs:
@@ -91,21 +91,21 @@ 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
@@ -114,11 +114,16 @@ jobs:
strategy:
matrix:
edition: [oss, ee]
folder: [onboarding, search]
env:
MB_EDITION: ${{ matrix.edition }}
DISPLAY: ""
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_REPLAYIO_ENABLED: 1
# disabled because of out of memory issues
# probably related to https://github.com/cypress-io/cypress/issues/27415
CYPRESS_NO_COMMAND_LOG: 1
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
TERM: xterm
@@ -132,43 +137,43 @@ jobs:
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
- 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 ${{ matrix.folder }}
- 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]
@@ -185,71 +190,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 +266,22 @@ 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

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: 'Valid git reference e.g. branches, tags, hashes'
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
run: |
./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
# TODO: Remove this step after the build utils script is merged to master
- name: Upload release utils script, so it can be used later on when checking out `master` branch
uses: actions/upload-artifact@v4
with:
name: release-util
path: ./bin/embedding-sdk/release_utils.bash
- name: Update changelog
run: |
yarn embedding-sdk:generate-changelog
- 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
uses: actions/upload-artifact@v4
with:
name: sdk-changelog
path: ./enterprise/frontend/src/embedding-sdk/CHANGELOG.md
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 "metabase-bot@metabase.com"
git config --global user.name "Metabase bot"
# TODO: Remove this step after the build utils script is merged to master
- name: Download release utils script
uses: actions/download-artifact@v4
with:
name: release-util
path: ./bin/embedding-sdk/
- 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
uses: actions/download-artifact@v4
with:
name: sdk-changelog
# We need to do this because it's impossible to download an artifact to an existing location
- name: Move over the downloaded changelog
run: |
mv CHANGELOG.md ./enterprise/frontend/src/embedding-sdk/CHANGELOG.md
- 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: Create a PR updating readme + published version, and changelog
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 }}"
gh pr edit --add-reviewer @metabase/embedding
env:
GH_TOKEN: ${{ steps.app-token.outputs.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 }}
- name: Setup git user
run: |
git config --global user.email "metabase-bot@metabase.com"
git config --global user.name "Metabase bot"
- 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 }}

View File

@@ -1,44 +0,0 @@
name: Require Percy specs
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
files-changed:
if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'visual')
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
visualizations: ${{ steps.changes.outputs.visualizations }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
add-label:
needs: files-changed
if: needs.files-changed.outputs.visualizations == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: tibdex/github-app-token@v2.1.0
id: generate-token
with:
app_id: ${{ secrets.METABASE_BOT_APP_ID }}
private_key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- uses: actions/github-script@v7
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["visual"]
})

157
.github/workflows/uberjar-sdk.yml vendored Normal file
View File

@@ -0,0 +1,157 @@
name: Build + Docker Uberjar for SDK
on:
# This workflow will be called from "release-embedding-sdk.yml"
workflow_call:
inputs:
git_ref:
description: 'Valid git reference e.g. branches, tags, hashes'
type: string
required: true
image_name:
description: Docker image used to upload to Dockerhub
type: string
required: true
jobs:
build:
name: Build MB ${{ matrix.edition }}
runs-on: ubuntu-22.04
timeout-minutes: 40
strategy:
matrix:
edition: [ee]
env:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: uberjar
- name: Build
run: ./bin/build.sh
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
with:
name: metabase-ee-uberjar
check_jar_health:
runs-on: ubuntu-22.04
name: Is ${{ matrix.edition }} (java ${{ matrix.java-version }}) healthy?
needs: build
timeout-minutes: 10
strategy:
matrix:
edition: [ee]
java-version: [11, 17]
steps:
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
with:
java-package: jre
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- run: java -version
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-ee-uberjar
- name: Launch uberjar
run: java -jar ./target/uberjar/metabase.jar &
- name: Wait for Metabase to start
run: while ! curl 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
containerize_test_and_push_container:
runs-on: ubuntu-22.04
name: Containerize ${{ matrix.edition }}
needs: check_jar_health
strategy:
matrix:
edition: [ee]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Extract and clean branch name
shell: bash
run: echo "branch=$(echo $GITHUB_REF_NAME | sed 's/[^-._a-zA-Z0-9]/-/g')" >> $GITHUB_OUTPUT
id: extract_branch
- name: Set image name to env
run: echo "image_name=${{ inputs.image_name || steps.extract_branch.outputs.branch }}" >> "$GITHUB_ENV"
- name: Verify the intended tag of the container image
run: echo "Container image will be tagged as ${{ env.image_name }}-${{ matrix.edition }}"
- name: Check out the code (Dockerfile needed)
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- name: Download uploaded artifacts to insert into container
uses: actions/download-artifact@v4
with:
name: metabase-ee-uberjar
path: bin/docker/
- name: Move the ${{ matrix.edition }} uberjar to the context dir
run: mv bin/docker/target/uberjar/metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2.5.0
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/metabase-dev:${{ env.image_name }}-${{ matrix.edition }}
no-cache: true
push: true
- name: Launch ${{ matrix.edition }} container
run: docker run --rm -dp 3000:3000 localhost:5000/metabase-dev:${{ env.image_name }}-${{ matrix.edition }}
timeout-minutes: 5
- name: Is Docker running?
run: docker ps
- name: Wait for Metabase to start and reach 100% health
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Retag and push images
run: docker tag localhost:5000/metabase-dev:${{ env.image_name }}-ee ${{ github.repository_owner }}/metabase-dev:${{ env.image_name }} && docker push ${{ github.repository_owner }}/metabase-dev:${{ env.image_name }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
env:
TRIVY_OFFLINE_SCAN: true
with:
image-ref: docker.io/${{ github.repository_owner }}/metabase-dev:${{ env.image_name }}
format: sarif
output: trivy-results.sarif
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'

View File

@@ -116,6 +116,8 @@ jobs:
platforms: linux/amd64
network: host
tags: localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-${{ matrix.edition }}
build-args: |
GIT_COMMIT_SHA=${{ github.sha }}
no-cache: true
push: true
- name: Launch ${{ matrix.edition }} container
@@ -240,6 +242,8 @@ jobs:
file: bin/docker/Dockerfile_ubuntu
network: host
tags: localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-${{ matrix.edition }}-ubuntu
build-args: |
GIT_COMMIT_SHA=${{ github.sha }}
no-cache: true
push: true
- name: Launch ${{ matrix.edition }} Ubuntu based container

11
.gitignore vendored
View File

@@ -1,5 +1,5 @@
*.class
*.cljc.rej
*.*.rej
*.iml
*.jar
*.log
@@ -27,7 +27,7 @@
/.lein-repl-history
/.sqlite.db
/backend-checksums.txt
/backend-docs/uberdoc.html
/backend-docs
/build.xml
/checkouts
/classes
@@ -51,6 +51,7 @@
/resources/frontend_client/embed.html
/resources/frontend_client/index.html
/resources/frontend_client/public.html
/resources/embedding-sdk
/resources/i18n/*.edn
/resources/instance_analytics.zip
/resources/license-backend-third-party.txt
@@ -95,7 +96,8 @@ modules/drivers/*/.lsp/*
.clj-kondo/*
!.clj-kondo/README.md
!.clj-kondo/config.edn
!.clj-kondo/hooks/
!.clj-kondo/src/
!.clj-kondo/test/
!.clj-kondo/macros/
# Editor- or environment-specific local files
@@ -107,3 +109,6 @@ modules/drivers/*/.lsp/*
.clj-kondo/metosin/malli-types-clj
.github/static-viz-sources.yaml
# airgap
/resources/airgap/

4
.loki/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
current
difference
report.html
report.json

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

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