Compare commits

...

92 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
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
Adam James
f3a26b5135 was using the wrong key here, not sure why, maybe it changed recently? 2024-05-28 15:32:30 -07:00
adam-james
a5c33e1756 Merge branch 'master' into attach-render-errors-subscriptions 2024-05-28 13:33:42 -07:00
Adam James
b89f86c568 add back some changes from master 2024-05-28 10:52:44 -07:00
Adam James
e108633f36 Fix lint errors 2024-05-27 16:57:54 -07: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
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
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
e16bfa4a76 Merge branch 'master' into attach-render-errors-subscriptions 2024-03-22 13:50:16 -07:00
adam-james
d0148baa24 Merge branch 'master' into attach-render-errors-subscriptions 2024-03-21 08:57:44 -07: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
754 changed files with 19913 additions and 15268 deletions

View File

@@ -1,5 +1,5 @@
;; -*- comment-column: 100; -*-
{:config-paths ["macros"]
{:config-paths ["macros" "src"]
:linters
{:aliased-namespace-symbol {:level :warning}
:invalid-arity {:skip-args [metabase.lib.util.match/match]} ; TODO (cam): can we fix these?
@@ -193,6 +193,7 @@
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
@@ -428,10 +429,6 @@
metabase.driver.druid.js druid.js
metabase.driver.druid.query-processor druid.qp
metabase.driver.druid.sync druid.sync
metabase.driver.googleanalytics.client ga.client
metabase.driver.googleanalytics.execute ga.execute
metabase.driver.googleanalytics.metadata ga.metadata
metabase.driver.googleanalytics.query-processor ga.qp
metabase.driver.impl driver.impl
metabase.driver.mongo.execute mongo.execute
metabase.driver.mongo.parameters mongo.params
@@ -687,6 +684,9 @@
metabase.api.card-test/with-temp-native-card! hooks.common/with-two-bindings
metabase.api.card-test/with-temp-native-card-with-params! hooks.common/with-two-bindings
metabase.api.collection-test/with-french-user-and-personal-collection hooks.common/with-two-top-level-bindings
metabase.api.common/defendpoint hooks.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async hooks.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async-schema hooks.metabase.api.common/defendpoint
metabase.api.dashboard-test/with-chain-filter-fixtures hooks.common/let-one-with-optional-value
metabase.api.dashboard-test/with-simple-dashboard-with-tabs hooks.common/with-one-binding
metabase.api.card-test/with-card-param-values-fixtures hooks.common/let-one-with-optional-value
@@ -785,9 +785,6 @@
metabase.api.card-test/with-ordered-items macros.metabase.api.card-test/with-ordered-items
metabase.api.collection-test/with-collection-hierarchy macros.metabase.api.collection-test/with-collection-hierarchy
metabase.api.collection-test/with-some-children-of-collection macros.metabase.api.collection-test/with-some-children-of-collection
metabase.api.common/defendpoint macros.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async macros.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async-schema macros.metabase.api.common/defendpoint
metabase.api.common/define-routes macros.metabase.api.common/define-routes
metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing macros.metabase.api.embed-test/with-embedding-enabled-and-temp-card-referencing
metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing macros.metabase.api.embed-test/with-embedding-enabled-and-temp-dashcard-referencing

View File

@@ -1,26 +1,7 @@
(ns macros.metabase.api.common
(:require
[clojure.string :as str]))
(ns macros.metabase.api.common)
(defmacro define-routes
"Macro for api.common/define-routes"
[& args]
`(do (def ~'routes "docstring" nil)
~@args))
(defn route-fn-name
"route fn hook"
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defmacro defendpoint
"Macro for api.common/defendpoint*"
[method route & body]
(let [method-fn (symbol "compojure.core" (str method))
route-name (route-fn-name method route)]
`(do
~method-fn
(defn ~route-name ~@body))))

View File

@@ -376,8 +376,15 @@
(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)))))))
(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)))

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

@@ -124,40 +124,3 @@
(check-for-i18n-format-specifiers node format-string)
(check-format-string-arg-count node format-string args)))
x)
(comment
;; should fail, missing a format arg
(infof
{:node (api/parse-string
(str '(log/warnf "Migration lock was acquired after %d retries.")))})
(infof
{:node (api/parse-string
(str '(log/warnf e "Migration lock was acquired after %d retries.")))})
;; should fail, too many format args
(infof
{:node (api/parse-string
(str '(log/warnf "Migration lock was acquired after %d retries." 1 2)))})
(infof
{:node (api/parse-string
(str '(log/warnf e "Migration lock was acquired after %d retries." 1 2)))})
(infof
{:node (api/parse-string
(str '(log/warnf "Migration lock was acquired after {0} retries." 1)))})
;; should fail, has format args but is warn rather than warnf
(info
{:node (api/parse-string
(str '(log/warn e "Migration lock was acquired after %d retries." 1 2)))})
;; should fail -- should not use i18n/tru or i18n/trs
(infof
{:node (api/parse-string
(str '(log/warnf (metabase.util.i18n/tru "Migration lock was acquired after {0} retries." 1))))})
(info
{:node (api/parse-string
(str '(log/warn (metabase.util.i18n/trs "Migration lock was acquired after {0} retries." 1))))}))

View File

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

@@ -36,6 +36,7 @@ runs:
["dashboard-filters", {} ],
["embedding", {} ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],
["metrics", {} ],
["models", {} ],
@@ -45,6 +46,7 @@ runs:
["organization", {} ],
["permissions", {} ],
["question", {} ],
["question-reproductions", {} ],
["search", {}],
["sharing", {} ],
["visualizations-charts", {} ],

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

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"
}

2
.github/team.json vendored
View File

@@ -32,7 +32,7 @@
{
"name": "Query Processor",
"label": ".Team/QueryProcessor",
"projectUrl": "https://github.com/orgs/metabase/projects/85/views/1",
"projectUrl": "https://github.com/orgs/metabase/projects/83/views/8",
"members": ["camsaul", "snoe", "bshepherdson", "metamben", "lbrdnk"]
},
{

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

@@ -160,66 +160,6 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-googleanalytics-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: googleanalytics
steps:
- uses: actions/checkout@v4
- name: Test Google Analytics driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-googleanalytics-ee'
test-args: ":exclude-tags '[:mb/once]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-google-related-drivers-classpath-test:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: 'googleanalytics,bigquery-cloud-sdk'
MB_BIGQUERY_TEST_PROJECT_ID: ${{ secrets.BIGQUERY_TEST_PROJECT_ID }}
MB_BIGQUERY_TEST_CLIENT_ID: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_ID }}
MB_BIGQUERY_TEST_CLIENT_SECRET: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_SECRET }}
MB_BIGQUERY_TEST_ACCESS_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_ACCESS_TOKEN }}
MB_BIGQUERY_TEST_REFRESH_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_REFRESH_TOKEN }}
MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON: ${{ secrets.MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON }}
steps:
- uses: actions/checkout@v4
- name: Test Google Related Drivers Classpath
uses: ./.github/actions/test-driver
with:
junit-name: 'be-google-related-drivers-classpath-test'
test-args: ':only "[metabase.query-processor-test.expressions-test metabase.driver.google-test metabase.driver.googleanalytics-test]"'
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-mariadb-10-2-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'

View File

@@ -20,7 +20,7 @@ concurrency:
cancel-in-progress: true
jobs:
git-tag:
check-git-tag:
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
@@ -30,25 +30,21 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
fetch-tags: true
- name: Setup git user
- name: check tags
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 }}
- if: ${{ failure() && steps.push-tag.outcome == 'failure' }}
run: echo "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."
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: git-tag
needs: check-git-tag
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
@@ -77,6 +73,8 @@ jobs:
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
@@ -86,9 +84,24 @@ jobs:
with:
m2-cache-key: "release-sdk"
- name: Update readme
run: |
./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
run: |
sed -i -E 's/("version": ").*"/\1${{ inputs.sdk_version }}"/' enterprise/frontend/src/embedding-sdk/package.template.json
./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
@@ -102,6 +115,12 @@ jobs:
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
@@ -136,7 +155,6 @@ jobs:
run: |
aws s3 cp $FILE s3://$BUCKET/$BUCKET_PATH
publish-npm:
needs: [build-sdk, upload-jar]
runs-on: ubuntu-22.04
@@ -153,14 +171,30 @@ jobs:
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: |
sed -i -E 's|(embedding-sdk-)[0-9.]+|\1${{ inputs.sdk_version }}|' enterprise/frontend/src/embedding-sdk/README.md
sed -i -E 's|(http://downloads.metabase.com/sdk/v)[0-9.]+|\1${{ inputs.sdk_version }}|' enterprise/frontend/src/embedding-sdk/README.md
bash ./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
run: |
sed -i -E 's/("version": ").*"/\1${{ inputs.sdk_version }}"/' enterprise/frontend/src/embedding-sdk/package.template.json
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
@@ -168,7 +202,7 @@ jobs:
app-id: ${{ secrets.METABASE_BOT_APP_ID }}
private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- name: Create a PR updating readme + published version
- 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 }}'
@@ -177,6 +211,7 @@ jobs:
--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 }}
@@ -191,3 +226,29 @@ jobs:
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 }}

3
.gitignore vendored
View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 62 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: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -20,8 +20,7 @@
"/enterprise/backend/src"
"/modules/drivers/bigquery-cloud-sdk/src"
"/modules/drivers/druid/src"
"/modules/drivers/google/src"
"/modules/drivers/googleanalytics/src"
"/modules/drivers/druid-jdbc/src"
"/modules/drivers/mongo/src"
"/modules/drivers/oracle/src"
"/modules/drivers/presto-jdbc/src"

View File

@@ -91,3 +91,4 @@ if (!fs.existsSync(SDK_DIST_DIR)) {
generateSdkPackage();
copyFileToOutput("LICENSE.txt");
copyFileToOutput("frontend/src/embedding-sdk/README.md", "README.md");
copyFileToOutput("frontend/src/embedding-sdk/CHANGELOG.md", "CHANGELOG.md");

View File

@@ -0,0 +1,11 @@
#!/bin/bash
function update_readme() {
sed -i -E 's|(embedding-sdk-)[0-9.]+|\1'"$1"'|' enterprise/frontend/src/embedding-sdk/README.md
sed -i -E 's|(http://downloads.metabase.com/sdk/v)[0-9.]+|\1'"$1"'|' enterprise/frontend/src/embedding-sdk/README.md
}
function update_package_json_template() {
sed -i -E 's/("version": ").*"/\1'"$1"'"/' enterprise/frontend/src/embedding-sdk/package.template.json
}
$1 $2

View File

@@ -49,7 +49,7 @@
com.snowplowanalytics/snowplow-java-tracker
{:mvn/version "1.0.1" ; Snowplow analytics
:exclusions [com.fasterxml.jackson.core/jackson-databind]}
com.taoensso/nippy {:mvn/version "3.3.0"} ; Fast serialization (i.e., GZIP) library for Clojure
com.taoensso/nippy {:mvn/version "3.4.2"} ; Fast serialization (i.e., GZIP) library for Clojure
com.vladsch.flexmark/flexmark {:mvn/version "0.64.8"} ; Markdown parsing
com.vladsch.flexmark/flexmark-ext-autolink
{:mvn/version "0.64.8"} ; Flexmark extension for auto-linking bare URLs
@@ -76,7 +76,7 @@
io.github.eerohele/pp {:git/tag "2024-01-04.60" ; super fast pretty-printing library
:git/sha "a428751"
:git/url "https://github.com/eerohele/pp"}
io.github.metabase/macaw {:mvn/version "0.1.29"} ; Parse native SQL queries
io.github.metabase/macaw {:mvn/version "0.1.44"} ; Parse native SQL queries
;; The 2.X line of Resilience4j requires Java 17, so we cannot upgrade this dependency until that is our minimum JVM version
io.github.resilience4j/resilience4j-retry {:mvn/version "1.7.1" #_ "must be 1.7.1"} ; Support for retrying operations
io.prometheus/simpleclient_hotspot {:mvn/version "0.16.0"} ; prometheus jvm collector
@@ -254,7 +254,7 @@
ring/ring-mock {:mvn/version "0.4.0"} ; creating Ring request maps for testing purposes
talltale/talltale {:mvn/version "0.5.14"}} ; generates fake data, useful for prototyping or load testing
:extra-paths ["dev/src" "local/src" "test" "test_resources"]
:extra-paths ["dev/src" "local/src" "test" "test_resources" ".clj-kondo/src" ".clj-kondo/test"]
:jvm-opts ["-Dmb.run.mode=dev"
"-Dmb.field.filter.operators.enabled=true"
"-Dmb.test.env.setting=ABCDEFG"
@@ -385,7 +385,6 @@
"modules/drivers/bigquery-cloud-sdk/test"
"modules/drivers/druid/test"
"modules/drivers/druid-jdbc/test"
"modules/drivers/googleanalytics/test"
"modules/drivers/mongo/test"
"modules/drivers/oracle/test"
"modules/drivers/presto-jdbc/test"
@@ -412,7 +411,6 @@
"modules/drivers/bigquery-cloud-sdk/src"
"modules/drivers/druid/src"
"modules/drivers/druid-jdbc/src"
"modules/drivers/googleanalytics/src"
"modules/drivers/mongo/src"
"modules/drivers/oracle/src"
"modules/drivers/presto-jdbc/src"
@@ -435,7 +433,6 @@
"modules/drivers/bigquery-cloud-sdk/src"
"modules/drivers/druid/src"
"modules/drivers/druid-jdbc/src"
"modules/drivers/googleanalytics/src"
"modules/drivers/mongo/src"
"modules/drivers/oracle/src"
"modules/drivers/presto-jdbc/src"
@@ -622,9 +619,9 @@
:extra-deps
{org.clojure/data.json {:mvn/version "2.5.0"}}}
;;; Run tests for the build scripts:
;;;
;;; clj -X:dev:drivers:build:build-dev:build-test
;; Run tests for the build scripts:
;;
;; clj -X:dev:drivers:build:build-dev:build-test
:build-test
{:exec-fn mb.hawk.core/find-and-run-tests-cli
:exec-args {:only ["bin/build/test"]}}
@@ -706,6 +703,12 @@
{:exec-args {:only [metabase.api.search-test
"test/metabase/search"]}}
;; test custom clj-kondo linters and hooks.
;;
;; clj -X:dev:test:test/kondo
:test/kondo
{:exec-args {:only [".clj-kondo/test"]}}
;; watch and reload clojure namespaces
:watch {:extra-deps
{com.nextjournal/beholder {:mvn/version "1.0.2"} ;; watcher

View File

@@ -12,7 +12,7 @@
You can use [[reset-changes!]] to clear our all the current trackings.
And [[untrack-all!]] or [[untrack!]] to stop tracking."
(:require
[clojure.pprint :as pprint]
[clojure.string :as str]
[metabase.util :as u]
[methodical.core :as m]
[toucan2.core :as t2]
@@ -29,6 +29,19 @@
(def ^:private tracked-models (atom #{}))
(defn- indent [prefix s]
(str/join "\n"
(map
(fn [line] (str prefix line))
(str/split-lines s))))
(defn- sort-map-for-printing [m]
(into (sorted-map-by (fn [a b]
(cond (= a :id) -1
(= b :id) 1
:else (compare a b)))) m))
#_:clj-kondo/ignore ;; printlns
(defn on-change
"When a change occurred, execute this function.
@@ -43,7 +56,7 @@
"
[path change-info]
(println (u/colorize :magenta :new-change) (u/colorize :magenta path))
(pprint/pprint change-info))
(println (->> change-info sort-map-for-printing u/pprint-to-str (indent " "))))
(defn- clean-change
[change]
@@ -98,7 +111,7 @@
(defn track!
"Start tracking a list of models.
(track! 'Card 'Dashboard)"
(track! :model/Card :model/Dashboard)"
[& models]
(doseq [model (map t2.model/resolve-model models)]
(track-one! model)

View File

@@ -1,18 +0,0 @@
---
title: Working with Google Analytics in Metabase
redirect_from:
- /docs/latest/administration-guide/databases/google-analytics
---
# Google Analytics (DEPRECATED)
Metabase supported Google Analytics version 3, which Google has set an end-of-life date for July 1, 2023.
If you still want to view Google Analytics data in Metabase, we recommend:
- Upgrading to the latest version of [Google Analytics](https://support.google.com/analytics/answer/10089681?hl=en&ref_topic=12154439,12153943,2986333).
- Setting up a [BigQuery](https://cloud.google.com/bigquery) account.
- Connecting your [Bigquery to Metabase](./bigquery.md).
- Exporting your [Google Analytics 4 data to BigQuery](https://support.google.com/analytics/answer/9358801?hl=en).
Google Analytics will export the data to BigQuery in one table per day. You can build native SQL models with [wildcard queries](https://cloud.google.com/bigquery/docs/querying-wildcard-tables), and then build Metabase questions over those views.

View File

@@ -4,6 +4,18 @@ title: API changelog
# Breaking changes to the API interface
## Metabase 0.51.0
- `GET /api/dashboard/:id/query_metadata`
New endpoint that combines responses for `/api/field/:id`, `/api/database/:id`, and `/api/table/:id/query_metadata`.
This should drastically cut down on the required number of requests to display a card.
- `GET /api/card/:id/query_metadata`
New endpoint that combines responses for `/api/field/:id`, `/api/database/:id`, and `/api/table/:id/query_metadata`.
This should drastically cut down on the required number of requests to display a dashboard.
## Metabase 0.50.0
- `GET /api/collection/tree` and `GET /api/collection/:id/items`
@@ -55,4 +67,4 @@ NOTE: These endpoint changes were added in 0.49.3, and a bug in `GET /api/embed/
- all endpoints that return data (e.g. exports in JSON, XLSX, CSV, endpoints that end in "/query")
Starting from v49, we respond to the API calls with values formatted according to the instance localization options
Starting from v49, we respond to the API calls with values formatted according to the instance localization options

View File

@@ -86,7 +86,6 @@ These parents are kind of a big deal.
- `:sql-jdbc` implements most of the four main features, but instead you must implement `sql-jdbc` multimethods found in `metabase.driver.sql-jdbc.*` namespaces, as well as some methods in `metabase.driver.sql.*` namespaces.
- `:sql` is itself the parent of `:sql-jdbc`; it can be used for SQL-based databases that _do not_ have a JDBC driver, such as BigQuery.
- `:sql` implements a significant chunk of driver functionality, but you must implement some methods found in `metabase.driver.sql.*` namespaces to use it.
- Drivers that use Google's API, such as BigQuery and Google Analytics, can use the `:google` driver as a parent.
- Some drivers use other "concrete" drivers as their parent -- for example, `:redshift` uses `:postgres` as a parent, only supplying method implementations to override postgres ones where needed.
### Calling parent driver implementations
@@ -139,4 +138,4 @@ To start a REPL.
clojure -A:dev:drivers:drivers-dev
```
You'll need to rebuild the driver and install it in your `./plugins` directory, and restart Metabase when you make changes.
You'll need to rebuild the driver and install it in your `./plugins` directory, and restart Metabase when you make changes.

View File

@@ -116,7 +116,6 @@ Note that the first part of the timestamp is in UTC (same thing as GMT). The tim
- Amazon Athena
- Druid
- Google Analytics
- MongoDB
- Presto
- SparkSQL

View File

@@ -77,7 +77,6 @@ If your timestamps are stored as strings or numbers in your database, an admin c
`datetimeDiff` is currently unavailable for the following databases:
- Druid
- Google Analytics
## Related functions

View File

@@ -9,7 +9,6 @@ Pivot tables allow you swap rows and columns, group data, and include subtotals
Pivot tables are not currently available for the following databases in Metabase:
- Druid
- Google Analytics
- MongoDB
Pivot tables work for simple and custom questions with summarized data for all other [officially supported databases](../../../databases/connecting.md). They don't work for questions that lack aggregate data, and they don't work for questions written in SQL, as Metabase would need to modify your SQL code in order to calculate subtotals. If you really need to use SQL, the workaround here is to create your question in two steps: first do all the complex things you need to do in SQL, save the results as a question, then use that saved SQL question as the starting point for a new GUI question which summarizes that data.
@@ -36,4 +35,4 @@ Where it makes sense, Metabase will automatically include subtotals for grouped
To collapse a group on a pivot table, you can click on the minus (–) button next to the group's heading (or the plus (+) button to expand it). When you save a pivot table, Metabase will remember which groups were expanded and which were collapsed.
For more, check out [How to create a pivot table to summarize your data](https://www.metabase.com/learn/basics/visualizing-data/how-to-create-pivot-tables.html).
For more, check out [How to create a pivot table to summarize your data](https://www.metabase.com/learn/basics/visualizing-data/how-to-create-pivot-tables.html).

View File

@@ -26,7 +26,7 @@ You can join data to combine your current data with another table, or even with
## Native query editor
Also known as the SQL editor (we say native because you can also query databases that don't use SQL, like MongoDB and Google Analytics).
Also known as the SQL editor (we say native because you can also query databases that don't use SQL, like MongoDB).
### [Introduction to the native query editor](./native-editor/writing-sql.md)

View File

@@ -2,17 +2,13 @@ import { cypressWaitAll } from "e2e/support/helpers";
Cypress.Commands.add(
"createDashboardWithQuestions",
({ dashboardName, dashboardDetails, questions, cards }) => {
({ dashboardName, dashboardDetails, questions }) => {
return cy
.createDashboard({ name: dashboardName, ...dashboardDetails })
.then(({ body: dashboard }) => {
return cypressWaitAll(
questions.map((query, index) =>
cy.createQuestionAndAddToDashboard(
query,
dashboard.id,
cards ? cards[index] : undefined,
),
questions.map(query =>
cy.createQuestionAndAddToDashboard(query, dashboard.id),
),
).then(dashcardResponses => {
const questions = dashcardResponses.map(

View File

@@ -20,7 +20,6 @@ Cypress.Commands.add(
}).then(response => ({
...response,
body: response.body.dashcards[0],
questionId,
}));
},
);

View File

@@ -9,8 +9,10 @@ export function setActionsEnabledForDB(dbId, enabled = true) {
}
export function fillActionQuery(query) {
cy.get(".ace_content:visible").type(query, {
// Without this wait, content tends to drop from the beginning of the string. TODO: Fix
cy.get(".ace_content:visible").wait(500).type(query, {
parseSpecialCharSequences: false,
delay: 50,
});
}
/**

View File

@@ -129,7 +129,7 @@ function getIcon(actionType) {
export function assertQueryBuilderRowCount(count) {
const message =
count === 1 ? "Showing 1 row" : `Showing ${count.toLocaleString()} rows`;
cy.findByTestId("question-row-count").contains(message);
cy.findByTestId("question-row-count").should("contain.text", message);
}
/**

View File

@@ -3,10 +3,10 @@ export const openCommandPalette = () => cy.get("body").type("{ctrl+k}{cmd+k}");
export const commandPaletteButton = () =>
cy.findByTestId("app-bar").findByRole("button", { name: /Search/ });
export const closeCommandPalette = () => cy.get("body").type("{esc}");
export const pressPageUp = () => cy.get("body").type("{pageup}");
export const pressPageDown = () => cy.get("body").type("{pagedown}");
export const pressHome = () => cy.get("body").type("{home}");
export const pressEnd = () => cy.get("body").type("{end}");
export const pressPageUp = () => cy.realPress("{pageup}");
export const pressPageDown = () => cy.realPress("{pagedown}");
export const pressHome = () => cy.realPress("{home}");
export const pressEnd = () => cy.realPress("{end}");
export const commandPaletteInput = () =>
cy.findByPlaceholderText("Search for anything or jump somewhere…");

View File

@@ -6,8 +6,9 @@ export function expressionEditorWidget() {
* @param {Object} option
* @param {string} option.formula
* @param {string=} option.name
* @param {boolean} option.blur true by default. However, if you need to examine the popover in the test, it should be set to false so the popover is not dismissed
*/
export function enterCustomColumnDetails({ formula, name }) {
export function enterCustomColumnDetails({ formula, name, blur = true }) {
cy.get(".ace_text-input")
.first()
.as("formula")
@@ -15,11 +16,15 @@ export function enterCustomColumnDetails({ formula, name }) {
.focus()
.clear()
.type(formula);
if (blur) {
cy.get("@formula").blur();
}
if (name) {
cy.findByPlaceholderText("Something nice and descriptive")
.clear()
.type(name);
.type(name)
.blur();
}
}

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