Compare commits

...

2516 Commits

Author SHA1 Message Date
Raphael Krut-Landau
1ad39582c8 fix(webapp): Vertically align checkboxes 2024-08-02 10:07:23 -04:00
John Swanson
2c7d0cf146 Revert "Preprocess queries before data perms check (#45601)" (#46429)
This reverts commit c7a5aee1f8.
2024-08-02 13:38:23 +00:00
Noah Moss
002238217a Add extra geojson content type (#46427) 2024-08-02 13:37:23 +00:00
Chris Truter
5ba895be36 Tighten up queue test (#46420) 2024-08-02 12:58:44 +00:00
Nicolò Pretto
3108d9fed1 fix low contrast on night theme embed frame "Export as pdf" (#46288)
* update embed frame pdf button colors to use --mb-color- vars

* change download pdf button color to brand color

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

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

* add e2e test

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

* refactor args

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

* fix db connection form icons

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

* Use :default temporal-unit

* Simplify logic, update comments

* Update substitute-field-filter-test

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

* Update field-filter-date-test

* Use end-excludding gte lt filter for DateTime fields

* Update substitute-field-filter-test

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

* Update field-filter-date-test

* Update bigquery test + comment

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

* Add guard for unexpected date string format

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

* Address review remarks

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

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

* better error handling

* update schedule

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

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

* Fixup bad git merge on test expectation

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

* Update releases.md

---------

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

* Add relativeDateFilterPartsRelativeTimeInterval

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

* Update desugar-relative-time-interval

* Define relative-time-filter op

* Add or update tests

* Update tests

* Update display-name-method

* Update test

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

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

* Add `effective_ancestors` to collection data

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

* Consolidate effective ancestors

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

- it never has the Root Collection, and

- the ancestors don't have a `personal_owner_id`

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

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

* setup rendering pipeline for static pie chart

* remove more donut code from BE

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

* compute viz settings for static pie chart

* create chartModel for pie chart (#43549)

* create chartModel for pie chart

* render static pie chart (#43550)

* render static pie chart

* render static pie chart legend (#43551)

* disable animation

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

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

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

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

* echarts pie

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

* add loki specs

* save snapshots

* fix small slices disappearing

* update snapshots

* add repro story for exteremely small slice

* add snapshot

* fix rounded total

* fix percent formatting in legend

* fix date dimension formatting

* fix binned and relative date dimension labels on legend

* add specs and snapshots for null and unaggregated dimensions

* hide overlaping labels on chart

* fix null dimension color

* show error when metric column has a negative value

* move legend to botom

* make dot margin smaller

* add columns to legend

* sort legend vertically

* dont use grid if only one row for legend

* never hide legend in static viz

* fix empty column culling

* show single legend item

* add long dimension name story

* fix long dimension name in legend

* right justify percentages in legend

* remove negative error and re-add stories

* handle negative values

* create chart definition for dynamic pie chart

* render chart with responsiveness

* add comment for borderWidth calculation

* center legend

* fix legend centering

* add story for missing currency formatting

* fix missing currency formatting

* fix graalvm crashing

* fix column settings computation

* add another currency formatting repro

* fix wrong order of col settings computations

* convert colors to hex

* fix colors missing from viz settings

* temp todo comment

* fix colors in dynamic viz

* update snapshots

* fix crashing due to invalid dimension/metric setting

* fix chart crashing for boolean dimension with labels on chart

* add repro

* fix regression in label formatting

* fix labels on small slices

* update specs

* emphasis state for slice hover

* recreate old label hiding logic

* include height measurement in getIsLabelVisible

* move d3 slices to chart model

* fix labels on static viz

* wip basic hover state and tooltip

* fix emphasis style getting stuck by memoizing everything

* update total display value

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

* handle other slice in tooltip

* fix bugs in total graphic

* use OTHER_SLICE_KEY const in static viz legend

* implement legend and connect to hover state

* implement click actions

* fix slice not clickable

* handle all zero slices

* add repro

* update specs

* update pie_chart.cy.spec.js

* update chart_drill.cy.spec.js

* add repro for single column legend

* use minimum 2 legend columns

* fix legend text overlap

* use more margin for single row legend

* update specs

* add repro for 28568

* add repro for 38424

* fix percent label not showing on large slices

* hide total text when chart is small

* replace comment about animations

* show warning for mixed positive and negative values

* delete old chart files

* fix type errors

* update d3 import

* update specs

* remove branch from uberjar.yml

* dont put single slice into other

* fix lint errors and pie render test

* update more d3 imports

* remove unused settings

* revert preview-card-width change

* remove unused import

* remove majorWidth option from formatting

* use debounceLeading refresh mode in ChartWithLegend

* remove TOTAL_GRAPHIC_OPTION constant

* delete unit test for pie chart

* fix failing test by doing set comparison instead

* fix typo in comment

* remove SUNBURST_SERIES_OPTION constant

* fix lint by removing unused eslint-disable

* move default color computation to getValue

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

* update pie border color for night mode and embedding

* fix styles for embedding case and add stories

* skip embedding stories

---------

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

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

* import updated translations

---------

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

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

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

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


---------

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

* Improve the test structure and assertions

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

* upgrade jest

* drop useless types

* drop babel-jest

* fix types

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

* Update naming

* Update naming

* Add client header for embedded context

* Add client header for embedded context

* Add sdk version header

* Fix e2e

* Fix storybook build

* Refactor to inject version in build step

* Fix unit tests

* Self review

* Fix e2e

* Fix e2e

* Fix e2e

* Fix e2e

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

* deduplicate webpack deps

* add ^

---------

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

* specs, public dashboards

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

* Restore fancy color hover states

* Add css modules

* oh the cleverness of me

* better var name

---------

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

**Better basic memoization**

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

**Bounded memoization**

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

**Fast JVM versions**

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

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

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

* Only assert the resize down

* Refactor repro 31701

* Remove flaky tag

* Better organize describe blocks

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

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

* Reuse existing helper

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

* Merge TS command definitions into a single file

* Export types

* Make dashboardDetails optional

* Export StructuredQuestionDetails

* Remove duplicated function

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

* Reuse const

* Remove old definitions

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

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

* Fix

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

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

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

* e2e test disabled moving search and recent items

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

* include api tests for query_execution and view_log

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

- disambiguate names used in tests

* pass test + cleanup test helper

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

* Remove unused properties

* Remove comment

* Experiment

* Simplify

* general cleanup and adding dashboard links handling

* fix tests, link cards; sort output

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

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

* Fix tests

---------

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

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

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

---------

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

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

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

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

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

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

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

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

* I missed a linter warning

* fix tab rendering

* fix test

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

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

---------

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

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

* migration adding embedding_client and embedding_version to qe and vl tables

* clarify function api

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

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

* update update migrations

* add predconditions to migrations

* fix tablenames + dataset_test

* Code Review responses

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

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

* Remove the Trash Collection from serialization

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

* fix: automatic Tusk self-review

---------

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

* use new built-in mu/defn-

* mu/defn- preserves metadata

---------

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

* Add TODO for the remaining tasks

* Make a test name consistent with others

* Finish the E2E test for #27643

* Fix the test to use PostgresDB

Since H2 originally doesn't fail the test

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

* Create QA snapshot with fully synced field metadata

* Fix failed tests from field metadata change

* Simplify question scenarios

* Simplify dashboard scenarios

* Fix permissions

* Rework titles

* Add comment about PG

* Add limit to speed things up

* Fix and improve dashboard assertions

* Fix and improve question assertions

---------

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

Fixes 45953

WIP

* use new-page in values-iterator

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

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

Fixes #41640

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

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

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

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

This fixes it by just taking last instead of destructuring.

* correct comparison to always use abs value in conditonal check

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

* Fix `PublicOrEmbeddedDashboardPage` tests

* Add tests

* Remove redundant dataset error checks

* Revert "Remove redundant dataset error checks"

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

* Fix syntax

* Add qa_db to workflow summary

* Only run necessary containers

* Fix QA DB snapshots running when QA_DB_ENABLED=false

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

* Make the whitespace linter happy

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

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

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

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

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

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

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

* Speed up the test by limiting the number of rows

* Make the repro more correct, and more resilient

* Remove intercepts

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

* Fix the test

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

* Update docs/permissions/data.md

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

---------

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

* add requirements checking

* docker check

* docker start command

* port checks

* add getting started steps

* add final install message

* cleanup cli text

* handle force-closing prompt

* build the cli when running build-embedding-sdk

* wording updates

* add redundant prompt in case of small terminals

* remove redundant instruction

* make sure the user confirms the step

* change container name to metabase-enterprise-embedding

* migrate cli to es modules instead of webpack

* add shebang line for npx

* add cli dependencies to devDependencies

* Revert "add cli dependencies to devDependencies"

This reverts commit 5d5e952c2b.

* Revert "add shebang line for npx"

This reverts commit 766fdda09e.

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

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

* Update existing tests

* Fix table hovercards E2E flake

* Fix repro 37009

* Update repro 30680

* Add comment

* Fix nested question flake

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

Fixes: #40292

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

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

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

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

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

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

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

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

* Embed preview should always use params from the token

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

* for previews, merge the embedding params sources instead

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

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

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

* fix an e2e test

* fix up last 2 failing e2e tests

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

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

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

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

- first, run the hydration method without counting DB queries

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

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

* Add e2e repro

* E2E repro

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

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

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

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

---------

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

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

* address review comments feedback

* extract useSdkContext

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

* adds the shim

* use ReactDOM.render instead of createRoot for backwards compat

* use createRoot for React 18 environment

* refactor renderRoot compatibility

* remove semver dependency

* add small test for version

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

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

* more notes

* edits

* update app db page

* file-based db mention

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

* clean output

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

* Revert "what does this break?"

This reverts commit 93e09edeb3.

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

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

* uncomment

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

* Refactor test

* Add repro for 'on' filter

* Fix metabase#39487

* Refactor test

* Change order of tests

* Improve assertions

* Group tests

* Add tests for filter pills

* Refactor tests

* Rename helpers

* Add filter modal tests

* Add tests for filter drill

* Add notebook tests

* Fix test

* Add one more repro

* Fix typo

* Optimize tests

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

* Update tests

* Improve comment

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

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

* Add comment

* Make ace editor slightly more resilient to re-renderings

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

* Update E2E tests

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

* Add bucketing to expression references

* Restore original schema

* Update e2e test

* Update test as per review remarks

* Apply suggestions from code review

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

* Remove alignment

* Rename ::field-type-info

* Update log level

* Remove redundant log

---------

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

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

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

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

* Refactor assertions

* Add repro for #33708

* Fix typo

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

* Remove Replay config

* Install and use custom Chrome v111

* Simplify comment

* Set a specific Chrome version commit

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

Fixes #37074

* Only change alias if conditions or table changed

* Fix test

* Fix fe test

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

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

* Fix right section in MultiSelect

* Update MultiSelect.styled.tsx

* Add a test

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

* Remove can_run_adhoc_query from the FE

* Disable can_run_adhoc_query on dashboard

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

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

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

* Fixup test from disabling can_run_adhoc_query

---------

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

* PR feedback

* PR feedback

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

* add foreground color test

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

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

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

* don't show unjoinable things in recents either

* unskip repro

* fix types

* fix repro

* fix tests in model/recent_views

* add unit test for invalid join in recents

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

* update type

* improve unit tests

---------

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

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

- updated whenever the QP processes a query for a dashcard

---------

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

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

This reverts commit a8b511fa28.

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

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

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

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

* Disable :foreign-keys on Mongo

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

* Update implicit joins tests

* Adjust sync-fields-test

* Update implicit joins feature check test

* Transform post-sync-hook to normal function

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

* Update test to handle Oracle correctly

* Split convoluted fn

* Avoid unnecessary computations for datasets with no fks

* Update docstring

* Fix driver usage

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

* Update sync_test.clj

* Update driver_test.clj

* Update moviedb.clj

* Update dataset_definition_test.clj

* Update fetch_metadata.clj

* Update fields_test.clj

* Update driver.clj

* Update driver/sql.clj

* Set sql driver join support to true for all joins

Deriving drivers are expected to set to false where applicable.

* Update sqllite.clj

* Remove foreign-keys from spark

* Remove :foreign-keys from presto

* Remove :foreign-keys from Athena

* Remove foreign-keys from big query

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

* Update test_metadata.cljc

* Set key-constraints to false for bigquery

* Add foreign keys to sqlite manually until sync is fixed

* Return driver require to Athena

* Correct typo

* Add naive primary key heuristic

* Update pk fk logic to handle name components correctly

* Add alias escaping to presto

* Add ordering to test

* Add order by to test

* Update test

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

* Add exception to alias forcing

* Different approach to exception from alias forcing

* Alternative approach for prefixing idents in bigq

* All seelcted fields by desired alias

* Rewrite only fields not from this source table

* Update test

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

* Add feature comment

* Explicit joins tests foreign-keys removal

* Update nested_queries_test.clj

* Update remapping tests

* Update tests

* Update tests to handle sqlite results format

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

* Address remarks

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

* Update bigquery test

* Update tests

* Adjust row level restrictions

* Add parameterized-sql feature

* Update comment

* Update leftovers

* Order keys

* Remove foreign keys from frontend

* Fix FE unit

* Update driver changelog

* Address review remark

* Update test/metabase/query_processor/test_util.clj

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

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

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

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

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

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

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

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

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

* Update test

* Update comment and reduce expression

* Update comment

* Address remarks

* Fix merge

---------

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

Fixes #44807.

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

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

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

---------

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

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

* Add driver feature

* Fix tests

* Remove ambiguous alias for sqlite

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

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

* Handle left-join support weirdness

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

* add to flaky group anyway

* add to flaky group anyway

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

* Update URL management (WIP)

* Fix tests failing because of whitespace changes

* Fix tests failing because of parameter order

* Use one hook for parameters and tab URL management

* Fix tests failing because of parameter order

* Fix test failing because of whitespace changes

* Revert

* Fix DashboardTabs tests

* Fix tests failing because of parameter order

* Fix test

* Fix test failing because of whitespace changes

* Remove unit tests that should be e2e tests now

* Fix tab navigation

* Fix string encoding/decoding

* Revert test changes

* Consistent question search params

* Update DashboardTabs tests

* Fix `SyncedParametersList`

* Fix e2e tests

* Fix nav usage

* Fix types

* Remove `useSyncedQueryString`

* Fix test

* Move slug utils to dashboard utils

* Fix nav

* Revert nav change

* Fix e2e tests

* Fix public/embedded dashboards, handle site url

* Add repro test

* Bring back and fix `PublicOrEmbeddedDashboardPage` tests

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

* Add a unit test

* Render time if 0

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

* Remove unused data-testid

* Remove redundant id and aria-labelledby

* Remove redundant props spread

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

* Fix navigation issue

* Add a repro for first issue

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

* Add a repro for second issue

* Refactor tests
- Fix not enough history entries issue

* Change order of tests to start with simpler one

* Fix invalid request issue

* Add more assertions

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

* make popover z-index customizable

* make the popover z-index customizable

* add tests for popover z-index

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

* Revert silly change

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

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

* B I G  improvements

* Appease Kondo

* Test fixes 🔧

* More test fixes 🔧

* Fix dataset-already-loaded?-test

* Fix test

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

* Postgres test fix 🔧

* Fix compilation errors

* MySQL fixes 🔧

* Fix syntax error

* MySQL fixes 🔧

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

* Fix Redshift

* Fix Presto JDBC

* Vertica test fix 🔧

* Fix Oracle dataset-already-loaded?

* Test fixes and parallelize some API tests.

* Test fixes 🔧

* Oracle test fix? 🔧

* Another test fix 🔧

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

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

* The most test fixes 🔧

* 3 or 4 test fixes 🔧

* Add schemas around stuff to catch errors

* Appease Kondo

* Implement dataset-already-loaded? for vertica

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

* Only test returned values in CI

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

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

* Add tests, support where available

* Add empty/null tests

* Adjust test query for athena

* Reset logging

* Fix comments

* Add Athena uuid conversion

* Address PR review

* Add comments

* Address PR comments

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

---------

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

* add e2e test

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

Fixes 27643

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Remove dead code

* Remove values same as default options

* Simplify hook API: Removing unused argument

* review: Remove redundant code

* Update look and feel copy (#44277)

* Update static embed tab name

* Update copies + rearrange settings

* Use Mantine Select

* Fix E2E tests by applying new copies

* Fix unit tests

* Fix more E2E tests

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

* Adjust spacing and relevant tests

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

* Reorder the function to match the visual order

* Make function name consistent

* Introduce the new background option (do nothing yet)

* Remove redundant exports

* Tighten up values to reduce confusion

* Make the parameters order consistent

* Only show background option on dashboads (spec)

* Allow dashboard embed background to be transparent

* Make filter background and header/footer transparent

* Fix type error

* Fix unit tests

* Fix E2E tests

* Fix checkerboard pattern not showing when no background

* Add unit tests

* Add missing copy update

* Remove remnants from outdated solutions within the PR

* Improve code comment references

* Fix E2E tests since the last copy change

* Fix type errors from merging master

* Update light theme style (#44488)

* Add background to dashboard filter on light theme

* Make position sticky works with transparent background

* Fix sticky filters not working on theme=transparent

* Fix unit tests

* Simplify IntersectionObserver components + fix E2E tests

* Add storybook for embedded dashboard

* Clarify the use of ExplicitSize context

* Remove unused code

* Formatting

* Review: Better mock `isWithinIframe`

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

* Update light theme checkerboard colors

* Update checkerboard colors

* Consolidate dashboard light/dark border style

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

* Update embed dashboard dark theme primary color

* Migrate dashboard text-secondary color

* Migrate text-tertiary color

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

* Fix failed e2e tests

* Fix static viz not working

* Update loki snapshots

* Remove unnecessary CSS custom property

* Make diff more consistent

* Address review: reusing type

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

* Match preview query with the actual code query

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

* Add unit tests

* Address review: Make tests less repetitive

* Update Metabase banner upsell UI (#45424)

* Prepare folder for nested components

* Update upsell UI

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

* Fix Upsell banner having horizontal scroll on full width

* Add new Metabase banner upsell component

* Fix unit tests

* Address review: Fix typo

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

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

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

* Remove unnecessary ESLint disable comment

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

* Address review: remove default value property

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

* Address review: Extract magic number

---------

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

* More UI updates (#45450)

* Update dark theme text colors to match the new design

* Update powered by metabase logo

* Update loki snapshots

* Fix unit tests

* Fix formatting

* Fix wrong dark theme metabase logo badge color

* Address review: Compress SVG with svgo

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

* Fix E2E tests

* Update loki snapshots

* Clarify Metabase base colors with comments

---------

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

* Add more tests (#45628)

* Add static embed question stories

* Add loki snapshots

* Add transparent theme for static dashboard tests

* Add transparent theme tests for static questions

* Assert `background` option in analytics tests

* Remove tests for logic that has been moved

* Update loki snapshots

* Fix failed E2E tests from merging master

---------

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

* Remove unused data-testid

* Remove redundant id and aria-labelledby

* Remove redundant props spread

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

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

* More taps

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

* add defendpoint dox

* make style consistent

* respond to review comment

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

Fixes #43597

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

* moving function to metabase global

* removing alert, adjusting e2e test

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

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

polish up pre-release milestone check

add and trigger new github action

handle already fixed issues

updates

* cleanup

* replace global imports

* prettier install

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

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

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

* fix types

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

* refactor: exportTabAsPdfButtonText function

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

* exportTabAsPdfButtonText -> getExportTabAsPdfButtonText

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

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

* Flag to hide download buttons (#44206)

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

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

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

* PLUGIN_DOWNLOADS_ENABLED -> PLUGIN_RESOURCE_DOWNLOADS

* adds comment to areDownloadsEnabled function to explain what it does

---------

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

* logic to handle downloads url parameter (#44363)

* minimal support for downloads url parameter

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

* fix prettier mistakes

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

* fix eslint issues

* update embedding snippets e2e

* update embedding questions e2e

* try to clean up the mess of downloads/downloadsEnabled

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

* adds TODOS for analytics

* unit tests for downloads flag (#45178)

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

* unit tests for downloads flag on dashboards and questions

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

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

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

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

* wip e2e tests

* make downloadUtils ts friendly

* assertNotEmpty function

* adds tests for public questions

* e2e tests for static embed downloads

* publicUid -> publicUuid

* fix assertNotEmpty

* fix parameter not renamed

* Apply suggestions from code review

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

* remove duplicated test

* fix another typo i forgot to rename

* fix another rename issue

* convert e2e-downloads-helpers to ts

* refactor: put method calculation in getEndpoint function

* adds note to downloadUtils

---------

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

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

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

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

* makes downloadsEnabled prop more consistent across components

* colocate downloadsEnabled with hideDownloadButton in embed-display-options

* defaults displayOptions.downloads to true to simplify logic

* remove unused queryString parameter in tests setup function

* reword TODO

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

This reverts commit aebf4cf3cf.

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

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

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

* remove comments

---------

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

* Add e2e repro for #37893

* Put the guard higher

* Fix unrelated test

* Go back to keeping the logic in `shouldRender`

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

* Optimize input in FilterModal

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

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

* Fix types

* Mock Range.prototype.getBoundingClientRect

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

* Have a test for archiving a question and a collection

* Refactor cy.createCollection and cy.archiveCollection to TS

* Refactor collection and user helpers to TS

* Keep collection helpers together

* Sort code

* Format code

* Use new createCollection helper

* Add return type to createCollection

* Fix typing

* Fix #32252

* Fix typing

* Deprecate openNewCollectionItemFlowFor

* Revert "Fix typing"

This reverts commit ecf3179868.

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

* try to update loki reference image

* change scalar to number

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

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

* update unit test

* update docs

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

* Refactor collection and user helpers to TS

* Keep collection helpers together

* Sort code

* Format code

* Add return type to createCollection

* Fix typing

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

* Fix #43219

* Create questions in parallel

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

* Fix assertion

* Be more specific which element is to be scrolled

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

* Remove redundant `tableMetadata`

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

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

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

* fixes failing unit tests

* pr feedback

---------

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

Closes: #44361

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

* This is the way

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

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

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

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

* updates

* remove release-list babashka script 😢

* Revert "remove release-list babashka script 😢"

This reverts commit 372a570f9af030abd6f297116e14568b3b51afa6.

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

* add reviewer to PR

* auto translate

* auto-translate works!

* update

* automate translation updates in CI

* fixes

* whitespace

* sort scripts

* just checkout the branch to begin with

* fix tests!

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

* Simplify fetchSegments selector

* Fix breadcrumbs

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

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

* remove extra install from frontend unit tests

* use the right dir

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

* Tighten up more

* Missed a spot

* More encapsulation

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

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

* fix reference

* fix export

* Move more reducers

* move parameterValues

* fixup! move parameterValues

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

* sdk parameter values

* use parameters to construct parameter input

* add a unit test for passing the correct parameters

* fix parameter parsing

* move TEST_PARAM to top of file

* update readme docs

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

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

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

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

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

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

* namespace should be a keyword

* decode the keyword

* add a typehint to avoid reflection

* Adds test for skip_graph

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

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

* Fix

* Fix

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

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

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

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

* respond to code review

* add + uses ExecutorCompletionService map function

* rename test

* more tests

* no concurrency for cljs

* fix timeout + add more tests

* use claypoole

* cleanup

* add kondo hooks for claypoole

* cleanup

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

Revert "add kondo hooks for claypoole"

This reverts commit 9d93b55b28.

* ignore unused value

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

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

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

* more flake fix

* fix slack message

* tired_face

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

* Fix deselecting the last join column

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

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

* Fix reference

---------

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

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

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

**Rebuilt query logic**

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

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

**Return a reducible result**

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

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

**Verifying**

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

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

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

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

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

* Invert events logic and update documentation

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

* store question result in sdk context

* remove dataset data type

* update question

* handle navigate to new card

* add loading states

* fix on query change

* update question change logic

* refactor question loading and query params

* fix ad-hoc question in dashboards

* extract useLoadQuestion into a separate hook

* cleanup run question on load

* revert changes in interactive question component

* store original question in the question result state

* turn the question into ad-hoc questions

* refactor run question methods

* add a separate isQueryRunning state for better ux

* isQueryRunning should default to false

* simulate re-running the query in unit tests

* add tests for rendering multiple valid questions

* refactor sync question method

* extract raw series and computed pivot logic

* add getCardAfterVisualizationClick

* separate single and multiple question tests

* fix import paths

* is question native

* pass queryResult instead of queryResults

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

* Add repro for #34574

* Use real `Tab` instead of a blur

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

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

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

* add summary and workflows

* adjust recent flake period

* code cleanup and add tests

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

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

---------

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

* Remove empty line

* Fix

---------

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

Fixes: #44962

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

* pass proper args

* put args back in proper order.

oops

* change form back to previous, but keep preview check

* autocorrect mistake? Or perhaps a silly typo?

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

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

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

* - Make revision-number consistent

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

* get id from the perms revision entity

* Move the revision id creation into the transaction

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

* write a test that checks the incomplete revision

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

* Sorting out types... I think?

* remove unneeded comment

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

* catching and throwing error

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

This allows you to use

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

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

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

* wip improving test util fns

* add subscription attachment util fn

* add tests to catch download/export differences

* viz-settings from card and dashcard  merged properly

* revert these changes which probably aren't needed

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

* normalize viz-settings no matter their origin

* Update test/metabase/api/downloads_exports_test.clj

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

* Incorporate some review feedback

* rendered table cards also respect column names

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

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

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

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

---------

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

* Adding modal and banner, user setting for dismissable banner

* copy changes

* adjust so modal only appears on data permission page

* e2e adjustments, adding banner test

* never show the modal or banner on new instances

* add test

* e2e adjustments, copy update

* more PR feedback

* move modal/banner settings & tests + clarify tests

* query for v50 migration execution works on mysql

- move changelog lookup into metabase.db.liquibase

* no race conditions in changelog-table-name

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

* revert changelog-table-name

- simply lookup the changlog row

---------

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

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

* Verify font is mentioned in HTML

* Bring back working assertions

* Add wait

* Disable speedy

* Disable CSP and emotion cache

* Revert "Disable CSP and emotion cache"

This reverts commit 573e99bfa4.

* Revert "Disable speedy"

This reverts commit 6f9962b869.

* Don't use local fonts

* Revert "Don't use local fonts"

This reverts commit 17c58aa73d.

* Force Lato

* Fix storybook file name

* ESLint

* Add more !important

* Revert !important

* Add font-family assertion

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

* restore legacy metrics

* its not legacy in v43

* Dont got echarts either

* newfangled echarts

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

* enable slack message

* don't always run cross-version tests

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

* provide a default implementation for refreshing auth tokens

* rename getRequestToken to fetchRequestToken

* add docs on customizing jwt authentication

* clarify docs, add error handling and failing tests

* update tests to pass

* re-export FetchRequestTokenFn type

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

* Refactor to redux state

* Fix logic with load with cards data

* Fix nasty e2e fails

* Fix nasty e2e fails

* Add global events

* Fix issue with loading event

* Fix issue with loading event

* Review fixes

* Add unit tests

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

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

* Add wildcard on interceptions

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

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

And now it will correctly log

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

Why no tests?
====

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

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

Testing metabase.db.liquibase-test

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

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

But this _passes_ in CI:

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

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

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

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

* changing text, adding unit tests

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

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

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

* Use focus method to do initial focus

* Use focus method for other _editor.focus calls

* Move focus to componentDidMount

* Cancel focus timeout  on unmount

* Add delay to broken test

* Switch to requestAnimationFrame

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

* fix mock column was not metric

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

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

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

- fix unused oldValue -> _oldValue

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

* fix test + disallow setting nested queries from code

* we cannot set enable-nested-queries

- set the env var instead

* add checks for the enable-nested-queries setting

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

* fix recents uri interception

* return enable_nested_queries setting to client

* adjust fetchmock url matcher

---------

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

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

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

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

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

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

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

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

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

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

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

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

* add preConditions to a few v51 migrations

---------

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

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

* Fix syntax error

* Test fixes 🔧

* Test fix??? 🔧

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

* Add repro for #44754

* Use theme spacing units

* Tweak the design slightly

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

* Add table prefetching

* Add test comparing call counts of select

* Update comment

* Add exception handling

* Add nil handling

* Handle possibye empty table-ids

* Update exception handling and test case

* Update src/metabase/models/card.clj

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

---------

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

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

Fixes #41464

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

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

* drop comment

* fix pattern order

* Use one version of typescript

* use :focus not :outline

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

* Use mb-color-focus for focus color

* Drop dead code

---------

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

Fixes #43793

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

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

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

* Split values at comma

WIP: Parse values using json

* Add label to ParameterValue and add ParameterValue to value config

* Use custom label in FieldValuesWidget

* Allow passing displayValue from outside of RemappedValue

* Allow passing displayValue in ParameterFieldWidgetValue

* Get custom value label in FormatterParameterValue

* Allow rendering custom displayValue in FieldValuesWidget

* Add custom ParameterValue types

* Fix ParameterValuePicker type

* Fix jest import for csv-stringify

* Add missing RTKQ exports for paramters

* Use direct implementation of useGetParameterValues

* Fix ValueSourceModal tests

* Add tests for value parsing and stringifying

* Use custom label in list too

* Render the custom label in a parameter value

* Setup parameter mocks in embed test

* Add info about splitting values with comma

* Add model hint when user is using labels

* Add test for cusom labels on dashboards

* Handle label-value pairs in test

* Test custom labels in parameter search input

* Use the label to parse the value for text inputs

* Fix comma's to commas

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

* Use strong instead of styling link

* Use getInput instead of ignoring eslint rule

* Use arrow function

* Add newlines between tests

* Use uppercase for test value

* Name value

* Use getLabel and getValue helpers to avoid indexing confusion

* Pull out confusing condition

* Move out getLabel helper

* Be more explicit about non-existent config values

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

* Move setupParameterValuesEndpoints to setup

* Add loading state

* Do not use alert to implement info box

* Fix formatting

* Remove undefined from getValue signature

* Use getLearnUrl

* Remove dependency on column

* Make custom field labels work in the absence of fields

* Support custom values for non-field parameters

* Add test for native question parameters

* Add newline in test

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

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

* Add test for loading state of FormattedParameterValue

* Do not fetch custom label for FormattedParameterValue

* Add table with ip addresses

* Add test for IPAddress filter with custom labels

* Add test for custom labels on type/Quantity fields

* Remove getInput helper in test

* Remove unused hasCustomLabel value

* Split up into common and premium tests

* Make fieldValues a map for performance

---------

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

Fixes #42829

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

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

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

* Move skip to top-level again

* Remove superflouous click

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

* Make the test description more descriptive

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

* Move question details to a variable

---------

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

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

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

Fixes: #43001

Might be related: #44858

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

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

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

* alter test to check for uniqueness across dashboard

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

* adjust migration to pass linter rules

* remove the extra rollback on migration

* Update src/metabase/models/user_parameter_value.clj

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

* Update src/metabase/models/user_parameter_value.clj

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

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

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

---------

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

* Test fix

* Make `format-honeysql` a multimethod

* Add test for #32543

* Test also fixes #44915

* Add explicit test for #44915

* Better test for #44915

* More test fixes 🔧

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

* Improve comment

* Improve comment

* Format code

* Update existing tests

* Extract helpers

* Update unit tests

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

* fix css

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

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

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

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

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

**Dashboard loads**

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

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

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

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

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

* Add repro for #39771

* Add explanatory comment

* Fix z-index

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

* Revert "Fix z-index"

This reverts commit 951e3dca86.

* Revert "Fix #39771"

This reverts commit 4165da5022.

* Update repro to new tooltip

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

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

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

* Convert the comment to JSDoc

* Add E2E reproduction

* Fix mapping

* Add test scenarios for the public sharing and embedding

* Simplify API payload

* Extract and significantly expand the reproduction scope


---------

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

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

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

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

* tests and optimizations

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

* fix typo

* add e2e test

* fix BE test

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

* last fixes

---------

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

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

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

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

* Hack an e2e test around an existing bug

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

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

* Appease Kondo

* Test fixes 🔧

* Overhauled Card metadata calculation code

* Test fixes 🔧

* Kondo fix 🔧

* Ok maybe I fixed stuff

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

* Maybe fixx the Cypress tests

* Experimental possible e2e test fix 🔧

* Test fixes 🔧

* Do things a little differently.

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

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

* Add repro for #42385

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

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

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

* add github action

* remove test code

* fix whitespace

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

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

* fix copy

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

* fix funnel bar row display setting

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

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

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

* Use saveQuestion instead of clicking trough the UI

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

* Use openOrdersTable instead of manually clicking through the ui

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

* Create question programmatically in test

---------

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

* Add a repro for #28106

* Format code

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

* Improve assertions

* Add comments

* Use saveQuestion helper

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

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

Fixes: #38753

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

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

This leaves Lato in place for other characters.

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

* stub installed fonts test

* typo

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

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

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

* add test checking that glyphs render correctly

* Add a test that directly checks the wrapping fn

* Change the string to keep the linter quiet

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

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

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

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

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

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

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

* Cope with driver specific failure modes

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

* Fixup some dependencies

* Fix textarea styles

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

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

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

---------

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

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

* Comment out failing assertions

* Skip repro

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

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

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

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

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

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

```

Simple repro:

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

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

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

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

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

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

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

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

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

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

* impls pr feedback

* impls more pr feedback

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

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

* make defsetting docstring formatting consistent

* log-direction is a string

* add test for enabling / disabling saml slo

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

* add jar instructions

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

* Update test to handle all drivers

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

* add missing useSyncURLSlug

* remove cardTitled prop that's not needed

* remove DashboardControls

* remove @ts-expect-error for dashboardId

* move props destructuring at the top

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

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

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

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

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

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

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

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

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

---------

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

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

* Accept non-aggregation cols in graph metrics sync

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

* Fix `xDomain` calculation in QB selectors

* Make database `features` optional

* Update reproductions-3.cy.spec.js

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

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-27 08:26:05 +01:00
Denis Berezin
7091c9eb47 feat(sdk): Improve dashboard to question navigation (#44648)
* Add dashboard question header

* Add dashboard data preserve after question drill

* Review fixes

* Review fixes

* Potential fix for e2e

* Potential fix for e2e

* Add basic unit tests

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

* Move dashboard reset to SDK component

* Fix issue with dashboard rerender

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

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

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

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

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

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

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

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

---------

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

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

* add tests

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

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

* Add an e2e test for fields

* Format code

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

---------

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

* fix RowChart firing invalid API request on legend item click

* fix clicking on non-breakout legend on dashboards

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

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

* Extract `DASHBOARD_DESCRIPTION_MAX_LENGTH` const

* Handle description max length in dashboard sidebar

* Add red border to dashboard description box

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

* css var for color

---------

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

* fix scroll on dashboard

* add e2e test

* fix unit tests

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

* add usePublicDashboardEndpoints instead of WithPublicDashboardEndpoints

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

* use usePublicDashboardEndpoints inside WithPublicDashboardEndpoints

* also migrate embed

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

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

* wrap setEmbedDashboardEndpoints/setPublicDashboardEndpoints in useEffect as per PR comment

* after the fix for metabase#38640 we don't need the public routes in the main app

* renamed test file

* change tests to use PublicOrEmbeddedDashboardPage

* remove PublicOrEmbeddedDashboardControlled and change imports for PublicOrEmbeddedDashboardPage

* remove debug prop left by mistake
2024-06-25 17:02:20 +02:00
Noah Moss
e7e4fd6f87 Fix parsing of MB_JETTY_SKIP_SNI (#44651) 2024-06-25 10:00:23 -04:00
Alexander Polyankin
e5e0c2ccd0 Fix expressions with the same name as their base column (#44641)
* Pass expressionPosition

* Add a test

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

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

* Rename expressionPosition to expressionIndex

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-25 13:25:42 +00:00
Alexander Polyankin
113d95366d Add e2e repro (#44656) 2024-06-25 09:12:22 -04:00
Ngoc Khuat
191d845941 Fix flaky test: update-db-to-never-scan-values-on-demand-test (#44658) 2024-06-25 19:26:30 +07:00
Oisin Coveney
d8a54827ee Split content from FilterModal into FilterContent (#44534) 2024-06-25 15:26:20 +03:00
Romeo Van Snick
3e54ff961e Add reproduction for "Result inconsistencies with Preview in GUI editor #40399" (#44630)
* Add e2e test to verify that step previews only care about the step being previewed

* Use getNotebookStep and find preview button using cy.icon

* Remove empty line

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

---------

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-06-25 14:21:04 +02:00
Nemanja Glumac
7b706ff9e6 Repro #33330: Cumulative count breaks in certain situations (#44671) 2024-06-25 13:47:36 +02:00
Uladzimir Havenchyk
689f8d7e58 refactor: drop old and unused endpoint (#44629)
* Drop old and not used  endpoint

* fixup! Drop old and not used  endpoint

* fixup! fixup! Drop old and not used  endpoint
2024-06-25 13:41:28 +03:00
Mahatthana (Kelvin) Nomsawadi
1fa5a933c6 refactor(sdk): Make sense of dashboard and embed code (#44636)
* Make the code makes more sense

* Fix type error
2024-06-25 10:25:43 +01:00
Nemanja Glumac
f43a15076d Refactor: Time-series chrome component (#44568)
* Move SimpleSpecificDatePicker to the form

* Extract `isSpecificValue` helper

* Integrate the toggle into `SimpleDateIntervalPicker`

* Make DateOperatorPicker do only one thing

Separation of concerns - lift SimpleRelativeDatePicker up to the form.

* Fix unit tests

* Add back the test for the `SimpleSpecificDatePicker`

* Keep the rendering logic in the `SimpleDatePicker`
2024-06-25 11:17:18 +02:00
Ryan Laurie
3fcc0f6e14 Tag core-release group in pre-release messages (#44663) 2024-06-25 02:11:04 -06:00
Phoomparin Mano
70eea1167b fix(sdk): missing css variables when rendering under a portal (#44473)
* apply css variables injection right under the public component

* refactor css variables

* fix name changes

* apply css variables to global styles

* update path

* render component wrapper as full-width

* move style resets to public component styles wrapper

* update unit tests for global styles
2024-06-25 12:51:52 +07:00
Cal Herries
a57718bd52 Fix querying TIMESTAMP WITH LOCAL TIME ZONE for oracle (#44456) 2024-06-24 20:16:22 -06:00
adam-james
a27c151078 Sanitize SVG before parsing with Batik to prevent render failures when invalid characters are in the SVG content (#44516)
* Add Temporal Units List to Dashboard Parameters Schema

Closes: #44361

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

* Sanitize the SVG before parsing it with Batik

WIP

Fixes: #43677

There are characters that are invalid according to the Batik XML Parser. This sanitizes the svg string to strip out
some of those characters so that the render can continue.

* Use the xml 1.0 spec allowed unicode chars list for the regex

* Remove accidentally merged code

* still miseed a line
2024-06-24 21:52:09 +00:00
Case Nelson
6317927039 fix: dont always optimize between expressions (#44493)
* fix: dont always optimize between expressions

Fixes #42291

The frontend produces expressions like

```
[:between
 [+ [:field ... {:temporal-bucket :day] [:interval 2 :day]]
 [:relative-datetime -1 :week]
 [:relative-datetime 0 :week]]
```

This should not be optimized because of the mixed `:day` and `:week`
units. However, it was being optimized since the compatible units
weren't being properly picked up by the match.

* Disable suspcicios args eastwood lint, kondo does it better

* Stop autobucket to day when adding a time interval
2024-06-24 14:18:53 -06:00
Case Nelson
8198461c9b perf: disable view log and card used updates during metadata fetches (#44502)
* perf: disable view log and card used updates during metadata fetches

* Disable writes for view_count and last_used_at

* Disable view_count tests

* Disable last-used-at tests

* Disable view_count test

* Fix view count test

* Disable view_count e2e testing
2024-06-24 10:21:34 -06:00
Alexander Polyankin
9b305a03e6 Add a try-catch for MBQL lib diagnoseExpression (#44628) 2024-06-24 16:07:58 +00:00
Alexander Polyankin
1d5d9cb430 Fix the operator list for type/TextLike PKs (#44569)
* Fix the operator list for `type/TextLike` PKs

* Fix the bug with using wrong operators

* Fix the bug with using wrong operators

* Update test/metabase/lib/filter_test.cljc

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>

* Test FKs too

* Update test/metabase/lib/filter_test.cljc

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>

---------

Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
2024-06-24 16:00:09 +00:00
Nemanja Glumac
172c7cc3af Repro #44550: Missing display name for the filter with an offset (#44624) 2024-06-24 16:53:56 +02:00
Jeff Bruemmer
d3aa47a58d fix link (#44622) 2024-06-24 10:23:04 -04:00
Nemanja Glumac
dc4a553056 Visually improve time-series chrome component (#44554)
* Get rid of the styled component

* Stack date operator on top of actual filter pickers

* Use the existing `CurrentDatePicker`

* Fix unit test

* Conditionally apply padding to the `CurrentDatePicker`

* Remove the custom prop
2024-06-24 14:18:21 +00:00
Denis Berezin
e74f0bbf41 Migrate ViewTitleHeader and its children to TS (#44513)
* part 1

* part 1

* part 2

* part 3

* part 4

* Self review

* Self review

* Fix merge conflicts

* Fix e2e

* review fixes

* review fixes
2024-06-24 17:12:36 +03:00
Uladzimir Havenchyk
f21ad7da0a test: add a test for the edge case in mapping on parameter change (#44610)
* test: add a test for the edge case in mapping on parameter change

* fixup! test: add a test for the edge case in mapping on parameter change
2024-06-24 16:41:59 +03:00
Mahatthana (Kelvin) Nomsawadi
1c2b5cc346 refactor: Create static embed view components (#44555)
* Remove `this` reference from the markup

* Move functions inline

* Introduce a view component making it purer

* Introduce question embed view component

* Address review: Don't lie about types

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

* Address review: Make code consistent

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-06-24 14:30:13 +01:00
Ngoc Khuat
f135ea4f07 Tidy pulse code, remove unused methods (#44603) 2024-06-24 20:27:45 +07:00
Alexander Polyankin
4bda202926 Fix new column shortcuts overwriting viz settings (#44582) 2024-06-24 09:08:32 -04:00
Alexander Polyankin
1f74c4312a Fix setting the join strategy for not yet existing join clauses (#44557) 2024-06-24 09:07:13 -04:00
Alexander Polyankin
8954c23632 Fix setting the temporal bucket of columns in a join condition to "Don't bin" (#44564) 2024-06-24 09:06:33 -04:00
Nemanja Glumac
bf5df6cd2b Increase the Codecov frontend target (#44613)
* Fix the comment

* Update the threshold for the front-end
2024-06-24 14:44:55 +02:00
Alexander Polyankin
b34b9607c4 Fix model metadata editing for SQL models with manually sorted columns (#44574) 2024-06-24 08:37:29 -04:00
Uladzimir Havenchyk
b228f16bb6 refactor: split DashCardCardParameterMapper into smaller components to reduce complexity (#44526)
* Exrtract 'useResetParameterMapping'

* Extract 'DashCardCardParameterMapperButton'

* Extract 'DashCardCardParameterMapperContent'

* cleanup

* Drop if/else

* cleanup
2024-06-24 13:16:42 +03:00
lbrdnk
260f8b0392 Add role to spec even if used in :connection-uri (#44397)
This PR removes `:role` removal from spec, even if it was added in `:connection-uri`.
It seems that `:connection-uri` is ignored on `do-with-connection-options` code path.
Hence use of non-default roles is again available on Snowflake.
2024-06-24 12:12:37 +02:00
lbrdnk
ba42baaf0f Adjust distinct aggregation expansion on Mongo (#44442)
This commit adds `$size` operator wrapping to `$addToSet`. That enables use of `:distinct`
clause in expressions on Mongo.
2024-06-24 12:10:11 +02:00
Ryan Laurie
452382bcca Fix infinite backport PR recursion in milestone setter (#44593)
* fix infinite backport PR recursion

* dedupe issue numbers
2024-06-24 01:57:22 -06:00
Alexander Solovyov
ea69066d83 add a test to check that openapi definitions can be generated (#44586) 2024-06-24 10:40:33 +03:00
Alexander Solovyov
839f1f775c xray should not filter again models with filters (#44547)
This not only does not make sense, but also fails for models with aggregations (and thus not having those fields for filtering available).
2024-06-24 10:13:15 +03:00
Ryan Laurie
2f6e5d7fcd Update Milestone Setter (#44521) 2024-06-23 23:28:46 -06:00
Alexander Solovyov
bdf67dbe3f [openapi] do not die when :query-params is not a map (#44549) 2024-06-22 11:32:26 +02:00
Uladzimir Havenchyk
981d69ab2a refactor: Rework undo to typescript (#44479)
* refactor: Rework undo to typescript

* fixup! refactor: Rework undo to typescript

* fixup! fixup! refactor: Rework undo to typescript

* Convert UndoListing to ts

* fixup! Convert UndoListing to ts

* Update frontend/src/metabase/redux/undo.ts

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

* address review

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-06-22 07:22:46 +00:00
Jeff Bruemmer
674ac9787c notes on upload perms (#44575) 2024-06-21 17:02:40 -04:00
Denis Berezin
dbcd84484c Add global styles to storybook, fix default fonts display (#44559)
* Add global styles to storybook, fix default fonts display

* Update loki testing screenshots
2024-06-21 22:45:52 +03:00
adam-james
998b28cddb Disable Pivot Export Post Processing Step (#44561)
This PR disables the 'make exports look pivoted' post processing step for csv and xlsx exports.

This is in response to a reported issue that Large Pivot Table downloads are failing entirely: #44556

A more hollistic fix and improvement to the post processing feature will be worked on, so the post processing code is
left untouched in this PR.

The dynamic vars in the csv and xlsx namespaces each default `false` and disable the export from running any post
processing. The var should remain `false` until we've got a plan for these types of exports, and there is no way for
users (either through ENV or UI) to change this, so the feature is effectively disabled.
2024-06-21 18:28:27 +00:00
Jeff Bruemmer
7a83278718 docs - actions and public dashboards (#44551) 2024-06-21 18:16:34 +00:00
Cam Saul
89f12e7c01 Set useLocalSessionState=true for MySQL DW connections [PERFORMANCE BOOST] (#44509)
* Set `useLocalSessionState=true` for MySQL DW connections

* Fix GH issue number

* Test fixes 🔧

* Lint fix 🔧
2024-06-21 10:04:22 -07:00
github-automation-metabase
e2670a1567 Update Readme version references and published npm version to 0.1.13 (#44553) 2024-06-21 16:13:22 +00:00
Nicolò Pretto
ecce383824 convert embed.ts to ts and to use createSlice from rtk (#44496)
* convert embed.ts to use createSlice from rtk

* only store in the state what we care about for interactive embedding

* use DEFAULT_EMBED_OPTIONS keys to filter searchOptions

* removed unused hash parameter

* adds basic unit test
2024-06-21 16:04:21 +00:00
John Swanson
0637fefa67 Fix dev migrate! command (#44545)
There were two problems here:

- wrong args to `mdb/migrate!` (passing the db-type as well as the data
source), and

- in MySQL, the changelog table name is not `:databasechangelog`. Use
`metabase.db.liquibase/changelog-table-name` to get the actual table name.
2024-06-21 14:41:23 +00:00
Mahatthana (Kelvin) Nomsawadi
74b2c11ea5 refactor: Extract refactor code out of feature branch to avoid conflicts (#44540)
* refactor: Simplify code (#44275)

* Remove dead code

* Remove values same as default options

* Simplify hook API: Removing unused argument

* review: Remove redundant code

* Refactor
2024-06-21 15:22:28 +01:00
Anton Kulyk
ce48b30e16 Revert graph settings sync change (#44535)
* Skip repro for 10493

* Add repro for 44532

* Remove `ensureMetricsAndDimensions`
2024-06-21 14:34:05 +01:00
Kamil Mielnik
fa192d940b Fix - Missing schema name in data picker (#44468)
* Show table's schema name when available

* Add a test

* Add a test for empty table schema
2024-06-21 20:19:57 +07:00
Phoomparin Mano
dbaddac9cb add demo video to the sdk readme (#44531) 2024-06-21 20:18:14 +07:00
Oisin Coveney
0b9bfbd21d Split FilterModal components into separate files and folders (#44530) 2024-06-21 12:38:01 +00:00
Oisin Coveney
bd6391cef0 Make notebook props explicit (#44529)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-06-21 12:11:35 +00:00
Oisin Coveney
27fc6ae43e Convert ViewTitleHeaderRightSide and associated components to TS (#44368) 2024-06-21 14:53:30 +03:00
Nicolò Pretto
2c04840477 convert browser.js to typescript (#44524)
* file renamed to .ts

* fixed ts errors in browser.ts
2024-06-21 12:17:45 +02:00
Kamil Mielnik
3565d5e2b8 Update browserslist-db (#44522)
- Run "npx update-browserslist-db@latest"
2024-06-21 08:38:59 +00:00
Ryan Laurie
db3b8979c5 ci: Move cloverage to run nightly (#44365)
* move cloverage to a nightly run

* what a mess
2024-06-21 00:54:21 -06:00
Chris Truter
0e8787805f Track metabase.nqa module dependencies (#44464) 2024-06-21 05:58:51 +02:00
Noah Moss
c966918bda Don't run sandboxing rollback test on mysql (#44515)
* Don't run sandboxing rollback test on mysql

* Update test/metabase/db/schema_migrations_test.clj
2024-06-21 02:03:17 +00:00
Cam Saul
1dceed32b8 Make the App DB transaction isolation level READ_COMMITTED for MySQL [MEGA PERFORMANCE BOOST] (#44505)
* Make the App DB transaction isolation level READ_COMMITTED for MySQL/MariaDB [MEGA PERFORMANCE BOOST]

* Add test
2024-06-21 01:44:34 +00:00
Mateusz Burzyński
514564290f Update @replayio/cypress (#44396) 2024-06-20 23:18:29 +02:00
John Swanson
cb055ac9de Don't sort official collections first in trash (#44322)
Add a new query parameter to `/api/collection/:id/items` and
`/api/collection/root/items`. If `official_collections_first` is passed,
we'll sort official collections first, or not, as requested. If it isn't
passed, we'll default to `false` for the trash collection, or `true` for
normal collections.
2024-06-20 21:17:38 +00:00
Nick Fitzpatrick
7f9e369c34 Fix crash on restoring bookmarked items, update bookmarks on restore (#44414)
* Fix crash on restoring bookmarked items, update bookmarks on restore

* adding bookmark assertions to e2e tests

* removing unintended createDashboard change
2024-06-20 17:55:03 -03:00
Cam Saul
08c841f3ef Oops fix the order we attempt to set DW transaction isolation in (#44501) 2024-06-20 20:41:10 +00:00
Jeff Bruemmer
d0096dc0fa clarify database vs driver (#44503) 2024-06-20 16:16:21 -04:00
Noah Moss
dce9879067 Fix rollback when sandboxing is configured (#44481) 2024-06-20 14:24:26 -04:00
Nemanja Glumac
442cedd5b9 Fix flaky E2E segments test (#44487) 2024-06-20 12:04:51 -06:00
Nicolò Pretto
105a72a008 remove code from useDashboardUrlParams and related files (#44426)
* simplify bordered logic

* 🧹 setTitled

* 🧹 setHideDownloadButton

* 🧹 setHideParameters

* inline useEmbedDisplayOptions

* move DEFAULT_EMBED_DISPLAY_OPTIONS to costants file so we can remove use-embed-display-options.ts

* move consts up in the file

* update deps of useEffect

* fix ts error in the sdk

* use useEmbedFrameOptions in useDashboardUrlParams

* embed frame should not touch the `embed` slice, which is used for interactive embedding
2024-06-20 17:05:35 +02:00
Mahatthana (Kelvin) Nomsawadi
05417a3a6c Add a link to embedding SDK changelog (#44480) 2024-06-20 15:35:48 +01:00
Alexander Polyankin
b3749f8fe5 E2E tests for click behaviors with temporal unit parameters (#44436) 2024-06-20 10:29:28 -04:00
Raphael Krut-Landau
79c8e9bd82 fix(admin): Add e2e tests of the database caching policy form's basic functionality (in Admin / Performance) (#44416)
Closes #44478
2024-06-20 10:14:44 -04:00
Ngoc Khuat
4a03070a9b Fix unable to sync json column with value is an array (#44465) 2024-06-20 14:05:00 +00:00
Raphael Krut-Landau
7e7414e86e fix(cache): Add missing question mark in the 'Clear cache' confirmation modal (#44453) 2024-06-20 07:47:20 -05:00
Phoomparin Mano
dab2d85277 fix(sdk): font size, color and padding in viz (#44283)
* funnel start color should be text-dark

* change pivot table font size unit to em for scaling

* change funnel and legend item unit to em

* change funnel font size to em

* change object detail font size to em

* change gauge font size to em

* add cartesian chart padding config

* update docs

* remove isEmbeddingSdk prop

* simulate the 0.875em base font size

* chart padding override should apply in query builder

* add cartesian padding to stories

* update readme docs

* fix collection browser option in readme docs

* fix pivot table font size scaling

* update loki

* update loki

* use em for smart scalar

* update chart default padding

* revert smart scalar font size scaling due to measurement

* dynamic font family and font size as defaults

* pivot table

* add more properties to sdk docs

* make FONT_SIZES constant local

* link to discussion on query builder extra spacing

* enforce that font is passed to getLeftHeaderWidths
2024-06-20 19:14:09 +07:00
Phoomparin Mano
992b2e899f fix(sdk): load custom font files when font is set to custom (#44432)
* load custom font family

* always return custom font family

* add tests for returning custom font family
2024-06-20 18:26:43 +07:00
github-automation-metabase
488e08a7dd Update Readme version references and published npm version to 0.1.12 (#44466) 2024-06-20 09:56:14 +00:00
Uladzimir Havenchyk
5638d79768 Adjust undo toast timeout 12s -> 8s (#44422)
* Adjust undo toast timeout 12s -> 8s

* typo

* Address review
2024-06-20 11:48:46 +03:00
Alberto Perdomo
0081f202bc Update SDK README.md (#44427)
Remove warnings about not using MB versions in production. This is a left over from the time we were pointing to builds off master and RCs.
2024-06-20 07:33:48 +00:00
Raphael Krut-Landau
e5c14e16ae fix: Use an indicator-agnostic testid (#44265)
* Use an indicator-agnostic testid

* Run sed

* Use correct testid
2024-06-19 20:32:15 -04:00
Case Nelson
523ea2488b fix: populate param-fields for named fields on public dashboards (#44440)
* Update e2e test

* Update e2e test

* fix: populate param-fields for named fields on public dashboards

* Add name to public hydration

* Add tests

* Add tests

* Fix tests

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-06-19 17:26:25 -06:00
Raphael Krut-Landau
08613cb3b6 fix(cache): Fix two bugs in Admin / Performance (#44255)
Ensures that minimum query durations are correctly displayed in the form post-save (#44249) and that all times can be used in the Schedule component  (#44257)
2024-06-19 18:53:03 -04:00
Raphael Krut-Landau
c006657dce feat: Use skeletons to indicate that the main navigation sidebar is loading (#44010) 2024-06-19 18:38:05 -04:00
Cal Herries
3f788bbaf2 Exclude native query matches in search scoring when the search should exclude native queries (#43982)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-06-19 22:06:02 +00:00
adam-james
bbde99dd31 User parameter value json fix (#44420)
* UserParameterValue transforms wrapped to properly escape string vals

The `json-in` and `json-out` functions used for toucan model transforms do not perform any string escaping logic. This
makes sense as we don't want to make assumptions about the shape of data flowing in/out of the db. But, this did mean
that for the User paramter values table, string values were causing an error to be logged. This doesn't break
anything, as the function will still correctly return the string, but it can clutter up logs.

So, this PR wraps all incoming values in a map and unwraps it for outgoing values.

* Add migration to wrap existing user param values with ::wrapper key

Since the in/out transform for UserParameterValues is updated, we need to migrate any existing values to have this wrapping.

* Simplify the solution to the problem.

Since we're already getting what we need from the json-in/json-out *except* that it's logging a parse error, we can
create a json-out that works the same way (tries to parse and returns the string as-is if it fails) without logging an
error at all.

* take away the arg and keywordize inside the json-out fn

* remove irrelevant comment

Signed-off-by: Adam James <adam.vermeer2@gmail.com>

* Add a little more test coverage for different value types

* faster test thanks to Dan!

* Add a comment about the data being tested

---------

Signed-off-by: Adam James <adam.vermeer2@gmail.com>
2024-06-19 21:50:47 +00:00
Alexander Polyankin
80c34c673d Disable parameter mapping to native models (#44372) 2024-06-19 21:21:57 +00:00
adam-james
89bdaa2fa8 XLSX Pivot Table Downloads have 'Native' Pivot Table (#43791)
* XLSX Pivot Table Downloads have 'Native' Pivot Table

Addresses: #2473

The xlsx downloads work fine for regular tables. However, on Pivot Table downloads, the resulting file isn't pivoted
and is formatted somewhat strangely (it contains additional rows related to totals, has an extra 'pivot-grouping'
column).

Now, the downloaded xlsx file contains 2 sheets:
- the data sheet containing the question's rows unpivoted. If you were constructing a pivot table yourself, you would
probably start with this shape of data.
- the pivot sheet containing a 'native' Pivot table whose reference points to the data on the data sheet, and whose
columns, rows, and values align with the cols, rows, and measures set up in Metabase

* Silly typo!

* Exported Pivot uses correct aggregation (sum, count, stddev, avg, min, max)

* data for pivot exports now also uses the formatting

* Add a test asserting that a pivot table exists in the xlsx file

* add-row! is a method dispatching on sheet class

* remove unnecessary hint

* address review feedback:

 - consolidate the aggregation function key fns into one function in the .xlsx namespace
   this was moved out of postprocessing so that the xlsx specific fns don't litter the post processing namespace at
   this time

 - clean up an unnecessary destructiring inside the native-pivot function
 - don't shadow 'name' inside the body of a fn

* Add tests that confirm zero-col and zero-row situations work

* Consolidate the atoms used to store pivot rows/options
2024-06-19 21:14:05 +00:00
Alex Yarosh
301ab32cef docs: Serialization API uses POST (#44439)
* call attention to POST

* wording
2024-06-19 16:24:01 -04:00
Nemanja Glumac
737c24af95 MS2: Expose "Include this {period}" in time-series chrome (#44247)
* Expose "Include this {period}" in timeseries chrome

* Fix type errors

* Simplify type guards

* Add unit tests

* Remove Flex wrapper around Switch

* Extract `IncludeCurrentSwitch` component

* Add E2E smoke tests

* Cover the toggle behavior with E2E tests

* Simplify test with a simple helper
2024-06-19 20:14:47 +00:00
Chris Truter
870dcd6c4a Don't analyse non-SQL cards with Macaw (#44350) 2024-06-19 12:48:15 -06:00
Denis Berezin
fa32093271 feat(sdk): Add interactive dashboards to embedding SDK (#44161)
* Temp

* Add support for saved questions

* Try to fix question not found issue

* Try to fix question not found issue

* Fix unit tests

* Add basic unit test

* Fix unit tests

* Fix unit tests, fix question not found issue

* Review fixes

* Review fixes

* Refactor components structure, review fixes

* Adjust readme
2024-06-19 18:05:19 +00:00
Anton Kulyk
4f53b0b9a9 Fix updating table questions in the notebook editor before running a query (#44428)
* Add repro test

* Fix null check
2024-06-19 18:33:02 +01:00
Braden Shepherdson
3ccf4d411c [QP] Fix breakouts on a nested model (#44418)
Fixes #43993 for real.

The earlier fix #44182 was needlessly restricting the
"nominal refs" check to fields which were using numeric IDs,
when really any match on nominal refs is valid.
2024-06-19 17:24:00 +00:00
Braden Shepherdson
891260cb57 [MBQL lib] Put :fields :all on joins on deleting last aggregation/breakout (#44321)
Part of #44298.
2024-06-19 17:09:42 +00:00
Mahatthana (Kelvin) Nomsawadi
863bc82af1 Clarify SDK release workflow (#44385) 2024-06-19 17:51:05 +01:00
github-automation-metabase
6f5c43d358 Update Readme version references and published npm version to 0.1.11 (#44421) 2024-06-19 16:50:54 +00:00
Mahatthana (Kelvin) Nomsawadi
0a550944f6 docs(sdk): Update readme pointing to the most recent v50 version (#44411)
* Update readme pointing to newer 50 release

* Update enterprise/frontend/src/embedding-sdk/README.md

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

---------

Co-authored-by: Phoomparin Mano <poom@metabase.com>
2024-06-19 17:22:50 +01:00
Ryan Laurie
9e4cbda477 ci: Automatically add milestones to prs and issues (#44357)
* automatically add milestones to prs and issues

* test code

* test code

* test commit (#3138)

* test commit (#43320)

* test commit (#44357)

* remove test code

* add newlines

* prefer older version milestones
2024-06-19 09:54:36 -06:00
Alex Yarosh
f0db81fccd docs: change paid to pro/enterprise (#44383)
* docs: change paid to pro/enterprise

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-06-19 15:28:12 +00:00
Jeff Bruemmer
5efb56c065 docs - add 50.6 to list of releases (#44399)
* add 50.6 to list of releases

* 49.17
2024-06-19 10:33:51 -04:00
Ryan Laurie
c643f094f1 Send five flakiest tests to flake job (#44402) 2024-06-19 14:24:16 +00:00
dependabot[bot]
c17bb33f0e Bump ws from 7.5.9 to 7.5.10 (#44345)
Bumps [ws](https://github.com/websockets/ws) from 7.5.9 to 7.5.10.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.5.9...7.5.10)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-19 17:16:28 +03:00
Uladzimir Havenchyk
400a1a2a10 fix: Do not pass template variables to findColumnIndexesFromLegacyRefs (#44377)
* fix: Do not pass template variables to findColumnIndexesFromLegacyRefs

* Add repro
2024-06-19 16:57:46 +03:00
Alexander Solovyov
f284a522e3 [openapi] fix query parameter detection and add default/description handling (#44239)
Also OpenAPI generation now handles parameter renaming, like in `{c :count}` destructuring.
2024-06-19 16:24:35 +03:00
Uladzimir Havenchyk
b41a5e840f Make dashboard filter auto-wire less presumptuous - add toast animation and hint messages (#44378) 2024-06-19 16:11:19 +03:00
github-automation-metabase
0e9076c0ff Update Readme version references and published npm version to 0.1.10 (#44398) 2024-06-19 13:07:43 +00:00
Kamil Mielnik
6daecbc66b Upgrade RTK to v2 (#44339)
* Upgrade @reduxjs/toolkit from ^1.9.3 to ^2.2.5

* Fix typing

* Upgrade redux-actions and @types/redux-actions

* Fix type errors

* Fix type errors

* Upgrade react-redux from ^8.0.5 to ^9.1.2
- remove @types/react-redux as it's no-longer-needed

* Upgrade redux-promise from ^0.5.0 to ^0.6.0
- upgrade @types/redux-promise

* Remove unused @types/redux-logger

* Revert "Upgrade redux-actions and @types/redux-actions"

This reverts commit 65005a0053.

* Remove createWeakSelector as weakMapMemoize is the default memoization strategy now

* Do not call unsubscribe if it does not exist

* Do not subscribe

* Remove console.log

* Make DelayedLoadingSpinner always render something with data-testid="spinner" so that tests can be aware of when things are loading

* Fix JoinStep unit tests

* Fix AddToDashSelectDashModal unit tests

* Fix SegmentApp unit tests

* Bring back original subscription logic

* Fix DataUsageStep unit tests

* Fix ManageApiKeys unit tests

* Simplify comment

* Fix MainNavbar unit tests

* Fix HomeRecentSection unit tests

* Use afterEach instead of afterAll to reset mocks

* Remove explanatory variable
2024-06-19 18:04:34 +07:00
Ngoc Khuat
613318f786 Metabase channel (#43924) 2024-06-19 09:25:42 +00:00
Ryan Laurie
35f97092e0 ci:Pass enterprise version to ee-extra build (#44386) 2024-06-19 02:38:34 -06:00
Nemanja Glumac
ce95331f30 Rename date/time empty filter options in the simple mode (#44102)
* Rename "empty" date/time filter options

* Add repro for #44101
2024-06-19 10:35:21 +02:00
Oisin Coveney
7de0faa635 Split View Header components into separate files (#44347) 2024-06-19 11:16:03 +03:00
adam-james
37abc08449 Pivot Tables with no Pivot Columns should still download (#44329)
* Pivot Tables with no Pivot Columns should still download

Fixes #44159

Pivot Tables can still be valid without columns, and therefore the download should respect such a query and be
successfully exported.

In this PR, the postprocessing of pivot results into 'visual pivot' exports for csv takes into account the zero-column
configuration and the download no longer fails.

* add a test to confirm that zero cols and >1 measures works as well

* Handle the case where there are zero pivot-rows.

This is a similar problem to the zero pivot-cols case, just with rows.

The app actually doesn't render these tables correctly, but that's a separate frontend bug
2024-06-18 13:20:00 -07:00
Benoit Vinay
6622470420 Add upload button for attached data warehouse (#43511)
* DWH plans added

* UploadCSV button component created

* Comments added

* Main nav bar updates

* Misc

* Align main nav bar button with link

* Misc comment

* Upload package created

* Various upload cleanup

* Misc

* Display button rule cleaned up

* Tracking added to upload CSV button

* Misc comment

* e2e tests WIP

* More comments

* e2e tests basic created

* NEw tracking schema

* e2e tests updated / Tracking WIP

* Analytics cleanup for button

* Misc

* Misc e2e tests Snowplow

* Removed forced Upload CSV button in FE

* Upload helpers created

* Misc unit tests updates

* Updated analytics

* Fix for e2e tests

* Upload fixture paths updated

* Misc for Snowplow

* Misc for plan

* More tests cleanup

* Misc

* Source added to analytics

* Plan unit tests fixed

* Update frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarView.tsx

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

* Update frontend/src/metabase/components/upload/constants.ts

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

* Misc imports

* Retrieving `uploads-settings` DB

* Remove default UploadCSV component export

* Misc

* Button copy updated

* Analytics updated with optional properties

* Default upload file input id updated

* csvupload schema updated

* Removed before

* No bad Snowplow events added

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-06-18 12:48:32 -04:00
Romeo Van Snick
4f6bf67629 Add RTK endpoints for loading and searching parameters (#44291)
* Add RTK endpoints for loading and searching parameters

* Add Parameter API types

* Move types to metabase-types

* Add return type to normalizeQuery
2024-06-18 18:02:06 +02:00
Oisin Coveney
cc17b9e88e fix(sdk): Fix spacing between collection browser and breadcrumbs (#44342) 2024-06-18 18:35:55 +03:00
Anton Kulyk
1b78f5a361 Fix timeline events filtering in the query builder (#44355)
* Add repro test

* Fix timeline events filtering

* Don't include first date of next interval
2024-06-18 16:23:04 +01:00
Alexander Polyankin
bdbaee5a2a E2E repro for "Fix field values remapping with models & custom dropdown source in public dashboards" (#44315) 2024-06-18 14:09:27 +00:00
John Swanson
d6873e86d5 Fix missing can_restore on collections (#44287)
I'd fixed the `can_restore` on non-collections to always be present, but
forgot about fixing it for collections as well.
2024-06-18 07:01:48 -07:00
Nick Fitzpatrick
413efacef5 [Bug Fix] Use effective location when building initial path in entity picker (#44327)
* use effective location when building initial path in entity picker

* unit test adjustment

* more unit test adjustments
2024-06-18 10:59:14 -03:00
Nemanja Glumac
bc78552d5f Fix metabase lib returning the string "null" as the drill through value (#44234)
* Convert drill-through (CLJ) values to JS

* Convert the drill-through `:null` to an actual `null`

Resolves #44232

* Use new function in `filter-drill-details`

* display-info->js should check for nil before seqable?

* fix js object comparison

* Add test for the `drill-value->js` function

* Simplify the test

* Fix the JS object equality in the test

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-06-18 15:56:36 +02:00
Nemanja Glumac
cb9fac1ddd Update Past to Previous in date filters (#44299) 2024-06-18 15:55:54 +02:00
Alexander Polyankin
191572d90f E2E repro for "Fix issue with root collection in QuestionPicker" (#44318) 2024-06-18 09:33:07 -04:00
Alexander Polyankin
9c18d099ce Add auto-wiring e2e tests for temporal unit parameters (#44326) 2024-06-18 09:30:29 -04:00
Nemanja Glumac
844188a97e Preemptively fix the E2E flake in alerty types (#44344) 2024-06-18 15:15:31 +02:00
Roman Abdulmanov
4ab0cfca9c Mark external PRs with the label (#44343) 2024-06-18 15:44:13 +04:00
Oisin Coveney
8cb98be8af fix(sdk): Remove night mode toggle from SDK static dashboards (#44284) 2024-06-18 11:44:04 +03:00
Oisin Coveney
f57be777d4 fix(sdk): Add theming options for Collection Browser's empty content message (#44281) 2024-06-18 11:05:28 +03:00
Ngoc Khuat
4d907fe8fb dev/rollback! n migrations (#40488) 2024-06-18 14:58:29 +07:00
Ngoc Khuat
62e8739fed Writing migration notes (#44116)
* Writing migration notes
2024-06-18 05:57:19 +00:00
Alexander Polyankin
337dbbe074 Fix remapped values in public dashboards (#44254) 2024-06-17 21:34:35 -04:00
Nick Fitzpatrick
1c83904ee2 Search events 1-1-0 (#44314)
* search events 1-1-0

* backwards compatible adjustment

* making context optional
2024-06-17 18:33:00 -03:00
Jesse Devaney
7f19247f7f Fix incorrect goal line plotting when using non-linear y-axis scales (log/pow) (#44320)
* refactor: de-duplicate variable usage

* fix incorrect goal-line plotting in pow and log y-axis scales

* add Loki variants to validate and enforce desired behavior

* update loki snapshots
2024-06-17 20:57:02 +00:00
Case Nelson
ea9dfd1d2b Change run to make-run in process-query-for-card (#44244)
* Change run to make-run in process-query-for-card

Fixes #44160

There were two levers where a card could change how it was run.

`qp` this is basically `qp/process-query` with some optional userland
flags and constraints marked on the passed in query.
In the case of pivot tables in the
`/pivot/:card-id/query` endpoints it was `qp.pivot/process-query`

'run' this defaults to a streaming response that takes the `qp` param
and `export-format` and passes a query to qp. Most often this is
overriden to not stream the response.

Unfortunately, if `run` is overwritten, then `qp` is thrown away, and
the caller who overrides `run` must determine the correct `qp` to use.

However, when running `process-query-for-dashcard` it is difficult to properly set
`qp` for all of the dashcards without doing card lookups. So [this commit](https://github.com/metabase/metabase/blob/release-x.50.x/src/metabase/query_processor/card.clj#L230-L232) did a check to swap the runner in the presence of a pivot query that calls the **default** runner with a `qp.pivot/run-pivot-query`. The problem is that pulse needs to use a non-default runner, but there's no way for `process-query-for-card` to do both.

This commit changes `run` to `make-run` which raises the abstraction to
a function that produces a runer given a `qp`. This allows
`process-query-for-card` to change the `qp` as needed while keeping the
passed in runner.

There's really three things going on that could be teased apart
further/better.

1. `qp` - this conflates the processor (`qp/process-query` `qp.pivot/run-pivot-query`)
  and modifying query (`qp/userland-query`,
  `qp/userland-query-with-default-constraints` `(update query :info merge info)`)
2. `make-run` - How the above are processed: (streaming/realized)

* Fix tests
2024-06-17 11:29:57 -07:00
Alberto Perdomo
66a189f77f Update SDK README.md (#44292)
Tweak the callout about the SDK still being in development
2024-06-17 18:27:37 +01:00
Alex Yarosh
f8298e49e2 remove audit mentions (#44309) 2024-06-17 11:29:01 -04:00
Raphael Krut-Landau
01db0a2a70 fix: Remove references in the FE to the deprecated enable-query-caching setting (#44263)
* wip

* Remove references to the old enable-query-caching setting

* remove fixme

* linter

* remove some more instances

* fix imports
2024-06-17 10:06:52 -05:00
Alexander Polyankin
a0dfc99c41 E2E repro for "Dashboard filters do not work with SQL models" (#44297) 2024-06-17 14:51:12 +00:00
Ryan Laurie
a72afa4751 Rework slow test group (#44286)
* skip super slow xray test

* unmark not very slow tests
2024-06-17 08:49:18 -06:00
Nemanja Glumac
5fd247c5a1 MS1: Elevate "include this {period}" and "starting from" in the relative date picker (#44279)
* Elevate include this period in the relative date picker (#44179)

* Mock new row with "include {period}"  string

* Implement "include this" using a toggle

* Elevate "starting from" option in the relative date picker (#44242)

* Elevate "Starting from" option in the filter picker

* Tweak the date offset close icon

* Fix tests
2024-06-17 15:59:01 +02:00
Jeff Bruemmer
fdc0b71512 add 50.5 (#44293) 2024-06-17 09:33:18 -04:00
Ryan Laurie
13c71cd054 ci(release): Fix ee-extra trigger in release script (#44282) 2024-06-17 11:43:58 +00:00
Raphael Krut-Landau
93334133ea fix: Remove help email from error diagnostic modal (#44165) 2024-06-15 03:36:04 +00:00
Jesse Devaney
aac751c212 Fix tool-tip values not being scaled in waterfall charts (#44180)
* fix column scaling issues in waterfall chart

- refactor dataset scaling to behave like scatter and cartesian chart models

* add E2E test
2024-06-14 21:12:53 -03:00
Raphael Krut-Landau
9a68f25867 fix(webapp): Tweak dashboard move toast to add internal spaces and ttag context (#44191) 2024-06-14 17:17:59 -04:00
Jeff Bruemmer
9ac932ae16 Note on SQLite and cloud (#44237) 2024-06-14 15:42:51 -04:00
Aleksandr Lesnenko
74e73d2b6a fix charts crash in safari when dataset timezone is not in iana format (#44193)
* fix charts crash in safari when dataset timezone is not in iana format

* Update Loki Snapshots

* better fix: apply offset instead of finding a timezone with such offset

* remove unused specs

* Update Loki Snapshots

* review

---------

Co-authored-by: Metabase Automation <github-automation@metabase.com>
2024-06-14 19:18:58 +00:00
Cal Herries
dd1eb6cb4d Fix fields from Amazon Athena Tables failing to sync if there is not an underscore in the Table Name (#44032) 2024-06-14 18:26:21 +00:00
John Swanson
27e1ff6452 Fix collection id on collection items endpoint (#44236)
* Fix a potential bug in `hydrate-can-restore`

I had a bug here. I wanted to hydrate `:collection` on the items and
then return the original items, but instead I was `dissoc`ing
`:collection` from the items. If the original items passed in already
had `:collection` keys this would break them.

AFAIK this didn't cause any issues, but it could have - so fixing it here.

* Add a test

* Present collection items in the collection

When fetching collection items, we need to fetch the true
`collection_id` in order to figure out things like `can_restore` and
`can_delete`, but set it to the displayed/effective `collection_id` when
we actually send it out.

This fixes a bug where collections had their `collection_id` match their
`id` when returned by this endpoint.
2024-06-14 18:22:50 +00:00
Ryan Laurie
6d87ed281e ci(release):Tag tech writers in release message (#44216) 2024-06-14 08:39:25 -06:00
Jeff Bruemmer
7d2112e697 Update partner-and-community-drivers.md (#44218) 2024-06-14 11:16:03 -03:00
Sloan Sparger
f702aee6a0 Sort trash collection by last_edited_at desc (#44181) 2024-06-14 09:04:49 -05:00
Alex Yarosh
8c416bd9ab update list of releases (#44217) 2024-06-14 09:56:40 -04:00
Phoomparin Mano
dd00df1a06 Replace usage of color-mod with color-mix and remove the postcss function (#44175)
* replace color-mod with color-mix

* update alpha values to round to 5%

* add deprecation notice to lighten, darken and alpha

* update loki reference image

* add alpha value css variables to storybook preview

* update loki reference image
2024-06-14 13:29:13 +00:00
Abed Habli
0e8469f4b0 capitalize the ‘U’ in user interface (#44196) 2024-06-14 09:12:06 -04:00
Ryan Laurie
e1ade5c665 Trigger ee extra build (#44138) 2024-06-14 06:40:15 -06:00
John Swanson
e677eb7ad2 Always provide can_restore (#44124)
Previously we were just adding this when the item was archived. Instead,
always send a value - if the item is not archived, it can't be restored,
so it will be `false` in this case.

Making this change will make fixing a frontend bug easier, because the
frontend will be able to just trust the `can_restore` value coming in
from the backend.
2024-06-14 05:25:03 -07:00
github-automation-metabase
012a763522 Update Readme version references and published npm version to 0.1.9 (#44212) 2024-06-14 12:13:41 +00:00
Oisin Coveney
d7a1e86798 fix(sdk): Update README to move Embedding the collection browser to Features currently supposed (#44208) 2024-06-14 11:46:42 +00:00
Ryan Laurie
4bbc3163e2 Better Release Slack Notifications (#44195)
* add additional release slack message

* trigger slack messages from build

* fixes

* remove silly var name
2024-06-14 05:35:30 -06:00
Ryan Laurie
c769688711 Update release script to trigger ops issue creation (#39634)
* update release script to trigger ops issue creation

* update secret vars
2024-06-14 05:27:35 -06:00
Kamil Mielnik
5258ec54f8 Fix background-color usage in CSS-in-JS (#44204) 2024-06-14 11:25:30 +00:00
Ryan Laurie
4f25a4720b Combine collections e2e specs (#43841)
* combine collections e2e specs

* obey the linter
2024-06-14 05:12:09 -06:00
Raphael Krut-Landau
1bfcdf8c90 fix(admin): Rename some variables (#43817) 2024-06-14 06:40:19 -04:00
Oisin Coveney
7854e07a62 fix: Ensure interactive embedding CTA matches instance features (#44197) 2024-06-14 13:32:50 +03:00
Oisin Coveney
81a586df95 fix(sdk): Add theming to collection browser breadcrumbs (#44066) 2024-06-14 12:19:04 +03:00
Nemanja Glumac
884901f20a Remove "is empty" and "not empty" from time-series chrome (#44164)
* Remove "is empty" and "not empty" from time-series chrome

* Fix unit test
2024-06-14 11:00:58 +02:00
Phoomparin Mano
9decd3e8ed docs(sdk): add theming changes to embedding SDK docs (#44172)
* docs update

* add dashboard.backgroundColor
2024-06-14 08:58:04 +00:00
Romeo Van Snick
62123c073e Use MultiAutocomplete in dashboard filters (#43293)
* Use MultiAutocomplete in dashboard filters

* Handle prefix on MultiAutocomplete

* Remove unnecessary tests for empty values

* Remove input className

* Handle numbers in MultiAutocomplete

* Accept number values in MultiAutocomplete

* Use MultiAutocomplete in NumberInputWidget

* Filter out empty items

* Do not expect formatted number in values

* Do not allow adding multiple values when multi is false

* Handle undefined values

* Make value optional

* Fix MultiAutocomplete types

* Make MultiAutoComplete generic in its value type

* Refine MultiAutocomplete type in NumberInputWidget

* Refine MultiAutocomplete type in FieldValuesWidget

* Fix typo

* Fix MultiAutocomplete tests

* Add helpers to work with MultiSelect and MultiAutocomplete inputs

* Handle MultiAutocomplete input in tests

* Fix filter helper

* Use multiAutocompleteInput helper

* Find the value remove button in test

* Fix tests for NumberInputWidget

* Fix tests for DefaultPicker

* Fix type in NumberInput

* Fix dasboard test

* Fix embedding test

* Add helpers to remove values

* Fix chained filter test

* Fix nested test

* Fix embedding tests

* Fix filter tests

* Use removeMultiAutocompleteValue

* Use removeMultiAutocompleteValue

* Remove unused variable

* Use multiAutocompleteInput helper

* Handle comma's in values

* Handle multiselect

* Fix filter test

* Add filter

* Format field value

* Fix embedding tests

* Allow rendering custom label for item

* Use renderValue in FieldValuesWidget

* Fix data prop type

* Be more explicit about broken types in FieldValuesWidget

* Fix default behaviour for label

* Fix embedding tests

* Force click

* Fix sharing test

* Use removeMultiAutocompleteValue

* Handle multiautocomplete inputs

* Force click filter

* Close the suggestions menu

* Fix email test

* Fix sharing filter

* Set viewport in test

* Fix sharing test

* Remove debugging logs

* Use removeMultiAutocompleteValue

* Close the suggestions menu using blur

* Remove commented out code

* Remove the unused color prop

* Move shared types to types file

* Rename ValueType to TValue

* Add missing forwardRef

* Add tests for filter and renderValue

* Use TokenField for single value parameters

* Fix single value test

* Be more specific about when to select a single input

* Fix single value e2e test

* Handle undefined parameter

* Accept all RowValue types in MultiSelect

* Accept all RowValue types in ListField

* Accept all RowValue types in SingleSelectListField

* Be more precise about the FieldValuesWidget value types

* Be more specific about when to render normal input

* Remove duplicate import

* Remove maxSelectedValues from MultiAutocomplete

* Parse values in FieldValuesWidget

* Remove parsing complexity from MultiAutocomplete

* Be more strict when parsing numbers

* Do not use multiselect when arity is 1

* Remove spurious changes

* Pass prefix from FieldValuesWidget

* Remove number MultiAutocomplete story

* Remove renderValue from MultiAutocomplete

* Add custom component to MultiAutocomplete

* Add missing data prop

* Remove spurious changes in MultiAutocomplete

* Remove SelectItem reference

* Use renderValue in FieldValuesWidget
2024-06-14 10:04:18 +02:00
Nick Fitzpatrick
a8d5ea6437 fix(command-palette): fix docs url (#44113) 2024-06-13 22:49:44 -04:00
Raphael Krut-Landau
a95ff7f595 fix: Remove console warnings in cache-related code (#44173)
This PR removes:
- a warning about missing React keys in the `Schedule` component
- a warning about invalid props in the `StrategyFormLauncher` component
2024-06-13 22:32:54 -04:00
Raphael Krut-Landau
e33acdc6b6 feat(admin/cache): Use distinct routes for each performance tab (#44139) 2024-06-14 00:38:32 +00:00
Raphael Krut-Landau
1088baf011 [Browse] Add skeletons to Browse models (#44008)
* adds a shimmer effect to the skeletons
* adds a `natural` prop that makes the skeletons have a random width between 50% and 80%
* adds a skeleton to Browse models

Closes #44111
2024-06-13 20:33:56 -04:00
Braden Shepherdson
ba182e1745 [QP] Fix :fields clauses in nest-query with extra aggs outside model (#44182)
Fixes #43993.
2024-06-13 22:55:07 +00:00
Sloan Sparger
458fbf9efb fixes coloring for bulk actions bar button (#44178) 2024-06-13 17:14:59 -05:00
Nick Fitzpatrick
4772b5e249 Adding snippets back into getCollection (#44097)
* adding snippets back into getCollection

* e2e test

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-06-13 17:01:58 -05:00
Phoomparin Mano
04a08d3304 replace css variables in static viz (#44131) 2024-06-14 03:04:15 +07:00
Noah Moss
2e94093025 Don't sync JWT registered claims as login attributes (#43976) 2024-06-13 19:10:53 +00:00
Noah Moss
d971a83601 Minor refactoring in JWT/SAML tests (#43866)
* little bit of refactoring in sso test code

* use :once instead of :each
2024-06-13 14:22:37 -04:00
Noah Moss
16599b223e Relax constraints on GET /api/user/:id endpoint (#44100) 2024-06-13 14:13:18 -04:00
Noah Moss
c7bf7d1def Fix login_history indexed columns (#44091) 2024-06-13 14:13:01 -04:00
Phoomparin Mano
d843973a8e feat(sdk): option to hide dashboard card title (#43859)
* expose card title settings

* Add dashboard test skeleton

* add a sample dashcard to the test

* dashboard grid should have card title by default

* add unit test for card title

* remove unused delay in unit test

* fix width and height being smaller than min values

* flip grid layout condition

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-06-14 00:54:01 +07:00
Raphael Krut-Landau
c7e46dc961 fix(ui-library): Don't animate Buttons (micro-PR) (#44137) 2024-06-13 16:10:33 +00:00
Phoomparin Mano
ee38f0e449 feat(sdk): apply theme options to tables in static dashboard (#44007)
* apply cell background color

* add id column overrides

* do not add transparency to id column cell when overridden

* fix static dashboard theming

* update loki reference image

* add style resets and regenerate loki snapshots

* add style resets and regenerate loki snapshots
2024-06-13 21:34:26 +07:00
Aleksandr Lesnenko
6e87cb9306 Fix invalid areas when line style is step (#44107)
* fix area step

* specs
2024-06-13 11:08:22 -03:00
Chris Truter
68bd9781ae Update Macaw to fix double blank lines (#44119) 2024-06-13 15:20:53 +02:00
Alex Yarosh
c5ef3fe772 [docs] update the list of releasts for 50.3 and 49.16 (#44125) 2024-06-13 09:11:19 -04:00
Anton Kulyk
ffbad1d6ae Fix broken line/area/bar charts after adding a second stage filter (#44053)
* Rework column sync to work with series objects

* Reuse previous metrics and dimensions if available

* Add repro test
2024-06-13 13:57:43 +01:00
Alexander Polyankin
3afe4821a0 Fix issue with root collection in QuestionPicker (#44081) 2024-06-13 03:52:09 +00:00
dpsutton
8824bd9a19 Handle errors when inferring separator of csv (#44073)
* Handle errors when inferring separator of csv

This file

```
"c1","c2"
"a,b,c","d"
```

was failing to upload for a silly reason: when we were checking for
which separator it used, we had a parse error when using a semi-colon
and that blew up the whole pipeline.

* Use cal's helpful test suggestions
2024-06-12 17:21:52 -05:00
Raphael Krut-Landau
e2144d140d Remove dead props in getButtonOverrides (#44082) 2024-06-12 16:55:17 -04:00
John Swanson
837beda619 Set can_delete to false for unarchived items (#44088)
Although a user may have the necessary permissions to delete an item, if we're not going to allow deleting unarchived items, can_delete should be false for them too.
2024-06-12 20:24:22 +00:00
Jeff Bruemmer
eb9bb2dad7 docs - minor edit (#44089) 2024-06-12 16:14:52 -04:00
Raphael Krut-Landau
6240dee136 [Browse] Use a loading skeleton instead of a spinner for Browse models in the nav (#43970)
* Add our first Mantine Skeleton

* Sort

* Simplify Skeleton.tsx
2024-06-12 15:16:34 -04:00
Alexander Polyankin
bab6387cdf Consolidate temporal unit pickers between dashboards and timeseries chrome (#44061) 2024-06-12 18:47:13 +00:00
Raphael Krut-Landau
44cfdf48e2 Make model persistence tab available on OSS (#44059) 2024-06-12 14:36:26 -04:00
Anton Kulyk
0cce65e2cb Move syncColumnSettings to metabase/visualization (#44074)
* Move `syncColumnSettings` to metabase/visualization

* Remove unused `SettingsSyncOptions`

* Fix type errors
2024-06-12 19:14:05 +01:00
Sloan Sparger
edcd2ff7c9 Fix "Manage database" perms incorrectly show up on the schema-level permissions page (#43601) 2024-06-12 13:02:01 -05:00
Jeff Bruemmer
fa8c7a2361 docs - release list 50.1 (#44076) 2024-06-12 13:26:21 -04:00
Alexander Solovyov
d638e94971 certain settings should be decrypted for cache config migration to run (#44048) 2024-06-12 11:22:04 -06:00
Ryan Laurie
d7bd5603bc Combine and reorganize admin e2e specs (#43853)
* combine and reorganize admin specs

* fix import and reorganize more
2024-06-12 11:20:47 -06:00
Ryan Laurie
acd7c31f22 Combine embedding e2e specs (#43843) 2024-06-12 11:20:25 -06:00
Ryan Laurie
cbda131e84 Combine native e2e specs (#43844) 2024-06-12 11:20:01 -06:00
Ryan Laurie
121054b293 Update how we run maildev in pre-release testing (#44072) 2024-06-12 10:27:22 -06:00
Oisin Coveney
fad00d4346 Convert Badge and CollectionBadge (#43997) 2024-06-12 17:18:15 +03:00
Alexander Polyankin
084dd3b2ae Allowlist for temporal unit parameters (#43967) 2024-06-12 10:05:24 -04:00
Ngoc Khuat
937e3daac1 Fix get card query_metadata and dashboard query_metadata throws 500 when users don't have view perms on any tables (#44052) 2024-06-12 15:53:50 +02:00
Nemanja Glumac
01e9387f62 Fix broken filter E2E test (#44051)
* Fix broken E2E test

* Remove linter warning
2024-06-12 12:31:03 +00:00
Oisin Coveney
14db7aeeac feat(sdk): Add collection browser (#43606) 2024-06-12 11:37:42 +03:00
Uladzimir Havenchyk
f7502d96e7 Restore icons in the new filter popup (#44025)
* Restore icons in the new filter popup

* it.each
2024-06-12 07:40:48 +00:00
Ivan Križnar
bae0aedf2c Fix scrollbar interaction in the custom expression suggestion list (#43995)
* Fix dismissing popup

* Undo revert

* Merge refs

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorTextfield/ExpressionEditorTextfield.tsx

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

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorSuggestions/ExpressionEditorSuggestions.tsx

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>

* Update frontend/src/metabase/query_builder/components/expressions/ExpressionEditorSuggestions/ExpressionEditorSuggestions.tsx

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>

* Use semantically correct HTML

* Fix popmenuTarget type

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-06-12 09:07:40 +02:00
Aleksandr Lesnenko
ae2c960913 fix single series bar hover (#43984)
* fix single series bar hover

* prefer reduced motion
2024-06-12 01:17:09 +00:00
Case Nelson
febfe4a5aa [Metrics V2] Metrics with filters on implicitly joined columns produce query error when added in a Summarize block (#43987)
* [Metrics V2] Metrics with filters on implicitly joined columns produce query error when added in a Summarize block

* Handle multiple metrics with same implicit join

* Address PR feedback
2024-06-11 16:12:51 -06:00
Nemanja Glumac
9ebb679f6d Fix "collection items sorting" E2E flake (#44023)
* Fix "collection items sorting" E2E flake

* Add comments

* Remove the `@flaky` tag
2024-06-11 19:45:45 +00:00
Nemanja Glumac
ce5d2547e7 Remove the custom resize handle from the notebook native query preview sidebar (again) (#44021) 2024-06-11 19:25:02 +00:00
Jeff Bruemmer
6c1458ff2f uploads in config file (#43891) 2024-06-11 14:13:32 -04:00
Nemanja Glumac
8af1555502 Fix the dashboard drill E2E flake (#44016) 2024-06-11 17:02:41 +00:00
bryan
7b849da346 Make recents understand context (#43478)
* adds the endpoint and a test

* add recents endpoint, todo: tests

* add post recents endpoint

* return recent views for both lists, but make the endpoint work

* Make recent-views context aware

- pruning is context aware, only checks for the recently-inserted
  context
- Adds endpoints:
    - POST to create selection recents,
    - GET activity/recents
      - requres context query param to be one of:
      - all, views, selections

- Adds context arg to update-users-recent-views!
- Cleans up arg schema for update-users-recent-views

* impl GET api/activity/recents

- return recent-selections and recent-views from
- send context == collection from pinned card reads

* update callsites of recent-views/update-users-recent-views!

- to use :view param where necessary

* fixes models/recent-view tests

* adds more activity/recent-view tests

* wip

- fix whitespace linter

* Fix command palette e2e test

- reuse util snake-keys

* updates fe to use new recents endpoints

* fixes fe type issue

* snake-keys -> deep-snake-keys

- I've been betrayed by lsp rename

* snake-keys -> deep-snake-keys

- I've been betrayed by lsp rename

* log selection events for created collections

* mysql doesn't allow default values for TEXT types

* log a recent view on data-picker selection

* decouple view-log context from card-event view context

* fix a doc typo

* stop double logging recent-views on POST

* maybe fixes some tests

* some e2e fixes

* fix mysterious divide by zero during score search

* fix divide by zero possibilities everywhere in score-items

metabase.api.activity/score-items used to throw when there weren't any
items being scored (even though there's a `(when (seq items) ...)` check)

* more test fixes

* fix more e2e tests, + rename endpoint in tests

* fix oopsie

* fixes a few more tests

* address review comments/questions

* allow for a comma delimited list in qps like ?context=views,selections

returns all recent view items with those contexts, most recent first
under the `:recents` key.

* refactors FE around new endpoint

* fixes for unit tests

* use ms/QueryVectorOf for context

* fix models/recent_views tests

* use multiple query params instead of comma delimited value on FE

* ignore timestamp when deduping recents

* review comments + test fixing

* update docstring

* fix api/activity_test s

* actually dedupe

* add test for deduping by context

* e2e fix: shows up-to-date list of recently viewed items after another page is visited

* e2e fix: should undo the question replace action

* e2e fix: should replace a dashboard card question (metabase#36984)

* e2e fix: should preselect the most recently visited dashboard

* fix 6 more e2e tests

* fixes fe type check and unit failure

* renames unit test mocking function

* fix a flaky e2e test

* widen Item to accept str or kw where sensible

- allow strings or keywords for moderated_status, and authority_level

* simplify impl + add test

* add view-log to events schema

* add collection context to view log

* fix the final 2 failing e2e tests

* click dashboard tab when the user has can-read? on recent entities

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-06-11 10:12:29 -06:00
John Swanson
7374e61ed7 Improve the Trash data model (#42845)
* Improve the Trash

Ok, so I had a realization at the PERFECT time, immediately after the RC
cutoff. Great job, brain!

Here's the realization. For the Trash, we need to keep track of two
things:

- where the item actually is located in the hierarchy, and

- what collection we should look at to see what permissions apply to the
item.

For example, a Card might be in the Trash, but we need to look at
Collection 1234 to see that a user has permission to Write that card.

My implementation of this was to add a column,
`trashed_from_collection_id`, so that we could move a Card or a
Dashboard to a new `collection_id`, but keep track of the permissions we
actually needed to check.

So:

- `collection_id` was where the item was located in the collection
hierarchy, and

- `trashed_from_collection_id` was where we needed to look to check
permissions.

Today I had the realization that it's much, much more important to get
PERMISSIONS right than to get collection hierarchy right. Like if we
mess up and show something as in the Trash when it's not in the Trash,
or show something in the wrong Collection - that's not great, sure. But
if we mess up and show a Card when we shouldn't, or show a Dashboard
when we shouldn't, that's Super Duper Bad.

So the problem with my initial implementation was that we needed to
change everywhere that checked permissions, to make sure they checked
BOTH `trashed_from_collection_id` and `collection_id` as appropriate.

So... there's a much better solution. Instead of adding a column to
represent the *permissions* that we should apply to the dashboard or
card, add a column to represent the *location in the hierarchy* that
should apply to the dashboard or the card.

We can simplify further: the *only time* we want to display something in
a different place in the hierarchy than usual is when it was put
directly into the trash. If you trash a dashboard as a part of a
collection, then we should display it in that collection just like
normal.

So, we can do the following:

- add a `trashed_directly` column to Cards and Dashboards, representing
whether they should be displayed in the Trash instead of their actual
parent collection

- use the `collection_id` column of Cards and Dashboards without
modification to represent permissions.

There's one main downside of this approach. If you trash a dashboard,
and then delete the collection that the dashboard was originally in,
what do we do with `dashboard.collection_id`?

- we have to change it, because it's a foreign key

- we can't set it to null, because that represents the root collection

In this initial implementation, I've just cascaded the delete: if you
delete a dashboard and then delete a collection, the dashboard will be
deleted. This is not ideal. I'm not totally sure what we should do in
this situation.

* Rip out all the `trashed_from_collection_id`

* Migration to delete trashed_from_collection_id

* fixes

* don't move collections

And don't allow deleting collections

* only show cards/dashboards with write perms

* Show the correct archived/unarchived branch

* some cleanup

* add a todo for tomorrow

* Fix for yesterday's TODO

* more wip

* refactor

* memoize collection info

* move around memoization a bit

* fix schema migration test

* oops, delete server.middleware.memo

* Use a migration script (postgres only for now)

* Fix some tests

* remove n+1 queries in `collection-can-restore`

* fix test

* fix more tests, and x-db migration script

* fix h2 rollback

* fix mysql/mariadb migration

* lint

* fix some mariadb/mysql tests

* fix h2 rollback

* Fix mysql rollback

* Fix Postgres migration

* "Real" `trash_operation_id` UUIDs from migration

* fix mariadb migration

* Separate MySQL/MariaDB migrations

* trashed directly bit->boolean

* Remove `trashed_from_*` from migrations

* Rename `api/updates-with-trashed-directly`

Previously named `move-on-archive-or-unarchive`, which was no longer
accurate since we're not moving anything!

* Add `can_delete`

* Delete test of deleted code

* Can't move anything to the Trash

The Trash exists as a real collection so that we can list items in and
such without needing special cases. But we don't want anything to
_actually_ get moved to it.

* integrates can_delete flag on FE

* Update src/metabase/models/collection.clj

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

* Update src/metabase/search/impl.clj

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

* Better name for `fix-collection-id`

Also consolidated it into a single function. It takes the
trash-collection-id as an argument to prevent a circular dependency.

* s/trashed/archived/ on the backend

In the product, we want to move to "trashed" as the descriptor for
things that are currently-known-as-archived.

It'd be nice to switch to that on the backend as well, but that'll
require quite a lot of churn on the frontend as we'd need to change the
API (or have an awkward translation layer, where we call it `trashed` on
the backend, turn it into `archived` when sending data out via the API,
and then the FE turns around and called it "trashed" again).

For now, let's just be consistent on the backend and call it `archived`
everywhere. So:

- `archived_directly` instead of `trashed_directly`, and
- `archive_operation_id` instead of `trash_operation_id`

* Fix up a couple docstrings

* Rename `visible-collection-ids` args

for `collection/permissions-set->visible-collection-ids`:

- `:include-archived` => `:include-archived-items`

- `:include-trash?` => `:include-trash-collection`

* select affected-collection-ids in the tx

* Stop dealing with `:all` visible collection ids

This used to be a possible return value for
`permissions-set->visible-collection-ids` indicating that the user could
view all collections. Now that function always returns a set of
collection IDs (possibly including "root" for the root collection) so we
don't need to deal with that anymore.

* Don't use separate hydration keys for collections

Dispatch on the model of each item (but still keep them in batches for
efficiency.)

* vars for collectable/archived-directly models

* Round up loose `trashed_directly`s

* Fix a test

* Use `clojure.core.memoize` instead of handrolled

It's slightly different (TTL instead of exactly per-request) but that
should be fine.

* FE lint fixes

* 😭 e2e test fix

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-06-11 11:31:14 -04:00
Phoomparin Mano
a742b3408b feat(sdk): theme option to customize the dashboard card border (#43963)
* add option to customize dashcard border

* use the shadow CSS variable

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

* make the shadow and border decoration call more explicit

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

* pass in theme as argument

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-06-11 22:14:46 +07:00
Romeo Van Snick
d876627b24 Unary number parameter (#43921)
* Allow picking arity of number parameters

* Limit to input to have arity 1 when multi is false

* Use MultiAutocomplete in NumberInputWidget when arity is 1

* Add test cases for single value numbers

* Only change arity when it is n

* Fix unit tests for NumberInputWidget

* Move arity check for numbers to getNumberParameterArity
2024-06-11 16:57:14 +02:00
Jeff Bruemmer
64f82436ef docs - updates for 50 (#44002) 2024-06-11 10:38:15 -04:00
Nemanja Glumac
28fc332064 Fix "line/bar chart" tooltip flake (#43975)
* Fix the typo

* Replace `realHover` with the `mouseMove` trigger

* Be explicit when targetting elements by their index

* fix combo chart tooltip e2e specs

* cy.wait as a last resort

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-06-11 14:09:24 +00:00
Aleksandr Lesnenko
6ec9de852e move stackable settings (#43978) 2024-06-11 13:42:56 +00:00
Nemanja Glumac
eebf4b5239 Fix E2E flake in the native_subquery spec (#43991)
* Re-work `startNewNativeQuestion` helper

* Fix native_subquery flakes

* Simplify the helper

* Remove the `flaky` tags
2024-06-11 14:10:58 +02:00
Kamil Mielnik
c0a804bfe6 Copy question link from dashboard (#43816)
* Improve typing in Question

* Remove dead CSS

* Improve typing in getUrlWithParameters

* Add LegendLabel

* Drop navigateToNewCardFromDashboard in PublicOrEmbeddedDashboard

* Extract getNewCardUrl and move getParametersMappedToDashcard closer to it

* Add link to dashboard chart title

* Update title-drill tests

* Format code

* Update test

* Add HrefMemo

* Use state to memoize href

* Recompute state on getHref prop change

* Format code

* Refactor href computation

* Update test

* Use selector instead of useMemo

* Fix unit tests

* Ensure type safety

* Revert getDashCardById type change to not make this PR too large

* Use complete dashboard

* Add a workaround for metabase#43990
2024-06-11 17:39:45 +07:00
Kamil Mielnik
40ef144430 Revert "Fix scrollbar interaction in the custom expression suggestion list (#…" (#43992)
This reverts commit a297e9a6ad.
2024-06-11 10:14:33 +00:00
Phoomparin Mano
6113998662 apply full width to static dashboard (#43954) 2024-06-11 17:05:35 +07:00
Mahatthana (Kelvin) Nomsawadi
ddb6299993 Release a test from the flaky test jail (#43946) 2024-06-11 09:06:03 +01:00
Mahatthana (Kelvin) Nomsawadi
459429985c ci(sdk): Remind SDK PR author to use conventional commits PR title (#43932)
* Remind embedding SDK PR author to use conventional commits

* Only remind PR author when PR title isn't conventional commits

* Add branch for testing

* Fix gh cli command

* Fix getting wrong user login

* Ensure we don't create more than 1 comment

* Improve comment format

* Add more info for non-changelog related type

* Check non-changelog related types

* Update the comment for consistency

* Revert "Add branch for testing"

This reverts commit 4a1be68828.
2024-06-11 07:30:35 +01:00
Chris Truter
a46b9d7fc2 More precise migration range logs (#43962) 2024-06-11 08:21:58 +02:00
Denis Berezin
e8fedf0164 feat(sdk): SDK theming part 6 - text-brand, text-dark, text-light, text-medium, admin-navbar, accentX (#43687)
* Migrate text-brand

* Migrate text-dark

* Migrate text-light

* Migrate text-medium

* Migrate admin-navbar

* make compact formatting consistent across all series (#43472)

* make compact formatting consistent across all series

* fix rebase

* [Browse] Show Browse models link in nav only when there are models (#43286)

* Upgrade to TypeScript v5.4 (#43736)

* use correct github api for CI (#43750)

* update list of releases (#43754)

* Multi Series Dashcards Render with Filters Applied To All Series (#43428)

* Multi Series Dashcards Render with Filters Applied To All Series

Fixes: #39083

Multi-series dashcards now properly render when a subscription is set up with filters that impact the values of each
card in the multi-series card.

* Small refactor for executing dashcards in a pulse context.

- move execute-dashboard-subscription to pulse.util
- this fn now will also execute all card series cards
  and put those results into a list on the key :series-results in the dashcard
  which is then used in the render multimethod to send the correct data to the javascript context

A small todo was taken care of as well, we can now use :dashboard-subscription in the :context key

* Fix up render fn

The shape of hte data going into the javascript was a bit unclear before. This keeps things a little more
understandable.

Next step is probably to create some Malli schemas inside the js_svg namespace to document and enforce the needed data shapes

* pull :data up a level from :result in the series cards

* Update src/metabase/pulse/render/body.clj

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

* Remove unneeded let

* set/rename-keys won't work here because we raise the :data key

I've realised a suggested change to just use set/rename-keys won't do what we need. We need instead to raise :data
from within the result key up to the same level (and dissoc result).

I've renamed the helper function to make its purpose a bit clearer

---------

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

* Hydrate can_run_adhoc_query and address review comments (#43747)

This is a followup on #43625.

* Consolidate dashboard-card specs (#43716)

* Consolidate joins specs (#43717)

* Update translations for v50 and add Danish Language Support (#43314)

* update translations for v50

* add Danish

* update translations for v50 release

* alphabetical order is nice

* Move database role to url parameters from connection properties on Snowflake (#43602)

* Move role to url parameters from connection properties

* Fix test

* Fix width of save button in cache sidebar (#43755)

* Remove dead code (#43603)

* Combine search e2e specs (#43718)

* Highlight the table cell data in dashboards when the cell is an ID column (#43728)

* highlight id cell column

* add simpletable stories

* add simple table test data

* add loki reference image

* Update frontend/src/metabase/visualizations/components/TableSimple/TableCell.styled.tsx

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

---------

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

* Remove old repro for 39150 (#43749)

* Fix remaining `tinyint` booleans in MySQL (#43296)

* Correct type for `report_card.dataset`

This was missed in the original migration of boolean types to
${boolean.type} in MySQL/MariaDB, and then missed again by me when I
migrated `collection_preview` over a week ago.

* Change all boolean types to `bit(1)` in MySQL

Liquibase changed their boolean type in MySQL from `bit(1)` to
`tinyint(4)` in version 4.25.1. Our JDBC driver does not recognize these
as booleans, so we needed to migrate them to `bit(1)`s.

As discussed [here](#36964), we
changed all existing `boolean` types that were in the
`001_update_migrations.yml` but not the SQL initialization file.

For new installations, this works: things in the SQL initialization file
get created with the `bit(1)` type.

However, for existing installations, there's a potential issue. Say I'm
on v42 and am upgrading to v49. In v43, a new `boolean` was added.

In this case, I'll get the `boolean` from the liquibase migration rather
than from the SQL initialization file, and it need to be changed to a
`bit(1)`.

I installed Metabase v41 with MySQL, migrated the database, and then
installed Metabase v49 and migrated again. I made a list of all the
columns that had the type `tinyint`:

```
mysql> SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_TYPE,        COLUMN_DEFAULT, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_TYPE = 'tinyint' AND TABLE_SCHEMA='metabase_test';
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| TABLE_SCHEMA  | TABLE_NAME                   | COLUMN_NAME       | COLUMN_TYPE | COLUMN_DEFAULT | IS_NULLABLE |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| metabase_test | core_user                    | is_datasetnewb    | tinyint     | 1              | NO          |
| metabase_test | metabase_field               | database_required | tinyint     | 0              | NO          |
| metabase_test | metabase_fieldvalues         | has_more_values   | tinyint     | 0              | YES         |
| metabase_test | permissions_group_membership | is_group_manager  | tinyint     | 0              | NO          |
| metabase_test | persisted_info               | active            | tinyint     | 0              | NO          |
| metabase_test | report_card                  | dataset           | tinyint     | 0              | NO          |
| metabase_test | timeline                     | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline                     | default           | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | time_matters      | tinyint     | NULL           | NO          |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
10 rows in set (0.01 sec)
```

Then wrote migrations. For each column, we:

- turn it into a `bit(1)`,

- re-set the previously existing default value, and

- re-add the NOT NULL constraint, if applicable.

* Change author and add missing `dbms`

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>

* Add ts-pattern library (#43752)

* Add events to measure search performance (#43135)

* new_search_query event

* Filters in object, search click event

* updating event schema

* type and event schema adjustments

* delete comments BE code

* adjusting tests

* PR feedback

* typos and spacing

* Fixup missing colors

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Alex Yarosh <alexandra@metabase.com>
Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
Co-authored-by: lbrdnk <lbrdnk@users.noreply.github.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: SakuragiYoshimasa <ysrhsp@outlook.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
2024-06-10 22:13:47 +00:00
Aleksandr Lesnenko
8936df34fb fix bar normalized stacking breaks line charts (#43957)
* fix bar normalized stacking breaks line charts

* spec
2024-06-10 21:24:30 +00:00
Emmad Usmani
80d33f6869 remove unused timeseries interval (#43421)
* remove two year timeseries interval

* use two year instead of five year interval

* update binning e2e spec
2024-06-10 21:17:15 +00:00
Nemanja Glumac
c62003fff3 Fix the flaky "bookmark" E2E test (#43965)
* Fix the flaky "bookmark" E2E test

Resolves #43871

* Remove the `flaky` tag
2024-06-10 22:27:02 +02:00
Alexander Polyankin
f530b0fd31 E2E tests for temporal unit parameters (#43688) 2024-06-10 16:24:51 -04:00
lbrdnk
f971c42ada Add connection string parsing to Snowflake (#43923)
* Add connection string parsing

* Add test case with role suffixed key
2024-06-10 22:04:10 +02:00
metamben
be9740ca70 Enable Clojure logging in the browser (#43959)
Messages at INFO level and higher will appear in the browser console.
2024-06-10 22:39:47 +03:00
Uladzimir Havenchyk
dc4614151c [Dashboard] Replace automatic wiring of the cards with opt-in variant (#43827) 2024-06-10 22:19:17 +03:00
Nemanja Glumac
84fd549fff Fix "CC typing suggestion" E2E flake (#43956)
* Fix E2E flake "cc-typing-suggestion"

Resolves #43872

* Remove `@flaky` tag

* Improve the assertion
2024-06-10 20:34:46 +02:00
Cal Herries
a2f3d74950 Actually validate view_log.context matches ::view-log/context on insert (#43801) 2024-06-10 18:04:08 +00:00
Nemanja Glumac
121fe66f67 Fix flaky E2E test "sidebar should be resizable" (#43947)
* Fix flaky E2E test "sidebar should be resizable"

* Remove the `flaky` tag

* Remove unused intercept
2024-06-10 17:35:36 +00:00
Ivan Križnar
a297e9a6ad Fix scrollbar interaction in the custom expression suggestion list (#43837)
* Expose `ExpressionEditorSuggestions` ref

* Add popup ref

* Prevent popup being dismissed when active

* Update displayName
2024-06-10 19:08:15 +02:00
metamben
8609c02bb6 Bulk load data for can_run_adhoc_query and table metadatas (#43899) 2024-06-10 19:47:31 +03:00
Raphael Krut-Landau
46215d51fc Remove classnames (#43869) 2024-06-10 12:33:38 -04:00
Raphael Krut-Landau
752749f79e [Cache] Fix save button bug and several smaller issues (#43810) 2024-06-10 15:49:25 +00:00
Chris Truter
5fc87983ff Avoid guessing Liquibase table name (#43928) 2024-06-10 15:29:09 +00:00
Raphael Krut-Landau
b6dea77ab0 Use the metric icon for metrics (#43893)
Closes #43894
2024-06-10 10:48:26 -04:00
Anton Kulyk
f106ffa776 Fix stacked redirects to homepage dashboard crashing the app (#43836)
* Add repro test

* Move home selectors to `metabase/selectors/app`

* Prevent unnecessary redirects to home dashboard

* Rename

* Handle navbar home link

* Fix unit tests

* Fix navigating away from an archived dashboard

* Handle sub-root Metabase URLs
2024-06-10 15:30:07 +01:00
Chris Truter
2cf666d9af Rename 'direct' fields references to 'explicit' (#43823) 2024-06-10 13:58:41 +00:00
Cal Herries
67fec430a5 Change the uploads-enabled setting's visibility to internal (#43849) 2024-06-10 07:54:03 -06:00
Denis Berezin
7046fef3c4 feat(sdk): SDK theming part 5 - success, summarize, warning, white, text-white, bg-white (#43676)
* Migrate success

* Migrate summarize

* Migrate warning

* Migrate white

* Add colors to storybook

* Fix CI

* Fix CI

* Codereview fixes

* Convert warning color
2024-06-10 16:34:51 +03:00
Jeff Bruemmer
88734ca33c note on locked filters (#43886) 2024-06-10 08:34:32 -04:00
Kamil Mielnik
897a22f298 Time-over-time comparison - e2e tests (#43724)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Add tracking helpers

* Add new schema

* Add tracking in column header

* Add tracking in plus modal

* Add tracking in aggregation picker

* Fix destructuring

* Add functionsUsedByExpression

* Fix schema number

* Add tests boilerplate

* Implement test for notebook editor

* Add test for column header

* Add a test for summarize sidebar

* Add a test for the plus button

* Add expectNoBadSnowplowEvents call in afterEach

* Format code

* Add missing redux store state in tests

* Add data for tests

* Move createQuestion call out of beforeEach

* Add tests for labels when there are no aggregations

* Add describe

* Add group helper

* Revert "Add group helper"

This reverts commit e047a223e9.

* Optimize: use cy.log() instead of it()

* Format code

* Add tests for 1 breakout, add helpers

* Add test for non-binned datetime column text

* Add test for non-datetime column text

* Nest tests

* Add test for multiple aggregations and no breakout, fix getTitle in this case

* Add all text tests

* Reduce nesting

* Enable test

* Format code

* Add tests

* Rename function

* Format code

* Simplify code

* Add assertions

* Format code

* Add column assertions

* Run tests with all 3 aggregations

* Remove logs

* Introduce CUSTOM_EXPRESSIONS_USED

* Avoid force click

* Remove explicit assertion

* Use be.visible instead of exist

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-10 11:56:46 +00:00
Ngoc Khuat
35b8b8b814 Fix flaky skip-if-empty-test by making sure pulse card follow ordres (#43913) 2024-06-10 08:05:22 +00:00
Uladzimir Havenchyk
8f399a1b3e Replace deprecated option from typescript v5 with eslint rule (#43767) 2024-06-10 10:43:50 +03:00
Ngoc Khuat
7b919f8b27 Task history sorted by started at (#43809) 2024-06-10 06:17:16 +00:00
Ngoc Khuat
51098a6cfa If there is an error in sync processes, make sure we catch the right exception (#43821) 2024-06-10 05:39:12 +00:00
Jesse Devaney
c93403e98f Fix stacked bar chart tool-tips when total value is negative (#43883)
* fix stacked bar chart tooltips when total value is negative

* add E2E test
2024-06-10 03:01:19 +00:00
Nick Fitzpatrick
92242d99b0 43475 command palette icon tweaks (#43652)
* Initial commit

* unit test, always white on active

* Run Prettier 🙄

* removing yellow color from verified model icon

* linter and type fix
2024-06-09 10:14:10 -06:00
Nick Fitzpatrick
7f4fd36b4e Refresh on login when user locale is different from site locale (#43775) 2024-06-09 09:08:28 -06:00
Braden Shepherdson
522b0df40a [MBQL lib] Move the field_ref matching hack from #43848 (#43902)
I'm not sure it's any less hacky in the CLJS but it keeps the TS
wrappers thin.

Context:
- #43799 is the original issue
- #43848 added the hack being removed here
2024-06-08 11:15:33 -04:00
Aleksandr Lesnenko
85ba3ac755 add line symbol on hover (#43887) 2024-06-07 21:04:57 -03:00
Ryan Laurie
f54fd3b1b6 Combine actions e2e specs (#43846) 2024-06-07 17:07:37 -06:00
Alexander Polyankin
6dff2dfe7e Fix parameter mapping with models (#43848) 2024-06-07 22:47:49 +00:00
Raphael Krut-Landau
74500ba310 Micro-edit: spaces not white spaces (#43860)
This PR simplifies a bit of text used in the cache cron schedule component: we can say "spaces" (which is normal English) not "white spaces" (which is developerese)
2024-06-07 18:07:33 -04:00
Raphael Krut-Landau
4e81aed3fb Fix unit test (#43895) 2024-06-07 18:02:03 -04:00
Aleksandr Lesnenko
f307977168 reset series displays when changing card display (#43868) 2024-06-07 21:12:41 +00:00
Nemanja Glumac
1d904a7eff Use params instead of body in RTK Query GET requests (#43786)
Resolves #41511
2024-06-07 22:59:50 +02:00
Jeff Bruemmer
9e191a48e6 docs - line charts updates (#43845) 2024-06-07 20:59:21 +00:00
Raphael Krut-Landau
95adc26b34 recents (#42138) 2024-06-07 16:28:10 -04:00
Raphael Krut-Landau
1b164bf49d [Browse] Remove Metabase analytics models from Browse models (#43778)
Closes #43251
2024-06-07 16:24:24 -04:00
Noah Moss
2cb5dd1919 Move around audit content to make perm checks more consistent + general cleanup (#43693) 2024-06-07 15:52:45 -04:00
Nemanja Glumac
19e92f3ee0 Use RTK Query to obtain task/job information (#43798)
* Type `TaskInfo`

* Re-write `JobInfoApp` to use RTK Query

* Re-write `JobTriggersModal` to use RTK Query

* Remove unused `fetchJobInfo` action

* Remove `TaskApi` from `services.js`

* Remove `JobApp` styled component

* Simplify fetching logic
2024-06-07 19:20:50 +00:00
Nemanja Glumac
bbde8ff568 Upgrade @testing-library/cypress to v10.0.2 (#43842) 2024-06-07 21:03:32 +02:00
Jeff Bruemmer
e34d653777 docs - update upload setting metadata (#43855) 2024-06-07 19:01:01 +00:00
Sloan Sparger
296636e5a6 Fix CloudPanel unit flake (#43856) 2024-06-07 18:36:20 +00:00
Raphael Krut-Landau
9f27f3775f Fix typo (#43808)
Fixes a small typo
2024-06-07 14:35:18 -04:00
Mahatthana (Kelvin) Nomsawadi
dfdaab03b3 ci(sdk): Automate merging SDK doc PR (#43751)
* Automate SDK doc PR

* Prevent auto merge

* Dry run npm publish for testing

* Speed up testing by not building jars

* Fix auto approve step

* disable concurrency so I could test multiple runs in parallel

* Test auto-merge

* Fix auto merge

* Revert "disable concurrency so I could test multiple runs in parallel"

This reverts commit 60e90076eb.

* Revert "Speed up testing by not building jars"

This reverts commit 4e53a54414.

* Revert "Dry run npm publish for testing"

This reverts commit 9b5d761c8d.

* Enable all commented out steps

* Remove unnecessary steps
2024-06-07 17:18:14 +01:00
github-automation-metabase
e13c64ec2c Update Readme version references and published npm version to 0.1.8 (#43832) 2024-06-07 16:56:25 +01:00
Mahatthana (Kelvin) Nomsawadi
905625eb5a ci(sdk): Ensure we append new release to the chaneglog instead of overwriting it. (#43729)
* Mock that the changelog is different from the one in master

* Apply changelog patch incase the changelog is created from another branch

* Dry run npm publish so I could test

* Fix failed patch

* Speed up testing by not building jar

* Fix adding new changelog to master

* feat(sdk): A placeholder for an actual feature in the changelog

* Mock that the changelog diverges from master

* Revert "Speed up testing by not building jar"

This reverts commit acb80d7465.

* Revert "Dry run npm publish so I could test"

This reverts commit f4e679efd9.

* Revert "Mock that the changelog diverges from master"

This reverts commit 0e77a68e1b.
2024-06-07 16:15:53 +01:00
Phoomparin Mano
40d11066a9 Customize dashboard, dashcard and question background color for embedding SDK (#43618)
* dashcard background color

* add bg-dashboard and bg-dashboard-card

* rename background-visualization to background-question

* apply bg-question to embedded questions

* use CSS variables along with theme object

* add css variables to more places

* add ability to reference design system colors for defaults

* use CSS variables for defaults

* fix chart skeleton test

* fix legend item title
2024-06-07 22:07:27 +07:00
Alexander Solovyov
33df115357 [sync] parse naked json values (#43812) 2024-06-07 17:42:16 +03:00
Alexander Polyankin
2b01d9fd3c Remove unused containers/DataPicker (#43802) 2024-06-07 10:31:49 -04:00
Ryan Laurie
4520bf9324 Run smaller smoke test suite for pre-release check (#43633)
* run smaller smoke test suite for pre-release check

* fix run command
2024-06-07 08:14:12 -06:00
Alex Yarosh
0d4c0e7850 format sql (#43753) 2024-06-07 09:59:32 -04:00
Romeo Van Snick
ceeac2912c Merge combine column components (#43593)
* Move expressionClause to handleSubmit

* Allow passing the first column as a prop and allow auto picking of columns

* Use CombineColumns component in header drills

* Remove duplicate CombineColumnsDrill component and helpers

* Allow separators to be null

* Calculate example in Example component to avoid useMemo call

* Fix test reference in test

* Append suffix to duplicate columns

* Rename parameter to something more expressive

* Enable autoPickColumn for all instances of the combine column popover

* Fix tests

* Fix notebook tests

* Make test typescript

* Correct types of openTable function
2024-06-07 12:38:56 +02:00
Mahatthana (Kelvin) Nomsawadi
dd30ead9a8 Add single CORS origin limitation (#43805) 2024-06-07 09:08:21 +00:00
Cal Herries
3c97497126 Change MySQL ENUM columns to have base_type=type/TextLike (#43533) 2024-06-06 22:10:17 -06:00
Nemanja Glumac
25c4cb0bd8 Fix milestone reminder (#42861)
* Add a helper to extract linked issues from PR body

* Add tests

* Tweak the workflow

* Fix the workflow

* Delete obsolete code

* Improve the message

* Fix whitespace error
2024-06-07 00:44:55 +02:00
Jesse Devaney
f54e3d5a76 Fix RowChart X-Axis ticks formatter (#43783)
* fix RowChart XAxis ticks formatter

- remove scaling from x-axis tick values like we did for y-axis tick values in ECharts charts

* add loki variant
2024-06-06 18:26:54 -04:00
Jesse Devaney
486e3370af hide "show_series_values" setting when "show_values" setting is disabled (#43785) 2024-06-06 21:54:35 +00:00
Ryan Laurie
1e50d9f3a8 Send more tests to flake jail (#43761)
* mark more tests as flaky

* all the flakes
2024-06-06 15:40:05 -06:00
Aleksandr Lesnenko
e3f166bf7b fix timeline events covers series (#43780) 2024-06-06 21:00:03 +00:00
Nick Fitzpatrick
6d0f5e69d6 Add events to measure search performance (#43135)
* new_search_query event

* Filters in object, search click event

* updating event schema

* type and event schema adjustments

* delete comments BE code

* adjusting tests

* PR feedback

* typos and spacing
2024-06-06 17:40:27 -03:00
Sloan Sparger
c7048cf89e Add ts-pattern library (#43752) 2024-06-06 14:58:18 -05:00
SakuragiYoshimasa
49b126efcd Fix remaining tinyint booleans in MySQL (#43296)
* Correct type for `report_card.dataset`

This was missed in the original migration of boolean types to
${boolean.type} in MySQL/MariaDB, and then missed again by me when I
migrated `collection_preview` over a week ago.

* Change all boolean types to `bit(1)` in MySQL

Liquibase changed their boolean type in MySQL from `bit(1)` to
`tinyint(4)` in version 4.25.1. Our JDBC driver does not recognize these
as booleans, so we needed to migrate them to `bit(1)`s.

As discussed [here](#36964), we
changed all existing `boolean` types that were in the
`001_update_migrations.yml` but not the SQL initialization file.

For new installations, this works: things in the SQL initialization file
get created with the `bit(1)` type.

However, for existing installations, there's a potential issue. Say I'm
on v42 and am upgrading to v49. In v43, a new `boolean` was added.

In this case, I'll get the `boolean` from the liquibase migration rather
than from the SQL initialization file, and it need to be changed to a
`bit(1)`.

I installed Metabase v41 with MySQL, migrated the database, and then
installed Metabase v49 and migrated again. I made a list of all the
columns that had the type `tinyint`:

```
mysql> SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLUMN_TYPE,        COLUMN_DEFAULT, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_TYPE = 'tinyint' AND TABLE_SCHEMA='metabase_test';
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| TABLE_SCHEMA  | TABLE_NAME                   | COLUMN_NAME       | COLUMN_TYPE | COLUMN_DEFAULT | IS_NULLABLE |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
| metabase_test | core_user                    | is_datasetnewb    | tinyint     | 1              | NO          |
| metabase_test | metabase_field               | database_required | tinyint     | 0              | NO          |
| metabase_test | metabase_fieldvalues         | has_more_values   | tinyint     | 0              | YES         |
| metabase_test | permissions_group_membership | is_group_manager  | tinyint     | 0              | NO          |
| metabase_test | persisted_info               | active            | tinyint     | 0              | NO          |
| metabase_test | report_card                  | dataset           | tinyint     | 0              | NO          |
| metabase_test | timeline                     | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline                     | default           | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | archived          | tinyint     | 0              | NO          |
| metabase_test | timeline_event               | time_matters      | tinyint     | NULL           | NO          |
+---------------+------------------------------+-------------------+-------------+----------------+-------------+
10 rows in set (0.01 sec)
```

Then wrote migrations. For each column, we:

- turn it into a `bit(1)`,

- re-set the previously existing default value, and

- re-add the NOT NULL constraint, if applicable.

* Change author and add missing `dbms`

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-06-06 21:55:33 +02:00
Nemanja Glumac
2473fa2f8b Remove old repro for 39150 (#43749) 2024-06-06 21:53:50 +02:00
Phoomparin Mano
ea2d0a7e03 Highlight the table cell data in dashboards when the cell is an ID column (#43728)
* highlight id cell column

* add simpletable stories

* add simple table test data

* add loki reference image

* Update frontend/src/metabase/visualizations/components/TableSimple/TableCell.styled.tsx

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

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-06-07 02:20:44 +07:00
Ryan Laurie
8cb8d6405d Combine search e2e specs (#43718) 2024-06-06 12:05:33 -06:00
Raphael Krut-Landau
df62bb0cb4 Remove dead code (#43603) 2024-06-06 13:56:09 -04:00
Raphael Krut-Landau
e199d76e6f Fix width of save button in cache sidebar (#43755) 2024-06-06 13:53:02 -04:00
lbrdnk
4a88a0c86a Move database role to url parameters from connection properties on Snowflake (#43602)
* Move role to url parameters from connection properties

* Fix test
2024-06-06 19:34:06 +02:00
Ryan Laurie
2cdae6bc9a Update translations for v50 and add Danish Language Support (#43314)
* update translations for v50

* add Danish

* update translations for v50 release

* alphabetical order is nice
2024-06-06 17:30:05 +00:00
Ryan Laurie
7a9767e110 Consolidate joins specs (#43717) 2024-06-06 11:14:54 -06:00
Ryan Laurie
3d1cbd3b8e Consolidate dashboard-card specs (#43716) 2024-06-06 11:14:43 -06:00
metamben
8eeacc60c4 Hydrate can_run_adhoc_query and address review comments (#43747)
This is a followup on #43625.
2024-06-06 20:07:30 +03:00
adam-james
b8907454c9 Multi Series Dashcards Render with Filters Applied To All Series (#43428)
* Multi Series Dashcards Render with Filters Applied To All Series

Fixes: #39083

Multi-series dashcards now properly render when a subscription is set up with filters that impact the values of each
card in the multi-series card.

* Small refactor for executing dashcards in a pulse context.

- move execute-dashboard-subscription to pulse.util
- this fn now will also execute all card series cards
  and put those results into a list on the key :series-results in the dashcard
  which is then used in the render multimethod to send the correct data to the javascript context

A small todo was taken care of as well, we can now use :dashboard-subscription in the :context key

* Fix up render fn

The shape of hte data going into the javascript was a bit unclear before. This keeps things a little more
understandable.

Next step is probably to create some Malli schemas inside the js_svg namespace to document and enforce the needed data shapes

* pull :data up a level from :result in the series cards

* Update src/metabase/pulse/render/body.clj

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

* Remove unneeded let

* set/rename-keys won't work here because we raise the :data key

I've realised a suggested change to just use set/rename-keys won't do what we need. We need instead to raise :data
from within the result key up to the same level (and dissoc result).

I've renamed the helper function to make its purpose a bit clearer

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-06-06 09:58:58 -07:00
Alex Yarosh
60bb8d6158 update list of releases (#43754) 2024-06-06 12:44:51 -04:00
Ryan Laurie
5a481f98b8 use correct github api for CI (#43750) 2024-06-06 10:12:51 -06:00
Sloan Sparger
18d5388de0 Upgrade to TypeScript v5.4 (#43736) 2024-06-06 11:04:10 -05:00
Raphael Krut-Landau
080efbc837 [Browse] Show Browse models link in nav only when there are models (#43286) 2024-06-06 15:43:15 +00:00
Aleksandr Lesnenko
b9c10c5178 make compact formatting consistent across all series (#43472)
* make compact formatting consistent across all series

* fix rebase
2024-06-06 15:32:32 +00:00
metamben
2bfaab28e6 Batch load card metadata (#43625) 2024-06-06 11:04:46 -04:00
github-automation-metabase
56b3b5054f Update Readme version references and published npm version to 0.1.7 (#43734) 2024-06-06 16:04:34 +01:00
Mahatthana (Kelvin) Nomsawadi
3164995660 Reference new Metabase 50 RC version (#43735) 2024-06-06 15:26:14 +01:00
Ngoc Khuat
13e51d4ecc add mt/inbox as testing context for test helpers' (#43731) 2024-06-06 21:22:00 +07:00
Alexander Solovyov
74e524c057 do not output exceptions used only for tests (#43723) 2024-06-06 17:03:06 +03:00
Jeff Bruemmer
18581104b9 docs - models and caching (#43681) 2024-06-06 09:45:08 -04:00
Ryan Laurie
01840901fe Backport reminder bot (#43637)
* WIP backport reminder bot

* polish and automate backport reminder

* do better english
2024-06-06 07:12:46 -06:00
Ryan Laurie
4b66bdbabc Fix OSS tests in CI (#43660)
* fix OSS tests in CI

* update tests that went on vacation for a while

* do safer cypress things

* better helper name
2024-06-06 07:02:46 -06:00
Oisin Coveney
b87281c531 Update README to reflect API changes in Static Dashboard (#43727) 2024-06-06 13:00:09 +00:00
Alexander Polyankin
855c840bc2 Fetch ad-hoc query metadata on the BE (#43675)
* adhoc-query-metadata

* Get ad-hoc query metadata from the BE

* Fix broken ad-hoc queries

* Fix broken ad-hoc queries

* Fix tests

* Add a test

* Add tests

* Add tests

* Fix whitespace

* Fix whitespace

* Fix tests
2024-06-06 07:13:19 -04:00
Kamil Mielnik
49360f68bf Analytic events for time-over-time comparison (#43589)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Add tracking helpers

* Add new schema

* Add tracking in column header

* Add tracking in plus modal

* Add tracking in aggregation picker

* Fix destructuring

* Add functionsUsedByExpression

* Fix schema number

* Add tests boilerplate

* Implement test for notebook editor

* Add test for column header

* Add a test for summarize sidebar

* Add a test for the plus button

* Add expectNoBadSnowplowEvents call in afterEach

* Format code

* Add missing redux store state in tests

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-06 18:03:32 +07:00
Kamil Mielnik
54d9fb2257 Time-over-time comparison - Unit tests (#43653)
* Use createQueryWithClauses in createQueryWithCountAggregation

* Support column-specific aggregations in createQueryWithClauses

* Add tests for compare option presence

* Fix case

* Add a test for onAdd

* Split tests

* Rename tests

* Add boilerplate for CompareAggregations unit tests

* Fix assertion

* Add more tests

* Add offset input tests

* Add tests

* Update frontend/src/metabase/query_builder/components/CompareAggregations/CompareAggregations.unit.spec.tsx

* Update tests after merge

* Use constants instead of factory functions
2024-06-06 07:44:54 +00:00
Mahatthana (Kelvin) Nomsawadi
ac6bb7b452 Followed-up tasks for changelog generation (#43656)
* Check git tag for an exact match

* Set npm publish to dry run, so I can test

* Uses new github automation account for creating a PR

* Remove unnecessary step

* Automatically set `no-backport` on the SDK doc version bump PR

* Fix step to edit PR with correct permission

* Remove npm dry run after finished testing
2024-06-06 08:42:24 +01:00
Denis Berezin
e430b776e3 feat(sdk): SDK theming part 4 - danger, dark, error, filter, focus, saturated, shadow (#43608)
* Migrate danger

* Migrate dark

* Migrate error

* Migrate filter

* Migrate focus

* Migrate saturated

* Migrate shadow

* Fix CI

* Fix CI

* Fix CI
2024-06-06 03:26:18 +03:00
metamben
0ade074b53 Remove serdes support for legacy metrics (#43272) 2024-06-05 23:17:17 +00:00
Ryan Laurie
7789ce34bf move github-slack-map to fix release script build (#43692) 2024-06-05 21:48:57 +00:00
Denis Berezin
6fcbf23e54 feat(sdk): SDK theming part 3 - brand, brand-light, brand-lighter (#43598)
* Migrate brand

* Migrate brand-light, brand-lighter

* Fix unit tests

* Code review fixes

* Fix CI
2024-06-06 00:17:00 +03:00
Jesse Devaney
6ac4fe977f Fix column scaling ("Multiply by a number") bugs (#43668)
* return empty string so non-empty labels do not get hidden by empty labels

* fix function name

* apply scaling in transformed dataset

* add missing option to OptionsType

* fix double scaling

* add column scaling to waterfall transformed dataset

* add column value scaling to dataset transform

* fix stacked bar segment labels not responding to column scaling

* fix tooltip values displayed

* since scaling as added to transformedDataset, use transformedDataset for formatters

* revert changes to display percentage instead of absolute value

* fix stacked data labels

* add loki variant for custom y-axis range with column scaling

* fix stack segmented label formatters compact calculation

* scale original dataset and use that instead of modifying transformedDataset

* update loki snapshots

* fix scatter plot dataset scaling

* fix tooltip values being double scaled

* add E2E test to validate behavior

* add helper for not duplicating the column scaling

* port multiple y-axis metrics with column scaling fixes to RowChart

* add waterfall and scatterplot loki variants

* fix type errors and failing unit tests

* fix failing unit tests

* update loki snapshots
2024-06-05 16:47:49 -04:00
Nemanja Glumac
5bf50a2131 Add E2E reproduction for #39150 (#43610)
* Add E2E reproduction for #39150

* Fix typo in the test title

* Move the viewport config to the `describe` block

* Add the second repro scenario as per the review comment

* Scope the variable to the relevant test
2024-06-05 22:47:38 +02:00
Anton Kulyk
c7c5b3568b Fix long field names handling for series names and in the model editor (#43394)
* Fix long names in model editor

* Fix long names in series name input
2024-06-05 19:04:01 +00:00
Alexander Polyankin
13aae6632d Performance fix for getUrlWithParameters when there are no parameters (#43626)
* Simple performance fix for getUrlWithParameters

* Fix tests
2024-06-05 14:50:55 -04:00
Jeff Bruemmer
f05fa8e607 column heading options (#43409) 2024-06-05 14:09:09 -04:00
Dennis Schridde
937e30fbed Expose attached-dwh token feature flag to frontend (#43657)
This allows frontend code to conveniently check whether the feature
flag is enabled or disabled.  This is in addition to the raw flag's
presence (or absence) in `(:features token-status)`.

References: https://github.com/metabase/metabase/issues/42381
References: https://github.com/metabase/metabase/pull/43511
2024-06-05 19:55:17 +02:00
Denis Berezin
8659846f0b feat(sdk): SDK theming part 2 - bg-error, bg-medium, bg-night, bg-white, border (#43512)
* Migrate bg-error

* Migrate bg-medium

* Migrate bg-night

* Migrate bg-white

* Migrate border

* Fix CI

* Fix unit tests

* Fix unit tests

* Code review fixes

* Code review fixes
2024-06-05 20:26:09 +03:00
Chris Truter
50e4cf7798 More wiring and documentation around Macaw (#43580) 2024-06-05 17:02:05 +00:00
Chris Truter
2a260cc9ff Demonstrate nesting dynamic redefines (#43496) 2024-06-05 18:42:52 +02:00
Kamil Mielnik
f61a065796 Previous period comparison shortcut in chill mode - column headers (#43500)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Add compareAggregationsDrill boilerplate

* Add compare-aggregations drill stub

* Update comment

* Compute title and aggregation

* Add TODO

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Limit aggregation choice to 1 in compare aggregations drill

* Redirect to chart upon submission

* Do not navigate to chart view

* Do not navigate to chart view

* Make drill-thru tests expect the new compare-aggregations drill

* Add type attribute to all ListItems

* Add aggregationIndex to drillInfo

* Add aggregationDrillDetails and wire it up

* Fix destructuring

* Fix tests

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-06-05 15:53:51 +00:00
Oisin Coveney
5c5f6c39a1 fix(sdk): Fix static dashboard API (#43581) 2024-06-05 18:36:47 +03:00
Ryan Laurie
a691754a94 Add team devex (#43662)
* Add DevEx to team.json

* no trailing commas in json
2024-06-05 09:20:47 -06:00
Ryan Laurie
7251aa834c Put New Tests in Flake Jail + Parole Well Behaved Tests (#43623)
* tag flakiest tests as such

* let well behaved tests out of flake jail

* more bad actors off the streets

* add another flake

* sandboxes re-offended already
2024-06-05 07:40:45 -06:00
Alexander Polyankin
f28991450a Temporal unit parameters in dashboards (#43212) 2024-06-05 08:39:31 -04:00
Aleksandr Lesnenko
f025758d8f Set min bar height for non-zero bars (#43485)
* set min bar height for non-zero values

* fix y-axis split logic uses transformed dataset instead of actual data
2024-06-05 11:41:28 +01:00
Aleksandr Lesnenko
0fb138af86 Fix RowChart shrinks on hover (#43634)
* fix memoization

* extend the basic row chart e2e spec
2024-06-05 11:22:43 +01:00
Tim Macdonald
4ec415a024 Use a more obvious test error message (#43642)
(When scrolling through CI logs I always do a double-take when I see a
huge stack trace with "Just an error". I think this is a little
clearer?)
2024-06-05 10:15:18 +00:00
Oisin Coveney
7c636450c2 Convert Pagination Controls to TS (#43586) 2024-06-05 13:04:25 +03:00
Ngoc Khuat
b561b0111c Add inbox as testing context to debug flaky pulse tests (#43570) 2024-06-05 09:36:07 +00:00
Mahatthana (Kelvin) Nomsawadi
44fb3171f4 Fix flaky interactive-embedding.cy.spec.js (#43588)
* Fix flaky test

* Fix the flake for real

* Fix stress test failing because of mismatched height

* Review: Move viewport setting to shared config
2024-06-05 08:01:36 +00:00
Alexander Solovyov
1e4fe0f1b8 [cache] config should be editable if entity is accessible (#43522) 2024-06-05 08:35:41 +03:00
Ryan Laurie
03d60d8fed Make Backports Automerge Again (#43635) 2024-06-05 01:14:28 +00:00
Sloan Sparger
b97d9791ec uses data-autofocus attribute to avoid mantine modal moving focus to the modal close button (#43546) 2024-06-04 18:07:48 -05:00
Ryan Laurie
75fbccb765 Consolidate permissions e2e specs (#43552) 2024-06-04 15:52:39 -06:00
Ryan Laurie
68938adb0c Consolidate custom column e2e specs (#43616) 2024-06-04 15:52:00 -06:00
Ryan Laurie
fa0cf11b25 Combine e2e native filter specs (#43527)
* consolidate e2e native filter specs

* fix helper

* fix runQuery call
2024-06-04 15:51:47 -06:00
Ryan Laurie
590be77299 Consolidate dashboard e2e specs (#43613)
* consolidate dashboard e2e specs

* fix import
2024-06-04 15:51:35 -06:00
Ryan Laurie
ce5b1cfe2f Consolidate chart viz e2e specs (#43619) 2024-06-04 15:51:17 -06:00
Ryan Laurie
384af8167e Release from tagged test jars (#43545)
* allow releasing from tagged test jars

* always listen to nemanja

* use java 17
2024-06-04 15:29:55 -06:00
Jeff Bruemmer
5b5b05973e docs - license step (#43534) 2024-06-04 16:55:58 -04:00
Phoomparin Mano
9d61985fcc feat(sdk): font size scaling and adjustment for visualizations (#43264)
* support test utilities in sdk import

* add relative unit default chart font size in embedding defaults

* make font size follow sdk root

* feat(sdk): add font size settings to axis ticks

* feat(sdk): add font size settings to series labels

* re-add hasTimelineEvents from merge commits

* apply default font size at the theme level

* add table header cell font size

* calculate cell font size based on 12.5px

* rename theme.chart to theme.cartesian

* refactor visualization theme

* refactor default viz theme

* remove chart style config

* add goal line

* pass font size to chart measurements

* use px as reference unit

* support row chart viz

* add missing echarts font size

* add table cell font sizes

* use css variables for funnel color

* fix theme type in smart scalar story

* add bar chart to storybook for visual test

* add line chart to storybook for visual test

* add loki reference images

* add loki reference images for row chart

* add loki shared reference images to stories filter

* update loki reference image

* synchronize base font size

* add theme provider to funnel test setup

* add missing default visualization theme

* add unit test for get size in px

* update loki reference image

* fix static viz build error
2024-06-05 03:36:49 +07:00
Nick Fitzpatrick
7d0357d983 remove modified padding on ellipsifyed sidebar items (#43585) 2024-06-04 17:21:27 -03:00
Aleksandr Lesnenko
a727faddda loki CI improvements (#43607) 2024-06-04 15:49:00 -03:00
Jeff Bruemmer
d9aaa9fd43 docs - caching updates (#42857) 2024-06-04 13:25:10 -04:00
Case Nelson
cefd7a61e8 Add can_run_adhoc_query to Card hydration (#43464) 2024-06-04 11:04:03 -04:00
Jeff Bruemmer
c5404ea285 Docs env var info (#43150) 2024-06-04 14:43:18 +00:00
Raphael Krut-Landau
8b6a4c966e [Browse] Add brand-colored dot to filter icon when the filter is active (#43350)
Closes #42964
2024-06-04 10:33:42 -04:00
Ryan Laurie
91b4bd6b34 Add build requirements for v50 (#43537) 2024-06-04 08:07:11 -06:00
Ryan Laurie
d53b0a7a80 Consolidate sharing e2e specs (#43514) 2024-06-04 08:06:49 -06:00
Nicolò Pretto
fea8f89a57 temporarily removes the SameSite=None suggestion box (#43524)
* temporarily removes the SameSite=None suggestion box

* fix copy
2024-06-04 13:05:06 +02:00
Oisin Coveney
ecad0c94b5 fix(sdk): Fix map visualizations breaking (#43491) 2024-06-04 13:43:26 +03:00
dependabot[bot]
237a663b3a Bump mysql2 from 3.9.7 to 3.9.8 (#43446)
Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.9.7 to 3.9.8.
- [Release notes](https://github.com/sidorares/node-mysql2/releases)
- [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md)
- [Commits](https://github.com/sidorares/node-mysql2/compare/v3.9.7...v3.9.8)

---
updated-dependencies:
- dependency-name: mysql2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-06-04 11:18:03 +01:00
Kamil Mielnik
0da1dd1662 Previous period comparison shortcut in chill mode - "+" button (#43493)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Rename ExtractColumn to ExtractColumnAction

* Add lines.svg

* Fix positioning in case dir attribute is not present in any parent component

* Add CompareAggregationsAction

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Remove redundant Box

* Compute the title

* Use proper title when there's only 1 aggregation

* Show visualization on submit

* Do not navigate to chart view

* Add type attribute to all ListItems
2024-06-04 09:53:55 +00:00
Kamil Mielnik
6763b13cfc Update dead jetty docs links (#43573)
* Update dead jetty docs link

* Update dead jetty docs link
2024-06-04 16:43:22 +07:00
Nicolò Pretto
816e1b0dbc refactor public/embed reducers and related code (#43495)
* move parameters and dashboard reducers to the common ones as they're used everywhere

* convert reducers-{common,main,public}.js to typescript, done with --no-verify

* convert reducers to named exports
2024-06-04 10:39:00 +02:00
Kamil Mielnik
3305c815b0 Previous period comparison shortcut in notebook mode (#43220)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Add boilerplate for CompareAggregations

* Fix title

* Render aggregations list

* Style AccordionList

* Sort props

* Fix bucket name

* Use displayName instead shortName

* Support parseValue prop in NumberInput

* Add period input accepting integers only

* Accept non-negative values only

* Do not accept zeros

* Add state

* Add submit button

* Export offset functions via Lib

* Make it possible to skip rightSection

* Add column picker

* Map offset user input to api input (negative value)

* Add label

* Fix crash

* Extract shouldCreate

* Make onSelect in AggregationPicker support multiple values

* Extract ReferenceAggregationPicker

* Extract ColumnPicker

* Extract getAggregations

* Rename

* Add custom items

* Refactor item component

* Extract OffsetInput

* Remove unused data-testid

* Style OffsetInput

* Generate titles according to specs

* Generate label

* Generate help

* Extract utils

* Use different width for the 1st step

* Format code

* Use MultiSelect directly

* Avoid custom parseValue

* Revert MultiaAutocomplete changes

* Improve typing in describeTemporalInterval and
 describeRelativeDatetime

* Use describeTemporalUnit to pluralize

* Use interface

* Avoid setting value as DOM attribute

* Fix test

* Add onAdd prop to AggregationPicker and revert the change to have onSelect pass multiple aggregations

* Reduce number of props

* Render checkboxes in custom items

* Introduce and use --mb-color-brand-lighter

* Avoid !important

* Remove redundant prop

* Fix warning about isSelected being used as DOM attribute

* Fix positioning in case dir attribute is not present in any parent component

* Add type attribute to all ListItems
2024-06-04 08:15:47 +00:00
Raphael Krut-Landau
2f0bc49783 [Browse] Don't show filter icon when no models have been verified (#43284)
On the Browse models page we have a filter icon which opens a popover with a switch that toggles "Show only verified models". With this change, the icon is not rendered if there are no verified models at all.
2024-06-03 22:21:22 -04:00
Raphael Krut-Landau
85e113420d [Browse] Unify breadcrumbs into one link (#43313)
* [Browse] Unify breadcrumbs into one link

* Avoid !important
2024-06-03 22:08:48 -04:00
Aleksandr Lesnenko
95d4179e28 Amend stack values labels control copy (#43553) 2024-06-04 01:53:49 +00:00
Emmad Usmani
9c7e96a857 fix data labels under trend/goal lines (#42928)
* fix data labels under trend/goal lines

* fix fontFamily missing

* update specs

* fix type errors

* snapshots

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-06-03 22:09:06 +00:00
Cal Herries
9f73b0ceb8 Skip fingerprinting or scanning field values for fields with base_type=type/* (#43483) 2024-06-03 15:49:13 -06:00
Jeff Bruemmer
12e25b65a1 notes and links to relevant docs (#42975) 2024-06-03 16:56:24 -04:00
Jeff Bruemmer
3206c87a61 docs - druid jdbc and json unfolding (#43267) 2024-06-03 16:49:34 -04:00
Sloan Sparger
4c2aed648f Fix bulk action delete button hover contrast (#43518) 2024-06-03 15:19:31 -03:00
Ryan Laurie
f10ab55f8a Combine tabular viz e2e specs (#43519) 2024-06-03 11:34:07 -06:00
Nemanja Glumac
97fe4c437c Use actions/checkout@v4 everywhere (#43525) 2024-06-03 19:14:01 +02:00
Nemanja Glumac
34b6159658 Use actions/github-script@v7 everywhere (#43526) 2024-06-03 19:13:43 +02:00
Aleksandr Lesnenko
cb4264c6b3 measure auto compactness on correct values (#43477)
* measure auto compactness on correct values

* snapshots
2024-06-03 16:22:33 +00:00
Cal Herries
5c8de49521 Don't throw an exception when a non-existent setting is in the config file (#43425) 2024-06-03 09:44:32 -06:00
Cal Herries
6bf7bfca9a Catch exceptions from driver/database-supports? outside driver code (#43429) 2024-06-03 09:44:06 -06:00
Denis Berezin
d228123152 feat(sdk): SDK theming part 1 - black, bg-light, bg-dark, bg-black (#43413)
* Convert black

* Convert bg-light

* Convert bg-dark

* Convert bg-black

* Fix CI

* Fix CI

* Fix tests

* Update visual test fixtures

* Fix visual tests
2024-06-03 18:29:33 +03:00
Ryan Laurie
32011873b1 Tag slack users by github handle (#43420)
* tag slack users by github handle

* sort users
2024-06-03 08:49:29 -06:00
Aleksandr Lesnenko
d19ad598b2 fix stacked data labels on ordinal charts (#43469) 2024-06-03 11:20:53 -03:00
Chris Truter
fa90376b08 Populate Macaw options based on database type (#43460) 2024-06-03 16:06:16 +02:00
Noah Moss
2c3c328472 Populate collection search results with effective parent (#43331)
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-06-03 09:55:59 -04:00
Kamil Mielnik
81621016d4 Revert "Copy question link from dashboard (#42892)" (#43499)
This reverts commit e7948a7249.
2024-06-03 13:49:35 +00:00
Nemanja Glumac
d67f3f5d99 Fix invalid input in the "build for release" action (#43492) 2024-06-03 13:28:37 +02:00
Ngoc Khuat
03d5dec982 Fix mariadb failed to migrate due to having deep nested revision (#43434) 2024-06-03 05:23:54 +00:00
Jesse Devaney
72443c62b1 Fix data labels too dense with large single series (#42985)
* remove unused variable

* conditionally render labels sparsely if large amount of data points

* update loki snapshots

* refactor data label formatter conditions

* setup intelligent label plotting

* handle the case when there are no labels

* add sparse data label rendering to bar charts

* do not compute if no labels need to be shown or hidden

* add sparse data labeling to waterfall charts

* adjustment for large series waterfall labels

* revert change

* refactor name

* add sparse labels to stacked bar and area

* improve scaleFactor

* fix type errors

* remove unused labelFormatter

* update snapshots

* patch ECharts

- labels with no text, i.e. "", were still being considered as plot-able labels which was causing labels with real text "asdfec.." to be hidden because of overlap.
- This patch makes it so that labels with no text, i.e. "", are not considered to be candidates for overlap checking.

* update loki snapshots

* only loop over dataset once for getWaterfallChartDataDensity

* improve performance of chart data density calculations

* update loki snapshots

* update E2E spec

* update E2E spec

* increase cartesian label density allotment

* update loki snapshots

* update loki snapshots

* comment out node_modules cache since it cannot be skipped by commit and is breaking CI

* fix type errors

* Reset node modules if patches are changed

* refactor type naming

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-06-01 06:05:22 +00:00
Cal Herries
2c1333ebb6 Only log views for cards in a dashboard if the user views the tab (#43102) 2024-05-31 17:51:41 -06:00
Case Nelson
68435f9091 Single metadata endpoint for cards (#43405) 2024-05-31 23:32:44 +00:00
Sloan Sparger
d5280c6bcf Fixes LDAP admin settings form not allowing modification if a custom port is set (#43476) 2024-05-31 23:26:37 +00:00
Ryan Laurie
7038b2e4c2 Combine Filters Reproduction into new e2e job (#43328)
* combine reproductions into new filters e2e job

* fix import

* gee thanks sloan
2024-05-31 14:16:40 -06:00
Cam Saul
3d0bc85a5b Kondo linter tests for :metabase/validate-logging (#43104)
* PoC Kondo linter test

* Log linter tests

* Remove fail-test
2024-05-31 20:12:28 +00:00
Vamsi Peri
a3f19cd8c5 Updated the QPD team board (#43466) 2024-05-31 18:02:31 +00:00
Chris Truter
70c1474c87 Handle MySQL quotes when resolving analyzed fields (#43447) 2024-05-31 17:42:30 +00:00
metabase-bot[bot]
6b59534f39 Update SDK version to 0.1.6 (#43457)
* Update Readme version references and published npm version to 0.1.6

* Update SDK Changelog

---------

Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Alberto Perdomo <albertoperdomo@users.noreply.github.com>
2024-05-31 17:13:53 +00:00
Uladzimir Havenchyk
e5aa995590 Optimize dashcard rendering in edit mode (#43431)
* Avoid unnecessary re-renderings in dashcards

* replace useCallback with useMemo

* Optimize dashcard rendering in edit mode
2024-05-31 16:58:12 +00:00
Ryan Laurie
557e6ead6a Add Advanced Cache Upsell (#43099)
* add hook to check token features

* add cache upsell to performance page

* upsell cards are white

* fix rebase
2024-05-31 10:30:58 -06:00
Oisin Coveney
d711251a70 fix(sdk): Add Static Dashboards to README (#43392)
* fix(sdk): add Static Dashboards to README

* Add more clarification comments for API

* Clarify dashboard ID type

* Prevent crashing SDK static dashboard if not provided optional values

* Document fallback behavior for `font`

---------

Co-authored-by: Mahatthana Nomsawadi <mahatthana.n@gmail.com>
2024-05-31 16:12:28 +00:00
Uladzimir Havenchyk
55c00bdd90 Avoid unnecessary re-renderings in dashcards (#43323)
* Avoid unnecessary re-renderings in dashcards

* replace useCallback with useMemo
2024-05-31 18:33:28 +03:00
Kamil Mielnik
1947328ed9 Repro #37380 - Users with no self-service access may update pivot tables and leave them in a non-working state (#43437)
* Fix crash and remove redundant casting

* Add repro for metabase#37380

* Be extra-safe with an empty array
2024-05-31 15:16:10 +00:00
Mahatthana (Kelvin) Nomsawadi
78db8c4916 ci(sdk): Autogenerate changelog on build (#43364)
* Auto tag embedding team for PR review + dry run npm publish

* Install changelog generation package

* Add the initial changelog

* feat(sdk): This is an empty commit. For testing purposes.

* Update SDk build script to include changelog

* Check if a tag exists

* Ensure changelog is in the released package

* Fix workflow

* Remove unnecessary step

* Ensure we can have access to release utils script when checking out master

* Fix the step to create a PR updating readme and changelog

* Fix changelog generation

* Fix couldn't download changelog

* Clean up steps
2024-05-31 16:03:06 +01:00
Emmad Usmani
c1f1d98381 remove accidental comment from scatterplot model (#43423) 2024-05-31 07:58:17 -07:00
Nick Fitzpatrick
ead905b105 React 18 (#41975)
* initial commit with most types sorted

* admin, binning, collections, custom-column and dashboard-cards suites

* Filters, Joins, Metrics, Models, Native and Native filters suites

* rest of e2e specs

* filters, actions, onboarding and custom column will hopfully be green?

* fixing static viz, brush filtering, login redirecting, and a few other tests

* types green

* linter green

* hopefully fixes filter tests

* I don't often cry, but when I do it's because of filter-types

* hopfully sorted the last test that's failing CI

* PR Feedback

* yarn prettier

* React 18 Upgrade - Unit Tests (#41577)

* fixes for most unit tests to work with react 18 + upgraded rtl to v15

* fixes all unit tests locally

* fixes from rebasing

* linter shames me

* fix flake in maps.cy.spec.js

---------

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-05-31 11:56:05 -03:00
Noah Moss
86b8825996 Bump nippy to 3.4.2 (#43444) 2024-05-31 14:50:01 +00:00
Romeo Van Snick
af6cecb863 Show the columns for the correct stage when using combine/extract in the presence of an aggregation (#43226)
* Do not use asReturned to determine columns for extractions and combine columns

* Add reproduction for #43226 for combine columns

* Add reproduction for #43226 for extract columns

* Remove commented out code

* Only render extraction shortcut when there are extractions

* Only render combination shortcut when there are combinations

* Use hasCombinations from CombineColumns

* Add hasExtractions from ExtractColumn

* Use appendStageIfAggregated over Lib.asReturned

* Only show combine column shortcut when there are two or more columns to be combined

* Lift appendStageIfAggregated to top-level drill

* Add test for extraction on table with just breakout

* Add test for combinations on table with just breakouts

* Disable the 2-column requirement for combinations

* Remove Lib.asReturned in appendStageIfAggregated

* Remove + 1 to stageIndex in appendStageIfAggregated

* Check for empty breakouts too in as-returned

* Switch back to Lib.asReturned

* Fix test for combine column on breakouts

* Reference the correct query and stageIndex

* add CLJS unit tests for as-returned with only aggs, breakouts

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-05-31 16:49:21 +02:00
Kamil Mielnik
9378e28ed4 Fix unit tests running multiple times in watch mode (#43445)
* Fix unit tests running multiple times in watch mode

* Ignore even more
2024-05-31 14:44:54 +00:00
Oisin Coveney
c3c65abdf0 #41973 Improvements + Convert PublicQuestion to TS (#43361) 2024-05-31 17:11:17 +03:00
Uladzimir Havenchyk
862ca7ea27 Optimize imports from collection (#43241) 2024-05-31 13:50:48 +00:00
Alexander Polyankin
780532543c Move loading of linked targets metadata to the BE (#43380) 2024-05-31 09:26:44 -04:00
metamben
3b6def1eb7 Support string operations on postgres UUIDs (#43417)
Fixes #40176.
2024-05-31 14:45:22 +03:00
Braden Shepherdson
54c8f9bac4 [QP] Drop last stage aggregations for questions in chain filtering (#43274)
Models are treated as opaque here, but for a saved question we expose
filters on the query before its final aggregation step.

This drops the aggregation clauses and gets the possible values for the
column of interest.

Fixes #43154.
2024-05-31 07:43:19 -04:00
Cam Saul
d6381501e9 Rework Kondo defendpoint custom macro to be a custom hook instead (#43411) 2024-05-31 13:26:24 +02:00
Nicolò Pretto
ea7bd55939 PublicDashboard -> PublicOrEmbeddedDashboard (#43302)
* PublicDashboard -> PublicOrEmbeddedDashboard

* file renames and some fixes for PublicOrEmbeddedDashboard

* PublicQuestion -> PublicOrEmbeddedQuestion (file renames)

* PublicDashboard -> PublicOrEmbeddedDashboard

* isPublic prop -> isPublicOrEmbedded in Dashboard and Dashcard
2024-05-31 12:45:04 +02:00
Mahatthana (Kelvin) Nomsawadi
0e8d4f8acf Add SDK changelog (#43433) 2024-05-31 09:04:44 +00:00
Phoomparin Mano
badf8b957b Update the SDK docs to point to v1.50.0-RC1 and add note on height customization (#43383)
* update jar and docker version in sdk readme

* add notes on customizing the component height
2024-05-31 12:55:07 +07:00
metamben
67ae7aded0 Remove redundant field from select (#43396)
This is just removing a duplicate field from a select clause.
2024-05-30 23:35:40 +00:00
Sloan Sparger
2bd4c9b59a Improve haveDashboardCardsChanged util permformance (#43422) 2024-05-30 23:21:03 +00:00
adam-james
42b6edb8c4 Multiple Measures Requires Additional Header Row in Pivot Exports (#43322)
* Multiple Measures Requires Additional Header Row in Pivot Exports

Mulitple measures can be set in our pivots. We indicate these properly in the fronted with a header row that shows
which measure is reprsented in that particular column.

The header builder fn in the pivot export post processing didn't handle this case, but after this PR, it correctly
adds the final header when necessary.

* Fix up header tests

* Remove comment form; the tests are derived from that work already
2024-05-30 21:52:24 +00:00
Aleksandr Lesnenko
642a704e66 support stacked series values labels (#42803) 2024-05-30 20:59:50 +00:00
Braden Shepherdson
246f9b55ac [drivers] Enable :regex feature for MySQL (and MariaDB) (#43269)
These databases previously had impoverished support for regular
expressions. The `:regex` driver feature requires advanced,
"Perl-compatible" regular expressions that can do things like lookahead
assertions.

- MySQL supports this from 8.0.4; we recommend 8.0.33+.
- MariaDB supports this from 10.0.5; we recommend 10.4+.

Fixes #43180.
2024-05-30 16:13:29 -04:00
Aleksandr Lesnenko
f83080071b fix waterfall chart timezone issues, bar widths (#41671) 2024-05-30 17:04:32 -03:00
Ryan Laurie
f143179759 Fix merge-conflicted e2e tests (#43404) 2024-05-30 19:50:30 +00:00
Romeo Van Snick
378f0de215 Fix timeseries chrome overflow (#42761)
* Avoid overflowing dropdown menus

* Hide most bucket picker items behind a More... button

* Add test for More… button on TimeseriesBucketPicker

* Add color to More... button

* Add test for showing all columns when a lower bucket is picked
2024-05-30 21:23:55 +02:00
metamben
e53aeff946 Move models.interface test to the right namespace (#43398) 2024-05-30 19:00:28 +00:00
Anton Kulyk
a39055459c Fix duplicate filter panels in fullscreen dashboards (#43370) 2024-05-30 19:58:40 +01:00
Cam Saul
52d5ccfaff Remove Google Analytics driver (#43352)
* Remove Google Analytics driver

* Remove more GA-related tests

* Un-remove tests that aren't related to GA
2024-05-30 18:22:11 +00:00
Chris Truter
6f2535e8d5 Update macaw for qualified rename support (#43195) 2024-05-30 17:24:35 +00:00
bryan
3b2736c22e CRU card events will log recent-views, and get returned through the API (#43037)
* Handles card events for CRU (not D) => recent view

* add tests

* avoid some errors in dev

We expect recent-views/post-process to return nil occasionally (for
permissions reasons, or more), so let's filter those out instead of
printing a noisy unactionable warning

* uncomment and fix test

* fix some cypress tests + docs improvements

* update more cypress tests

* more cypress test updates

* adding a card puts it into your recents now

* fix notebook-data-source

* fix notebook-data-source

* fixing more e2e tests

* fix command palette e2e tests

* run prettier

* fix style issue

* update notebook-data-source tests

* update homepage e2e tests

* Next question is in recents, now

* update command palette: skip the first pagedown, since it is a noop

* check the buttons for their respective names

* ensure that the model is there, and no questions are
2024-05-30 11:05:30 -06:00
Sloan Sparger
63ecb0a303 Prep unit tests for React 18 upgrade (#43375)
* pulls out test changes from react 18 / rtl 15 refactor that are comptable with react 17 / rtl 12

* impls pr feedback
2024-05-30 16:53:51 +00:00
Anton Kulyk
b1eca0f9b7 Keep a single null dimension value (#43246)
* Keep a single null dimension value

* Add Loki test

* Remove Loki test

* Throw an error if dataset is empty after filtering

* Extract error message into a constant
2024-05-30 17:11:59 +01:00
Romeo Van Snick
a4add27807 Minor design updates to multi select (#43292)
* Add color to icon directly

* Remove unused css file

* Only show info icon when the field is focussed

* Use metabase blue for background on value tags

* Use larger font size for value labels

* Make the value labels bold

* Tweak padding on search input

* Move custom MultiAutocomplete styles to MultiSelect overrides and adapt to accept xs size too
2024-05-30 15:16:30 +00:00
Uladzimir Havenchyk
beba8d5c01 Optimize DashboardHeader rendering by using selector (#43123) 2024-05-30 15:14:53 +00:00
Uladzimir Havenchyk
b62726d36d Avoid heavy calculations on dashboard fetching (#43340) 2024-05-30 17:33:56 +03:00
Anton Kulyk
1610201fba Revalidate x-axis scale when graph.dimensions change (#43254) 2024-05-30 15:30:13 +01:00
Alexander Polyankin
0975be548c Force loading metadata before queries (#43369) 2024-05-30 10:24:49 -04:00
metamben
24ec71c88e Leave viz-setting part as is if normalization fails (#43336)
Fixes #43089.
2024-05-30 16:46:04 +03:00
Ryan Laurie
b77443a410 Combine models repro specs (#43342) 2024-05-30 07:10:24 -06:00
Ryan Laurie
f134831a71 Combine question e2e reproductions into fewer specs in a different job (#43271)
* combine question reproductions into one spec

* split question reproductions

* split reproductions three ways

* fix sample db id
2024-05-30 07:10:12 -06:00
Alexander Polyankin
520c7dc94f Fix getMappingOptionByTarget perf (#43339) 2024-05-30 12:37:26 +00:00
Anton Kulyk
7463c67887 Fix relative/internal links in table viz (#43303)
* Use internal Link for relative and same-origin URLs

* Update frontend/test/metabase/lib/formatting.unit.spec.js

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

* Update frontend/test/metabase/lib/formatting.unit.spec.js

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

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-05-30 13:04:27 +01:00
Alexander Polyankin
85b053b77f Load metadata before queries (#43354) 2024-05-30 11:32:42 +00:00
Phoomparin Mano
b55e141fe8 feat(sdk): pivot table color customizations (#43201)
* feat(sdk): colors for pivot tables

* fix theme type

* feat(sdk): basic pivot table theming

* fix emphasis hover color

* customizable row toggle color

* add storybook story and refactor hover color logic

* add sdk visualization wrapper

* make theme values with defaults internally non-optional but externally optional

* update test to render with providers

* update test wrapper to have height container

* update pivot table loki reference image

* update theme names

* make all theme options optional in the public config

* update readme

* readme update for consistency
2024-05-30 11:24:43 +00:00
metabase-bot[bot]
7737d3c857 Update Readme version references and published npm version to 0.1.5 (#43035)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-05-30 12:05:48 +01:00
lbrdnk
127d2626e5 Backfill :effective-type for coerced fields (#43144)
- Update how base type and effective type is added in query-method :mbql/query.
- Base type and effective type is added also during the conversion of query-method :query.
- Adds warning suppression for expressions to places where normalize is 
  called something that does not conform schme (eg. ->pMBQL :dispatch-type/map called
  in query-method :query).
2024-05-30 09:31:01 +02:00
Cal Herries
07dae0a6b6 Fix not being able to upload to a table if the uploads database has switched (#43026) 2024-05-30 00:11:34 +00:00
Sloan Sparger
bee66b406b [WIP] Cloud migration v3 (#43047)
* syncs with BE better for using prod/staging store links

* updates init step, fixes tests

* updates start confirmation modal design

* copy changes

* adjusting unit test

* removing unneeded code

* PR feedback, updating tests

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-05-29 23:26:02 +00:00
Case Nelson
f811b08b6d Single metadata endpoint for a dashboard (#43283) 2024-05-29 21:21:04 +00:00
Alexander Polyankin
84952a7f2b Do not use MBQL lib for parameter fields in dashboards when possible (#43312) 2024-05-29 15:44:43 -04:00
Braden Shepherdson
a672996a96 [MBQL lib] Add preview-query to truncate a query for Notebook preview (#42836)
Fixes #42831.

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-29 19:24:22 +00:00
Aleksandr Lesnenko
4c2d2400f9 fix edit hash is not removed after editing a dashboard (#43213) 2024-05-29 14:45:28 -03:00
Oisin Coveney
d0314b2e9c feat(sdk): Add static dashboards to embedding SDK (#41973) 2024-05-29 20:40:30 +03:00
Filipe Silva
96b357a625 cloud migration rc1 (#43082) 2024-05-29 18:11:58 +01:00
Anton Kulyk
10fee384b2 Add font fallbacks to charts rendering context (#43315)
* Use `useBrowserRenderingContext` in most charts

* Add font family fallbacks
2024-05-29 17:14:53 +01:00
John Swanson
8cfca2c6ef Allow disabling encryption for settings (#43085)
* Allow disabling encryption for settings

For two settings, we want to disable encryption entirely.

On the way out of the data source, we don't need to worry - the
decryption is already backwards-compatible with non-encrypted data.

On the way in, things are a bit less straightforward. The core of the
change is replacing the `t2/deftransform` that *always* runs
`encryption/maybe-encrypt` on the value with:

- a define-after-select that always tries to decrypt the value (so we
can handle existing encrypted values in the db)

- a define-before-insert that encrypts the value if the `defsetting`
told us to, and

- a define-before-update that does the same thing.

For now, set two settings to be never-encrypted: `analytics-uuid` and
`anon-tracking-enabled`.
2024-05-29 08:41:50 -07:00
Kamil Mielnik
cb828242f3 Time-over-time comparison aggregation helpers (#43081)
* Sort functions

* Add boilerplate for aggregateOffset and tests

* Simplify assertion

* Make basic case work

* Handle name generation

* Do not require "lib/uuid" attribute to be present since MLv2 will normalize it under the hood anyway

* Fix typing

* Group tests

* Refactor offsetClause to return a new clause instead of a new query
- Move offsetClause to expressions.ts
- Add assertion

* Revert "Sort functions"

This reverts commit ab9ce2b24e.

* Move tests

* Handle names dynamically

* Shorten a test

* Update comment

* Add TODO

* Update expression types

* Add diffOffsetClause & percentDiffOffsetClause

* Add a test for diffOffsetClause

* Add TODOs

* Add tests for diffOffsetClause and percentDiffOffsetClause

* Unwrap tests

* Add skeleton for new tests

* Refactor first offsetClause tests

* Add tests for names

* Fix case of non-datetime columns

* Handle a case with offset < 1 and no breakouts

* Handle a case with offset < 1 and breakouts on non-datetime column

* Handle a case with offset < 1 and breakouts binned datetime column

* Handle a case with offset < 1 and breakout on non-binned datetime column

* Refactor

* Refactor

* Remove TODO

* Add tests for diffOffsetClause

* Add tests for percentDiffOffsetClause

* Move offset stuff to offset.ts and offset.unit.spec.ts

* Use template string for prefixes

* Use breakoutColumn + isDate to check column type

* Refactor

* Fix error message

* Use displayName instead shortName
2024-05-29 21:41:42 +07:00
Romeo Van Snick
c25c32a552 Update expression suggestion design (#43232)
* Use sentence case for suggestion headers

* Remove suggestion group dividers

* Highlight suggestions when mousing over them

* Remove unused hoverparent

* Remove custom highlighting for icons

* Allow passing color to metadata info icon

* Make suggestions icons have a consisten color

* Update documentation suggestion style

* Add margin to suggestion sections

* Reorder suggestion sections

* Add test for mouse over highlight on suggestions

* Fix test for suggestion footers

* Remove debugging true

* Rename 'Most used functions/aggregations' to 'Common functions/aggregations'

* Highlight suggestion on mouse move

* Only call onHighlightSuggestion if it is not already highlighted

* Use arrow functions

* Fix test for suggestion highlight
2024-05-29 11:00:55 +00:00
Romeo Van Snick
58867ab701 Correctly place "Add column" button and allow using it when summarizing (#43189)
* Do not render 'Add column' shortcut when viewing a raw table

* Do not show 'Add column' shortcut when a query has aggregations

* List shortcut guards out of component

* Make 'Add column' icon sticky in the header

* Add test for hiding the column shortcut

* Remove Number wrapper

* Move padding to a constant

* Use actions directly to determine if there are any shortcuts

* Make sure there are expressionable columns for the combine columns shortcut

* Make sure there are extractable columns for the extract column shortcut

* Remove padding when not overflowing

* Do not shadow query in popover components

* Allow combine and extract for raw tables

* Add test for combining summarization columns

* Add test for combining summarization columns

* Use a more precise way of calculating the offset for the 'Add column' button

* Handle null question

* Change to the outline button

* Use actual column widths to calculate total width

* Handle empty mode

* Remove extra measure call

* Move shortcutColumn to separate method and avoid looping over all available actions when possible
2024-05-29 11:02:53 +02:00
Nicolò Pretto
d187cadbde Fix multiple origins support by handling invalid origins (#43170)
* Revert "Revert "minimal support for multiple values for Access-Control-Allow-Origin (#42888)" (#43125)"

This reverts commit a4312230a8.

* refactor: extracted parse-approved-origins + supported "*" without special case

* fix: parse-approved-origins won't break on multiple spaces in a row

* handles invalid urls in the origins + some formatting

* log instead of throwing in parse-url + simplify the logic in parse-approved-origins

* simplify parse-approved-origins logic by splitting on "at least one space"

* remove extra boolean call

* approved-origins -> approved-origins-raw to better reflect that it's a raw string

* swap the order of the arguments to `is` in the tests

* indentation 🙃
2024-05-29 07:59:33 +02:00
Phoomparin Mano
fdfcf63573 support test utilities in sdk import (#43242) 2024-05-29 12:53:20 +07:00
Raphael Krut-Landau
505d43496b Move model caching form to Admin / Performance (#43143) 2024-05-29 03:15:24 +00:00
metamben
dcb9713d56 Return card type in GET /api/table/card__:id/query_metadata (#43203)
* Return card type in GET /api/table/card__:id/query_metadata

Also, stop requesting card metadata in dependent-metadata.
2024-05-29 02:10:57 +03:00
Ryan Laurie
61c778c1cd Improve models table performance (#43149)
* improve models table performance

* add loading state for large sets of models

* less icon padding
2024-05-28 22:53:30 +00:00
Raphael Krut-Landau
b9d037f60b Tweak appearance of cache page and form (#42856)
* squashed branch

* fix form buttons and formpadding

* fix some tests
2024-05-28 17:30:50 -04:00
Aleksandr Lesnenko
c75cbe65da use automation user PAT when creating commits in CI workflows (#43250) 2024-05-28 18:29:52 -03:00
Anton Kostenko
35a6544b79 Add Git repo SHA to the final image for future tracking (#43260) 2024-05-28 20:47:23 +00:00
Ryan Laurie
cd53c8af5d entityPicker in technicolor (#43161)
* entityPicker in technicolor

* more precise import

* add unit test
2024-05-28 20:45:58 +00:00
Chris Truter
bc3ce713db Upgrade zx from 7.2.3 to 8.1.0 (#43054) 2024-05-28 14:04:56 -06:00
Cal Herries
2c75a0c66a Fix a couple of flaky tests using with-call-count (#43248) 2024-05-28 13:22:06 -06:00
Alexander Polyankin
1712e03e79 Fix parameter matching with model columns (#43204) 2024-05-28 14:36:15 -04:00
Ryan Laurie
0e66b0d19a Use table2 icon for questions (#43095)
* use table2 icon for questions

* update e2e tests
2024-05-28 11:05:44 -06:00
Jeff Bruemmer
1670832a39 docs - app db note (#43239) 2024-05-28 13:04:47 -04:00
Cal Herries
8b82721dc9 A couple of changes to the sample content (#43200) 2024-05-28 16:24:25 +00:00
Jesse Devaney
8770ea27f0 Implement graceful error handling for trend charts (#43090)
* fix trend charts erroring on latest value being null

* refactor previousRowIndex calculation

* handle errors gracefully

* refactor error messages

* update computeTrend unit tests

* add error handling integration test

* add E2E test to check that errors are gracefully handled

* add integration test to enforce the fix

* fix static viz

* display more meaningful error on static-viz trend charts

* move error handling out of trend chart and fix error handling in Visualization.tsx

* update compute.unit.spec.js

* update SmartScalar.unit.spec.js

* use separate error handler for ErrorBoundary errors in Visualization.jsx

* update E2E test

* update error handling

* update compute.unit.spec.js

* fix react state change error in render function

* show generic error message for ErrorBoundary caught errors

* revert ErrorBoundary changes

* remove generic error border for visualizations
2024-05-28 11:41:31 -04:00
Jeff Bruemmer
cebf9a9622 add 49.12 to list of releases (#43236) 2024-05-28 15:04:03 +00:00
Phoomparin Mano
8fc52d228b feat(sdk): expose color and typography options for smart scalar in embedding SDK (#42915)
* feat(sdk): allow overriding positive and negative values

* docs(sdk): add positive and negative colors to docs

* feat(sdk): add smart scalar font size

* feat(sdk): add smart scalar line height settings

* feat(sdk): get rid of custom embedding mantine theme type

* wip: setup storybook and loki for smart scalar

* fix missing state for rendering visualizations

* docs(sdk): add scalar customizations to readme

* test(sdk): add test cases to loki

* add smart scalar reference image

* use css variables for brand

* make embedding theme options partial

* fix scalar value wrapper line height

* update loki snapshot

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2024-05-28 14:17:58 +00:00
Kamil Mielnik
3b3dcd8647 Disable offset() in custom columns (#43224)
* Disable offset in custom columns

* Remove .only

* Update CLJS tests
2024-05-28 21:08:37 +07:00
Uladzimir Havenchyk
33bb0759c5 Do not ignore icon prop on the Filter button (#43229) 2024-05-28 16:30:49 +03:00
Oisin Coveney
ed3cfb6087 Convert ParametersList to TS (#42822) 2024-05-28 15:20:20 +03:00
Alexander Solovyov
0bd7db0f18 [serdes] unify snowplow analytics in a single event (#43218) 2024-05-28 12:18:22 +00:00
Anton Kulyk
cc660510ed Fix rare axis ticks for timeseries axes (#43127)
* Fix typos

* Tweak `maxTicksForChartWidth` calculation

* Update Loki screenshots

* Tweak `PIXELS_PER_CHARACTER`

* Update test
2024-05-28 13:15:13 +01:00
Romeo Van Snick
b6bb9d184e Allow creating new items by inserting comma in MultiAutocomplete (#42824)
* Pass current values to shouldCreate

* Allow comma to create new item

* Simplify getAvailableSelectItems

* Add unit test for MultiAutocomplete input

* Use text instead of Text in paste

* Handle spaces in MultiAutocomplete

* Remove cast

* Reuse last var

* Use haveLastBeenCalledWith over haveBeenCalledWith

* Handle pasting when there is text in the input already

* Accept quote-delimited values

* Add info icon

* Handle tab as a separator

* Fix test cases for unsanitized parseValues

* Add csv-parse

* Use csv-parse to parse values

* Apply the correct color to the info icon

* Rename util to utils

* Break up tooltip text

* Only return unique values

* Be more accepting around quotes in the middle of unescaped values

* provide Buffer for csv-parse package in storybook

* Use browser-friendly version of csv-parse

* Remove unused eslint rule

* Add specital case for csv-parse to jest config

* Put uniqueness check in each state update

* Only add partial value if it is valid

* Only add partial value if it is valid

* Fix test case for FilterValuePicker

* Just use Set

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

* Allow parsing more than one value

* Use isValid everywhere it makes sense

* Add test for RTL languages

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-28 13:43:10 +02:00
Kamil Mielnik
e7948a7249 Copy question link from dashboard (#42892)
* Remove dead CSS

* Use proper types

* Properly type parameterValues

* Add href prop support to LegendCaption

* Extract getNewCardUrl
- move getParametersMappedToDashcard

* Use href in CartesianChart

* Handle RowChart

* Handle Funnel

* Format code

* Fix types

* Update first test in title-drill

* Update test

* Update test

* Update tests
- pass questionId in createQuestionAndDashboard

* Add test for links

* Fix createDashboardWithQuestions

* Add missing click handler

* Fix crash

* Fix typo

* Add a workaround for #42999

* Fix tests

* Fix hover color

* Update comment

* Get rid of mapStateToProps in DashboardGrid

* Invert condition

* Use useCallback instead useMemo

* Do not pass getNewCardUrl down if navigateToNewCardFromDashboard is not present
- Remove default noop for navigateToNewCardFromDashboard in PublicDashboard

* Remove explicit undefined prop
2024-05-28 18:23:51 +07:00
Phoomparin Mano
8cbacf7511 feat(sdk): override chart colors (#42960)
* add color types for chart sdk colors

* simplify chart color types

* chart color mappings

* apply mapping to master branch

* add chart mapping to mantine

* feat(sdk): apply chart accent colors to mantine and color getter

* rename tint and shade

* remove chart color logic from mantine

* add a color mapping test

* docs(sdk): add chart customizations to readme

* add type comments on MappableSdkColor

* cleanup sdk colors
2024-05-28 16:56:01 +07:00
Mahatthana (Kelvin) Nomsawadi
0c6b9355a7 Fix typo (#43194) 2024-05-28 09:05:39 +01:00
Cal Herries
92daf0cc7f Fix flaky migration rollback test for mysql: metabase.db.custom-migrations-test/migrate-uploads-settings-test-1 (#43210) 2024-05-28 04:06:25 +00:00
Cal Herries
83b55b99d6 Don't allow executing archived pivot-table cards in a public dashboard (#43206) 2024-05-27 16:51:53 -06:00
Alexander Polyankin
c45307cc9f Omit checks for dashboard metadata when not needed (#43197) 2024-05-27 14:39:39 -04:00
Case Nelson
a306b35715 [Metrics V2] Remove legacy-metric metadata (#43134)
* [Metrics V2] Remove legacy-metric metadata

Fixes #43131

* Don't mock metric

* Drop definition_description hydration on legacy metric

* Remove defintion_description tests

* Update src/metabase/lib/metadata.cljc

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

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-05-27 12:04:14 -06:00
Cal Herries
f3ddcb66a7 Migrate uploads settings to the db-level behind the scenes, so the uploads DB can be set by the config file (#42869) 2024-05-27 17:18:46 +00:00
Phoomparin Mano
a9d0596fcf docs(sdk): update color reference (#43086) 2024-05-27 15:07:52 +00:00
Uladzimir Havenchyk
057cb3f386 Avoid unnecessary re-renderings in dashboard - dashboard controls (#43169)
* Avoid unnecessary re-renderings in dashboard - dashboard controls

* Comment
2024-05-27 15:16:02 +03:00
Kamil Mielnik
e532b95fc6 Fix missing React key prop (#43179)
* Fix missing React key prop

* Fix missing React key prop

* Fix order of conditions and make the code easier to follow
2024-05-27 11:58:52 +00:00
Uladzimir Havenchyk
5f33a31dbd Restructure parameters e2e tests - separate auto-wiring (#42820) 2024-05-27 14:20:25 +03:00
Kamil Mielnik
4f37d5607a Enable running tagged tests defined in TS (#43172)
* Update & tag a test

* Run tests also on TS files

* Update mongo test
2024-05-27 18:11:20 +07:00
Alexander Solovyov
80687b8a42 [serdes] nested fields should be properly serialized (#43066) 2024-05-27 11:19:06 +03:00
Cal Herries
f4f2d45b23 Fix connection impersonation when jdbc spec is passed (#43147) 2024-05-25 01:02:31 +00:00
metamben
d208d800c3 Migrate metrics with display setting scalar (#43160) 2024-05-24 22:57:10 +00:00
metamben
1416017caa Remove api/legacy-metric (#43133) 2024-05-25 01:47:13 +03:00
metamben
e50a22f971 Remove unused card related endpoints (#43141) 2024-05-24 23:59:27 +03:00
Alexander Polyankin
b18e9caa42 Optimize initial dashboard load - load dashboard metadata in parallel with the query (#43101) 2024-05-24 20:38:53 +00:00
Nick Fitzpatrick
5e29f434a0 Add media query to search button (#43084)
* add media query to search button

* useSmallScreen hook
2024-05-24 16:48:02 -03:00
Ryan Laurie
abf9004160 Allow recent command palette items with the same name (#43098) 2024-05-24 13:04:02 -06:00
Ryan Laurie
c77f7f23d9 Hide creation buttons on search and recents tabs (#42977)
* hide creation buttons on search and recents tabs

* update e2e tests
2024-05-24 13:03:38 -06:00
Oisin Coveney
e1e845afa4 Convert DashboardControls to TS hooks (#42777)
* Convert DashboardControls to TS hooks

* fix types

* Modify dashboard url params to ensure that we keep hash options that haven't changed

* Fix PublicDashboard and DashboardTabs tests

* Use synced dashboard tabs for automatic dashboard, and use normal tabs for those with DashboardControls

* reduce hash option location changes to only the ones we can change through the UI

* Add comment on state management

* Remove console

* Attempt to solve more tests

* Remove loadDashboardParams as a passed prop

* Fix some tests, but will cause unit test to break

* Change names to reflect actual usage

* Fix lint and type issues

* Add simpler url param control, simplify types, and simplify fullscreen hook

* Add two way binding with url params to attempt to fix tests

* Fix unit test + types

* Move folders and fix imports

* Use Record<string, unknown> for refresh hook

* Remove console.log

* Clear query parameters when ParametersList unmounts

* Add comment

* Revert DisplayTheme changes

* Fix weird reloading problem

* Fix reducers test

* add code comments on selecting the tab once tab data is loaded

* add code comments on unsyncing parameters

* Fix e2e tests, move url reset to tabs context

* Fix e2e tests

* Hotfix

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-05-24 21:58:34 +03:00
Raphael Krut-Landau
adb7ff58a4 [Cache] Only show "Adaptive" and "Don't cache" options on OSS page (#43122)
* Limit options on OSS Admin/Performance page

* simplify

* simplify

* simplify

* divide constants to avoid circular imports

* divide constants to avoid circular imports

* divide constants to avoid circular imports

* simplify

* simplify

* simp

* fix

* simplify

* simplify

* fix test
2024-05-24 13:44:03 -04:00
Aleksandr Lesnenko
a4312230a8 Revert "minimal support for multiple values for Access-Control-Allow-Origin (#42888)" (#43125)
This reverts commit bf6fd9ef25.
2024-05-24 11:33:03 -04:00
Aleksandr Lesnenko
9194a1baca fix bars width when chart has two y-axes (#43100) 2024-05-24 12:29:29 -03:00
Uladzimir Havenchyk
1cb339e833 [Dashboard] Optimize rendering by reducing the number of props passing down to from the very top (#43114)
* Avoid unnecessary re-renderings in dashboard - getEmbeddedParameterVisibility

* Avoid unnecessary re-renderings in dashboard - favicon, page title

* Exclude isLoadingComplete from passing down

* Avoid unnecessary re-renderings in dashboard - metadata

* Drop metadata from Public Dashboard

* Avoid unnecessary re-renderings in dashboard - dashcardData
2024-05-24 18:20:04 +03:00
Nicolò Pretto
bf6fd9ef25 minimal support for multiple values for Access-Control-Allow-Origin (#42888)
* minimal support for multiple origins in security middleware

* if -> when to be more idiomatic

* adds tests for parse-url

* if -> when

* add missing new line in tests

* split the logic of validation in functions

* adds tests for the small functions

* use namespace in tests instead of :refer
2024-05-24 15:48:57 +02:00
Romeo Van Snick
2ab5debac0 Remove fixed height on popover (#43058) 2024-05-24 15:16:01 +02:00
Romeo Van Snick
2145b3cf9e Fix breakout pivot tether (#43060)
* Limit the height of the breakout popover

* Allow the click action popover to untether to prevent overflowing the screen

* Add reproduction for #43075

* Rename breaktrhough to breakout

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

* Use findAllByTestId

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

* Remove copy pasted question name

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

* Remove unused api intercept

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-24 14:01:58 +02:00
Romeo Van Snick
023ca9d1e9 Fix bucket trigger position (#43061)
* Make accordion list item content 100% wide

* Remove unused Dot component

* Move bucket popover trigger to the end of the item

* Revert QueryColumnPicker styles to what they were before adding the info icons

* Fix the height of the bucket picker
2024-05-24 08:36:39 +00:00
Uladzimir Havenchyk
14a42893a8 [UI] Fix styles for disabled Switch (#43091) 2024-05-24 09:19:03 +03:00
Case Nelson
5ad73d6fe6 [Metrics V2] Port Legacy metric tests and fixes (#43094)
* [Metrics V2] Port Legacy metric tests and fixes

Fixes #43093

* Address pr review
2024-05-23 16:39:57 -06:00
Alexander Polyankin
3713a16283 Optimize initial dashboard load (#42901) 2024-05-23 21:57:41 +00:00
metamben
e5e879afd4 Stop returning archived metrics in available metrics (#43031)
* Stop returning archived metrics in available metrics
* Add archived metric test
* Migrate legacy metric tests
* Delete lib/legacy_metric.cljc
2024-05-24 00:29:57 +03:00
metamben
1754ddcfaa Prevent returning metrics v2 migration backup field (#43087) 2024-05-23 18:39:43 +00:00
Emmad Usmani
1ea2b05fa3 refactor scatter plot to separate code path (#43032)
* refactor scatter plot model to separate function

* (2/3) refactor scatter plot option to separate function (#43033)

* use getScatterPlotOption

* use buildEChartsScatterSeries directly

* remove hoveredSeriesDataKey from scatter

* (3/3) improve chart model types (#43034)

* create WaterfallChartModel type

* create ScatterPlotModel type

* rename BaseCartesianChartModel to CartesianChartModel

* simplify chartModel creation in hook
2024-05-23 16:58:26 +00:00
Nick Fitzpatrick
ef28ff992c 42592 new modal adding database (#42966)
* modal built

* code cleanup, removing unused components

* whitespace shame

* adjusting unit test

* removing px shame
2024-05-23 11:40:37 -03:00
Ngoc Khuat
c9f2ffe99e Fix flaky test send-pulses-exceed-thread-pool-test (#43050) 2024-05-23 13:46:12 +00:00
Chris Truter
20cdd7cc1b Fix a bunch of small typos (#43055) 2024-05-23 13:39:52 +00:00
Kamil Mielnik
73e1b12679 Add repro for #42999 (#43000) 2024-05-23 19:56:05 +07:00
Noah Moss
5597f0febd Rework popular_items to use recent_views and view_count columns (#43041) 2024-05-23 08:45:02 -04:00
Alexander Polyankin
0e157dc8fb Revert "Load dashcard metadata in parallel with the query (#42953)" (#43063)
This reverts commit a0a4a26fdf.
2024-05-23 12:29:50 +00:00
Ryan Laurie
eee1c7e5b8 Properly show parent DBs in entity picker recents and search (#43016) 2024-05-23 05:32:02 -06:00
Tim Macdonald
4f7f55807c [ParseSQL] Find-and-replace with optional tags (#43013)
* Support find-and-replace with optional tags

[Fixes #42583]
2024-05-23 09:55:29 +00:00
Tim Macdonald
925454f14c [ParseSQL] Find-and-replace for snippets (#43011)
* Support F&R for snippets

[Fixes #42648]
2024-05-23 09:47:18 +01:00
Kamil Mielnik
dc4d78f16c Add a repro for #36508 (#43002) 2024-05-23 15:18:08 +07:00
Alexander Polyankin
59859a16b6 Flaky e2e fix (#43048) 2024-05-23 09:16:01 +02:00
Kamil Mielnik
41f6d17519 Fix - Empty collections shown in Data Picker (#42959)
* Generate different shouldShowItem for different pickers

* Add repro for #42957

* Update test to use models instead of metrics
2024-05-23 13:57:27 +07:00
Uladzimir Havenchyk
848fd9303e Drop props spreading to DashboardHeader (#42887) 2024-05-23 09:52:17 +03:00
bryan
ba7eae7554 bump saml20 - fix azure SLO (#43022) 2024-05-22 23:25:57 +00:00
Alexander Polyankin
a0a4a26fdf Load dashcard metadata in parallel with the query (#42953)
* Split card data and query

* Split card data and query

* Split card data and query

* Fix loading state

* Postpone card check

* Postpone card check

* Postpone field check

* Postpone field check

* Postpone field check

* Postpone field check

* Postpone field check

* Add await

* Add await

* Add await

* Add await

* Fix tests

* Fix data loading

* Fix data loading

* Fix data loading

* Fix data loading

* Revert "Fix data loading"

This reverts commit 2b782b9936.

* Fix data loading

* Fix test

* Fix test

* Fix embedding

* Fix xrays

* Fix xrays
2024-05-22 18:05:11 -04:00
Sloan Sparger
bdb006be00 Update link to docs about "No self-service" deprecation (#43038) 2024-05-22 21:22:18 +00:00
Nick Fitzpatrick
bd48581c81 42934 entity picker create collection root (#43005)
* NewCollectionDialog adjustment and unit test

* adding unit test for NewDashboardDialog
2024-05-22 17:28:08 -03:00
Alberto Perdomo
7deaf0d4ae Improvements to embedding sdk readme (#43021)
* SDK readme: update available and planned features

* SDK readme: general improvements
2024-05-22 20:46:48 +01:00
Ryan Laurie
f52078550b simplify db strategy editor markup (#42986)
* simplify strategy editor markup

* make it work for OSS too 😁
2024-05-22 13:41:17 -06:00
bryan
b2cf93c671 Effective location on collection recent items (#43018)
* add effective_location to recent-collection-items

* cleanup
2024-05-22 12:51:39 -06:00
Alexander Polyankin
93b83ab52f Add data source specific icons to data and join steps in the notebook editor (#42982) 2024-05-22 14:26:23 -04:00
Case Nelson
a68a4da67a [Metrics V2] Handle clashing expression names when adjusting metrics (#42984)
* [Metrics V2] Handle clashing expression names when adjusting metrics

Fixes #42782

* Address PR review
2024-05-22 11:51:32 -06:00
Ryan Laurie
bd552424ae update required checks copy documentation (#43003) 2024-05-22 08:58:10 -06:00
Jeff Bruemmer
ac639eaaef docs - download diagnostics (#42930) 2024-05-22 10:57:46 -04:00
Braden Shepherdson
acbfc6b5cc Drivers: Update the driver changelog with new features (#43004)
These were added in #42602 but I neglected to update the changelog.
Their defaults should serve for most drivers.
2024-05-22 10:18:27 -04:00
Uladzimir Havenchyk
933fd547f6 Cleanup annoying console warning from emotion (#42819) 2024-05-22 13:05:59 +00:00
Tim Macdonald
12bb81b528 Handle native query find-and-replace for queries with card refs (#42939)
* Handle native query find-and-replace for queries with card refs

[Fixes #42582]

c.f. limitiations in #42938

* wee cleanup
2024-05-22 10:44:18 +00:00
Cam Saul
340ea839d0 Tests for #15131 (#42972)
* Tests for #15131

* Appease Kondo
2024-05-22 11:23:58 +02:00
Romeo Van Snick
946974fb77 Limit the height of actions popover (#42946)
* Limit the height of actions popover

* Use Box instead of custom wrapper

* Add rem import
2024-05-22 10:58:16 +02:00
bryan
9dbfae2e17 the ' makes the doseq do nothing (#42988) 2024-05-22 04:45:50 +00:00
Cam Saul
d5a32ecb57 metabase.search namespace (#42487)
* Search API namespace

* Search API namespace

* Search API namespace

* Fix Kondo warnings

* Fix typo

* Finally solve the MySQL ^:parallel test failures <3

* Make some search tests REPL-friendly

* Did I finally fix `^:parallel` MySQL tests?

* Ok I give up just make the search tests single-threaded for MySQL/MariaDB.

* Revert the stuff to make paralell tests work for MySQL... for now.

* Keep new name

* Revert deps-graph changes

* Remove unused namespaces

* Fix Kondo linter for log/info + format

* Misc fixes 🔧

* Test fixes 🔧
2024-05-21 20:44:00 -07:00
Cam Saul
618b8c28aa metabase.analyze API namespace (#42469)
* Squashed commit

* Update config

* Backport the kondo ignore stuff from other PR.

* `metabase.analyze` API namespace
2024-05-22 02:56:04 +00:00
Cal Herries
a2b85e4b75 Tidy api-changelog.md (#42992) 2024-05-21 20:32:48 -06:00
John Swanson
1279a73ae2 Fix report_card.collection_preview in v49 (#42950)
This is a bit painful. I merged this change, but realized we need to
backport the fix to v49. However:

- we don't want to have two versions of the migration (one with a v49
id, one with a v50 id) because then if someone upgrades to 50, then
downgrades to 49, the `rollback` will run and change the type back,
leading to a bug.

- we don't want to push a v51 changeSet ID to v49 or v50, because we
give the user a helpful notice when their database needs a downgrade.
We do this by checking for the latest *executed* migration in the
database and comparing it to the latest migration that Liquibase knows
about, and making sure the executed isn't bigger than the known (e.g.
you can't have executed a v51 migration if it isn't in the local
migration yaml). That would all work fine, except that then we want to
tell you how to downgrade your database, and we use the latest-executed
version for that. So if, for example, someone upgraded from 48 to 49 and
got a v51 changeset, then downgraded back to 48, they would get an error
telling them to run the *v51* jar to roll back their DB.

In this case though, I think it's fine to just move the migration around
to v49, then we can backport it to 49 and 50.
2024-05-21 23:34:16 +00:00
Ryan Laurie
8615540e38 add snowplow tracking for upsells (#42955)
* add snowplow tracking for upsells

* add upsell snowplow test

* appease the linter
2024-05-21 16:49:10 -06:00
Emmad Usmani
139e421771 highlight hovered timeline event (#42969)
* highlight hovered timeline event

* add e2e test

* use TIMELINE_EVENT_DATA_NAME constant

* add test case for clicking icon
2024-05-21 15:23:18 -07:00
bryan
790a6479c8 Fixing a couple Recents API corner cases (#42813)
* handle visibilty_type on tables

- remove def wtf
- uncomment + fix tests

* make sure parent colls exist on report_cards

- official is a string
- ensure the database for a recent table exists

* remove def + improve arg name

* docstring

* improve + extract valid parent collection check

* grab the entity's colllection id and use that for the validity test

- This seems like something that should never happen, but I've seen it
happen. I think it might be possible from a down/up migration.

* fix tests

* fix more tests

* cleanup

* fixing another test

* add error-avoider, to filter bad items in prod instead of throwing

- improve recent view testing for table

* remove wrap (it double prints the value)
2024-05-21 16:07:43 -06:00
Denis Berezin
89bef96b93 feat: Add utm parameters to embedded OSS Metabase footer link (#42968)
* Add utm params to  link

* Fix e2e, add url domain

* Fix e2e
2024-05-21 21:34:27 +00:00
Case Nelson
8f9b9c3a13 [Metrics V2] Backfill viz settings for compatible-series (#42970)
* [Metrics V2] Backfill viz settings for compatible-series

Fixes #42575

The BE should rely on the query when there is no corresponding viz setting.
If there is no graph.metrics setting, assume that all last-stage aggregations are used.
No graph.dimensions -> use breakouts.

* Fix tests

* Unskip e2e test

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-21 21:20:32 +00:00
Jeff Bruemmer
64aa52ea12 docs - command palette (#42397) 2024-05-21 17:13:17 -04:00
Case Nelson
4fd9d7ae21 [Metrics V2] Adjust expression clauses in metric refs (#42962)
Fixes #42360
2024-05-21 13:49:55 -06:00
Jesse Devaney
6270bb4bc6 Fix overly frequent line series dots (#42735)
* hide symbols for charts with too many of them

* update loki

* prevent series dots showing up after manually disabling another series

* update loki snapshots

* refactor conditional

* update loki snapshots
2024-05-21 19:30:54 +00:00
metamben
9771eaa290 Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc (#42653)
* Migrate druid metrics-inside-aggregation-clauses-test to druid-jdbc
* Fix test-runner: druid should not exclude druid-jdbc
* Implement set-parameter and unprepare-value for LocalDateTime for druid-jdbc
2024-05-21 18:58:47 +00:00
Nick Fitzpatrick
c69596ab0b changing button height and CP input placeholder (#42770)
* changing button height and CP input placeholder

* adjusting search button size

* translate new placeholder
2024-05-21 15:39:59 -03:00
Denis Berezin
a3c3193474 fix(sdk): Various fixes for InteractiveQuestion theming (#42932)
* Fixes for InteractiveQuestion theming

* Update readme

* Fix for unset filter theme color

* Fix unit tests

* Fix unit tests
2024-05-21 18:31:17 +00:00
Sloan Sparger
eca94e12d8 Fix c method of ttag not showing strings as tagged in debug mode #42965 2024-05-21 17:50:57 +00:00
Alexander Polyankin
4be9fcf47f Revert "Fix failing offset tests" (#42961)
* Revert "Fix failing offset tests (#42944)"

This reverts commit fca30b1ae5.

* Fix e2e
2024-05-21 17:33:25 +00:00
Phoomparin Mano
2e9a53a778 feat(sdk): apply user interface color overrides to the sdk (#42834)
* feat(sdk): apply ui color overrides to the sdk

selector state

set global embedding colors

rename the method

* test(sdk): add unit test on color overrides
2024-05-21 17:29:24 +00:00
Kamil Mielnik
bbaa180303 Fix - Admin Email does not Display on Question Timeout Page (#42937)
* Extract EmailAdmin and add tests for it

* Rename EmailAdmin to AdminEmail

* Remove redundant async

* Add a test case for no email
2024-05-21 17:26:15 +00:00
Romeo Van Snick
1424a6ea70 Fix icon colors in column picker (#42945)
* Make icons 16px in data picker

* Use text-light in DataPicker to match other icons
2024-05-21 17:18:31 +00:00
Kamil Mielnik
fca30b1ae5 Fix failing offset tests (#42944)
* Fix failing offset tests

* Fix flaking test
2024-05-21 15:24:34 +00:00
Cal Herries
ccb4942b6a [forward-port] More upload test changes for clickhouse (#42531) (#42715) 2024-05-21 07:46:44 -06:00
Cal Herries
9da95541f1 CSV uploads: Add test for appending duplicate data (#42918) 2024-05-21 07:46:02 -06:00
Alexander Polyankin
4b7f04a8bc Cleanup DataPicker initialization (#42916) 2024-05-21 08:31:22 -04:00
Uladzimir Havenchyk
c09ec3ddeb Drop props spreading to DashboardSidebars (#42907) 2024-05-21 12:48:02 +03:00
Kamil Mielnik
9384525278 Repro #36631 - A "Default period" is appended for Date columns within Custom Columns when using Question as Source Data (#42876)
* Add a repro for #36631

* Do not wrap id
2024-05-21 13:38:18 +07:00
Kamil Mielnik
802b0d915f Cover Offset() in custom expressions with e2e tests (#42756)
* [MBQL lib] Reject broken uses of `offset` in expressions, filters (#42662)

- Using `offset` in custom expressions is supported only when there is
  an order-by defined on that stage.
- Using `offset` in custom filters is not supported at all, currently.

* Support `Offset()` in custom columns [frontend] (#42326)

* Only nest expressions referenced in breakouts or aggregations

* Support Offset() as expression with no breakouts

* Test fixes 🔧

* Oracle test update

* Improved Oracle test

* Test update 🔧

* Fix busted test

* Add naive support for Offset() in expressions

* Introduce MBQLClauseFunctionReturnType

* Add "window" to MBQLClauseFunctionReturnType and use it for the offset function

* Handle offset type inference

* Remove unused export

* Use "expression" instead of "window" return type
- Rename identifiers in isCompatible
- Make isCompatible accept a clause object instead of just the type
- Handle offset as a special case in isCompatible

* Use any type

* Rename expectedArgumentType to expectedType

* Format code

* Sort types

* Do not suggest offset function in filters

* Fix offset not working in case

* Revert "Do not suggest offset function in filters"

This reverts commit e63790b780.

* Fix order of adjustments

---------

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

* Disable offsets in filters expressions

* Group existing aggregations-specific tests

* Remove repro for a closed issue

* Use findByText instead of contains

* Add a test for filter expressions

* Add a test for aggregation expressions suggestions

* Disable offsets in filters expressions (#42755)

* Add a test for custom column suggestions

* Add "typing" to enterCustomColumnDetails

* Use enterCustomColumnDetails, improve assertions

* Add more assertions

* Optimize queries

* Add typing for offset expressions

* Add a repro for metabase#42764

* Add a TODO

* Add a TODO

* Add a TODO

* Use NumericLiteral

* Post-merge fixes

* Update test

* Add tests for other custom expressions

* Test drills

* Format code

* Update test name

* Add an assertion

* Add assertions for the preview

* Unskip fixed issue

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
Co-authored-by: Cam Saul <github@camsaul.com>
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-21 13:37:45 +07:00
metamben
09c557cdf7 Fix flaky adjust-mixed-multi-source-test (#42926) 2024-05-21 09:10:26 +03:00
Sloan Sparger
cf97acdaeb Split out Search e2e tests and Record Pre-Release Sanity Checks with Replay (#42933)
* add replay recordings to sanity check e2e tests during pre-release workflow

* split out search tests from onboarding folder

* parallelize pre-release testing

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-20 23:33:19 +00:00
John Swanson
b76e26fac3 Correct type for report_card.collection_preview (#42919)
In v49, we converted all boolean types to `bit(1)` on mysql/mariadb. It
looks like we missed this one, so when you `GET` a card it has
`"collection_preview": 1`. Then we get an error when trying to save,
because `collection_preview` should be a boolean.

I verified that after this migration, `GET`ting a card results in a
boolean `"collection_preview"`.
2024-05-20 15:20:05 -07:00
Jesse Devaney
f436b5b066 fix trend charts spacing (#42860) 2024-05-20 20:41:09 +00:00
Sloan Sparger
32421f2e39 Remove flaky / redundant e2e test (#42920) 2024-05-20 20:19:05 +00:00
Jeff Bruemmer
1ef312845f small edits (#42923) 2024-05-20 20:17:37 +00:00
metamben
9cb18c0056 Fix comment (#42906)
* Fix comment
2024-05-20 19:27:40 +00:00
Kamil Mielnik
fb4b8ca2a6 Create the new Metric entity (Metrics v2) (#38457) 2024-05-20 13:47:00 -04:00
Roman Abdulmanov
d80667fe36 revert embed board (#42911) 2024-05-20 17:44:49 +00:00
Uladzimir Havenchyk
3999e8ebe4 Drop props spreading to DashboardGrid (#42875) 2024-05-20 20:43:58 +03:00
Sloan Sparger
375cb63200 Disable popular items e2e home page test in OSS (#42896)
* disables testing for home page popular items in oss

* Update e2e/test/scenarios/onboarding/home/homepage.cy.spec.js

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

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
2024-05-20 12:23:52 -05:00
Sloan Sparger
45622180e1 asserts values match current expectations of values which hopefully solves race conditions that might be happening (#42905) 2024-05-20 12:23:02 -05:00
Denis Berezin
0278b8d221 fix(sdk): Use theme font in charts and tooltips (#42855)
* Allow charts font override in SDK

* Fix default not configured font
2024-05-20 16:57:49 +00:00
Ryan Laurie
36d03247f3 Improve db setup tests more (#42899)
* improve db setup test

* improve embedding test
2024-05-20 11:04:33 -05:00
Ryan Laurie
3697804c3c Remove utm from source plan in upsell links (#42890) 2024-05-20 15:15:42 +00:00
Ryan Laurie
5e562cd86c Make Metabot Cool Again (#42797)
* Make Metabot Cool Again

* update tests
2024-05-20 07:32:55 -06:00
Uladzimir Havenchyk
5d795be2c8 Exclude jspdf and html2canvas from the bundle (#42536)
* Exclude jspdf and html2canvas from the bundle

* cleanup
2024-05-18 13:03:29 +03:00
John Swanson
930777e1a4 Add a type to collections returned by search (#42535)
Under:

- `item.type`

- `item.collection.type`, and

- `item.collection.effective_ancestors.*.type`
2024-05-17 15:36:56 -07:00
Cal Herries
b300002061 Use db argument in driver/database-supports? for uploads (#42851) 2024-05-17 21:43:22 +00:00
John Swanson
80d8e87242 Update API Changelog (#42864) 2024-05-17 21:14:01 +00:00
Jeff Bruemmer
9be96be978 docs - csv upload replace (#42529) 2024-05-17 16:59:36 -04:00
Denis Berezin
7f6ba3e374 Restore default styles for subtle button (#42854) 2024-05-17 20:29:12 +00:00
metabase-bot[bot]
443203b41c Update Readme version references and published npm version to 0.1.4 (#42852)
Co-authored-by: Metabase bot <metabase-bot@metabase.com>
2024-05-17 19:22:00 +00:00
Noah Moss
fb9da630b3 Fix schema error in recent views query (#42844) 2024-05-17 18:07:31 +00:00
Sloan Sparger
8477f8db86 Fix homepage flaky test (#42839)
* fixes homepage flaky test

* take 2

* better fix
2024-05-17 17:52:03 +00:00
Nick Fitzpatrick
f74b0e3fbb fixing e2e flakes in search-snowplow and recently-viewed specs (#42840) 2024-05-17 17:10:56 +00:00
Ryan Laurie
eaab3ba2ce Improve db connection setup test (#42838) 2024-05-17 11:54:33 -05:00
Nemanja Glumac
3b5258d7ea Remove GoogleAnalytics specific logic from the FE (#42827) 2024-05-17 18:01:23 +02:00
Oisin Coveney
01e45b8471 Review suggestions from #42768 (#42830) 2024-05-17 14:44:09 +00:00
Romeo Van Snick
147b9f7dad Scroll to created column when extracting or combining columns in chill mode (#42650)
* Set scrollToLastColumn ui control from column extract action

* Scroll to last column when the uiControl is set

* Scroll to last column when combining a column

* Scroll to last column when combining a column via the + shortcut

* Scroll to last column when extracting a column via the + shortcut

* Remove all references to settingsSyncOptions

* Check that the column is added at the end

* Disable scrollToLastColumn once used

* Add test that verifies scrollToLastColumn ui control has been reset
2024-05-17 16:23:03 +02:00
Ngoc Khuat
29a1713df7 Add task history status (#42372) 2024-05-17 14:06:21 +00:00
Denis Berezin
a6035a1aff Add custom theming support for SDK InteractiveQuestion component (#42663)
* Add proper brand colors to drills menu

* Add theming for filters and drills

* Fix css vars

* Fix table css

* Add SDK theme colors interface and remapping

* Fix dashboard brand color issue

* Fix theme colors interface

* Fix default theme table cell background

* Fix typo

* Fix for qb filters panel custom border
2024-05-17 13:40:28 +00:00
Nemanja Glumac
c64187b17b Drop the "frozen" frontend install during build when in CI (#42771) 2024-05-17 15:26:10 +02:00
Oisin Coveney
2cf2955f91 Convert RefreshWidget to Mantine, CSS modules, and TS (#42768) 2024-05-17 13:24:48 +00:00
Kamil Mielnik
784e869891 Data picker (#41175)
* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Fix nil schema in /api/table/:id/query_metadata

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 38ac092335.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 2b8fe78ed4.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 219506f0e0.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 9430478bdf.

* Revert "Fix nil schema in /api/table/:id/query_metadata"

This reverts commit 8c6cdd9068.

* Table Picker (#40509)

* Generic types

* Generic types

* Generic types + make generateKey a prop

* Generic types

* Extract AutoScrollBox.styled.tsx

* Move AutoScrollBox to a separate directory

* Generic types

* Generic types

* Generic types

* Unhookify searchFilter

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Finish dealing with a cast

* Destructure import

* Inline type

* Generic types

* Remove cast

* Remove commented code

* Remove redundant fallback

* Move CollectionPicker out of EntityPicker

* Avoid as unknown

* Remove TODOs

* Rename TisFolder to IsFolder

* Fix any

* Fix anys

* Remove NestedItemPicker's storybook

* Remove a cast

* Remove a cast

* Remove a cast

* Revert "Remove a cast"

This reverts commit b762d0f076.

* Use extends SearchModelType instead of extends string everywhere

* Revert "Use extends SearchModelType instead of extends string everywhere"

This reverts commit 708190d63e.

* Fix SearchResult["available_models"] type

* Handle options.allowCreateNew

* Add missing description attribute to Database type

* Move allowCreateNew to CollectionPickerOptions

* Add missing description attribute in Database mock

* Add types

* Add TableList component

* Add SchemaList component

* Fix naming

* Add DatabaseList component

* Add NotebookDataItemPickerResolver

* Fix typing

* Add TablePicker and NotebookDataPickerModal

* Update types

* Fix types

* Add folder type

* Fix initial state

* Update title

* Make query model-dependent

* Render tables

* Fix schema icon

* Adjust key generation

* Rename utilts to utils

* Use ItemList error prop

* Use value prop

* Rename NotebookDataPickerModal to DataPickerModal

* Automatically open datapicker if there is no value

* Highlight current item

* Rename value to initial value

* Fix item highlighting

* Rework TablePicker state

* Leave TODOs for names

* Fix selecting items

* Fix highlighting selected item

* Hide confirmation button

* Add fetchMetadata to tableApi

* Fix Table['schema'] type

* Fetch table metadata upon selection

* Remove options from DataPickerModal

* Fix collectionId typing in Question

* Add collectionId prop

* Remove title prop

* Add todo

* Fix confirmation button

* Remove old DataSourceSelector

* Bring back useSchemaListQuery

* Fix crash

* Fix picker not opening

* Hide dbs list and schemas list if there's only 1

* Remove unused ref

* Remove unused DataPickerListResolver

* Remove unused types

* Change conditional rendering to allow for loading state

* Revert collection-related changes

* Use RTK

* Avoid using stale data

* Fix highlighted db

* Remove todo

* Remove unused type

* Remove useSchemaListQuery

* Rename Value to TablePickerValue

* Move isValueEqual to utils and rename it to isTablePickerValueEqual

* Improve TODO

* Remove unused options prop

* Introduce tablePickerValueFromTable

* Avoid having 2 table metadata requests

* Update comment

* Update comment

* Remove unused function

* Allow null in tablePickerValueFromTable

* Extract helpers

* Rename schemaId to schemaName

* Remove description

* Improve naming

* Simplify types

* Add explanatory comments

* Fall back to empty state when there are no items

* Account for null schemas

* Account for null schema in tests

* Revert "Account for null schema in tests"

This reverts commit 0c96d1cb88.

* Revert "Account for null schemas"

This reverts commit 4f5c4e99ee.

* Improve typing around schema name

* Refactor auto-select logic

* Refactor

* Avoid comment

* Make useAutoSelectOnlyItem generic

* Do not enforce presence of at least 1 tab with TypeScript

* Fix types

* Remove obsolete comment

* Post-merge fix

* Integrate QuestionPicker in DataPicker (#42268)

* Add question and model pickers to Data Picker

* Add model attribute to data picker value

* Introduce DataPickerValue

* Start with the right tab when opening data picker modal

* Do not use stale sourceCard value

* Fix switching tabs when a table is selected

* Use undefined instead of null for consistency

* Do not show models/questions tabs when there are no models/questions

* Fix selecting models/questions in search results

* Remove dead code

* Remove dead code

* Ignore selecting collections

* Refactor useHasModels and useHasQuestions into useAvailableData

* Use models param to speed up the query

* Do not require `onConfirm` prop in `EntityPickerModal` (#42317)

* Make onConfirm prop optional

* Add a test for onConfirm prop assertion

* Table does not appear selected in single-schema dbs (#42336)

* Convert useAutoSelectOnlyItem arguments to param object

* Disable auto-selection when there already is a selection

* Use `DataPicker` in `JoinTablePicker` (#42330)

* Refactor DataStep:
- rename handleTableSelect to handleTableChange
- extract value and memoize it

* Remove redundant fragment

* Add new DataPicker props

* Use DataPickerModal in JoinTablePicker

* Remove initialTab prop since the default tab is always the models tab anyway

* Limit table selection to particular database

* Limit search results to a given database

* Support databaseId in useAvailableData

* Filter collection items by databaseId

* Use databaseId prop only for CollectionItemList component

* Fix types

* Fix filtering

* Use useLatest for onChange

* Fix typing

* Introduce shouldShowItem and use it instead of databaseId prop

* Improve PickerInfo type

* Use MLv2 to generate DataPickerModal value in JoinTablePicker

* Fix title

* Add isModel to TableDisplayInfo

* Add a hack to populate query metadata with info that table is a model

* Remove NewQuestionView & QuestionDataSelector (#42562)

* Temporarily disable recents tab in the data picker

* Update Data Picker tests (#42565)

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Fix metadata loading

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test and make it pass

* Update test

* Update tests

* Update test

* Use entityPickerModal() instead of modal()

* Use entityPickerModal() instead of modal()

* Update test

* Update test

* Update test

* Revert change that broke tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Remove test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Rename createDatabaseIdItemFilter to createShouldShowItem

* Update test

* Update and skip a test

* Remove test

* Update tests

* Update tests

* Update tests

* Remove test

* Update tests

* Update test

* Update test

* Update test

* Extract utils

* Use helpers

* Extract helpers

* Update test

* Update test

* Update test

* Update test

* Update test

* Filter out collections that do not have card or dataset

* Improve filtering

* Always show root and personal collections, see https://github.com/metabase/metabase/issues/42687

* Remove failing assertion

* Update tests

* Use entityPickerModalTab

* Accept strings in pickEntity

* Use entityPickerModalLevel

* Use entityPickerModalTab

* Use entityPickerModalTab

* Update tests

* Update test

* Update tests

* Update test

* Fix assertion

* Update test

* Update tests

* Update test

* Update tests

* Update tests

* Update test

* Update test

* Update tests
- ensure database list gets loaded like in a real app

* Update test

* Update test

* Integrate Recents tab in Data Picker (#42821)

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Fix metadata loading

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Update test and make it pass

* Update test

* Update tests

* Update test

* Use entityPickerModal() instead of modal()

* Use entityPickerModal() instead of modal()

* Update test

* Update test

* Update test

* Revert change that broke tests

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Remove test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update test

* Update tests

* Update test

* Update test

* Rename createDatabaseIdItemFilter to createShouldShowItem

* Update test

* Update and skip a test

* Remove test

* Update tests

* Update tests

* Update tests

* Remove test

* Update tests

* Update test

* Update test

* Update test

* Extract utils

* Use helpers

* Extract helpers

* Update test

* Update test

* Update test

* Update test

* Update test

* Filter out collections that do not have card or dataset

* Improve filtering

* Always show root and personal collections, see https://github.com/metabase/metabase/issues/42687

* Remove failing assertion

* Update tests

* Use entityPickerModalTab

* Accept strings in pickEntity

* Use entityPickerModalLevel

* Use entityPickerModalTab

* Use entityPickerModalTab

* Update tests

* Update test

* Update tests

* Update test

* Fix assertion

* Update test

* Update tests

* Update test

* Update tests

* Update tests

* Update test

* Update test

* Update tests
- ensure database list gets loaded like in a real app

* Update test

* Enable recents tab and update tests

* Update test

* Update tests

* Add Recents-related assertions

* Update test

* Clean up mocks

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-17 12:53:29 +00:00
Uladzimir Havenchyk
752bf845fc Add missing tests for user-level filter state in dashboards (#42826)
* Add missing tests for user-level filter state in dashboards

* Update e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-17 12:41:41 +00:00
Raphael Krut-Landau
5ac502a58c rebase (#42808) 2024-05-17 08:30:47 -04:00
Raphael Krut-Landau
95722dcbe3 New copy for strategyform (#42815) 2024-05-17 08:13:37 -04:00
Raphael Krut-Landau
918327bb34 Remove dead code (#42823) 2024-05-17 08:13:15 -04:00
Raphael Krut-Landau
12ae82f084 Fix BucketPickerPopover test (#42811) 2024-05-17 08:09:19 -04:00
Phoomparin Mano
74ec3eeec7 feat(sdk): document theming options in readme (#42784)
* add font size example

* feat(sdk): document theming options in readme
2024-05-17 17:16:42 +07:00
Sloan Sparger
7460cad859 [Feature branch] Make Trash Usable (#42339)
* Migration to add `trashed_from_*` (#41529)

We want to record where things were trashed *from* for two purposes:

- first, we want to be able to put things back if they're "untrashed".

- second, we want to be able to enforce permissions *as if* something is
still in its previous location. That is, if we trash a card or a
dashboard from Collection A, the permissions of Collection A should
continue to apply to the card or dashboard (e.g. in terms of who can
view it).

To achieve this, collections get a `trashed_from_location` (paralleling
their `location`) and dashboards/cards get a
`trashed_from_collection_id` (paralleling their `collection_id`).

* Create the trash collection on startup (#41535)

* Create the trash collection on startup

The trash collection (and its descendants) can't have its permissions
modified.

Note that right now, it's possible to move the Trash collection. I'll
fix this when I implement the API for moving things to the Trash.

* s/TRASH_COLLECTION_ID/trash-collection-id/g

* Add a comment to explain null comparison

* Move archived items to the trash (#41543)

This PR is probably too big. Hopefully documenting all the changes made here will make it easier to review and digest. So:

Tables with a `collection_id` had `ON DELETE SET NULL` on the foreign key. Since we only deleted collections in testing and development, this didn't really affect anything. But now that we are actually deleting collections in production, it's important that nothing accidentally get moved to the root collection, which is what `SET NULL` actually does.

When we get an API request to update the `archived` flag on a card, collection, or dashboard, we either move the item *to* the trash (if `archived` is `true`) or *from* the trash (if `archived` is `false`). We set the `trashed_from_collection_id` flag as appropriate, and use it when restoring an item if possible.

Because moving something to the trash by itself would have permissions implications (since permissions are based on the parent collection) we need to change the way permissions are enforced for trashed items.

First, we change the definition of `perms-objects-set-for-parent-collection` so that it returns the permission set for the collection the object was *trashed from*, if it is archived.

Second, when listing objects inside the Trash itself, we need to check permissions to make sure the user can actually read the object - usually, of course, if you can read a collection you can read the contents, but this is not true for the trash so we need to check each one. In this case we're actually a little extra restrictive and only return objects the user can *write*. The reasoning here is that you only really want to browse the Trash to see things you could "act on" - unarchive or permanently delete. So there's no reason to show you things you only have read permissions on.

Because previously the Collections API expected archived collections to live anywhere, not just in a single tree based in the Trash, I needed to make some changes to some API endpoints.

This endpoint still takes an `exclude-archived` parameter, which defaults to `false`. When it's `false`, we return the entire tree including the Trash collection and archived children. When it's `true`, we exclude the Trash collection (and its subtree) from the results.

Previously, this endpoint took an `archived` parameter, which defaulted to `false`. Thus it would only return non-archived results. This is a problem, because we want the frontend to be able to ask for the contents of the Trash or an archived subcollection without explicitly asking for archived results. We just want to treat these like normal collections.

The change made to support this was to just default `archived` to the `archived` status of the collection itself. If you're asking for the items in an archived collection, you'll only get archived results. If you're asking for the items in a non-archived collection, you'll only get unarchived results.

This is, for normal collections, the same thing as just returning all results. But see the section on namespaced collections for details on why we needed this slightly awkward default.

No change - this endpoint still takes an `archived` parameter. When `archived=true`, we return the Trash collection, as it is in the root collection. Otherwise, we don't.

* Make Trash Usable - UI (#41666)

* Remove Archive Page + Add `/trash` routing (#42226)

* removes archive page and related resources, adds new /trash route for trash collection, adds redirects to ensure consistent /trash routing instead of collection path

* fixes unit + e2e tests, corrects links generated for trash collection to use /trash over /collect/:trashId route

* updates comment

* Serialize trash correctly (#42345)

Also, create the Trash in a migration rather than on startup. Don't set a specific trash collection.id, instead just select based on the `type` when necessary.

* Fix collection data for trashed items (#42284)

* Fix collection IDs for trashed items

When something is in the trash, we need to check permissions on the
`trashed_from_collection_id` rather than the `collection_id`. We were
doing this. However, we want the actual collection data on the search
result to represent the actual collection it's in (the trash). I added
the code to do this, a test to make sure it works as intended, and a
comment to explain what we're doing here and why.

* Refactor permission for trashed_from_collection_id

Noah pointed out that the logic of "what collection do I check for
permissions" was getting sprinkled into numerous places, and it felt a
little scary. In fact, there was a bug in the previous implementation.
If you selected a collection with `(t2/select [:model/Collection ...])`,
selecting a subset of columns, and *didn't* include the
`trashed_from_collection_id` in that set of columns, then called
`mi/can-write?` on the result, you'd get erroneous results.
Specifically, we'd return `nil` (representing the root collection).

I think this is a reasonable fix, though I'm pretty new to using fancy
multimethods with `derive` and such. But basically, I wanted a way to
annotate a model to say "check these permissions using
`:trashed_from_collection_id` if the item is archived." And in this
case, we'll throw an exception if `:trashed_from_collection_id` is not
present, just like we currently throw an exception if `:collection_id`
is not present when checking permissions the normal way.

* Move existing archived items to the trash (#42241)

Move everything that's archived directly to the trash. It's not ideal
because we're wiping out the existing collection structure, but the
existing Archive page also has no collection structure.

* lint fixes from rebase

* Fix backend tests (#42506)

`can_write` on collection items was wrong because we didn't have a
`trashed_from_collection_id` - the refactor to ensure we didn't make
that mistake worked! 🎉

* Add an /api/collections/trash endpoint (#42476)

This fetches the Trash in exactly the same way as if we'd fetched it
with `/api/collection/:id` with the Trash ID. I hadn't realized that the
frontend was doing this with the previously hardcoded Trash ID.

* Make Trash Usable - Dynamic Trash Collection Id (#42532)

* wip

* fixes hardcoded reference to trash id in sidebar

* remove TRAHS_COLLECTION

* fixes line and e2e tests

* fix invert logic mistake and fixes lint

* Make Trash Usable - Search Filter UI (#42402)

* adds filtering for archived items on the search page

* fix typing mistake

* Make Trash Usable - Bug Bash 1 (#42541)

* disables reordering columns in archived questions, disables modifying archived question name in question header, collection picker no longer defaults to archived item, keeps trashed collection from appearing collection picker search results, shops showing empty area in trashed dashboard info sidebar, disables uploading csvs to trashed collections

* impls pr feedback

* fix e2e failure

* Localize the name of the Trash (#42514)

There are at least two spots where we can't just rely on the
after-select hook, and select the collection name directly from the
database: the Search and Collection API.

In these cases we need to call `collection/maybe-localize-trash-name`,
which will localize the name if the passed Collection is the Trash
collection.

* Update migration IDs

Migration IDs need to be in order.

* Fix failing mariadb:latest test (#42608)

Hooooly cow. Glad to finally track this down. The issue was that
booleans come back from MariaDB as NON BOOLEANS, and clojure says 0 is
truthy, and together that makes for FUN TIMES.

We need to turn MariaDB's bits to booleans before we can work with them.

* Make Trash Usable: Add `can_restore` to API endpoints (#42654)

Rather than having two separate implementations of the `can_restore`
hydration for cards and dashboards, I set up automagic hydration for the
`trashed_from_collection_id`. Then the hydration method for
`can_restore` can just first hydrate `trashed_from_collection` and then
operate based on that.

* fix can_restore for collections trashed from root

* Fix `trashed_from_location` for trashed subcols

We were setting `trashed_from_location` on subcollections to the
`trashed_from_location` of the ancestor that was trashed - which is
wrong.

This would have caused bugs where collections would be restored to the
root collection, regardless of where they were originally trashed from.

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>

* Fix Trash rollbacks (#42710)

* Fix Trash rollbacks

There were a few errors in my initial implementation.

First, we can't simply assume that `trashed_from_location` and
`trashed_from_collection_id` are set for anything in the archive. They
should be set for things *directly* trashed, but not for things trashed
as part of a collection.

Therefore, we need to set `location` and `collection_id` to something
like "if the item is in the trash, then the `trashed_from` - otherwise,
don't modify it".

Second, because `trashed_from_collection_id` is not a foreign key but
`collection_id` is, we have a potential problem. If someone upgrades,
Trashes a dashboard, then Trashes and permanently deletes the collection
that dashboard _was_ in, then downgrades, how do we move the dashboard
"back"? What do we set the dashboard's `collection_id` to?

The solution here is that when we downgrade, we don't actually move
dashboards, collections, or cards out of the Trash collection. Instead
we just make Trash a normal collection and leave everything in it.

* Make Trash Usable - Bug Bash 2 (#42787)

* wip

* fixes access to property on null value

* pr clean up

* more clean up

* Fix up tests

- permissions will check the archived from location. So recents need to
select :report_card.trashed_from_collection_id and
:dash.trashed_from_collection_id to satisfy mi/can-read?
- some commented out code with `(def wtf (mt/user-http-request
...))`. Restore tests.
- probably commented out because the recent views come back in an order
but we don't care about the order. And it was asserting against an
ordered collection. Just go from [{:id <id> :model <model>} ...] to a
map of {<id> <model>} and then our comparison works fine and is not
sensitive to order.

* put try/finally around read-only-mode

ensure the setting read-only-mode! to false happens in a finally
block. Also, set read-only-mode to false in

```clojure
(deftest read-only-login-test
  (try
    (cloud-migration/read-only-mode! true)
    (mt/client :post 200 "session" (mt/user->credentials :rasta))
    (finally
      (cloud-migration/read-only-mode! false))))
```

But worryingly, I think we have a lurking problem that I'm not sure why
we haven't hit yet. We run tests in parallel and then put all of the
non-parallel tests on the same main thread. And when one of these puts
the app in read-only-mode, the parallel tests will fail. HOPEFULLY since
they are parallel they won't be hitting the app-db necessarily, but
there could be lots of silly things that break.

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: dan sutton <dan@dpsutton.com>
2024-05-17 06:01:30 -04:00
Luiz Arakaki
dc4c56174d Update Metabase Analytics content for v50 (#42799)
* update metabase analytics with cache dashboardtab and subscriptions and alerts dashboard

* update yamls without view_count

* fix metabase analytics namespace
2024-05-17 09:51:28 +00:00
Uladzimir Havenchyk
d5bd7cac1f Maintain user-level state in dashboards for filters (#39813) 2024-05-17 12:37:14 +03:00
Nick Fitzpatrick
8fd90abb5a defaultToRecentsTab added (#42800) 2024-05-17 15:06:39 +07:00
Oisin Coveney
e2828c7902 Bump screenfull version to 6.0.2 (#42776) 2024-05-17 10:23:53 +03:00
Jesse Devaney
c747c1709c Move series data label formatters from option to the model (#42616)
* move series data label formatters to the model

- TODO: move stacked data label formatters to the model

* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* remove unused formatting options parameter

* move stacked labels formatter to model

* fix stacked combo chart label display for non-stacked lines

* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* fix waterfall chart labels

---------

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-05-17 07:02:41 +00:00
Raphael Krut-Landau
c059690297 rebase (#42788) 2024-05-17 00:22:38 -04:00
Cal Herries
0fd6da0b1f Remove some columns from serialized card and table entities (#42812) 2024-05-16 21:44:09 -06:00
Raphael Krut-Landau
6cfb3b5f21 Add cache invalidation configuration form to question info sidebar (#42729) 2024-05-16 23:33:06 -04:00
Cam Saul
7a9b6acca8 Fix sorting by Offset() custom expression aggregation (#42737)
* Fix sorting by `Offset()` custom expression aggregation

* Unskip test

* Revert breaking change to `mt/id` and related
2024-05-17 02:56:23 +00:00
Cal Herries
c7b5cddbdd Exclude view_count columns from serialized dashboard and card (#42801) 2024-05-17 01:18:01 +00:00
Alexander Polyankin
4e50783cd2 Fix filters with is-null and not-null operators crashing the QB (#42796) 2024-05-17 00:44:10 +00:00
bryan
7ab065f2e3 Recents API Improvements (#42660)
* handle recent view for non-existant entity

* test that recent views works with missing entities

- just doesn't return them.

* dont count on there being entities in the app-db

* Query for the entity data upfront for recent-views

- Still need to check for the model_object due to popular-items calls

* cleanup, fix ellide logic

memoize get-parent-coll

* more cleanup

* rewire half of the queries

* rewrite the other queries, and improve docs

* align some queries

* lookup all entities ahead of time

- always return effective parent collections

* seperate n+1 tests

* use = instead of a set

* no need for a vector

* fixup simple table test

* go from effective-location-path to id instead of hydrating
2024-05-16 23:19:58 +00:00
Filipe Silva
b7253af4f2 Cloud Migration Feature (#41317)
* feat: cloud migration endpoints

* fix: don't leave open conn behind when checking migrations

`unrun-migrations` would open a new connection but not close it.
Since `with-liquibase` is happy enough using a data-source the fix is straightforward.

You can verify this by running the following code:

```
(comment
  (require '[metabase.cmd.dump-to-h2 :as dump-to-h2]
           '[metabase.analytics.prometheus :as prometheus])

  (defn dump []
    (-> (str "cloud_migration_dump_" (random-uuid) ".mv.db")
        io/file
        .getAbsolutePath
        dump-to-h2/dump-to-h2!))

  (defn busy-conns []
    (-> (prometheus/connection-pool-info)
        first
        second
        :numBusyConnections))

  ;; each dump leaves behind 1 busy conn

  (busy-conns)
  ;; => 0

  (dump)
  (busy-conns)
  ;; => 1

  (dump)
  (busy-conns)
  ;; => 2

  (dump)
  (busy-conns)
  ;; => 3

  )
```

* fix: flush h2 before returning from dump

* rfct: move code to models.cloud-migration

* test: add login while on read-only test

* fix: assorted cloud_migration fixes from review

* test: allow overriding uploaded dump

* fix: add UserParameterValue to read-only exceptions

Also make the list a little bit nicer.

* fix: only block dumped tables on read-only

* fix: recover on startup if read-only was left on

* feat: block migration when hosted already

* test: test settings for migration

* feat: cloud migration supports retries and multipart

* test: sane dev defaults for migration

* fix: upload 100% shouldn't be migration 100%

* chore: make up a new migration id after merge

* Cloud Migration FE (#42542)

* it's a start

* ui wip

* wip

* dynamic polling intervals, and custom modal for migrate confirmation modal

* cleans out most of the remainig UI TODOs

* adding progress component

* impls team feedback

* makes component more testable, starts some a unit test for the CloudPanel

* finish unit testing

* reverts api changes

* update progress styling

* fix type issues

* fix e2e failure, fix feature unit tests by holding last migration state in fetchMock if more requests than expected happen at the end of a test, remove white spacing change in clj file

* second pass at fixing tests

* fix copy from ready-only to read-only

* copy fix

* Update frontend/src/metabase/admin/settings/components/CloudPanel/MigrationError.tsx

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* Update frontend/src/metabase/admin/settings/components/CloudPanel/MigrationInProgress.tsx

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

* adding e2e test

* pr feedback

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>

---------

Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-05-16 18:05:32 -05:00
Alexander Polyankin
606686c3c4 Use is-empty and not-empty for string columns in quick filter drill (#42804) 2024-05-16 22:51:38 +00:00
Ryan Laurie
4308410389 Basic Upsell System Setup + Hosting Upsell (#42785)
* Basic Upsell System Setup

* Hosting Upsell

* add upsell to updates page

* update utms

* update copy, utms and text
2024-05-16 16:12:28 -06:00
Raphael Krut-Landau
f225c92795 Allow license tokens that start with airgap_ (#42733)
Accept license tokens with an `airgap_` prefix, besides the already accepted 64-character long tokens.

This weakens the validation in the FE. Rigorous validation of tokens beginning with `airgap_` occurs in the BE. See this [Slack message](https://metaboat.slack.com/archives/C064EB1UE5P/p1715813885703249?thread_ts=1715813614.437989&cid=C064EB1UE5P).
2024-05-16 17:58:24 -04:00
Raphael Krut-Landau
430df7ee49 Browse-related heading changes (#42779)
Rename "Browse data" to "Browse databases"

Closes #42781
2024-05-16 17:56:46 -04:00
Aleksandr Lesnenko
8b9e15266a combo stacked chart (#42085)
* combo stacked chart

* spec

* remove irrelevant spec

* combo stacking

* fix selecting y-axis on stacked charts

* snapshot

* linter, specs, types

* propagate combo stacking to area and bar charts (#42600)

* propagate combo stacking to area and bar charts

* enable combo stacking for bar/area charts, fix data transform

* fix types, specs

* fix y-axis extents calculations

* remove spec that tested the removed control, update specs, update test data

* review

* show show data values setting on normalized charts that have a line series

* fixes
2024-05-16 18:40:46 -03:00
adam-james
672fa62e47 Area Bar Combo Stacked Viz Settings Migration (#42740)
* Area Bar Combo Stacked Viz Settings Migration

Per: https://www.notion.so/metabase/Migration-spec-e2732e79215a4a5fa44debb272413db9

This addresses the necessary migrations for area/bar/combo stacked viz settings.

* Custom migration test works

* Check that non area/bar/combo charts also remove stack_display
2024-05-16 14:36:41 -07:00
Braden Shepherdson
d46c23fe55 [MBQL lib] Add canPreview and use it from the notebook (#42791)
* [MBQL lib] Add `canPreview` and use it from the notebook

* Fix previewQuery

* Apply can-preview across stages; add unit tests

---------

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-05-16 21:27:36 +00:00
Jeff Bruemmer
02e42f32e3 49.11 to list of releases (#42794) 2024-05-16 16:30:59 -04:00
adam-james
2f30a47ffc Correct Data Shape for Multi-Series Static Viz (#42730)
* Correct Data Shape for Multi-Series Static Viz

Fixes: #41787

During the echarts migration, some backend tests needed fixing. In this process, the shape of data (eg. list of cards
and their data results from execution) were altered.

This was done to fix failing tests and renders for single series cards (all Questions and many dashcards), but didn't
correctly handle a multi-series card.

This conditionally adds back the expected shape.

Perhaps in a follow on PR it's worth inspecting the implementation of the :javascript_visualization render method to
clean it up. Probably worth putting some Malli schemas around it too to make it clearer what shape we need.

* Make sure card/data maps going into static-viz are distinct

* Add a test util to render dashcards, add multiseries card test

We haven't made a 'unit' (perhaps more like a small integration test at this point) test for multi series dashcards
yet.

In most other cases, making sure a card (Question) renders properly is sufficient, but the multi series dashcards are
a special case. It's probably useufl to have a test or two, and the dashcards test util should hopefully help future
test writing a bit now too.
2024-05-16 13:05:23 -07:00
Kamil Mielnik
cd007ba6ac Offset in custom expressions (#42751) 2024-05-16 19:23:16 +00:00
Aleksandr Lesnenko
361f568ee1 drop percy (#42303) 2024-05-16 13:37:29 -03:00
Nemanja Glumac
54d7a3b559 Remove the last traces of BuildJet from the CI (#42758) 2024-05-16 16:42:28 +02:00
Oisin Coveney
d58cb8a6cc Fix unmounted node error on ExplicitSize (#42766) 2024-05-16 14:15:04 +00:00
Alexander Polyankin
0147c695a7 Fix broken pivot table questions that had out of date viz settings (#42698) 2024-05-16 09:53:14 -04:00
Mahatthana (Kelvin) Nomsawadi
3dbeb3bfbd Automate releasing embedding SDK (#42516)
* WIP some workflows

* Add reminder todo comment

* Complete the workflow

* Fix YAML syntax error

* Trigger the workflow

* Fix resuable workflow

* Fix uberjar workflow

* Add missing steps before testing

* Pass recrets to resuable workflow, so it could run

* Fix sdk artifact location

* Remove unneeded output

* fetch tags, so it doesn't fail on push

* Only running EE uberjar in SDK workflow

Because OSS is never needed

* Fix incorrect syntax

* Shuffle workflow so it failed fast

* Fix syntax error

* Attempt to bulid only EE jar

* Fix the error handling step

* Fix failing to upload to s3

* Fix create a PR step

* Fix the last temporary command, so the build looks green

* Remove hack to trigger the workflow

* Remove completed todo comment

* Clean up S3 step

* Add todo comment

* Upload correct docker image name

* Bump the package version before building SDK

* Fix uploading the correct Metabase dev container name

* Fix one too many double quote

* Push the correct docker image

* Fix PR creation step

* Dry run publishing SDK

* Use a separate uberjar workflow for SDK

* Remove a bunch of unused steps

* Update variable names, step names

* Improve tag error message

* Correct m2-cache-key to be unique

* Fix the push tag failure step to only run when failed to push tag

* Fix changed artifact name

* Improve env name for clarity

* Fix extra trailing empty line

* Remove conditions from running certian steps

* Removing npm publish dry-run
2024-05-16 13:21:09 +00:00
Tim Macdonald
34900091e5 [ParseSQL] Find-and-replace for variables and field filters (#42703)
* Add a simple replace-names test

* Support find-and-replace in cards with variables and field filters

[Fixes #42580]

[Fixes #42581]

* Add models.card/replace-fields-and-tables!

* Docstring fix

* Little cleanup
2024-05-16 13:13:59 +01:00
Mahatthana (Kelvin) Nomsawadi
44cb385c40 Upgrade redshift dependency version (#42746) 2024-05-16 06:03:22 +00:00
Cal Herries
0843dafbd9 Realize DB transient rows in after-select hook before calling driver.u/features (#42744) 2024-05-16 04:07:33 +00:00
Luis Paolini
4a6dfe409b Bump SQL Server driver for v50 (#41021)
same compatibility of the previous one but this is compatible with JDK 21
https://learn.microsoft.com/en-us/sql/connect/jdbc/release-notes-for-the-jdbc-driver?view=sql-server-ver16

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-15 20:45:23 -03:00
Nick Fitzpatrick
62754d5b88 42701 search type ahead cp (#42716)
* respect search-typeahead-enabled

* updating unit test

* adding e2e test
2024-05-15 18:48:15 -03:00
Raphael Krut-Landau
95d5a829de Move createMockModelResult to browse folder (#42690)
* Move createMockModelResult to browse folder

* fix
2024-05-15 17:23:28 -04:00
Jeff Bruemmer
95db580178 docs - update appearance settings (#42388) 2024-05-15 17:09:19 -04:00
Jeff Bruemmer
7bdfafc822 docs - offset (#42484) 2024-05-15 17:08:54 -04:00
Nick Fitzpatrick
f37c417b89 replace search bar with command palette toggle (#42603)
* replace search bar with command palette toggle

* e2e test part one

* onboarding suite

* green e2e

* unit tests

* delete shame
2024-05-15 17:26:45 -03:00
Alex Yarosh
e8d6f86ccd [docs] Jessica's onboarding feedback (#42670)
* update collections

* feedback

* links

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

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-15 19:28:31 +00:00
John Swanson
9aa572cbc1 remove TODOs from metabase.models.setting (#40020)
3 TODOs were removed here:

- "a way to SET Database-local values." More like TODONE :haaa:

- "we should probably also bind this [that is, *database-local-values*]
in sync contexts e.g. functions in [[metabase.sync]]" I think we don't
need to do this. The full set of maybe-database-local settings right now
is `aggregated-query-row-limit`, `unaggregated-query-row-limit`,
`database-enable-actions`, and `persist-models-enabled`. None of these
need to be set when `sync`ing. If at some point we do add a db-local
setting that should affect the way syncing works, we will need to do
this - but I don't think this TODO will help figure that out.

- "settings sent via an env var aren't returned for security purposes.
It is an open question whether we should obfuscate them and still show
the last two characters like we do for sensitive values that are set via
the UI." I think if it's been this way for 5 years, it no longer
qualifies as an "open question." We can reopen if down the road if this
is something we want.
2024-05-15 12:10:16 -07:00
adam-james
a52450c38a Pivot table exports (#41668)
* PoC Pivot table exporting.

Works so far!

This just hacks a couple things in. I added the :query via format_rows, which should instead have its own proper
middleware

Pivot export should probably not just be in the middleware namespace but in qp.pivot.

Should not break the streaming results writer for non-pivots... obviously this breaks ordinary results, so that needs
to be handled properly.

Better documentation about how the logic actually works. Pivot tables are hard to remember/easy to forget, so some
very clear diagrams/examples would probably be good.

* adjust csv export to export a pivot table when pivot options exist

* post processing of pivot table rows for card/dashcard downloads

* WIP on getting pivot exports to work with unsaved questions

* WIP getting pivot exports working on unsaved questions

The dataset POST /pivot endpoint is used to get the pivot data to the frontend, but also to get the pivot query.

The query that is returned by the POST comes from the json_query, which is populated by the userland-query stuff with
the last run query. The pivot qp runs mulitple queries and each query runs through the regular userland query qp, so
we'll 1. see lots of executions recorded and 2. end up with the wrong query in the POST return. It'll look mostly
correct, but due to how the pivot qp works won't necessarily have all of the fields.

That incorrect pivot query is passed to the /:export-format endpoint and we don't end up seeing correct results.

Since that json_query gets fed back to the backend when doing an export, we do need it to be correct, like the query
that was sent to /pivot in the first place.

Since this is a WIP, I've just passed the query as a string to :original-query in :info, and if that exists, use that
to fill the :json_query key.

Then, also add a :was-pivot flag so that the dataset download endpoint can look at it and use the pivot qp instead of
the regular qp. Even if we have the correct 'top level' query, we need to run it through the pivot qp to get the full,
correct pivoted results.

* Pivot Export Test

Here I've added a pivot export test that has various assertions trying to capture the correct output from the pivot
csv export.

I've done my best to explain the tests with comments, but have also left a (comment ) form with a function
`explore-pivot` to help *show* rather than tell what the expected pivot output should be.

I've created this new namespace to first capture this pivot export test with the intent to add tests that can improve
our confidence that ALL exports/downloads in ALL places behave as we expect in the future. It just seemed nice to
start fresh here with the pivot export test first.

* Don't need to make this public.

* Add lots of comments to hopefully make this a bit easier to follow

* Added an explore-raw-pivot fn in comment form

* Update test/metabase/api/downloads_exports_test.clj

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

* begin addressing feedback

- finish an unfinished docstring
- merge info instead of assoc
- use a native query to build the pivot data instead of using a custom dataset, to keep test speed ok

* Create a new ns for the pivot post processing utils

Separate the post processing fns into their own namespace. This means I can easily add a test namespace for the post
processing specifically as well.

* Add pivot postprocessing test ns, not complete, but decent start

* fix mistake in endpoint. Only add original query to first pivot q

* Figured out how to keep the original query without storing as a string

* Perhaps this'll fix things properly?

---------

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
2024-05-15 17:47:58 +00:00
Romeo Van Snick
3506941ec8 Design update for extract examples (#42399)
* Move the extract examples inline

* Use ui Button for ClickAction and render examples inline
2024-05-15 17:23:12 +00:00
Phoomparin Mano
c16ff2be32 Support basic theming in interactive data tables for embedding SDK (#42411)
* support theming in table

* theme injection with hoc

* reasonable default theme options

* customizable text color

* theming table header

* table theming

* change theme configuration order

* apply sorted cell color directly

* gutter background

* remove header theming for now

* fix: id column styling

* id column borders

* border color

* add cell hover color

* conditional hover color

* use brand color to accent

* add default theme values to unit test

* cell background should default to white

* update unit test

* remove unused properties

* remove duplicated color declaration as inner cell data styles it

* remove duplicate fallback

* remove unused use-embedding-theme hook

* use theme color from Mantine for css variables

* update defaults

* inject default component theme

* add notes on cell data theme

* update unit tests

* update unit tests

* remove no-op text-brand hover color

* remove no-op is sorted cell color
2024-05-16 00:13:03 +07:00
Raphael Krut-Landau
13bbb9d0c7 Add cache configuration form to dashboard sidebar (#42192) 2024-05-15 12:42:45 -04:00
Raphael Krut-Landau
413872d243 Don't explicitly set the dimensions of the verified model icon (#42702) 2024-05-15 12:40:44 -04:00
Raphael Krut-Landau
e23e654c65 Use new icon for verified models (#42689) 2024-05-15 09:23:26 -04:00
Nemanja Glumac
5333bd946a Require an explicit knob to allow uploading ReplayIO recordings (#42649)
* Explicitly decide whether to upload or not

* Upload in the main e2e workflow, but skip uploading in stress-test workflow

* Do not record runs in the stress-test workflow

* Add Replay API key

Even though we're not using it in this workflow. 🤷

* Omit env var from the stress-test workflow
2024-05-15 14:10:29 +02:00
Alexander Solovyov
5cfc079d1d json unfolding: parse incrementally instead of using cheshire (#42638)
this lowers memory usage 100x for 50kb strings (our limit before this change) and speeds up parsing by an order of magnitude.

For example, results for parsing 42kb string (already in memory):

Before: Time per call: 6.32 ms    Alloc per call: 8,732,850b
After:  Time per call: 55.16 us   Alloc per call: 83,254b
2024-05-15 13:08:32 +03:00
Romeo Van Snick
214a59894e Info icon design update (#42557)
* Render item icon inline with column icon

* Use inline info icon in field picker

* Use new QueryColumnInfoIcon on filter columns picker

* Use new QueryColumnInfoIcon on suggestions dropdown

* Use new QueryColumnInfoIcon aggregations dropdown

* Use new QueryColumnInfoIcon filter modal

* Use new QueryColumnInfoIcon in BreakoutColumnListItem

* Use new QueryColumnInfoIcon in FieldList

* Use new QueryColumnInfoIcon in DataSelectorFieldPicker

* Update TableInfoIcon to render fallback too

* Use new TableInfoIcon in DataSelector

* Use new TableInfoIcon in ViewHeader

* Fix types in breakout column

* Move aria-label to wrapper

* Move binning back to the right

* Always give info icon full opacity

* Remove asDot props everywhere
2024-05-15 08:48:18 +02:00
Uladzimir Havenchyk
90f7e62f58 Optimize getColumnCardinality by using cache correctly (#42664) 2024-05-15 06:01:06 +00:00
Ngoc Khuat
fe1f5950fb An one time job to init send-pulse trigger and migration down to clean up send-pulse triggers (#42316)
* Add a job to init send pulse trigger only once

* Send pulse triggers should respect report timezone (#42502)
2024-05-15 05:42:44 +00:00
Aleksandr Lesnenko
e9f3f490f5 fix static combo chart crashes when viz settings are invalid (#42669)
* fix static combo chart crashes when viz settings are invalid

* spec
2024-05-14 23:20:30 +00:00
Emmad Usmani
f401054091 remove percent change tooltip from waterfall chart (#42658) 2024-05-14 19:42:51 -03:00
Jeff Bruemmer
342ed573bb docs - view data and create queries (#42121) 2024-05-14 16:31:47 -04:00
Braden Shepherdson
a6039a0fcb [MBQL lib] Add native queries to the shared tests for all drills (#42478)
Follow up to #42424.

This enforces that all drills do not appear on native stages.
Also fixes one more drill on top of the two in #42424 that were wrongly
showing up for native queries.
2024-05-14 20:20:22 +00:00
Uladzimir Havenchyk
df92623dda Optimize isVisualizationClickable check in TableInteractive (#42639)
* Optimize isVisualizationClickable check in TableInteractive

* Destructure question

* Mode is nullable
2024-05-14 22:51:19 +03:00
Alexander Polyankin
1519acb6c9 Fix metadata loading issues after tabs (#42655) 2024-05-14 15:04:20 -04:00
Braden Shepherdson
50a03a1956 [Drivers] New features to replace hard-coded driver lists in tests (#42602)
- `:metadata/key-constraints` for those databases which formally track
  PK and FK key constraints. Some databases (eg. Presto/Athena/Starburst
  family) don't support constraints like that, but do support querying
  based on foreign keys (which is the `:foreign-keys` feature).
- `:connection/multiple-databases` for databases where a single
  connection can connect to many databases. This is the case for Athena,
  since it connects to an S3 bucket and exposes all files in the bucket
  as databases through that single connection.
- Also removed a troublesome "all DBs except a huge list" case in the
  SSH tunnel tests with a shorter list of supported drivers.
2024-05-14 13:06:35 -04:00
Anton Kulyk
706a553550 Use icons for "Line style" viz settings (#42637)
* Add icons

* Use icons
2024-05-14 18:01:11 +01:00
Nemanja Glumac
f4c7b9f0fc Fix broken metric revision API call (#42634)
* Fix broken metric revision API call

Fixes #42633

* Add E2E repro for #42633

* Fix metrics revision history in the data reference

* Add repro for #42633 for the reference page

* Consolidate tests

* Do not use hard coded id

* Fix lint errors
2024-05-14 16:27:20 +00:00
Ryan Laurie
5437e3d34d Disable Error Diagnostic Modal In Embedding (#42641)
* Disable Error Diagnostic Modal In Embedding

* add e2e test for diagnostic modal
2024-05-14 09:36:16 -06:00
bryan
60888cc593 handle RecentViews for non-existant entites (#42643)
* handle recent view for non-existant entity

* test that recent views works with missing entities

- just doesn't return them.

* dont count on there being entities in the app-db
2024-05-14 15:32:37 +00:00
Ryan Laurie
52d32c15e0 Recents Picker Tab (#42079)
* add recents tab

type updates

fix unit test

change where we filter recents

WIP Recents Tab

wip recents

design updates

update recents design to match search

use new recents format

initial recents implementation

fix types

* fix e2e tests

* update more e2e tests

* allow recents filters

* update test mocks

* add unit tests for recents tab

* update e2e tests

* add e2e tests for recents picker tab

* fix lost access test
2024-05-14 09:19:28 -06:00
Nemanja Glumac
47b3f17292 Remove unused @visx libraries (#42624)
* Remove `@visx/event`

* Remove `@visx/legend`

* Remove `@visx/responsive`

* Remove `@visx/mock-data`

* Remove `@visx/tooltip`
2024-05-14 16:15:38 +02:00
Ngoc Khuat
b6b67a6158 Delete pulses when archive dashboard (#42558) 2024-05-14 14:09:51 +00:00
Ngoc Khuat
11c985398d Fix migration fail with encryption key (#42617) 2024-05-14 21:09:15 +07:00
Raphael Krut-Landau
8b6e0bf15f Fix column widths in Browse models (#42601) 2024-05-14 09:40:51 -04:00
Chris Truter
c594662969 Fix reflection on newer JVM versions (#42630) 2024-05-14 10:05:08 +00:00
Nemanja Glumac
f52e02ff58 Remove unused SettingsBatchForm component (#42627)
* Remove unused `SettingsBatchForm` component

* Remove `react-collapse` and its types
2024-05-14 09:05:17 +00:00
Nemanja Glumac
1a44a83c3a Allow multiple values for string operators in the dashboard (#42013)
* Expand the single or multi-selectable string filter choices

* Mark operators as `multi`

* Wrap an existing test in a separate `describe` block

* Test multiple values settings

* Expand repro to include multiple dashboard filter values

* Ease the load by limiting the card results

* Switch to the more flexible data structure for the dashboard filters

* Expand the assertions

* Fix typo

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-14 10:46:44 +02:00
Romeo Van Snick
50e64abfac Prevent the suggestion popover from flipping to the top (#42625) 2024-05-14 10:35:23 +02:00
Uladzimir Havenchyk
2555eebaa7 Avoid unnecessary re-renderings in column settings sidebar (#42595) 2024-05-14 11:22:44 +03:00
Nemanja Glumac
1d1bcdff9f Remove number-to-locale-string (#42590) 2024-05-14 06:53:41 +02:00
Aleksandr Lesnenko
0ecb5b085c allow description columns to be dimensions of charts (#42539) 2024-05-14 03:12:50 +00:00
Emmad Usmani
47148ce79b add + symbol to percent change tooltip (#42614) 2024-05-13 23:29:45 -03:00
Emmad Usmani
090222677a refactor legend components to use items prop (#42417)
* refactor legend components to use items prop

* update RowChart

* add types

* add key to type

* fix type errors

* fix legend.unit.spec.ts
2024-05-14 01:35:58 +00:00
bryan
2b91354fd4 New Recents API Format (#42239)
* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* ellide inactive tables

* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* New Recents + Popular API Format - Frontend (#42305)

* fix tests

* new API payload format for recents and populars

* update url generation

* update recents components

* update tests

* only show 5 recents in command palette

* remove unused types

* update tests

* obey the linter

* type updates

* fix unit test

* change where we filter recents

---------

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

* fix modelToUrl types

* respond to review comments

* post merge test fix

---------

Co-authored-by: Ryan Laurie <30528226+iethree@users.noreply.github.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-13 22:55:58 +00:00
Raphael Krut-Landau
cc0a4231f4 Ellipsify descriptions properly in Browse models (#42456)
* Ellipsify descriptions properly in Browse models

* Simplify
2024-05-13 20:47:44 +00:00
Jeff Bruemmer
e6213e4b45 add 49.10 (#42599) 2024-05-13 20:26:31 +00:00
adam-james
127a62f640 Don't use the slugify util for filenames (#42475)
* Don't use the slugify util for filenames

* Fix tests that looked for incorrect filenames

* add a test

* fix filename in pulse test util
2024-05-13 13:21:22 -07:00
Noah Moss
9d968d9eef SCIM-scoped API key (#42086) 2024-05-13 15:49:30 +00:00
Nemanja Glumac
dcc5587ff7 Remove classlist-polyfill (#42588) 2024-05-13 15:44:07 +00:00
Ngoc Khuat
35a487d367 Static viz get background color thread safe (#42548) 2024-05-13 22:17:44 +07:00
Nemanja Glumac
3820cf05f0 Remove color-harmony (#42577) 2024-05-13 15:05:13 +00:00
Uladzimir Havenchyk
1fe63c52bf Partially fix columns and viz settings mismatch (#42344)
From now we allow mismatch between `base-type` if we need to match columns and columnSettings
2024-05-13 14:35:14 +00:00
Romeo Van Snick
9665e569f1 Combine/extract shortcuts snowplow events (#42445)
* Copy question event to new version

* Add new events for adding column via plus modal

* Add plus modal variants

* Track combine column via plus header

* Track extract column via plus header

* Add test for combine question event

* Add e2e test for extract column shortcut snowplow events
2024-05-13 15:52:54 +02:00
Romeo Van Snick
e3dffcc497 Combine column shortcut (#42442)
* Add index file to CombineColumns

* Add CombinColumnAction

* Add CombinColumnsAction to default and embedding modes

* Fix outdated --color-brand references

* Set up sequenced close handler in combine columns

* Allow outside clicks to happen when popover is not open

* Add e2e test for combine column shortcut

* Remove unused prop

* Rename file to match component name: CombineColumnsAction

* Simplify test assertion

* Set width on combine columns action

* Remove superflouous ? check
2024-05-13 14:16:05 +02:00
Kamil Mielnik
f596f0b00f Cover Offset() in aggregations with e2e tests (#42455)
* Add repro for 32323

* Fix offset not working in case

* Make offset function return any

* Add a repro for #42377

* Fix order of adjustments

* Revert unrelated changes

* Remove commented code

* Revert unrelated changes

* Refactor test

* Type offset aggregation

* Add a test for no order by or breakout clause

* Add a basic test for breakout clause

* Fix assertion

* Remove problematic dependency

* Fix uuids generation

* Remove redundant limit

* Add a test for multiple breakouts

* Update test names

* Extract OFFSET_SUM_TOTAL_AGGREGATION

* Add a repro for metabase#42509

* Add a test for multiple aggregations and breakouts

* Remove unused intercept

* Move uuid utils to separate file
- it wasn't possible to import the utils file in e2e tests without it

* Make isUuid a type guard

* Add tests for sorting

* Tag the test

* Add extra assertion to verify expression parsing

* Add a complex scenario

* Reverse isFirst logic
2024-05-13 11:04:20 +00:00
Nemanja Glumac
38d540a91f Remove code related to GoogleAnalytics tracking (#42556) 2024-05-13 12:01:41 +02:00
Ngoc Khuat
77fccd8b63 Quartz: auto delete jobs without a class during scheduler initialization (#42383) 2024-05-13 16:07:48 +07:00
Phoomparin Mano
e8dc5ec5a6 Migrate smart scalar and night mode to support Mantine theming (#42347)
* migrate smart scalar to css modules

* lighten theme color

* adjust margin

* map space 1 to xs

* use c prop instead of color

* use rem unit

* use rem unit

* add y margin

* return null when no children

* comment on text variation

* cleanup unused components and add dark mode todo

* remove todo comment

* support night mode in embedding

* lift dashboard theme to redux

* make theme non-nullable with default

* use component prop instead of title tag

* optional display theme

* restore tooltip state

* add default mock state

* remove theme from embed

* replace handleActions with createReducer
2024-05-13 08:57:16 +00:00
Nemanja Glumac
f8474255e8 Upgrade Cypress to v13.9.0 (#42507)
* Upgrade Cypress to `v13.9.0`

* Upgrade `@replayio/cypress` to `v2.1.0`

* Upgrade `cypress-real-events` to `v1.12.0`

* Upgrade `esbuild` to `v0.21.1`
2024-05-13 09:55:04 +02:00
Nicolò Pretto
84519c835b remove google analytics (#42515) 2024-05-13 09:44:35 +02:00
Phoomparin Mano
6cc0f2bc9c bump to 0.1.3 (#42519) 2024-05-13 07:18:35 +00:00
Romeo Van Snick
eca348eab9 Extract column shortcut (#42261)
* Render plus button in interactive table header

* Add columnShortcuts on ClickObject

* Dispatch click action for columnShortcuts on plus button

* Make onCancel an optional prop

* Add ExtractColumn action

* Add ExtractColumn action to Default and Embedding mode

* Use arrow_split icon for extract column action

* Add title to extract column popover

* Add e2e test for Extract column shortcut

* Use asReturned in extract column

* Rename to Extract part of column

* Add a custom title to the new column shortcut

* Add onClose to ExtractColumn popover

* Hide shortcuts icon when question is not editable

* Fix null error

* Do not use submodules in import

* Scroll more in test
2024-05-13 08:26:52 +02:00
adam-james
932781aa95 Format Rows toggle also applies to Column Names (#42543)
* Format Rows toggle also applies to Column Names

Fixes: #42500
When format-rows is false, we want to also pass that true/false value to the title column formatting.

That is, if a column is renamed and formatting is applied, we want to use that column's name. But, if a column is
renamed and the user exports unformatted csv or json, the custom column name should NOT be used, as was the behaviour
in prior versions.

* write a better test explanation
2024-05-10 23:39:04 +00:00
Jesse Devaney
f1e110856c Fix pie chart display when switching from notebook editor (#42430)
* fix pie chart display when switching from notebook editor

* remove hack

* fix missing pie chart display

* fix missing pie chart display

* address feedback

* fix type error
2024-05-10 21:56:05 +00:00
Emmad Usmani
562defa9a9 remove unused viz series utils (#42422) 2024-05-10 17:09:13 -04:00
Ryan Laurie
f6522a5d45 Fix disabled state for bulk actions buttons (#42533) 2024-05-10 21:07:37 +00:00
Raphael Krut-Landau
17852e5fa3 [Browse] Improve model sorting (#42493)
Ensures that models are sorted as follows in Browse models:

* Models are sorted by collection, by default
* When models are sorted by collection, they are secondarily sorted by name (so that models with the same collection path appear in alphabetic order)
2024-05-10 14:46:28 -04:00
Aleksandr Lesnenko
e308d73cac use echarts tree shaking api (#42520)
* use echarts tree shaking api

* fix specs

* update types

* move echarts module registration back to individual components

* Transpile echarts in jest

---------

Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
2024-05-10 15:40:04 -03:00
Braden Shepherdson
a785b1685b [QP] Handle variadic :contains etc. in dashboard filters (#42404)
These params were failing to match. This matches them up and puts the
options in the correct place. (`[:contains x y opts]` but `[:contains opts x y z]`).
2024-05-10 10:50:29 -07:00
Emmad Usmani
8e17e13e8a fix percent change across daylight savings (#42482)
* fix percent change across DST

* add e2e tests
2024-05-10 10:44:07 -07:00
Alex Yarosh
6d6555462e add 48.13 (#42522) 2024-05-10 13:42:14 -04:00
Alex Yarosh
7ed624b9a9 [docs] Serialization docs update (#42439)
* serialization update

* anchor links

* more anchor links

* correct curl call

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* review feedback

* links

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-10 18:56:37 +02:00
Ngoc Khuat
e8201e38b7 Thread safe static viz (#42494) 2024-05-10 16:22:09 +00:00
Cam Saul
59e7b3d1cb metabase.xrays API namespace (#42491)
* Remove unused `metabase.api.transform`

* Copy the deps graph improvements from my other PR

* New combined X-Rays API namespace

* Fix kondo error
2024-05-10 09:13:59 -07:00
Raphael Krut-Landau
c68b889d29 Fix drill FK test flake by removing unneeded wait for /api/dataset (#42501) 2024-05-10 12:12:51 -04:00
Alex Yarosh
3ef530dbf3 [docs] Clarify how optional SQL vars work (#42490)
* how optional clauses work

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-10 16:06:28 +00:00
Raphael Krut-Landau
aec41f458b squash (#42111) 2024-05-10 12:03:28 -04:00
Emmad Usmani
4036d86ad2 fix pie chart tooltip (#42465)
* fix pie chart tooltip

* add unit test
2024-05-10 16:01:34 +00:00
Raphael Krut-Landau
1175ee6ef9 Put bulk actions above popovers in collections (#42512)
* q

* Restore margin-left adjustment
2024-05-10 11:57:28 -04:00
Cal Herries
ef15d0e32b Allow drivers to not automatically add a PK column for CSV uploads (50) (#42466) 2024-05-10 15:08:10 +00:00
Alex Yarosh
52ee28578f add bq troubleshooting to the guide (#42492) 2024-05-10 08:27:35 -06:00
Alexander Solovyov
7e90c2ddca [serdes] handle circular dependencies in dashboards (#42267) 2024-05-10 16:49:02 +03:00
Kamil Mielnik
3e9f4ac515 Fix - diagnose-expression throws when Offset is nested (#42497)
* Fix offset not working in case

* Make offset function return any

* Add a repro for #42377

* Fix order of adjustments

* Revert unrelated changes

* Remove commented code

* Revert unrelated changes
2024-05-10 20:39:09 +07:00
Nemanja Glumac
a522cd88c0 Remove unused exportCardQuery endpoint definition from DashboardApi (#42499) 2024-05-10 12:14:25 +00:00
Phoomparin Mano
82e41b7652 Update embedding SDK readme to remove height CSS workaround (#42453)
* update readme as height is now optional

* remove other wrapper
2024-05-10 18:05:06 +07:00
Mahatthana (Kelvin) Nomsawadi
b4ed5a3bf7 Fix SDK interactive question showing no question error incorrectly (#42400)
* Fix loading showing when it's not supposed to

* Add unit test

* Review: Improve code clarity
2024-05-10 07:52:28 +01:00
Raphael Krut-Landau
521fe4d929 Tweak the Model explanation banner (#42413) 2024-05-10 04:11:56 +00:00
Ngoc Khuat
2e5847f44a Prioritize sending fast pulses (#42331) 2024-05-10 01:45:18 +00:00
Alex Yarosh
54d9ae7555 [docs] see publicly shared content (#42488)
* see shared content

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-09 21:25:35 +00:00
Alex Yarosh
c5033b8c20 fix format (#42485) 2024-05-09 14:54:59 -06:00
Cam Saul
5fcceaad01 metabase.metabot API namespace (#42468)
* Squashed commit

* Update config

* Backport the kondo ignore stuff from other PR.

* Metabot API namespace
2024-05-09 22:13:27 +02:00
Alex Yarosh
1bce4cb647 add 49.9 (#42481) 2024-05-09 14:12:33 -06:00
Braden Shepherdson
6eb213461c [QP] Fix error with :!= "Is Not" filter on expression (#42461) 2024-05-09 18:43:17 +00:00
Uladzimir Havenchyk
6864bc7e1a Disable cypress log to bypass out of memory issue (#41472) 2024-05-09 12:31:30 -06:00
Cam Saul
6799062a1b Enumerate the current state of the world with regards to module namespaces (#42437)
* Squashed commit

* Update config

* Backport the kondo ignore stuff from other PR.
2024-05-09 17:45:42 +00:00
Braden Shepherdson
0dbe2761f2 [Drills] Only show "Extract" and "Combine" actions on MBQL stages (#42424)
They don't work correctly on a native stage.
2024-05-09 13:03:16 -04:00
Tim Macdonald
2bac5512d4 Use official version of Marginalia (#42204)
For Reasons™ we had been using my fork, but now that I've taken over the
project the officially-deployed version does what we need.
2024-05-09 16:40:46 +01:00
Oisin Coveney
4fe8e0466c Convert PublicDashboard to TS (#41972)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-05-09 18:36:03 +03:00
Ryan Laurie
06cd458d43 Allow Admins to clean up uploaded tables in bulk (#42183)
* add upload management API

* add upload management interface

* remove trailing slash

* add e2e upload management test

* add upload management to token_features

* jsdoc cleanup

* fixes tests

- include :upload_management in session_test
- fix list-url in upload management
- ensure local tests have upload management disabled
  (causes tests locally to 422 instead of 402: it has sufficient
  permissions from a local token to try to delete the table but the
  table is not an upload table, so you get a 422)

* add card archive param

* update tests

* use common component

* add success/error toasts

* test success/error notifications

* update e2e tests

* address review comments

* make sure we have fresh data

---------

Co-authored-by: dan sutton <dan@dpsutton.com>
2024-05-09 15:27:46 +00:00
Raphael Krut-Landau
e9b43787a1 Make Browse models table sortable (#42113)
* squash

* Reset change

* Fix name column width
2024-05-09 11:04:13 -04:00
Mahatthana (Kelvin) Nomsawadi
14d6cc9ad3 Fix not allow using both react 17 and 18 in the SDK (#42457)
* Fix not allow using both react 17 and 18 in the SDK

* Review: Fix not including React 17 🤦
2024-05-09 15:44:34 +01:00
Raphael Krut-Landau
962c32a36b Remove dead API keys code (#42418) 2024-05-09 14:41:25 +00:00
Jacob Joseph
c380a5a323 [docs] Update environment-variables.md: fix typo re: MB_JETTY_SKIP_SNI (#42432) 2024-05-09 08:58:09 -04:00
Kamil Mielnik
6c9099bfd5 Fix flaky question management e2e test (#42444)
* Fix flaky question management test

* Update assertions order to reduce probability of a flake

* Use explicit assertions

* Change assertion order

* Decrease flakiness
2024-05-09 12:02:25 +00:00
Ryan Laurie
7ce866130e Remove Dead Pickers (#41801)
* update e2e tests

* rework linked entity picker

* remove deprecated pickers

* remove dead picker code

* another one bites the dust

* remove create collection on the go

* update linkedEntityPicker unit tests-

* update timeline move modal

* remove unused import
2024-05-09 05:49:16 -06:00
Mahatthana (Kelvin) Nomsawadi
ee936cbb55 Fix axios security issue by updating the upstream library version (#42448) 2024-05-09 11:44:04 +00:00
Ngoc Khuat
958cceb377 Fix mysql with multiple most recent revision (#42285) 2024-05-09 11:26:44 +00:00
Nemanja Glumac
2b9e81671f Consolidate engine utilities (#42211)
* Remove unused functions

* Remove `export` from a local function

* Remove googleanalytics related engine code

* Use `getEngines` selector instead of the deprecated Metabase `Settings`

* Use `getDefaultEngineKey`

* Use `formatSQL` function locally

* Remove unused `getEngineLogo` function

* Convert to TS

* Remove unused export

* Fix types

* Expand test coverage

* Update type

* Remove `googleanalitics` from an assertion

* Address review comment

* Expand types

* Add tests for `isDeprecatedEngine`

* Expand tests
2024-05-09 11:16:22 +02:00
Romeo Van Snick
3a33bbacfd Use the correct icon for the extract column shortcut (#42415) 2024-05-09 10:54:16 +02:00
Cam Saul
252c942335 Add metabase.actions.core module API namespace (#42433) 2024-05-09 10:09:20 +03:00
Ngoc Khuat
11594d8cef fix malli error in defendpoint (#42089)
* fix malli error in defendpoint

* fix a couple more error print-outs

---------

Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
2024-05-09 05:10:14 +00:00
Aleksandr Lesnenko
3bfd11f1ba allow using urls from other columns in link templates (#42438) 2024-05-09 01:50:29 +00:00
Ryan Laurie
0c1a1f50f8 Remove Extraneous Style Props (#42431)
* remove in modeluploadmodal

* remove unnecessary padding from new collection dialog
2024-05-08 17:39:38 -06:00
Ryan Laurie
1c5e5998bb Dashboard Picker (#41559)
* wip dashboard picker

* use in homepage selector

* remove dead code

* remove generateKey prop

* add unit tests

* cleanup

* WIP unit tests

* update personal/public interactions and tests

* update e2e tests

* allow disabling items in dashboardPicker

* add new dashboard tag invalidation

* use rtk in dashboardpicker

* use collection_id from api

* horrendous way of disabling read only items

* remove badness

* disallow selecting read-only dashboards in dashboard picker search

* pass search filter as prop

* update types and tests

* update types and tests

* address review comments
2024-05-08 17:39:12 -06:00
bryan
0468c9a7f5 adds the new watch alias, which reloads BE on file changes (#42371)
* adds watch alias, which reloads BE on file changes

* watch dev, src, test + every path in `:extra-paths`
2024-05-08 16:53:26 -06:00
Raphael Krut-Landau
54c1e07613 Add table of models to the "Browse models" page (#41954) 2024-05-08 18:08:54 -04:00
bryan
6ca8393fcb convert SocketChannelEndpoint to SocketChannel (#42419)
* convert `SocketChannelEndpoint` to `SocketChannel`

* Remove fatal logging (used for debugging)

* check for nil channel + log on unknown type

* only log unexpected transport types once
2024-05-08 20:52:44 +00:00
Ryan Laurie
3d1265641e Fix another flaky question picker unit test (#42421) 2024-05-08 20:18:26 +00:00
Cam Saul
1e9e60a0fb Cam's module linter 5000 (#42250)
* Cam's module linter 5000

* Get Kondo passing

* Revert changes to usage of mdb.setup/setup-db!

* Check ns shapes

* Add ns :require shape linter; PR feedback

* Linter fixes 🔧
2024-05-08 20:16:40 +00:00
Noah Moss
f418e685fc Allow disabling health check logging via env var (#42357) 2024-05-08 20:14:17 +00:00
Phoomparin Mano
1f416069d0 Reserve component height with defaults from visualization type in embedded questions (#42212)
* prop to reserve height and use full height by default

* require height to be passed

* add default height based on viz type

* default to 250px

* reserve table height

* remove memoization

* rely on the card size defaults constant

* multiply by a fixed constant

* correct vis to viz
2024-05-08 18:18:58 +00:00
adam-james
2455537bc1 Dashboard Param Values Common Impl for Embedding/Preview Embedding (#42052)
* Dashboard Param Values Common Impl for Embedding/Preview Embedding

Refactor the embedding api namespace to allow a bit of reuse between the embedding api and the embedding preview
api. In some cases, the implementations are not identical (in terms of the shape of data expected/endpoints
available), so this is a first step to making them the same.

Related:

https://www.notion.so/metabase/Make-embedding-preview-behave-consistently-with-actual-static-embeds-855353d8e5e8411d8164c7ac563c7d2f

* Add a test to verify that preview-embed param-values endpoint works

* Use preview embed endpoint and fix relevant tests

* Add tests

* Change name to reflect what actually happens in the function

---------

Co-authored-by: Mahatthana Nomsawadi <mahatthana.n@gmail.com>
2024-05-08 17:54:17 +00:00
Ryan Laurie
0bcba904e3 Fix flaky frontend question unit test (#42412) 2024-05-08 17:46:56 +00:00
Raphael Krut-Landau
b0bc469dfe Port CollapseSection to ts (#42333)
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-05-08 11:36:51 -04:00
Mahatthana (Kelvin) Nomsawadi
e678ed6de0 Support custom font in SDK (#42342)
* Support custom font in SDK

* Update component after merging master
2024-05-08 16:31:14 +01:00
Nicolò Pretto
1a7879031d attempt to type the return value of actions created by createThunkAction (#42328)
* attempt to type the return value of actions created by createThunkAction

* use built in Awaited instead of custom AwaitedIfPromise
2024-05-08 16:44:51 +02:00
Jeff Bruemmer
0d4043fb32 docs - fix broken link (#42391) 2024-05-08 10:39:53 -04:00
Uladzimir Havenchyk
6704d9e70a Fix overflow problem in Filter Modal sidebar (#42386) 2024-05-08 17:32:04 +03:00
Uladzimir Havenchyk
09cc197a0b Do not allow cy.pause() to go into commit (#42387) 2024-05-08 17:28:46 +03:00
Phoomparin Mano
c1862e9325 Option to customize base font size in React embedding (#42322)
* allow customizable base font size

* pass in fontSize in mantine theme

* only apply font size if it exists
2024-05-08 21:18:29 +07:00
dpsutton
5d0ad01a36 bump methodical (#42361)
now:

```clojure
❯ clj -M:"$ALIASES"
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
2024-05-07 19:55:25,167 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
```

no logs about recur targets unboxing
2024-05-08 08:26:28 -05:00
Nemanja Glumac
a91f3c0490 Remove unused useNativeQuery util (#42384) 2024-05-08 12:36:54 +00:00
Abed Habli
ca280a8f8b [docs] Updating table settings (#42324)
* updating the first section

* updating the column header formatting screenshot

* Typo

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

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

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

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-08 13:09:30 +02:00
Chris Truter
8509a8d6a0 Remove trailing slash from API route (#42320) 2024-05-08 11:52:44 +01:00
Cal Herries
07a22a8818 Increment view_count on card and dashboard views (#41882) 2024-05-08 09:56:31 +00:00
Mahatthana (Kelvin) Nomsawadi
4f25760eab Simplify code (#42374) 2024-05-08 10:17:15 +01:00
Mahatthana (Kelvin) Nomsawadi
ad9db46b10 Bump published SDK version (#42340) 2024-05-08 08:55:13 +01:00
Ngoc Khuat
faa0eebd8d Fix failed to upgrade when instances have obsolete 3rd party drivers (#42369) 2024-05-08 14:30:23 +07:00
Nemanja Glumac
f6493678db Allow multiple values for string operators in the query builder (#42101) 2024-05-08 09:07:55 +02:00
Alexander Solovyov
7f5a5d8abb Backfill QueryField on Metabase startup (#42279) 2024-05-08 09:51:24 +03:00
Cam Saul
53ee757545 Don't optimize temporal filters with unbucketed exprs against relative datetimes (#42310)
* Don't optimize [:between <expr w/ :default bucketing> <relative-datetime> ...] filters

* Update tests 🔧
2024-05-07 20:09:48 +00:00
Cam Saul
5406087e5f Support Offset() as an expression with no breakouts [backend] (#42132)
* Only nest expressions referenced in breakouts or aggregations

* Support Offset() as expression with no breakouts

* Test fixes 🔧

* Oracle test update

* Improved Oracle test

* Test update 🔧

* Fix busted test

* Fix running and saving Offset over the REST API

* Remove stray :wow

* More test fixes 🔧
2024-05-07 20:05:27 +00:00
Ryan Laurie
2c1decae01 Make Z-indexes a bit more sane (#42272)
* Add back entity picker search item tooltip

This reverts commit 7fbf839e41.

* make z-indexes a bit more sane

* fix rebase
2024-05-07 13:53:09 -06:00
Cam Saul
b67ca77bdb Only nest expressions referenced in breakouts or aggregations (#42302)
* Only nest expressions referenced in breakouts or aggregations

* Test fixes 🔧

* Oracle test update

* Improved Oracle test
2024-05-07 15:04:31 -04:00
Romeo Van Snick
7249b7df31 Allow duplicate "combine column" columns in chill mode (#42314)
* Add suffix to name if column already exists

* Add test for duplicate combine columns

* Use direct question in test

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

* Fix formatting

* Use createQuestion for other tests too

* Fix table references

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-07 18:00:32 +02:00
Nick Fitzpatrick
1488757b85 41901 command palette search view all (#42179)
* initial attempt

* search button

* small adjustments

* adding back the search bar

* adding an extra check in e2e

* i18n adjustment

* impls pr feedback

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-05-07 10:51:07 -05:00
dpsutton
64ac0d76ef Silence abs warning on startup (#42311)
before:

```clojure
❯ clj -M:"$ALIASES"
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.algo.generic.math-functions, being replaced by: #'clojure.algo.generic.math-functions/abs
2024-05-07 04:39:37,890 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
```

after:

```clojure
❯ clj -M:"$ALIASES"
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/21.0.2-tem
2024-05-07 04:40:42,561 INFO metabase.util :: Maximum memory available to JVM: 8.0 GB
```

Now no warning about `abs`
2024-05-07 10:21:16 -05:00
Mahatthana (Kelvin) Nomsawadi
7277c0c1a6 Fix Embedding SDK calling admin endpoint (#42327) 2024-05-07 16:04:00 +01:00
Aleksandr Lesnenko
6e71432b7a add chart logging own env var (#42334) 2024-05-07 14:53:21 +00:00
Mahatthana (Kelvin) Nomsawadi
4443033cef Update the README to document some SDK quirks (#42332)
* Update the README to document some SDK quirks

* Address review
2024-05-07 15:24:02 +01:00
Kamil Mielnik
18313cd703 Remove snippets from search types (#42315)
* Remove snippets in search models
- They're not supported, see model-to-db-model in search/config.clj

* Fix TS error

* Fix TS error
2024-05-07 19:50:30 +07:00
Ngoc Khuat
bb8f00bda1 fix sync dynamic table (#42312) 2024-05-07 19:17:23 +07:00
Romeo Van Snick
e2c219b0f9 Fix combine extract column drill icons (#42297)
* Use extract column icon for column extraction drill thru

* Use combine column icon for column combine drill thru
2024-05-07 10:47:39 +02:00
Ngoc Khuat
96984ed0ab Send pulses in parallel (#41772) 2024-05-07 07:30:02 +00:00
Tim Macdonald
a2282dfb2f Remove unusued code paths for automagic filtering (#42098)
* Remove unusued code paths for automagic filtering

All the way from 2018!

* Use pre-computed value
2024-05-07 14:26:57 +07:00
Ryan Laurie
2205ece6cb Basic Table Component (+ use it for API Keys) (#42287)
* add basic table component

* use basic table in api keys UI

* tweak padding

* replace test id

* update e2e test ids
2024-05-06 17:58:08 -06:00
Aleksandr Lesnenko
41bf0f9639 fix tooltip shows data for different X value (#42299) 2024-05-06 23:48:08 +00:00
Ryan Laurie
0f8beaf4a4 Entity picker/new search item component (#42009)
* add new entity picker result item

* simplify types

* enterprise icon fixes

* unit test fixes

* design updates

* address PR comments

* remove poorly implemented tooltip

* fix unit test

* simplify spinner situation
2024-05-06 16:50:29 -06:00
Ryan Laurie
a3b1d79580 Make bulk action bar reusable (#42296)
* Make bulk action bar reusable

* unify bulk action usage

* skip obsolete test
2024-05-06 15:53:25 -06:00
Aleksandr Lesnenko
bd96fa2566 Fix x-axis time series interval computation when x-values include nulls (#42292)
* add chart model logging

* fix x-axis time series interval computation when x-values include nulls
2024-05-06 19:23:56 +00:00
bryan
013a6c512a new version fixes saml20 issues (#42286) 2024-05-06 13:22:41 -06:00
bryan
f80ae194bf adds diagnostic info to troubleshooting (#42283) 2024-05-06 13:18:16 -06:00
Uladzimir Havenchyk
1ff80213fe Improve types for ParameterSettings (#42269) 2024-05-06 21:48:45 +03:00
Emmad Usmani
9a2fa4a8dd add percent change to timeseries tooltip (#42059)
* add percent change to timeseries tooltip

* move computeChange to lib/numeric

* cleaning up code in numeric.js

* color text

* add unit to key

* move change to tooltip footer

* fix extra bottom spacing

* remove color

* handle gaps in data

* clean up code

* add change to funnel tooltip

* move retained to footer in funnel

* update copy

* remove min decimal count

* rename events.tsx -> events.ts

* add test cases to line-bar-tooltips.cy.spec.js

* add specs for edge cases

* readd exports to fix numeric.unit.spec.js

* don't show for change for scatterplot

* translate retained

* use parseTimestamp instead of String

* handle quarter interval

* remove redundant dayjs calls

* handle quarter with Feburary correctly
2024-05-06 18:48:07 +00:00
John Swanson
1a5d9e82fc Add can_write to cards/dashboards in Search (#42276) 2024-05-06 11:22:52 -07:00
Jeff Bruemmer
2efdee2485 docs - field type metadata (#41223) 2024-05-06 14:10:41 -04:00
Alexander Polyankin
649de4ffde Fix wrapping in QueryColumnPicker (#42246) 2024-05-06 08:32:26 -04:00
Abed Habli
9c058c64aa Added Key Authentication Option to SSH Tunneling Docs (#42206)
* Update ssh-tunnel.md

Add SSH key authentication option to SSH tunneling docs

* Update docs/databases/ssh-tunnel.md

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

* Update docs/databases/ssh-tunnel.md

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

* Update docs/databases/ssh-tunnel.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-06 14:05:57 +02:00
Cal Herries
03381ef359 Use database-supports? instead of hard-coded driver in dataset-with-custom-pk-test (#42224) 2024-05-06 09:04:54 +01:00
lbrdnk
baa9b81bd7 Add new Druid JDBC driver (#40293) 2024-05-05 16:01:53 +02:00
bryan
47eae5a505 fix a regex validation (#42251) 2024-05-04 02:44:00 +00:00
John Swanson
60657636f0 Add can_write to /collection/:id/items (#42184)
For dashboards and cards/models only.
2024-05-03 20:50:24 +00:00
Vamsi Peri
e1469c74e1 Update feature_request.md (#42232)
Remove the language for how important is this feature to you
2024-05-03 14:10:22 -04:00
Uladzimir Havenchyk
395c89846f Adjust styles of the single active tab in parameter sidebar (#42209) 2024-05-03 20:51:26 +03:00
Jeff Bruemmer
30416f6861 docs - update filter docs (#42169) 2024-05-03 13:43:20 -04:00
Alex Yarosh
ccc9fe647d [docs] A bit more details about API (#42137)
* api details

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

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-03 17:30:21 +00:00
Phoomparin Mano
8e96f386fa Define public metabase theme and Mantine transformer for embedding SDK (#42207)
* public metabase theme type

* add tests for transforming embedding theme

* export public types

* load transformed theme override into theme provider

* migrate font family inside theme configuration

* add assertion for font family

* update README to add font family in theme options

* add font enum, fix tuple type and cleanup tests

* color tuple argument name

* use fill for colortuple
2024-05-04 00:12:15 +07:00
Nicolò Pretto
5550010892 Embed homepage, MS4 (#41990)
* use css modules instead of inline styles for cursor: default (#41644)

* add toast notification after the feedback (#41575)

* fix modal submit sending data while button says skip (#41784)

* fix: it should not send the feedback if button says skip

* add comment explaining why we check that getLastFeedbackCall() is undefined

* embedding homepage analytics (#41725)

* rename defaultTab -> initialTab

* add events schema for embedding-homepage

* fix stories

* add analytics, e2e tests and fix typo in dismiss reason

* copy embed_flow schema for better diff in the next commit

* adds isExampleDashboard to trackStaticEmbedPublished

* utm tags

* fix bug of is_example_dashboard

* better test names

* refactor embed homepage status type

* "() => {}" => "_.noop"

* add "Setup embedding" to the admin setup checklist (#41638)

* add setup embedding to the admin setup checklist

* restore whitespace as it was before

* i miss prettier (whitespace again)

* Clean up check list for embedding

Largely making a new entry for the embedding info just to fight long
lines. `:embedding-homepage-dismissed-as-done` just made the maps really
long. If we have a `:done?` under an `:embedding` keyword it reads much
more naturally.

Also, The previous diff was calling `boolean` on a var rather than
invoking the var:

```clojure
:embedding-app-origin (boolean embed.settings/embedding-app-origin)
;;                             ^^^^^^^^^^^^^^ needs to be (invoked)
```

---------

Co-authored-by: dan sutton <dan@dpsutton.com>

* Change utm tags for embedding homepage links (#42042)

* update utm tags

* utm_media -> utm_content

* add description to the checklist setup step (#42200)

---------

Co-authored-by: dan sutton <dan@dpsutton.com>
2024-05-03 18:39:25 +02:00
Mahatthana (Kelvin) Nomsawadi
b890780c5d Update readme adding more ways to run Metabase (#42217)
* Update readme adding more ways to run Metabase

* Remove running from `master` because it could break

* Update enterprise/frontend/src/embedding-sdk/README.md

Co-authored-by: Alberto Perdomo <albertoperdomo@users.noreply.github.com>

* Update disclaimer, makes it more obvious

---------

Co-authored-by: Alberto Perdomo <albertoperdomo@users.noreply.github.com>
2024-05-03 15:52:56 +00:00
Anton Kulyk
434e42023e Add viz settings to manage line style and thickness to line/area charts (#42043)
* Rename "Line style" to "Line shape"

* Add "line.style" viz setting

* Add "line.size" viz setting

* Apply new viz settings in line/area charts

* Clean up `ChartSettings` test suite

* Fix default values not applied

* Add visual test

* Add E2E test

* Rework default values

* Use constant S/M/L values for "line.size" setting
2024-05-03 16:33:23 +01:00
Mahatthana (Kelvin) Nomsawadi
166248d6c4 Fix InteractiveQuestion loader show no question before loaded (#42208)
* Fix InteractiveQuestion loader show no question before loaded

* Add tests

* Unskip a test
2024-05-03 16:03:28 +01:00
Raphael Krut-Landau
5f3cca25f4 Enable customization of columns in ItemsTable (#41777)
Lets the `ItemsTable` component have customizable columns.

The logic for this is contained in `BaseItemsTable`. This is preliminary work for #41614

This doesn't introduce any new UI, but there is a unit test for the new logic.

The main thing to check is whether the table on the collections page stills work correctly. Note how the columns adjust as you resize the viewport horizontally. (In fact, the columns will sometimes adjust as you close and open the sidebar, because the width they are paying attention to is the width of the area to the right of the sidebar.)

Closes #41908
2024-05-03 10:42:59 -04:00
Ngoc Khuat
84a7859d76 Fix Bigquery can't sync materialized views (#42092) 2024-05-03 12:47:34 +00:00
Braden Shepherdson
bf5eb3a013 Add a few tests for time granularity parameters (#42119)
The API/model schemas for dashboard parameters are general enough
that they just work for this new type, which doesn't look very different
from a value parameter right now.

Part of #42118.
2024-05-03 12:42:34 +00:00
Romeo Van Snick
3b4af16356 Add snowplow event for combining columns via chill mode header (#42173)
* Add snowplow event for column combine via header

* Add test for snowplow event

* Remove unnecessary within wrapper

* Fix linting issues
2024-05-03 13:41:13 +02:00
Romeo Van Snick
021c35aa92 Snowplow event for extract action via notebook shortcut (#42095)
* Add helper to track column extractions

* Track column extractions

* Add text for column extraction

* Pass correct extraction to trackColumnExtractViaShortcut
2024-05-03 13:40:52 +02:00
Romeo Van Snick
0691779dda Fix broken test in drill extraction (#42202) 2024-05-03 12:00:09 +02:00
Phoomparin Mano
bf6a6d3381 remove chart root padding when in embedding environment (#42164) 2024-05-03 14:35:46 +07:00
Romeo Van Snick
a616d3b6ab Add tests for url and email columns (#42144)
* Add test for email extractions

* Fix swapped domain and host examples

* Add tests for URL columns

* Fix examples for shortcut too

* Use arrow function instead of function
2024-05-03 08:48:28 +02:00
Cam Saul
3829b2ce38 MLv2: Simplify MetadataProvider protocols (16 methods/3 protocols => 7 methods/2 protocols) (#42070)
* Simplified MetadataProvider protocol

* Test fix

* Ok make CachedMetadataProvider a separate schema again after all.

* Consolidate the Metadata schemas

* Clean Kondo warnings

* Malli-ify the stuff in metabase.lib.metadata.protocols

* Fix Kondo warnings

* Test fix 🔧

* PR feedback
2024-05-03 05:41:07 +00:00
Aleksandr Lesnenko
876ff91252 fix replace missing values with zeros on time series (#42058) 2024-05-02 23:12:08 -03:00
Cam Saul
a4e4e11aff Fix LegacyMetric/Segment macroexpansion with definitions using ancient MBQL (#42087)
* Fix LgeacyMetric/Segment macroexpansion with definitions using ancient MBQL 2

* Remove stray println

* PR feedback
2024-05-03 00:54:20 +00:00
Cam Saul
69fc2b2a03 Window functions should use all breakouts except first for partitioning (#42131)
* Window functions should use all breakouts except first for partitioning

* Update the offset() test

* Update tests

* Rework how we use driver escape-alias in MLv2; fix Oracle

* PR feedback

* Test fixes 🔧
2024-05-03 00:50:45 +00:00
Jeff Bruemmer
c4ff50f25d docs - generate environment variables (#41802) 2024-05-02 18:13:42 -04:00
Uladzimir Havenchyk
c3d237899c Cleanup parameters popover (#42107)
* Cleanup parameters popover

* Convert to ts

* Drop comment

* Convert dashboard-options to TS
2024-05-02 21:23:21 +00:00
Braden Shepherdson
4fa57785b6 [QP] Support :temporal-unit parameters on MBQL queries (#42116)
This is a new parameter `:type` (and `:widget-type`) to choose a time
granularity (a `:temporal-unit`, eg. `month`, `day`, `day-of-week`)
which should replace the unit on the target field for the parameter.

The target field should be a breakout with a temporal type (date,
datetime) that's compatible with the input unit. The value of the
parameter should be a string or keyword naming one of the units:
`"month"`, `:month`.

Part of #42118.
2024-05-02 17:03:33 -04:00
Uladzimir Havenchyk
ebe0e58f07 Restore mapping and filter settings when user switches operator type to the saved (#42076) 2024-05-02 23:40:41 +03:00
Noah Moss
d1de1e5666 Optimize loading of admin permissions pages (add skip_fields flag to database metadata endpoint) (#42062)
* add skip_fields flag to database metadata endpoint

* skips loading fields on database metadata requests while on admin permissions pages

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-05-02 15:03:32 -05:00
Alex Yarosh
a330f612b7 [docs] Add TOC to a few articles (#42181)
* add TOC to Jetty article

* add ToC for debian article

* vvariables

* Update docs/installation-and-operation/running-metabase-on-debian.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-02 20:03:05 +00:00
Romeo Van Snick
50ef456400 Add analytics event for extract column in chill mode (#41774)
* Add trackColumnExtractViaHeader helper

* Add Lib.extract wrapper

* Track column extractions via header

* Fix analytics event name

* Add tests for extract action analytics

* Set up extractions metadata helper

* Use functionsUseByExtraction in analytics

* Add custom type for ExtractionTag

* Use ExtractionTag in analytics

* [MBQL lib] Add `Lib.columnExtractDrillExtractions`

This gets the extractions from a column-extract drill, which is needed
in the UI.

* Add extractionExpression wrapper

* Add extractionsForDrill helper

* Fix type signature of extractionExpression

* Use expressionParts for getting expression function

* Walk expression to get functions used

* Simplify ColumnExtractionTag

* Fix expected expression

* Be more explicit with what the guard does

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
2024-05-02 21:14:09 +02:00
Alex Yarosh
81daa11189 remove trailing slash (#42177) 2024-05-02 12:56:00 -06:00
Nick Fitzpatrick
6cc670bf52 42078 palette search links (#42167)
* Items as links

* unit tests
2024-05-02 15:40:42 -03:00
Jeff Bruemmer
a9e0b014ed add 49.8 to list of releases (#42174) 2024-05-02 14:39:07 -04:00
Abed Habli
bc7c52c520 [docs] Add Pathway for Email Settings Configuration (#42091) 2024-05-02 13:55:48 -04:00
Nemanja Glumac
ad864aa398 Fix E2E Repro #42065 failure (#42161)
* Explicitly wait for the result to load

* Remove the drill-through part from the repro
2024-05-02 16:23:05 +00:00
Phoomparin Mano
ca1dbdaa57 Apply mantine color palette to cartesian chart labels (#42148)
* use palette for rendering

* add unit tests for chart label colors

* cleanup test code

* update unit test name

* cleanup color handler

* use theme.fn.themeColor to get color
2024-05-02 15:39:07 +00:00
Nick Fitzpatrick
f852b48fc8 41994 command pallet search descriptions (#42117)
* Adding Descriptions to search results in palette

* Palette Results List component

* adjusting e2e and unit tests

* type fix

* removing duplicate theme font

* fix typo, palette types adjustment
2024-05-02 11:17:51 -03:00
Nemanja Glumac
6d2ae82bed Enable Mongo tests to run in the stress-test action (#42162) 2024-05-02 16:11:27 +02:00
Phoomparin Mano
f25830b906 Verify Metabase's theme is merged with user-supplied theme overrides (#42142)
* ensures metabase theme override is merged with user-supplied theme

* ensure both metabase and user themes are merged

* ensure existing theme override is applied

* add tests for default text colors
2024-05-02 13:59:25 +00:00
Nemanja Glumac
43c0ce979a Fix/update the hard coded description fields in containers action (#42149) 2024-05-02 15:02:00 +02:00
Ngoc Khuat
3db638f8f6 Fix mongo OOM during sync (#42140) 2024-05-02 12:15:53 +00:00
lbrdnk
33f6325c51 Skip flaky test (#42120) 2024-05-02 14:07:39 +02:00
Ngoc Khuat
eaff18734a Comment out failing snowflake test sync-dynamic-tables-test (#42145)
* Comment out failing snowflake test sync-dynamic-tables-test

* unrelated indent
2024-05-02 06:54:14 -04:00
Uladzimir Havenchyk
4a76da0b10 Fix typo in the file name (#42102) 2024-05-02 12:57:01 +03:00
Phoomparin Mano
b2cc510966 Expose theme property to metabase provider in embedding SDK (#42050)
* expose theme property in MetabaseProvider

* add more descriptions on what the theme overrides are for
2024-05-02 16:31:16 +07:00
Aleksandr Lesnenko
44ceb9eb19 support unpinning line charts from zero, pinning scatter charts to zero (#41672) 2024-05-01 21:35:27 +00:00
Alex Yarosh
2c6b94d634 [docs] Use SQL questions as sources for other questions (#42077)
* sql questions

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

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

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

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-01 21:28:26 +00:00
Alex Yarosh
4a0514b598 [docs] Custom destinations in static embedding (#42080)
* custom destinations in static embedding

* Update docs/embedding/static-embedding.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-05-01 21:25:14 +00:00
Alex Yarosh
e09397cafc cast (#42064) 2024-05-01 15:24:57 -06:00
Alex Yarosh
7329a9d857 [docs] Add "check table visibility" to troubleshooting guide (#42072)
* check visibility

* more precise

* Update docs/troubleshooting-guide/cant-see-tables.md
2024-05-01 15:24:40 -06:00
Alex Yarosh
191b59d44b surface dashboard width in toc (#42083) 2024-05-01 15:23:19 -06:00
Alex Yarosh
892006e525 [docs] use SSO for MFA (#42084)
* mfa

* plans
2024-05-01 15:21:27 -06:00
Uladzimir Havenchyk
766c1201f4 Drop unused isDashboardParameterWithoutMapping function (#42103) 2024-05-01 18:51:20 +00:00
Romeo Van Snick
0dc75042d9 Combine columns (#42021)
* [MLv2] Add `preview-expression` to eval an expression on sample data

This is needed to show the previews in the UX for the combining columns
epic #39977.

Fixes #39979.

* [MBQL lib] Add "Combine columns" drill-thru

This is following the original plan of using a drill for this. It's hard
to combine that with the "preview" functionality.

See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569)
for discussion of how we might approach that issue.

Fixes #39978.

* [MBQL lib] Add "Combine columns" drill-thru

This is following the original plan of using a drill for this. It's hard
to combine that with the "preview" functionality.

See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569)
for discussion of how we might approach that issue.

Fixes #39978.

* [MLv2] Add `preview-expression` to eval an expression on sample data

This is needed to show the previews in the UX for the combining columns
epic #39977.

Fixes #39979.

* [MLv2] Add `preview-expression` to eval an expression on sample data

This is needed to show the previews in the UX for the combining columns
epic #39977.

Fixes #39979.

* Revert "Merge branch 'mblib-preview-expressions' into combine-columns"

This reverts commit dac17f84aa, reversing
changes made to 2934fab19d.

* Revert "Merge branch 'mblib-preview-expressions' into combine-columns"

This reverts commit 2934fab19d, reversing
changes made to 6a43c22e78.

* Revert "Merge branch 'mblib-preview-expressions' into combine-columns"

This reverts commit 6a43c22e78, reversing
changes made to 2257333a8a.

* [FE] "Combine columns" drill thru (#40082)

* Type Section['icon'] properly, including the hack for summarize section

* Add combine columns section

* Add types for combine columns drill

* Add combine columns drill component stub

* Mock combine columns drill

* Add component stub

* Encapsulate typing hacks

* Extract CombineColumnsDrill

* Extract ColumnAndSeparatorRow

* Improve naming, add button to edit separators

* Translate string

* Improve styling

* Separator input

* Handle removing columns

* Rename lib.ts to utils.ts

* Implement onSubmit

* Add getNextColumnAndSeparator

* Use form for a11y

* Handle vertical overflow

* Handle horizontal overflow

* Extract formatSeparator

* Use proper translations

* Adjust min/max sizes

* Fix scrollbar being unnecessarily shown

* Display source column name

* Avoid serializing the entire column and putting it into DOM

* Use module.css extension

* Format code

* Improve a11y

* Mock combineColumnsDrillExpression and previewExpression

* Add Preview component

* Move preview logic to Preview component

* Style Preview

* Format code

* Move styles to CSS modules

* Update UI to latest designs
- move "Add another column" button
- remove "Separated by X" button
- always show separator inputs

* Remove displayInfo mock

* Add asReturned

* Update CombineColumnsDrillThruInfo

* Integrate new way of working with combine columns drill

* Fix generating expression names

* Integrate drill with click actions

* Integrate new preview workflow

* Revert "Update UI to latest designs"

This reverts commit cda039dffe.

* Use previewExpression interface correctly

* Use new preview_expression API

* Make sure columns are created with original query and stage index

* Extract usePreview and handle preview errors

* Update popover title

* Move add column button

* Fix outline being cut off

* Style preview label as per design

* Format empty separator

* Make preview scrollable

* Use project convention

* Simplify ScrollArea usage

* Use ScrollArea in CombineColumnsDrill

* Update comment

* Remove Lib.previewExpression

* Clean up the preview after removing Lib.previewExpression

* Implement getPreview

* Change default column preview to 'text'

* Remove usePreview hook which is no longer in use

* Rename Preview to Example

* Use different placeholder for separator input

* Add whitespace placeholder

* Add ColumnPicker boilerplate

* Export Input

* Use QueryColumnPicker for ColumnPicker

* Pass width to AccordionList

* Add sequences popover events with tippy

* Remove unused ColumnOption helpers

* Add testid to Example

* Add e2e test for combine column in header

* Select content of separator input on focus

* Reduce padding on example

* Add monospace variant to Text

* Use monospace variant in Example

* Use monospace font in textinput

* Match faux-select label styles to our TextInput label styles

* Add missing color

* Remove !important

* Use pre whitespace so consecutive spaces show up

* Remove empty default

* Add example for boolean

* Remove !important

* Use should.have text over contain

---------

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>

* Remove duplicated code

* Export useMantineTheme from metabase/ui

* Use useMantineTheme instead of reading theme directly

* Remove setTimeout in popover

* Use plain t instead of jt

* Move Popover dropdown sequence hack to metabase/ui

---------

Co-authored-by: Braden Shepherdson <braden@metabase.com>
Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-05-01 18:22:11 +02:00
lbrdnk
9887f2222d Add string like filtering capabilities to filter widget (#42065)
* Add string like filtering capabilities to filter widget

* Address the review suggestions

* Add e2e test

* Address review suggestions

* Update mongo e2e test id so it hopefully corresponds to CI data

* Update e2e test to use id gathered from actual data

* Expand and improve the E2E reproduction

* Explicitly reference the underlying issues we're reproducing

* Update frontend/src/metabase/querying/components/FilterPicker/FilterPickerBody/FilterPickerBody.tsx

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

* Fix parens

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2024-05-01 17:14:00 +02:00
Braden Shepherdson
d142da9984 [QP, lib] Allow multiple arguments to :contains, :starts-with, etc. (#41958)
These string matching clauses only allowed two arguments previously.
Typically `[:contains field x]` to match a field against a literal.

This adds similar desugaring for `:contains`, `:does-not-contain`,
`:starts-with` and `:ends-with` that is currently done for
multi-argument `:=` and `:!=`:

```clojure
[:contains field x y z] ;; ->
[:or [:contains field x] [:contains field y] [:contains field z]]

[:does-not-contain field x y z] ;; ->
[:and [:does-not-contain field x]
      [:does-not-contain field y]
      [:does-not-contain field z]]
```
2024-05-01 12:53:03 +00:00
Anton Kulyk
bdb1a02236 Fix flaky dashboard repro tests (issue 39863) (#42046) 2024-05-01 10:35:23 +00:00
Anton Kulyk
df7a85339b Fix flaky dashboard subscription test (#42051) 2024-05-01 10:26:28 +00:00
Romeo Van Snick
5f2e323414 Notebook text extraction shortcut (#41578)
* Add shortcuts to suggestions

* Add shortcuts group

* Add split icon

* Start implementing extract column modal

* Pass alwaysExpanded from prop to accordion items

* Allow disabling search on QueryColumnPicker

* Only render columns that support extraction

* Add columnExtractions helper to Lib

* WIP

* Add examples for column extraction

* Use Lib.columnExtractions to create extraction picker

* WIP: Create clause from extraction

* Use mb- prefix in color

* Add extract wrapper

* Use updated column extraction types

* WIP: extract clause

* Use JSDoc for todo

* Handle extract column submit in expression editor

* Set name based on extract expression

* Suffix column displayNames to avoid conflicts

* Rename combine test to disambiguate it from extract test

* Add e2e test for column extractions

* Correctly render button as button

* Add tests for email extractions

* Use correct font in expression button

* Remove error when selecting an extraction

* Use last expression

* Use handleExpressionChange

* Add tests for url extractions

* Rename to lastExpression

* Add issue link to the todo

* Move Button into ExtractColumn

* Use unstyled button for ExtractColumnButton
2024-05-01 10:59:26 +02:00
lbrdnk
ddc0f98ff1 Add cancelation exception for vertica (#42047) 2024-05-01 10:07:06 +02:00
Ngoc Khuat
7f53ac9343 Capture card's last_used_at (#41006) 2024-05-01 07:34:17 +00:00
Cam Saul
856b449626 Fix Snowflake/Redshift filtering on date for timestamp with time zone columns (#41864)
* Fix Snowflake filtering on date for `timestamp with time zone` columns

* Snowflake should just generate raw SQL for literals

* Go ahead and fix other Snowflake stuff and reenable a bunch of disabled tests

* Snowflake test fixes 🔧

* Minor test improvements

* Fix Redshift and Vertica as well.

* Address PR feedback
2024-05-01 03:24:17 +00:00
Cam Saul
2b5d207f2d Add kondo hook so LSP can jump to driver definition (#41856) 2024-05-01 00:49:34 +00:00
Noah Moss
7ed6b66d02 Add docs link to perms email (#42004) 2024-04-30 21:24:24 +00:00
Alex Yarosh
ba0d786bdd [docs] Update the slack channel settings (#42071)
* update the option name

* Update docs/configuring-metabase/slack.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-04-30 21:08:58 +00:00
Alex Yarosh
fecc05925a note about default users (#42067) 2024-04-30 15:07:10 -06:00
Nemanja Glumac
0a84028335 Remove unused endpoint reference from the services.js (#42040) 2024-04-30 22:05:44 +02:00
Uladzimir Havenchyk
9228c5eb7a Update codecov github action (#42034) 2024-04-30 21:33:46 +03:00
Phoomparin Mano
30b90a8909 migrate sdk reducers to use builder callback (#42038) 2024-04-30 16:50:21 +00:00
Nemanja Glumac
389886d90c Remove native dataset from services (#41209)
* Use RTK Query endpoint to fetch native dataset in preview query modal

* Remove unused selector

* Remove endpoint from `services`

* Fix type error

* Use `getLearnUrl` selector instead of the deprecated MetabaseSettings

* Fix the error potentially being undefined when passed to a helper

* Fix weird destructuring syntax
2024-04-30 17:26:50 +02:00
Phoomparin Mano
341882cff7 Bump react-embedding-sdk version and copy README to output (#42020)
* bump react embedding sdk version to 0.1.0

* publish to metabase-embedding-sdk-react using version 0.1.1

* add commands to copy LICENSE and README files to output

* use the scoped metabase package

* rename file content variable

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

* update embedding sdk package description

* update content variable in script

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

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-04-30 15:16:10 +00:00
Mahatthana (Kelvin) Nomsawadi
868ccdf26e Fix "react" typo (#42032)
It should be capitalized
2024-04-30 15:44:32 +01:00
adam-james
2d29f05f20 Store Parameter Values Set by User on a per-user basis (#40415)
* Store Parameter Values Set by User on a per-user basis

This is a WIP for #28181 and the notion doc:

https://www.notion.so/metabase/Tech-Maintain-user-level-state-in-dashboards-for-filters-fc16909a3216482f896934dd94b54f9a

Still to do:

- [ ] validate the table/model design
- [ ] hook up the endpoints mentioned in the doc (2 in api/dashboard)
- [ ] return the user specific parameter values on /api/dashboard/:dashboardID endpoints
- [ ] write a few tests to capture the intent of this feature

* Accidentally deleted a digit in the change ID timestamp

* first pass at writing user param values to the db.

It's in a doseq here which is probably not the correct way to go yet, but it's a step in the right direction.

* Hydrate dashboard response with `:last_used_param_values` key

If the user has previously set a parameter's value, it will show up in the map under that parameter id.

If the user has no parameter value set, that entry will be 'null'.

* Use proper fn name

* Only save or retreive user params if there's a current user id

* Add model to necessary lists

* Only run query when there are parameter ids to run it with

* Add a test to confirm that last_used_param_values works

* Add models test namespace for CRUD test

* The hydration is checked in the dashboard api test already
2024-04-30 14:19:10 +00:00
Cal Herries
34e22f90dc Move away from deprecated slack upload endpoints (#41974) 2024-04-30 14:18:59 +00:00
Nemanja Glumac
1cead3a86a Remove "dataset duration" endpoint (#42025)
* Remove `dataset_duration` from MetabaseApi

* Remove unused endpoint
2024-04-30 16:08:28 +02:00
Mahatthana (Kelvin) Nomsawadi
3c8ec9648f Fix invalid reducer key warning in frontend unit test's initial state (#42022)
* Fix `sdk` key not expected on a reducer

* Use existing type instead

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Add default SDK state when using `renderWithProvider` with `sdk` mode

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-04-30 14:33:23 +01:00
Uladzimir Havenchyk
8f0b21b47d Update copy for native questions wihtout variables during column mapping (#41650) 2024-04-30 13:28:49 +00:00
Ryan Laurie
085767de68 Revert "Fix default font in mantine (#41858)" (#41968)
* Revert "Fix default font in mantine (#41858)"

This reverts commit 131594bc62.

* define font fallbacks
2024-04-30 12:57:17 +00:00
Raphael Krut-Landau
39ba5192b3 Move ItemsTable components to a higher-level folder (#41952)
Since `ItemsTable` will be used in Browse models, this PR moves that file and related components to `metabase/components/ItemsTable`.
2024-04-30 08:51:38 -04:00
Mahatthana (Kelvin) Nomsawadi
7e215b7e46 Revert "Update SDK to use a temparay npm package name (#42023)" (#42026)
This reverts commit e86366562f.
2024-04-30 12:22:07 +00:00
Mahatthana (Kelvin) Nomsawadi
e86366562f Update SDK to use a temparay npm package name (#42023)
We should change this back once we can publish the package with the
desired name.
2024-04-30 13:04:33 +01:00
Romeo Van Snick
a8c6aace75 Add analytics event for combining/extracting columns (#41767)
* Add analytics event for combine columns shortcut

* Add new version for question analytics schema

* Add column_combine_via_shortcut event

* Add custom_expressions_used field

* Use trackSchemaEvent to track combine column event

* Move trackColumnCombineViaShortcut to separate file

* Fix typo in event key

* Add column_combine_via_column_header

* Add column_extract_via_shortcut

* Add column_extract_via_column_header

* Add database id for question

* Move analytics file to frontend/src/metabase/query_builder

* Allow null for custom_expressions_used

* Add test for snowplow event

* Fix typo in schema

* Add max length to custom expressions

* Add description to list item
2024-04-30 14:03:42 +02:00
Mahatthana (Kelvin) Nomsawadi
912b5e51fd Fix Line or bar chart not rendering in SDK (#42015) 2024-04-30 10:38:10 +01:00
Oisin Coveney
253fd4b39e Add customization for loader and error components (#41828) 2024-04-30 11:49:27 +03:00
Alexander Solovyov
858aa15082 serdes: do not die on unreadable yamls (#41887) 2024-04-30 08:26:07 +00:00
Alexander Polyankin
256835b0c0 Load card metadata recursively (#41963) 2024-04-29 19:59:58 -04:00
dpsutton
5df74763ff Revert "Store fields used in MBQL cards in QueryField (#41821)" (#42005)
* Revert "Store fields used in MBQL cards in QueryField (#41821)"

This reverts commit 0da8100558.

* comment out test
2024-04-29 17:10:09 -05:00
lbrdnk
6581a28ea3 Make resolve-private-key include private-key-options in database details (#41941)
* Update resolve-private-key and add test
2024-04-29 23:30:43 +02:00
Braden Shepherdson
435d823aad [MBQL lib] Add Lib.extractionExpression to get the expression directly (#41885)
Previously they could only be added to the query with `Lib.extract`, but
this returns the expression the extract would add.
2024-04-29 21:05:45 +00:00
Cam Saul
dd0f14a55f Add Offset() expression (BE + FE) (Part 1) (#41346)
* Fix add-alias-info matching for nominal field literal refs

* Minor cleanup

* Minimize diff

* A bit more cleanup

* Cumulative aggregations w/ multiple breakouts should reset counts (#2862)

* Update dox

* Do the nesting FIRST before adding alias info.

* Remove unused

* FE for Offset()

* Cleanup stray code

* Prettier

* Kondo

* Test fixes 🔧

* Better error message when no breakout

* Support offset as an expression with no breakouts. Still require an ORDER BY tho.

* Fix most stuff

* Hack city??????

* Revert nest-query changes and disable the offset-no-breakout test for now.

* Appease TypeScript

* Test fix 🔧

* Oracle & MySQL test fixes

* Test fixes 🔧

* Remove maxWorkers for FE unit tests
2024-04-29 16:52:08 -04:00
Jeff Bruemmer
799b7df38e docs- sql sidebar (#41442) 2024-04-29 16:32:23 -04:00
Nemanja Glumac
815ac5c779 Add tag type mapping for the pulse (#41992)
Resolves #41467
2024-04-29 22:26:22 +02:00
Luis Paolini
c683f3fdf6 Bump MongoDB driver for 50 (#41894) 2024-04-29 21:10:48 +02:00
Nemanja Glumac
d38e1faf69 Re-wire the Collections entity to use RTK Query under the hood [WIP] (#41825) 2024-04-29 20:41:44 +02:00
Noah Moss
6ea128a130 Add entity_id columns to users and groups (#41816) 2024-04-29 14:33:05 -04:00
Phoomparin Mano
d6d1fe23f0 Add metabase commercial license to embedding-sdk (#41768)
* add metabase commercial license to embedding-sdk

* attach commercial license file to npm package

* refactor license file generation
2024-04-29 17:42:31 +00:00
Alex Yarosh
7d64ca2623 cleanup (#41965) 2024-04-29 10:31:32 -06:00
Jeff Bruemmer
a77ce0ec7f fix period, update headings (#41961) 2024-04-29 12:30:36 -04:00
Uladzimir Havenchyk
a9e641a675 Use 4 cores running jest tests on CI (#41939) 2024-04-29 19:15:06 +03:00
Raphael Krut-Landau
afd75eeaa5 Port code relating to moderation to ts #41756 (#41903)
preliminary work for https://github.com/metabase/metabase/pull/41614
2024-04-29 11:01:15 -04:00
Tim Macdonald
6a5efe5e7b Native Query Analyzer cleanup (#41950)
* Missing sentence for NQA documentation

* Add a test for optional field filter parsing
2024-04-29 15:40:57 +01:00
Aleksandr Lesnenko
2555075350 remove echarts branch from the uberjar workflow (#41921) 2024-04-29 10:36:29 -03:00
Mahatthana (Kelvin) Nomsawadi
48e48889bf Add Embedding SDK readme (#41776)
* Add Embedding SDK readme

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

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

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

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

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

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

* Clarify the result from `useQuestionSearch`

* Remove the mentioning of API key

Since we want to drop API key support for embedding SDK

* Add more detail

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

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

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

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

* Update enterprise/frontend/src/embedding-sdk/docs/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Remove private GH repo

* Remove the compatibility table until we've made the first release

* Fix typo

* Add details how to run with locally built SDK

* Correct Metabase Embedding SDK case

* Make the instruction more concise

* Add a disclaimer

* Update config removing deleted property

* Add Oisin suggestion that was missed from rebasing

* Clarify plugin section

* Tweak SDK Readme

* Polish the limitation section

* Update the code sample into 4 sections making it easier to read

* Tweak overview and features section of README

* Add metabase configuration section

* Clean up section

* Replace the doc in the root embedding SDK directory

* Some tweaks and improvements to SDK README

* Tweaks to SDK README: wording, change flow, add section on running MB from master

* Update enterprise/frontend/src/embedding-sdk/README.md

Co-authored-by: Oisin Coveney <oisin@metabase.com>

* Feedback section

* Add simple InteractiveQuestion example

* SDK README: Tweak Slack wording

* Standardize fullstops + fix typo

* Clean up formatting

---------

Co-authored-by: Nicolò Pretto <info@npretto.com>
Co-authored-by: Phoomparin Mano <poom@metabase.com>
Co-authored-by: Oisin Coveney <oisin@metabase.com>
Co-authored-by: Alberto Perdomo <alberto.perdomo@gmail.com>
2024-04-29 14:09:30 +01:00
Mahatthana (Kelvin) Nomsawadi
fe3d71af8d Fix SDK style overridden by CSS reset (#41891) 2024-04-29 15:39:21 +04:00
Cal Herries
9a8ddfef39 Mitigate redshift flakes by not dropping view in test (#41876) 2024-04-29 10:13:01 +01:00
Romeo Van Snick
647f8f7f92 Add case for boolean columns in example (#41889) 2024-04-29 11:11:30 +02:00
Aleksandr Lesnenko
246c8a8387 dc.js to echarts migration (#41395)
Co-authored-by: Emmad Usmani <emmadusmani@berkeley.edu>
Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: Mark Bastian <markbastian@gmail.com>
Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>
Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-04-26 20:14:40 -03:00
John Swanson
a536c2d7bf Add collection.effective_ancestors to model search results (#41746)
* Add `collection.effective_ancestors` to search

Fixes #41909

The ultimate goal here is to be able to display a UI that showed the entire (effective) path to each collection.

This was a bit more painful than I'd hoped. The primary issue is that we
tied two things together:

- scoring results

- "serializing" results (really, partially serializing results, because
we do more work to shape the data later)

Why is this a problem? The `top-scorers` function took a transducer and
returned the *serialized* top scorers. Later, when we need to operate
on *all* the top results (in this case, to collect all the collection
IDs and names that we know of), we're looking at the serialized results.

In our case, we needed some data (collection location) that wasn't
included after serialization. We could add it, of course, but it's
frustrating to need to change the API of what data is *returned* from
the endpoint for purely internal purposes (changing the data available
during *processing*).

I ended up pulling serialization out of the scoring function. At some
point down the road, we should go ahead and move the `serialize`
function out of the `search.scoring` namespace entirely - there's really
no reason for it to belong there as far as I can tell.
2024-04-26 22:47:05 +00:00
Sloan Sparger
b460b29fd2 fixes db perms error when permissionEditor is null (#41900) 2024-04-26 15:51:52 -05:00
Ryan Laurie
54aa214798 Remove Popular Items Entity (#41851)
* remove popular items entity

* support secondary icons
2024-04-26 14:48:00 -06:00
Ryan Laurie
131594bc62 Fix default font in mantine (#41858) 2024-04-26 14:47:36 -06:00
Ryan Laurie
552c10139e Remove defunct form components (#41902)
* remove defunct form components

* fix lil type errros
2024-04-26 14:33:15 -06:00
Ryan Laurie
7fd5d3ff6b Remove Recents Entity (#41846)
* add entity agnostic getIcon function

* remove recent items entity

* fix tests and support secondary icon

* fix display name
2024-04-26 13:52:14 -06:00
Cam Saul
b0a9b11ca1 Fix cumulative aggregations in queries with filters and breakouts (#41792) 2024-04-26 22:40:50 +03:00
Nick Fitzpatrick
e89012f35e Command Palette - Prioritize recent items, do not filter search results (#41854)
* prioritize recent items, do not filter search results

* fixing unit test
2024-04-26 15:34:45 -03:00
Nick Fitzpatrick
0e70276ff7 removing form props from entities and EntityForm component (#41849) 2024-04-26 15:04:13 -03:00
Nick Fitzpatrick
fda53853af Migrate DatasetFieldMetadataSidebar to new Forkmik components (#41571)
* temp

* rework DatasetFieldMetadataSidebar to use new form components

* temp

* removing unneeded import

* fixing display name form field

* temp

* more temp

* onChange for form elements

* e2e adjustment
2024-04-26 15:04:01 -03:00
Denis Berezin
5b6a926a0f SDK - Add Reset button for InteractiveQuestion + drills popover styles fix (#41860)
* Button

* Reset button

* Skip failing unit test

* Fixes after merge
2024-04-26 17:30:17 +00:00
Alexander Solovyov
dd66a69a26 sql parsing: more correct field matching (#41781) 2024-04-26 14:46:25 +00:00
Braden Shepherdson
a24abaeae1 [QP, lib] Add expression functions for month, quarter, weekday names (#41548)
The new expressions `:month-name`, `:quarter-name` and `:day-name`
return the (user localized) names for these units, given the
corresponding number.

For example, 4 yields `"Apr"`, `"Q4"` or `"Wednesday"` respectively.

The `column-extract` drill uses these new expressions, rather than
generating its own `:case` clauses for them.

Note that `:day-of-week` and `:month-of-year` are tricky cases for i18n, but there are tests that exercise them thoroughly.

Part of the follow-up for Extract Column epic #38964.
2024-04-26 14:09:35 +00:00
Oisin Coveney
e35b346c58 Fix Interactive Question Loading state (#41880) 2024-04-26 14:02:17 +00:00
Nemanja Glumac
40b17c926c Remove the ace editor gutter line number highlight (#41881) 2024-04-26 15:40:07 +02:00
Romeo Van Snick
8e111abc09 Static extract examples (#41778)
* Add subTitle to ClickActions

* Add examples to column extractions

* Add test for examples

* Add test for examples

* Use rem helper

* Use JSDoc for todo

* Disambiguate between ColumnExtraction and ColumnExtractionInfo

* Update type of getExample

* Use rem helper
2024-04-26 15:26:57 +02:00
Alexander Solovyov
0da8100558 Store fields used in MBQL cards in QueryField (#41821) 2024-04-26 15:25:49 +03:00
Cal Herries
3a80be379f Add view_count for cards and dashboards and populate it from view_log (#41840) 2024-04-26 12:07:40 +00:00
Nemanja Glumac
19efc5cd8b Remove the custom resize handle from the notebook native query preview sidebar (#41877)
* Remove the custom resize handle

* Increase the handle width
2024-04-26 13:59:31 +02:00
Romeo Van Snick
304308e7de Notebook custom expression editor "combine columns" shortcut (#41872)
* Notebook combine columns (#41379)

* Add CombineColumns dialog component

* Add combine columns to the expression editor widget

* Add placeholder for empty and space to the input

* Drop the first separator

* Remove empty string from eventual concat

* Add example to Combine Colunmns builder

* Show example in monospace

* Do not collapse spaces in example

* Use monospace in separator input

* Reorganise column flatten helper

* Add back button on combine buttons modal

* Select text when focussing separator input

* Add minimum height to example

* Use that same separator as the last row

* Use ExpressionWidgetHeader instead of hand-rolled header

* Fix type when generating example

* Correctly update default separator when a url column gets set

* Swap url and email checks

* Move column input into separate component

* Use QuerySelector for column select

* WIP: customise dropdown

* Export Input

* Use a button to render the column selector

* Add combine icon

* Use shortcut suggestion shortcut for combine columns

* Allow interacting with buttons inside the popover

* Use longDisplayName for button label

* Add asReturned

* Use asReturned in CombineColumns modal

* Make faux-select button styles match normal input

* Return focus to button when select closes

* Fix type of focus event

* Move ColumnInput component to a separate file

* Only show combine column shortcut on custom column

* Add missing test ids

* Add e2e test for combine column shortcut

* Remove white fill from paths

* Add color to combine icon

* Use function expression, not declaration

* Remove comment

* Move initial default separator to constant

* Remove unused select option helpers

* Add isInteger helper to Lib

* Add case for integer columns

* Add unit tests for util

* Add SuggestionShortcut type to props for Suggestions

* Remove {enter} which broke test

* Do not use !important

* Simplify classname into object-style

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

* Use direct override on Button instead of class

* Fix formatting issue

* Use .select() to select input

* Avoid selecting placeholder text

* Avoid losing focus when window loses focus

* Rename evt to event

* Add monospace variant to Text

* Use monospace variant in Example

* Use monospace font from theme

* Match faux-select label styles to our TextInput label styles

* Remove empty default variant

* Add limit to the test case

* Remove unnecessary within wrapper

* Use rem

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

---------

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

* Remove intercept we're not waiting for

* Use have.text instead of contain

* Use cy.button

* Expand cancel test

* Remove duplicate title

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2024-04-26 11:21:10 +00:00
Ngoc Khuat
4542696805 Fix format-rfc3339 uses 12 hour format (#41870) 2024-04-26 17:51:20 +07:00
Nemanja Glumac
09b56609c4 Fix broken E2E reproduction for #39221 (#41875)
* Re-write E2E repro for 39221

* Convert to TS
2024-04-26 12:48:33 +02:00
dependabot[bot]
a73a0a7400 Bump mysql2 from 3.9.4 to 3.9.7 (#41823)
Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.9.4 to 3.9.7.
- [Release notes](https://github.com/sidorares/node-mysql2/releases)
- [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md)
- [Commits](https://github.com/sidorares/node-mysql2/compare/v3.9.4...v3.9.7)

---
updated-dependencies:
- dependency-name: mysql2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-26 08:40:55 +00:00
Ngoc Khuat
efb8de81f1 Fix the flake in add-required-filter-if-needed-test due to field order (#41815)
* Fix the flake in add-required-filter-if-needed-test due to field order

* /s/oredered-filter/ordered-filter
2024-04-26 08:28:25 +00:00
Braden Shepherdson
dd9e126bb6 [MBQL lib] Add column-extractions to the top level (#41525)
Column extractions are "canned" expressions based on a column's
type. For example, we might extract the weekday from a temporal column,
or the domain from an email or URL column.

This logic already existed inside the `column-extract` drill; this pulls
it out as a top-level concept, since extractions are also being
integrated into the notebook editor apart from drills.

Part of the follow-up for Extract Column epic #38964.
2024-04-25 19:28:12 +00:00
Noah Moss
9950139325 Add a note about perms graph changes to the API changelog (#41836) 2024-04-25 17:44:50 +00:00
Luis Paolini
7a6ef85777 Bump snowflake driver (#41790)
I need to test a bugfix with a customer (Fixed an issue with parsing large responses (greater than 16MB)) in 49.7
2024-04-25 19:36:27 +02:00
Tim Macdonald
c3c7f52cfd Clean up Native Query Analyzer documentation (#41830)
Also add the replace-names fn, which is a simple pass-through to Macaw #modularity
2024-04-25 16:06:53 +00:00
Oisin Coveney
53ecef5b6a Remove SDK API keys from existence (#41780) 2024-04-25 15:54:19 +00:00
Tim Macdonald
0c0eab21f4 Remove stale cards endpoint (#41826)
(It's coming back in similar form, but EE-only)
2024-04-25 14:46:42 +00:00
Noah Moss
90591f3baf Fix Cloverage failures on master (#41799) 2024-04-25 14:22:02 +00:00
Ryan Laurie
4cbae2ee70 Use RTK in entity picker (#41735)
* use rtk in entity picker

* use rtk for collection creation

* fix tricky entity shenanigans

* update collection_id type
2024-04-25 07:31:49 -06:00
Cal Herries
aec91c4bb9 Remove driver-specific code from sync-fields! (#41588) 2024-04-25 12:42:49 +01:00
Nemanja Glumac
53cf083fe5 Re-wire the Pulses entity to use RTK Query under the hood (#41775)
* Throw on `Pulse.api.delete`

* Add boilerplate `subscriptionApi`

* Add `unsubscribe` endpoint

* Add types

* Delete unused `Pulses.objectActions`

* Re-wire `Pulses` entity to use RTK Query for `objectActions`

* Re-wire `Pulses.api` to use RTK Query under the hood

* Add cache invalidation

* Fix `setArchived` objectAction

* Update DELETE response type

* Fix `params`
2024-04-25 12:54:45 +02:00
Oisin Coveney
cac42f2190 Add SDK test scaffolding and tests for use-init-data + SDK components (#41695) 2024-04-25 12:15:41 +03:00
Alexander Solovyov
400b554999 Revert "Store fields used in MBQL cards in QueryField (#41623)" (#41820)
This reverts commit f5bd634428.
2024-04-25 09:14:02 +00:00
Jeff Bruemmer
86ecf6c5b1 update list of releases (#41804) 2024-04-24 20:06:32 -04:00
John Swanson
6ead51550d Add collection ID to /collection/:id/items (#41757)
Pretty much does what it says on the tin.
2024-04-24 21:59:01 +00:00
Nick Fitzpatrick
c4134211ac Migrate SMTPConnectionForm to Form Provider (#41703)
* Migrate SMTPConnectionForm to Form Provider

* e2e test adjustment

* updaing setting mock

* PR feedback
2024-04-24 18:22:31 -03:00
Tim Macdonald
48b63228ef Upgrade to Macaw 28 (#41769)
It has a slightly different API shape. We're not using it right this
minute, but we're about to and it seemed nice to separate this out into
its own PR
2024-04-24 19:28:46 +00:00
Denis Berezin
ba014a5d02 SDK plugins system PoC (#41560)
* Isolate click actions

* Self review fixes

* Add global plugin config

* Review fixes

* Drill with custom view

* Review fixes
2024-04-24 13:51:07 +00:00
Alexander Solovyov
f5bd634428 Store fields used in MBQL cards in QueryField (#41623) 2024-04-24 16:38:59 +03:00
Romeo Van Snick
9e9e310d72 Export input wrapper and remove label hack (#41728)
* Export Input

* Move TextInput overrides to Input

* Remove the :not(:only-child) hack the Schedule component

* Remove the :not(:only-child) hack from  DateInput

* Remove the :not(:only-child) hack from FileInput

* Remove the :not(:only-child) hack from Select

* Remove the :not(:only-child) hack from TextArea

* Remove the :not(:only-child) hack from TimeInput

* Reproduce pre-hack margin in Schedule component

* Undo overzealous refactor
2024-04-24 15:26:27 +02:00
Nemanja Glumac
be35a04c37 Re-wire the PersistedModels entity to use RTK Query under the hood (#41686)
* Add persisted info types

* Keep exports sorted alphabetically

* Add boilerplate `perist` API

* Use RTK Query for the `PersistedModels.list`

* Throw for unused `PersistedModels` endpoints

* Update types

* Re-wire PersistedModels `get` requests to use RTK Query

* Fix the endpoint

* Refresh model cache using RTK Query

* Add cache invalidation

* Fix `PersistedModels.api.get` endpoint options

* Remove stray TODO comment

* Explain the difference between the `persisted-info` and the `persisted-model` tags

* Invalidate `persisted-info` list upon refreshing a single model
2024-04-24 14:43:09 +02:00
Mahatthana (Kelvin) Nomsawadi
e9fd9a4054 Render click actions popover inside the embedding SDK root (#41726) 2024-04-24 12:56:30 +01:00
Cal Herries
325b9827b4 Test for sample database having sync scheduled (#41752)
Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-04-24 10:10:13 +01:00
Cal Herries
48f739255e Track public and embedded card views, and collection views in the view log (#41748) 2024-04-24 09:14:20 +01:00
Cal Herries
5dee3b828f Fix missing permissions for sample DB (#41724) 2024-04-24 08:58:16 +01:00
Emmad Usmani
3a7d577555 allow scientific notation (e) in ChartSettingInputNumeric.tsx (#41755)
* allow scientific notation (`e`) in `ChartSettingInputNumeric.tsx`

* update spec

* update comment
2024-04-23 18:18:37 -07:00
Sloan Sparger
0d6bb3a1f2 Fix flaky perms EE to OSS downgrade test (#41759) 2024-04-23 21:47:22 +00:00
Nick Fitzpatrick
f72048575a tabbing through save question modal (#41729) 2024-04-23 17:02:22 -03:00
Chris Truter
719fc4f750 Invalidate model caching when updating upload table (#41653) 2024-04-23 17:14:00 +00:00
Jesse Devaney
8fc3dd1b72 Fix queries being re-run because of broken parameters comparison (#41659)
* fix queries being re-run because parameters were being compared with different sorts

* add test to validate and enforce behavior
2024-04-23 13:01:59 -04:00
LeAnn
8d9d49c035 Update environment-variables.md (#40040) 2024-04-23 12:42:54 -04:00
Ryan Laurie
73a90baa43 dont use buildjet for e2e or frontend tests (#41733)
* dont use buildjet for e2e

* dont use buildjet for frontend either
2024-04-23 15:44:57 +00:00
Romeo Van Snick
ab287b053a Be more consistent with borders and avoid double borders (#41565)
* Be more consistent with borders and avoid double borders

* Mark the aggregation 'Custom Expression' button as an action

* Remove color from action headers

* Remove bottom border from last child

* Remove top border from first child

* Make section header classes consistent

* Add border to search header

* Use correct color for borders

* Add props to enable borders in AccordionList

* Add borders to column picker elements
2024-04-23 17:33:34 +02:00
Mahatthana (Kelvin) Nomsawadi
b5f952f39f Remove unused function (#41720) 2024-04-23 16:11:20 +01:00
Nemanja Glumac
585b4ea46b Remove unused monospaceText prop (#41721) 2024-04-23 16:02:37 +02:00
Nick Fitzpatrick
5a43dffdac Migrate Entity Copy Modal away from EntityForm (#41534)
* CopyQuestionForm

* CopyDashboardForm

* inital values adjustment, e2e tests

* FormObserver
2024-04-23 10:16:37 -03:00
Alexander Solovyov
bb3194ba5f move cache business logic to model from api (#41677) 2024-04-23 12:52:42 +00:00
Oisin Coveney
03db4e387b Replace isLoggedIn and isInitialized with LoginStatus (#41637) 2024-04-23 15:07:47 +03:00
Cal Herries
dc90d8de22 Exclude internal content from admin checklist and usage stats (#41697) 2024-04-23 10:54:01 +00:00
Cal Herries
6964931a99 Improve test coverage for describe-fks and describe-fields (#41528) 2024-04-23 11:29:36 +01:00
adam-james
5834ebf561 Note the format_rows changes in the api changelog (#41268) 2024-04-23 10:48:17 +02:00
Nemanja Glumac
4b71e9aa64 Use the proper case for a "year" token format (#41715)
* Use proper case for year date format

Fixes #40493

* Add regression test for specific filters in different locales

* Actually use the locale
2024-04-23 10:31:45 +02:00
Mahatthana (Kelvin) Nomsawadi
9d2503b15d Fix TippyPopover default text color not visible after migration (#41716) 2024-04-23 09:30:07 +01:00
Oisin Coveney
5b96078a0d Add dynamic fonts to embedding SDK (#41179) 2024-04-23 10:14:29 +03:00
Noah Moss
39627a3acb New default permissions for groups (#41323) 2024-04-22 19:22:05 -04:00
adam-james
97861b154c Dates Binned by Week Export Formatting Matches App (#41619)
* Dates Binned by Week Export Formatting Matches App

Fixes: #41492

Before, the dates binned by week would be formatted as follows in CSV and JSON exports:

`Week 1 - 2024`

But that doesn't match the App's format of a Date Range:

`January 1, 2024 - January 7, 2024`

So, now the exports will apply formatting in this same way.

Note that a second bug (#41616) exists on the Frontend preventing the column formatting being applied in the app. This is
frontend only, and the csv and json exports will match the column formatting settings (eg. abbreviated dates and
alternative separators will be used in the export).

* add test and change default week style

* Week format test change

* also fix incorrect :hour formatting
2024-04-22 21:47:49 +00:00
A. Marius Rabenarivo
faab06e3de [tech debt] Stop using ms/BooleanString and only use ms/BooleanValue (#41390)
* [tech debt] Stop using ms/BooleanString and only use ms/BooleanValue

ms/BooleanString will coerce to a string, and we should probably get rid of it and only ever use ms/BooleanValue which will always coerce to a boolean
We want the coercion layer to give us values that are helpful, and true is more helpful than "true".
So we should remove ms/BooleanString and calls to parseBoolean

* Remove ms/BooleanString usage in api/native_query_snippet.clj

* Remove test case related to ms/BooleanString

* Remove the BooleanString schema def as no longer used
2024-04-22 13:13:29 -06:00
Raphael Krut-Landau
d73067b4bb Port six collection-related components to TypeScript (#41632)
BaseItemsTable
BaseTableItem
BulkActions
CollectionContentView
CollectionCopyEntityModal
ItemsTable
2024-04-22 17:17:49 +00:00
Oisin Coveney
ea9a8f56e5 Modify JWT session token logic to use immediate return value from action (#41694) 2024-04-22 17:04:17 +00:00
bryan
b8166365ea add validated migration checksums 45 46 47 and 48 (#41662) 2024-04-22 09:50:18 -06:00
Nemanja Glumac
f6d5db166f Re-wire the Snippets entity to use RTK Query under the hood (#41656)
* Throw for `Snippets.api.delete`

* Add boilerplate `snippet` RTK API

* Add boilerplate RTK-compatibility layer for main `Snippets.api` endpoints

* Add types

* Add cache invalidation
2024-04-22 15:30:50 +02:00
Mahatthana (Kelvin) Nomsawadi
82d90d043c Fix not sending necessary HTTP headers when downloading results (#41633)
* Fix not sending necessary HTTP headers when downloading results

* Fix fail E2E tests

* Add E2E test

* Fix failed tests

* Fix unit tests

* Fix download on subpath

* Fix unit tests for subpath
2024-04-22 12:30:12 +01:00
Tim Macdonald
68fc6f4477 Rename 'mac' alias to 'macaw' (#41680) 2024-04-22 10:58:27 +00:00
Nemanja Glumac
aee64bb9e4 Re-wire the Revisions entity to use RTK Query under the hood (#41558)
* Add RTK Query `revision` API

* Re-wire `Revisions` entity `list` to work with RTK Query

* Re-wire the `Revisions` entity `revert` to work with RTK Query
2024-04-22 09:11:02 +02:00
Noah Moss
42f73a056a New default DB permissions (#40869) 2024-04-19 17:16:43 -04:00
Braden Shepherdson
e435824b20 [QP, lib] Add new expression functions for host, domain, subdomain (#41540)
These functions are implemented with hairy regular expressions, and
it's more user-friendly and future-proof to name those functions in MBQL
rather than baking the `regexextract` and regex into the user's query.

It lets us evolve the regexes in the future if we detect a bug, and it
improves the UX since the user sees a meaningful function instead of

    regexextract([My URL Column], "(?<=[@\.])(?!www\.)[^@\.]+(?=\.[^@\.]{1,3}\.[^@\.]+$|\.[^@\.]+$)")

Also refactors the regexes somewhat so that they work for emails as well as URLs, and there's always just one layer of `:regex-match-first`.
Previously this was separated into two steps: URL or email to host, and host to (sub)domain.

Part of the follow-up for Extract Column epic #38964.
2024-04-19 14:49:53 -04:00
Noah Moss
46c4805157 Add a new migration to clean up deprecated perm types (#41649) 2024-04-19 14:00:52 -04:00
Uladzimir Havenchyk
f7f0282087 Reset mapping after change of operator for native questions (#41615)
* Reset mapping after change of operator for native questions

* Add a basic test

* Better name for a test
2024-04-19 20:01:01 +03:00
lbrdnk
271bbdf4f9 Remove defaultauthdb portion of mongo connection string (#41553) 2024-04-19 18:12:05 +02:00
Alex Yarosh
c6b7bda2ef [docs] Revise Okta SAML docs (#41493)
* okta docs

* clarifying group mapping methods

* links

* Apply suggestions from code review

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

* review feedback

* Typo

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-04-19 09:59:20 -06:00
Kamil Mielnik
5169036492 Account for non-hydrated properties in GET /api/dashboard (#41622)
* Account for non-hydrated properties in GET /api/dashboard

* Fix provideTags

---------

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2024-04-19 15:58:55 +00:00
Nicolò Pretto
f570c4ab79 add withUndos option to renderWithProviders to render Undos during … (#41576) 2024-04-19 17:35:09 +02:00
lbrdnk
2072e0602a Use dbname from database details instead of stats returned from Mongo (#41549)
* Use dbname from details instead of from stats

* Add mongo sharded cluster CI job
2024-04-19 17:32:16 +02:00
Nemanja Glumac
435f9acbad Re-wire the Groups entity to use RTK Query under the hood (#41480)
* Delete unused endpoint from `PermissionsApi`

* Add group tag helpers

* Define RTK Query 5 main endpoints for `permissionApi` (group)

* Re-wire 5 main api methods in groups entity to work with RTK Query

* Re-wire `clearMember` action to work with RTK Query

* Add `Groups.api.update`

* Update types

* Fix membership failing to update after `CREATE_MEMBERSHIP`

* Make sure `members` is not undefined

* Fix cache invalidation
2024-04-19 16:28:49 +02:00
Noah Moss
79583b9892 [Feature branch] Split data access and query builder access (#41581)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-04-19 10:13:38 -04:00
Kamil Mielnik
e6fa8f9058 Fix Dispatch type (#41631)
* Fix Dispatch type

* Fix typing

* Fix types
2024-04-19 11:38:53 +00:00
Mahatthana (Kelvin) Nomsawadi
855b32452b Add prefix to CSS custom properties (#41574)
* Migrate --border-*

* Migrate *breadcrumb*

* Migrate --color-bg-black

* Migrate --color-bg-dark

* Migrate --color-bg-light

* Migrate --color-bg-medium

* Migrate --color-bg-white

* Migrate --color-border

* Migrate --color-brand*

* Migrate --color-error

* Migrate --color-focus

* Migrate --color-shadow

* Migrate --color-success

* Migrate --color-text-dark

* Migrate --color-text-light

* Migrate --color-text-medium

* Migrate --color-text-white

* Migrate --color-white

* Migrate --default-border-radius

* Migrate --default-button-border-radius

* Migrate --default-font-family

* Migrate --default-font-size

* Migrate --default-header-margin

* Migrate --gap-1

* Migrate --icon-width

* Migrate --input-border-color

* Migrate --input-border-radius

* Migrate --margin-*

* Migrate --muted-color

* Migrate --padding-*

* Migrate --page-header-padding

* Migrate --subtitle-color

* Migrate --title-color

* Reset to master

* Remove unused --color-text-default

* Remove unused --color*

* Remove unused CSS custom properties

* Prefix only necessary CSS custom properties
2024-04-19 12:18:49 +01:00
Oisin Coveney
8e4632208a Convert EmbeddingContext to Sdk Store slice (#41585) 2024-04-19 13:59:35 +03:00
Uladzimir Havenchyk
5b9522cfc9 Add a way to update filter type and operator from parameter sidebar (#41555) 2024-04-19 12:01:45 +03:00
Nemanja Glumac
2ab84940ed Introduce task api using RTK Query and use it to replace Tasks entity (#41452)
* Throw for unused Tasks endpoints

* RTK Query `taskApi`

* Wire tasks entity list and get endpoints to use RTK Query

* Fix typo

* Expose `taskApi`

* Rework `TaskModal` to use RTK Query api

* Throw on `Tasks.api.get`

* Rework `TaskApp` to use RTK Query api

* Delete `Tasks` entity

... which never should've been an entity in the first place.

* Delete unused `TaskApi` entry

* Fix next pagination page not being properly disabled

* Do not export `isLastPage` function

* Convert TasksApp to TS

* Use Mantine Tooltip

* Remove stray comment

* Add empty lines for better legibility

* Update the response type

* Define `task_details` type more strictly

* Use the existing `DatabaseId` type

* Provide tags for `list` and `get` endpoints

* Address code review

* Handle error and loading in the `TasksApp`

* Handle error and loading in the `TaskModal`

* Extract the page size into a variable

* Index databases without mutation

* Refactor TaskModal
2024-04-19 00:54:04 +00:00
John Swanson
370671017c Don't say we'll cache archived models (#41329)
When we actually run the job to cache models, we select "refreshable
models", which selects `PersistedInfo` where:

- the `state` is something refreshable, and

- the question marked for caching is actually a model, and

- the question hasn't been archived.

However, when we selected `PersistedInfo`s to display to the user, we
didn't apply any conditions. Instead, we included PersistedInfo where
the question was not a model, or where the question had been archived.

To prevent confusion, let's hide these.

Fixes https://github.com/metabase/metabase/issues/41318
2024-04-18 13:57:34 -07:00
Ryan Laurie
427fbc1c82 Fix invisible user items in search filters (#41604) 2024-04-18 20:20:02 +00:00
Raphael Krut-Landau
96f9d6c14e [Cache] Add "Invalidate cache now" button (#40972) 2024-04-18 18:26:57 +00:00
Denis Berezin
198ebcf5d1 Fix Embedded dashboard parameters parse runtime error (#41545)
* Fix parameters parse

* Add e2e test

* Add e2e test
2024-04-18 17:15:56 +00:00
Jeff Bruemmer
9797a74c21 add redshift to list of dbs that support uploads (#41594) 2024-04-18 13:01:26 -04:00
Cal Herries
091c4a68d8 Fix null characters in JSON breaking CardRevisionAddType for postgres (#41584) 2024-04-18 16:59:34 +00:00
Raphael Krut-Landau
470df0bf7f [Cache] Schedule strategy follow up (#41420)
* Put Schedule in two columns
* Simplify timezone display
* Support 24-hour format
* Fix bugs
2024-04-18 12:03:02 -04:00
Kamil Mielnik
6bf0ada3c3 Bump dompurify in yarn.lock (#41583) 2024-04-18 15:38:33 +00:00
Ryan Laurie
784c26ac7a Question + Model Picker (#40207)
* WIP questionpicker

* use to replace dashcard content

* much better stuff

* question picker

* values source card modal

* create action form

* awesome hacky fix for crashing model detail page

* use entity picker in sandboxing modal

* deprecate ye olde question picker

* keep old question picker in add-card dashboard sidebar

* better last level check

* update types

* make stuff better

* fix rebase conflicts

* better initial value handling

* update e2e tests

* sweet sweet unit tests

* fix sandbox tests

* fix tests

* type fix

* fixes

* search style improvements

* remove unused prop

* safer path detection

* delayed loading spinner

* change confirm default

* set default collection for placeholder card

* address review comments

* update unit tests

* update e2e tests

* fix re-rebase

* add some happy little comments
2024-04-18 15:25:05 +00:00
Braden Shepherdson
8ff9805d9d [MBQL lib] Allow more filtering options for string PKs (#41477)
The filters for _numeric_ PK and FK filters are slightly different than a general numeric column. That's fine for numeric keys, but with string keys that same set of numeric filters was being returned, and then the ones for strings were removed. That left only `Is` and `Is Not` for a string PK or FK.

This PR allows more flexibility in filtering by string PKs and FKs, by checking the base type of the column and using the right set of filters for the type of key.

Closes #40665.
2024-04-18 08:46:01 -04:00
Mahatthana (Kelvin) Nomsawadi
14f1e19a91 Bump dompurify (#41564) 2024-04-18 13:33:37 +01:00
Nemanja Glumac
ee80dea28a Introduce pagination to RTK list endpoints (#41538)
* Add the pagination type

* Add the pagination helper

* Update types

* Update `user` API

* Update `collection` API

* Update `search` API

* Update `UserListQuery` type

* Explicitly define default pagination inputs

* Remove the pagination helper

* Update and fix types

`limit` and `offset` are actually nullable.

* Separate types (again)

* Fix `PaginationResponse` type
2024-04-18 12:21:16 +00:00
Chris Truter
d521d628ca Increase timeout for with-dynamic-redefs test (#41516) 2024-04-18 12:30:48 +02:00
Alexander Solovyov
fcca920e95 migrate caching settings over to the new cache_config table (#41462) 2024-04-18 13:03:09 +03:00
Lena
e9f1142287 Link the process in the CODEOWNERS file (#41507) 2024-04-18 11:36:48 +02:00
Phoomparin Mano
e21201cb4b Links to metabase URLs should open in the same window in link cards (#41508)
* external link cards should apply the correct target attribute

* add unit tests for absolute and relative question links in link cards
2024-04-18 09:32:17 +00:00
Chris Truter
4a3cdd0e51 Test that delete CSV argument is passed through (#41562) 2024-04-18 09:27:45 +00:00
Cal Herries
8e3ac99a85 Exclude sample content and "Metabase Analytics" content from usage stats (clone) (#41522) 2024-04-18 09:18:59 +00:00
Nicolò Pretto
c288e4d9f3 Feedback for the Embedding Homepage (#40746)
* FeedbackModal for the Embedding Homepage

* add source and change to correct endpoint

* fix tests, adding await and fixing endpoint

* use toEqual to also check for the source

* addresses PR feedback

* button becomes Send when email is written

* make 'comments' optional, trim inputs and refactor tests

* product-feedback endpoint (#40974)

* mvp of the proxy endpoint for the product feedback

* cleanup and fixes

* email :string -> ms/NonBlankString

* revert my solution

* Dan diff file

* makes fields other than source optional

* don't use default value in dev, to not spam the prod endpoint

* change from setting to function for product-feedback-url, as it's not meant to be changed by end users

* changed endpoint as per https://metaboat.slack.com/archives/C010ZSXQY87/p1712918951362979?thread_ts=1704910781.153589&cid=C010ZSXQY87

* fix wrong dismiss reason sent for 'I'm not interested right now'

* Update frontend/src/metabase/home/components/EmbedHomepage/EmbedHomepage.tsx

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

* renamed field: feedback -> comment

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-04-18 10:04:41 +02:00
Mahatthana (Kelvin) Nomsawadi
80ada89391 Scope html styles and CSS custom properties (#41527) 2024-04-18 09:01:14 +01:00
Cal Herries
f02b79a621 Add curate permissions for "All Users" for example collection (#41512) 2024-04-18 07:28:57 +00:00
Ngoc Khuat
d1a7cec69c Count Field usage (#39671) 2024-04-18 03:45:36 +00:00
Kamil Mielnik
dee6226ea9 Migrate dashboards to RTK (#41311)
* Add provideDashboardListTags and provideDashboardTags

* Keep the utils sorted alphabetically

* Include collection tags in dashboard tags

* Add getDashboard

* Migrate basic CRUD dashboard endpoints to RTK

* Migrate remaining dashboard endpoints to RTK

* Fix save dashboard action

* Remove unused favorite/unfavorite dashboard endpoints

* Fix copy dashboard action

* Move types to types file

* Type dashboard API requests

* Fix get

* Fix typo

* Pass body

* Add a comment

* Support noEvent option to fix a failing test
2024-04-17 22:40:24 +00:00
Uladzimir Havenchyk
152ca0e500 Fix formatting of pre-release.yml (#41497) 2024-04-18 00:41:32 +03:00
Noah Moss
39cf70c334 Revert "[Feature branch] Split data access and query builder access (#39209)" (#41552)
This reverts commit e0e4ade04e.
2024-04-17 16:11:22 -05:00
Braden Shepherdson
20efd0e6f8 [MBQL lib] Github auto nag on metabase.lib.js changes (#41251)
Add a Github workflow to nag on a PR that changes `metabase.lib.js` without updating `docs/developers-guide/mbql-library-changelog.md` as well.

You can set the `.metabase-lib/no-change` label to override for a change that edits the namespace without materially changing the API.
2024-04-17 16:38:17 -04:00
Alexander Solovyov
75f669b227 [cache] log query hash during calculation of eligibility (#41530) 2024-04-17 23:10:32 +03:00
lbrdnk
6f14f039aa Cancel statement on completion of execute-reducible-query (#41470)
* Cancel statement on completion of execute-reducible-query

* Address review remarks
2024-04-17 20:53:42 +02:00
Chris Truter
83cbaae024 EE endpoint for deleting CSV uploads (#41293) 2024-04-17 18:35:59 +00:00
Noah Moss
e0e4ade04e [Feature branch] Split data access and query builder access (#39209)
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: Nick Fitzpatrick <nick@metabase.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
Co-authored-by: Sloan Sparger <sloansparger@users.noreply.github.com>
Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-04-17 14:32:17 -04:00
Romeo Van Snick
42ce333d51 Fix broken test in FilterPicker (#41523) 2024-04-17 17:59:31 +02:00
Cal Herries
09e16f6fc8 Use fk-metadata instead of table-fk-metadata everywhere (#41375) 2024-04-17 15:36:05 +00:00
Nicolò Pretto
cb6075a569 fix: border appearing on night theme if bordered=false (#41514) 2024-04-17 16:06:43 +02:00
Mahatthana (Kelvin) Nomsawadi
a2cdc1345d Migrate float.modules.css (#41510)
* Migrate .floatLeft, .floatRight

* Remove unused components
2024-04-17 13:48:10 +00:00
Braden Shepherdson
0bde1fc9eb [MBQL lib] Column Extract from URL, email requires regex support (#41484)
Not all drivers support regular expressions. Don't return the
Column Extractions for URL -> (sub)domain and email -> domain unless the
database can support the regular expression matches.

Part of the follow-up for Extract Column epic #38964.
2024-04-17 12:59:00 +00:00
Uladzimir Havenchyk
320307f765 Remove not flaky tests from flaky group (#41496) 2024-04-17 15:26:11 +03:00
Mahatthana (Kelvin) Nomsawadi
81db2adb17 Migrate .clearfix (#41509) 2024-04-17 13:21:16 +01:00
Ngoc Khuat
d2905f89e2 Revert "Add BEC team codeowner (#41500)" (#41505)
This reverts commit 9b0e2817ca.
2024-04-17 09:38:22 +00:00
Ngoc Khuat
9b0e2817ca Add BEC team codeowner (#41500) 2024-04-17 15:29:36 +07:00
Nicolò Pretto
2b126f5ddb add unit tests for #41440 (#41465) 2024-04-17 09:05:53 +02:00
Oisin Coveney
d1e8e441f6 Convert EmbedFrame.module.css to CSS modules (#41367) 2024-04-17 09:16:46 +03:00
Denis Berezin
caac0cb646 Embedding SDK - Fix table header styles calculation (#41449)
* Fix table styles calculation

* Review fixes

* Fix unit tests
2024-04-17 00:55:09 +03:00
Braden Shepherdson
8c2c556ad3 Use cached Malli validators/explainers; make :fn schemas cacheable (#39947)
This improves our Malli performance substantially! Many of our code paths were calling vanilla `malli.core/validate` or `malli.core/explain`; these redo the (possibly expensive) compilation of the schema into a validator or explainer for every call.

We should use the caching versions in `metabase.util.malli.registry` everywhere, and our runtime performance will be much improved.

However when I started using these cached versions, I found that the memory use was growing out of control. Eventually I tracked this down to `:fn` schemas. Functions are only comparable by pointer equality, so they make poor cache keys. `(fn ...)` or `comp` calls in a schema on a `mu/defn` function **get re-created for every call of the `mu/defn`'d function**! That's a big time sink recompiling the schemas if we're *not* caching, and a huge memory sink if we *are* caching!

This PR pulls every such schema I could find out into a `def` so it uses the same closure and is cacheable. I'd like to automate that in some part of the Malli pipeline, or maybe a linter rule, but I haven't found a good way to do it yet.

Part of #39946.
2024-04-16 13:16:24 -04:00
Nemanja Glumac
093308d23d Re-wire the Users entity to use RTK Query under the hood (#41312)
* Define the types for the `create` user request

* First draft for the create user API using RTK Query

* Export RTK user API

* Define explicit `create` api for the user entity

* Define `updatePassword` mutation

* Wire users entity `resetPasswordManual` to use RTK under the hood

* Use `updatePassword` mutation

* Wire users list calls

* Remove unused `update_password` from services

* Fix the dispatch used to list users

* Dispatch the action type and the payload

* Wire `deactivateUser` to work with RTK

* Wire `reactivateUser` to work with RTK

* Delete unused entries from `UserApi`

* Convert the reducer to use `switch` statement

* Remove unused user `send_invite` endpoint from FE

* Wire `resetPasswordEmail` in users entity to work with RTK

* Provide cache invalidation for the `userApi`

* Add `provideUserListTags` helper

* Pass `email` as a sole argument

* Throw on `get` a user

This endpoint hasn't been used in a long itme.
Removed in https://github.com/metabase/metabase/pull/41334/files#diff-241e0afa11f03a0942eb322aa47695e58496379b0b6d42e6e59ecf6a20fe623cL448

* Use RTK Query to `updateUser`

* Fix wrong syntax

* Use RTK Query to `getUser`

It was used by `.load` and `fetch` after all.

* Export `useUpdateUserMutation`

* Refactor `getRecipientsList`

* Fix response type for the `getUser`

* Pass user id as a sole argument instead of in an object

* Fix users entity `get` method

* Fix the user update password form

* Fix unit tests

* Fix deactivate and reactivate query invocations

See e949812.

* Adjust types according to the feedback

* Order utils alphabetically

* Throw on `delete`

* Revert "Fix unit tests"

This reverts commit 2c329e8364.

* Fix FE unit test mocks

* Rename imports to use plural for consistency

* Fix one last remaining FE unit test
2024-04-16 15:48:05 +00:00
Nemanja Glumac
da9125f8b0 Fix double await syntax in a FE unit test (#41435) 2024-04-16 16:18:48 +02:00
Romeo Van Snick
176f631782 Add most used functions to suggestions when they open (#41267)
* Add list of most popular functions and aggregations

* Render 'All functions' link on expression dropdown

* Suggest popular functions when no input is given

* Do not return focus to search bar

* Default to not matching any substring

* Open suggestions when the expression editor opens

* Group expressions by group

* Render group titles in dropdown

* Match the expression suggestions height to the design

* Add tests for popular functions

* Convert tests to it-style

* Only return supported popular functions

* Limit most used functions group to 5 items

* Make the suggestion footer keyboard-accessible

* Make a different group for popular aggregations

* Remove padding on suggestion list

* Resize list

* Add test for popular functions in suggest

* Move showMetabaseLinks into args

* Remove unneeded optional chain

* Clarify popup issue in ACE hack

* Use correct target for links

* Reference correct method in comment

* Split up popular expressions

* Remove Set around popular functions/aggregations

* Do not allow interacting with suggestion header

* Do not use _ prefix for variable

* Add verb in test

* Remove unused async in test

* Test if functions are in document

* Move tests for suggestWithFooter to separate file

* Use correct target in link

* Fix typo in key

* Allow picking suggestion when textbox is empty

* Remove unnecessary cast

* Avoid double scroll bars

* Only show link to all functions when editor is empty

* Split up popular functions between expressions and filters

* Fix type of popular variable

* Use the same heuristic for footer as for popular expressions

* Close suggestions when the editor is not focused

* Add missing open prop in test

* Simplify test

* Add selector for expression editor widget

* Fix e2e tests

Fix e2e tests

* Avoid non-interactive clicks from closing the dropdown

* Use custom expression helpers in broken test

* Fix test

* Remove should exist check for selector
2024-04-16 16:16:14 +02:00
Chris Truter
d95e990284 Add test for how uploads sanitize similar columns (#41412) 2024-04-16 14:05:53 +02:00
Uladzimir Havenchyk
03e9e1c63f [e2e] Unify dashboard filter editing (#41443) 2024-04-16 10:38:51 +00:00
Alexander Solovyov
801445b1e1 global setting to enable/disable native sql parsing (#41315) 2024-04-16 13:21:49 +03:00
Ngoc Khuat
10f892ff25 missing test case for update scan field values schedule (#41459) 2024-04-16 09:36:08 +00:00
Oisin Coveney
e5a0255909 Refactor and convert DataSelector.module.css to CSS modules (#41362) 2024-04-16 11:01:15 +03:00
Nicolò Pretto
c393df2a72 revert dashcard border to put back transparency for transparent embed… (#41432) 2024-04-16 09:02:11 +02:00
Phoomparin Mano
585f49ddb8 add heypoom to the embedding team in team.json (#41458) 2024-04-16 13:42:19 +07:00
Oisin Coveney
19420a2b49 Convert rounded.module.css to CSS modules (#41357) 2024-04-16 09:26:08 +03:00
Ngoc Khuat
9b8df36dde Migration to remove scan field values triggers for DBs that turn it off (#41348) 2024-04-16 04:52:58 +00:00
Braden Shepherdson
6f5b24c6ed [MBQL lib] Add "Combine columns" drill-thru, lib/as-returned, API changelog (#41060)
The drill-thru is mostly a stub to put an entry in the context menu. Most of the logic for this is built on the FE using the existing functions for consuming and creating expressions.

See [thread](https://metaboat.slack.com/archives/C06P22KS4JH/p1712264174056569) for a lot more context.

This also adds `docs/developer-guide/mbql-library-changelog.md` and documents adding this function to the library as the first change in the API. I'll follow up in another PR with Github automation to expect the changelog to be updated whenever `src/metabase/lib/js.cljs` changes.

Fixes #39978.
2024-04-15 17:21:29 -04:00
Jesse Devaney
7eb6bf61ce Fix progress bar display error in query builder (#41330)
* fix progress bar in query builder

* add spec to verify regression fix
2024-04-15 17:14:32 -04:00
Jeff Bruemmer
793e5130d1 docs - note on model caching (#41446)
* note on model caching

* update link

* blockquote
2024-04-15 13:36:40 -07:00
Jeff Bruemmer
263534f965 docs - note on internal metabase account (#41207) 2024-04-15 13:20:15 -07:00
Chris Truter
b829cb7d6d Fix reflection getting Liquibase URL (#41411) 2024-04-15 16:35:36 +00:00
Tim Macdonald
6e0f5059ae Move QueryField creation to the card's after-update (#41421) 2024-04-15 17:32:55 +01:00
Alex Yarosh
e9256fda39 [docs] Static embedding description (#41282)
* static embedding

* Update docs/embedding/start.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-04-15 10:19:27 -06:00
Denis Berezin
7d19cb3d68 Convert TableInteractive.module.css (#41294) 2024-04-15 18:20:01 +03:00
Ngoc Khuat
616cfb1adb Fix unable to disable scan field values (#41170) 2024-04-15 14:20:42 +00:00
Cal Herries
e0e95863e5 Fix resources/sample-content.edn (no such file or directory) error running jar (#41408) 2024-04-15 16:51:41 +03:00
Chris Truter
af442cbf6c Fix infinite loop attack for bouncycastle (#41406)
See: https://security.snyk.io/vuln/SNYK-JAVA-ORGBOUNCYCASTLE-6612984
2024-04-15 11:52:10 +00:00
Nicolò Pretto
d952d779a0 fix header being rendered (with its border) on dashboard embedded with titled=false and only one tab (#41399)
* fix header being rendered (with its border) on dashboard embedded with titled=false and only one tab

* embedframe-header -> embed-frame-header
2024-04-15 11:35:13 +00:00
Uladzimir Havenchyk
d7e839dad5 [Parameters] Add "Disconnect from cards" button (#41380) 2024-04-15 11:14:47 +00:00
Chris Truter
0660f2a88c Release migration locks during shutdown (#41089) 2024-04-15 10:32:08 +00:00
dependabot[bot]
bf68fbd480 Bump mysql2 from 3.6.3 to 3.9.4 (#41398)
Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.6.3 to 3.9.4.
- [Release notes](https://github.com/sidorares/node-mysql2/releases)
- [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md)
- [Commits](https://github.com/sidorares/node-mysql2/compare/v3.6.3...v3.9.4)

---
updated-dependencies:
- dependency-name: mysql2
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-15 10:17:35 +00:00
Oisin Coveney
688ef2ce21 Convert transitions.module.css to CSS modules (#41361) 2024-04-15 13:10:49 +03:00
Oisin Coveney
6a5a27bf0e Convert shadow.module.css to CSS modules (#41360) 2024-04-15 13:10:30 +03:00
Oisin Coveney
803c79c4f9 Convert legend.module.css to CSS modules (#41355) 2024-04-15 11:10:07 +03:00
Oisin Coveney
22525bad0e Convert width.module.css to CSS modules (#41359) 2024-04-15 11:09:50 +03:00
Cal Herries
de043add81 Log errors fetching sync metadata (#41376) 2024-04-15 10:07:10 +03:00
Raphael Krut-Landau
8006c2c68e Add Schedule strategy to Admin > Performance (#41230)
Adds a Schedule strategy to the Admin / Performance page

![image](https://github.com/metabase/metabase/assets/130925/d78ff74d-df1c-477a-b157-a0c3f21a861b)

[Loom](https://www.loom.com/share/5623cd5d772e417ba2e58c29ae1b8c14?sid=9844f0db-5bb1-4d35-af9b-206d263f5516)

As discussed with @luizarakaki, rather than modify the legacy `SchedulePicker` to work with this use case, I made a new version of it - a `Schedule` component - that uses Mantine and a better (though imperfect) approach to localization. For now, the dropdowns are not vertically aligned in this Schedule picker - something I can try to remedy later if that is important.

Tests for the Schedule component will be added in a follow-up PR.
2024-04-12 23:13:03 -04:00
adam-james
f826a28fc2 Bugfix 37914 wrong filters UI in embedding (#41342)
* Keep Filter Values for enabled Parameters in Embedding

Fixes: #37914

Previously, we removed locked parameters entirely. This is to prevent leaking potentially sensitive values.

However, for the situation where the same field backs 1 locked or disabled paramter and 1 enabled parameter, we do
still want to send the paramater values, because the enabled parameter implies that the values are permissible to see
in the embed.

So, this change will still remove parameters based on their 'disabled/locked/enabled' status, but will NOT remove the
linked field ids if they're also being used by 'enabled' parameters.

This results in the backend correctly sending necessary parameter values to the embed, where the frontend can then
render the appropriate UI instead of falling back to just text filters.

* test the case where a locked and enabled param share same field

* Address feedback. Added comment to explain classify fn
2024-04-12 21:49:50 +00:00
Denis Berezin
bec3d589db Add interactive question component with drill down (#41106)
* Add interactive question component

* Remove excess click actions for embedding

* Disable non-working drills

* Cleaner components api

* Clean up

* Review fixes

* Fix lint error

* Review fixes

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-04-12 22:41:32 +03:00
Uladzimir Havenchyk
ade34797d8 Render parameter type and operator in parameter sidebar (#41218) 2024-04-12 22:27:12 +03:00
lbrdnk
5d8cc872fa Exclude implicitly joinable columns from visible-columns in fk-columns-to (#41274)
* Exclude implicitly joinable columns from visible-columns in fk-columns-to

* Add test

* Update description
2024-04-12 20:59:01 +02:00
Cam Saul
b93e99dcd6 [P1 BUG FIX] Cumulative aggregations with multiple breakouts should reset counts when values of breakouts other than change (#41340)
* Fix add-alias-info matching for nominal field literal refs

* Minor cleanup

* Minimize diff

* A bit more cleanup

* Cumulative aggregations w/ multiple breakouts should reset counts (#2862)

* Update dox

* Do the nesting FIRST before adding alias info.

* Remove unused
2024-04-12 18:48:03 +00:00
Cal Herries
bdb34a3309 Sample content (#40753) 2024-04-12 19:21:54 +03:00
Nick Fitzpatrick
e57313a1f4 No implicit any on callbacks (#41314)
* no implicit any on callbacks

* cleaning up use of any

* small adjustments

* PR feedback and unit test adjustment

* typing click handler
2024-04-12 12:58:33 -03:00
Cal Herries
423a02fa45 Log sync errors in CI to debug redshift flakes (#41022) 2024-04-12 15:27:32 +00:00
Cal Herries
92181ab153 Add INFO log for each table being fingerprinted (#41365) 2024-04-12 17:50:41 +03:00
Cal Herries
bcf8ddb1e2 Mitigate redshift flakes by not dropping tables in upload tests (#41366) 2024-04-12 17:49:04 +03:00
Romeo Van Snick
b355cc240c Expression editor suggestion improvements (#41304)
* Add help text icon in expression editor suggestions (#41092)

* Add helptext to expression suggestions

* Deduplicate getDatabase calls

* Allow customising popover width

* Split out help text content component

* Render an info icon with the help text

* Remove duplicated defaults for popover

* Explicitly wait for suggestion items in test

* Remove commented out code

* Use React imports directly

* Rename e to evt

* Inline getHelpText when creating suggestions

* Avoid overlapping content

* Remove unnecessary Fragment

* Avoid selecting item when clicking link or button inside element

* Allow shifting popover

* Stop Popover mouse events for bubbling

* Use onMouseDown instead of onMouseDownCapture to avoid clicks inside popover from triggering select

* Add help text to all suggestions that are know mbql functions

* Expression suggestions clean up (#41236)

* Move ExpressionEditorSuggestions to tsx

* Convert ExpressionEditorSuggestions to functional component

* Simplify suggestion match component

* Move ExpressionEditorSuggestions a separate folder

* Remove default export

* Use Popover instead of Tippy for suggestions list

* Fix suggestions tests

* Remove data-ignore-outside-clicks

* Add default for suggestions

* Fix e2e test

* Move helptext wrapper to ExpressionEditorTextfield

* Switch to metabase/ui for Button

* Use arrow function
2024-04-12 16:39:59 +02:00
Cal Herries
1c5e14884d Correct sync error handling in redshift tests (#41363) 2024-04-12 17:07:40 +03:00
Oisin Coveney
2051da0be7 Convert Formula component to TS (#41349) 2024-04-12 16:42:28 +03:00
Nicolò Pretto
baf69d50f1 embed-homepage ms2: connect example dashboard (#41180)
* connect the example dashboard id setting to the embedding homepage (#41138)

* connect the example dashboard id setting to the embedding homepage

* fix types

* Update frontend/src/metabase/home/components/EmbedHomepage/StaticTabContent.tsx

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

---------

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

* use isNotNull

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-04-12 13:04:45 +00:00
Cam Saul
dd40ac5f74 Fix add-alias-info matching for nominal field literal refs (#41326)
* Fix add-alias-info matching for nominal field literal refs

* Minor cleanup

* Minimize diff

* A bit more cleanup
2024-04-12 14:20:49 +02:00
Oisin Coveney
85f486c2ea Convert AccountHeader to TS (#41181)
Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-04-12 10:36:35 +03:00
Nemanja Glumac
450ab94d9b Remove unused keys from UserApi (#41334) 2024-04-12 09:01:50 +02:00
Raphael Krut-Landau
639aa29c4a In Admin > Performance, display minimum query duration in seconds (#40970) 2024-04-11 21:35:36 +00:00
Cam Saul
bb97466c43 Convert auto-bucket-datetimes middleware to MLv2 (#41157)
* Convert `auto-bucket-datetimes` middleware to MLv2

* New Kondo rule time.

* Test & lint fixes 🔧

* Fix typos

* Apply suggestions from code review

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

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-04-11 18:24:44 +00:00
Mahatthana (Kelvin) Nomsawadi
9e88fb35fd Migrate bordered.module.css (#41307)
* Migrate .bordered

* Migrate .borderBottom, .borderTop

* Fix typo

* Remove unused classes

* Migrate .borderRight

* Migrate .borderLeft

* Migrate .borderLight

* Migrate .borderError

* Migrate .borderSuccess

* Migrate .borderBrand

* Migrate .borderTransparent

* Migrate .borderless

* Migrate .borderMedium

* Review: Add missing CS import
2024-04-11 18:38:47 +01:00
Nick Fitzpatrick
29ef29e99a 40895 entity path in palette (#40985)
* collection and db breadcrumbs

* compact breadcrumbs

* adding navigation keybindings

* recent_views and search changes to always include collection or db name

* removing breadcrumbs, display parent name

* removing unneeded components

* e2e and FE unit tests

* waitFor

* e2e tests for keybindings

* help

* be tests passing

* PR feedback and type adjustments

* unit test adjustment
2024-04-11 17:14:35 +00:00
Jeff Bruemmer
f1ca96647c docs - drop note on sandboxes (#41220)
* drop note on sandboxes

* model caching

* reinstate model caching sandbox warning
2024-04-11 13:24:17 -03:00
Chris Truter
8441ffc233 Don't return nil schema, and test more table fields (#41169)
* Test created_at and schema fields
* Coerce nil schema to empty string
2024-04-11 16:06:33 +02:00
Oisin Coveney
9f5e92e431 Add JWT auth flow to Embedding SDK code (#40902)
Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-04-11 17:04:45 +03:00
Alexander Polyankin
bd9c63c55d Migrate alerts to RTK (#41190)
* Replace AlertApi

* Replace AlertApi

* Replace AlertApi

* Fix bugs

* Fix bugs

* Fix typo

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-11 12:49:18 +00:00
dependabot[bot]
4b97c42702 Bump tar from 6.1.11 to 6.2.1 (#41306)
Bumps [tar](https://github.com/isaacs/node-tar) from 6.1.11 to 6.2.1.
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/isaacs/node-tar/compare/v6.1.11...v6.2.1)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-11 12:23:09 +00:00
Uladzimir Havenchyk
926e572588 Render correct parameter sidebar tab content after switching parameter (#41144) 2024-04-11 10:26:43 +00:00
Cal Herries
4dcc6bc9fa Re-enable Redshift uploads and make uploads tests faster (#41088) 2024-04-11 09:47:14 +00:00
Uladzimir Havenchyk
85e2e8cd6a Rework parameters sidebar to mantine (#41130) 2024-04-11 09:37:23 +00:00
Oisin Coveney
2c21fa99a0 Convert colors.module.css to CSS Modules (#40366) 2024-04-11 12:14:36 +03:00
Nemanja Glumac
9d19c4b69c Preserve the original question name in a "save question" modal (#41197)
* Keep the original question name in the save modal where possible

Resolves #41196

* Update tests

* Append "- Modified" to a suggested question name

* Preserve the original question description

* Address reviews - adjust the translation string

* Add E2E reproduction

* Remove extra space

* Improve assertions
2024-04-11 09:43:19 +02:00
Nicolò Pretto
99d15b0416 add env var to enable css modules classnames linting (#41173)
* .eslintrc -> .eslintrc.js

* This might work?

* add env for linting css modules class names

* avoid extending postcss-modules/recommended, specify just the used rule instead

* add missing . on comment

* Remove unused .detailName references

* Fix ManageApiKeys and GuiQueryEditor

* Fix SettingText and DashboardControls

* fix missing textUnspaced class

* remove usave of S.headerButton, that's actually never used because we never pass headerLink to ReferenceHeader

* Remove flexNoShrink

---------

Co-authored-by: Oisin Coveney <oisin@metabase.com>
2024-04-11 08:54:22 +02:00
Kamil Mielnik
32a328a054 Update offset on EntityPickerModal (#41183) 2024-04-11 06:15:42 +00:00
Raphael Krut-Landau
d839a4d4e6 Localize 'How often should we check for results?' (#41254) 2024-04-10 20:20:37 +00:00
adam-james
9cdf2340a8 Fix embed download endpoint (#41264)
* Fix embed download endpoint

We have added format_rows as a query parameter. In most endpoints this just works fine.

Here, however, the problem is that we use query parameters to pass parameter values. We run some validation over these
provided parameter values (eg. don't allow a user to over ride a 'locked' parameter). Since we have these 2 different
use cases for query parameters, the validation was failing on :format_rows, which isn't expected to exist at all.

Here, I dissoc the :format_rows key prior to this validation step, so normal validation can continue.

* Add test that uses this card embedding endpoint
2024-04-10 17:30:10 +00:00
Alexander Solovyov
3a220a796c Migration to backfill QueryField for native cards (#41188) 2024-04-10 17:01:19 +00:00
dpsutton
2a8e19b222 Nested queries have limits which can defeat their purpose (#41051)
* Nested queries have limits which can defeat their purpose

Consider a query

```sql
select count(*) from {{#199}}
```

This query should return the number of distinct rows in the query
defined by 199. But it's actually limited by the excel limit of
1048575. And that's because when the value of `{{#199}}` is expanded it
has that limit applied as normal.

```clojure
qp=> (let [card-id 199] ;; use a valid card id for you
       (-> {:database 1,
            :type :native,
            :native {:query "select count(*) from {{ref}}"
                     :template-tags {:ref {:card-id card-id
                                           :type :card
                                           :name "ref"
                                           :display-name "ref"}}}
            :middleware {:disable-max-results? true}}
           qp.compile/compile
           :query
           (metabase.db.query/format-sql )
           println))
select
  count(*)
from
  (
    SELECT
      "PUBLIC"."ORDERS"."ID" AS "ID",
      "PUBLIC"."ORDERS"."TOTAL" AS "TOTAL"
    FROM
      "PUBLIC"."ORDERS"
    LIMIT
      1048575
  )
```

But we can suppress this limit when substituting a query inside yielding

```sql
select
  count(*)
from
  (
    SELECT
      "PUBLIC"."ORDERS"."ID" AS "ID",
      "PUBLIC"."ORDERS"."TOTAL" AS "TOTAL"
    FROM
      "PUBLIC"."ORDERS"
  )
```

And this is proper because we want to limit the _outer_ query, not
internal queries.

* Remove limit from test expectation

* stupid trailing space

* another subquery test

* Use helper function to disable limit middleware
2024-04-10 10:17:22 -05:00
Cal Herries
51142efc8b Fix snowflake's delete-old-datasets! for tests (#41249) 2024-04-10 15:08:00 +00:00
dpsutton
b1e835415c Fix #39138 again (#40936)
* Fix #39138 again

Fixes #40934

Got unfixed somehow in #40578. seems like some file renames caught it off guard

But the long and short is that its possible for a persisted model to end
up in the state "refreshing" (possible an instance restart during
refreshing). The refreshing job doesn't look for these so they become
effectively invisible.

Since the job to refresh them will only run one at a time cluster wide,
any jobs that are in the "refreshing" state when the refresher begins to
refresh are necessarilly stuck (no one else could currently be
refreshing them). So we can just add them to the queue of models to
refresh.

```clojure
(jobs/defjob ^{org.quartz.DisallowConcurrentExecution true ;; <----
               :doc "Refresh persisted tables job"}
  PersistenceRefresh [job-context]
  (refresh-job-fn! job-context))
```

* Ensure ee/oss pathways are taken in tests

Annoying little footgun here. CI does not run with an ee token, so in
order to ensure that test pathway goes through ee version of a
defenterprise we _must_ use the `mt/with-premium-features
{:cache-granular-controls}`,  but we also want to ensure that it goes
through the oss version.

So two options, a `doseq` on both features (empty set and the feature
that triggers this). But want a test in the enterprise folder as well to
ensure.

The real trickiness comes from running tests at a repl and CLI. My REPL
always has an ee token in it. My command line always lacks that as
well. So want to be explicit about the token features in effect at test
time.

That's why I'm essentially duplicating tests (ee in ee folder, oss in
regular pathway)
2024-04-10 09:44:48 -05:00
Noah Moss
514f9e0575 Remove -Xmx4g option from :cloverage alias (#41253) 2024-04-10 14:15:32 +00:00
Tim Macdonald
34954c8d64 [ParseSQL] Support queries with {[variable}}s and {{field filter}}s in them (#41193)
* Support parsing {{variable}}s and such in queries

[Fixes #39954]

[Fixes #39953]
2024-04-10 13:46:29 +00:00
Nick Fitzpatrick
eb8109de09 increase activation distance for dashboard parameter dragging (#41123)
* increase activation distance for dashboard parameter dragging

* updating drag sensitivity for other places

* adjusting e2e tests
2024-04-10 10:28:51 -03:00
Cal Herries
cfb86ef85e Faster driver/describe-database for redshift (#41068) 2024-04-10 13:28:23 +00:00
Cal Herries
59aa80bd9a Comment out flaky rollback test for MySQL (#41244) 2024-04-10 13:05:16 +00:00
Nick Fitzpatrick
830b8faf9b Upgrading react-dnd and react-draggable (#41212) 2024-04-10 09:16:44 -03:00
Mahatthana (Kelvin) Nomsawadi
3c0f8181ac Migrate base.module.css (#41246)
* Migrate .pointerEventsNone

* Remove unused global class

* Migrate .faded, .fadeInHover

* Migrate .circle

* Remove unreachable code

* Remove unused props
2024-04-10 11:57:16 +00:00
Oisin Coveney
489edea4ad Convert PreviewPane to TS (#40961) 2024-04-10 13:14:06 +03:00
Denis Berezin
fc2ff55743 Restore tabs display for embedded dashboard without title (#41204)
* Restore tabs display for embedded dashboard without title

* Add unit test

* Remove empty file

---------

Co-authored-by: Mahatthana Nomsawadi <mahatthana.n@gmail.com>
2024-04-10 08:35:20 +00:00
Mahatthana (Kelvin) Nomsawadi
f3d161382d Upgraded xlsx module (#41231) 2024-04-10 07:11:54 +00:00
Cal Herries
4c00bc4982 Mitigate some redshift flakes (#41191) 2024-04-10 09:48:34 +03:00
Cam Saul
82dd157aca <datetime expression> = <date literal string> should do something sane (#36068)
* H2 compilation improvements: avoid unneeded casting

* Legacy MBQL schema improvements

* Add additional test for wrap-value-literals

* Simpler version of the fixes from #36068

* Test and lint fixes 🔧
2024-04-09 22:59:04 +00:00
Cam Saul
f901b5ae5f Improved pivot QP: use MLv2 and avoid recursive preprocessing (performance improvement) (#40141)
* Pivot QP use MLv2

* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* PR feedback

* Resurrect remove-all-breakouts

* Test fixes 🔧
2024-04-09 22:32:02 +00:00
Raphael Krut-Landau
91486ae41c Use DelayedLoadingAndErrorWrapper component in Admin > Performance (#41103) 2024-04-09 22:25:26 +00:00
Cam Saul
63910c89d6 Bump backend tests -Xmx from 2 GB to 12 GB (#41213) 2024-04-09 21:28:45 +00:00
Jeff Bruemmer
184cb81275 typo (#41205) 2024-04-09 11:01:51 -07:00
Braden Shepherdson
15b90a0281 [MBQL lib] Don't enforce expression types when converting from legacy (#41147)
These type checks are useful when constructing clauses with full MLv2
metadata available, but when converting from legacy the `:field` refs
have only `:base-type`.

If a column has its metadata overridden to eg. coerce a string or
integer into a date, its `:base-type` will remain `:type/Integer` or
`:type/Text` and the `:effective-type` will be `:type/Date` etc.

This change skips the type check while converting from legacy, and
while checking `can-run`. Eventually this should be replaced with
tracking `:effective-type` on refs or using real metdata, instead of
relying on the `:base-type` only.

Fixes #41122.
2024-04-09 17:42:27 +00:00
Romeo Van Snick
1eacf8e674 Be more specific about which sections need a seperator (#41137) 2024-04-09 18:43:12 +02:00
Cal Herries
db6013d82a Fix coercing multiple columns from int to float in H2 (#41139) 2024-04-09 18:30:42 +03:00
Mahatthana (Kelvin) Nomsawadi
fef3ba6e11 Migrate components/modal.module.css (#41091)
* Remove unused CSS custom properties

* Migrate .ModalContainer

* Migrate .Modal

* Migrate .ModalBackdrop

* Migrate Modal transition classes

* Migrate modal sizes

* Fix tests

* Add missing classes from migration

* Address review: use `data-testid`

* Remove unused classes

* Revert the util that selects Mantine modal
2024-04-09 15:29:25 +01:00
Abed Habli
4aaf880a46 Fix exporting-results list.md (#41167)
I have edited the list of "Download results."
2024-04-09 07:06:07 -07:00
Alexander Polyankin
2500b207d3 Fix tags for self-referencing entities (#41129) 2024-04-09 13:10:52 +00:00
Nemanja Glumac
71a3226267 Improve the fetching logic in a notebook native preview (#41141)
* Improve the fetching logic in a notebook native preview

* Rely on `isFetching` always

* Show a disabled convert button when there's no query
2024-04-09 12:30:01 +00:00
Nemanja Glumac
a160d8b7ae Convert ui actions to TypeScript (#41080)
* Convert `ui` actions to TypeScript

* Make sure fetched user is not `null`
2024-04-09 11:35:31 +00:00
Tim Macdonald
e1d3c48e90 Bump Macaw (now with sanitization) (#41166) 2024-04-09 10:49:15 +00:00
Nemanja Glumac
f016befaef Rename native query preview sidebar component (#41082) 2024-04-09 10:37:54 +02:00
Alexander Solovyov
1504b86572 serialize result metadata for any card (#41131)
We need to serialize it for any card, since when a normal question depends on a native question - their result_metadata won't be updated when opening a dashboard, which leads to front-end not understanding how to connect the parameters from a dashboard to a card, and errors during queries.
2024-04-09 09:50:10 +03:00
adam-james
2d98cd74b7 Bugfix 38839 manually set axis position (#41143)
* Group axes with the correct map shape.

Prior to this, any time axes were all explicitly set :left or :right by the user, the `group-axes-at-once` function
would incorrectly return the map in the following form:

`{:left ["a" "b" "c"]}` which is incorrect. It must instead look like this:

`{"a" :left "b" :left "c" :left}`

This fixes the map shape and permits the user to explicitly set all axes to the left or to the right.

* Add a test to confirm the axis settings are respected and do render
2024-04-08 23:24:54 +00:00
Cam Saul
a871940545 More Metric => LegacyMetric renaming (#40418)
* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Rename `metabase.mbql` to `metabase.legacy-mbql`

* Fix Kondo warnings

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* Fix import

* Another fix 🔧

* Merge

* FIXES

* Add another missing REQUIRE

* More Metric => LegacyMetric renaming

* metabase.models.metric-important-field => metabase.models.legacy-metric-important-field

* Even more renaming

* More renaming

* Even more fixes.

* More renaming

* Wow, even more renaming!!
2024-04-08 22:32:06 +00:00
Cam Saul
a6291809a6 Use window functions for cumulative sum and cumulative count [BigQuery] (#40982)
* Use window functions for SQL drivers for cumulative count and sum

* H2/Snowflake/Redshift implementation

* Test fixes 🔧

* Use SELECT expression positions as the default window function implementation

* Some test fixes.

* Fix bugs in add-alias-info

* MongoDB fixes

* Another pass

* BigQuery should use positions?

* BigQuery almost works 100% now.

* MLv2 fix conversion behavior for expressions with type info

* Add transformations for nesting cumulative aggregations in expressions

* Minor tweaks

* MLv2 should escape aliases using driver/escape-alias (dynamically bind this)

* Kondo fix

* Lint fixes 🔧

* More test fixes and revert test changes

* Update some tests to use correct case for nominal Field literal refs

* Wow! BigQuery is fixed! Remove upgrade-field-literals middleware

* Disable tests for the failing drivers, we can fix in follow-on PRs.

* Enable BigQuery :window-functions

* Extra info

* Add GH issue numbers

* Update more GH issue numbers

* Fix SQL Server!!!! wooo

* I THOUGHT WE WERE DISABLING SPARK SQL!!!!!!!!!!1

* Cleanup to get things ready for review.

* Snowflake + Vertica shouldn't use output column numbers for ORDER BY in OVER

* Code cleanup

* Snowflake + Vertica shouldn't use output column numbers for ORDER BY in OVER

* Code cleanup

* Test fixes 🔧

* Much simpler BigQuery implementation

* Add GH issue context

* Remove commented-out code

* Remove unused add-stage-at-index

* Documentation

* Test fix? 🔧

* Test fix 🔧
2024-04-08 21:41:53 +00:00
Cam Saul
6c515648da Legacy MBQL documentation (#40657)
* Legacy MBQL documentation

* Do not commit dox

* Subject the legacy MBQL stuff to the same stricter linting rules as MLv2

* PR feedback
2024-04-08 21:03:15 +00:00
Jeff Bruemmer
e9f0cb0e8a docs - notes on events and timelines (#41102) 2024-04-08 13:03:31 -07:00
Nemanja Glumac
dd8e0728b6 Preserve notebook native preview user preferences (#41064)
* Add new user-local setting `notebook-native-preview-preferences`

* Update user settings on FE

* Use two distinct setting entries

* Update FE types

* More explicit `notebook-native-preview-sidebar-width` definition

* Add selectors

* Initialize QB uiControls based on the BE settings

* Rename QB store entry

`isNativePreviewSidebarOpen` -> `isShowingNotebookNativePreview`

* Rename QB store entry

`nativePreviewSidebarWidth` -> `notebookNativePreviewSidebarWidth`

* Add Redux actions

* Dispatch user settings on top of Redux store

* Fix test title typo

* Add E2E test to make sure sidebar is resizable

* Expand the E2E test to cover persisting settings across sessions

* Be more explicit that we're resizing along x axis

* Store window breakpoint as a variable

* Calculate handle's left position more explicitly
2024-04-08 20:40:56 +02:00
Alexander Solovyov
8c46de0168 cache invalidation test was over-specific (#41132) 2024-04-08 17:02:24 +00:00
Oisin Coveney
d93af458dc Fix bad spacing on notebook action buttons (#41134) 2024-04-08 19:29:59 +03:00
Ryan Laurie
9be788d110 Make Collection Picker child-aware (#40655)
* make collectionpicker child-aware

* update unit tests

* add another unit test

* move test some place more sensible

* fix rebase
2024-04-08 16:23:31 +00:00
Cal Herries
89dc03f2c7 Refactor: move fingerprinting and classifier code from sync directory (#39436) 2024-04-08 15:37:34 +00:00
Alexander Polyankin
28689319f6 Allow to change RHS table in each join (#40891) 2024-04-08 15:32:58 +00:00
Romeo Van Snick
177a70ef78 Quickfix heigth on row picker (#41063)
* Make the height of the rows consistent when there is no info icon

* Limit the amount of connected tables shown

* Use Array.from({ length })

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

* Use a regex to find connected tables in test

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-04-08 16:16:09 +02:00
Romeo Van Snick
15e5ca6c86 Move search to toplevel in accordionlist (#40008)
* Make canSelectSection a function

* Use a custom type for actions in the accordionlist

* Add the globalSearch prop to AccordionList

* Improve AccordionList tests

* Enable globalSearch in the AccordionPicker on the FilterColumn and QueryColumn picker

* Assume alwaysVisible for action sections

* Add state for empty search results

* Fix test case

* Allow passing globalSearch to Select

* Set globalSearch in semantic type picker

* Handle search when a section does not have items

* Rename variable to be more descriptive

* Add borders to headings in select

* Add border to back button too
2024-04-08 15:59:03 +02:00
Braden Shepherdson
40c4d7f46e [MBQL lib] suggestedJoinConditions accepts a join position for edits (#41035)
This optional fourth argument will disregard all joins at `position` and
later when suggesting conditions. This is useful when editing a join's
RHS, which wipes out the condition. We don't want to generate a
suggested condition that's based on keys from the RHS of the join we
just edited, or from later joins.

Fixes #40916. Part of #40890.
2024-04-08 13:45:29 +00:00
Braden Shepherdson
29f9a88f00 [API] Ensure the :schema is returned as an empty string, not nil (#41052)
Fixes #41023.
2024-04-08 13:31:05 +00:00
Alexander Solovyov
846425172d cache invalidation (#40774)
New endpoint accepts entity and entity ids in form of `database=1&dashboard=2&question=3`. If you don't supply
`&include=overrides`, then it tries to find configs directly referencing supplied entities and updates their
`invalidated_at`. If you supply `&include=overrides`, all the referenced cards are
updated (`report_card.cache_invalidated_at`).

Cache strategies then select the maximum `invalidated_at` in their logic. EE-only.

resolves #40548
2024-04-08 15:00:22 +03:00
Chris Truter
c53ac13ec5 Remove unused driver argument passed around (#41100) 2024-04-08 13:46:17 +02:00
Chris Truter
17ce608985 Add endpoint to list uploaded tables (#41117) 2024-04-08 13:45:40 +02:00
Nick Fitzpatrick
2596b73ebc React Testing Library V12 (#40981)
* update deps

* adjusting tests to work with new RTL

* removing testing-library/no-unnecessary-act:off
2024-04-08 07:44:28 -03:00
Alexander Polyankin
2834f048a3 Migrate timeline and timeline events to RTK (#41020) 2024-04-08 13:12:44 +03:00
Alexander Polyankin
840f2eca2a Migrate search to RTK (#41040) 2024-04-08 13:11:58 +03:00
Nemanja Glumac
f85e17245a Make notebook native preview sidebar resizable (#40984)
* Display sql preview on sizes less than 1280px

* Handle min notebook width using Mantine responsitve style prop

* Display the resizable sidebar on sizes >= 1280px

* Set sidebar width on resize

* Add custom handle

* Simplify window resizing with `useWindowSize` hook

* Use "white" from the theme colors

* Improve sidebar semantics with `aside`

* Define the `NativeQueryPreviewSidebar` as `aside`

* Use Mantine style props instead of CSS module

* Run the E2E test again using regular browser

We removed the nested media query that ReplayIO doesn't support.
Now this test can run using Replay Chromium as all other tests do.

* Add some breathing room between the scrollbar and the resizable sidebar
2024-04-08 11:19:09 +02:00
Oisin Coveney
3c97894b93 Convert PublicError and PublicNotFound to TS (#40956) 2024-04-08 11:54:09 +03:00
Tim Macdonald
15709fa8eb Remove lingering Joda Time references (#40958)
[Fixes #13922]
2024-04-08 08:28:01 +00:00
Alexander Solovyov
6a8f24ccdb make qp.middleware.cache-test/min-ttl-test pass consistently (#41008) 2024-04-08 10:20:13 +03:00
Oisin Coveney
44b576c96c Convert spacing.module.css to CSS Modules (#40518) 2024-04-08 10:18:11 +03:00
Noah Moss
707ad07238 Ignore internal user when initializing from config file (#41097) 2024-04-06 12:03:44 -04:00
Cam Saul
f0cb822bc7 MLv2 normalization: add :lib/uuid automatically to options maps if missing (#40466)
* MLv2 normalization: add :lib/uuid automatically to options maps if it's missing

* Remove unneeded normalization code in QP

* Fix 🔧

* Ignore invalid metadata providers when passed in from the REST API
2024-04-06 02:01:02 +00:00
Nicolò Pretto
9402bd68b9 embed-homepage - ms1 PR (#40382)
* create ui for the full embedding homepage, without any logic (#40251)

* wip ui for the full embedding homepage

* adds missing link + fix keys

* remove done TODO

* Update frontend/src/metabase/home/components/EmbedHomepage/InteractiveTabContent.tsx

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

* destructure props in the function arguments

* rename customerFacingAnalyticsDocsUrl to analyticsDocsUrl

---------

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

* add new settings for embedding homepage (#40455)

* remove old minimal version

* adds new embedding homepage settings and sets them at the end of the setup

* comment e2e test

* add tests for embedding homepage flags

* more tests

* remove unit tests related to old minimal version

* fixes flags descriptions

* :keyword for embedding-homepage

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

* replace reloadSettings and refreshSettingsList with initializeSettings

* `value => value === true` -> `Boolean`

* toMatchObject -> toEqual for more strict tests

* remove useless undefined check for settings, the component is conditionally rendered based on a setting so it means they're loaded anyway

* fix: use :hidden as we changed the type to :keyword

* specifically check for the `embedding` feature in the tokenFeatures object instead of checking if any feature is active

* remove double \n

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

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>

* connect settings to the embed homepage and show it (#40528)

* fix nested a warnings in browser console

* connect settings to the embed homepage and show it

* fix stories

* remove localStorage.clear() as we're not using it in the logic anymore

* dismiss without feedback for the embedding homepage (#40587)

* feat: add dismiss functionality to the embed homepage

* update setup e2e to check for the dismissal of embedding homepage

* use List from metabase/ui (#40638)

* set embedding-secret-key when embedding is enabled (#40813)

* set embedding-secret-key when embedding is enabled

* use "named" setters and getters as suggested by Noah

* Fix tests for ms1 after updating on master (#41069)

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-04-05 23:25:47 +03:00
Cam Saul
9d112756ff Use window functions for cumulative sum and cumulative count (#40752)
* Use window functions for SQL drivers for cumulative count and sum

* H2/Snowflake/Redshift implementation

* Test fixes 🔧

* Use SELECT expression positions as the default window function implementation

* Some test fixes.

* Fix bugs in add-alias-info

* MongoDB fixes

* Another pass

* BigQuery should use positions?

* Disable tests for the failing drivers, we can fix in follow-on PRs.

* Extra info

* Add GH issue numbers

* Update more GH issue numbers

* Fix SQL Server!!!! wooo

* I THOUGHT WE WERE DISABLING SPARK SQL!!!!!!!!!!1

* Cleanup to get things ready for review.

* Snowflake + Vertica shouldn't use output column numbers for ORDER BY in OVER

* Code cleanup

* Test fix? 🔧
2024-04-05 13:03:24 -07:00
Uladzimir Havenchyk
15bc33492b Fix flaky object-detail e2e test (#41096) 2024-04-05 19:04:28 +00:00
Cam Saul
697ac34dae Do not i18n the logs (#41067) 2024-04-05 18:53:27 +00:00
Romeo Van Snick
a91f3d8636 No error message on preview api error (#40996)
* Correctly pass an error string to Vizualization

* Fix error layout for preview vizualization

* Do not animate preview vizualization height

* Add reproduction for #40724

* Fix test description

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

* Rename coerceError to getErrorMessage

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-05 11:42:10 -04:00
Alexander Polyankin
56469a29db Fix loading metadata for models (#41074) 2024-04-05 18:30:21 +03:00
Chris Truter
c8bbe47189 Tighten metabase.upload interface (#41075) 2024-04-05 15:18:40 +00:00
Alexander Polyankin
30f3acd49a Fix question schema notebook (#41078) 2024-04-05 13:35:26 +00:00
Mahatthana (Kelvin) Nomsawadi
7649bba353 Migrate list.module.css (#41030)
* Moved a CSS rule, so we could only migrate 1 CSS file

* Migrate .ListSectionHeader

* Migrate .ListItem

* Migrate .ListItemArrow

* Migrate .ListSectionHeaderCursor

* Migrate .ListSectionToggleAble

* Migrate .ListSectionTitle

* Migrate .ListSectionExpanded

* Migrate .ListSectionIcon

* Migrate .ListItemCursor

* Migrate .ListItemDisabled

* Migrate .ListItemSelected

* Migrate .ListItemTitle

* Migrate .ListItemDescription

* Migrate a CSS class used in tests

* Fix tests from migrating global CSS classes
2024-04-05 13:49:32 +01:00
Mahatthana (Kelvin) Nomsawadi
7c344da791 Migrate LineAreaBarChart.module.css (#41018)
* Migrate .LineAreaBarChart

* Migrated .LineAreaBarChartRenderer

* Migrate .mute-*

* Fix tests that rely on a static class

* Fix wrong DOM query selector syntax

* Address review: Remove CSS comment noise
2024-04-05 13:49:19 +01:00
Jeff Bruemmer
398f85181c docs - dash card notes (#41057) 2024-04-05 08:41:26 -04:00
Cal Herries
b9464c30e9 Simple sync exceptions (#41066) 2024-04-05 15:16:23 +03:00
Mahatthana (Kelvin) Nomsawadi
1c42af3740 Fix flaky test (#41073) 2024-04-05 13:05:53 +01:00
Jeff Bruemmer
16ab6a833a remove redirect (#41049) 2024-04-05 07:54:38 -04:00
dependabot[bot]
f7f864d6a1 Bump follow-redirects from 1.15.4 to 1.15.6 in /release (#40612)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-04-05 11:55:25 +03:00
Braden Shepherdson
199e069c4d [MLv2] First pass of docs improvements in metabase.lib.js (#40679)
Goal is to properly document the interface between MLv2 and the FE. In
particular I want to call out the health and fate of each function. Some
of them only exist to support legacy compatibility, for example, and
that should be documented to discourage new usage and make clear the
conditions for removing the functions.
2024-04-04 22:09:09 +00:00
Romeo Van Snick
c4b3e79200 Make info icons less obtrusive (#40865)
* Hide info icons when no description exists

* Move defaults for InfoIcon to separate file

* Add open delay to popover

* Remove inverted background from type label

* Fix margin on semantic type label

* Make semantic type not be bold

* Fix unit tests for hidden info icons

* Rename file to constants

* Remove unused showIfEmpty prop altogether

* Fix the height of the expression suggestions that don't have an info icon

* Fix padding on filter modal

* Fix the height on dataref
2024-04-04 20:10:24 +00:00
Aleksandr Lesnenko
8fe94af974 asynchronously load libraries for png and pdf exports (#41036) 2024-04-04 15:31:27 -03:00
Jeff Bruemmer
f7b7bda730 docs - update public sharing (#41044) 2024-04-04 14:09:18 -04:00
Denis Berezin
1f93ba5c6c Add types generation for embedding SDK package (#40975)
* Add manual imports fixup

* Fixes

* Fixes

* Review fixes

* Review fixes
2024-04-04 16:56:03 +00:00
lbrdnk
ee6f4ac163 Enable not emptyable arguments for is-empty and not-empty clauses (#40957)
* Enable not emptyable arguments for is-empty and not-empty clauses

* Add review remarks

* Shorten dataset name so it is usable with some drivers

* Disable test for Athena

* Handle possibly missing base type

* Update comment

* Missing base type field is treated as not emptyable

* Update desugar middleware

Now middleware adds base type to fields with integer id that are missing that first. This ensures correct function of is-empty expansion.

* Update desugar middleware

Cleanup base types necessary for desugaring is-empty

* Update desugar middleware cleanup

* Update test

* Adjust tests

* Remove now redundant e2e test

* Update comment
2024-04-04 18:51:10 +02:00
Nicolò Pretto
7d16a878b0 Revert "fix: padding not working on <Modal> component" (#41029)
This reverts commit 88a36a6a6d.
2024-04-04 16:12:27 +00:00
Kamil Mielnik
7603ad8a9d Repro #23103 - Wrong number of distinct values in a native model (#41027)
* Repro #23103 - Wrong number of distinct values in a native model

* Fix flake
2024-04-04 16:05:28 +00:00
Jeff Bruemmer
4879d7d614 docs - mention of raw unformatted results (#41033) 2024-04-04 11:53:28 -04:00
Braden Shepherdson
4bad50337f [MLv2] Handle nested "Zoom In" drills on binned columns (#40965)
The first time you zoom in on a bin in a binned query, it works fine.

For example, Orders COUNT by SUBTOTAL auto-binned has a bin for 40-60.
If you zoom in on that, it correctly shows the range 40 to 60 broken
down into smaller bins which are 2.5 units wide. If you then try to
zoom in on one of these smaller bins, say 50-52.5, there are two
problems:

1. The filters from the first zoom (`>= 40` and `< 60`) are still
   there, and so are the new ones (`>= 50` and `< 52.5`).
2. The new filter is actually wrong; it uses the big width (20)
   from the original bins, not the width of the nested bins (2.5),
   so the new filters are `>= 50` and `< 70`.

This PR fixes both issues, so nested bins (1) remove the old filters,
and (2) use the correct width for the nested bins.
2024-04-04 11:03:06 -04:00
Alexander Solovyov
c059d8d585 do not print stacktrace when client closes connection too early (#40834) 2024-04-04 14:57:27 +03:00
Chris Truter
321e2d0d55 Testing parity for appending to and replacing uploads (#40899) 2024-04-04 11:50:46 +00:00
Chris Truter
862daf338a Break out upload.types namespace (#40741) 2024-04-04 10:30:28 +00:00
Mahatthana (Kelvin) Nomsawadi
2d281d2c84 Fix flaky test caused by unmounted HoverCard (#40966)
* Fix flaky test caused by unmounted HoverCard

* Remove unused test util
2024-04-04 10:18:39 +01:00
Nicolò Pretto
88a36a6a6d fix: padding not working on <Modal> component (#40748) 2024-04-04 11:04:02 +02:00
Oisin Coveney
4e7d6f4584 Convert cursor.module.css to CSS modules (#40522) 2024-04-04 11:42:06 +03:00
Alexander Polyankin
a5759d7681 Fix question_id in question schema 1-0-3 (#41002) 2024-04-04 09:23:07 +03:00
Braden Shepherdson
cb506458ee [QP] Correctly find joined fields in the previous stage (#40933)
This logic was trying to match `[name join-alias]` pairs previously, but
that won't work since the later stage field doesn't have a `:join-alias`
on it. This falls back to matching on only the ID or name, but only if
it's unambiguous.

Fixes #40252.
2024-04-03 22:01:43 +00:00
Alex Yarosh
7a4b2fb07e [docs] some format fixes (#40938)
* fix indent in referencing models

* remove syntax highlighting for now
2024-04-03 15:22:10 -06:00
John Swanson
cce183e7ce Don't throw when sent non-int limit/offset (#40821)
This middleware shouldn't throw exceptions when `limit` or `offset`
query parametesr aren't integers.
2024-04-03 13:30:10 -05:00
Lena
8386526374 Make Noah the codeowner for permissions et al (#40919)
* Make Noah the codeowner for permissions et al

et al = `integrations` (OSS google auth, LDAP and Slack integrations) + `enterprise` (audit, advanced SSO, advanced config stuff).  `enterprise` also has LLM which doesn't really have a codeowner now, but it also doesn't need one.

* Correct the paths and the scopes
2024-04-03 19:10:55 +02:00
Raphael Krut-Landau
c1f4bff840 Basic cache admin UI (#39234)
Adds:
* Performance tab 
* Data caching settings tab
* Two-panel strategy editor
* "Don't cache" strategy
* "TTL" strategy
* "Duration" strategy
* "Use default" option for databases
* OSS page
* Unit tests

[Loom](https://www.loom.com/share/b1b173a52be9401588ffb63f718e052a?sid=bed4bdf5-f967-4d93-af55-9b96b6b52730)
2024-04-03 12:04:23 -04:00
Nemanja Glumac
9a8e0a088e Add analytics events for the native code preview in a notebook (#40962)
* Bump the question schema and update it with the new events

* Enable snowplow tracking on the frontend

* Add E2E test for tracking snowplow events related to native preview sidebar

* Fix question id type in the schema
2024-04-03 17:59:54 +02:00
Mahatthana (Kelvin) Nomsawadi
a583764b74 Fix embedding (#40841)
* Fix overflow static dashboard

* Fix `frame` event's height for interactive dashboards

* Fix E2E tests

* Fix test names to match the correct GitHub issue numbers

* Use `data-element-id` for consistency

* Make the test selector more consistent
2024-04-03 16:32:50 +01:00
Ngoc Khuat
d84764c51e comment out flaky caching test (#40963) 2024-04-03 15:28:53 +00:00
Ngoc Khuat
7866f7e20b Fix unable to search field values from partitioned tables (#40767) 2024-04-03 15:27:25 +00:00
Lena
359a8dacc6 Clarify that backport/no-backport is an internal thing (#40954)
* Clarify that backport/no-backport is an internal thing

A few times per month, external contributors ask about the notion doc they can't access and about the labels they are not expected to set. This is not the experience we should give to people who not only take their time to contribute to metabase, but also actually read the PR template.

(slightly duplicated condition in the beginning and the end of the paragraph — "For those employed [...] If you're not employed [...]" — is on purpose)

* Add linebreaks in PR template

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

---------

Co-authored-by: Tim Macdonald <tim@metabase.com>
2024-04-03 16:12:57 +02:00
Nick Fitzpatrick
9c477a75f3 Command Palette UI adjustments (#40650)
* Command Palette UI adjustments

* move search to end of results list

* ellipsis long command palette items, min icon size and showing debounced text

* setting fixed width. adjusting admin result icons and text

* fixing e2e test
2024-04-03 10:21:28 -03:00
Alexander Polyankin
1235d9a8ee Deprecate MLv1 metadata (#40947) 2024-04-03 16:11:26 +03:00
Jeff Bruemmer
7e899cff28 add 49.3 to list of releases (#40943) 2024-04-03 08:55:05 -04:00
Uladzimir Havenchyk
54ed754436 Fix row id mapping in object detail modal displaying (#40874)
* Map row id on object detail id

* Add a fallback

* Add e2e test

* Add a limit

* Provide a fix for #34070

* Simplify test
2024-04-03 12:32:30 +00:00
Nemanja Glumac
2cf943207c Use MLv2 to determine whether a query can be previewed (#40609)
* Use MLv2 to determine whether a query can be previewed

* Add E2E repro for #40608

* Expand E2E repro

* Fix test

* Make sure the step is active and visible before offering to preview its query

* Expand E2E test

* Address review comment - use `getNotebookStep` helper
2024-04-03 11:09:53 +00:00
Jeff Bruemmer
9521828422 docs - formatting exports (#40921) 2024-04-03 06:53:21 -04:00
Uladzimir Havenchyk
d12c549a1f Do not put js code into page title (#40901)
* Do not put js code into page title

* Typecheck

* Add e2e test

* Update e2e/test/scenarios/question/document-title.cy.spec.js

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-03 10:48:39 +00:00
Mahatthana (Kelvin) Nomsawadi
af54379afa [MS2] 1. Analytics (#40681)
* Remove old config + fix typo

* Add new analytics for 4 new illustration settings
2024-04-03 11:21:55 +01:00
Cal Herries
e5f9d2c412 Create the internal user in a migration (#40907) 2024-04-03 10:11:50 +00:00
Mahatthana (Kelvin) Nomsawadi
f94ec2cce8 Migrate dashboard.module.css (#40918)
* Migrate .DashEditing

* Migrate .CardTitle

* Migrate .PinMap

* Migrate .PinMapUpdateButtonDisabled

* Migrate .BrandColorResizeHandle

* Migrate .VisualizationSlowSpinner

* Migrate .AddSeriesModal

* Migrate 2 more classes
2024-04-03 10:07:17 +01:00
Mahatthana (Kelvin) Nomsawadi
1299f251a1 Remove unused CSS files (#40908)
* Fix default export

* Remove unused classes

* Remove unused components
2024-04-03 10:06:40 +01:00
Mahatthana (Kelvin) Nomsawadi
715174d314 [M1] Metabase illustration settings (#40219)
* Add login page illustration (#39299)

* Move Metabot setting to a new place

* Add setting for login page illustration

* fix UI styling

* Fix not able to upload the same file twice

* Update the admin > appearance > conceal metabase copy

* Prepare the component for tests

* Add some unit tests

* Prevent settings not saved sometimes

After setting the value to/from `custom` one of the setting could be
failed to save, I suspect this happens because the race condition from
trying to save the setting values relatively at the same time.

* Make unit tests easier to read

* Add all unit test test cases

* Add basic E2E test

* Show fallback icon for broken images

* Make use of the proper component

* Update the comment to affect the reality

* Add an error message when file size is over 2MB

* Show an error message when the file size > 2MB

* Add the error message tests

* Preserve the preview image aspect-ratio

* Detect corrupted images

* Fix failing unit tests

* Address feedback: Type

* Feedback: Create meaningful variables

* Feedback: Make selector API more sensible

* Prevent race condition

Makes sure we save the settings completely before making other actions
that also change settings otherwise, there could be race conditions.

* Feedback: tighten up a type

* Feedback: Fix inconsistency callback calls

* 2. Add the rest 3 illustration settings (#40487)

* Add the rest 3 illustration settings

* Don't make the X icon feel lonely

* Fix illustration widget saving

* Fix type error

* 3. Update the select UX to match new design (#40491)

* Update the select UX to match new design

* Move info dot next to file upload button

* Simplify IllustrationWidget API

* Update setting title copy

* Clean up test comments

* Feedback: Clarify `any` type

* Feedback: Use shorthand object creation

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

* Feedback: Use global CSS glass instead of inlining values

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

* Feedback: Remove unnecessary curly brackets in JSX

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

---------

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

* 4. Connect illustrations to new setting values (#40139)

* Wire landing page illustration to the setting value

* Wire the unsubscribe page to the setting value

* Prepare no rows error to be wired to the setting value

* Wire no question results illustration to the setting value

* Wire no search results illustration to setting value

* Fix error from fixing conflict

* Fix required unnecsseary prop on Image

* Use Image component

* Link dashboard card no results image to the setting value

* Move the no data results to more a generic directory

* Link collection picker no results image to the setting value

* Make illustrations more accessible

* Fix failed tests

* Test unscribe page illustration + test no illustration

* Add landing page tests

* Simplify Cypress selectors

* Refactor: Rename settings to match the new requirements

No question data -> No Data
No search results -> No object

These changes are made so, these 2 settings are generic enough to
include other illustrations later on.

* Add no data illustration test

* Add no object illustration tests

* Fix unsubscribe page background style

* Fix not able to build static viz

* 5. Follow-up on milestone 1 (#40710)

* Update custom background illustration scale behavior

* Remove the need to put an SVG file in static folder

* Fix test from rebasing off master with @testing-library/user-event upgrade

---------

Co-authored-by: Denis Berezin <denis.berezin@metabase.com>
2024-04-03 09:07:54 +01:00
dpsutton
12ea8d42b5 Creator sentiment emails iterate (#40922)
* Send creator emails every week

mod the email by 52 instead of by 12 and use the current week as an
anchor

```clojure
user=> (require '[java-time.api :as t])
nil
user=> (let [every-day (take 1000 (t/iterate t/plus (t/local-date 2024 1 1) (t/days 1)))
             f         (fn [d]
                         (let [wf (java.time.temporal.WeekFields/of (java.util.Locale/getDefault))]
                           (.get d (.weekOfWeekBasedYear wf))))]
         (sort (keys (frequencies (map f every-day)))))
(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
 40 41 42 43 44 45 46 47 48 49 50 51 52)
```

```clojure
user=> (metabase.util.cron/cron-string->schedule-map "0 0 2 ? * 7")
{:schedule_minute 0,
 :schedule_day "sat",
 :schedule_frame nil,
 :schedule_hour 2,
 :schedule_type "weekly"}
```

* fix typo in creator sentiment email, clean up a bit

typo: had `:verison` instead of `version`.

And while I'm in there, make the payload all in one file and have the
email namespace json->bytes->b64-encode so the data is all in one place
and the setting that allows it to be present or not is co-located.
2024-04-02 14:34:56 -05:00
Nick Fitzpatrick
32c0bf9e06 command palette trigger in app bar search (#40747)
* command palette trigger in app bar search

* remove tabbing to the trigger button
2024-04-02 14:48:26 -03:00
Nemanja Glumac
e36669d9c6 SQL in a sidebar - Milestone 2: Visual tweaks (#40694)
* Move all notebook containers styles to one place

* Make NotebookStep wide again

* Tweak sidebar width and breakpoints

* Remove top margin from NotebookSteps

* Stop line wrapping in an ace editor

* Uniform width between step header and step body

* Remove stray styles

* Scroll content independently

* Use named export

* Use Mantine button for "Visualize"

* Convert notebook step width to rem

* Adjust the position of the step close button

* Adjust notebook step max-width to 1200px

* Remove the `cx` where not needed

* Use HTML 5 `aside` element for the sidebar

* Use Mantine responsive styles

* Fix E2E test
2024-04-02 17:42:57 +00:00
Denis Berezin
9526eaa937 CI for Embedding SDK (#40629) 2024-04-02 17:38:47 +00:00
Maz Ameli
be3a46b854 fix instance analytics typo (#36596) 2024-04-02 10:27:07 -07:00
Chris Truter
8db8b43059 Fix bumping minor version past 10 (#40859) 2024-04-02 19:02:19 +02:00
Ryan Laurie
5b19999dfc Use RTK Query instead of entity framework for DatabaseCandidates (#40403)
* use RTK Query instead of entity framework for DatabaseCandidates

* use skipToken to tighten up API request types
2024-04-02 16:49:46 +00:00
Alexander Polyankin
69353015bb Replace Questions.loadList with RTK (#40896) 2024-04-02 18:46:23 +03:00
Uladzimir Havenchyk
a4fb40e496 Add repro test for a model that uses another model and both have custom column with the same name (#40851)
* Add repro test for a model that uses another model and both have custom column with the same name

* Skip test

* Update e2e/test/scenarios/models/reproductions/39150-model-with-same-custom-column-name.cy.spec.js

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

* Update e2e/test/scenarios/models/reproductions/39150-model-with-same-custom-column-name.cy.spec.js

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

* Convert to ts and add question

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-04-02 15:40:21 +00:00
Alexander Polyankin
c27b0a35f4 Migrate metrics entity to RTK (#40900) 2024-04-02 18:36:40 +03:00
Chris Truter
61f7c7f243 Make generated_columns optional for csvupload events (#40880) 2024-04-02 16:55:32 +02:00
Jeff Bruemmer
250058711c docs - notification perms (#40692) 2024-04-02 10:48:11 -04:00
Nemanja Glumac
03aaf47d77 Add breakpoints to the Mantine theme overrides (#40903) 2024-04-02 14:36:32 +00:00
Mahatthana (Kelvin) Nomsawadi
4ac74859b0 Migrate frontend/src/metabase/components/Popover/Popover.module.css (#40730)
* Migrated .PopoverContainer, .PopoverBody

* Make global CSS more prominent

* Migrate 2 classes

* Remove unused class

* Migrate .PopoverBodyWithArrow

* Remove unused class

* Migrate .PopoverBodyMarginBottom

* Remove unused class

* Migrate .PopoverFooter

* Remove unused class

* Preserve classes order for easier review

* Fix unit tests
2024-04-02 14:30:31 +01:00
Alexander Polyankin
28640cfd93 Show query execution time in the QB header for MBQL queries (#40889) 2024-04-02 12:30:42 +00:00
Uladzimir Havenchyk
27fbc96829 Add repro for "Dashboard filters do not work with custom columns on saved questions used in models" (#40784) 2024-04-02 14:45:53 +03:00
Uladzimir Havenchyk
ee28134c9b Add a repro for 'GUI model joining native ones break with column not found error' (#40772)
* Add a repro for 'GUI model joining native ones break with column not found error'

* Rename test

* Add await

* Skip test
2024-04-02 14:44:50 +03:00
Alexander Polyankin
de322a10aa Migrate schema entity to RTK (#40785) 2024-04-02 11:41:56 +00:00
Leo Paillier
d9d8c688e3 Fixes code snippet typo with extra closing parenthsis in case expression (#40873) 2024-04-02 07:07:30 -04:00
Jeff Bruemmer
f52d2f09f5 fix typo (#40858) 2024-04-02 07:06:57 -04:00
Oisin Coveney
215c0bc197 Convert BrowserCrumbs to TS (#40847) 2024-04-02 13:10:46 +03:00
Ryan Laurie
80e690534a Update Translations Strings for 49.3 (#40780)
* put new strings in the pot

* update some more strings

* add new translated strings
2024-04-01 13:20:14 -06:00
Jeff Bruemmer
dacca2446d update releases (#40862) 2024-04-01 15:14:25 -04:00
Jeff Bruemmer
53884aebf5 remove doc updates (#40028) 2024-04-01 18:57:37 +00:00
Romeo Van Snick
49926dbabf Handle null value for field in CategoryFingerprint (#40861) 2024-04-01 18:23:47 +00:00
Roman Abdulmanov
cfca498700 Team json update (#40855) 2024-04-01 19:19:00 +03:00
Anton Kulyk
69b63e89ea Update query results download tooltip copy (#40849) 2024-04-01 17:13:33 +01:00
Anton Kulyk
45b2f147e8 Fix x-ray dashboards run some queries twice on load (#40844)
* Fix parameter values comparison in x-rays

* Skip rerun when `parameterValues` are not initialized

* Remove not used code
2024-04-01 17:07:28 +01:00
Uladzimir Havenchyk
48863d24c3 Remove flakiness from ListPicker spec (#40832) 2024-04-01 17:55:16 +03:00
Uladzimir Havenchyk
6d146ab82d Do not update Pie chart state unnecessary (#40840) 2024-04-01 17:43:34 +03:00
Ryan Laurie
8a9a0a162b Properly Handle Other Users' Personal Subcollections in CollectionPicker (#40822) 2024-04-01 14:04:36 +00:00
Ryan Laurie
d68187e1fc Allow CollectionMover to display API errors (#40700)
* HELP

* Help delivered

* allow entityPicker to display api errors

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-04-01 08:00:44 -06:00
Oisin Coveney
6655faa047 Convert hide.modules.css to CSS modules (#40574) 2024-04-01 11:14:30 +03:00
Alex Yarosh
6ec4282d39 [docs] creating a HAR file (#40734)
* add link

* create HAR

* formatting

* periods

* more formatting

* feedback
2024-03-29 13:00:29 -06:00
Raphael Krut-Landau
34d35b84ca Fix model card overflow bug (#40736) 2024-03-29 18:29:10 +00:00
Anton Kulyk
bd33c86a8d Don't rerun dashcard queries when switching tabs without parameter changes (#40783)
* Add E2E test

* Move `getDatasetQueryParams` to `data-fetching.js`

* Use `null` as a parameter value when missing

* Fix missing default `datasetQuery`
2024-03-29 17:19:52 +00:00
Alexander Polyankin
97ba53dfe6 Fix adding a filter for a UUID PK column (#40777) 2024-03-29 16:31:46 +00:00
Ryan Laurie
9423ca83c0 fix timing test flake (#40786) 2024-03-29 10:58:25 -05:00
Alexander Polyankin
7f147bdf15 Migrate database and some field endpoints to RTK (#40701) 2024-03-29 13:33:19 +00:00
Nicolò Pretto
f8d3566137 enableMouseEvents on EmbedModal to allow selecting with the mouse on … (#40771) 2024-03-29 12:10:16 +00:00
Alexander Polyankin
b3e900b24b Allow saving native questions with required parameters without defaults (#40739) 2024-03-29 14:04:32 +03:00
Nick Fitzpatrick
589a665eb4 Fix for userEvents 14 on Master (#40761)
* Nick is sad

* tests passing
2024-03-28 22:53:48 +00:00
John Swanson
c451e286bc Fix :dataset_query (#40652)
... among other things.

The order of arguments was wrong here, causing the default
implementation of `post-process-collection-childre` to be called. The
implementation for `:card` ends up removing the `:dataset_query`
entirely, which is what was intended.
2024-03-28 15:43:35 -07:00
John Swanson
9961c354af Add location and effective_location to search (#40687)
For collections retrieved from the Search API, attach `location` and
`effective_location` so the frontend knows... where they're located.
2024-03-28 15:43:21 -07:00
dpsutton
e0d2407749 Throttle reset_password endpoint (#40760) 2024-03-28 17:30:28 -05:00
adam-james
23bda114fa Cards with Results Should Show up in Subscriptions (#40743)
* Cards with Results Should Show up in Subscriptions

Fixes: #40726

This PR fixes a bug where setting 'Hide thie card if there are no results' in a Dashcard's viz-settings would hide the
card even when there were results.

* adjust test to show that the setting is respected

Before, the setting would always hide the card. Now, the card is only hidden when there are no results. This test sets
up 4 cards: 2 are normal, 2 have no results, but 1 has the setting to hide empty. THerefore, we should expect to see 3 results.
2024-03-28 21:19:26 +00:00
Sloan Sparger
3522a5ccf2 Upgrade @testing-library/user-event to v14 (#40269)
* upgrades @testing-library/user-event to v14, updates test to accomidate events always returning promises and other breaking API changes

* Fixing up broken suites. Half way

* rest of tests

* green plz

* Fix new entries of userEvent usage

* unit test adjustments

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
Co-authored-by: Uladzimir Havenchyk <uladzimir.dev@gmail.com>
2024-03-28 18:24:23 +00:00
adam-james
347c5ef47c Make format export optional (#40606)
* Make Formatting on Exports Optional

Formatting on exports can be turned off via a middleware key:

`:format-export?` which will control if the 'app style' formatting will be applied to the exported results.
`:format-export? false` will return the file as in previous Metabase versions.

* format_export's default value provided in the QP middleware

Should still default to formatted for v. 49, as the formatting is intended as a feature. This default value should be
provided in a central place, so is added to the middleware and is therefore not necessary for the API to provide a default.

* weird indentation

* Add format_export param to dashboard dashcard query endpoint

* Add format_export option to embedded dashboard downloads endpoint

* Move default true value to the streaming-results-writer impls

* Default true but for real this time

* Add format_export to the public Question endpoint

* Add test to card api

* Dashboard exports endpoint test

* Add test to dashboard embeds

Test still fails and I don't know why yet

* the dangers of println debugging....

Well, I was passing a string false the whole time. Turns out the problem was me

* Public Card downloads endpoint now has format_export and test

* export_format also works for adhoc queries using api/dataset

* Let defendpoint do the boolean parsing

* Embed endpoint should now work too.

* Unify format-rows and format-export middlewares

* Sneaky endpoint!

* In xlsx, always parse temporal strings so that viz-settings formatting is applied

* Snuck in an incomplete change by accident. removed it.

* Can now specify format/no format on subscriptions

* Fix and move migration

* default format rows to true in attachments

* Ok, I think that should actually work for subscriptions.

* Change endpoints to use format_rows instead of confusing format_export

* format_rows everywhere

* Fix more test failures

* redef'd function had wrong signature

* Make format export optional (FE part) (#40643)

* Refactor download URL builder code

Need to handle query `params` and request `body` separately

* Export `useHover` from `metabase/ui`

* Add unformatted export for dashboard cards

* Add unformatted export for saved questions

* Fix POST body encoding

* Add unformatted export for ad-hoc questions

* Ensure `format_export` is always false for Excel

* Add unformatted export to public questions

* Add unformatted export to embedded questions and dashboards

* Fix behavior for PNG format

* Add tests for `QueryDownloadPopover`

* Fix e2e downloads helper (allow URL query params)

* Rework alt key handling

* Add e2e test

* Switch to `format_rows` instead of `format_export`

* Add unformatted export option to subscriptions

* Fix `isHoldingAltKey` initial state

* Rework e2e test to use Total column

* Fix initial checkbox state for subscriptions

* Use "Alt" in tooltip label for Windows/Linux

* Show the subscriptions toggle only for CSV attachments

---------

Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>

* Address review feedback

---------

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-03-28 17:59:21 +00:00
Jeff Bruemmer
6bf8b21cdf docs - update info collection page (#40197) 2024-03-28 13:08:13 -04:00
Alex Yarosh
036de06748 fix typo (#40744) 2024-03-28 10:43:58 -06:00
Oisin Coveney
dac5a001cd Fix wrong icon (#40738) 2024-03-28 18:21:05 +02:00
Kamil Mielnik
907a416009 Fix some warnings in JS console (#40727)
* Fix warning about passing a ref to a function component
- this didn't work and fortunately was not used (anymore) at all

* Move comment where it belongs

* Fix warning that functions cannot be react children
2024-03-28 15:38:40 +00:00
Alexander Polyankin
0b27a96fb0 Do not sort suggested columns, metrics, segments by name (#40636) 2024-03-28 16:24:06 +02:00
Oisin Coveney
3fbfeddf3d Convert text.module.css to CSS modules (#40582)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-03-28 16:15:00 +02:00
Oisin Coveney
153e039685 Convert scroll.module.css to CSS modules (#40621) 2024-03-28 16:11:38 +02:00
dpsutton
bcfe9e44a1 clear errors in success pathway (#40672)
if a previous run had an error, it will remain present but the state
would be "indexed". We should just clear that error.
2024-03-28 09:02:31 -05:00
Oisin Coveney
06c664ae79 Convert layout.module.css to CSS modules (#40561)
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
2024-03-28 14:32:26 +02:00
Oleg Gromov
bb04cccad2 Native query default parameter values: ParameterValuePicker for list values (#39852) 2024-03-28 11:31:45 +00:00
Alexander Polyankin
ce4af92c59 Trim clipboard data in filter widgets (#40718) 2024-03-28 10:55:32 +00:00
Tim Macdonald
df1366e128 ParseSQL: select * (#40637)
* Parse wildcards in native queries

Add query_field.direct_reference

* Do away with old Model refs in Card model test

* Do not show stale cards with a select *
2024-03-28 09:54:05 +00:00
Mahatthana (Kelvin) Nomsawadi
bee426d232 Update dependencies (#40713) 2024-03-28 09:21:06 +00:00
Chris Truter
0e0f5bb92d Strip tsv file extension (#40702) 2024-03-28 08:59:54 +00:00
Anton Kulyk
7efd8d3627 Fix dashcards from other tabs displayed after leaving editing mode (#40696) 2024-03-28 00:07:49 +00:00
Chris Truter
e63d82ef3e Accept TSV files for upload (#40566) 2024-03-27 22:18:42 +02:00
Sloan Sparger
c6c8ec0d3c Correct issue where EE only LDAP user provisioning feature is breaking OSS instances (#40685) 2024-03-27 14:39:00 -05:00
Ryan Laurie
70ec6d8615 Handle invalid file drop (#40690) 2024-03-27 13:35:55 -06:00
Raphael Krut-Landau
b426fe7eee Remove database prompt banner (#40648) 2024-03-27 13:51:46 -04:00
Ryan Laurie
a016ecca40 Collection moving with EntityPicker (#39869)
* wip - collection moving

fix subcollection detection

make stuff nice

update e2e tests

prettier

new e2e coverage

fix unit tests

fix stacked modals

cleanup

less diff

sneaky-ass modal wrappers

fix some e2e tests

* rebase rejigger

* fix tricky e2e flake
2024-03-27 10:22:04 -06:00
Uladzimir Havenchyk
0c9e3d55f9 Upgrade node to 18.20 (#40661)
* Upgrade node to 18.20

* Trigger CI

* Try 20 again

* Revert "Try 20 again"

This reverts commit 8f4b39e7a6.

* Revert change

* Add nvmrc to the frontend_sources list
2024-03-27 16:00:59 +00:00
John Swanson
c6dd2765b0 Allow group managers to view all people (#40619)
Fixes #40328

[Our documentation](https://www.metabase.com/docs/latest/people-and-groups/managing#group-managers) states that:

> Group managers can:
>
> - View all people in the Admin settings > People tab.

This fixes enforcement to be aligned with the documentation. This behavior makes sense, because as the docs also state, Group Managers should be allowed to *add* people to the group they manage, which they can only do if they can see those people!

Initially, I also removed a faulty test, which was described as:
```
;; Non-segmented users are allowed to ask for a list of all of the users in the Metabase instance. Pulse email lists
;; are an example usage of this. Segmented users should not have that ability. Instead they should only see
;; themselves. This test checks that GET /api/user for a segmented user only returns themselves
```

but actually failed to test this in a relevant way (because it was testing the `GET /api/user` endpoint rather than the `GET /api/user/recipients` endpoint). The test had continued to pass only because the user was the only member of the group they managed.

I initially thought this behavior wasn't desired, but as it turns out, it *is* in fact documented behavior to disallow sandboxed users from seeing any email suggestions. Investigating, I found that a bug was allowing sandboxed users to see all users on the `/api/user/recipients` endpoint if the user-visibility setting was set to `:all`.

Thus, the second commit fixes the bug and re-adds the (fixed) test. A sandboxed user now only sees their own user when hitting `/api/user/recipients`.
2024-03-27 15:40:27 +00:00
Oisin Coveney
9a0fdd429a Convert hover.module.css to CSS modules (#40575) 2024-03-27 17:08:41 +02:00
Uladzimir Havenchyk
16e5553ed6 Use a released version of source-map-js (#40667) 2024-03-27 14:14:01 +00:00
Noah Moss
7d2e51946a Custom migration to delete old truncate-audit-log quartz job (#40649) 2024-03-27 10:06:30 -04:00
Kamil Mielnik
244a19da32 Deprecate entity hooks (#40666)
* Deprecate entity hooks still in use

* Remove unused entity hooks

* Move entity framework hooks to a separate directory
2024-03-27 20:45:06 +07:00
Anton Kulyk
a6684ac137 Fix filters disappeared from dashboard PDFs (#40664) 2024-03-27 13:05:43 +00:00
Oisin Coveney
bf2bb2421a Convert headings.module.css to CSS modules (#40570) 2024-03-27 12:59:33 +02:00
Nemanja Glumac
cc1f9f038f Trigger a query limit update on blur while in notebook mode (#40630)
* Trigger the query limit change on blur

* Use named export

* Add a unit test

* Fix E2E tests

* Fix unit tests

* Additional E2E test fix

* Address review comments
2024-03-27 08:09:50 +00:00
Raphael Krut-Landau
a43261f2c6 Restore Models in Browse data (#40633)
* Revert "Remove Models from Browse data (#40108)"

This reverts commit 45a2e8689f.

* Make rtl friendly

* Add 'no description' for blank-description models

* Fix vertical position of collection header toggle

* Move FixedSizeIcon into metabase/ui and increase height of empty state

* Move FixedSizeIcon back into BrowseModels.styled.tsx

* Localize 'No description'

* Add comment

* Fix type issue
2024-03-26 23:43:40 -04:00
Ryan Laurie
5fb43f2663 Tag Flaky Tests (#40654) 2024-03-26 23:53:10 +00:00
Denis Berezin
98f6cd824e Embedding SDK - integration commit (#40198)
* Minimal SDK code

* Fix viz, styles

* Move SDK code to enterprise folder

* Fix files structure

* Clean-up

* Review fixes

* Review fixes

* Review fixes

* Remove elementid

* Reuse some options from main webpack config

* Actualize package.json

* Actualize package.json
2024-03-26 23:10:40 +00:00
Alexander Polyankin
65e527cdb3 Resolve crash due to missing stageIndex parameter in available-metrics (#40614) 2024-03-26 21:46:09 +00:00
Nemanja Glumac
b777f58d48 Remove readonly notebook view (#40641) 2024-03-26 21:22:25 +01:00
dpsutton
564e642f8a Raise model index limit (#40642)
* Use expression fix on both pk-ref and value-ref

The gist: inside the query expressions are referred to as [:expression
"foo"]. But as a nested query, it's just another field, and the fact
that it was an expression is irrelevant and should not leak from that
stage. So "downstream" should just be [:field "foo" base-type].

Oddly, if you just fix one field or the other, the query would be
"valid", would log an error, but no valid values would be returned.

It seems like the invalid expression reference was just dropped so we
only selected a single column and those were removed (we run `(filter
valid-tuples?)` as we only want valid key/value pairs).

So let's add a `(> (count values) 0)` which was failing previously.

* Fix indexing error

When updating the model index, it diffs the existing values vs the new
values and deletes appropriate and adds the new values. But it was using
the wrong column when updating the model index values. It used `pk_ref`
but that table uses `model_pk`. This led to the following errors on
stats:

```sql
select pk_ref, value_ref, state, error from model_index where state = 'error'

pk_ref,value_ref,state,error
"[""field"",563028,null]","[""field"",563018,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
"[""field"",534030,null]","[""field"",534037,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
"[""field"",545945,null]","[""field"",545948,null]",error,"ERROR: column ""pk_ref"" does not exist Position: 68"
```

Now those errors will be fixed and the model indexes will correctly
track the values

* Bump indexing threshold to 25,000

Had been limited to 5,000 rows of model indexing. This was a made up
number as we went into this endeavor. But it's proving to be far too
small. Bumping to 25,000

* Parititon deletions and inserts

With a higher limit need to ensure that we don't send too large of a
query.

```clojure
model-index=> (t2/insert! ModelIndexValue
                          (map (fn [id]
                                 {:name           (str (gensym "value"))
                                  :model_pk       id
                                  :model_index_id 1})
                               (range 25000)))
Execution error (PSQLException) at org.postgresql.jdbc.PgPreparedStatement/<init> (PgPreparedStatement.java:105).
PreparedStatement can have at most 65,535 parameters. Please consider using arrays, or splitting the query in several ones, or using COPY. Given query has 75,000 parameters
```

* move comment and fix test failure explanation

comment should be next to the number? check. and also need to use
`mc/explain` which returns info rather than `mc/validate` which returns
a bool:

```clojure
;; bad
model-index-test=> (let [values [[1 "foo"] [2 "foo"] ["foo" "foo"]]]
                     (-> (mc/validate [:sequential [:tuple number? string?]] values)
                         (me/humanize)))
nil
;; good
model-index-test=> (let [values [[1 "foo"] [2 "foo"] ["foo" "foo"]]]
                     (-> (mc/explain [:sequential [:tuple number? string?]] values)
                         (me/humanize)))
[nil nil [["should be a number"]]]
```
2024-03-26 15:22:12 -05:00
Cam Saul
4543a7fd9b Fix filtering on LocalDates (#40530)
* Split from #40146: only the filter changes

* Don't include format-rows changes here.

* Test fixes 🔧

* Test fix 🔧

* Misc test fixes 🔧

* Test fix 🔧

* Tweak SQL Server fix
2024-03-26 13:57:52 -06:00
Braden Shepherdson
b9f6cdb29d [MLv2] Return correct drill-thrus for single-row aggregates (#40462)
They were showing "break out by" and quick filters, when they should be
showing "break out by" and "See these Orders".

These are the `pivot` and `underlying-records` drills, internally.

Fixes #40174.
2024-03-26 12:54:16 -06:00
Ryan Laurie
49864834cd CSV Replacement Frontend (#40480)
* add UI for CSV replace

* update e2e tests

* update unit tests

* use enums everywhere + delete commented code block

* all the enums
2024-03-26 17:08:18 +00:00
Tim Macdonald
79f06ef9d0 Add the dev debug page to the docs (#40626) 2024-03-26 16:48:04 +00:00
Alexander Polyankin
4afee8dbed Use RTK beneath the database entity (#40560) 2024-03-26 16:14:18 +00:00
Ryan Laurie
b770bd58ab Collection Moving Cleanup (#40388) 2024-03-26 09:58:14 -06:00
Aleksandr Lesnenko
0b179262b4 fix normalized chart crashes when trend lines enabled but there is no insights data (#40624) 2024-03-26 12:17:21 -03:00
dependabot[bot]
826d632136 Bump express from 4.17.1 to 4.19.2 (#40618)
Bumps [express](https://github.com/expressjs/express) from 4.17.1 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.1...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Chris Truter <chris@metabase.com>
2024-03-26 14:13:22 +00:00
Nemanja Glumac
a07d90935a Show generated SQL in a side bar automatically - Milestone 1 (#40595)
* Show SQL in a notebook sidebar [PoC/task-1] (#40279)

* Display SQL in the notebook sidebar

* Remove unused modal

* Rename the component to `SQLPreviewSidebar`

* Hide the close button in a SQL sidebar

* Rename the component to `NativeQueryPreviewSidebar`

* Toggle a native query sidebar preview [PoC/task-2] (#40327)

* Use Mantine components where possible

* Rename the button to `ToggleNativeQueryPreview`

* Toggle the native query preview sidebar on and off

* Update the button tooltip based on the sidebar state

* Shorten var names

* Read the state directly from the store

* Re-enable the button that converts a query into its native counterpart [PoC/task-3] (#40362)

* Re-enable the button that converts a query into its native counterpart

* Use Mantine button

* Remove references to the modal

* Fix tests

* Use RTKQuery for API calls in the native preview sidebar [PoC/extras] (#40430)

* Use RTKQuery for API calls

* Fetch question inside the component

* Export named component

* Add type guard

* Use RTK query for the native dataset endpoint

* Improve semantics around error message

* Improve native sidebar basic styling [PoC/task-4]  (#40463)

* Refactor sidebar to use `AceEditor`

* Fix the query display condition

* Style the code as in the native query editor

* Style the toggle icon

* Make native preview usable on small screens

* Cover "Show SQL/native query in a sidebar" with E2E tests [PoC/task-5] (#40540)

* Fix query formatting for Mongo

* Add initial smoke tests

* Cover "converting a question to SQL" scenarios

* Cover "converting a question to a native query" scenarios

* Add test that covers behavior on small screens

* Adjust the viewport width to counter CI's behavior

* Revert "Adjust the viewport width to counter CI's behavior"

This reverts commit 370a76b621.

* Add E2E repro for #38181

* Add repro for #40557

* Try a workaround for the failing test in CI

* Show empty sidebar if query has no data source

* Add E2E coverage for an empty sidebar state
2024-03-26 15:02:10 +01:00
Oisin Coveney
be6c90d5ce Fix width issue in Embed Code sample (#40616) 2024-03-26 15:16:23 +02:00
Chris Truter
d8694f1a3a Bump follow-redirects from 1.15.5 to 1.15.6 (#40615)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-26 12:37:43 +00:00
Oisin Coveney
1ba18765d0 Convert link.module.css to CSS modules (#40584) 2024-03-26 14:20:58 +02:00
Nicolò Pretto
9cf856f2a9 export List from metabase/ui (#40348)
* export List from metabase/ui

* fix text color

* adds WithIcon example

* fix typos
2024-03-26 11:30:47 +01:00
Mahatthana (Kelvin) Nomsawadi
ba74c6bff3 Fix e2e util cypressWaitAll (#40572)
* Fix e2e utils

* Update e2e/support/commands/api/composite/createDashboardWithQuestions.js

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

* Remove unnecessary return

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

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-03-26 10:01:05 +00:00
Oisin Coveney
743f4ff9d7 Remove SaveQuestionModal.module.css and replace with general CSS modules (#40500) 2024-03-26 09:44:24 +00:00
Oisin Coveney
fa45b738d1 Convert grid.module.css to CSS modules (#40564) 2024-03-26 11:27:54 +02:00
John Swanson
dc279fde80 Sort official collections first in API endpoints (#40598)
* Sort official collections first in API endpoints

For both `/api/collection/tree` and `/api/collection/items`, sort
collections with official collections coming first.


Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-03-25 23:26:28 +00:00
Case Nelson
b4203948a5 Fix case-sensitive option leaking to string/= (#40535)
Fixes #40383

If a native query parameter is set up with a string widget type that
supports a `case-sensitive` option, and that parameter is tied to a
dashboard filter that did not support that option, the option was still
leaking into the filter as an option where options were not expected.

For instance the native query parameter used `string/contains` and the
dashboard used `string/=`, the QP would try to build a filter like `[:=
field value {:case-sensitive false}]` which is an illegal filter.
2024-03-25 15:23:54 -06:00
Alexander Solovyov
e3b360cde8 caching -> cache (#40578) 2024-03-25 22:53:06 +03:00
Jeff Bruemmer
113a9222e2 docs - update serialization.md (#40594) 2024-03-25 14:24:57 -04:00
Alexander Polyankin
73c5a96b17 Use can-save for models (#40586) 2024-03-25 20:14:28 +02:00
Jeff Bruemmer
2012647375 remove mention of fingerprinting (#40591) 2024-03-25 11:25:42 -06:00
Jeff Bruemmer
67cb98f23b fix anchor links (#40588) 2024-03-25 13:14:42 -04:00
Alexander Solovyov
815b2a7308 make cache config available for OSS version (#40512) 2024-03-25 14:57:33 +00:00
Alexander Polyankin
e74cf9f571 Migrate /api/password_reset_token_valid to RTK (#40568) 2024-03-25 16:32:13 +02:00
Bryan Ricker
f302f221e1 typo fix (#40467) 2024-03-25 10:29:32 -04:00
Chris Truter
9d0d0c8daf Use mb/once for relevant upload tests (#40499) 2024-03-25 13:50:03 +00:00
Alexander Polyankin
62df05aef1 Deprecate Entity Framework (#40563) 2024-03-25 15:20:28 +02:00
Chris Truter
2a68dfabc1 Fix parsing integers after floats in CSV upload (#40552) 2024-03-25 11:53:58 +00:00
Chris Truter
b206d85b44 Implement CSV separator inference (#40525) 2024-03-25 11:41:26 +00:00
Chris Truter
135f8c7fd0 Prevent NPE when formatting geographic coords (#40550) 2024-03-25 11:22:51 +00:00
Tim Macdonald
d52d4fe18a Bump next.jdbc (#40452) 2024-03-25 10:50:43 +00:00
Ngoc Khuat
8b728bec35 Fix unable to migrate to 49 due to v49.00-059 migration (#40547)
* In #37160 we added a migration to convert all datetime columns to
timestamp with time zone by using a fixed list of what to convert. but
it turns out some customer instances has a different list. So this PR
removed the fixed list and use a query to get a list of all datetime
columns.
2024-03-25 10:49:39 +00:00
Ngoc Khuat
9b941d8a35 Add tests for checking partial table privileges on PG (#40549) 2024-03-25 10:40:54 +00:00
Tim Macdonald
760d1196c9 Backend dep bump for 50 (#40372)
* Remove unused marginalia aliases

* Upgrade deps.edn

From `neil deps upgrade`

* Un-bump jetty-server

* Downgrade H2 due to many problems

* Dep bumping for Athena

* Dep bumps for BigQuery

* Dep bumps for Presto

* Dep bumps for Redshift

* Dep bumps for Snowflake

* Dep bumps for SQLite

* Upgrade to Mongo 5

* Bump next.jdbc
2024-03-25 08:32:57 +00:00
Nicolò Pretto
f1194b2494 remove enum from step_number on setup event schema (#40456) 2024-03-25 09:25:49 +01:00
Eric Jensen
13df79cd1c Include postgresql tables that are visible through column grants instead of full table grants for simple questions (#40034)
Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-03-25 09:15:57 +01:00
Ngoc Khuat
4e9d14b19c Postgres: Sync table row count (#39494) 2024-03-25 07:55:54 +00:00
Ngoc Khuat
6176fe4d8f Homebrew getTables for postgres (#39670) 2024-03-25 04:36:05 +00:00
adam-james
3133edce33 Funnel Chart Static-Viz should handle row data more robustly (#40114)
* Funnel Chart Static-Viz should handle row data more robustly

The row data coming into the funnel chart render method can evidently have a few slightly different shapes, and may
need to be 'coordinated' with the :funnel.rows key from viz-settings (names and order are specified there).

This is a WIP to make the method more robust to different row data shapes. For example:

[[1 100] [2 200]] should work as well as [["A" 100] ["B" 200]] and correctly handle the viz-settings

WIP because I need to add a test or two, try to get a handle on the exact schema that is allowed for 'row shape' and
the funnel.row viz key, and see if there are failing cases that I haven't considered yet.

* Funnel rows should now work more effectively with possible raw-rows

* Add a test that checks the success of the render and correct order

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>

* Update src/metabase/pulse/render/body.clj

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>

* Addressing feedback from the review

 - renamed build-funnel-rows to funnel-rows
 - used 'funnel-viz' as the binding for the {:key "asdf" :name "asdf" :enabled true} maps from the viz settings
 - added docstring to the function to try clarify its 2 branches (keys vs indices on the rows)

---------

Co-authored-by: Chris Truter <crisptrutski@users.noreply.github.com>
2024-03-22 21:15:32 +00:00
Alexander Polyankin
ea498e809b Migrate filter field values to RTK (#40515) 2024-03-22 20:35:49 +00:00
Alex Yarosh
79c947d45c [docs] mention reordering on charts (#40409)
* note about reorder

* Apply suggestions from code review

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-03-22 14:17:12 -06:00
Alexander Solovyov
e2dd8a8a44 fix t2.hydrate import in dev (#40508) 2024-03-22 19:25:25 +02:00
adam-james
aab6657198 Trend Chart Viz Should Use Proper Card execute in Rendering (#40464)
* Trend Chart Viz Should Use Proper Card execute in Rendering

WIP

Fixes: #39854

The trend chart follows a code path shared with multi-series static-viz. This means there was an implicit expectation
that a dashcard is associated with the card at all times. This isn't true for alerts, so the code is fixed to remove
the failure.

* Add a test

* add missed :breakout that actually made the test work

oops

* Adding comments to try clarify what's going on
2024-03-22 09:24:09 -07:00
Denis Berezin
b4fa0de3c0 Global to local css migration - form (#40133)
* Migrate form.module.css

* Self review fixes
2024-03-22 14:34:27 +00:00
Nick Fitzpatrick
fbcd986ce2 Command palette/main (#39268)
* Command Palette

* small adjustments

* unit tests for results

* removing dupe component

* removing unneeded webpack config

* fix linting issue

* fixing scroll behavior for settings

* moving search results message, adding embedding e2e test

* unit tests for palette utils
2024-03-22 14:16:12 +00:00
Cal Herries
1409c7bdf4 Skip mysql for rollback test: add-join-alias-to-visualization-settings-field-refs-test (#40505) 2024-03-22 15:58:18 +02:00
Oisin Coveney
2f7952b5f6 Convert calendar.module.css to CSS Modules (#40353) 2024-03-22 15:40:46 +02:00
Cal Herries
68625a4fad Relax public action execution throttler to allow 10 requests every second (#40465) 2024-03-22 13:29:24 +00:00
Oisin Coveney
99f2595570 Convert overflow.module.css to modules (#40498) 2024-03-22 15:05:03 +02:00
Ngoc Khuat
c772c0ae89 Redshfit: sync tables with partial select permission (#40421) 2024-03-22 12:20:14 +00:00
Cal Herries
060e6d466b Add back describe-database test coverage for redshift (#40446) 2024-03-22 14:15:32 +02:00
Oisin Coveney
f2960b1f1b Convert flex.module.css to CSS modules (#40457) 2024-03-22 14:07:03 +02:00
Chris Truter
e861d18bb6 Basic version of CSV replacement, with only basic testing (#40363) 2024-03-22 11:40:49 +00:00
Ngoc Khuat
1e759755c0 move the detect n+1 hydration to dev ns (#40486) 2024-03-22 07:58:31 +00:00
Kamil Mielnik
c6cd140efb Refactor types in CollectionPicker (#40377)
* Generic types

* Generic types

* Generic types + make generateKey a prop

* Generic types

* Extract AutoScrollBox.styled.tsx

* Move AutoScrollBox to a separate directory

* Generic types

* Generic types

* Generic types

* Unhookify searchFilter

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Generic types

* Finish dealing with a cast

* Destructure import

* Inline type

* Generic types

* Remove cast

* Remove commented code

* Remove redundant fallback

* Move CollectionPicker out of EntityPicker

* Avoid as unknown

* Remove TODOs

* Rename TisFolder to IsFolder

* Fix any

* Fix anys

* Remove NestedItemPicker's storybook

* Remove a cast

* Remove a cast

* Remove a cast

* Revert "Remove a cast"

This reverts commit b762d0f076.

* Use extends SearchModelType instead of extends string everywhere

* Revert "Use extends SearchModelType instead of extends string everywhere"

This reverts commit 708190d63e.

* Fix SearchResult["available_models"] type
2024-03-22 13:53:56 +07:00
Ngoc Khuat
a03dd0955b Detect N+1 hydration and throw an exception (#40272) 2024-03-22 02:27:08 +00:00
Alex Yarosh
b277fcc701 [docs] Organize and add undocumented custom expressions (#40050)
* sort expression functions by use case

* custom expression edits

* formatting cleanup

* fix link

* Apply suggestions from code review

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

* address comments

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-03-21 17:39:11 -06:00
Nick Fitzpatrick
21ec7d6850 correcting input ref on ListSearchField (#40453) 2024-03-21 18:21:59 -03:00
Nick Fitzpatrick
ca83975013 40232 sortable with popovers (#40378)
* custom sensor

* e2e test, moving sortable

* e2e test adjustment

* combining props
2024-03-21 18:21:37 -03:00
bryan
5c946b30c2 Often SLO won't be setup on the IdP but we should still delete the session. (#40459)
* Often slo won't be setup, but we should still delete the session

* test that we delete the session even when "/handle_slo" is not called

* cleanup test

* take the cookie from the session, not as a parameter
2024-03-21 20:38:11 +00:00
Nemanja Glumac
ca82de8137 Remove the aggregation item tooltips (#40461)
* Remove the aggregation item tooltips

* Fix relevant unit test
2024-03-21 19:18:04 +01:00
Tim Macdonald
017afe5bfa Git-ignore all Marginalia-generated docs (#40458) 2024-03-21 14:02:36 -04:00
John Swanson
defd5cee28 /api/collection/:id/items gets here and below (#40203)
* /api/collection/:id/items gets `here` and `below`

During postprocessing of `collection` children retrieved by
`/api/collection/:id/items`, annotate each of the children with `below`
and `here` keys representing the presence of questions, models, or
collections at this level of the hierarchy or below it.

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-03-21 09:54:14 -07:00
Alexander Polyankin
6e81c48abc Cleanup can-save (#40448) 2024-03-21 15:46:32 +00:00
Denis Berezin
6be91c5a36 Embedding SDK - add CORS header for API endpoints (#40394)
* Add CORS solution for SDK

* Review fixes

* Linter fixes
2024-03-21 18:46:16 +03:00
Kyle Doherty
b2bc74fafa Small bit of api doc styling (#40443)
* tweak styling to better match MB

* add Lato as rapidoc font

---------

Co-authored-by: Alexander Solovyov <alexander@solovyov.net>
2024-03-21 11:25:28 -04:00
adam-james
104f18ccaf Formatter Gives correct year for dates near start/end of Year (#40410)
Fixes: #40306

Our datetime formatter relies on the `java-time.api`, for which there are many different, sometimes confusing, formatter patterns: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#appendPattern-java.lang.String-

In this case, 'YYYY' is a week-of-year style year, which calculates which week a date falls into before returning the
year. Sometimes days near the start/end of a year will fall into a week in the wrong year.

For example, apparently 2023-12-31 falls into the 1st week of 2024, which probably not the year you'd expect to
see. What we probably do want is 'yyyy' which calculates what day of the year the date is and then returns the year
based off of that instead of the week number.

For an explanation, you can check out this SO answer: https://stackoverflow.com/a/46395342 provides an explanation.
2024-03-21 08:09:17 -07:00
Alexander Polyankin
f41cd82f5b Fix missing columns after query fields update (#40398) 2024-03-21 15:07:41 +00:00
Oisin Coveney
3690baaf6f Convert animation.module.css to CSS modules (#40228) 2024-03-21 14:25:30 +00:00
Mahatthana (Kelvin) Nomsawadi
63ba56fdf0 Fix flaky whitelabel test (#40441)
* Fix flaky whitelabel test

* Update another test for `landing-page`
2024-03-21 14:16:06 +00:00
Oisin Coveney
bf43aa2162 Convert arrow.module.css to CSS Modules (#40289) 2024-03-21 16:04:15 +02:00
Alexander Polyankin
850024ac6d Fix models utils using mbql directly (#40438) 2024-03-21 15:39:17 +02:00
Jeff Bruemmer
17c7d1c6af add 49.1 to list of releases (#40439) 2024-03-21 08:59:28 -04:00
Raphael Krut-Landau
c06291d657 Restore logo margin (#40417) 2024-03-21 06:31:23 -04:00
Abed Habli
3f42b5ac09 adding a new section "How x-ray works" (#40248)
Thanks, Jeff and Alex!
2024-03-21 10:41:49 +01:00
Ngoc Khuat
0eb75595bd Fix N+1 in checking write permission for collection (#40345) 2024-03-21 16:07:51 +07:00
Cal Herries
c1cfdd9f37 Revive flaky redshift tests (#40391) 2024-03-21 08:36:35 +00:00
Alexander Polyankin
fc8711b727 Filter operator defaults (#40352) 2024-03-21 10:30:12 +02:00
Mahatthana (Kelvin) Nomsawadi
5cee34ede5 Add data-display/Image to "metabase/ui" (#40373)
* Add data-display/Image to "metabase/ui"

* Add `position` API to accompany `fit` API

* Feedback: Make file name consistent with the codebase
2024-03-21 08:03:33 +00:00
Alexander Polyankin
00341d07a4 Add tests (#40423) 2024-03-21 10:01:07 +02:00
Cam Saul
0a15637f13 Rename metabase.mbql to metabase.legacy-mbql (#40158)
* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Rename `metabase.mbql` to `metabase.legacy-mbql`

* Fix Kondo warnings

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* Fix import

* Another fix 🔧

* Merge

* FIXES

* Add another missing REQUIRE
2024-03-21 05:38:41 +00:00
Chris Truter
b4949f7c82 Restore lost csvupload snowplow schema (#40277) 2024-03-21 04:52:20 +00:00
Cam Saul
efffd5898d E2E support for CRUD + running pMBQL queries; new MLv2 normalization [WIP] (#39969)
* E2E support for CRUD + running pMBQL queries; new MLv2 normalization

* More work on improved normalization

* Update schema references

* Test fixes 🔧

* Move the MBQL parameters schema

* Performance improvements

* Improved pivot code etc.

* Clean namespaces

* Fixes 🔧

* Wow

* Test fix 🔧

* Fixes

* Actions should use strings for column names (fix :update-row and :create-row normalization)

* MLv2 schema should check against keys for the other query type

* Ok, have I fixed things?

* More fixes 🔧

* Fix indentation

* Another round of test fixes. 🔧

* Split pivot stuff off

* Hopefully the last few test fixes 🔧

* We need to test normalization for queries that have keyword keys as well.

* Fix Cljs i18n namespaces

* Sort namespaces

* Only test against H2

* Test fixes 🔧

* Register MBQL clause schemas and test fixes 🔧

* Test fixes and PR feedback

* Test fix

* Remove the normalization tests

* Test fixes 🔧

* Fix kondo

* Test fix

* Another fix

* Test fix 🔧
2024-03-21 01:16:11 +00:00
bryan
bcda846895 Feature branch for airgap-token: Milestone 1 (#39733)
* decrypt and read values from airgap token

- Adds notion of "AirgapToken"
- Adds max-users and company optional fields to `TokenStatus`
- Adds branch to `fetch-token-status*` for handling airgapped tokens

* Add support for handling airgap tokens

- validate airgap token valid-thru date

* enforce user creation limits using airgap token

* fix airgap token reads + fill in the token data

* in oss mode don't try to read the airgap_ token

* use airgap-token? helper

* tighten the user-creation logic

- make the check correct
- account for archived users

Co-authored-by: John Swanson <john.swanson@metabase.com>

* check airgap user count

setting premium-embedding-token
app startup

* move decryption code into ee namespace

* add some tests for token decryption

* fix tests and add tests

* move ee features into ee tests

* add typehint + warn on reflection

* add a check for missing public key resource

* respond to review

- add docstring to AirgapToken
- remove outdated comment
- fix off-by-1 error

* valid-now? takes a TokenStatus instead of a :map

* revert usage of mt/with-temporary-setting-values

---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-03-20 15:31:25 -06:00
Ryan Laurie
61a2a60e21 RTKQuery integration: login history (#39273)
* wip

* refreshes list through tag invalidation rather than prop drilling refresh list fn

* invalidate count, added invalidation utils, general clean up

* custom fetcher that makes use of our api service

* reorganizes files and impls util to createEntityApis more easily

* documents different approaches

* moves main file

* wip

* stash

* clean up

* further clean up

* type annotations clean up

* fixes api key unit test

* pull out api keys feature from branch

* moves files core rtkquery files into metabase/api

* replace trivial loginHistory entity

* export hook too

* fix rebase

---------

Co-authored-by: Sloan Sparger <sloansparger@gmail.com>
2024-03-20 15:15:08 -06:00
Alex Yarosh
01a1d4cb06 [docs] better surface docker compose (#40407)
* surfacing docker compose

* Update docs/installation-and-operation/running-metabase-on-docker.md

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

---------

Co-authored-by: Jeff Bruemmer <jeff.bruemmer@gmail.com>
2024-03-20 15:13:32 -06:00
Jeff Bruemmer
58b667d9bc docs - mb_no_surveys (#40400) 2024-03-20 17:04:59 -04:00
Anton Kulyk
9f4e9137ec Fix a flaky test in revision history suite (#40359)
* Clean up test

* Fix race condition

* Wait for GET dashboard + for sidebar to close

* Add wait

* Add a sad comment
2024-03-20 21:02:23 +00:00
bryan
61cacd7faf Windows doesn't know what a UnixPath is: use Path (#40384) 2024-03-20 20:27:23 +00:00
Raphael Krut-Landau
7216c2ed91 Accommodate wide icons in nav and admin nav (#40386) 2024-03-20 19:58:29 +00:00
Cal Herries
cd1de02f9b Fake test dataset isolation for redshift (#40310) 2024-03-20 21:57:04 +02:00
Denis Berezin
43fbe75e3b Global to local css migration - Query Builder, Dashboard (#40106)
* Global styles refactor

* Add missing test change

* Fix e2e

* Migrate buttons

* Migrate buttons

* Migrate query builder

* Migrate dashcards

* Review fixes

* Review fixes

* Review fixes
2024-03-20 18:42:54 +00:00
Alexander Solovyov
22e3963b2e OpenAPI docs (#40162) 2024-03-20 20:22:36 +03:00
adam-james
49d76b6a3f Autodescribe Question Prompt adjustments (#40319)
In a working meeting, some prompt adjustments were tried. This change felt like the best incremental improvement,
considering feedback from users on stats.

We attempted to guide the LLM to return descriptions that:

 - don't state the chart type as if its *very* important (we can see what it is already, so its not that important)
 - do call out caveats and important specifics as implied by the question's filters, aggregations, and breakouts
 - are descriptive but not verbose
 - try not to state caveats too strongly
2024-03-20 10:17:05 -07:00
Luis Paolini
caa50d98c6 Add formatted values (#40389) 2024-03-20 14:08:59 -03:00
Alexander Solovyov
4eadd09e70 Fix caching tests flakes (#40379) 2024-03-20 16:36:25 +00:00
Chris Truter
4eea9108d6 Rename load-from-csv to create-from-csv (#40367) 2024-03-20 15:29:01 +00:00
metamben
8e89c578ac Rename metric to legacy-metric (#39232)
* Rename :model/Metric to :model/LegacyMetric
* Rename ::lib.schema.metadata/metric tp ::lib.schema.metadata/legacy-metric
* Rename models.metric/Metric to models.metric/LegacyMetric
* Move /api/metric endpoints to /api/legacy-metric
2024-03-20 15:03:26 +00:00
Nick Fitzpatrick
841d902b43 SettingsSetting to Functional Component (#40318)
* SettingsSetting FC, change to named export

* adding unit test
2024-03-20 11:53:17 -03:00
Nemanja Glumac
703ee9ec78 Expand and explain the NativeQueryForm type (#40358) 2024-03-20 14:24:58 +00:00
Nemanja Glumac
9a60d3949d Update dataset RTKQuery API (#40356)
* Rename api to just `dataset`

We're going to use this api for both structured and native endpoints.

* Fix the input type
2024-03-20 15:07:21 +01:00
Alexander Solovyov
4f04b6b18c Caching: new strategies and configuration API (#38400) 2024-03-20 15:22:45 +03:00
Nick Fitzpatrick
4a7903dd53 Moving new item modals to be global (#40315)
* moving new item modals to be global

* adjusting unit tests
2024-03-20 09:19:06 -03:00
Nemanja Glumac
6473241a24 Prevent QB header from jumping between modes (#40335) 2024-03-20 12:18:52 +00:00
Alexander Polyankin
4c0d0ea8b4 Fix UX for picking multiple values in filters (#40278) 2024-03-20 12:18:18 +00:00
Oisin Coveney
25bac882cf Convert inputs.module.css to CSS Modules (#40163) 2024-03-20 11:53:31 +02:00
Oleg Gromov
37b4269d1b Fix: allow running native queries with required parameters and no defaults (#40288) 2024-03-20 09:48:41 +00:00
Nemanja Glumac
2ad88d074b Rename QueryViewNotebook to NotebookContainer (#40316)
* Use Mantine Flex for the NotebookContainer

* Rename the component to `NotebookContainer`

* Convert to TS

* Explain the delay

* Use regular div

* Destructure the import type

* Simplify styling

* Shorten the prop name to `isOpen`
2024-03-20 09:40:06 +00:00
Nicolò Pretto
0ea451bfc1 v2 of minimal embed homepage (#40168)
* v2 of minimal embed homepage

* useState instead of useMemo, fix unit tests

* address pr feedback
2024-03-20 09:19:56 +01:00
Ngoc Khuat
2f816f1812 Convert simple hydration to batched hydration (#40217) 2024-03-20 12:36:32 +07:00
Ngoc Khuat
0e17e3b581 Redshift and Oracle test sync: do not use hack (#40052) 2024-03-20 05:08:10 +00:00
Ryan Laurie
bc88692513 RTKQuery Implementation: AuditInfo (#39266)
* use rtk for auditInfo

* destructured hook export

* fix rebase

* remove unused services definition
2024-03-19 23:15:57 +00:00
Sloan Sparger
6212151bec Split setup process into atomic stages (#39287) 2024-03-19 18:13:45 -05:00
Ryan Laurie
835a4495f7 Handle double escape in entityPicker (#40151)
* handle double escape in entityPicker

* escape key test

* use fancy hook
2024-03-19 22:53:15 +00:00
Jeff Bruemmer
c69e08faf7 add 48.9 to list of releases (#40324) 2024-03-19 16:00:03 -04:00
Jesse Devaney
4c28763287 Fix null values being applied to filters with click behavior custom URL links (#40023)
* do not pass null values to link url

* update null check to include query builder nulls replaced with "(empty")

* add test to verify behavior

* replace magic string with constant

* fix breakout in cypress spec
2024-03-19 19:33:14 +00:00
Nemanja Glumac
e7e35973ef createNativeDataset API using RTK query (#40286) 2024-03-19 20:21:51 +01:00
Chris Truter
af6cbeb8a0 Preserve sign on parenthesized zero floats when parsing (#40309) 2024-03-19 18:46:47 +00:00
Braden Shepherdson
18701ae3c6 [MLv2] Allow any arithmetic sub-clauses in an aggregation (#40259)
This issue was previously punted, because the schema for aggregation
clauses allowed the tag to be `:any`. Now it's a short list of permitted
arithmetic expressions, but that list is too short and excludes things
like `:round`.

This change searches for an aggregation clause transitively in the
expression, and so allows any arithmetic expression.
2024-03-19 18:45:18 +00:00
Chris Truter
30bbf73392 Fix float-to-int type coercion for CSV appends (#40275) 2024-03-19 17:47:00 +00:00
Cal Herries
84735b5571 Revert "Revert updating FKs during metadata sync (#39679) (#39924)" (#40233) 2024-03-19 18:59:05 +02:00
Cal Herries
f2e8df68a3 Fix flaking tests using mt/with-temp-copy-of-db (#40291) 2024-03-19 18:37:43 +02:00
Alexander Polyankin
17f960c0d0 Dimension field error handling (#40300)
* Add try-catch in Dimension.field()

* Fix the bug

* Fix the bug

* Fix the bug
2024-03-19 18:34:29 +02:00
Kamil Mielnik
80effffd0a Fix e2e search tests running out of memory (#40294)
* Move search-related snowplow tests to a separate file

* Update test names

* Move filters-related search tests to a separate file

* Extract search helpers into a separate file

* Revert test rename
2024-03-19 15:55:17 +00:00
Oisin Coveney
71ff518a2e Convert AdminPaneLayout and AdminPaneTitle to TS (#40285) 2024-03-19 17:34:14 +02:00
Ryan Laurie
ec847fd6be RTK Implementation: store/billing info API (#39270)
* use rtk query for billing info
2024-03-19 15:03:35 +00:00
Ryan Laurie
6e48b65512 Remove instance settings from error diagnostics (#40245) 2024-03-19 07:58:57 -06:00
Ryan Laurie
8768079543 Diagnostic Modal Updates (#40149)
* capture more frontend errors

* improve fallback error experience
2024-03-19 07:53:21 -06:00
Oisin Coveney
5b63015ef1 Convert admin.module.css to CSS modules (#40081) 2024-03-19 14:08:31 +02:00
Kamil Mielnik
08f8952a68 [E2E] Refactor question commands to function helpers (#40236)
* Extract question function helpers

* Move question helpers

* Remove cy.archiveQuestion

* Replace cy.createQuestion usages in TS files

* Format code in JSDocs
2024-03-19 18:36:35 +07:00
Alexander Polyankin
e2bcb38c9a Compose dataset mbql follow-ups (#40281)
* Fix comment

* Try removing Visualization hack for composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion

* Try to remove composeQuestion
2024-03-19 13:26:04 +02:00
Chris Truter
99758685e9 Log warnings when we redact database details (#39638) 2024-03-19 09:38:02 +00:00
Alexander Solovyov
f38617d179 uncomment migration tests (#40230)
mysql seems to have stopped flaking on them
2024-03-19 12:28:04 +03:00
Alexander Polyankin
448a4f3dca Migrate composeDataset and composeThisQuery to MBQL lib (#40181) 2024-03-19 11:10:45 +02:00
Nemanja Glumac
51a20b15f6 SQL in a sidebar prep: NativeQueryPreview component (#40268)
* Export named `NativeCodePanel`

* Export named `NativeQueryModal`

* Rename `NativeQueryModal` to `NativeQueryPreview`

* Do not use styled components in the `NativeQueryPreview`
2024-03-19 09:46:32 +01:00
Alexander Polyankin
41c9c50120 Fix dnd clause composition (#40274) 2024-03-19 08:07:12 +00:00
Denis Berezin
2fd5d6ebef Global to local css migration - grabber (#40007) 2024-03-18 22:12:00 +00:00
Braden Shepherdson
15a411c241 [MLv2] Support Extract to get the domain from emails (#40200)
Milestone 3 of #38964.
2024-03-18 22:02:05 +00:00
John Swanson
918878ebd2 return collections in same order from /api/collections/tree and /api/collections/:id/items (#40044)
There were two problems here:

- one endpoint was sorting in the database, but not putting 'analytics'
last.

- one endpoint was sorting in the database, but then sorting again in
clojure, which had subtly different behavior for special characters

Fixes #39965
2024-03-18 14:12:32 -07:00
Case Nelson
341e4b4c60 Fix time-interval-expression-test flake (#40253) 2024-03-18 14:29:32 -06:00
adam-james
fef2e75d3c Lock :display when using 'zoom' in Dashboard (#38496)
* Use proper :display when using 'zoom' in Dashboard

Fixes: #38307

WIP, I want to change at a different call site so that defaults are still used in case there is no :display set.

* Lock Display so that drill through doesn't overwrite it with defaults

* Lock display only when drill action coming from a dashboard

* Use isDashboard properly

* Add test to confirm Display is locked from Dashboards

* minor changes to the test

* Lock Display specifically for zoom-in-binning and timeseries

* Fix wrong string quotes

* Try a simple change to see if the e2e test will pass in CI

* Fix test

* Minor refactor

* Wait for dashcard queries in e2e test

* Wait for loading spinner to be gone

* Fix type errors

* Fix incorrect dashboard ID used in test

---------

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-03-18 13:24:59 -07:00
Chris Truter
a767fd31c9 Support appending new CSV fields (#39951) (#40220) 2024-03-18 18:21:45 +00:00
Braden Shepherdson
7a4918d062 [MLv2] Support Extract action for (sub)domains from URLs (#40188)
Milestone 2 of #38964.
2024-03-18 18:02:49 +00:00
Sloan Sparger
b04e1a3568 RTKQuery integration: API Keys (#40043) 2024-03-18 11:59:27 -05:00
Chris Truter
6710930a62 Publish snowplow events on CSV append success / failure (#39944) 2024-03-18 16:16:56 +00:00
Cal Herries
ad9016f938 Comment out failing time-interval-expression-test (#40238) 2024-03-18 14:41:51 +00:00
Nemanja Glumac
936e38a10a E2E test coverage for "Highlight the selected data source in the notebook editor" project (#40199)
* Add the initial test for the empty app db

* Add reproduction for #25142

* Add test that covers only saved questions

* Cover scenarios with a table as a source

* Add tests that cover nested questions and models

* Add test for simple model's source table

* Remove intercepted schema routes

* Improve assertion

* Fix the test failing on enterprise instance

* Add E2E reproduction for #40223

* Remove superfluous code block

* Avoid casting
2024-03-18 15:28:44 +01:00
Sloan Sparger
ee131b5f71 Upgrade to React 17 (#40144)
* upgrade to react 17

* fix popovers

* upgrade formik to fix types

* fix sso nested form failures

* fix WindowModal failing unit test

* update RowChart test to accommodate changes to event pooling in react 17

* updates input blur change components to use layout effect to ensure input ref is available at the time of unmount

* fixes failing map visualization e2e test
2024-03-18 09:11:34 -05:00
Alexander Polyankin
c98419c9ce Disable saving models without up-to-date result_metadata (#40087) 2024-03-18 13:55:27 +02:00
Oleg Gromov
0f1873f4b3 eslint: Disable testing-library/no-unnecessary-act (#40084) 2024-03-18 11:42:50 +00:00
Nemanja Glumac
6fe41dd437 Provide more room for the "Expected behavior" in bug reports (#40222) 2024-03-18 10:43:29 +01:00
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
Anton Kulyk
a16b4d5cf7 Fixes for LLM auto-description (#39858)
* Fix card summarize endpoint

* Fix "AI features" setting section visibility

* Add  setting

* Use `ee-ai-features-enabled` setting

* Add test for new LLM defsetting. Add note in settings UI

---------

Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
2024-03-11 07:05:46 -07:00
Romeo Van Snick
a1e31348f7 Remove info icon on table (#39853)
* Allow hiding empty TableInfoIcons

* Hide info icon if it is empty in header

* Do not show info icon on subheader

* Replace hideIfEmpty for showIfEmpty
2024-03-11 15:02:24 +01:00
Ryan Laurie
aed35c65ac Diagnostic Information Modal (#39817)
* Add metabase user id to log lines
* add modal to select error data to include
* trigger on global keyboard shortcut
---------

Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-03-11 07:54:51 -06:00
Tim Macdonald
bd69928398 Add Marginalia link to the Developer Guide (#39937) 2024-03-11 13:38:41 +00:00
Cal Herries
d1c59dabec Make update-card-with-type-and-dataset-test not parallel (#39929) 2024-03-11 12:57:47 +00:00
John Swanson
549153c45e Fix hanging cache refresh jobs (#39664)
I started a much more complex fix with a job that tried to clean up
stale `refreshing` PersistedInfos... then talked to Dan, who pointed out
that because only one instance is running these jobs at any given
time, we can just add `refreshing` to the list of refreshable states.
2024-03-11 12:42:22 +00:00
Alexander Polyankin
d02629e451 Allow dropdown source for all string operators in dashboards (#39703) 2024-03-11 12:20:50 +00:00
Cal Herries
a2f3656b3e Only copy active fields and tables with data/with-temp-copy-of-db (#39862) 2024-03-11 10:05:22 +00:00
Kamil Mielnik
ef9fb05784 Repro #35711 - Models broken with custom fields (#39763)
* Add repro for metabase#35711

* Format code
2024-03-11 13:35:23 +07:00
Kamil Mielnik
af200d4d31 Fix - Description for calculated columns in model metadata editing page is incorrectly populated with description from other columns (#39851)
* Fix metabase#34349

* Remove outdated comment

* Add repro for metabase#34349

* Add tag for issue 25884 and extract a constant
2024-03-11 13:34:27 +07:00
Nick Fitzpatrick
6565d04314 Using CSS transition and component for QB header (#39794)
* Using CSS transition and  component for QB header

* Reduce delay on hovercard in tests

* Increase timeout on hovercard

* Wait for longer in hovercard test

* mouseover

---------

Co-authored-by: Romeo Van Snick <romeo@romeovansnick.be>
2024-03-08 23:18:14 -04:00
Aleksandr Lesnenko
cda5baf098 hide execution time from percy snapshots (#39870) 2024-03-08 19:40:27 -03:00
Cam Saul
2dccd287b1 Convert QP to MLv2 (Part 1) (#39613)
* 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 🔧

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

* Test fix

* Test fix
2024-03-08 19:27:30 +00:00
Aleksandr Lesnenko
bf3e899e19 Specify GH project board per team (#39631)
* specify GH project board per team

* update teams projectUrls

* remove QC team project url
2024-03-08 15:35:06 -03:00
Jesse Devaney
e3de88900a adjust progress bar height when card is min height (#39819) 2024-03-08 13:31:06 -05:00
Jesse Devaney
80703aa63a adjust padding for small cards (#39811) 2024-03-08 13:30:35 -05:00
Chris Truter
e8fc1a0a60 Publish audit logs for CSV uploads (#39821) 2024-03-08 18:29:16 +00:00
Noah Moss
f7103f080b Bump clojure to 11.1.2 (#39857) 2024-03-08 17:04:57 +00:00
Chris Truter
a0d78d1956 Upgrade column type when appending floats to an integer column (#39493)
Contains two child PRs:

* Optimize upload type inference (#39741)
* Take upload settings as an argument for easier testing (#39706)
2024-03-08 17:00:52 +00:00
Sloan Sparger
75a16e72e8 removes react motion from undo component (#39787) 2024-03-08 09:38:47 -06:00
Alexander Polyankin
28ab027592 Extract column e2e (#39770) 2024-03-08 13:13:44 +00:00
Alexander Solovyov
77b649dbcb [chain filters] should not be using inactive fields for joins (#39635) 2024-03-08 12:39:26 +00:00
Alexander Polyankin
56b3e22c07 Fix test name (#39791) 2024-03-08 12:07:53 +00:00
Cal Herries
58f7889155 Update existing foreign keys during metadata sync (#39679) 2024-03-08 11:44:09 +00:00
Alexander Polyankin
4252a066e1 Fix table columns remapped fields (#39798) 2024-03-08 09:54:35 +00:00
Romeo Van Snick
e4dcb68b67 Only return help text for supported features (#39766)
Avoid showing the help test dialog for unsupported features
2024-03-08 10:08:02 +01:00
Uladzimir Havenchyk
6b1289e89a Cleanup css modules usage (#39646)
* Cleanup css modules usage

* fixup! Cleanup css modules usage

* fixup! fixup! Cleanup css modules usage

* revert one class
2024-03-08 07:30:15 +00:00
Sloan Sparger
5cd181d00d Upgrade redux-auth-wrapper package (#39708)
* init pass at upgrade

* pin to version 2 of package, import history v3 related utils

* rename js file to ts

* add types to type-guards file
2024-03-08 00:54:49 -04:00
Nick Fitzpatrick
4c90cdd3f0 Chart Settings Table Formatting DnD kit (#39705)
* Chart Settings Table Formatting DnD kit

* await onChange, update unit tests

* named exports
2024-03-08 04:39:34 +00:00
Nick Fitzpatrick
bf416893bc Disclosure triangle and Fullpage modal transitions (#39780)
* css animation on disclosure triangle

* Full page modal using mantine transition

* removing comment
2024-03-08 04:09:40 +00:00
Nemanja Glumac
cefc94c988 Remove deprecated and unused searchTypeaheadEnabled method (#39797) 2024-03-07 23:37:00 +01:00
Nemanja Glumac
805ecd4727 Do not allow undefined when updating a user setting (#39728) 2024-03-07 23:36:22 +01:00
bryan
7bc9f1065c Adds property based test for u/map-all (#39738)
* Adds property based test for u/map-all

* respond to code review
2024-03-07 15:31:57 -07:00
Raphael Krut-Landau
819fe3da75 Fix janky db refreshing (#39796) 2024-03-07 16:42:31 -05:00
Anton Kulyk
180cf7870b Fix order of actions in question, dashboard and collection item menus (#39782) 2024-03-07 20:17:44 +00:00
Nemanja Glumac
a5f33dcd66 Fix the dismissed-custom-dashboard-toast setting (#39785)
This setting key is defined using kebab-case.
Not sure how it worked (if it worked) using the snake_case?
2024-03-07 21:08:46 +01:00
Nemanja Glumac
52b0c766ef Remove user-locale from settings (#39786) 2024-03-07 20:52:36 +01:00
Kyle Doherty
29917e92e8 tweak default modal spacing (#39788)
* tweak default modal spacing

* tweak spacing between header and body
2024-03-07 14:08:52 -05:00
adam-james
0ea86ea61d Dashboard width revision message should handle nil (#39710)
* Revision Diff Should handle `nil` Dashboard Width

Even though there shouldn't be `nil` values in dashboard.width, because the migration populates w/ the default value
of `full`, it is still true that because of the version before the migration, revisions  can have `nil` for the width
value. The diff string impl didn't consider this, causing an NPE with `(name nil)`.

* Use :guard to prevent nil values from matching

* Add test checking that dashboard width change is described correctly
2024-03-07 11:08:28 -08:00
Nemanja Glumac
8a4e14cd21 Properly highlight models as the data source (#39792)
* [HDS] Prep/cleanup steps for Highlighting the data source (#39681)

* Rename `DATA_BUCKET` key to `MODELS`

* Rename misleading method

`isSavedQuestionSelected` is too narrow because we can also have
other saved entities, such as models (and soon metrics) as the selected source.

* Fix type for `selectedTableId`

* Extract `sourceId`

* Rename saved question instances to saved entity

* Rename related components

* Show models correctly in the data source picker (#39686)

* Show models correctly in the data source picker

* Address review comments

* Destructure props

* Add E2E reproduction for #39699

* Prevent accessing potentially stale value

Closes #39699
2024-03-07 19:55:38 +01:00
Alexander Polyankin
08a189ca9f "Extract column" drill thru (#39162) 2024-03-07 20:07:38 +02:00
Nemanja Glumac
bbe3f1a354 Define PrivilegedSettings type (#39734)
* Define PrivilegedSettings type

This consists of Admin settings and Settings manager settings.

* Order settings alphabetically
2024-03-07 18:00:53 +01:00
Uladzimir Havenchyk
1bbeb2fd16 Make tabs e2e test stable again (#39762) 2024-03-07 18:44:05 +02:00
Nick Fitzpatrick
32a87d261f using CSS animations for notebook previews (#39717)
* using CSS animations for notebook previews

* useMemo

* optimizations on question creation
2024-03-07 12:08:55 -04:00
Romeo Van Snick
49f3369732 Column info fixes (#39746)
* Avoid overlapping icon on AccordionList

* Allow table fks to be undefined

* Only fetch fks when they havent been fetched before
2024-03-07 16:52:09 +01:00
Sloan Sparger
70a240de93 Remove react-motion - Bulk Actions (#39729)
* removes react motion usage from bulk action related components and replaces with mantine transition component

* removes unused eslint disable comment

* fixes e2e tests
2024-03-07 11:48:48 -04:00
Anton Kulyk
6213967713 Fix invisible chart legend dots when printing (#39752) 2024-03-07 15:10:22 +00:00
Noah Moss
2e5a99b3b0 [Feature branch] Permissions schema + API change (#37473)
Co-authored-by: bryan <bryan.maass@gmail.com>
Co-authored-by: Bryan Maass <bryan.maass@gmail.com>
Co-authored-by: Jerry Huang <jhuang37050@gmail.com>
Co-authored-by: Noah Moss <noahbmoss@gmail.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
Co-authored-by: John Swanson <john.swanson@metabase.com>
2024-03-07 09:47:23 -05:00
Anton Kulyk
fcc35d2293 Fix unresponsive dashboard header button (#39757) 2024-03-07 14:42:17 +00:00
Anton Kulyk
00eecc9364 Show "Bookmark" before "Archive" in entity menus (#39755) 2024-03-07 14:09:47 +00:00
Alexander Polyankin
d7f7c580be Cache fromLegacyQuery calls (#39682) 2024-03-07 14:21:00 +02:00
Oleg Gromov
cd1cad550c ParameterValuePicker: use in Native queries for single strings, numbers, and dates (#39454) 2024-03-07 11:43:06 +00:00
Alexander Polyankin
85a2213643 Do not create questions for dashcards with permission errors (#39688) 2024-03-07 12:49:04 +02:00
Alexander Polyankin
357e446cdd Cache can-run (#39695) 2024-03-07 12:48:04 +02:00
Romeo Van Snick
78cb28816a Surface more column info (#39296)
* Add info icon to the column picker dropdown in the notebook editor (#38725)

* Make SemanticTypeLabel not depend on Field but just on the semantic type
* Add MLv2 version of FieldInfo
* Add MLv2 props to FieldInfoPopover
* Convert TableInteractive to use MLv2 version of FieldInfoPopover
* Support Fingerprints in FieldInfo for MLv2 types
* Move DateTimeFingerprint to its own file
* Move NumberFingerprint to its own file
* Allow Category finderprint info to work with MLv2 types
* Remove null values in fingerprint info
* Move move ColumnDescription into separate component
* Split up fingerprint info component

* Add hover card metadata to summarize sidebar (#38817)

- Add column info hovercard to the summarize sidebar
- Implement redesign of the bucker picker to accommodate the icon

* Add hovercard on notebook filters (#38854)

Add ColumnInfoIcon to the notebook filter picker

* Add info popover to custom expression popover (#38870)

* Pass query to ExpressionEditorSuggestions

* Add info popover to custom expression suggestions

* Add test for custom expression hovercard

* Pass column directly instead of spreading it

* Add unit test for suggestion list item

* Add column info on filter modal (#38916)

Add column info icon on the filter modal fields

* Implement design feedback and fix tests (#39064)

* Be more explicit with the icon position

* Align the info icon more to the left

* Directly export HoverParent

* Ignore outside clicks on popover element

* Fix binning tests

* Select the correct popover

* Fix import order

* Fix broken export

* Force click out of item

* Fix missing bucket picker (#39244)

* Data reference info hovercards (#39144)

* Add info icons to fields in the data reference

* Add test for info icon on field list

* Render field items in a delay group

* Fix import order to avoid circular dep

* Force click item in test to avoid overlapping element

* Add info icon to parameter field mapping (#39099)

* Add info icon to dataselector

* Add unit test for info icon

* Fix import order to avoid circular dep

* Ignore overlay when clicking element

* Fix a circular dependency coming up in DataSelectorFieldPicker.unit.spec.tsx

* Explicitlty import React

* Fix text selector

* Force click items to avoid overlapping elements from breaking the test

* Avoid circular dependencies in entities/questions

---------

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

* Join column hovercard (#38967)

* Render Info icon on join column picker

* Allow customising label on AccordionList

* Add unit test for info icon on join column picker

* Add info icon to summarize picker too

* Fix margin on item name

* Fix tests that rely on binning label

* Set icon color without !important

* Fix position of popover

* Allow list item content to shrink where necessary

* Make list item title ellipsified

* Never shrink icon

* Ignore overlay when clicking element

* Fix import order to avoid circular dep

* Reduce overlapping hovercards

* Fix cut-off of text in summary column

* Table info hovercard (#39308)

* Use named export for TableInfoPopover

* Remove duplicate propTypes

* Export TableInfo's props

* Use Mantine HoverCard for table info popover

* Move info Popover to separate component

* Move InfoIcon to shared component file

* Add TableInfoIcon component

* Add info icon to table picker

* Pass through TableInfo props

* Add test for TableInfoIcon

* Use the info icon for the table header in chill mode

* Pick the hovercard inside of the popover

* Fix rendering children

* Fix question test for table header

* Avoid rendering huge icon in subtitle

* Avoid unneccessary ternary

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

* Do not use within with single query

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

* Avoid cutting of loading spinner

* Avoid closing popover when clicking it's content

* Add test for click inside hovercard

* Fix typo in commment

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

* Use direct import of ReactNode

* Be more specific with popover selector

* Scope selector to sidebar

* Use correct selector for hovercard

* Avoid scrollbars in info card

* Adjust the width of the target component

* Add more padding to description in table info card

* Increase close delay to allow for clicks to go through

* Simplify to findByText

---------

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

* Add DelayGroup to unpinned dimensions

* Remove unused variable

* Use getByText

* Fix time popover closing when more... is clicked

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-03-07 15:30:05 +07:00
Kamil Mielnik
215715053e Add a repro for metabase#39508 (#39692) 2024-03-07 13:50:01 +07:00
Raphael Krut-Landau
2132d4d864 Disable animation on NewItemMenu (#39712) 2024-03-06 21:29:58 -05:00
Jeff Bruemmer
9413706bd2 docs - update basic exploration (#39559) 2024-03-06 17:04:08 -05:00
Noah Moss
22917f3dd3 Remove Audit v1 Backend (#39639) 2024-03-06 21:23:33 +00:00
Chris Truter
f17f7f2953 Render CSV append errors as markdown (#39651) 2024-03-06 22:54:43 +02:00
Jesse Devaney
9fbe6e8d17 Fix text cutoff for error view and no results view on dash-cards (#39656)
* fix dashcard text gets cut off

* fix magic number
2024-03-06 20:32:02 +00:00
Jesse Devaney
60ca0cfd16 fix action button label cut off (#39661) 2024-03-06 14:58:14 -05:00
bryan
77a50c4762 update Admin Webapp team members (#39718) 2024-03-06 19:48:22 +00:00
Vamsi Peri
42f2e2c9b6 remove mark from dashviz team (#39716) 2024-03-06 19:16:53 +00:00
Nick Fitzpatrick
2f01330c10 38092 metadata table columns dnd (#39637)
* Metadata Table columns use Sortable List

* cleanup

* e2e test adjustments
2024-03-06 15:07:18 -04:00
Uladzimir Havenchyk
818dde03ad Add stylelint (#39680)
* Add stylelint

* Apply stylelint
2024-03-06 21:11:19 +03:00
Nemanja Glumac
e8dcda839c Add dashboard tabs E2E test to the flaky ones (#39704)
[ci skip]
2024-03-06 17:58:53 +01:00
Nick Fitzpatrick
4a78412079 ChartSettingOrderedItems using SortableList (#39561)
* ChartSettingOrderedItems using SortableList

* e2e test adjustments

* unit tests
2024-03-06 11:47:14 -04:00
Kamil Mielnik
d97e615414 [E2E] Overload the existing E2E visitQuestion helper to make it work with the alias (#39683)
* Convert commands/api/question to TS

* Add missing embedding_params and collection_position attributes to Card

* Type question function

* Move types to the top of file

* Inline throwIfNotPresent

* Add types for logAction

* Define StructuredQuestionDetails & NativeQuestionDetails

* Add typing to commands

* Return for consistency

* Remove queryType argument from question

* Define typing for archiveQuestion command

* Format code

* Define typing for createQuestion and createNativeQuestion commands

* Make options optional

* Remove TODO

* Use arrow functions, update JSDoc

* Use type for consistency

* Add missing attributes in mocks

* Make embedding_params non-optional

* Add boilerplate for 11994 repro

* Add temporary code

* Improve typing

* Implement test for combo chart

* Simplify code

* Convert updatePermissions to TS and add typing for updatePermissionsGraph

* Add typing for updatePermissionsSchemas

* Add typing for API responses, make updatePermissionsSchemas parameters optional

* Add JSDocs

* Explicitly specify types in commands

* Use CardId

* Fix the test
- add missing visuzalization_settings to the pivot question
- use "readonly" user and drop permissions manipulations

* Remove TODO

* Add an explanatory comment

* Inline visitDashboardByAlias

* Make visitQuestion accept an alias

* Use new visitQuestion interface where possible

* Remove somewhat duplicated comment
2024-03-06 14:22:56 +00:00
Uladzimir Havenchyk
9cb6c96a08 Fix webpack memory leaks in watch mode (#39658)
* Tweak webpack config

* Fix memory leak
2024-03-06 17:14:08 +03:00
Chris Truter
44d194b109 Fix field-vales query to specify :full type (#39652) 2024-03-06 06:54:12 -07:00
Chris Truter
0ae5714d08 Fail number parsing if it is only a substring (#39576) 2024-03-06 06:52:56 -07:00
Kamil Mielnik
82d2c62b60 Repro #11994 - Clicking RawData-toggle on pivoted table makes the question dirty and shows Save-button (#39629)
* Convert commands/api/question to TS

* Add missing embedding_params and collection_position attributes to Card

* Type question function

* Move types to the top of file

* Inline throwIfNotPresent

* Add types for logAction

* Define StructuredQuestionDetails & NativeQuestionDetails

* Add typing to commands

* Return for consistency

* Remove queryType argument from question

* Define typing for archiveQuestion command

* Format code

* Define typing for createQuestion and createNativeQuestion commands

* Make options optional

* Remove TODO

* Use arrow functions, update JSDoc

* Use type for consistency

* Add missing attributes in mocks

* Make embedding_params non-optional

* Add boilerplate for 11994 repro

* Add temporary code

* Improve typing

* Implement test for combo chart

* Simplify code

* Convert updatePermissions to TS and add typing for updatePermissionsGraph

* Add typing for updatePermissionsSchemas

* Add typing for API responses, make updatePermissionsSchemas parameters optional

* Add JSDocs

* Explicitly specify types in commands

* Use CardId

* Fix the test
- add missing visuzalization_settings to the pivot question
- use "readonly" user and drop permissions manipulations

* Remove TODO

* Add an explanatory comment
2024-03-06 20:15:54 +07:00
Cal Herries
5c1ab5e6de Fix dev/pprint-sql (#39678) 2024-03-06 14:44:36 +02:00
Anton Kulyk
7e92458cae Scroll dashboard tabs to the end when adding a tab (#39648)
* Scroll dashboard tabs to the end when adding a tab

* Fix useEffect deps

* Handle typescript error
2024-03-06 12:04:22 +00:00
Uladzimir Havenchyk
0483818e6a Remove unused shallowEqual file (#39659) 2024-03-06 09:47:45 +00:00
Kamil Mielnik
c3a2b3f7f6 Refactor cy.updatePermissionsGraph, cy.updatePermissionsSchemas & cy.updateCollectionGraph to TypeScript (#39675)
* Convert updatePermissions to TS and add typing for updatePermissionsGraph

* Add typing for updatePermissionsSchemas

* Add typing for API responses, make updatePermissionsSchemas parameters optional

* Add JSDocs

* Explicitly specify types in commands
2024-03-06 09:25:39 +00:00
Alexander Polyankin
d9507f2af8 Join performance issues (#39633) 2024-03-06 08:26:01 +00:00
Cal Herries
37c79a537c Fix mistake in API changelog: type can be "question" not "query" (#39673) 2024-03-06 07:45:18 +02:00
Cal Herries
7efd95f015 Add test for POST /api/card/:id/query for parameters with defaults (#39106) 2024-03-06 07:39:00 +02:00
Cal Herries
3900ce6ad8 Tighten updateable columns of sync classify step (#39630) 2024-03-06 07:36:43 +02:00
adam-james
fb66d06845 Use timestamp in attachment filenames (#39666)
* Use timestamp in attachment filenames

Fixes: #39120

This modifies the subscriptin attachment filenames to match the same format used when doing a direct download from a
dashboard or question.

That is:
 - card names are slugified (spaces and dashes turned to underscores, etc.)
 - a timestamp is appended to the slugified card name

* Fix tests

* Change docstring to use example local to the namespace
2024-03-06 04:42:42 +00:00
Jesse Devaney
5d27229cea Fix click behavior not working for pivot table header cells and tables pivoted (pivoted column cells) (#39569)
* update pivot table header cells clicked format to match the expected format

* fix clicked table pivoted click behavior for the chosen pivot column

* fix failing tests

* add tests
2024-03-05 21:59:53 +00:00
Ryan Laurie
7ea28578ec Remove AuditV1 Frontend (#39557) 2024-03-05 14:35:01 -07:00
Uladzimir Havenchyk
bb1d13ff4d Deduplicate some packages (#39632)
* Dedup some packages

* Fix typecheck

* formatting
2024-03-05 20:14:24 +00:00
Chris Truter
05082892eb Use malli to ensure all column types are covered (#39612) 2024-03-05 20:01:38 +00:00
Braden Shepherdson
fbd7b5c8eb [MLv2] remove-field throws given aggregation, breakout, or expression (#38741)
`metabase.lib.field/remove-field` is intended for manipulating the
`:fields` list. That list controls which fields from the source,
previous stage, explicit join, or implicit join should be included in
the results.

All aggregations, breakouts, and custom expressions are always included
in the return columns for that stage, so they cannot be removed with the
`:fields` clause. The UI does not attempt to do this, but this check is
a guardrail for future changes. Trying to hide an aggregation from the
`:fields` clause can silently create a broken query.
2024-03-05 14:54:46 -05:00
Noah Moss
c1c676c5ff Don't provision SSO users before the instance has been setup (#39640) 2024-03-05 13:50:36 -05:00
Anton Kulyk
56c0ebea37 Fix errors happening after canceling a new dashboard tab creation (#39473)
* Add repro test

Reproduces #38055
Reproduces #38278

* Add `cancelEditingDashboard` action

* Clean `selectedTabId` when canceling editing
2024-03-05 18:44:08 +00:00
Ryan Laurie
15c668b5ab Dont alert slack on failing backport branches (#39589) 2024-03-05 18:13:26 +00:00
Romeo Van Snick
20211d0922 Update text for visualisation loading state (#39625) 2024-03-05 17:29:45 +00:00
Alexander Solovyov
b26dec2ee9 include clj-memory-meter in :dev alias (#39636) 2024-03-05 19:49:18 +03:00
Nemanja Glumac
72022752da Define the PublicSettings type (#39468)
* Create new interface `PublicSettings`

* Fix wrong type for `start-of-week`

This setting has a default value "Sunday", and cannot be `undefined`
since it is public.

* Fix type error: Add `start-of-week` to the mocks

* Move `other-sso-enabled?` setting to the EnterpriseSettings type

* Arrange settings alphabetically

* Move `other-sso-enabled?` back to oss Settings to unblock PR
2024-03-05 16:40:03 +01:00
Kamil Mielnik
08e8bc4a67 Introduce describeWithSnowplowEE (#39623)
* Introduce describeWithSnowplowEE and use it in e2e/test/scenarios/onboarding/home/browse.cy.spec.js

* Use separate block for EE tests
2024-03-05 14:14:34 +00:00
Chris Truter
71262597f7 Use toposort to simplify and fix CSV column type operations (#39491)
* Use hierarchy instead of home-rolled DAG structure
* Implement an order preserving tag hierarchy
* Replace breadth first traversal with toposort
2024-03-05 07:01:10 -07:00
Kamil Mielnik
c3fca2010c Refactor cy.archiveQuestion, cy.createQuestion & cy.createNativeQuestion to TypeScript (#39614)
* Convert commands/api/question to TS

* Add missing embedding_params and collection_position attributes to Card

* Type question function

* Move types to the top of file

* Inline throwIfNotPresent

* Add types for logAction

* Define StructuredQuestionDetails & NativeQuestionDetails

* Add typing to commands

* Return for consistency

* Remove queryType argument from question

* Define typing for archiveQuestion command

* Format code

* Define typing for createQuestion and createNativeQuestion commands

* Make options optional

* Remove TODO

* Use arrow functions, update JSDoc

* Use type for consistency

* Add missing attributes in mocks

* Make embedding_params non-optional
2024-03-05 19:54:35 +07:00
Oleg Gromov
fc24cdf587 HK: Translate parameter values to TS (#39539) 2024-03-05 12:35:43 +00:00
Anton Kulyk
2d5e273e67 Update dashboard sections menu (#39533) 2024-03-05 09:58:32 +00:00
Alexander Polyankin
915f5fca8f Optimize join step (#39509)
* Fix data step

* Fix data step

* Fix data step

* Optimize join step

* Fixes

* Fix joinable columns
2024-03-05 11:24:57 +02:00
Cam Saul
90d2b800b3 No more Schema, only Malli (finish the migration) (#39235)
* No more Schema, only Malli

* Remove the rest of Schema

* Fix Kondo warnings

* Port some decoding code

* More porting

* Almost all done?

* Parsing fixes 🔧

* More fixes

* Fix Kondo errors

* Test & lint fixes 🔧

* Test fix 🔧

* PR feedback
2024-03-05 03:51:51 +00:00
Uladzimir Havenchyk
792552d0a1 Fix cursor in notebook editor (#39566) 2024-03-04 16:54:55 -08:00
Jeff Bruemmer
04452226a1 48.8 (#39573) 2024-03-04 21:46:19 +00:00
Jesse Devaney
e57f16c87c fix query string parsing (#39537) 2024-03-04 16:10:35 -05:00
Nemanja Glumac
1a3698b81b Move user-local settings to user model (#39469) 2024-03-04 20:28:33 +00:00
Denis Berezin
7d6ba4768e Fixes after css modules migration (#39531) 2024-03-04 20:18:01 +00:00
Ryan Laurie
112cb7f320 Enterprise api calls cleanup (#39480) 2024-03-04 13:01:28 -07:00
Nemanja Glumac
4a4d95241a Add the ability to copy required checks from master to any existing branch (#38873)
* Add the ability to copy required checks from `master` to any existing branch

* tweaks to release check copy script

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-03-04 20:29:55 +01:00
Braden Shepherdson
300dbf3a23 [MLv2] joinable-columns on a Join sets source and alias (#39529)
`(joinable-columns query stage a-join)` previously returned
`:lib/source :source/table-defaults` and set
`:metabase.lib.join/join-alias` but not `:source-alias`.

This corrects both issues so that `joinable-columns` on a join returns
columns with the same shape as from `visible-columns`.

Also refactors a series of `mapv` transforms into a transducer pipeline.

Fixes #39514.
2024-03-04 17:43:04 +00:00
Mark Bastian
b88b1ade62 Additional X-Ray Documentation (#39466)
This just expands the documentation in the primary x-ray namespace (`metabase.automagic-dashboards.core`). At this point, someone new to the namespace should be able to get into the x-ray code without difficulty.
2024-03-04 09:22:25 -08:00
Cal Herries
1cfa623a9b Remove TODOs (#39425) 2024-03-04 19:01:35 +02:00
Nemanja Glumac
7b66a6509b Do not return setting value if the database persisted in last-used-native-database-id does not exist (anymore) (#39269)
* Do not return value if the database does not exist

* Update tests

* Use negative number for non-existing database id

* Use `discard-setting-changes` macro to reset setting value
2024-03-04 17:41:10 +01:00
Braden Shepherdson
f965d08815 [QP] Use the alias for unfolded JSON columns from previous stages (#39446)
In the legacy QP the `:fields` of the outer query has the ID,
`[:field 100 {}]` so the JSON unfolding is written out again.

With this change, the `source-alias` is used for columns coming from
previous stages.

Fixes #34930. Fixes #35636.
2024-03-04 16:29:29 +00:00
Ryan Laurie
8ce30f63c3 Add build start slack message (#39467) 2024-03-04 09:21:40 -07:00
Ryan Laurie
e3b1353b3f Don't send release reminders on weekends (#39522) 2024-03-04 11:21:03 -05:00
Alexander Polyankin
9be96da946 Prevent custom expressions from being removed from the query (#39518) 2024-03-04 15:58:22 +00:00
lbrdnk
48caf35d38 Fix mongo password handling (#38959)
* Fix mongo password handling

* Update test, add credential check

* Address the review remarks
2024-03-04 16:08:13 +01:00
Braden Shepherdson
050625550d [QP] Fix confusion of expressions with the same name as columns (#39255)
When determining column aliases in `add-alias-info`, reuse an existing
desired column alias if one is present.

Fixes #39059. Might fix #25931.
2024-03-04 17:38:14 +03:00
Cal Herries
fb466de74c Mitigate BE flakes caused by redshift-lbv-sync-error-test and redshift-types-test (#39045) 2024-03-04 16:33:49 +02:00
Alexander Solovyov
ad90ce1067 [serdes-v1] can now dump/load entity_id (#39010) 2024-03-04 17:26:59 +03:00
Alexander Polyankin
f9bbbabc99 Remove broken field ref comparison with QP columns (#39517) 2024-03-04 16:18:19 +02:00
Kamil Mielnik
944be00cf9 Repro #23851 - Drill-through on a timestamp column binned as XofY fails unless sematic type is defined (#39510)
* Add repro for #23851

* Use arrow function

* Improve assertions

* Improve assertion
2024-03-04 21:08:59 +07:00
Kamil Mielnik
4d943dac34 Repro #29094 - Notebook filter field allows non boolean custom expressions (#39502)
* Add repro for #29094

* Use arrow function
2024-03-04 14:00:48 +00:00
Kamil Mielnik
ec5a4da89c Use arrow functions in e2e & unit tests definitions (#39512)
* Use arrow functions in e2e tests

* Use arrow functions in unit tests
2024-03-04 13:29:52 +00:00
Kamil Mielnik
a926009707 Repro #30312 - Cannot filter directly from table column header when Question is Summarized (#39500)
* Add repro for #30312

* Use arrow function

* Improve assertions
2024-03-04 13:25:34 +00:00
Alexander Polyankin
ca9303daf3 Optimize data step in the notebook editor (#39505) 2024-03-04 15:06:51 +02:00
Anton Kulyk
6d34b9e9c7 Replace dashboard.isEditing state with dashboard.editingDashboard (#39472)
* Use `null` instead of `false` for `setEditingDashboard`

* Replace `isEditing` with `editingDashboard`

* Extract `EditableActionButtonAttrs`
2024-03-04 11:37:53 +00:00
Anton Kulyk
950a275387 Convert dashboard/actions/core to TypeScript (#39464) 2024-03-04 10:18:19 +00:00
Kamil Mielnik
bfceeebf16 Repro #34688 and #34690 - Time series footer (#39442)
* Add repro for #34690

* Add a repro for #34688

* Rename file

* Format code

* Update test name
2024-03-04 13:23:52 +07:00
Oisin Coveney
ead86bf610 [FIX: #39152] Public links refer to null when question is new (#39154) 2024-03-02 09:33:30 +01:00
Nick Fitzpatrick
ee5e9e10ee ✨ 📁 New Collection Picker 📁 ✨ (#38315)
* Entity Picker Squash

rough table selection. dont fire me plz

make stuff prettier

make mysql work in table picker

make a tabbed entity picker

reorganize stuff

WIP collectionPicker

collection picker works

NextedItemPicker Styling

more collectionpicker work

make collectionpicker work

Single Picker UI

adding scroll left

Tabbed UI

add search

fix key?

Splitting up components

yolo animation

isolate search input

reorg and fix some types

nested item picker unit test

types are much better

scroll left when needed on mount

handle snippets and some other stuff

Modal unit tests

Modal transition, default options adjustments, fixing endless searching

allow all personal collections

fix some types

createNewCollection

disable collection creation for read-only collections

using entity loaders

goodbye refs

started working on types. Still some stuff to do

I give up. Ryan help plz

wip

wip

more wip

fix stuff

cool stuff

cool stuff

cool stuff

more stuff

fix backwards traversal

use effective_location

testing helpers

# Conflicts:
#	frontend/src/metabase/common/components/EntityPicker/components/NestedItemPicker/NestedItemPicker.tsx

dont use entity picker for move modal yet

add a logical ui location

takes a location like `/1/2/3/4/` and returns a "logical" ui location
that includes only collections that the user can see.

For instance, in the above location, if the user lacked permissions to
collection 3, they could still see collection 4 but would see it as a
child of 2, so it's effective ui location would be `/1/2/4/`

remove location from other model types

ie cards, snippets, etc would have a nil location. just remove

test for ui logical location

switch to existing `effective_location`

had reinvented the wheel. There's already an effective_location which
does exactly what we want.

Add can-write? for UI concerns

want it for collection picker UI info (remove or show greyed out). Tests
are failing but want for them to start

{:test 35, :pass 270, :fail 14, :error 0, :type :summary}

better personal collection pathing

no root permissions

Basic version of Models in Browse Data (#37707)

* Add Models and Databases tabs
* Models are organized by collection
* Exclude items in personal collections
* Simplify BrowseHeader

dashboard spec passing

Initial collection selected

infinite scroll right, fixing rebase issue

native and models e2e

getting better. remember to look at moderator icon styling

adding search result filter, collection lookup for new collection modal

use correct icons for special things

top folder for snippets

Endless API requests 😅

virtualize lists

e2e tests are.... green??

now green e2e plz

UI adjustments, empty collection state

Lots of moving around. Types should be fairly happy, and started writing unit tests

happy-ish unit tests?

fix backend tests

remove test/table pickers

nicer loader

use personal endpoint

remove questionPicker

use generic types where possible

resolving import order stuff

some type stuff sorted

✅✅ type checks ✅✅

more prettier

fix lint error

Nick is embarassed

types back to green

fix rebase conflicts

* new collection modal polish, bad nav link stuff

* removing TFolder

* gathering collection picker components

* auto selecting newly created collections

* handle confirm on Enter

* formCollectionPicker cleanup

* border on selected search result

* NavLink variants

* virtualize search results

* fixing icon color on variants

* empty collection and search results state

* default options spread, removing commented tests, actionButtons

* moving New Collection Dialog, localizing header

* make entityPickerModal generic

* cleanup

* update unit tests

* update e2e tests

* fix type exports

* fix 1 more unit test

* last test fixes plz

* better loading behaviors

* improved x-scrolling

* remove imperative handle on scroll, scroll to selected item on mount

* fix virtualizer type

* scroll after measuring

* clean up your hooks man

* smooth out loading behavior

* happy little typescript types

* update collection id type

* cancel pending search requests

* handle whitespace search

* cleanup

* more cleanup

* lets null coalesce instead

* fix type

* small type fix

* Make a more versatile and easy-to-use list virtualizer

* better mock

* fix rebase conflicts

* even more cleanup

* ok raffi was right about the scrolling

* test fixes

* submit button niceties

* wider new collection button

* make jsdom happy

* lighter navlink variant

---------

Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-03-01 20:48:13 +00:00
metamben
b3f47b3411 Generate unique user name in table-privileges-test (#39457)
* Generate unique user name in table-privileges-test
2024-03-01 23:00:30 +03:00
Jesse Devaney
99e4ce4460 Fix click behavior when routing to a different tab on the same dashboard (#39319)
* fix click behavior for routing to a new tab on the same dashboard

* update changes

* add test to validate behavior
2024-03-01 19:31:11 +00:00
Nemanja Glumac
321c6c295a Differentiate UserSettings type from the rest of the Settings (#39456) 2024-03-01 20:06:50 +01:00
Case Nelson
398ff345c8 Fix snowflake ssh tunnel (#39283)
* Fix snowflake ssh tunnel

* Put test where it will run in CI

* Override incorporate-ssh-tunnel

* Revert snowflake in util.ssh-test

* Move tunnel connection tests to sql_jdbc

* Add mock-server fixture

* Exclude drivers from tunnel test

* Fix up reconnection tests

* Exclude more drivers

* Address PR feedback
2024-03-01 10:27:47 -07:00
Anton Kulyk
3fe8aaadca Fix dashboard tabs drop animation (#39444)
* Fix dashboard tabs drop animation

* Remove animation delay from an e2e test
2024-03-01 17:20:01 +00:00
Nicolò Pretto
636d718559 License activation step - ms1 (#39257)
* adds /api/setup/token-check and add license-token to POST /api/setup (#38858)

* adds /api/setup/token-check and add license-token to POST /api/setup

* refactor tests

* license-token => license_token for consistency

* fixed test message

* fix nesting in test

* Add the step in the FE and pass the token to the setup api call (#38953)

* refactor: go back to saving the index for the step, to avoid having to use a selector that needs global state in the reducer

* Revert "refactor: go back to saving the index for the step, to avoid having to use a selector that needs global state in the reducer"

This reverts commit ee7e44f48788528e059c3f1f8816a73b675e082b.

* feat: adds UI and token api logic

* test structure for paid features

* initSetup action as workaround

* pass token to the /setup endpoint

* add jest tests for ee without token case

* add warning comment  on getIsPaidPlan

* copy old schema for better diff

* add license_token step seen event in the schema

* update e2e tests to make them pass

* should make e2e pass

* explicitly check that the license activation step is not rendered

* useStep hook

* refactor: simplify logic in step_number

* refactor: getInactiveStepTitle

* fix too many slashes in import

* refactor: rename selectThisStep to handleStepSelect

* use isSetupCompleted from useStep

* adds expect().toBeInTheDocument

* remove waitFor in favor of await findBy

* add submit snowplow event and increase the onboarding version in the events (#39151)

* trackLicenseTokenStepSubmitted

* adds a test and makes sure we're passing the token as undefined, not as null

* clean up

* remove waitFor

* goToNextStep in all thunks (#39103)

* Revert "initSetup action as workaround"

This reverts commit 0318a55b22.

* goToNextStep thunk

* Change the Next button to skip for the license activation step (#39292)

* change the Next button to be Skip

* trim token input

* fix e2e test

* fix quotes

* hide error when the user changes the token (#39440)

* keep token visible when going back (#39443)
2024-03-01 17:11:16 +00:00
Anton Kulyk
09dbd78a8c Fix visual glitch when dragging a dashboard tab (#39445) 2024-03-01 17:00:50 +00:00
Jeff Bruemmer
42661387f5 docs - updates to installation (#39228) 2024-03-01 16:51:41 +00:00
Uladzimir Havenchyk
a5b9817e11 Utilize diagnoseExpression to detect expression errors (#39263)
* Utilize diagnoseExpression to detect expression errors

* Add expressionPosition

* Replace boolean with filter for startRule

* Revert "Replace boolean with filter for startRule"

This reverts commit 9d4cca4734.

* Remove console

* Fix comments
2024-03-01 16:26:44 +00:00
Alexander Polyankin
64c184f849 Forcefully reload table/card metadata when there are no fields (yet) (#39311) 2024-03-01 18:03:57 +02:00
Denis Berezin
2bc2507c66 Remove unused global css (#39220)
* Remove unused global css

* More clean-up

* Review fixes
2024-03-01 21:49:05 +07:00
Chris Truter
15fc335183 Update various TODO comments (#39422)
* Vague uncertainty from 5 years ago - gone

* Remove obsolete TODO

* Link to issue for incomplete date formatting
2024-03-01 16:48:39 +02:00
Chris Truter
3d76f3d3db Move jetty timeout default to metabase.config (#39418) 2024-03-01 09:46:37 -05:00
Ryan Laurie
3c7f69f0aa Notify slack on cross-version test failure (#39430)
* notify slack on cross-version test failure

* update name
2024-03-01 07:35:57 -07:00
Nemanja Glumac
c715206fe6 Use updateUserSetting for user-local settings (#39359)
* Treat `dismissed-browse-models-banner` as a user-setting

* Treat `dismissed-custom-dashboard-toast` as a user-setting
2024-03-01 14:33:53 +01:00
Uladzimir Havenchyk
bfd6895ff8 Optimize some parts of Notebook editor (#39441)
* canRun is expensive, reduce number of calls

* Drop unused variables

* do not calculate TimeSeriesChrome in notebook mode

* Do not re-render ColumnNotebookCellItem unnecessary

* Do not re-render notebook steps unnecessary

* Revert "Do not re-render ColumnNotebookCellItem unnecessary"

This reverts commit 09cca64684.

* Do not render main in notebook mode
2024-03-01 15:05:16 +03:00
Kamil Mielnik
afc28b9581 Revert "Fix missing result metadata (#39201)" (#39294)
* Revert "Fix missing result metadata (#39201)"

This reverts commit d26b782063.

* Move resultsMetadata mapping to getSubmittableQuestion

* Bring back the test
2024-03-01 07:30:44 +00:00
bryan
b09db3b450 Tech Debt: teamzero (#39417)
* [AS+BCM] fix first 3 todos

* [AS+BCM] add issues

* add jdbc proxy issue

* driver/driver-features -> driver/features

* killing more todos and remove `supports?`

* add more issues

* dont let people who dont have snippet perms access snippets

* adding more issues

* replace calls to support? in mongo driver

* fix namespace sorting

* whitespace
2024-03-01 00:43:36 +01:00
Mark Bastian
e6c518a931 Fixing E2E Cross-version Tests (#39285)
* Fixing E2E Cross-version Tests

E2E cross version tests were broken for multiple reasons, primarily due to changes made in UI layout, cypress testing, and data changes. Overall, the basic workflows still work, but subtle click order differences and other small changes made the entire job consistently fail.

To fix this, this PR:
- Provides a function, `parseVersionString`, which computes version information provided a test version string. This information includes the raw string version, the edition (ee or oss), and the major, minor, and patch version of the version string.
- In the same file, `cross-version-helpers.js`, adds constants identifying versions in which certain breaking UI or Cypress changes occurred.
- Finally, a set of exported functions are provided which take a version object and execute conditional logic based on the provided version so that behavior is consistent across Metabase versions.

The versions are computed in `cross-version-source-helpers.js` and `cross-version-target-helpers.js` and are used in js files as shown:

```js
import { visualize } from "e2e/support/helpers";
import {
  fillAreaUnderLineChart,
  newQuestion,
  saveQuestion,
} from "e2e/test/scenarios/cross-version/helpers/cross-version-helpers.js";
```

This then allows logic like the below, where the high level call is made and the right logic is dispatched based on the version information.

```js
it("should create questions", () => {
  cy.signInAsAdmin();

  cy.visit("/question/new");

  newQuestion(version);

  // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
  cy.findByText("Orders").click();
})
```

Other smaller changes were also made that created a more universal sequence of UI actions.

Fixes #39229

* clear -> click

* Fixing area icon selection

* Restoring scheduling to align with master

* fe lint
2024-02-29 16:39:29 -07:00
Alexander Solovyov
b0c471ef19 ring-json already supports converting stuff to keywords (#39416) 2024-03-01 00:08:38 +01:00
Chris Truter
83bf255493 Move refresh test helper into test namespace (#39421) 2024-02-29 22:04:56 +00:00
Nick Fitzpatrick
784d86517b Dashboard Header FC, using entity, select, and dispatch hooks (#39267)
* Dashboard Header FC, using entity, select, and dispatch hooks

* resolving types

* updating other use of getDashboardActions

* PR feedback
2024-02-29 17:33:05 -04:00
Nick Fitzpatrick
1f83821e2a Migrating ParametersList to dnd-kit (#38059) 2024-02-29 15:59:00 -04:00
metamben
dcd3558a1f Hack test case to unblock Oracle tests (#39317)
* Hack test case to unblock Oracle tests

In metabase.query-processor-test.implicit-joins-test/implicit-joins-with-expressions-test
we calculate an interval by going back from today a number of years to arrive at 2019. On
February 29, this calculation fails with Oracle because there was no February 29 in 2019.
This hack changes 2019 to 2020 and makes Oracle happy.
breakout-on-temporally-bucketed-implicitly-joined-column-inside-source-query-test
had to be adjusted too.
2024-02-29 22:49:12 +03:00
Alexander Solovyov
3a016bedf4 switch back to ring-jetty-adapter - addresses security issue (#39321) 2024-02-29 20:31:16 +01:00
bryan
b2d7dc6cc9 Saml2 slo (#39034)
* wip

* SLO works with auth slo handler route

* move slo handling endpoint to /auth/sso/handle_slo

* fix slo redirect url

* SLO works, and the sso-handle-slo for saml is where it belongs

- a ton of cleanup

* fix api/session namespace + add docstrings

* cleaning up logout action

* add slo logout test along with slo response xml

* whitespace + linter

* add docstring

* update exclusions in deps.edn

* un-require metabase-enterprise ns from oss ns

* add docs for how to setup SLO to metabase docs

* docs: clarify that setting up SLO is optional

* move slo logout endpoint into ee code

- removes sso-info defenterprise since it is no longer needed

* use current version of saml20-clj

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-02-29 09:52:52 -08:00
dpsutton
80f90f4f5b Don't delete "off" persisted_info records (#39272)
* Don't delete "off" persisted_info records

If they are off, they are "eligible" models for persistence that we do
not want to persist. And to remember that use choice to not persist them
we need to keep the record around. This was handled previously, but
https://github.com/metabase/metabase/pull/39219 was a bit too blunt. We
had a bunch of records in a "creating" state that we weren't removing,
so i deleted them regardless of state. But we want to make sure that the
"off" ones are not deleted.

On stats, a bunch of ones that were set to off are now slated to be
persisted after the prune job deleted the persisted_info records.

* unused local. whoops
2024-02-29 11:44:20 -06:00
Jesse Devaney
9594057efe Trend Charts: Improve Error Messages (#39212)
* improve error messages

* update error message
2024-02-29 12:18:18 -05:00
Nicolò Pretto
d819cdc496 update e2e_specs to include ts files (#39314) 2024-02-29 17:09:47 +00:00
Jeff Bruemmer
d6b681d301 docs - 49 updates (#39135)
* filter notes

* usage insights notes
2024-02-29 11:40:10 -05:00
Nemanja Glumac
fb6921f857 Do not fetch app settings when updating user-local setting (#39251)
* Create and use new action `updateUserSetting`

* Add E2E reproduction for #39221

Fixes #39221.
2024-02-29 17:18:05 +01:00
Ryan Laurie
100e38743d Easy List Virtualization (#39074)
* Make a more versatile and easy-to-use list virtualizer

* use new virtualized list in archive app

* update archive tests

* better mock
2024-02-29 16:13:28 +00:00
Ryan Laurie
de98812566 Fix api key empty state (#39302) 2024-02-29 16:12:59 +00:00
Uladzimir Havenchyk
2f16ac011b Make tabs e2e test more reliable and do not fail on 29th of February (#39301) 2024-02-29 18:35:56 +03:00
Alexander Solovyov
e27747a792 update deps with security issues (#39286) 2024-02-29 10:32:27 -05:00
Ryan Laurie
1d6f496535 Translate object action select strings (#38889)
* translate object action select strings

* import order fix
2024-02-29 15:31:10 +00:00
Uladzimir Havenchyk
55a8331daf Lazy calculate column groups (#39224) 2024-02-29 17:46:08 +03:00
Kyle Doherty
915015de1c add content from Notion documentation to storybook guidlines for Modal (#39160)
* add content from Notion documentation to storybook guidlines for Modal

* clean up examples a bit
2024-02-29 08:58:26 -05:00
Anton Kulyk
0fbbc4f2c2 Reset new dashboard subscription form state (#39258) 2024-02-29 13:51:15 +00:00
Uladzimir Havenchyk
88db9fc199 De-compose css from tailwind style (#39239)
* Drop duplicated composes

* De-compose flex

* De-compose flex-full

* De-compose justify-center

* De-compose align-center

* De-compose flex-1-quarter

* De-compose text-centered

* De-compose full

* De-compose relative

* De-compose flex-no-shrink

* De-compose block

* De-compose inline-block

* De-compose flex-row

* De-compose ml-auto

* De-compose mr-auto

* De-compose full-height

* De-compose absolute

* De-compose top

* De-compose align-self-start

* De-compose no-decoration

* De-compose flex-half

* De-compose cursor-pointer

* De-compose flex-aligh-right
2024-02-29 15:05:58 +03:00
Jeff Bruemmer
8422304474 docs - clean up docs on referencing question and models in SQL questions (#39265) 2024-02-28 16:53:17 -05:00
Sloan Sparger
03e7fa4f9d Admin logs layout fix & perf improvements (#39031) 2024-02-28 14:56:13 -06:00
Oleg Gromov
06ada2d4b2 Disable done button in Dashboard parameter editing for required param (#39206) 2024-02-28 16:59:37 +00:00
Denis Berezin
7ff4b5ad1d Switch CSS code to be locally scoped by default (#39020)
* Add local-global styles

* Add local-global styles

* Fix missed rules

* Fix vendors styles

* Revert emotion refactors

* Fix vendor styles

* Fix eslint

* Fix e2e tests

* Fix review comments

* Fix

* Code review fixes

* Hotfix after merge
2024-02-28 22:29:42 +07:00
Alexander Polyankin
1c5508bbfe Migrate from legacy popover in notebook components (#39200) 2024-02-28 15:07:52 +00:00
Uladzimir Havenchyk
70535db22a Fix wrong sample db import (#39241) 2024-02-28 17:29:59 +03:00
Nemanja Glumac
5042124517 Show only native databases users can use (#39167)
Fixes #39053.
2024-02-28 14:17:02 +00:00
Kamil Mielnik
253e8bb4ad Too eager unsaved changes warning when editing native questions (#39157)
* Show unsaved changes warning for native questions only when the query has been changed

* Drop legacyQuery usage

* Add test for new behavior

* Update pathnames for running questions
- required to make native_subquery.cy.spec.js pass - this test suite uses native queries referencing other questions by id instead of a full slug, and upon opening such question the id in the query automatically changes to the full slug, and the URL gets a hash
2024-02-28 14:00:05 +00:00
Tony-metabase
9733aab12f Update saml-okta.md (#38597)
Removing a trailing `/`
2024-02-28 14:52:56 +01:00
Nemanja Glumac
576e1511ab Persist user-local info about the last selected database in the native query editor (#38986)
* Add new user-specific setting `last-used-database-id`

* Update user settings when user selects a database for a native query

* Remember the last used database in the native query editor

* Fix type error

* Set database id when initializing new native question

* Persist the database only for "New > Native query"

* Persist last used database for native models

* Mark `last-used-database-id` setting as potentially `undefined`

* Reduce diff

* Remove unused prop from QB

* Lift dispatch logic up to the `View` component

* Fix type errors

* Make this setting work for all authenticated users

* Add initial E2E tests

* Add initial backend unit test

* Expand the backend unit test to check for user-local only property

* Fix E2E test and make it more explicit

* Add mongo-related E2E test

* Fix typo

* Add permission-related E2E tests

- Adds reproduction for #39053

* Make sure no redundant requests are made

This commit ensures no redundant requests are made when selecting
the same, i.e. the previously selected, database.

* Add E2E tests related to model actions

* Clean up

* Extract persist database logic into an action

* Update the setting name as suggested in the code review

* Make the setting description a bit more explicit

* Add one more permissions-based E2E test

* Store postgres database name in a variable
2024-02-28 14:39:51 +01:00
Kamil Mielnik
d26b782063 Fix missing result metadata (#39201)
* Keep result-metadata of native queries if possible

Part of #37009.

* Fix typo

* Add a fallback for when resultMetadata is not available

* Revert "Add a fallback for when resultMetadata is not available"

This reverts commit 5ad3a8b408.

* Move resultsMetadata logic into getSubmittableQuestion

* Add a fallback for when resultMetadata is not available

* Add explanatory comment

* Guard against missing resultsMetadata

* Add repro for #35039

* Simplify the test

* Add an explanatory comment

* Fix test

* Rename promise to runQuestionPromise

---------

Co-authored-by: Tamás Benkő <tamas@metabase.com>
2024-02-28 11:47:02 +00:00
Mahatthana (Kelvin) Nomsawadi
0b51201d14 Fix wrong icon colors (#39238)
* Remove unused props to avoid confusion

* Fix incorrect official collection icon in collection view

* Fix hardcoded SVG icon color

* Remove unused prop
2024-02-28 11:02:01 +00:00
dpsutton
f2d279cd88 Delete all pruned persisted info records (#39219)
We prune persisted info records if they meet any of the following
criteria:

```clojure
(or (contains? (persisted-info/prunable-states) current-state)
    (:archived card-info)
    (not (:dataset card-info)))
```

But we only deleted the record when:

```clojure
(when (= "deletable" current-state)
  (t2/delete! PersistedInfo :id (:id persisted-info)))
```

So any records that were in a "creating" state (persist a model, but
before it first gets persisted, make it not a model, or archive the
underlying model), we constantly pruned them but never removed the
persisted info record.

Leading to task results like:

```javascript
{"success": 21, "error": 0, "skipped": 0}
```

Because 21 things were queued up for pruning, were attempted to be
pruned, but the persisted info record never removed.
2024-02-27 20:07:58 -06:00
Cam Saul
ddfd9f6360 Drop report_card.dataset (#38981)
* Drop report_card.dataset [WIP] [ci skip]

* Drop report_card.dataset

* Some test fixes

* More test fixes

* All OSS tests should be fixed now?

* Remove check for :dataset key from snake-hating-map

* Remove NOCOMMIT stuff

* Remove unused namespaces

* PR feedback

* Migrate dataset attribute in autocomplete suggestions (#39054)

* FE - Migrate `dataset: true` to enum value in Bookmarks (#39056)

* Fix Card["type"] - Bookmark["card_type"] mapping and add an extra assertion

* Fix card-type check out of raw query

* Fix the test

* Fix tests after merge

* Log body when unexpected response code

* Get logging in CI

* Relax is_upload schema for latest mariadb

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
Co-authored-by: Case Nelson <case@metabase.com>
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-02-27 17:28:28 -07:00
Mark Bastian
1ea9968997 Text cards not skipped in pulses (#39216)
This PR updates the logic of skipping what cards are displayed in a pulse email by ensuring the type of the card being processed is a `:card` in addition to having no results.
2024-02-27 18:56:31 +00:00
Uladzimir Havenchyk
7f0d6718cd QB: reduce number of MLv2 calls (#39208) 2024-02-27 21:21:20 +03:00
Nemanja Glumac
a5bb1b42f5 Optimize the CI milestone reminder (#39196)
This PR narrows down the matching pattern for the milestone reminder to
only the descriptions that explicitly contain one of the closing keywords
followed by the issue (number).

To verify that the proposed solution works, please check:
- https://regexr.com/7sk94

Also see the list of the closing keywords as defined by GitHub.
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests

* Make the pattern case insensitive

Co-authored-by: Nicolò Pretto <info@npretto.com>
2024-02-27 19:02:43 +01:00
Mark Bastian
d2c6d11ca2 Fixing bad pulses when bad params exist (#39136)
* Fixing bad pulses when bad params exist

Previously, when a dashboard parameter was removed that was depended upon by a subscription, the subscription went into a broken state that was unfixable (the removed param was still attached to the notification but not visible in the UI for editing). Rather than remove that parameter, which could potentially lead to data leaks, we just archive the pulse.

Now, when a dashboard is saved that would break a pulse/subscription, we archive the pulse and send an email the the dashboard and pulse creators to notify them that the pulse has been removed. The email also contains which params were removed as well as a list of who will no longer be receiving the messages.

One code consideration when writing the query logic to determine the blast radius of the bad pulse was whether to write a large join query then reorganize the results or do N+1 queries starting from the pulse id (The logic requires hitting all of pulse, pulse channel, pulse channel recipients, and user tables). I started with a full join query along the lines of what is shown below, but opted for the N+1 query as broken pulses should be a very rare occurrence so readability was preferred over performance.

```clojure
  (let [parameter-ids ["a3d043d5"]]
    (when (seq parameter-ids)
      (t2/query
        (sql/format
          {:with   [[:params {:select [[:id]
                                       [[:raw "json_array_elements(parameters::json) ->> 'id'"]
                                        :parameter_id]]
                              :from   :pulse}]
                    [:pulse_ids {:select-distinct [[:id :pulse_id]]
                                 :where           [:in :parameter_id parameter-ids]
                                 :from            :params}]]
           :select [[:p.id :pulse_id]
                    [:pc.id :pulse_channel_id]
                    [:pcr.id :pulse_channel_recipient_id]
                    [:creator.first_name :creator_first_name]
                    [:creator.last_name :creator_last_name]
                    [:creator.email :creator_email]
                    [:recipient.first_name :recipient_first_name]
                    [:recipient.last_name :recipient_last_name]
                    [:recipient.email :recipient_email]]
           :from   [[:pulse :p]]
           :join   [:pulse_ids [:= :p.id :pulse_ids.pulse_id]
                    [:pulse_channel :pc] [:= :pc.pulse_id :p.id]
                    [:pulse_channel_recipient :pcr] [:= :pcr.pulse_channel_id :pc.id]
                    ;; Get the pulse creator
                    [:core_user :creator] [:= :creator.id :p.creator_id]
                    ;; Get the pulse recipient
                    [:core_user :recipient] [:= :recipient.id :pcr.user_id]]}))))
```

* Fixing inconsistent test results by adding a timeout and expecting 2 messages.

* Fixing NPEs in tests, but not sure why we are not getting results sometimes.

* Trying to fix 500 in dashboard PUT

* Tests run ok locally against mongodb

* Fixing unit tests

* fixing template up

* fixing unit tests

* Adding refined tests to try to detect what is going on with failing tests

* Formatting

* Tracking down test failures and updating email template

* Removing db-specific query

* Simplifying broken pulse logic to not get all pulses twice.

* A couple small simplifications to the logic.

* Adding slack messaging

* Making pulse checks conditional on parameter updates
2024-02-27 17:28:20 +00:00
Ryan Laurie
dd6916ef68 useSetting hook (#39183)
* add useSetting hook

* example usage

* better types

* more implementations
2024-02-27 09:18:56 -07:00
metamben
edf55f52f4 Keep result-metadata of native queries if possible (#39184)
Part of #37009.
2024-02-27 18:30:34 +03:00
Jeff Bruemmer
820cc56fdf docs - mention support for multiple domains (#39165) 2024-02-27 08:57:56 -05:00
Uladzimir Havenchyk
ba9b3c1fa5 QB: evaluate notebook preview lazy (#39194)
* QB: evaluate notebook preview lazily

* fixup! QB: evaluate notebook preview lazily

* fixup! fixup! QB: evaluate notebook preview lazily

* fixup! fixup! fixup! QB: evaluate notebook preview lazily
2024-02-27 13:52:17 +00:00
Nemanja Glumac
396362b9ce Clean QueryBuilder props [PoC] (#39070)
* Move `initialCollectionId` prop to `QueryModals`

* Remove unused prop and selector
2024-02-27 13:27:17 +01:00
Oleg Gromov
f7388f8370 Add dashboard_filter_required (#39159) 2024-02-27 10:17:30 +00:00
Oleg Gromov
dc7f604b47 Replace old radio buttons (#39128) 2024-02-27 10:14:39 +00:00
Nemanja Glumac
f6efff3984 [E2E] Document how to use table and field references from the Sample Database (#39193) 2024-02-27 10:24:58 +01:00
Uladzimir Havenchyk
f0f8630f5b Use People table from sample DB in e2e (#39191) 2024-02-27 07:14:16 +00:00
Emmad Usmani
c8fb1bec7a fix incorrect tooltip value in pie chart (#39180) 2024-02-27 00:11:02 +00:00
Nemanja Glumac
6f462b783f Use mongo 5.0 for E2E tests (#39168)
* Use mongo 5.0 for E2E tests

* Update snapshot names

* Update DB name
2024-02-26 22:47:57 +01:00
Jeff Bruemmer
bbc5c08a2a update redirect (#39177) 2024-02-26 16:43:59 -05:00
metamben
d092c3037b Add diagnose-expression (#39124)
Fixes #38954.
2024-02-27 00:17:07 +03:00
Jeff Bruemmer
a0331c7a9b redirect faq to docs README (#39171) 2024-02-26 14:52:16 -05:00
Uladzimir Havenchyk
bcc4885740 Fix applying default values for a pinned sql question (#39156)
* Fix applying default values for a pinned question

* fix typecheck

* Add a comment
2024-02-26 19:43:57 +00:00
Ryan Laurie
740a2e75ed Add analytics events for browse data (#39028)
* Add two Snowplow click tracking events to the Browse Data page, for clicks on models and tables

# Conflicts:
#	frontend/src/metabase/browse/components/BrowseModels.tsx
#	frontend/src/metabase/browse/components/TableBrowser/TableBrowser.jsx

* add backend event

* fix event tracking

* test snowplow even

* update schema type field

* more prettier

---------

Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-02-26 12:05:16 -07:00
Case Nelson
898e2843e1 Converted queries shouldn't change stage-metadata (#39127)
Converted queries need to fill in types of references converted from v1
to properly pass schemas. However legacy refs still exist in
`:lib/stage-metadata` and these refs should not be touched. Checking
that `map?` is in the second position of a ref is an easy way to
determine which version ref we're looking at.
2024-02-26 10:06:28 -07:00
Anton Kulyk
6ca186f843 Fix invisible text in custom homepage toast (#39158) 2024-02-26 16:52:54 +00:00
Anton Kulyk
244ad7e901 FE followup — LLMs for Question and Dashboard Titles and Descriptions (#38298) (#39147)
* Missing untranslated string

* Fix redundant `export`

* Misc clean up

* Remove duplicate block

* Decouple `LLMSuestionQuestionInfo` from form

* Merge loading and loaded state layouts

* Extract `getSubmittableQuestion`

* Compute `submittableQuestion` in save modal

* Fix selectors

* Fix types naming style

* Fix multiple calls to summarize endpoint
2024-02-26 16:06:57 +00:00
Alexander Polyankin
c631bf6bc3 Migrate graph.metrics sync to use QP metadata (#39094)
* Migrate graph.metrics to use QP metadata

* Migrate graph.metrics to use QP metadata

* Handle native columns

* Handle missing query results

* Optimize
2024-02-26 12:25:17 +02:00
Case Nelson
7b2ae02cba Allow binning field refs from expressions (#39089)
Fixes #26202

Previously we only looked for binned field-ids in order to update
binning strategies in qp. With this change we also look for field-name
refs. This allows expressions to be binned in models.
2024-02-23 16:16:45 -07:00
John Swanson
ca92e5d8fb Fix duplicate log line (#39133) 2024-02-23 22:27:23 +00:00
Mark Bastian
0ee45364dc Updating Feature Flag Meta for LLM (#39119)
This just bumps the metadata version of the `enable-llm-autodescription?` feature flag to 50 (`^{:added "0.50.0"}`).
2024-02-23 21:41:23 +00:00
Noah Moss
f557d29ff5 Add env var to hide built-in geojson (#39132) 2024-02-23 20:55:30 +00:00
Anton Kulyk
ff24898773 Fix dashboard filters color transition when leaving fullscreen (#39126) 2024-02-23 19:03:05 +00:00
Anton Kulyk
769ace4988 Show filters without values in fullscreen mode (#39076)
* Show filters without values in fullscreen mode

* Remove `parametersWidget` from `DashboardHeader`

* Use regular filters panel in fullscreen mode

* Minor refactor

* Minor refactor

* Fix nightmode

* Fix transition
2024-02-23 17:23:12 +00:00
Braden Shepherdson
4b80c77912 [MLv2] Ensure :name is unique on returned columns in the FE (#39118)
This is FE-only because this is a compatibility issue with the (legacy)
metadata coming back from the QP.

In time, the FE logic should be ported to MLv2 or made to depend on
things other than the `:name` field. MLv2 code itself (including BE
usage) should be based on the (already unique)
`:lib/desired-column-alias`.

Fixes #37517.
2024-02-23 16:16:31 +00:00
Cal Herries
e8a19eadbd Remove reminder to clean up changelog in release notes (#39097) 2024-02-23 17:57:32 +02:00
Cal Herries
22ce27f155 Remove special describe-table-fks for redshift (#39011) 2024-02-23 15:28:33 +00:00
Uladzimir Havenchyk
585891d028 Add eslint rule to handle quotes in e2e (#38965)
* Apply eslint quotes rule on e2e folder

* fixup! Apply eslint quotes rule on e2e folder

* fixup! fixup! Apply eslint quotes rule on e2e folder
2024-02-23 14:55:00 +00:00
Alexander Polyankin
12e062ed12 Fix previews for multi-stage queries (#39108) 2024-02-23 14:54:26 +00:00
Mark Bastian
f90e4db22e LLMs for Question and Dashboard Titles and Descriptions (#38298)
* Endpoint stubs

* It's alive!!!

The summarization endpoint is live, calling OpenAI, and connected to the `POST "metabot/card/summarize"`. `POST card/` also taps the results.

* Updating prompt

* Updated response shape

* [WIP] working front-end suggest button

* Incorporating viz settings

* add suggest description to save question modal

* Updating prompt

* merge title and description suggestion into one button

* Updating prompt

* Removing dead code

* Removing unused param and fn cleanup

* Fix string comment

* Adding dashboard summary endpoint stubs

* auto-request title and description

* dashboard summary wip

* dashboard summary wip

* dashboard summary wip

* better prompt

* remove dead component

* add suggest description button in dashboard sidebar

* fix dashboard description suggestion request

* better prompt

* swap out button when generating dashboard suggestion

* adding keywords

* adding keywords

* adding keywords

* adding keywords

* polish loading question name and description suggestions

* polish UI for dashboard description suggestion

* Stubbed in usage middleware

* Beginning EE Push

Moved metabot/summarize endpoints to autodescribe/summarize in the ee codebase to push this towards being an ee feature and distinguish it from metabot features.

Added snowplow tracking.

* Isolating EE LLM Code

This change completely separates metabot code from ee llm code.

It also introduces a composable client mechanism for creating LLM clients for different tasks.

* Task-Oriented LLM Refactoring

LLM code is now organized clearly into a directory of tasks. Each ns in the tasks package provides a certain LLM task to be used in the API.

* Adding unit test

* Adding admin UI elements for EE OpenAI key

* prettier on frontend/src/metabase/services.js

* Cleaning up description text

* Updating api calls

* FE stuff -- hiding things when feature not enabled.

* Figuring out linting for snowplow file

* Figuring out linting for snowplow file

* Fixing unit test

* add token feature llm-autodscription

* change added from 0.50 to 0.49

* extract logic from SaveQuestionModal into ee plugin

* extract logic from DashboardInfoSidebar to ee plugin

* Fixing unit test

* tests

* cleaning up code for SaveQuestionModal

* gate llm question name behind openAI key setting

* remove styles from SaveQuestionModal.css

* clean up code for dashboard

* lint

* Enabling triggering based on `:llm-autodescription` feature flag

* Starting to look at using a badge for LLM results (#38797)

* Starting to look at using a badge for LLM results

* WIP - Using an Indicator to show AI "stuff"

* Prototype of LLM with badge/indicator

* Removing dashboard description AI

* Ensuring LLM icon only shows when key is present. Updating icon to newer design. TODO: Put the icon in the right place.

* Cleanup -- still need to figure out how to position the indicator and not collapse the radio when selected.

* Updating save question form with LLM values does not reset form

* Cleanup

* Correct icon placement

* Adding MB branding to star

* add ai icon, tweak display

* Fix z-index, tweak padding

* cleanup

* remove inactive code

* Cleaning llm description task cobwebs out

* fix collection creation

* Cleaning lint and merge errors

* Adding "save-question-modal" test id back in

* Fixing jest test

* Touching a file to unstick CI

* Untouching a file to unstick CI

* Fixing some includes from the rebase.

* eslint fixes

* eslint fixes

* Fixing types

* Using `PLUGIN_IS_EE_BUILD.isEEBuild()` instead of `isEnterprise()`

* Removing dead styling

* Adding test ids and fixing cypress tests

* Fixing e2e tests

* Incorporating feedback

* Update frontend/src/metabase-types/api/settings.ts

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>

* Update frontend/src/metabase/core/components/EditableText/EditableText.tsx

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>

* Update frontend/src/metabase/core/components/Input/Input.tsx

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>

* Update frontend/src/metabase/core/components/TextArea/TextArea.styled.tsx

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>

* Update frontend/src/metabase/core/components/TextArea/TextArea.styled.tsx

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>

* Update frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardInfoSidebar.tsx

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>

* Fixing import

* Rebasing on master to fix conflicts

* Fixing types

* Revert "Update frontend/src/metabase/core/components/EditableText/EditableText.tsx"

This reverts commit fe11817086bff50f90336f30d33a1431cae662c5.

* Revert "Update frontend/src/metabase/core/components/Input/Input.tsx"

This reverts commit eef21407ee32e636a8b4e2594d502d5bbaa36870.

* Revert "Update frontend/src/metabase/core/components/TextArea/TextArea.styled.tsx"

This reverts commit dd1c22b993a6576d92547749d2eb93cb68411585.

* Revert "Update frontend/src/metabase/core/components/TextArea/TextArea.styled.tsx"

This reverts commit b169d05364e92c032ae5b6c972888a86079921e2.

* Fixing e2e tests

* address feedback

* Fixing e2e tests

* Fixing modal for models

---------

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>
Co-authored-by: Emmad Usmani <emmadusmani@berkeley.edu>
Co-authored-by: Kyle Doherty <5248953+kdoh@users.noreply.github.com>
Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
Co-authored-by: Ryan Laurie <iethree@gmail.com>
2024-02-23 14:05:34 +00:00
Oleg Gromov
a1a177707f Update required parameter reset icon (#39068) 2024-02-23 13:29:50 +00:00
Oleg Gromov
7c41bc13d2 Native query tag editor field mapper: mimic Mantine (#38997) 2024-02-23 11:54:34 +00:00
Uladzimir Havenchyk
2b6d4f3649 Use correct dashcard types in Dashboard (#39050) 2024-02-23 14:41:56 +03:00
Kamil Mielnik
5776cf3d1e Query execution time (#38999)
* Show query execution time in Query Builder footer

* Show execution time for all types of queries

* Revert "Show execution time for all types of queries"

This reverts commit 429cb124c5.

* Update assertions

* Remove redundant condition

* Add tests for query execution time

* Format code

* Do not use FunctionComponent
2024-02-23 17:48:19 +07:00
Mahatthana (Kelvin) Nomsawadi
b98bca4699 Hide dashboard actions on public/static embed dashboards (#39048)
* Hide dashboard actions on public/static embed dashboards

This is not what we want. See
https://metaboat.slack.com/archives/C057T1QTB3L/p1696532502602629?thread_ts=1696519212.704419&cid=C057T1QTB3L

* Add E2E tests

* Review: Use TS type guard

* Fix the logic in the previous commit
2024-02-23 07:26:43 +00:00
Uladzimir Havenchyk
f4b02f0cf5 Cleanup dependencies (#39078) 2024-02-23 09:44:27 +03:00
Luis Paolini
e852380d32 Update bug_report.yml (#39082)
Remove note
2024-02-23 00:53:33 +00:00
adam-james
cd13cc9388 Flow :semantic-type through QP for aggregations (#38829)
* WIP flow :semantic-type through QP for aggregations

Fixes: #38022

WIP need to add and fix some tests and confirm if this is the most correct place to fix the problem. Seems like it's a
good spot to put things though.

* Add test asserting that :semantic_type does flow through QP

Also fix a couple tests that now have a :semantic_type key.

* Add different aggregation types to semantic-type test

Working on adding tests and fixing various aggregation semantic types

* Test :semantic-type for all aggregations and adjust some metadata-methods

* Better use of existing methods via derive

* Properly set hierarchy between ::count-aggregation and ::quantity-aggregation
2024-02-22 15:20:28 -08:00
Jeff Bruemmer
b9730bffee update list of releases (#39084) 2024-02-22 17:23:16 -05:00
Vamsi Peri
1eb2078c1e Include filters when exporting dashboard to PDF (#38231)
* Include filters when exporting dashboard to PDF

* Fix missing dashcard borders

* Fix title padding

* Fix filters panel background color

* Fix parameters panel spacing

* Extract `DASHBOARD_PDF_EXPORT_ROOT_ID` const

---------

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2024-02-22 20:42:32 +00:00
Alexander Polyankin
b2398b650d Use getColumnKey for table.columns viz setting (#38995) 2024-02-22 22:24:49 +02:00
Luiz Arakaki
000dfa922a Update Metabase analytics content for 49 (#39058)
* update content for 49

* add date filter to question overview
2024-02-22 16:32:46 -03:00
Alexander Polyankin
e813357596 Filter picker search free input (#38907) 2024-02-22 20:01:16 +02:00
Nick Fitzpatrick
af138e8515 Allow official collections inside personal collections (#38823)
* initial stuff

* remove check for sub collections in personal collections

* remove test

* cleanup and adjusting tests

* import spacint

---------

Co-authored-by: Jerry Huang <jhuang37050@gmail.com>
2024-02-22 10:29:50 -05:00
Braden Shepherdson
fb815da3a6 [MLv2] Handle Object.isFrozen() legacy columns as input (#39032)
`cljs.core/hash` mutates vanilla JS arrays to attach a UID to them for
hashing purposes. Before this change, given a `DatasetColumn` with a
frozen `field_ref` array, we would use it directly on the
`:metadata/column`, and `(hash column)` would try to mutate the frozen
array and throw.

This clones the array while converting the legacy column to MLv2 form,
so there's no issue with mutating it.

Fixes the `closure_uid_123456789` issue.

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2024-02-22 09:44:25 -05:00
Ngoc Khuat
83d79b24cf Add api change log for replacing report_card.dataset with report_card.type (#39044)
* add an api change log about replacing report_card.dataset with report_card.type

* Update docs/developers-guide/api-changelog.md
2024-02-22 18:54:11 +07:00
Romeo Van Snick
862754c0ef Clear undo stack when first opening native editor (#39003)
* Add regression test for #35344

* Clear undo's when first opening editor

* Make sure normal undo's still work
2024-02-22 12:53:28 +01:00
Kamil Mielnik
48a82e4504 FE - Migrate dataset flag - move changes to master (#39047)
* Migrate changes from https://github.com/metabase/metabase/pull/38544

* Migrate changes from https://github.com/metabase/metabase/pull/38714

* Migrate changes from diff with metrics-v2 branch
2024-02-22 17:54:59 +07:00
Mahatthana (Kelvin) Nomsawadi
94795abc9e Fix can't select dashboard tabs in interactive embedding with parameter header=false (#39007)
* Remove full-app to a newer term

* Fix dashboard not loading in interactive embedding with header=false
header=false

* Fix can't choose dashboard tabs in interactive embedding w/ header=false
2024-02-22 07:21:08 +00:00
Braden Shepherdson
8376ca837a [MLv2] Prescribe the order for metabase.lib.column-group/group-columns (#38587)
The desired order is: own columns, explicitly joined, implicitly joined.
Explicit joins are ordered among themselves by join alias. Implicit
joins are ordered by the join alias of the FK (own columns first), then
by the name of the FK column.

Previously this order has usually been at least close to the desired
order by accident, since it's close to the iteration order of
`visible-columns`. However, `group-columns` uses `group-by`, which
returns a map. If there are enough groups (more than 8 I think) the map
implementation will switch from a `[key1 value1 key2 value2 ...]` array
to a real map, and the iteration order is undefined.

This change enforces the desired order, including a test that `shuffle`s
the columns. (And fixing the expectations for a few other tests.)
2024-02-21 23:11:02 +00:00
Anton Kulyk
aa22957e48 Trend chart tweaks (#38976)
* Auto open the comparison picker

* Preselect a single column for "anotherColumn" comparisons

* Flip value and label inputs in `StaticNumberForm`

* Respect static value's label case

* Merge `getInitialColumn` and `getInitialLabel`
2024-02-21 21:42:07 +00:00
Jeff Bruemmer
0f0a65e96d standardize params formatting (#38202) 2024-02-21 16:01:57 -05:00
Jerry Huang
3aad256235 Cleanup creator sentiment and follow up email code (#39016)
* creator sentiment cleanup

* change setting to be survey-enabled

* fix test

* change send-creator-sentiment-emails
2024-02-21 11:59:35 -08:00
Raphael Krut-Landau
4d8260500c Browse models: expandable/collapsible collections (#38704) 2024-02-21 16:54:11 +00:00
Jerry Huang
9d058c9183 Support JWT and other SSO methods at the same time (#38927)
* add if statement for jwt saml

* add tests

* add tests

* fix tests
2024-02-21 08:01:02 -08:00
Noah Moss
447d2a6b3d Use batched hydration of fields for tables (#38972) 2024-02-21 09:00:41 -05:00
adam-james
75739942f6 Do not create param_values on Dashboard Load, only fetch if they exist (#38980)
* Do not fetch param_values on Dashboard Load

Fixes: #38826

This change removes the *-or-create* behaviour of `field-ids->param-field-values`. This means that on Dashboard Load,
if the param values already exist, they'll be grabbed. But, if they don't, we won't try to fetch or create them.

This is WIP because it seems to contradict changes related to fixing #30218

* Comment out the other test added for #30218

* Remove the tests from 30218

These tests are asserting that param_values are created on dashboard load when the Field Values don't exist. This is
the behaviour we want to revert, so the tests are asserting something we don't want anymore.

* Improved test string wording

* Update src/metabase/models/params.clj

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

---------

Co-authored-by: Ngoc Khuat <qn.khuat@gmail.com>
2024-02-21 13:55:27 +00:00
Alexander Polyankin
ac3734876c Fix table viz settings when query is out of sync with the setting (#38912) 2024-02-21 14:21:43 +02:00
Anton Kulyk
47e4fccc28 Fix dashboard snowplow schema files (#38977) 2024-02-21 11:35:15 +00:00
Nemanja Glumac
8a620bfda2 Update ModelIndex type (#38901) 2024-02-21 12:18:09 +01:00
Oleg Gromov
8c856c758c Native query tag editor panel: use Mantine (#38906)
Change selects and add TextInputBlurChange
Extract controls
Update required parameter toggle
Fix e2e toggleRequired helper
Migrate ValuesSourceSettings to Mantine Radio
Fix all tests
Address review feedback
Reorganize TagEditorParam components
Add TextInputBlurChange component test
2024-02-21 09:24:28 +00:00
Mahatthana (Kelvin) Nomsawadi
db2624f86a Follow up on "Polish appearance settings" (#38850)
* Renaming files for consistency

* Combine both container and view component

* Add the new selector + improve types

* Force user to refresh to see the colors change.

* Revert "Add the new selector + improve types"

This reverts commit 1587411da685857ee586b3096a58148f6a0ce36c.

* Type setting selectors to support enterprise setting keys

* Copy changes

* Remove unused files

* Remove default exports/imports

* Add a modal telling users to refresh the page after changing colors

* Revert "Add a modal telling users to refresh the page after changing colors"

This reverts commit ac8772d01f.

* Makes it obvious to users they need to refresh browser

After changing colors, we want to make sure the behavior of colors is
consistent across the board. Previously this wasn't the case, some
elements will immediately change colors, while some don't. This created
confusion.

The new behavior is to NOT change any color at all after changing the
application colors and let users refresh their browsers themselves.

* Update copy according to a discussion

* Fix e2e from copy change

* Make assertion explicit

* Fix the last E2E failure
2024-02-21 02:59:29 +00:00
Ryan Laurie
5d1e1959c5 Update release notes template (#38865) 2024-02-20 16:31:57 -07:00
Jeff Bruemmer
ef81cfb688 docs - requiring a filter (#38813) 2024-02-20 16:41:48 -05:00
Uladzimir Havenchyk
80dad7a61e Add repro test for custom column disappearing metabase#38944 (#38960) 2024-02-20 23:45:49 +03:00
Case Nelson
922b1fdc7f Wrap literals around expression refs (#38886)
* Wrap literals around expression refs

Fixes #27185

Expression refs need to be handled like field refs as far as type hints
in opts are concerned. Otherwise we don't pass the correct parameter
types to the drivers.

* Address pr feedback
2024-02-20 13:02:16 -07:00
Jesse Devaney
e5d9913aa2 use all hidden parameters to determine visibility (#38882)
- queryParams: hide_parameters
- hiddenParameterSlugs
2024-02-20 14:49:55 -05:00
Jerry Huang
a634189ae6 Add Creator Sentiment Email task (#38787)
* Add new email function and send email to creator

* remove debug stuff

* add tests, address comments

* actually add tests

* Update src/metabase/email/messages.clj

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

* address comments

---------

Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2024-02-20 10:56:42 -08:00
Case Nelson
7f9afb07bc Fixes filters against datetime binned expressions (#38874)
* Fixes filters against datetime binned expressions

Fixes #33528

Turns out that `mbql/normalize` and `lib/normalize` behaved slightly
different and `[:expression "abc" {...}]` refs would drop their opts in
the former path. In order to properly query against binned datetimes
it's important that expression ref does not lose its type or else the
optimizer will not see that `time-interval` needs to convert to a
`between` rather than an `=`.

* Fix test

* Only keep specific keys on expression opts for these expression filters

* Don't run checkin dataset on snowflake or athena
2024-02-20 11:49:07 -07:00
Uladzimir Havenchyk
e94ea96a1b Rework findColumnIndexForColumnSetting to MLv2 (#37854)
* Rework findColumnIndexForColumnSetting to MLv2

* Throw an error to find all places without query

* Use MLv2 in ChartSettingTable (#38171)

* Add a comment why we can't use mlv2 in chart setting table

* Use mlv2 findColumnIndexForColumnSetting in ChartSettingTableColumns

* Tests completed, so revert throwing

* Use mlv2 findColumnIndexForColumnSetting in object detail (#38170)

* Use mlv2 findColumnIndexForColumnSetting in object detail

* Address review

* Use mlv2 findColumnIndexForColumnSetting in Question (#38169)

* Use mlv2 findColumnIndexForColumnSetting in Question

* Update question tests

* Use mlv2 findColumnIndexForColumnSetting in viz settings (#38172)

* Use mlv2 findColumnIndexForColumnSetting in Table (#38168)

* Cleanup finColumnSettings usage (#38914)

* Fix linting
2024-02-20 18:43:34 +03:00
Chris Truter
927b5f8ce6 More pervasive and atomic Liquibase locking (#38810) 2024-02-20 13:37:46 +00:00
Kamil Mielnik
bbe6b0b808 Fix availableDrillThrus typing (#38957)
- @see https://metaboat.slack.com/archives/C0645JP1W81/p1708431515190439
2024-02-20 12:49:40 +00:00
Kamil Mielnik
750638e4d2 Align paths in Prettier & ESLint scripts (#38951)
* Align ESLint & prettier paths in "lint-stage" & "scripts" in package.json

* Handle ts files in e2e tests

* Manually fix ESLint-reported issues

* Format "lint-prettier-pure" script the same way as "prettier"

* Run "yarn eslint-fix"

* Manually fix remaining issues

* Ignore database files in ESLint as they reference a file that is git-ignored but does exist locally

* Remove duplicated eslint call
2024-02-20 12:09:07 +00:00
Kamil Mielnik
22684b87fc Include e2e directory in prettier scripts (#38948)
* Include e2e directory in prettier scripts

* Run "yarn prettier"
2024-02-20 09:50:52 +00:00
lbrdnk
21c5df971c Use macro that does pre and post cleanup (#38929)
Swaps with-temporary-setting-values for with-report-timezone-id.
2024-02-20 09:37:12 +01:00
Kamil Mielnik
2aa3cec610 RFC 70 - Automate sorting imports (#33883)
* Upgrade eslint-plugin-import

* Configure import/order rule for consistent, predictable imports

* Change "eslint-disable-next-line no-restricted-imports" into "eslint-disable-line"

* Ensure imports are in a single block

* Move or remove informative comments between import statements

* Remove imports-grouping comments

* Configure groups
- the difference between the default setting is the presence of "internal" group

* Manually fix imports order and disable "import/order" rule in files with possible circular dependencies

* Move comment to the same line as import

* Run "yarn eslint-fix" 5 times
- Remaining: 16 problems (16 errors, 0 warnings)

* Manually fix imports order in remaining files

* Run "yarn prettier"

* Fix import

* Fix circular dependency

* Fix circular dependency

* Remove unused action creator (it was inlined in 702988ec3f due to circular dependency)

* Re-add accidentally removed code

* Fix typing

* ESLint
2024-02-20 07:35:40 +00:00
Kamil Mielnik
ebb5500c15 Fix - Flaky QueryBuilder tests (#38860)
* Use fetchMock.flush() to prevent tests from interfering with each other

* Revert "Use fetchMock.flush() to prevent tests from interfering with each other"

This reverts commit 03f1277cf2.

* Add typing for requests in the redux store

* Fix QueryBuilder flakes by introducing waitForLoadingRequests

* Simplify interface

* Add mocks for requests in redux store, update types

* Simplify code

* Increase timeout
2024-02-20 13:29:31 +07:00
Jeff Bruemmer
ff5e6765a0 docs - user attribute examples (#38579) 2024-02-19 15:46:41 -05:00
Sloan Sparger
f509213c79 Sidebar loading state regression fix (#38875) 2024-02-19 14:06:45 -06:00
Jeff Bruemmer
664e98ff10 docs - trend viz updates (#38717) 2024-02-19 15:05:51 -05:00
Ryan Laurie
5078594f17 Appends follow-up UI fixes (#38837) 2024-02-19 18:51:22 +00:00
Alexander Polyankin
08b8dfb1f4 Remove legacy query from parameter targets (#38820)
* Remove legacy query from parameter targets

* Fix for native queries

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* Migrate getPivotColumnSplit to MLv2

* Fix

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* Migrate getParameterTargetField to MLv2

* fix

* Another attempt

* Another attempt

* Another attempt

* Another attempt

* Another attempt
2024-02-19 20:12:24 +02:00
Alexander Polyankin
abc4bb3eaf Remove MLv1 fields, breakouts, expressions (#38903)
* Migrate getPivotColumnSplit to Mlv2

* Migrate getPivotColumnSplit to Mlv2

* Migrate getPivotColumnSplit to MLv2

* Migrate getPivotColumnSplit to MLv2

* Migrate getPivotColumnSplit to MLv2

* Remove MLv1 breakouts

* Remove expressions

* Remove expressions

* Remove expressions

* Remove expressions

* Remove expressions

* Remove expressions

* Fix

* Fix tests

* Fix tests
2024-02-19 19:16:43 +02:00
Jeff Bruemmer
bf5554249f docs - redshift impersonation access (#38734) 2024-02-19 12:15:38 -05:00
Jeff Bruemmer
118dd01f14 docs - link visibility (#38723) 2024-02-19 11:43:52 -05:00
Nicolò Pretto
f179f3cc35 Replace MetabaseSettings.isEnterprise() with isEEBuild() (#38818)
* add getIsEECode selector

* isEEBuild function

* Revert "add getIsEECode selector"

This reverts commit 3fc3fa79a2.

* remove isEnterprise

* rename plugin to be more explicit
2024-02-19 14:51:26 +01:00
Mahatthana (Kelvin) Nomsawadi
8281abdce1 Polish appearance settings (#38713)
* Introduce tabs to admin settings

* Change route when changing tabs

* Reorder whitelabel settings according to the new design

* Modify ImageUpload to support value from the setting

* Update colors settings copy and style

* Update copy in appearance/branding page

* Update copy in appearance/conceal-metabase page

* Add toggle grouping description

* disconnect application colors from chart colors

* Update whitelabel/branding copy

* Update whitelabel/conceal-metabase toggles

* Deprecate the old admin text input widget

* Extend the test

* Introduce SettingtextInput which uses metabase/ui component

* Update Admin Select widget

* Convert font Select to metabase/ui

* Fix style conflict causing Select dropdown to overflow the page

* Prevent repression on other settings page than Appearance

* Move landing page (EE) to general settings page

* Fix FE type

* Fix unit tests

* Fix E2E tests

* Fix type

* Removed commented out code

* Fix E2E from master change
2024-02-19 12:14:37 +00:00
Anton Kulyk
7fe1620f07 Add new dashboard analytics events (#38872)
* Implement `dashboard_width_toggled` event

* Implement `dashboard_section_added ` event

* Add a new snowplow schema file (1-1-4)

* Use 1-1-4 schema file
2024-02-19 11:25:01 +00:00
Alexander Polyankin
bebcd1e70f Migrate getPivotColumnSplit to Mlv2 (#38859) 2024-02-19 13:06:52 +02:00
Oleg Gromov
e708924ac1 Translate to typescript (#38809) 2024-02-19 10:39:20 +00:00
Sloan Sparger
d2856e4d60 Admin Layout Regression Fixes (#38688) 2024-02-16 18:22:34 -06:00
Ryan Laurie
36b462190f Disable failing sandbox test (#38887) 2024-02-17 00:02:53 +00:00
Jesse Devaney
2a48f4f69a fix dashboard header fixed width adjustment bug (#38880) 2024-02-16 22:12:39 +00:00
Ryan Laurie
affed15424 Use data fetching hooks for collections content (#38519)
* add bookmarks fetching hook

* hookify collections content

* refactor to make everything much prettier
2024-02-16 15:02:48 -07:00
Sloan Sparger
72951e3a15 Admin UI for disabling user auto provisioning (#38716)
* impl feature

* makes use of existing form components and deletes custom widget

* e2e tests

* fix lints

* fixes lint around Metabase name usage

* removed the select keys line to allow for whatever setting to be updated

* fix defaulting logic for ldap and jwt, fixes unit test

* snip snap snip snap

* fix unit and maybe lint tests

* fix ldap code

* fixes trimming null

* fixes e2e ldap tests

* e2e progress

* breaking local e2e in hopes of fixing ci...

---------

Co-authored-by: Jerry Huang <jhuang37050@gmail.com>
2024-02-16 15:42:49 -06:00
Mark Bastian
2a017f80dc Add per viz-type card template sizes in x-rays (#38836)
* Add per viz-type card template sizes in x-rays

Previously, any card without a size (width or height) set in their yaml definition was set to a default of `default-card-width` or `default-card-width`, respectively. This PR adds a map of default and min dimensions per viz type (the `:display`) key and fills that in for each template. The template is merged into this result, keeping anything that already existed in the yaml file.

Before merging this we should consider if we want to use the min values and where this data should be stored. It is currently in `metabase.automagic-dashboards.dashboard-templates`, but was lifted from [sizes.ts](https://github.com/metabase/metabase/blob/master/frontend/src/metabase/visualizations/shared/utils/sizes.ts).

* Moving card sizing constants to cljc

The default card sizes were found in `sizes.ts` and were duplicated into `metabase.automagic-dashboards.dashboard-templates`. This PR consolidates those changes into `metabase.shared.automagic-dashboards.constants`.

Note that @kulyk and @JesseSDevaney might want to consider further consolidation of dashboard related constants into this namespace.

* Incorporating Feedback

Changes
- Explicitly defined two constants in the shared file that are clj and js friendly
- Set case to CARD_SIZE_DEFAULTS_JSON
- Updated `metabase.automagic-dashboards.dashboard-templates/set-default-card-dimensions` to use a helper

* Update src/metabase/shared/automagic_dashboards/constants.cljc

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>

* Updating ns name per Jesse

---------

Co-authored-by: Jesse Devaney <22608765+JesseSDevaney@users.noreply.github.com>
2024-02-16 20:56:32 +00:00
Anton Kulyk
c93ec86dce Extract setDashboardWidth action (#38871)
* Convert `dashboard/actions/ui` to TypeScript

* Extract `setDashboardWidth` action
2024-02-16 19:05:09 +00:00
Anton Kulyk
495732c8bf Make the filter bar sticky for public dashboards (#38766)
* Make filters sticky

* Fix hidden parameters still taking vertical space

* Bump z-index

* Conditional sticky filters on small screens

* Don't render `ParametersWidgetContainer` without parameters

* Add border to filters panel when scrolling

* Fix e2e tests

* Fix filter panel background color

* Disable sticky filters for "transparent" embed theme
2024-02-16 19:04:56 +00:00
Chris Truter
0e9b99f934 Create X-or-insert! methods and use them for FieldValues (#38760) 2024-02-16 16:38:57 +00:00
Chris Truter
65c881fe1f Fix update hook and add select hook (#38751) 2024-02-16 15:58:41 +00:00
Nemanja Glumac
4c8a205bde Clean up and simplify MLv1 clear* utilities (#38852)
* Remove unused `breakout` parameter

* Evaluate `clear()` inline

* Evaluate `getBreakoutClause([])` inline

* Simplify `clearBreakouts` query helper

1. The second argument of `setBreakoutClause` is aways `undefined`
which means that we can remove it.

2. No need to export this helper since it's used only within this file

* Remove unused `clearBreakouts` helper from breakout helpers

* Simplify `clearFields` helper

* Simplify `clearOrderBy` helper

* Remove unused `clear` util
2024-02-16 14:45:40 +01:00
Nemanja Glumac
433bcb67eb [MLv2] Further StructuredQuery cleanup (#38831)
* Remove unused `StructuredQuery.prototype.topLevelQuery`

* Remove unused `StructuredQuery.prototype.lastSummarizedQuery`

* Remove unused `StructuredQuery.prototype._keyForFK`

* Remove unused `isSegmentOption` helper
2024-02-16 13:59:35 +01:00
Alexander Solovyov
2f61b2d783 serialization: log actual model when couldn't generate entity id (#38814) 2024-02-16 12:08:13 +03:00
lbrdnk
e390148149 Add server side generated relative datetime capabilities to Snowflake (#38779)
* Remove duplicate definition

* Extend server side relative datetime generation to Snowflake

* Cleanup
2024-02-16 10:02:16 +01:00
lbrdnk
788cc10a6e Update group-by-week-test to use database timezone id (#38805)
* Update test

* Remove driver exclusions
2024-02-16 09:58:12 +01:00
Alexander Polyankin
f3211040af Remove MLv1 virtual tables (#38806)
* Migrate legacyQueryTable

* Migrate legacyQueryTable

* Load missing data

* Remove virtual tables

* Remove the test
2024-02-16 10:34:38 +02:00
Braden Shepherdson
c062ab7ff0 Enable source maps for CLJS in release builds (#38819)
We do this for our JS and TS code. This change configures shadow-cljs to
emit the source maps in release mode, and bumps the versions of
shadow-cljs and the transitive dependency `source-maps-js` to enable
webpack to consume these source maps correctly.

(The output source maps have some quirks, and broke some consumers.
Mainly that inlining of CLJS functions can result in empty namespaces,
and while the file contents were correctly inlined,
`sourceContents: ""` looks falsy in JS. Webpack would try to read the
nonexistent source files and fail to build.)
2024-02-16 08:02:13 +00:00
Raphael Krut-Landau
1ce5b449ae Browse models: refactoring (#38730)
* In browse, move ModelGroup and associated components to a separate file
* Improve look of Browse tabs and SchemaBrowser crumbs
2024-02-15 19:52:32 -05:00
Cam Saul
80dcbdfbf3 Mega QP context and entrypoint overhaul. Reduce QP hairiness by 30% (#35465)
* QP enterprise middleware should use `defenterprise`

* Test fix? 🔧

* Remove `:rff` from the Query Processor context map

* Sort namespaces

* Simplify QP entrypoints part 1

* Test fixes 🔧

* Test fixes 🔧

* Make sure defenterprise dispatch is done for every QP run

* B I G  QP context overhaul

* WIP

* Remove qp.context.default

* Test fix 🔧

* PR feedback

* QP context overhaul [WIP] [ci skip]

* QP context overhaul [WIP] [ci skip]

* Fix duplicate preprocesses

* Some test fixes.

* More test fixes [ci skip]

* Source card resolution middleware should be preprocessing middleware, not around [ci skip]

* Test fixes [WIP] [ci skip]

* Remove `test-qp-middleware`

* Remove `qp/compile`

* Fix Kondo warnings/cleanup

* Remove `mt/compile`

* Fix most tests

* Mostly everything working?

* 4 failures, 1 error

* Eliminate QP context `reducedf`

* 3 failures, 0 errors <3

* All tests are passing <3

* Remove dead debug-qp code

* Fix test failure

* Remove async context

* Remove raisef

* Forget it, just remove context entirely [ci skip]

* Fix Kondo errors

* Fix Kondo warnings

* Fix Kondo warnings

* Fix Kondo warnings

* Remove empty namespace

* Fix some reflection warnings

* Update dox [ci skip]

* Test fix 🔧

* Fix pivot QP

* Misc improvements

* Test fix 🔧

* Improvements and test fixes

* More test fixes 🔧

* Test fixes 🔧

* Address PR feedback

* Test fixes 🔧

* More test fixes and docstring improvements

* Appease Eastwood

* Test fixes 🔧

* More test fixes

* Test fixes 🔧

* Revert test parallelization in metabase.models.params.chain-filter-test

* Update src/metabase/async/util.clj

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

---------

Co-authored-by: metamben <103100869+metamben@users.noreply.github.com>
2024-02-15 22:06:22 +00:00
Case Nelson
bb9f81d4f2 Extend param substitution to handle datetimes (#38695)
* Extend param substitution to handle datetimes

Prior to this only dates were supported as values for native timestamp field parameters.

* Check for exclusion filter when determining alignment unit
2024-02-15 10:10:24 -07:00
Sloan Sparger
227f0b83a9 Fix search result display for items with large strings without word breaks (#38727) 2024-02-15 09:45:56 -06:00
Sloan Sparger
7a27db7864 Improve tooltips in navigation (#38588) 2024-02-15 09:45:40 -06:00
Oleg Gromov
792a4ed7c6 Update "Add/update filter button" in filter widgets (#38468) 2024-02-15 12:50:15 +00:00
Nicolò Pretto
d419e9acc4 add missing tests from meet embedders testing plan (#38772)
* test: adds tests for localStorage flag

* Apply suggestions from code review

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

---------

Co-authored-by: Mahatthana (Kelvin) Nomsawadi <me@bboykelvin.dev>
2024-02-15 09:39:44 +01:00
Nemanja Glumac
521a3cb4e8 [MLv2] Migrate cleanQuery util [WIP] (#38505) 2024-02-15 08:36:53 +00:00
Alexander Polyankin
103cc5a57a Remove some legacy query usages from QB (#38774) 2024-02-15 09:58:53 +02:00
Mark Bastian
987e7eb44c Setting x-ray dashboard width to 24 (#38790)
This just updates the `grid-width` parameter in `metabase.automagic-dashboards.populate` to be consistent with new FE work.
2024-02-15 00:14:09 +00:00
metamben
2975da8df1 Remove all empty stages instead of just the last one (#38743)
Fixes #37626.
2024-02-14 22:50:21 +00:00
Jeff Bruemmer
ae68db40ae docs - dash upgrades (#38689) 2024-02-14 16:16:24 -05:00
Mark Bastian
1e1a321133 Removing flaky flag on issue 19889 e2e test (#38791)
The `19889-native-query-export-column-order.cy.spec.js` test hasn't flaked in over 30 days per [replay.io](https://app.replay.io/team/dzoyNTM4ZjRmOC05YmFlLTRiYjYtYjljYi1jOGYzOWUyMjRhZWY=/tests/dHJ0OjEyMDIwNjkzMWYyMDExMmUzZmMxNDE0MmMxMWFiY2I3NjlmZTliNDE=?param=dzoyNTM4ZjRmOC05YmFlLTRiYjYtYjljYi1jOGYzOWUyMjRhZWY%3D&param=tests&param=dHJ0OjEyMDIwNjkzMWYyMDExMmUzZmMxNDE0MmMxMWFiY2I3NjlmZTliNDE%3D) and I can't make it fail locally after several repeated attempts.

At this point I'm just removing the flaky flag and closing until we can get it to flake again.

Fixes #36682
2024-02-14 16:04:52 -05:00
Cal Herries
0dcd64dac4 Disable redshift support for uploads (again) (#38776) 2024-02-14 21:11:48 +02:00
Ryan Laurie
a50098a997 Update build requirements for v49 (#38742) 2024-02-14 09:01:02 -07:00
Alexander Polyankin
3cbc61eed2 Remove MLv1 joins (#38763) 2024-02-14 17:55:26 +02:00
Uladzimir Havenchyk
dbae664c84 [Parameters] Cleanup types usage (#38752)
* [Parameters] Cleanup wrong tests

* fixup! [Parameters] Cleanup wrong tests
2024-02-14 18:45:11 +03:00
Cal Herries
4d552f131f Redshift support for CSV uploads (take 3) (#38567) 2024-02-14 15:22:45 +00:00
Raphael Krut-Landau
197aa18209 Browse models: Add one filter (#38661)
Add an "only show verified models" filter to Browse models
2024-02-14 15:05:26 +00:00
Kyle Doherty
9f7144b5de add CODENOTIFY to email directory (#38313) 2024-02-14 09:57:22 -05:00
Nicolò Pretto
d999b113cf refactor: rename PreferencesStep to DataUsageStep (#38708) 2024-02-14 13:52:53 +00:00
Uladzimir Havenchyk
86490fd6ba Migrate DashcardCardParameterMapper to TS (#38596)
* Do not show Unknown field in parameter mappings if there is mapping

* Rework to MLv2

* handle virtual cards separately

* WIP

* fixup

* Rework the approach

* cleanup

* Fix unit test

* fixup! Fix unit test

* keep only one -1

* Add a test

* Split tests into groups

* Migrate DashcardCardParameterMapper to TS

* Add more types

* Add additional check

* Improve tests

* Move code to utils

* Make types more flexible

* Better types

* Test

* Test

* Normalize target

* Add more tests

* Attempt to fix types

* Cleanup

* Address review

* revert unneeded change

* Correct types

* fixup! Correct types

* rely on types :crossfingers:
2024-02-14 13:37:43 +00:00
Nicolò Pretto
9f18eef381 refactor e2e of onboarding/setup (#38669)
* refactor: extract language step helper

* refactor: convert test and util to typescript

* fillUserAndContinue and skipWelcomePage

* test events sent via snowplow

* adds last step "completed" + add step_number in the assertions

* adds comment clarifying why we expect 1 event even though we block snoplow

* findByTextEnsureVisible().click() can just be findByText.click() as we can't click invisibile things

* remove default parameters to fillUserAndContinue

* refactor: use findByRole for "Next" button
2024-02-14 14:12:25 +01:00
Alexander Polyankin
1c9df6f7fe Fix native editor flakes (#38755) 2024-02-14 14:59:35 +02:00
adam-james
999aa7be75 Use font fallbacks in the static-viz js (#38737)
The trend chart email was rendering incorrectly in gmail on iOS for some reason.

I think it happened because the Lato font was unavailable in the gmail+iOS context and this new
:javascript_visualization (introduced with trend charts for the static-viz rendering pipeline) specified a font family
of Lato with no fallbacks. It seems that CSS doesn't inherit font fallbacks from parent elements at all, so even
though fallbacks were specified further up the tree, they weren't used.

This PR just adds the same fallbacks used elsewhere in static-viz render code.
2024-02-13 22:55:22 +00:00
metamben
d3c78b6020 Distinguish different arities of aggregation-clause (#38726)
Fixes #37782.
2024-02-13 22:48:22 +00:00
Jeff Bruemmer
a0273af7a1 update api docs (#38736) 2024-02-13 15:35:21 -05:00
Noah Moss
adb3ea3b1e Add run-cloverage tag to run Cloverage on non-master branches (#38732) 2024-02-13 15:01:50 -05:00
metamben
ffd43d9cfb Include table items with the targets of FK fields (#38528) 2024-02-13 21:40:00 +02:00
Jesse Devaney
2f9e8ff366 Milestone 4: Make Dashboard Header Fixed Width (#38634)
* Add fixed width behavior to dashboard header

* refactor fixed width styled component

* adjust margin to match full-app margin

* make styles consistent across public/embed and full-app dashboards

* Make public/embed dashboard headers fixed width

* add fixed width header behavior to x-ray dashboards

* fix dashboard headers button alignment

* add tests

* add parameter to dashboard to test fixed width behavior

* fix tab alignment in public dashboards

* refactor tests

* only render container when dashboardTabs is not null

* improve styled component naming

* make dashboard tabs styling consistent between public/embed and full-app dashboards

* make dashboard info sidebar width consistent with other dashboard sidebars

* align dashboard header and dashboard body position when dashboard sidebar is open

* refactor tests
2024-02-13 18:05:55 +00:00
Anton Kulyk
aea4c074c1 Make Mantine tooltips consistent with legacy tooltips (#38678) 2024-02-13 15:45:34 +00:00
Jeff Bruemmer
549b298bf3 update list of releases (#38718) 2024-02-13 10:33:11 -05:00
Mahatthana (Kelvin) Nomsawadi
279b372136 Add ESLint rule for Metabase strings (#38553)
* Fix case where Metabase links are render inside template strings

* Add `no-literal-metabase-strings` ESLint rule

* Fix all Metabase string errors

* Address review: Fix the rule

The rule was checking if we have imported the selector
`getApplicationName` then ignore all Metabase strings. This is different
than `no-unconditional-metabase-links-render` because in that rule, when
fixed the Documentation URLs are still in the file, but in this rule,
when fixed, there should be no Metabase strings left in the file.

* Fix errors from the new lint rule
2024-02-13 15:29:31 +00:00
Sloan Sparger
985ef5d063 Remove dead code in frontend/src/metabase/admin (#38589) 2024-02-13 09:18:01 -06:00
lbrdnk
ee219e5c93 Use server side generated timestamp for relative datetime computation on Redshift v2 (#38604)
* Restore commit 16988f50d6, server side generated timestamps for Redshift (#35995)

* Remove redundant test -- caching is best effort

* Make comments more descriptive

* Remove 0 arity from testcase generator function

* Move units into `use-server-side-relative-datetime?` definition
2024-02-13 15:38:20 +01:00
Jeff Bruemmer
0dd109bedf docs - serialization endpoints (#38292) 2024-02-13 09:34:12 -05:00
Uladzimir Havenchyk
4025072e8d Rework parameter mapping comparing to MLv2 (#38545)
* Do not show Unknown field in parameter mappings if there is mapping

* Rework to MLv2

* handle virtual cards separately

* WIP

* fixup

* Rework the approach

* cleanup

* Fix unit test

* fixup! Fix unit test

* keep only one -1

* Add a test

* Split tests into groups

* Improve tests

* Move code to utils

* Make types more flexible

* Test

* Test

* Normalize target

* Add more tests
2024-02-13 13:53:32 +00:00
Kamil Mielnik
b98fa2b4bb Fix isNavigationAllowed (#38703)
* Removed unused route

* Remove invalid test

* Remove invalid routes from isNavigationAllowed, update tests

* Remove invalid route

* Handle /model/:id/notebook route

* Migrate Question.prototype.isDataset to Question.prototype.type

* Consolidate code

* Add missing attribute

* Type cards and questions for extra safety

* Fix running edited models

* Improve diff
2024-02-13 20:46:47 +07:00
Chris Truter
5bc74cd5b3 Implicitly delete old FieldValues when fetching current ones (#38396) 2024-02-13 13:07:16 +00:00
Chris Truter
3396f7562b Parallelize tests with thread-safe version of with-redefs (#38620)
Gotta go fast and gotta stay safe.

We have 413 calls to with-redefs, so I'm not going to try get 'em all yet.
2024-02-13 14:03:41 +02:00
Romeo Van Snick
28be3c586c Make fieldpicker look more like other popovers (#38674) 2024-02-13 09:40:46 +01:00
Sloan Sparger
3a0815a7a3 Disable password reset button after click in admin (#38619)
* disables password reset button in admin after the user has clicked the button once

* add email throttle

* fix test

---------

Co-authored-by: Jerry Huang <jhuang37050@gmail.com>
2024-02-12 23:43:46 +00:00
Braden Shepherdson
3415469d65 Deflake dashboard-filters-id by waiting for the card to finish loading (#38691)
This test has been flaky due to checking its assertion before waiting
for the cards on the dashboard to refresh based on the newly added or
set filter.

This waits for the hourglass icon `loading-spinner` to be gone before
checking that the table is properly filtered.

[Example failure](https://app.replay.io/recording/e2etestscenariosdashboard-filtersdashboard-filters-idcyspecjs--83043eb8-690e-482e-9108-a24455b4942f)
2024-02-12 22:13:48 +00:00
Mark Bastian
c30c0f4d44 Showing currency_in_header options in admin for fields (#38237)
* Showing currency_in_header options in admin for fields

The Table Metadata > Database Name > Table Name > Field Name > Formatting view did not show `Where to display the unit of currency` due to the following previous logic:

```
getHidden: (column, settings, { series }) =>
  settings["number_style"] !== "currency" ||
  series[0].card.display !== "table"
```

The second clause, `series[0].card.display !== "table"`, always returned true since `series[0].card.display` is `undefined`.

This has been updated to:

```
getHidden: (column, settings, { series }) =>
  settings["number_style"] !== "currency" &&
  (!series[0].card.display || series[0].card.display === "table")
```

The requirement for hiding this option is now:
1.  The series number style must not be currency
2.  If the series is currency, the card display type must either be undefined or of type table.

Fixes #38021

* Fixing viz settings helper when radiogroup is ambiguous.

* add forAdminSettings prop in extraData of column settings

---------

Co-authored-by: Nick Fitzpatrick <nickfitz.582@gmail.com>
2024-02-12 14:58:05 -07:00
Nemanja Glumac
ebbdd89a07 Use "filled" bookmark icon when the item is bookmarked (#38239)
* Use "filled" bookmark icon when the item is bookmarked

* Update E2E tests

* Update the affected unit test

* Make dashboard header icons smaller and darker

* Make dashboard bookmark icon look like its neighbors

* Unify question and dashboard icon's background on hover

Question icons have been using `text-medium` unlike dashboard icons
that had `text-light`.
2024-02-12 22:29:30 +01:00
Uladzimir Havenchyk
f63bf2f165 Rework findColumnSettingIndexForColumn to MLv2 (#37856)
* Rework findColumnSettingIndexForColumn to MLv2

* WIP

* correct test

* Update frontend/src/metabase-lib/queries/utils/dataset.ts

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

* Update frontend/src/metabase-lib/queries/utils/dataset.ts

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

* Address review

---------

Co-authored-by: Kamil Mielnik <kamil@kamilmielnik.com>
2024-02-12 23:45:58 +03:00
Braden Shepherdson
c9f0f7a1dd [MLv2] Add description and fingerprint to displayInfo for columns (#38476)
If present. Also adds these fields to the TS types.
2024-02-12 13:36:24 -05:00
Ryan Laurie
74444ce975 Models In Browse Data Follow Up (#38635)
Co-authored-by: Raphael Krut-Landau <raphael.kl@gmail.com>
2024-02-12 11:40:05 -05:00
Sloan Sparger
3e771f01e6 Fix sidebar and home loading indefinitely when database data fails to load (#38582) 2024-02-12 10:31:12 -06:00
Sloan Sparger
ab1d41391a Show more billing info on license and billing settings page (#38497) 2024-02-12 10:21:08 -06:00
metamben
1f4965d6b2 Compare datetimes w/o timezone fields with literals as strings (#38642)
* Compare datetimes w/o timezone fields with literals as strings
2024-02-12 18:24:21 +03:00
Luis Paolini
969f0a32f5 Bump Bigquery driver (#38660)
On 2.36, Bigquery fixed some issue around the location where the jobid was being sent. This will allow us to do https://github.com/metabase/metabase/issues/21309

changelog https://github.com/googleapis/java-bigquery/blob/main/CHANGELOG.md
2024-02-12 12:05:05 -03:00
Mark Bastian
a9b792c92d source-field populated in aggregates with foreign refs (#38624)
* source-field populated in aggregates with foreign refs

When aggregates are populated that reference other tables, either a `:source-field` must be provided in the field metadata or a `:join-alias` needs to be provided. The former is preferred.

Prior to this PR, the first situation in the below simplified case could happen:

```clojure
;;Simplified case
;; busted
(qp/process-query
  {:database 1,
   ;; 59 is "PRODUCTS" -> "PRICE" which is not in the "REVIEWS" table
   :query    {:aggregation  [["sum" ["field" 59 {:base-type "type/Float"}]]]
              ;; "REVIEWS"
              :source-table 8},
   :type     "query"})

; Works
(qp/process-query
  {:database 1,
   ;; The `:source-field` metadata fixes the above query
   :query    {:aggregation  [["sum" ["field" 59 {:base-type    "type/Float"
                                                 ;; "REVIEWS" -> "PRODUCT_ID"
                                                 :source-field 71}]]]
              :source-table 8},
   :type     "query"})
```

This PR updates `metabase.automagic-dashboards.interestin/ground-metric` to use the `->reference` function for fields when building the `decoder` for transforming field names to references, which properly adds sources for external fields.

Fixes #38618

* Updating `grounded-metrics-test` to reflect updated field referencing.
2024-02-12 07:41:55 -07:00
Nemanja Glumac
ce5b2111e2 [QC] Remove unused utils and methods on the Join prototype (#38570)
* Remove unused `clearFields` method on a `Join` prototype

* Remove unused `remove` method from the `Join` prototype

* Remove unused `removeJoin` method and helper

* Remove unused `replace` method from the `Join` prototype

* Remove unused `updateJoin` method and helper

* Remove more potentially unused methods from the `Join` prototype

* Mark `joinedTable` method as private
2024-02-12 14:18:12 +01:00
Cal Herries
3dcae2fc17 Add api-changelog.md (#38658) 2024-02-12 15:17:52 +02:00
Nicolò Pretto
5165eec277 should make test pass in release when we have a specific version in t… (#38655)
* should make test pass in release when we have a specific version in the url

* fix eslint error
2024-02-12 14:05:51 +01:00
Kamil Mielnik
26779d30a1 Type routing in State (#38645)
* Add routing to State

* Introduce getLocation selector

* Shorten code

* Do not export local selector

* Update frontend/src/metabase/selectors/routing.ts

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

---------

Co-authored-by: Uladzimir Havenchyk <125459446+uladzimirdev@users.noreply.github.com>
2024-02-12 19:54:18 +07:00
8958 changed files with 1169249 additions and 422367 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,200 +0,0 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]))
(defn- node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(let [resolved (hooks/resolve {:name sexpr})]
(when-not (= :clj-kondo/unknown-namespace (:ns resolved))
(symbol (name (:ns resolved)) (name (:name resolved))))))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(def ^:private white-card-symbols
'#{;; these toucan methods might actually set global values if it's used outside of a transaction,
;; but since mt/with-temp runs in a transaction, so we'll ignore them in this case.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/>!!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions/perform-action!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.api.public-test/add-card-to-dashboard!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.core/ensure-audit-db-installed!
metabase.db.schema-migrations-test.impl/run-migrations-in-range!
metabase.db.setup/migrate!
metabase.db.setup/setup-db!
metabase.db/setup-db!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.email-test/reset-inbox!
metabase.email/send-email!
metabase.models.action/insert!
metabase.models.collection.graph-test/clear-graph-revisions!
metabase.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.models.field-values/create-or-update-full-field-values!
metabase.models.model-index/add-values!
metabase.models.moderation-review/create-review!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.models.permissions/grant-application-permissions!
metabase.models.permissions/grant-collection-read-permissions!
metabase.models.permissions/grant-collection-readwrite-permissions!
metabase.models.permissions/grant-full-data-permissions!
metabase.models.permissions/grant-native-readwrite-permissions!
metabase.models.permissions/grant-permissions!
metabase.models.permissions/revoke-application-permissions!
metabase.models.permissions/revoke-data-perms!
metabase.models.permissions/update-data-perms-graph!
metabase.models.permissions/update-group-permissions!
metabase.models.persisted-info/ready-database!
metabase.models.revision/revert!
metabase.models.setting-test/test-user-local-allowed-setting!
metabase.models.setting-test/test-user-local-only-setting!
metabase.models.setting.cache/restore-cache!
metabase.models.setting/set!
metabase.models.setting/validate-settings-formatting!
metabase.permissions.test-util/with-restored-perms!
metabase.pulse/send-notifications!
metabase.pulse/send-pulse!
metabase.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data/try-to-extract-sample-database!
metabase.setup/create-token!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.sync/sync-database!
metabase.task.index-values/job-init!
metabase.task.persist-refresh/job-init!
metabase.task.persist-refresh/refresh-tables!
metabase.task.persist-refresh/schedule-persistence-for-database!
metabase.task/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-test-data-db!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.integrations.ldap/start-ldap-server!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.util.ssh-test/start-mock-servers!
metabase.util.ssh-test/stop-mock-servers!})
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node}]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
(f form)
(doseq [child (:children form)]
(walk f child)))]
(walk (fn [form]
(when-let [qualified-symbol (node->qualified-symbol form)]
(when (and (not (contains? white-card-symbols qualified-symbol))
(end-with-exclamation? qualified-symbol))
(hooks/reg-finding! (assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`."
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))
node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))

View File

@@ -1,371 +0,0 @@
(ns hooks.common
(:require [clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
as the current version of kondo will use the whole form by default."
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-node)))))
;;; This stuff is to help debug hooks. Trace a function and it will pretty-print the before & after sexprs.
;;;
;;; (hooks.common/trace #'calculate-bird-scarcity)
(defn- trace* [f]
{:pre [(fn? f)]}
(fn traced-fn [node]
(println \newline)
(clojure.pprint/pprint (hooks/sexpr (:node node)))
(let [node* (f node)]
(println '=>)
(clojure.pprint/pprint (hooks/sexpr (:node node*)))
node*)))
;;; this doesn't seem to work with SCI. Use [[defn-traced]] instead.
;; (defn trace [varr]
;; {:pre [(var? varr)]}
;; (when-not (::traced? (meta varr))
;; (alter-var-root varr trace*)
;; (alter-meta! varr assoc ::traced? true)
;; (println "Traced" varr)))
(defmacro defn-traced
"Replace a hook [[defn]] with this to trace the before and after sexprs."
[fn-name & fn-tail]
`(do
(defn fn# ~@fn-tail)
(def ~fn-name (trace* fn#))))
;;;; Common hook definitions
(defn do*
"This is the same idea as [[clojure.core/do]] but doesn't cause Kondo to complain about redundant dos or unused values."
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(for [arg args]
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(with-meta (meta node)))]
{:node node*}))
(defn with-one-binding
"Helper for macros that have a shape like
(my-macro [x]
...)
=>
(let [x nil]
...)
Binding is optional and `_` will be substituted if not supplied."
[{{[_ {[x] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-bindings
"Helper for macros that have a shape like
(my-macro [x y]
...)
=>
(let [x nil, y nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-three-bindings
"Helper for macros that have a shape like
(my-macro [x y z]
...)
=>
(let [x nil, y nil, z nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y z] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)
(or z (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-four-bindings
"Helper for macros that have a shape like
(my-macro [a b c d]
...)
=>
(let [a nil, b nil, c nil, d nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-five-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-six-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-seven-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f g]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil, g nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f g] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)
(or g (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-one-top-level-binding
"Helper for macros that have a shape like
(my-macro x
...)
=>
(let [x nil]
...)"
[{{[_ x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-top-level-bindings
"Helper for macros that have a shape like
(my-macro x y
...)
=>
(let [x nil, y nil]
...)"
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)
y (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn let-one-with-optional-value
"This is exactly like [[clojure.core/let]] but the right-hand side of the binding, `value`, is optional, and only one
binding can be established.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {[binding value] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[binding (or value (hooks/token-node 'nil))])
body))]
{:node node*}))
(defn- let-second-inner [body bindings]
(let [binding-infos (for [[model {[binding value] :children}] (partition 2 bindings)]
{:model model
:binding binding
:value (or value
(hooks/token-node 'nil))})]
(-> (hooks/vector-node
[(hooks/vector-node (map :model binding-infos))
(-> (hooks/list-node (list* (hooks/token-node `let)
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(with-meta (meta body)))])
(with-meta (meta body)))))
(defn let-second
"Helper for macros that have a shape like
(my-macro x [y]
...)
where the let is for second arg.
=>
(let [y nil]
...)"
[{:keys [node]}]
(let [[_ first-arg-ref binding+opts & body] (:children node)]
{:node (let-second-inner body [first-arg-ref binding+opts])}))
(defn let-with-optional-value-for-last-binding
"This is exactly like [[clojure.core/let]] but the right-hand side of the *last* binding, `value`, is optional.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {bindings :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
(into []
(comp (partition-all 2)
(mapcat (fn [[binding value]]
[binding (or value (hooks/token-node 'nil))])))
bindings))
body))]
{:node node*}))
(defn with-ignored-first-arg
"For macros like
(discard-setting-changes [setting-1 setting-2]
...)
=>
(do ...)
where the first arg ought to be ignored for linting purposes."
[{{[_ _x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'do)
body))]
{:node node*}))
(defn with-used-first-arg
"For macros like
(with-drivers (filter pred? some-drivers)
...)
=>
(let [_1234 (filter pred? some-drivers)]
...)
where the first arg should be linted and appear to be used."
[{{[_ arg & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
{:node node*}))

View File

@@ -1,29 +0,0 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as str]
[hooks.common :as common]))
(defn route-fn-name
"route fn hook"
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defn defendpoint
"defendpoint hook"
[{:keys [node]}]
(let [[method route & body] (rest (:children node))]
{:node
(hooks/vector-node [;; register usage of compojure core var
(common/with-macro-meta (hooks/token-node (symbol (str "compojure.core")
(str method)))
node)
;; define function with route-fn-name
(hooks/list-node
(list* (common/with-macro-meta (hooks/token-node 'clojure.core/defn)
node)
(route-fn-name (hooks/sexpr method) (hooks/sexpr route))
body))])}))

View File

@@ -1,68 +0,0 @@
(ns hooks.metabase.mbql.schemas.macros
(:require [clj-kondo.hooks-api :as hooks]))
(defn- unwrap-defclause-clause-name
"The `clause-name-form` can be either a plain symbol, or a vector like `[var-name mbql-clause-name]`. For the vector
form, we are only interested in the `var-name`. For a plain symbol, the two names are the same. Return a token node."
[clause-name-form]
(-> (if (hooks/vector-node? clause-name-form)
(first (:children clause-name-form))
clause-name-form)
(with-meta (meta clause-name-form))))
(defn- collect-defclause-body-schemas
"Collect the argument schemas in the body of a `defclause` form into a vector node.
The body is a sequence of <argument-name> <argument-schema> pairs. We can ignore the argument names.
<argument-schema> can optionally be wrapped be `(optional ...)` or `(rest ...)`... we can ignore these."
[arg-specs]
(hooks/vector-node
(for [[_arg-name arg-schema] (partition-all 2 arg-specs)
:let [arg-schema (if (and (hooks/list-node? arg-schema)
('#{optional rest} (hooks/sexpr (first (:children arg-schema)))))
(-> (second (:children arg-schema))
(with-meta (meta arg-schema)))
arg-schema)]]
arg-schema)))
(defn defclause
"e.g.
(defclause [ag:var var] field-or-expression FieldOrExpressionDef)
=>
(def ag:var [FieldOrExpressionDef])"
[{:keys [node]}]
(let [[_defclause clause-name-form & arg-specs] (:children node)]
{:node (-> (hooks/list-node
(list
(hooks/token-node 'def)
(unwrap-defclause-clause-name clause-name-form)
(hooks/string-node "Docstring.")
(collect-defclause-body-schemas arg-specs)))
(with-meta (meta node)))}))
(comment
(defn- defclause* [form]
(hooks/sexpr
(:node
(defclause
{:node
(hooks/parse-string
(with-out-str
(clojure.pprint/pprint
form)))}))))
(defn- x []
(defclause* '(defclause [ag:var var]
field-or-expression FieldOrExpressionDef)))
;; =>
(def ag:var "Docstring." [FieldOrExpressionDef])
(defn- y []
(defclause* '(defclause var
x (some-list-schema)
y (optional FieldOrExpressionDef)
z (rest (some-other-schema)))))
;; =>
(def var "Docstring." [(some-list-schema) FieldOrExpressionDef (some-other-schema)]))

View File

@@ -1,5 +1,7 @@
(ns macros.metabase.api.common)
(defmacro define-routes [& args]
(defmacro define-routes
"Macro for api.common/define-routes"
[& args]
`(do (def ~'routes "docstring" nil)
~@args))

View File

@@ -1,16 +0,0 @@
(ns macros.metabase.domain-entities.malli)
(defmacro define-getters-and-setters [schema & defs]
`(do
(comment ~schema) ;; Reference the schema
~@(for [[sym _path] (partition 2 defs)]
`(do
(defn ~(vary-meta sym
assoc :export true)
"docs" [_x#] nil)
(defn ~(vary-meta (symbol (str "with-" (name sym)))
assoc :export true)
"docs" [x# _new#] x#)
(defn ~(vary-meta (symbol (str (name sym) "-js"))
assoc :export true)
"docs" [x#] x#)))))

View File

@@ -0,0 +1,9 @@
(ns macros.metabase.models.query-field-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
`(let [~(macros.common/ignore-unused 'card-id) 1
~(macros.common/ignore-unused 'table-id) 2
~(macros.common/ignore-unused 'tax-id) 3
~(macros.common/ignore-unused 'total-id) 4]
~@body))

View File

@@ -0,0 +1,12 @@
(ns macros.metabase.task.setup.query-analysis-setup
(:require [macros.common]))
(defmacro with-test-setup!
"Set up the data required to test the Query Analysis related tasks"
[& body]
`(let [~(macros.common/ignore-unused 'c1) 1
~(macros.common/ignore-unused 'c2) 2
~(macros.common/ignore-unused 'c3) 3
~(macros.common/ignore-unused 'c4) 4
~(macros.common/ignore-unused 'arch) 5]
~@body))

View File

@@ -0,0 +1,16 @@
(ns macros.metabase.xrays.domain-entities.malli)
(defmacro define-getters-and-setters [schema & defs]
`(do
(comment ~schema) ;; Reference the schema
~@(for [[sym _path] (partition 2 defs)]
`(do
(defn ~(vary-meta sym
assoc :export true)
"docs" [_x#] nil)
(defn ~(vary-meta (symbol (str "with-" (name sym)))
assoc :export true)
"docs" [x# _new#] x#)
(defn ~(vary-meta (symbol (str (name sym) "-js"))
assoc :export true)
"docs" [x#] x#)))))

View File

@@ -0,0 +1,6 @@
(ns macros.metabase-enterprise.advanced-permissions.api.util-test
(:require [macros.common]))
(defmacro with-impersonations! [impersonations-and-attributes-map & body]
`(let [~(macros.common/ignore-unused '&group) ~impersonations-and-attributes-map]
~@body))

View File

@@ -0,0 +1,11 @@
(ns macros.metabase-enterprise.query-reference-validation.api-test
(:require [macros.common]))
(defmacro with-test-setup [& body]
`(let [~(macros.common/ignore-unused 'card-1) 1
~(macros.common/ignore-unused 'card-2) 2
~(macros.common/ignore-unused 'card-3) 3
~(macros.common/ignore-unused 'card-4) 4
~(macros.common/ignore-unused 'coll-2) 100
~(macros.common/ignore-unused 'coll-3) 200]
~@body))

View File

@@ -1,6 +1,6 @@
(ns macros.metabase-enterprise.sandbox.test-util
(:require [macros.common]))
(defmacro with-gtaps [gtaps-definition & body]
(defmacro with-gtaps! [gtaps-definition & body]
`(let [~(macros.common/ignore-unused '&group) ~gtaps-definition]
~@body))

View File

@@ -0,0 +1,329 @@
(ns hooks.clojure.core
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.set :as set]
[clojure.string :as str]))
(defn- node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(let [resolved (hooks/resolve {:name sexpr})]
(when-not (= :clj-kondo/unknown-namespace (:ns resolved))
(symbol (name (:ns resolved)) (name (:name resolved))))))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(def ^:private symbols-allowed-in-fns-not-ending-in-an-exclamation-point
'#{;; these toucan methods might actually set global values if it's used outside of a transaction,
;; but since mt/with-temp runs in a transaction, so we'll ignore them in this case.
toucan2.core/delete!
toucan2.core/update!
toucan2.core/insert!
toucan2.core/insert-returning-instance!
toucan2.core/insert-returning-instances!
toucan2.core/insert-returning-pk!
toucan2.core/insert-returning-pks!
clojure.core.async/<!!
clojure.core.async/>!!
clojure.core.async/alts!!
clojure.core.async/close!
clojure.core.async/poll!
clojure.core.memoize/memo-clear!
clojure.core/conj!
clojure.core/persistent!
clojure.core/reset!
clojure.core/swap!
clojure.core/volatile!
clojure.core/vreset!
clojure.core/vswap!
clojure.java.jdbc/execute!
methodical.core/add-aux-method-with-unique-key!
methodical.core/remove-aux-method-with-unique-key!
next.jdbc/execute!
;; Definitely thread safe
metabase.test.util.dynamic-redefs/patch-vars!
;; TODO: most of these symbols shouldn't be here, we should go through them and
;; find the functions/macros that use them and make sure their names end with !
;; best way to do this is try remove each of these and rely on kondo output to find places where it's used
clojure.test/grant-collection-perms!
clojure.test/grant-collection-perms-fn!
clojure.test/grant-perms-fn!
clojure.test/purge-old-entries!
clojure.test/revoke-collection-perms!
clojure.test/save-results!
metabase-enterprise.advanced-permissions.models.permissions/update-db-download-permissions!
metabase-enterprise.internal-user/install-internal-user!
metabase-enterprise.sso.integrations.saml-test/call-with-login-attributes-cleared!
metabase.actions/perform-action!
metabase.analytics.snowplow-test/fake-track-event-impl!
metabase.analytics.snowplow/track-event-impl!
metabase.api.public-test/add-card-to-dashboard!
metabase.cmd.dump-to-h2/dump-to-h2!
metabase.cmd.load-from-h2/load-from-h2!
metabase.core/ensure-audit-db-installed!
metabase.db.schema-migrations-test.impl/run-migrations-in-range!
metabase.db.setup/migrate!
metabase.db.setup/setup-db!
metabase.db/migrate!
metabase.db/setup-db!
metabase.driver.mongo-test/create-database-from-row-maps!
metabase.driver.postgres-test/create-enums-db!
metabase.driver.postgres-test/drop-if-exists-and-create-db!
metabase.driver.sql-jdbc.execute/execute-statement!
metabase.email-test/reset-inbox!
metabase.email/send-email!
metabase.models.action/insert!
metabase.models.collection.graph-test/clear-graph-revisions!
metabase.models.collection.graph-test/do-with-n-temp-users-with-personal-collections!
metabase.models.field-values/create-or-update-full-field-values!
metabase.models.model-index/add-values!
metabase.models.moderation-review/create-review!
metabase.models.on-demand-test/add-dashcard-with-parameter-mapping!
metabase.models.permissions/grant-application-permissions!
metabase.models.permissions/grant-collection-read-permissions!
metabase.models.permissions/grant-collection-readwrite-permissions!
metabase.models.permissions/grant-full-data-permissions!
metabase.models.permissions/grant-native-readwrite-permissions!
metabase.models.permissions/grant-permissions!
metabase.models.permissions/revoke-application-permissions!
metabase.models.permissions/revoke-data-perms!
metabase.models.permissions/update-data-perms-graph!
metabase.models.permissions/update-group-permissions!
metabase.models.persisted-info/ready-database!
metabase.models.revision/revert!
metabase.models.setting-test/test-user-local-allowed-setting!
metabase.models.setting-test/test-user-local-only-setting!
metabase.models.setting.cache/restore-cache!
metabase.models.setting/set!
metabase.models.setting/validate-settings-formatting!
metabase.permissions.test-util/with-restored-perms!
metabase.pulse/send-notifications!
metabase.pulse/send-pulse!
metabase.query-processor.streaming.interface/begin!
metabase.query-processor.streaming.interface/finish!
metabase.query-processor.streaming.interface/write-row!
metabase.sample-data/try-to-extract-sample-database!
metabase.setup/create-token!
metabase.sync.sync-metadata.fields.sync-metadata/update-field-metadata-if-needed!
metabase.sync.sync-metadata/sync-db-metadata!
metabase.sync.util-test/sync-database!
metabase.sync.util/store-sync-summary!
metabase.sync/sync-database!
metabase.task.index-values/job-init!
metabase.task.persist-refresh/job-init!
metabase.task.persist-refresh/refresh-tables!
metabase.task.persist-refresh/schedule-persistence-for-database!
metabase.task/delete-task!
metabase.test.data.bigquery-cloud-sdk/execute!
metabase.test.data.impl/copy-db-tables-and-fields!
metabase.test.data.impl/get-or-create-database!
metabase.test.data.impl/get-or-create-default-dataset!
metabase.test.data.impl.get-or-create/set-test-db-permissions!
metabase.test.data.interface/create-db!
metabase.test.data.interface/destroy-db!
metabase.test.data.oracle/create-user!
metabase.test.data.oracle/drop-user!
metabase.test.data.sql-jdbc.load-data/make-insert!
metabase.test.data.users/clear-cached-session-tokens!
metabase.test.initialize/do-initialization!
metabase.test.initialize/initialize-if-needed!
metabase.test.integrations.ldap/start-ldap-server!
metabase.test.util.log/ensure-unique-logger!
metabase.test.util.log/set-ns-log-level!
metabase.test.util/do-with-temp-env-var-value!
metabase.test.util/restore-raw-setting!
metabase.test.util/upsert-raw-setting!
metabase.test/initialize-if-needed!
metabase.test/test-helpers-set-global-values!
metabase.test/with-temp-env-var-value!
metabase.upload-test/set-local-infile!
metabase.util.files/create-dir-if-not-exists!
metabase.util.ssh-test/start-mock-servers!
metabase.util.ssh-test/stop-mock-servers!})
(defn- end-with-exclamation?
[s]
(str/ends-with? s "!"))
(defn- non-thread-safe-form-should-end-with-exclamation*
[{[defn-or-defmacro form-name] :children, :as node}]
(when-not (and (:string-value form-name)
(end-with-exclamation? (:string-value form-name)))
(letfn [(walk [f form]
(f form)
(doseq [child (:children form)]
(walk f child)))]
(walk (fn [form]
(when-let [qualified-symbol (node->qualified-symbol form)]
(when (and (not (contains? symbols-allowed-in-fns-not-ending-in-an-exclamation-point qualified-symbol))
(end-with-exclamation? qualified-symbol))
(hooks/reg-finding! (assoc (meta form-name)
:message (format "The name of this %s should end with `!` because it contains calls to non thread safe form `%s`."
(:string-value defn-or-defmacro) qualified-symbol)
:type :metabase/test-helpers-use-non-thread-safe-functions)))))
node))
node))
(defn non-thread-safe-form-should-end-with-exclamation
"Used to ensure defn and defmacro in test namespace to have name ending with `!` if it's non-thread-safe.
A function or a macro can be defined as 'not thread safe' when their funciton name ends with a `!`.
Only used in tests to identify thread-safe/non-thread-safe test helpers. See #37126"
[{:keys [node cljc lang]}]
(when (or (not cljc)
(= lang :clj))
(non-thread-safe-form-should-end-with-exclamation* node))
{:node node})
(comment
(require '[clj-kondo.core :as clj-kondo])
(def form (str '(defmacro a
[x]
`(fun-call x))))
(def form "(defmacro a
[x]
`(some! ~x))")
(def form "(defun f
[x]
(let [g! (fn [] 1)]
(g!)))")
(str (hooks/parse-string form))
(hooks/sexpr (hooks/parse-string form))
(binding [hooks/*reload* true]
(-> form
(with-in-str (clj-kondo/run! {:lint ["-"]}))
:findings))
(do (non-thread-safe-form-should-end-with-exclamation* (hooks/parse-string form)) nil))
(defn- ns-form-node->require-node [ns-form-node]
(some (fn [node]
(when (and (hooks/list-node? node)
(let [first-child (first (:children node))]
(and (hooks/keyword-node? first-child)
(= (hooks/sexpr first-child) :require))))
node))
(:children ns-form-node)))
(defn- lint-require-shapes [ns-form-node]
(doseq [node (-> ns-form-node
ns-form-node->require-node
:children
rest)]
(cond
(not (hooks/vector-node? node))
(hooks/reg-finding! (assoc (meta node)
:message "All :required namespaces should be wrapped in vectors [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker))
(hooks/vector-node? (second (:children node)))
(hooks/reg-finding! (assoc (meta node)
:message "Don't use prefix forms inside :require [:metabase/require-shape-checker]"
:type :metabase/require-shape-checker)))))
(defn- require-node->namespace-symb-nodes [require-node]
(let [[_ns & args] (:children require-node)]
(into []
;; prefixed namespace forms are NOT SUPPORTED!!!!!!!!1
(keep (fn [node]
(cond
(hooks/vector-node? node)
;; propagate the metadata attached to this vector in case there's a `:clj-kondo/ignore` form.
(vary-meta (first (:children node)) (partial merge (meta require-node) (meta node)))
;; this should also be dead code since we require requires to be vectors
(hooks/token-node? node)
(vary-meta node (partial merge (meta require-node)))
:else
(printf "Don't know how to figure out what namespace is being required in %s\n" (pr-str node)))))
args)))
(defn- ns-form-node->ns-symb [ns-form-node]
(some-> (some (fn [node]
(when (and (hooks/token-node? node)
(not= (hooks/sexpr node) 'ns))
node))
(:children ns-form-node))
hooks/sexpr))
(defn- module
"E.g.
(module 'metabase.qp.middleware.wow) => 'metabase.qp"
[ns-symb]
(some-> (re-find #"^metabase\.[^.]+" (str ns-symb)) symbol))
(defn- ignored-namespace? [ns-symb config]
(some
(fn [pattern-str]
(re-find (re-pattern pattern-str) (str ns-symb)))
(:ignored-namespace-patterns config)))
(defn- module-api-namespaces
"Set API namespaces for a given module. `:any` means you can use anything, there are no API namespaces for this
module (yet). If unspecified, the default is just the namespace with the same name as the module e.g.
`metabase.db`."
[module config]
(let [module-config (get-in config [:api-namespaces module])]
(cond
(= module-config :any)
nil
(set? module-config)
module-config
:else
#{module})))
(defn- lint-modules [ns-form-node config]
(let [ns-symb (ns-form-node->ns-symb ns-form-node)]
(when-not (ignored-namespace? ns-symb config)
(when-let [current-module (module ns-symb)]
(let [allowed-modules (get-in config [:allowed-modules current-module])
required-namespace-symb-nodes (-> ns-form-node
ns-form-node->require-node
require-node->namespace-symb-nodes)]
(doseq [node required-namespace-symb-nodes
:let [clj-kondo-ignore (some-> (meta node) :clj-kondo/ignore hooks/sexpr set)]
:when (not (contains? clj-kondo-ignore :metabase/ns-module-checker))
:let [required-namespace (hooks/sexpr node)
required-module (module required-namespace)]
;; ignore stuff not in a module i.e. non-Metabase stuff.
:when required-module
:let [in-current-module? (= required-module current-module)]
:when (not in-current-module?)
:let [allowed-module? (or (= allowed-modules :any)
(contains? (set allowed-modules) required-module))
module-api-namespaces (module-api-namespaces required-module config)
allowed-module-namespace? (or (empty? module-api-namespaces)
(contains? module-api-namespaces required-namespace))]]
(when-let [error (cond
(not allowed-module?)
(format "Module %s should not be used in the %s module. [:metabase/ns-module-checker :allowed-modules %s]"
required-module
current-module
current-module)
(not allowed-module-namespace?)
(format "Namespace %s is not an allowed external API namespace for the %s module. [:metabase/ns-module-checker :api-namespaces %s]"
required-namespace
required-module
required-module))]
(hooks/reg-finding! (assoc (meta node)
:message error
:type :metabase/ns-module-checker)))))))))
(defn lint-ns [x]
(lint-require-shapes (:node x))
(lint-modules (:node x) (get-in x [:config :linters :metabase/ns-module-checker]))
x)

View File

@@ -1,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
@@ -8,11 +10,11 @@
'#{clojure.core/alter-var-root
clojure.core/with-redefs
clojure.core/with-redefs-fn
metabase-enterprise.sandbox.test-util/with-gtaps
metabase-enterprise.sandbox.test-util/with-gtaps-for-user
metabase-enterprise.sandbox.test-util/with-gtaps!
metabase-enterprise.sandbox.test-util/with-gtaps-for-user!
metabase-enterprise.sandbox.test-util/with-user-attributes
metabase-enterprise.test/with-gtaps
metabase-enterprise.test/with-gtaps-for-user
metabase-enterprise.test/with-gtaps!
metabase-enterprise.test/with-gtaps-for-user!
metabase-enterprise.test/with-user-attributes
metabase.actions.test-util/with-actions
metabase.actions.test-util/with-actions-disabled
@@ -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,20 +107,9 @@
clojure.core.async/to-chan!
clojure.core.async/to-chan!!
metabase.driver.sql-jdbc.execute/execute-prepared-statement!
metabase.query-processor/process-query-and-save-execution!
metabase.query-processor/process-query-and-save-with-max-results-constraints!
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]
@@ -129,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

@@ -0,0 +1,409 @@
(ns hooks.common
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.pprint]))
(defn with-macro-meta
"When introducing internal nodes (let, defn, etc) it is important to provide a meta of an existing token
as the current version of kondo will use the whole form by default."
[new-node hook-node]
(with-meta new-node (meta (first (:children hook-node)))))
;;; This stuff is to help debug hooks. Trace a function and it will pretty-print the before & after sexprs.
;;;
;;; (hooks.common/trace #'calculate-bird-scarcity)
(defn- trace* [f]
{:pre [(fn? f)]}
(fn traced-fn [node]
(println \newline)
(clojure.pprint/pprint (hooks/sexpr (:node node)))
(let [node* (f node)]
(println '=>)
(clojure.pprint/pprint (hooks/sexpr (:node node*)))
node*)))
;;; this doesn't seem to work with SCI. Use [[defn-traced]] instead.
;; (defn trace [varr]
;; {:pre [(var? varr)]}
;; (when-not (::traced? (meta varr))
;; (alter-var-root varr trace*)
;; (alter-meta! varr assoc ::traced? true)
;; (println "Traced" varr)))
(defmacro defn-traced
"Replace a hook [[defn]] with this to trace the before and after sexprs."
[fn-name & fn-tail]
`(do
(defn fn# ~@fn-tail)
(def ~fn-name (trace* fn#))))
;;;; Common hook definitions
(defn do*
"This is the same idea as [[clojure.core/do]] but doesn't cause Kondo to complain about redundant dos or unused values."
[{{[_ & args] :children, :as node} :node}]
(let [node* (-> (hooks/list-node
(list*
(with-meta (hooks/token-node 'do) {:clj-kondo/ignore [:redundant-do]})
(for [arg args]
(vary-meta arg update :clj-kondo/ignore #(conj (vec %) :unused-value)))))
(with-meta (meta node)))]
{:node node*}))
(defn with-one-binding
"Helper for macros that have a shape like
(my-macro [x]
...)
=>
(let [x nil]
...)
Binding is optional and `_` will be substituted if not supplied."
[{{[_ {[x] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-bindings
"Helper for macros that have a shape like
(my-macro [x y]
...)
=>
(let [x nil, y nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-three-bindings
"Helper for macros that have a shape like
(my-macro [x y z]
...)
=>
(let [x nil, y nil, z nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[x y z] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or x (hooks/token-node '_)) (hooks/token-node 'nil)
(or y (hooks/token-node '_)) (hooks/token-node 'nil)
(or z (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-four-bindings
"Helper for macros that have a shape like
(my-macro [a b c d]
...)
=>
(let [a nil, b nil, c nil, d nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-five-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-six-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-seven-bindings
"Helper for macros that have a shape like
(my-macro [a b c d e f g]
...)
=>
(let [a nil, b nil, c nil, d nil, e nil, f nil, g nil]
...)
All bindings are optional and `_` will be substituted if not supplied."
[{{[_ {[a b c d e f g] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[(or a (hooks/token-node '_)) (hooks/token-node 'nil)
(or b (hooks/token-node '_)) (hooks/token-node 'nil)
(or c (hooks/token-node '_)) (hooks/token-node 'nil)
(or d (hooks/token-node '_)) (hooks/token-node 'nil)
(or e (hooks/token-node '_)) (hooks/token-node 'nil)
(or f (hooks/token-node '_)) (hooks/token-node 'nil)
(or g (hooks/token-node '_)) (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-one-top-level-binding
"Helper for macros that have a shape like
(my-macro x
...)
=>
(let [x nil]
...)"
[{{[_ x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn with-two-top-level-bindings
"Helper for macros that have a shape like
(my-macro x y
...)
=>
(let [x nil, y nil]
...)"
[{{[_ x y & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[x (hooks/token-node 'nil)
y (hooks/token-node 'nil)])
body))]
{:node node*}))
(defn let-one-with-optional-value
"This is exactly like [[clojure.core/let]] but the right-hand side of the binding, `value`, is optional, and only one
binding can be established.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {[binding value] :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
[binding (or value (hooks/token-node 'nil))])
body))]
{:node node*}))
(defn- let-second-inner [body bindings]
(let [binding-infos (for [[model {[binding value] :children}] (partition 2 bindings)]
{:model model
:binding binding
:value (or value
(hooks/token-node 'nil))})]
(-> (hooks/vector-node
[(hooks/vector-node (map :model binding-infos))
(-> (hooks/list-node (list* (hooks/token-node `let)
(hooks/vector-node (mapcat (juxt :binding :value) binding-infos))
body))
(with-meta (meta body)))])
(with-meta (meta body)))))
(defn let-second
"Helper for macros that have a shape like
(my-macro x [y]
...)
where the let is for second arg.
=>
(let [y nil]
...)"
[{:keys [node]}]
(let [[_ first-arg-ref binding+opts & body] (:children node)]
{:node (let-second-inner body [first-arg-ref binding+opts])}))
(defn let-with-optional-value-for-last-binding
"This is exactly like [[clojure.core/let]] but the right-hand side of the *last* binding, `value`, is optional.
(some-macro [x] ...)
=>
(let [x nil] ...)
(some-macro [x 100] ...)
=>
(let [x 100] ...)"
[{{[_ {bindings :children} & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node
(into []
(comp (partition-all 2)
(mapcat (fn [[binding value]]
[binding (or value (hooks/token-node 'nil))])))
bindings))
body))]
{:node node*}))
(defn with-ignored-first-arg
"For macros like
(discard-setting-changes [setting-1 setting-2]
...)
=>
(do ...)
where the first arg ought to be ignored for linting purposes."
[{{[_ _x & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'do)
body))]
{:node node*}))
(defn with-used-first-arg
"For macros like
(with-drivers (filter pred? some-drivers)
...)
=>
(let [_1234 (filter pred? some-drivers)]
...)
where the first arg should be linted and appear to be used."
[{{[_ arg & body] :children} :node}]
(let [node* (hooks/list-node
(list*
(hooks/token-node 'let)
(hooks/vector-node [(hooks/token-node (gensym "_"))
arg])
body))]
{:node node*}))
(defn node->qualified-symbol [node]
(try
(when (hooks/token-node? node)
(let [sexpr (hooks/sexpr node)]
(when (symbol? sexpr)
(let [resolved (hooks/resolve {:name sexpr})]
(cond
(and resolved (:ns resolved))
(symbol (name (:ns resolved)) (name (:name resolved)))
;; if it wasn't resolved but is still qualified it's probably using the full namespace name rather than an
;; alias.
(qualified-symbol? sexpr)
sexpr)))))
;; some symbols like `*count/Integer` aren't resolvable.
(catch Exception _
nil)))
(defn format-string-specifier-count
"Number of things like `%s` in a format string, not counting newlines (`%n`) or escaped percent signs (`%%`). For
checking the number of args to something that takes a format string."
[format-string]
(count (re-seq #"(?<!%)%(?![%n])" format-string)))
(comment
;; should be 1
(format-string-specifier-count "%s %%")
;; should be 2
(format-string-specifier-count "%s %%%n%s")
;; should be 0
(format-string-specifier-count "%n%%%%")
;; should be 1
(format-string-specifier-count "%-02d"))

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

@@ -0,0 +1,69 @@
(ns hooks.metabase.legacy-mbql.schemas.macros
(:require
[clj-kondo.hooks-api :as hooks]))
(defn- unwrap-defclause-clause-name
"The `clause-name-form` can be either a plain symbol, or a vector like `[var-name mbql-clause-name]`. For the vector
form, we are only interested in the `var-name`. For a plain symbol, the two names are the same. Return a token node."
[clause-name-form]
(-> (if (hooks/vector-node? clause-name-form)
(first (:children clause-name-form))
clause-name-form)
(with-meta (meta clause-name-form))))
(defn- collect-defclause-body-schemas
"Collect the argument schemas in the body of a `defclause` form into a vector node.
The body is a sequence of <argument-name> <argument-schema> pairs. We can ignore the argument names.
<argument-schema> can optionally be wrapped be `(optional ...)` or `(rest ...)`... we can ignore these."
[arg-specs]
(hooks/vector-node
(for [[_arg-name arg-schema] (partition-all 2 arg-specs)
:let [arg-schema (if (and (hooks/list-node? arg-schema)
('#{optional rest} (hooks/sexpr (first (:children arg-schema)))))
(-> (second (:children arg-schema))
(with-meta (meta arg-schema)))
arg-schema)]]
arg-schema)))
(defn defclause
"e.g.
(defclause [ag:var var] field-or-expression FieldOrExpressionDef)
=>
(def ag:var [FieldOrExpressionDef])"
[{:keys [node]}]
(let [[_defclause clause-name-form & arg-specs] (:children node)]
{:node (-> (hooks/list-node
(list
(hooks/token-node 'def)
(unwrap-defclause-clause-name clause-name-form)
(hooks/string-node "Docstring.")
(collect-defclause-body-schemas arg-specs)))
(with-meta (meta node)))}))
(comment
(defn- defclause* [form]
(hooks/sexpr
(:node
(defclause
{:node
(hooks/parse-string
(with-out-str
(clojure.pprint/pprint
form)))}))))
(defn- x []
(defclause* '(defclause [ag:var var]
field-or-expression FieldOrExpressionDef)))
;; =>
(def ag:var "Docstring." [FieldOrExpressionDef])
(defn- y []
(defclause* '(defclause var
x (some-list-schema)
y (optional FieldOrExpressionDef)
z (rest (some-other-schema)))))
;; =>
(def var "Docstring." [(some-list-schema) FieldOrExpressionDef (some-other-schema)]))

View File

@@ -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
@@ -65,6 +63,7 @@
jwt-user-provisioning-enabled?
jwt-shared-secret
last-acknowledged-version
last-used-native-database-id
ldap-attribute-email
ldap-attribute-firstname
ldap-attribute-lastname
@@ -91,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
@@ -161,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,27 @@
(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 'mt/with-anaphora 1))
(eval . (put-clojure-indent 'prop/for-all 1))
(eval . (put-clojure-indent 'qp.streaming/streaming-response 1))
(eval . (put-clojure-indent 'tc/quick-check 1))
(eval . (put-clojure-indent 'u/profile 1))
(eval . (put-clojure-indent 'u/prog1 1))
(eval . (put-clojure-indent 'u/select-keys-when 1))
(eval . (put-clojure-indent 'with-meta '(:form)))
(eval . (put-clojure-indent 'tc/quick-check 1))
;; 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 +86,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)

View File

@@ -1,2 +1,4 @@
frontend/src/cljs
frontend/src/cljs_release
e2e/support/cypress_sample_database.js
e2e/support/cypress_sample_instance_data.js

216
.eslintrc
View File

@@ -1,216 +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",
{
"pathGroups": [
{
"pattern": "react",
"group": "builtin",
"position": "before"
},
{
"pattern": "metabase/**",
"group": "internal"
},
{
"pattern": "metabase/**/components",
"group": "internal",
"position": "before"
},
{
"pattern": "__**",
"group": "internal",
"position": "before"
},
{
"pattern": "metabase-lib/**",
"group": "internal",
"position": "after"
}
],
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object"
]
}
],
"no-console": [2, { "allow": ["warn", "error"] }],
"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"
}
},
{
"files": ["*.unit.spec.*", "frontend/src/metabase/admin/**/*"],
"rules": {
"no-unconditional-metabase-links-render": "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 }]
}
}
]
}

230
.eslintrc.js Normal file
View File

@@ -0,0 +1,230 @@
/* 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: "(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",
{
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
destructuredArrayIgnorePattern: "^_",
},
],
// This was introduced in 6.0.0
"@typescript-eslint/no-unsafe-declaration-merging": "off",
},
},
{
extends: [
"plugin:jest/recommended",
"plugin:jest-dom/recommended",
"plugin:testing-library/react",
],
plugins: ["jest", "jest-dom", "testing-library"],
files: [
"*.unit.spec.ts",
"*.unit.spec.tsx",
"*.unit.spec.js",
"*.unit.spec.jsx",
],
rules: {
"jest/valid-title": ["error", { ignoreTypeOfDescribeName: true }],
},
},
],
};

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
@@ -82,7 +82,6 @@ body:
label: Severity
description: |
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Metabase entirely?
_Note: the more honest and specific you are here the more we will take you seriously._
validations:
required: true

View File

@@ -17,7 +17,6 @@ A clear and concise description of what you want to happen.
A clear and concise description of any alternative solutions or features you've considered.
**How important is this feature to you?**
Note: the more honest and specific you are here the more we will take you seriously.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -1,5 +1,5 @@
> [!IMPORTANT]
> If you are merging into master, please add either a `backport` or a `no-backport` label to this PR. You will not be able to merge until you do this step. Refer to the section [Do I need to backport this PR?](https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#89f80d6f17714a0198aeb66c0efd1b71) in the Metabase Branching Strategy document for more details.
> For those employed by Metabase: if you are merging into master, please add either a `backport` or a `no-backport` label to this PR. You will not be able to merge until you do this step. Refer to the section [Do I need to backport this PR?](https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#89f80d6f17714a0198aeb66c0efd1b71) in the Metabase Branching Strategy document for more details. If you're not employed by Metabase, this section does not apply to you, and the label will be taken care of by your reviewer.
> **Warning**
>

View File

@@ -16,7 +16,6 @@ runs:
const java = 11;
const defaultRunner = "ubuntu-22.04";
const beefierRunner = "buildjet-2vcpu-ubuntu-2204";
const defaultOptions = {
"java-version": java,
@@ -36,8 +35,11 @@ runs:
["dashboard-cards", {} ],
["dashboard-filters", {} ],
["embedding", {} ],
["embedding-sdk", { context: "embedding-sdk" } ],
["filters", {} ],
["filters-reproductions", {}],
["joins", {} ],
["metrics", {} ],
["models", {} ],
["native", {} ],
["native-filters", {} ],
@@ -45,12 +47,14 @@ runs:
["organization", {} ],
["permissions", {} ],
["question", {} ],
["question-reproductions", {} ],
["search", {}],
["sharing", {} ],
["visualizations-charts", {} ],
["visualizations-tabular", {} ],
["oss-subset", { edition: 'oss', context: "special" } ],
["slow", { runner: beefierRunner, context: "special" } ],
["flaky", { runner: beefierRunner, context: "special" } ],
["slow", { context: "special" } ],
["flaky", { context: "special" } ],
["mongo", { context: "qa-database" } ],
];

View File

@@ -0,0 +1,67 @@
name: Cross-branch migration test
inputs:
base-ref:
required: true
runs:
using: "composite"
steps:
- name: Check out base branch
uses: actions/checkout@v4
with:
ref: ${{ inputs.base-ref }}
- name: Prepare backend environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: cross-branch-migrations
- name: Run backend on base branch
run: |
clojure -M:run:ee > metabase.log 2>&1 & echo $! > metabase_pid
tail -F metabase.log &
shell: bash
- name: Wait for Metabase to start
run: |
while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}' > /dev/null; do
if ! kill -0 $(cat metabase_pid) 2>/dev/null; then
cat metabase.log
echo "Metabase process has exited."
exit 1
fi
sleep 1
done
shell: bash
- name: Stop Metabase on base branch
run: kill $(cat metabase_pid)
shell: bash
- name: Check out pull request branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Run backend on pull request branch
run: |
clojure -M:run:ee > metabase.log 2>&1 & echo $! > metabase_pid
tail -F metabase.log &
shell: bash
- name: Wait for Metabase to start
run: |
while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}' > /dev/null; do
if ! kill -0 $(cat metabase_pid) 2>/dev/null; then
cat metabase.log
echo "Metabase process has exited. Check that your migration changes work on an instance that has been previously initialized on your PR's target branch."
exit 1
fi
sleep 1
done
shell: bash
- name: Stop Metabase on pull request branch
run: kill $(cat metabase_pid)
shell: bash

View File

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

@@ -1,12 +1,20 @@
name: Prepare cypress environment
description: Cypress preparation steps
outputs:
chrome-path:
description: Path to the custom Chrome executable
value: ${{ steps.setup-chrome.outputs.chrome-path }}
runs:
using: "composite"
steps:
- name: Install Replay.io browser
run: npx @replayio/cypress install
shell: bash
- name: Install Chrome v111
uses: browser-actions/setup-chrome@v1
with:
# https://chromium.cypress.io/linux/stable/111.0.5563.146
chrome-version: 1097615
id: setup-chrome
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}

View File

@@ -1,10 +1,15 @@
name: Prepare front-end environment
inputs:
node-version:
description: "The version of Node.js to use, overriding .nvmrc"
required: false
runs:
using: "composite"
steps:
- name: Prepare Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }} # this overrides, if present
node-version-file: ".nvmrc"
- name: Check to see if dependencies should be cached
if: ${{ contains(github.event.head_commit.message, '[ci nocache]') }}
@@ -23,6 +28,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

@@ -0,0 +1,33 @@
name: Run Embedding SDK Storybook
runs:
using: "composite"
steps:
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs
shell: bash
- name: Build Storybook
run: yarn build-storybook-embedding-sdk
shell: bash
- name: Serve Storybook
run: yarn http-server storybook-static -p 6006 &
shell: bash
- name: Wait for Storybook to become available
run: |
echo "Waiting for Storybook to be served..."
while ! curl --silent --fail http://localhost:6006; do
sleep 5
echo "Retrying..."
done
echo "Storybook is being served!"
shell: bash

17
.github/auto_request_review.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# The reviewers configuration for the auto_request_review workflow
# See https://github.com/necojackarc/auto-request-review/tree/master?tab=readme-ov-file#reviewers-configuration
# for the spec
files:
# migrations related files
'resources/migrations/**':
- team:core-backend-components
'src/metabase/db/custom_migrations.clj':
- team:core-backend-components
options:
ignore_draft: true
ignored_keywords:
- DO NOT REVIEW
- WIP
enable_group_assignment: false

View File

@@ -23,24 +23,34 @@ frontend_sources: &frontend_sources
- "**/tsconfig*.json"
- "package.json"
- "babel.config.json"
- ".eslintrc"
- ".eslintrc.js"
- "postcss.config.js"
- "webpack.config.js"
- "webpack.embedding-sdk.config.js"
- "webpack.static-viz.config.js"
- ".nvmrc"
frontend_specs: &frontend_specs
- *shared_specs
- "frontend/test/**"
- "frontend/**/tests/**"
- "frontend/**/*.unit.*"
- "jest.config.json"
- "jest.config.js"
- "jest.tz.unit.conf.json"
release_source: &release_sources
- "release/**"
frontend_all: &frontend_all
- *frontend_ci
- *frontend_sources
- *frontend_specs
frontend_loki_ci: &frontend_loki_ci
- ".github/workflows/loki.yml"
- ".loki/**"
- ".storybook/**"
backend_ci: &backend_ci
- ".github/actions/prepare-frontend/**"
- ".github/actions/prepare-backend/**"
@@ -93,10 +103,15 @@ e2e_ci: &e2e_ci
e2e_specs: &e2e_specs
- "**/*.cy.*.js"
- "**/*.cy.*.ts"
- "e2e/runner/**"
- "e2e/support/**"
- "e2e/snapshot*/**"
e2e_cross_version: &e2e_cross_version
- ".github/workflows/e2e-cross-version.yml"
- "e2e/test/scenarios/cross-version/**"
e2e_all:
- *default
- *e2e_ci

35
.github/team.json vendored
View File

@@ -3,11 +3,10 @@
{
"name": "Querying Components",
"label": ".Team/QueryingComponents",
"projectUrl": "https://github.com/orgs/metabase/projects/97/views/1",
"members": [
"ranquild",
"uladzimirdev",
"kamilmielnik",
"oleggromov",
"nemanjaglumac",
"romeovs"
]
@@ -15,16 +14,13 @@
{
"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",
"label": ".Team/BackendComponents",
"projectUrl": "https://github.com/orgs/metabase/projects/50/views/1",
"members": [
"tsmacdonald",
"qnkhuat",
@@ -36,13 +32,8 @@
{
"name": "Query Processor",
"label": ".Team/QueryProcessor",
"members": [
"camsaul",
"snoe",
"bshepherdson",
"metamben",
"lbrdnk"
]
"projectUrl": "https://github.com/orgs/metabase/projects/83/views/8",
"members": ["camsaul", "snoe", "bshepherdson", "metamben", "lbrdnk"]
},
{
"name": "Admin Webapp",
@@ -50,13 +41,11 @@
"members": [
"noahmoss",
"escherize",
"qwef",
"iethree",
"npfitz",
"shaunlebron",
"johnswanson",
"rafpaf",
"sloansparger"
"sloansparger",
"iethree"
]
},
{
@@ -67,9 +56,15 @@
"EmmadUsmani",
"JesseSDevaney",
"kulyk",
"markbastian",
"adam-james-v"
]
},
{
"name": "DevEx",
"label": ".Team/DevEx",
"members": [
"uladzimirdev"
]
}
]
}

View File

@@ -30,7 +30,7 @@ jobs:
const prNumber = context.payload.pull_request.number;
if (prAuthor.endsWith('[bot]')) {
return false;
return null;
}
// Assign PR author
@@ -44,7 +44,7 @@ jobs:
const team = teamConfig.teams.find(t => t.members.includes(prAuthor));
if (!team) {
console.log('You are not assigned to any team. If you need one, update .github/team.json');
return false;
return null;
}
try {
@@ -55,7 +55,7 @@ jobs:
});
} catch (e) {
console.log(`The label ${team.label} does not exist, create it first`);
return false;
return null;
}
// Add team label
@@ -66,9 +66,9 @@ jobs:
labels: [team.label]
});
return true;
return team.projectUrl || null;
- uses: actions/add-to-project@v0.5.0
if: ${{ fromJSON(steps.auto-assign.outputs.result) }}
if: ${{ steps.auto-assign.outputs.result != 'null' }}
with:
project-url: https://github.com/orgs/metabase/projects/50/views/1
project-url: ${{ steps.auto-assign.outputs.result }}
github-token: ${{ steps.generate-token.outputs.token }}

View File

@@ -11,11 +11,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: tibdex/github-app-token@v2.1.0
id: generate-token
with:
app_id: ${{ secrets.METABASE_BOT_APP_ID }}
private_key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- uses: ./.github/actions/find-squashed-commit
name: Find commit
id: find_commit
@@ -82,7 +78,7 @@ jobs:
TARGET_BRANCH: ${{ steps.get_latest_release_branch.outputs.branch-name }}
ORIGINAL_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
ORIGINAL_TITLE: ${{ github.event.pull_request.title }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
COMMIT: ${{ steps.find_commit.outputs.commit }}
- name: Auto approve backport PR
@@ -96,7 +92,7 @@ jobs:
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'false' }}
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ steps.generate-token.outputs.token }}
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
pull-request-number: ${{ steps.create_backport_pull_request.outputs.backport_pr_number }}
merge-method: squash

View File

@@ -0,0 +1,21 @@
# Config is in .github/auto_request_review.yml
name: Auto Request Review
on:
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
jobs:
auto-request-review:
# Don't run on forked repos
if: ${{ !github.event.pull_request.head.repo.fork }}
permissions:
contents: read
pull-requests: write
name: Auto Request Review
runs-on: ubuntu-latest
steps:
- name: Request review based on files changes and/or groups the author belongs to
uses: necojackarc/auto-request-review@v0.13.0
with:
token: '${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}'

27
.github/workflows/backend-cloverage.yml vendored Normal file
View File

@@ -0,0 +1,27 @@
name: Backend-Cloverage
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * 1-5' # every weekday at 5am US eastern time
jobs:
be-linter-cloverage:
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cloverage"
- name: Build static viz frontend
run: yarn build-static-viz
- name: Collect the test coverage
run: clojure -X:dev:ci:ee:ee-dev:test:cloverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/coverage/codecov.json
flags: back-end

View File

@@ -6,7 +6,7 @@ on:
- "master"
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
types: [opened, synchronize, reopened, ready_for_review, labeled]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
@@ -63,27 +63,6 @@ jobs:
token: ${{ github.token }}
filters: .github/static-viz-sources.yaml
be-linter-cloverage:
needs: files-changed
if: github.ref_name == 'master' && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cloverage"
- name: Build static viz frontend
run: yarn build-static-viz
- name: Collect the test coverage
run: clojure -X:dev:ci:ee:ee-dev:test:cloverage
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v3
with:
files: ./target/coverage/codecov.json
flags: back-end
be-linter-clj-kondo:
needs: [files-changed, static-viz-files-changed]
if: |
@@ -206,7 +185,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

@@ -13,6 +13,56 @@ on:
required: true
jobs:
start-message:
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send build start message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPreReleaseMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPreReleaseMessage({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
releaseSha: '${{ inputs.commit }}',
userName: '${{ github.actor }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
trigger-milestone-check:
runs-on: ubuntu-22.04
timeout-minutes: 5
needs: start-message
steps:
- name: trigger pre-release milestone check
uses: actions/github-script@v7
with:
script: | # js
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release-milestone-check.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
}
});
check-version:
runs-on: ubuntu-22.04
timeout-minutes: 10
@@ -85,7 +135,7 @@ jobs:
uses: actions/github-script@v7
id: release_branch
with:
result_encoding: string
result-encoding: string
script: | # js
const { getReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';

View File

@@ -1,80 +1,41 @@
name: Milestone Reminder
name: Automatically set milestone
run-name: Set milestone for ${{ github.event.head_commit.message }}
on:
pull_request:
types: [closed]
push:
branches:
- "master"
- release-x.**
jobs:
milestone-reminder:
if: github.event.pull_request.merged == true
name: Remind to set milestone
set-milestone:
name: Automatically set milestone
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
pull-requests: write
issues: read
issues: write
contents: read
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
ref: master # we want the logic from master, even though we're triggering on a release branch
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- uses: actions/github-script@v7
with:
script: | # js
const { setMilestoneForCommits } = require('${{ github.workspace }}/release/dist/index.cjs');
const owner = context.repo.owner;
const repo = context.repo.repo;
const pullNumber = '${{ github.event.pull_request.number }}';
const branchName = `${{ github.ref }}`;
const commitMessage = context?.payload?.head_commit?.message ?? '';
// the github API doesn't expose linked issues, so we have to parse the body ourselves
function getLinkedIssueId(pull) {
// https://regexr.com/7mjnp
const match = pull.data.body.match(/(\/issues\/|#)(\d+)/);
return match && match?.[2];
}
function getMilestone(pullOrIssue) {
// pull has pull.data.milestone, issue has issue.milestone
return pullOrIssue?.data?.milestone || pullOrIssue?.milestone;
}
const pull = await github.rest.pulls.get({
await setMilestoneForCommits({
github,
owner,
repo,
pull_number: pullNumber,
});
if (getMilestone(pull)) {
console.log("Pull request has milestone", pull.data.milestone?.title);
process.exit(0);
}
const issueId = getLinkedIssueId(pull);
if (issueId) {
console.log('linked issue found', issueId);
const issue = await github.rest.issues.get({
owner,
repo,
issue_number: issueId,
});
const milestone = getMilestone(issue);
if (milestone) {
console.log("Linked issue has milestone", milestone.title);
process.exit(0);
}
}
console.log("No milestone found");
const author = pull.data.user.login;
const guideLink = "https://www.notion.so/metabase/Metabase-Branching-Strategy-6eb577d5f61142aa960a626d6bbdfeb3?pvs=4#3dea255ffa3b4f74942a227844e889fa";
const message = `@${author} Did you forget to add a milestone to the issue for this PR? _[When and where should I add a milestone?](${guideLink})_`;
await github.rest.issues.createComment({
owner,
repo,
issue_number: pullNumber,
body: message,
branchName,
commitMessages: [commitMessage],
});

View File

@@ -0,0 +1,57 @@
name: Conventional commit PR Title Reminder
on:
pull_request:
branches:
- master
paths:
- enterprise/frontend/src/embedding-sdk/**
jobs:
pr-title-reminder:
runs-on: ubuntu-22.04
timeout-minutes: 5
permissions:
pull-requests: write
steps:
- name: Check if the PR title is already following Conventional Commits style
uses: actions/github-script@v7
id: is-conventional-commit
with:
result-encoding: string
script: | # js
const pullRequestTitle = context.payload.pull_request.title
const conventionalCommitRegex = /^(?<type>\w+)\((?<scope>\w+)\):/
const match = pullRequestTitle.match(conventionalCommitRegex)
if (match) {
const { type, scope } = match.groups
return ['feat', 'fix', 'perf', 'docs', 'style', 'refactor', 'test', 'build', 'ci'].includes(type) && scope === 'sdk'
}
- name: Checkout repository so `gh` CLI works
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Remind PR authors to use conventional commit in the title
if: ${{ steps.is-conventional-commit.outputs.result != 'true' }}
run: |
comment='@${{ github.event.pull_request.user.login }} You have modified embedding SDK code. Please make sure the PR title follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) style.
Here are all the supported types that will be shown in the changelog:
- `feat`
- `fix`
- `perf`
These types `docs`, `style`, `refactor`, `test`, `build`, and `ci` are also encouraged for non-changelog related tasks.
Please also make sure to include `sdk` scope, otherwise, the changelog will not include this task.
For example, these are valid PR titles:
- `feat(sdk): Add interactive dashboard component`
- `feat(sdk): Support theming pie chart`
- `fix(sdk): Fix static dashboard crash`'
gh pr comment -b "$comment" --edit-last || gh pr comment -b "$comment"
env:
GH_TOKEN: ${{ github.token }}

View File

@@ -0,0 +1,162 @@
name: Cross-branch migration tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- "resources/migrations/**"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
migrations-h2-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: h2
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-postgres-12-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
services:
postgres:
image: postgres:12-alpine
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-postgres-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: postgres
MB_DB_PORT: 5432
MB_DB_HOST: localhost
MB_DB_DBNAME: circle_test
MB_DB_USER: circle_test
services:
postgres:
image: circleci/postgres:latest
ports:
- "5432:5432"
env:
POSTGRES_USER: circle_test
POSTGRES_DB: circle_test
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mysql-8-0-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mysql:
image: cimg/mysql:8.0
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mysql-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
MB_MYSQL_TEST_USER: root
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: circle_test
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mariadb-10-2-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:10.2.23
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}
migrations-mariadb-latest-ee:
runs-on: ubuntu-22.04
timeout-minutes: 5
env:
CI: 'true'
MB_DB_TYPE: mysql
MB_DB_HOST: localhost
MB_DB_PORT: 3306
MB_DB_DBNAME: circle_test
MB_DB_USER: root
services:
mariadb:
image: circleci/mariadb:latest
ports:
- "3306:3306"
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cross-branch-migration-test
with:
base-ref: ${{ github.base_ref }}

View File

@@ -21,7 +21,6 @@ on:
- Athena
- BigQuery
- Druid
- Google Analytics
- Google Classpath Test
- Maria DB
- Maria DB (latest)
@@ -109,42 +108,6 @@ jobs:
junit-name: 'be-tests-druid-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-tests-googleanalytics-ee:
if: inputs.driver == 'Google Analytics'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: googleanalytics
steps:
- uses: actions/checkout@v4
- name: Test Google Analytics driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-googleanalytics-ee'
test-args: ":only ${{ inputs.test }} :times ${{ inputs.times }}"
be-google-related-drivers-classpath-test:
if: inputs.driver == 'Google Classpath Test'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: 'googleanalytics,bigquery-cloud-sdk'
MB_BIGQUERY_TEST_PROJECT_ID: ${{ secrets.BIGQUERY_TEST_PROJECT_ID }}
MB_BIGQUERY_TEST_CLIENT_ID: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_ID }}
MB_BIGQUERY_TEST_CLIENT_SECRET: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_SECRET }}
MB_BIGQUERY_TEST_ACCESS_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_ACCESS_TOKEN }}
MB_BIGQUERY_TEST_REFRESH_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_REFRESH_TOKEN }}
MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON: ${{ secrets.MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON }}
steps:
- uses: actions/checkout@v4
- name: Test Google Related Drivers Classpath
uses: ./.github/actions/test-driver
with:
junit-name: 'be-google-related-drivers-classpath-test'
test-args: ':only "[metabase.query-processor-test.expressions-test metabase.driver.google-test metabase.driver.googleanalytics-test ${{ inputs.test }}] :times ${{ inputs.times }}"'
be-tests-mariadb-10-2-ee:
if: inputs.driver == 'Maria DB'
runs-on: ubuntu-22.04

View File

@@ -40,6 +40,9 @@ jobs:
MB_ATHENA_TEST_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_ACCESS_KEY }}
MB_ATHENA_TEST_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_SECRET_KEY }}
MB_ATHENA_TEST_S3_STAGING_DIR: ${{ secrets.MB_ATHENA_TEST_S3_STAGING_DIR }}
# These credentials are used to test the driver when the user does not have the athena:GetTableMetadata permission
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_ACCESS_KEY }}
MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY: ${{ secrets.MB_ATHENA_TEST_WITHOUT_GET_TABLE_METADATA_SECRET_KEY }}
steps:
- uses: actions/checkout@v4
- name: Test Athena driver
@@ -126,20 +129,27 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-googleanalytics-ee:
be-tests-druid-jdbc-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: googleanalytics
DRIVERS: druid-jdbc
services:
druid:
image: metabase/druid:29.0.1-json-no-ingestion
ports:
- "8888:8888"
env:
CLUSTER_SIZE: nano-quickstart
steps:
- uses: actions/checkout@v4
- name: Test Google Analytics driver
- name: Test Druid JDBC driver
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-googleanalytics-ee'
junit-name: 'be-tests-druid-jdbc-ee'
test-args: ":exclude-tags '[:mb/once]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
@@ -153,39 +163,6 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-google-related-drivers-classpath-test:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: 'googleanalytics,bigquery-cloud-sdk'
MB_BIGQUERY_TEST_PROJECT_ID: ${{ secrets.BIGQUERY_TEST_PROJECT_ID }}
MB_BIGQUERY_TEST_CLIENT_ID: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_ID }}
MB_BIGQUERY_TEST_CLIENT_SECRET: ${{ secrets.MB_BIGQUERY_TEST_CLIENT_SECRET }}
MB_BIGQUERY_TEST_ACCESS_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_ACCESS_TOKEN }}
MB_BIGQUERY_TEST_REFRESH_TOKEN: ${{ secrets.MB_BIGQUERY_TEST_REFRESH_TOKEN }}
MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON: ${{ secrets.MB_BIGQUERY_CLOUD_SDK_TEST_SERVICE_ACCOUNT_JSON }}
steps:
- uses: actions/checkout@v4
- name: Test Google Related Drivers Classpath
uses: ./.github/actions/test-driver
with:
junit-name: 'be-google-related-drivers-classpath-test'
test-args: ':only "[metabase.query-processor-test.expressions-test metabase.driver.google-test metabase.driver.googleanalytics-test]"'
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-mariadb-10-2-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
@@ -281,7 +258,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-4-4-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -327,7 +304,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-4-4-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -361,7 +338,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-5-0-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -407,7 +384,7 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-5-0-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -444,7 +421,39 @@ jobs:
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-latest-ee'
test-args: ":exclude-tags '[:mb/once]'"
test-args: ":exclude-tags '[:mb/once :mongo-sharded-cluster-tests]'"
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
with:
input-path: ./target/junit/
output-name: ${{ github.job }}
bucket: ${{ vars.AWS_S3_TEST_RESULTS_BUCKET }}
aws-access-key-id: ${{ secrets.AWS_TEST_RESULTS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_RESULTS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
trunk-api-token: ${{ secrets.TRUNK_API_TOKEN }}
be-tests-mongo-sharded-cluster-ee:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.backend_all == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
env:
CI: 'true'
DRIVERS: mongo
services:
mongodb:
image: metabase/mongo-sharded-cluster:6
ports:
- "27017:17017"
steps:
- uses: actions/checkout@v4
- name: Test MongoDB driver (Sharded cluster)
uses: ./.github/actions/test-driver
with:
junit-name: 'be-tests-mongo-sharded-cluster-ee'
test-args: ':only "[metabase.driver.mongo.sharded-cluster-test]"'
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -800,6 +809,11 @@ jobs:
MB_SNOWFLAKE_TEST_WAREHOUSE: ${{ secrets.MB_SNOWFLAKE_TEST_WAREHOUSE }}
MB_SNOWFLAKE_TEST_PK_USER: METABASE PK
MB_SNOWFLAKE_TEST_PK_PRIVATE_KEY: ${{ secrets.MB_SNOWFLAKE_TEST_PK_PRIVATE_KEY }}
# RSA Role testing:
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_DEFAULT_USER: RSA_ROLE_TEST_DEFAULT_USER
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_CUSTOM_USER: RSA_ROLE_TEST_CUSTOM_USER
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_ROLE: RSA_ROLE_TEST_ROLE
MB_SNOWFLAKE_TEST_RSA_ROLE_TEST_DB: RSA_ROLE_TEST_DB
steps:
- uses: actions/checkout@v4
- name: Test Snowflake driver

View File

@@ -2,15 +2,36 @@ name: E2E Cross-version Tests
on:
schedule:
- cron: '0 9 * * 0'
- cron: '0 9 * * 1-5'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
cross-version-testing:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 60
timeout-minutes: 3
outputs:
e2e_cross_version: ${{ steps.changes.outputs.e2e_cross_version }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
cross-version-testing:
needs: files-changed
if: ${{ needs.files-changed.outputs.e2e_cross_version == 'true' || github.event_name == 'schedule'}}
runs-on: ubuntu-22.04
timeout-minutes: 20
strategy:
matrix:
version: [
# Major OSS upgrade
{ source: v0.42.2, target: v0.48.7 },
# OSS upgrade
{ source: v0.41.3.1, target: v0.42.2 },
# EE upgrade
@@ -50,11 +71,12 @@ jobs:
- name: Wait for Metabase to start on port 3000
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Cypress on the source
run: |
yarn cypress run \
--browser chrome \
--browser ${{ steps.cypress-prep.outputs.chrome-path }} \
--config-file e2e/test/scenarios/cross-version/source/shared/cross-version-source.config.js \
--spec e2e/test/scenarios/cross-version/source/**/*.cy.spec.js
- name: Stop Metabase ${{ matrix.version.source }}
@@ -82,7 +104,7 @@ jobs:
- name: Run Cypress on the target
run: |
yarn cypress run \
--browser chrome \
--browser ${{ steps.cypress-prep.outputs.chrome-path }} \
--config-file e2e/test/scenarios/cross-version/target/shared/cross-version-target.config.js \
--spec e2e/test/scenarios/cross-version/target/**/*.cy.spec.js
- name: Upload Cypress Artifacts upon failure
@@ -93,3 +115,51 @@ jobs:
path: |
./cypress
if-no-files-found: ignore
notify-on-failure:
needs: cross-version-testing
if: ${{ always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule' }}
name: Cross-version test failure
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/setup-node@v4
with:
node-version: lts/Hydrogen # 18.x.x
- run: npm install @slack/web-api
- name: notify slack of failure
uses: actions/github-script@v7
with:
script: | # js
const FAILED_RUN_URL = "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}";
const REF_NAME = "${{ github.ref_name }}";
// notify slack of failure
const { WebClient } = require('@slack/web-api');
const slack = new WebClient('${{ secrets.SLACK_BOT_TOKEN }}');
await slack.chat.postMessage({
channel: 'engineering-ci',
text: 'Cross-version Tests Have Failed',
blocks: [
{
"type": "header",
"text": {
"type": "plain_text",
"text": `:broken_heart: Cross-version tests are failing on ${REF_NAME}`,
"emoji": true,
}
},
],
attachments: [{
color: "#BF40BF",
blocks: [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": `See <${FAILED_RUN_URL}|failing run details>.`
}
},
]
}]
});

View File

@@ -20,6 +20,15 @@ on:
type: string
required: false
default: "ee"
qa_db:
description: 'Select the type of Database you want to run your tests with'
type: choice
required: true
default: "none"
options:
- none
- sql
- mongo
jobs:
workflow-summary:
@@ -35,6 +44,7 @@ jobs:
echo '- `spec`: ${{ inputs.spec }}' >> $GITHUB_STEP_SUMMARY
echo '- `burn_in`: ${{ inputs.burn_in }}' >> $GITHUB_STEP_SUMMARY
echo '- `grep`: "${{ inputs.grep }}"' >> $GITHUB_STEP_SUMMARY
echo '- `qa_db`: "${{ inputs.qa_db }}"' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'triggered by: @${{ github.event.sender.login }}' >> $GITHUB_STEP_SUMMARY
@@ -44,8 +54,8 @@ jobs:
name: Stress test E2E flake fix
env:
DISPLAY: ""
QA_DB_ENABLED: true
CYPRESS_REPLAYIO_ENABLED: 1
QA_DB_ENABLED: ${{ contains(fromJSON('["sql", "mongo"]'), inputs.qa_db) }}
CYPRESS_QA_DB_MONGO: ${{ inputs.qa_db == 'mongo' }}
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
MB_SNOWPLOW_AVAILABLE: true
@@ -66,9 +76,9 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}
maildev: true
openldap: true
postgres: true
mysql: true
mongo: true
postgres: ${{ inputs.qa_db == 'sql' }}
mysql: ${{ inputs.qa_db == 'sql' }}
mongo: ${{ inputs.qa_db == 'mongo' }}
- name: Download Metabase ${{ matrix.edition }} uberjar
uses: ./.github/actions/e2e-download-uberjar
@@ -83,6 +93,7 @@ jobs:
java-version: 11
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
@@ -95,7 +106,7 @@ jobs:
--spec '${{ github.event.inputs.spec }}' \
--env burn=${{ github.event.inputs.burn_in }},grep='${{ github.event.inputs.grep }}' \
--config-file e2e/support/cypress-stress-test.config.js \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4

View File

@@ -4,7 +4,7 @@ on:
push:
branches:
- "master"
- 'release-**'
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
@@ -39,8 +39,39 @@ jobs:
id: e2e-matrix
uses: ./.github/actions/build-e2e-matrix
# if this is a test on a release branch, we need to check the build requirements
get-build-requirements:
if: |
!cancelled() &&
contains(github.ref, 'release-x')
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
java_version: ${{ fromJson(steps.dependencies.outputs.result).java_version }}
node_version: ${{ fromJson(steps.dependencies.outputs.result).node_version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get build dependencies
uses: actions/github-script@v7
id: dependencies
with:
script: | # js
const { getBuildRequirements, getVersionFromReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = getVersionFromReleaseBranch('${{ github.ref }}');
const requirements = getBuildRequirements(version);
return {
java_version: requirements.java,
node_version: requirements.node,
};
build:
needs: [files-changed, e2e-matrix-builder]
needs: [files-changed, e2e-matrix-builder, get-build-requirements]
if: |
!cancelled() &&
github.event.pull_request.draft == false &&
@@ -54,14 +85,19 @@ jobs:
env:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
# make sure that builds on release branches get licenses, because we use them for releases
SKIP_LICENSES: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
with:
node-version: '${{ needs.get-build-requirements.outputs.node_version }}'
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: e2e-tests
java-version: '${{ needs.get-build-requirements.outputs.java_version || 11 }}'
- name: Build uberjar with ./bin/build.sh
run: ./bin/build.sh
@@ -87,13 +123,9 @@ jobs:
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
CYPRESS_PULL_REQUEST_ID: ${{ github.event.pull_request.number || '' }}
COMMIT_INFO_MESSAGE : ${{ github.event.pull_request.title || github.event.head_commit.message || github.even.head.sha }}
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message || github.even.head.sha }}
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
CYPRESS_REPLAYIO_ENABLED: 1
RECORD_REPLAY_METADATA_FILE: /tmp/replay-metadata.json
RECORD_REPLAY_METADATA_TEST_RUN_ID: ${{ github.run_id }}
REPLAY_API_KEY: ${{ secrets.REPLAY_IO_TOKEN }}
TZ: US/Pacific # to make node match the instance tz
strategy:
fail-fast: false
@@ -133,6 +165,7 @@ jobs:
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
@@ -143,24 +176,24 @@ jobs:
run: |
yarn run test-cypress-run \
--env grepTags=@OSS,grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run slow and resource-intensive Cypress tests
if: matrix.name == 'slow' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="@slow",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run Flaky Cypress tests
if: matrix.name == 'flaky' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="@flaky",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--env grepTags="@flaky --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run EE Cypress tests on ${{ matrix.name }}
if: matrix.context == 'folder' && github.event_name != 'schedule'
@@ -168,18 +201,33 @@ jobs:
yarn run test-cypress-run \
--env grepTags="-@slow+-@mongo+-@flaky --@quarantine",grepOmitFiltered=true \
--folder ${{ matrix.name }} \
--browser 'replay-chromium'
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Run E2E tests that depend on Mongo
if: matrix.name == 'mongo'
run: |
yarn run test-cypress-run \
--env grepTags="@mongo --@quarantine",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.js' \
--browser 'replay-chromium'
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
env:
CYPRESS_QA_DB_MONGO: true
- name: Run Embedding SDK Storybook
if: matrix.context == 'embedding-sdk' && github.event_name != 'schedule'
uses: ./.github/actions/run-embedding-sdk-storybook
- name: Run E2E tests for Embedding SDK
if: matrix.context == 'embedding-sdk' && github.event_name != 'schedule'
run: |
yarn run test-cypress-run \
--env grepTags="-@slow+-@flaky --@quarantine",grepOmitFiltered=true \
--folder 'embedding-sdk' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
env:
CYPRESS_IS_EMBEDDING_SDK: true
shell: bash
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()
@@ -217,46 +265,10 @@ jobs:
- run: |
echo "Didn't run due to conditional filtering"
visual-regression-tests:
runs-on: ubuntu-22.04
timeout-minutes: 60
pr-env:
needs: [build]
if: |
!cancelled() && needs.build.result == 'success'
name: percy-visual-regression-tests
steps:
- uses: actions/checkout@v4
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
maildev: true
- name: Retrieve uberjar artifact for ${{ matrix.edition }}
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ github.ref == 'refs/heads/master' && secrets.PERCY_TOKEN || ''}}
!cancelled() &&
contains(github.event.pull_request.labels.*.name, 'PR-Env')
uses: ./.github/workflows/pr-env.yml
secrets: inherit

39
.github/workflows/embedding-sdk.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Embedding SDK
on:
push:
branches:
- "master"
- "release-**"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
sdk-build:
if: contains(github.event.pull_request.labels.*.name, 'embedding-sdk-build')
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Build SDK bundle
run: yarn run build-embedding-sdk
- name: Generate SDK package.json
run: yarn run embedding-sdk:generate-package "$GITHUB_SHA"
- name: Generate .npmrc for Github npm registry
uses: actions/setup-node@v4
with:
registry-url: "https://npm.pkg.github.com"
- name: Publish package
run: yarn run embedding-sdk:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -0,0 +1,34 @@
name: Flake Issue Creator
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1-5' # every weekday at 1am US eastern time
jobs:
flake-issue-creator:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Update flake issues
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { updateFlakeIssues } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
await updateFlakeIssues({
github,
owner: context.repo.owner,
repo: context.repo.repo,
});

35
.github/workflows/flake-status.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Flake Status Report
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * 2,5' # Tuesdays and Fridays at 1am US eastern time
jobs:
flake-status-report:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Post Flake Status Report
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { summarizeFlakes } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
await summarizeFlakes({
github,
owner: context.repo.owner,
repo: context.repo.repo,
channelName: 'engineering-ci'
});

View File

@@ -4,15 +4,15 @@ on:
workflow_dispatch:
inputs:
spec:
description: 'Relative path of the target spec'
description: "Relative path of the target spec"
type: string
required: true
burn_in:
description: 'Number of times to run the test (e.g. 20)'
description: "Number of times to run the test (e.g. 20)"
type: string
required: true
grep:
description: 'Grep and filter tests to run in isolation'
description: "Grep and filter tests to run in isolation"
type: string
required: false
@@ -45,10 +45,12 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Build cljs
run: yarn build:cljs
- name: Stress-test ${{ github.event.inputs.spec }} ${{ github.event.inputs.burn_in }} times
run: |
for i in {1..${{ github.event.inputs.burn_in }}}; do
yarn test-unit \
yarn jest --runInBand --ci --silent --no-cache \
--testPathPattern '${{ github.event.inputs.spec }}' \
--testNamePattern '${{ github.event.inputs.grep }}'
if [[ "$?" != 0 ]]; then

View File

@@ -70,7 +70,7 @@ jobs:
fe-tests-unit:
needs: files-changed
if: github.event.pull_request.draft == false && needs.files-changed.outputs.frontend_all == 'true'
runs-on: buildjet-2vcpu-ubuntu-2204
runs-on: ubuntu-22.04
timeout-minutes: 60
env:
JEST_JUNIT_OUTPUT_DIR: ./target/junit
@@ -91,10 +91,11 @@ jobs:
run: yarn run test-unit --silent
- name: Upload coverage to codecov.io
if: github.ref_name == 'master'
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./coverage/lcov.info
flags: front-end
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Test Results
uses: ./.github/actions/upload-test-results
if: always()

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@v4
with:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
ref: ${{ github.head_ref }}
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs
- name: Build Storybook
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@v7
with:
github-token: ${{secrets.METABASE_AUTOMATION_USER_TOKEN}}
script: |
github.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'loki-update'
})

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

@@ -0,0 +1,85 @@
name: Loki Visual Regression Testing
on: [pull_request]
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
frontend_ci: ${{ steps.changes.outputs.frontend_ci }}
frontend_sources: ${{ steps.changes.outputs.frontend_sources }}
frontend_loki_ci: ${{ steps.changes.outputs.frontend_loki_ci }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
visual-test:
needs: files-changed
if: needs.files-changed.outputs.frontend_ci == 'true' || needs.files-changed.outputs.frontend_sources == 'true' || needs.files-changed.outputs.frontend_loki_ci == 'true'
runs-on: ubuntu-latest
services:
docker:
image: docker:19.03.12
options: --privileged
ports:
- 2376:2376
env:
DOCKER_TLS_CERTDIR: /certs
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/docker-certs:/certs/client
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Prepare frontend environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "cljs"
- name: Compile CLJS
run: yarn build-pure:cljs
- name: Build Storybook
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 test-visual:loki
- name: Generate Visual Report on Failure
if: failure()
run: yarn test-visual:loki-report
- name: Upload Artifact
id: artifact-upload-step
if: failure()
uses: actions/upload-artifact@v4
with:
name: loki-report
path: .loki/
if-no-files-found: ignore

View File

@@ -0,0 +1,32 @@
name: Update changelog for MBQL library changes
on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- synchronize
paths:
- src/metabase/lib/js.cljs
jobs:
mbql-library-changelog-check:
runs-on: ubuntu-latest
if: ${{ !contains( github.event.pull_request.labels.*.name, '.metabase-lib/no-change' ) }}
steps:
# - uses: jesusvasquez333/verify-pr-label-action@v1.4.0
# with:
# github-token: '${{ secrets.GITHUB_TOKEN }}'
# valid-labels: '.metabase-lib/no-change'
# disable-reviews: true
- uses: actions/checkout@v4
- name: Check for updated MBQL library changelog
run: |
if [[ $(git show HEAD -- docs/developers-guide/mbql-library-changelog.md) ]]; then
echo "Library and changelog updated together - all good"
else
echo "metabase.lib.js namespace changed but docs/developers/guide/mbql-library-changelog.md did not"
echo "Update the changelog with the changes made to the library's API."
echo "If the edits did not change the API, add the `.metabase-lib/no-change` label."
exit 1
fi

View File

@@ -1,4 +1,4 @@
name: Migrations
name: Lint migrations
on:
push:
@@ -9,14 +9,14 @@ on:
jobs:
check-migrations:
lint-migrations:
runs-on: ubuntu-22.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: check-migrations
- name: Verify Liquibase Migrations
run: ./bin/lint-migrations-file.sh
- uses: actions/checkout@v4
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: lint-migrations
- name: Verify Liquibase Migrations
run: ./bin/lint-migrations-file.sh

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

@@ -0,0 +1,15 @@
name: PR Closed or Unlabeled
on:
pull_request:
types: [ closed, unlabeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-env:
if: ${{ github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR-Env') || github.event.label.name == 'PR-Env' }}
uses: ./.github/workflows/pr-env-destroy.yml
secrets: inherit

71
.github/workflows/pr-env-destroy.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: CI for PR Review ENV Destroy
run-name: Destroying Dynamic PR Environment for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
jobs:
destroy_pr:
runs-on: ubuntu-latest
name: PR Review ENV Destroy
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Destroy PR Review ENV
run: |
kubectl delete metabase -n hosting-pr${{ github.event.number }} hosting-pr${{ github.event.number }}
kubectl delete ns hosting-pr${{ github.event.number }}
- name: Setup psql client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Drop app database if exists
run: |
PGPASSWORD='${{ secrets.PR_ENV_DB_PASSWORD }}' \
psql \
-h ${{ secrets.PR_ENV_DB_HOST }} \
-U ${{ secrets.PR_ENV_DB_USER }} \
-d ${{ secrets.PR_ENV_DB_NAME }} \
-c "DROP DATABASE IF EXISTS hosting_pr${{ github.event.number }};"

17
.github/workflows/pr-env-labeled.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: PR-Env labeled
on:
pull_request:
types: [ labeled ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pr-env:
if: ${{ github.event.label.name == 'PR-Env' }}
uses: ./.github/workflows/pr-env.yml
with:
wait_for_uberjar: true
secrets: inherit

169
.github/workflows/pr-env.yml vendored Normal file
View File

@@ -0,0 +1,169 @@
name: CI for PR Review ENV
run-name: Building Dynamic PR Environment for ${{ github.ref_name }} by @${{ github.actor }}
on:
workflow_call:
inputs:
wait_for_uberjar:
description: "Wait for uberjar build"
required: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
name: Build Metabase Docker image
timeout-minutes: 60
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
with:
registries: "${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}"
- name: Wait for uberjar
id: wait_for_uberjar
if: ${{ inputs.wait_for_uberjar == true }}
run: |
## Get workflow run id for uberjar build
curl -Ls --output e2e-tests.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/e2e-tests.yml/runs?head_sha=${{ github.event.pull_request.head.sha || github.sha }}
ID=$(jq -r '.workflow_runs[0].id' e2e-tests.json)
## Wait for uberjar build to complete
while [ true ]; do
curl -Ls --output uberjar.json \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/${ID}/jobs?filter=latest
jq -r '.jobs[] | select(.name == "build (ee)") | .steps[] | select(.name == "Prepare uberjar artifact") | .status' uberjar.json | grep -q "completed" && break
echo "Waiting for uberjar build..."
sleep 10
done
echo "run_id=$(jq -r '.workflow_runs[0].id' e2e-tests.json)" >> $GITHUB_OUTPUT
- name: Retrieve uberjar artifact for ee
uses: actions/download-artifact@v4
with:
name: metabase-ee-${{ github.event.pull_request.head.sha || github.sha }}-uberjar
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ inputs.wait_for_uberjar && steps.wait_for_uberjar.outputs.run_id || github.run_id }}
- name: Move uberjar to bin/docker
run: |
jar xf target/uberjar/metabase.jar
mv target/uberjar/metabase.jar bin/docker/metabase.jar
- name: Build container
uses: docker/build-push-action@v6
with:
context: bin/docker/
platforms: linux/amd64
network: host
tags: ${{ secrets.PR_ENV_AWS_ACCOUNT_ID }}.dkr.ecr.us-east-1.amazonaws.com/metabase-enterprise:pr${{ github.event.number }}
push: true
deploy_pr:
needs: [ build ]
runs-on: ubuntu-latest
name: PR Review ENV
permissions:
id-token: write
contents: read
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.PR_ENV_TAILSCALE_OAUTH_SECRET }}
tags: tag:ci
version: 1.50.1
sha256sum: d9fe6b480fb5078f0aa57dace686898dda7e2a768884271159faa74846bfb576
- name: Create OIDC Token
id: create-oidc-token
shell: bash
run: |
export OIDC_URL_WITH_AUDIENCE="$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ secrets.PR_ENV_K8S_AUDIENCE }}"
IDTOKEN=$(curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" -H "Accept: application/json; api-version=2.0" "$OIDC_URL_WITH_AUDIENCE" | jq -r .value)
echo "::add-mask::${IDTOKEN}"
echo "idToken=${IDTOKEN}" >>$GITHUB_OUTPUT
- name: Setup Kube Context
uses: azure/k8s-set-context@v2
with:
method: kubeconfig
kubeconfig: |
kind: Config
apiVersion: v1
current-context: default
clusters:
- name: default
cluster:
certificate-authority-data: ${{ secrets.PR_ENV_K8S_CERTIFICATE_AUTHORITY_DATA }}
server: ${{ secrets.PR_ENV_K8S_SERVER }}
users:
- name: oidc-token
user:
token: ${{ steps.create-oidc-token.outputs.IDTOKEN }}
contexts:
- name: default
context:
cluster: default
namespace: default
user: oidc-token
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.PR_ENV_IAM_ROLE }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-east-1
- name: Setup psql client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Create app database if not exists
run: |
export PGPASSWORD='${{ secrets.PR_ENV_DB_PASSWORD }}'
export PGUSER=${{ secrets.PR_ENV_DB_USER }}
export PGHOST=${{ secrets.PR_ENV_DB_HOST }}
export PGDATABASE=${{ secrets.PR_ENV_DB_NAME }}
psql -tc "SELECT 1 FROM pg_database WHERE datname = 'hosting_pr${{ github.event.number }}'" \
| grep -q 1 \
|| psql -c "CREATE DATABASE hosting_pr${{ github.event.number }}"
- name: Download Deployment YAML template
run: aws s3 cp s3://metabase-pr-env/metabase.yml.tmpl ./metabase.yml.tmpl
- name: Render Deployment YAML
uses: nowactions/envsubst@v1
with:
input: ./metabase.yml.tmpl
output: ./metabase.yml
env:
IMAGE_TAG: pr${{ github.event.number }}
PR_NUMBER: ${{ github.event.number }}
MB_PREMIUM_EMBEDDING_TOKEN: ${{ secrets.PR_ENV_MB_PREMIUM_EMBEDDING_TOKEN }}
SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Deploy PR Review ENV
run: |
kubectl apply -f ./metabase.yml
preview_links:
runs-on: ubuntu-latest
needs: [ deploy_pr ]
steps:
- uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
message: |
👋 Deploying a preview environment for commit ${{ github.event.pull_request.head.sha || github.sha }}.
✅ Preview:
https://pr${{ github.event.number }}.coredev.metabase.com
🗒️ [login instructions](https://www.notion.so/metabase/Ephemeral-PR-Environments-c74a3710c87a460dbf4fc0007a001458)

View File

@@ -5,12 +5,16 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
description: "Metabase version (e.g. v0.46.3)"
type: string
required: true
commit:
description: 'A full-length commit SHA-1 hash'
description: "A full-length commit SHA-1 hash"
required: true
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
release-artifact:
@@ -91,26 +95,26 @@ jobs:
edition: [oss, ee]
java-version: [11, 17]
steps:
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
with:
java-package: jre
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- run: java -version
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Launch uberjar (and keep it running)
run: java -jar ./metabase.jar &
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v4
with:
java-package: jre
java-version: ${{ matrix.java-version }}
distribution: "temurin"
- run: java -version
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Launch uberjar (and keep it running)
run: java -jar ./metabase.jar &
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
run-sanity-check:
runs-on: ubuntu-22.04
timeout-minutes: 30
needs: [release-artifact, check-uberjar-health]
needs: [release-artifact]
strategy:
matrix:
edition: [oss, ee]
@@ -119,59 +123,63 @@ jobs:
DISPLAY: ""
CYPRESS_ALL_FEATURES_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
CYPRESS_NO_FEATURES_TOKEN: ${{ secrets.E2E_STARTER_TOKEN }}
# disabled because of out of memory issues
# probably related to https://github.com/cypress-io/cypress/issues/27415
CYPRESS_NO_COMMAND_LOG: 1
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
TERM: xterm
services:
maildev:
image: maildev/maildev:2.0.5
ports:
- "1080:1080"
- "1025:1025"
credentials:
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- name: Prepare Docker containers
uses: ./.github/actions/e2e-prepare-containers
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: "temurin"
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact for ${{ matrix.edition }}
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Get the version info
run: |
jar xf metabase.jar version.properties
mv version.properties resources/
- name: Run a few important Cypress tests as sanity check
run: |
mkdir -p ./target/uberjar && cp metabase.jar ./target/uberjar/metabase.jar
yarn test-cypress-run --folder onboarding
maildev: true
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: "temurin"
- name: Prepare Cypress environment
id: cypress-prep
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact for ${{ matrix.edition }}
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Get the version info
run: |
jar xf metabase.jar version.properties
mv version.properties resources/
- name: Run a few important Cypress tests as sanity check
run: |
mkdir -p ./target/uberjar && cp metabase.jar ./target/uberjar/metabase.jar
yarn test-cypress-run \
--env grepTags="@smoke",grepOmitFiltered=true \
--spec './e2e/test/scenarios/**/*.cy.spec.(js|ts)' \
--browser ${{ steps.cypress-prep.outputs.chrome-path }}
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-failed-tests-recording
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
- name: Upload Cypress Artifacts upon failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-failed-tests-recording
path: |
./cypress
./logs/test.log
if-no-files-found: ignore
containerize:
needs: [release-artifact, run-sanity-check]
needs: [release-artifact]
runs-on: ubuntu-22.04
timeout-minutes: 15
strategy:
@@ -185,71 +193,71 @@ jobs:
outputs:
image_tag: ${{ steps.target.outputs.image_tag }}
steps:
- name: Get the version
run: |
if [[ "${{ matrix.edition }}" == "ee" ]]; then
echo "VERSION=${{ needs.release-artifact.outputs.ee_version }}" >> $GITHUB_ENV
else
echo "VERSION=${{ needs.release-artifact.outputs.oss_version }}" >> $GITHUB_ENV
fi
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Move the Uberjar to the context dir
run: mv metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/local-metabase:${{ env.VERSION }}
no-cache: true
push: true
- name: Get the version
run: |
if [[ "${{ matrix.edition }}" == "ee" ]]; then
echo "VERSION=${{ needs.release-artifact.outputs.ee_version }}" >> $GITHUB_ENV
else
echo "VERSION=${{ needs.release-artifact.outputs.oss_version }}" >> $GITHUB_ENV
fi
- name: Check out the code
uses: actions/checkout@v4
with:
ref: ${{ needs.release-artifact.outputs.commit }}
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Move the Uberjar to the context dir
run: mv metabase.jar bin/docker/.
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v3
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/local-metabase:${{ env.VERSION }}
no-cache: true
push: true
- name: Launch container
run: docker run --rm -dp 3000:3000 localhost:5000/local-metabase:${{ env.VERSION }}
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Launch container
run: docker run --rm -dp 3000:3000 localhost:5000/local-metabase:${{ env.VERSION }}
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Retag and push container image to ${{ vars.DOCKERHUB_OWNER }} staging Docker Hub repo
id: target
run: |
# SHA-1 truncated to 7 digits should be enough
SHORT_HASH=${COMMIT:0:7}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Retag and push container image to ${{ vars.DOCKERHUB_OWNER }} staging Docker Hub repo
id: target
run: |
# SHA-1 truncated to 7 digits should be enough
SHORT_HASH=${COMMIT:0:7}
IMAGE_TAG=$VERSION-$SHORT_HASH
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
IMAGE_TAG=$VERSION-$SHORT_HASH
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
echo "Retag local image for staging"
docker tag localhost:5000/local-metabase:$VERSION $CONTAINER_IMAGE
echo "Retag local image for staging"
docker tag localhost:5000/local-metabase:$VERSION $CONTAINER_IMAGE
echo "Pushing container image $CONTAINER_IMAGE ..."
docker push $CONTAINER_IMAGE
echo "Pushing container image $CONTAINER_IMAGE ..."
docker push $CONTAINER_IMAGE
echo "Finished!"
shell: bash
env:
COMMIT: ${{ needs.release-artifact.outputs.commit }}
echo "Finished!"
shell: bash
env:
COMMIT: ${{ needs.release-artifact.outputs.commit }}
verify-docker-pull:
runs-on: ubuntu-22.04
@@ -261,22 +269,80 @@ jobs:
env:
IMAGE_TAG: ${{ needs.containerize.outputs.image_tag }}
steps:
- name: Login to Docker Hub # authenticated, to avoid being rate-throttled
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Pull the container image
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
echo "Pulling container image $CONTAINER_IMAGE ..."
docker pull $CONTAINER_IMAGE
echo "Successful!"
- name: Launch container
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
docker run --rm -dp 3000:3000 $CONTAINER_IMAGE
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
- name: Login to Docker Hub # authenticated, to avoid being rate-throttled
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_RELEASE_USERNAME }}
password: ${{ secrets.DOCKERHUB_RELEASE_TOKEN }}
- name: Pull the container image
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
echo "Pulling container image $CONTAINER_IMAGE ..."
docker pull $CONTAINER_IMAGE
echo "Successful!"
- name: Launch container
run: |
CONTAINER_IMAGE=${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_STAGING_REPO }}:$IMAGE_TAG
docker run --rm -dp 3000:3000 $CONTAINER_IMAGE
timeout-minutes: 5
- name: Wait for Metabase to start
run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done
timeout-minutes: 3
trigger-auto-publish:
if: ${{ inputs.auto }}
needs: [run-sanity-check, check-uberjar-health, verify-docker-pull]
permissions:
actions: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: trigger auto publish
uses: actions/github-script@v7
with:
script: | # js
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'release.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
auto: true,
}
});
tests-complete-message:
if: always()
runs-on: ubuntu-22.04
needs: [run-sanity-check, check-uberjar-health, verify-docker-pull]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send tests complete message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendTestsCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
const allJobsSuccessful =
'${{ needs.run-sanity-check.result }}' === 'success' &&
'${{ needs.check-uberjar-health.result }}' === 'success' &&
'${{ needs.verify-docker-pull.result }}' === 'success';
await sendTestsCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
testStatus: allJobsSuccessful ? 'success' : 'failure',
}).catch(console.error);

View File

@@ -0,0 +1,254 @@
name: Release Metabase Embedding SDK for React
on:
workflow_dispatch:
inputs:
# TODO: Add a version validation, so the workflow won't fail when publishing to npm
sdk_version:
description: 'SDK version (e.g. 0.1.3)'
type: string
required: true
git_ref:
description: 'A git commit hash that will be used to build the SDK'
type: string
required: true
concurrency:
# We want to ensure only one job is running at a time because
# there could be a conflict when updating the readme file.
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
check-git-tag:
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
fetch-tags: true
- name: check tags
run: |
if [ $(git tag -l | grep $tag$) ]
then
echo "::error::Tag '${{ env.tag }}' already exists. If you expect to run this workflow with the same tag, please remove the tag first and rerun this workflow again."
exit 1
else
exit 0
fi
test:
needs: check-git-tag
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "release-sdk"
- name: Run unit tests
run: yarn embedding-sdk:test-unit
build-sdk:
needs: test
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
fetch-depth: 0
fetch-tags: true
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: "release-sdk"
- name: Update readme
run: |
./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
# NOTE: this should happen before "Build SDK bundle" as we inject SDK version into the code during build step
run: |
./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
- name: Update changelog
run: |
yarn embedding-sdk:generate-changelog -o changelog-diff
- name: Build SDK bundle
run: yarn run build-embedding-sdk
- name: Generate SDK package.json in the build directory
run: yarn run embedding-sdk:generate-package
- name: Upload built SDK package as artifact
uses: actions/upload-artifact@v4
with:
name: metabase-sdk
path: ./resources/embedding-sdk
- name: Upload changelog diff
uses: actions/upload-artifact@v4
with:
name: sdk-changelog-diff
path: ./changelog-diff
build-jar:
needs: test
uses: ./.github/workflows/uberjar-sdk.yml
with:
git_ref: ${{ inputs.git_ref }}
image_name: embedding-sdk-${{ inputs.sdk_version }}
secrets: inherit
upload-jar:
needs: build-jar
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/download-artifact@v4
name: Retrieve uberjar artifact
with:
name: metabase-ee-uberjar
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Upload uberjar to S3
env:
BUCKET: ${{ vars.AWS_S3_DOWNLOADS_BUCKET }}
BUCKET_PATH: sdk/v${{ inputs.sdk_version }}/metabase.jar
FILE: ./target/uberjar/metabase.jar
shell: bash
run: |
aws s3 cp $FILE s3://$BUCKET/$BUCKET_PATH
publish-npm:
needs: [build-sdk, upload-jar]
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out master to prepare for a SDK version bump PR
uses: actions/checkout@v4
with:
# when we created version update PR, it would only have diff from 2 files SDK readme and SDK package.json template
ref: master
- name: Setup git user
run: |
git config --global user.email "github-automation@metabase.com"
git config --global user.name "Metabase Automation"
- name: Update readme
run: |
bash ./bin/embedding-sdk/release_utils.bash update_readme ${{ inputs.sdk_version }}
- name: Bump published npm package version
run: |
bash ./bin/embedding-sdk/release_utils.bash update_package_json_template ${{ inputs.sdk_version }}
- name: Retrieve SDK changelog diff
uses: actions/download-artifact@v4
with:
name: sdk-changelog-diff
- name: Update changelog
run: |
cat changelog-diff enterprise/frontend/src/embedding-sdk/CHANGELOG.md > new-changelog
mv new-changelog enterprise/frontend/src/embedding-sdk/CHANGELOG.md
- name: Create a PR updating readme + published version, and changelog (using GitHub Metabase Automation account)
run: |
git checkout -b update-sdk-version-${{ inputs.sdk_version }}
git commit -a -m 'Update Readme version references and published npm version to ${{ inputs.sdk_version }}'
git push origin HEAD
gh pr create --base master\
--assignee "${GITHUB_ACTOR}"\
--title "Update SDK version to ${{ inputs.sdk_version }}"\
--body "Update Readme version references and published npm package version to ${{ inputs.sdk_version }}"
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.METABASE_BOT_APP_ID }}
private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
- name: Edit PR adding useful information (using Metabase bot app)
run: |
gh pr edit --add-reviewer @metabase/embedding --add-label no-backport
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Auto approve PR (using GitHub Actions account)
run: |
gh pr review --approve
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable Pull request auto-merge (using GitHub Metabase Automation account)
run: |
gh pr merge --auto --squash
env:
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: Retrieve build SDK package artifact
uses: actions/download-artifact@v4
with:
name: metabase-sdk
path: sdk
- name: Publish to NPM
run: |
cd sdk
echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_RELEASE_TOKEN }} > .npmrc
npm publish
git-tag:
needs: publish-npm
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
tag: embedding-sdk-${{ inputs.sdk_version }}
steps:
- name: Check out the code using the provided ref
uses: actions/checkout@v4
with:
ref: ${{ inputs.git_ref }}
# Lightweight tags don't need committer name and email
- name: Create a new git tag
run: |
git tag ${{ env.tag }}
- name: Push the new tag
id : push-tag
run: |
git push origin ${{ env.tag }}

View File

@@ -0,0 +1,52 @@
name: Release Milestone Check
run-name: Pre-release Milestone check for ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: "Metabase version (e.g. v0.46.3)"
type: string
required: true
commit:
description: "A full-length commit SHA-1 hash"
required: true
jobs:
check-milestone:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: yarn --cwd release --frozen-lockfile && yarn --cwd release build
- uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
with:
script: | # js
const {
checkMilestoneForRelease,
sendMilestoneCheckMessage,
} = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const commitHash = '${{ inputs.commit }}';
const issueCount = await checkMilestoneForRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version,
commitHash,
});
await sendMilestoneCheckMessage({
channelName: process.env.SLACK_RELEASE_CHANNEL,
issueCount,
version,
});

View File

@@ -0,0 +1,55 @@
name: Release Notes Preview
run-name: Preview ${{ inputs.version }} release notes
on:
workflow_dispatch:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
type: string
required: true
jobs:
preview-release-notes:
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Fail early on the incorrect version format
if: ${{ !(startsWith(inputs.version,'v0.') || startsWith(inputs.version,'v1.')) }}
run: |
echo "The version format is invalid!"
echo "It must start with either 'v0.' or 'v1.'."
echo "Please, try again."
exit 1
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get Release Version
uses: actions/github-script@v7
env:
DOCKERHUB_OWNER: test_owner
DOCKERHUB_REPO: test_repo
AWS_S3_DOWNLOADS_BUCKET: test_bucket
with:
script: | # js
const { getChangelog } = require('${{ github.workspace }}/release/dist/index.cjs');
const fs = require('fs');
const version = '${{ inputs.version }}';
const notes = await getChangelog({
version,
github,
owner: context.repo.owner,
repo: context.repo.repo,
});
fs.writeFileSync(`release-notes-preview-${version}.md`, notes);
- name: Upload Release Notes
uses: actions/upload-artifact@v4
with:
name: release-notes-preview-${{inputs.version}}.md
path: |
${{ github.workspace }}/release-notes-preview-*.md

91
.github/workflows/release-patch.yml vendored Normal file
View File

@@ -0,0 +1,91 @@
name: Release 1b - Auto Patch
run-name: Patch Release ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Major Metabase version (e.g. 45, 52, 68)'
type: number
required: true
schedule:
- cron: '15 0 * * 1-5' # every weekday at 7/8:15 pm Eastern Time
jobs:
auto-patch-trigger:
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: yarn --cwd release --frozen-lockfile && yarn --cwd release build
- name: Trigger auto-patch
uses: actions/github-script@v7
with:
script: | # js
const {
getLatestGreenCommit,
getNextPatchVersion,
hasCommitBeenReleased,
} = require('${{ github.workspace }}/release/dist/index.cjs');
// Don't forget to update this for the next major release 🤞
const AUTO_RELEASE_VERSIONS = [49, 50];
async function releasePatchFor(majorVersion) {
const nextPatch = await getNextPatchVersion({
github,
owner: context.repo.owner,
repo: context.repo.repo,
majorVersion,
});
const goodCommit = await getLatestGreenCommit({
github,
owner: context.repo.owner,
repo: context.repo.repo,
branch: `release-x.${majorVersion}.x`,
});
const hasBeenReleased = await hasCommitBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
ref: goodCommit,
majorVersion: Number(majorVersion),
});
if (nextPatch && goodCommit && !hasBeenReleased) {
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'tag-for-release.yml',
ref: 'refs/heads/master',
inputs: {
commit: goodCommit,
version: nextPatch,
auto: true,
}
});
} else {
console.log(
{ nextPatch, goodCommit, hasBeenReleased }
);
console.error(`No new patch version or no green commit found for v${majorVersion}`);
}
}
if (context.eventName === 'workflow_dispatch') {
const inputVersion = Number(context.payload.inputs.version);
if (typeof inputVersion !== 'number') {
console.log('Invalid version number', inputVersion);
throw new Error(`Invalid version number: ${inputVersion}`);
}
await releasePatchFor(inputVersion);
} else { // scheduled release of AUTO_RELEASE_VERSIONS
await Promise.all(AUTO_RELEASE_VERSIONS.map(releasePatchFor));
}

View File

@@ -1,9 +1,9 @@
name: Release Status Check
name: Release and Backport Status Check
on:
workflow_dispatch:
schedule:
- cron: '0 13 * * *' # every day at 8am US eastern time
- cron: '0 7 * * 1-5' # every weekday at 8am/9am Central European Time
jobs:
check-release-status:
@@ -38,3 +38,31 @@ jobs:
repo: context.repo.repo,
channelName: process.env.SLACK_RELEASE_CHANNEL,
});
open-backport-reminder:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn --frozen-lockfile && yarn build
- name: Check release status and post to Slack
uses: actions/github-script@v7
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { checkOpenBackports } = require('${{ github.workspace }}/release/dist/index.cjs');
if (!process.env.SLACK_BOT_TOKEN) {
throw new Error('SLACK_BOT_TOKEN is required');
}
const ossReleased = await checkOpenBackports({
github,
owner: context.repo.owner,
repo: context.repo.repo,
channelName: 'engineering-ci',
});

72
.github/workflows/release-tests.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: Release Code Tests
on:
push:
branches:
- "master"
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
files-changed:
name: Check which files changed
runs-on: ubuntu-22.04
timeout-minutes: 3
outputs:
release_source: ${{ steps.changes.outputs.release_source }}
steps:
- uses: actions/checkout@v4
- name: Test which files changed
uses: dorny/paths-filter@v3.0.0
id: changes
with:
token: ${{ github.token }}
filters: .github/file-paths.yaml
release-type-check:
needs: files-changed
if: needs.files-changed.outputs.release_source == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: "release"
- name: prepare dependencies in release directory
run: yarn --cwd release --frozen-lockfile
- name: Run frontend type-check
run: yarn --cwd release type-check
release-tests-unit:
needs: files-changed
if: needs.files-changed.outputs.release_source == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: "release"
- name: prepare dependencies in release directory
run: yarn --cwd release --frozen-lockfile
- name: Run release unit tests
run: yarn --cwd release test:unit
release-test-build:
needs: files-changed
if: needs.files-changed.outputs.release_source == 'true'
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: "release"
- name: prepare dependencies in release directory
run: yarn --cwd release --frozen-lockfile
- name: Build release bundle
run: yarn --cwd release build
- name: Smoke test release bundle
run: node release/dist/index.cjs

View File

@@ -31,6 +31,10 @@ on:
description: 'Skip publishing release notes'
type: boolean
default: false
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
check-version:
@@ -90,6 +94,34 @@ jobs:
return versions;
publish-start-message:
runs-on: ubuntu-22.04
needs: [check-version]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send publish start message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPublishStartMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishStartMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
download-uberjar:
needs: check-version
runs-on: ubuntu-22.04
@@ -228,7 +260,7 @@ jobs:
- name: Upload to S3
run: aws s3 cp ./metabase.jar s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.version_path.outputs.result }}/metabase.jar
- name: Upload to s3 latest path
if: ${{ steps.latest_path.outputs.result != 'false' }}
if: ${{ !inputs.auto && steps.latest_path.outputs.result != 'false' }}
run: aws s3 cp ./metabase.jar s3://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}/${{ steps.latest_path.outputs.result }}/metabase.jar
- name: Create cloudfront invalidation
run: |
@@ -374,7 +406,7 @@ jobs:
echo "Finished!"
- name: Tag the container image as latest
if: ${{ steps.latest_version_check.outputs.result == 'latest' }}
if: ${{ !inputs.auto && steps.latest_version_check.outputs.result == 'latest' }}
run: |
echo "Pushing ${{ env.DOCKERHUB_REPO }}:latest ..."
docker tag localhost:5000/local-metabase:${{ steps.canonical_version.outputs.result }} ${{ env.DOCKERHUB_REPO }}:latest
@@ -482,16 +514,25 @@ jobs:
$GITHUB_WORKSPACE/release/reorder-tags.sh ${{ needs.check-version.outputs.ee }} ${{ inputs.commit }}
trigger-docs-update:
if: ${{ inputs.skip-release-notes != true }}
needs: push-tags
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
needs:
- push-tags
- check-version
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
env:
NEW_OSS_VERSION: ${{ needs.check-version.outputs.oss }}
NEW_EE_VERSION: ${{ needs.check-version.outputs.ee }}
GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.DOCS_UPDATE_TOKEN }}
script: |
github.rest.repos.createDispatchEvent({
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
await github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: '${{ secrets.DOCS_REPO }}',
event_type: 'trigger-docs-update',
@@ -499,9 +540,96 @@ jobs:
version: '${{ inputs.version }}'
}
});
- uses: actions/checkout@v4
with:
token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- name: update releases.md
uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const fs = require('fs');
const releaseText = fs.readFileSync('./docs/releases.md', 'utf8');
const newReleaseText = releaseText
.replace(
/## Metabase Enterprise Edition releases\n\n/,
`## Metabase Enterprise Edition releases\n\n- [${process.env.NEW_EE_VERSION}](https://github.com/metabase/metabase/releases/tag/${process.env.NEW_EE_VERSION})\n`
)
.replace(
/## Metabase Open Source Edition releases\n\n/,
`## Metabase Open Source Edition releases\n\n- [${process.env.NEW_OSS_VERSION}](https://github.com/metabase/metabase/releases/tag/${process.env.NEW_OSS_VERSION})\n`
);
fs.writeFileSync('./docs/releases.md', newReleaseText);
- name: commit and push updates
run: | # bash
git config --global user.email "metabase-bot@metabase.com"
git config --global user.name "Metabase bot"
git checkout -b docs-add-$NEW_OSS_VERSION
cd docs/
git add releases.md
git commit -m "Add $NEW_OSS_VERSION to the list of releases"
git push origin docs-add-$NEW_OSS_VERSION --force
- name: open pr with updates
run: | # bash
gh pr create --fill \
--body "Like it says on the tin 😁" \
--label "Type:Documentation" \
--label "backport" \
--reviewer "jeff-bruemmer" \
--assignee "jeff-bruemmer"
trigger-cloud-issues:
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const version = '${{ inputs.version }}';
const enterpriseVersion = version.replace(/^v0\./, "v1.");
github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: '${{ vars.OPS_REPO }}',
event_type: 'create-release-issues',
client_payload: {
version: enterpriseVersion,
}
});
trigger-ee-extra-pr:
needs: verify-s3-download
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
script: | # js
const version = '${{ inputs.version }}';
const enterpriseVersion = version.replace(/^v0\./, "v1.");
github.rest.repos.createDispatchEvent({
owner: '${{ github.repository_owner }}',
repo: 'metabase-ee-extra',
event_type: 'update-ee-extra-build',
client_payload: {
version: enterpriseVersion,
auto: '${{ inputs.auto }}',
}
});
draft-release-notes:
if: ${{ inputs.skip-release-notes != true }}
if: ${{ !inputs.auto && inputs.skip-release-notes != true }}
needs: push-tags
runs-on: ubuntu-22.04
timeout-minutes: 15
@@ -553,7 +681,7 @@ jobs:
});
publish-version-info:
if: ${{ inputs.skip-version-info != true }}
if: ${{ !inputs.auto && inputs.skip-version-info != true }}
runs-on: ubuntu-22.04
needs: [push-tags, check-version]
timeout-minutes: 15
@@ -611,7 +739,66 @@ jobs:
--distribution-id ${{ vars.AWS_CLOUDFRONT_STATIC_ID }} \
--paths "/version-info.json" "/version-info-ee.json"
publish-complete-message:
if: ${{ !inputs.auto }}
runs-on: ubuntu-22.04
needs: [draft-release-notes, verify-docker-pull, verify-s3-download, publish-version-info]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send publish complete message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
generalChannelName: 'general',
}).catch(console.error);
auto-publish-complete-message:
if: ${{ inputs.auto }}
runs-on: ubuntu-22.04
needs: [push-tags, verify-docker-pull, verify-s3-download]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send auto publish complete message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPublishCompleteMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPublishCompleteMessage({
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
generalChannelName: '',
}).catch(console.error);
manage-milestones:
if: ${{ !inputs.auto }}
permissions: write-all
runs-on: ubuntu-22.04
needs: [draft-release-notes, publish-version-info] # this will ensure that the milestone stays open until the release notes are published

View File

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

View File

@@ -2,7 +2,7 @@ name: Re-run Flaky Workflows
on:
workflow_run:
workflows: [Backend, Driver Tests, E2E Tests, Frontend]
workflows: [Backend, Driver Tests, E2E Tests, Frontend, Backend-Cloverage]
types: [completed]
branches: [master, 'release-x.**', 'backport-**']
@@ -10,7 +10,7 @@ jobs:
rerun-on-failure:
name: 'Re-run ''${{ github.event.workflow_run.name }}'' workflow'
runs-on: ubuntu-22.04
# Do not re-run scheduled workflow runs. That's only Replay.io E2E tests for now.
# Do not re-run scheduled workflow runs
if: github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event != 'schedule'
env:
BRANCH_NAME: ${{ github.event.workflow_run.head_branch }}
@@ -45,7 +45,7 @@ jobs:
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
} else {
} else if (!BRANCH.includes('backport-')) {
// notify slack of repeated failure
const { WebClient } = require('@slack/web-api');
const slack = new WebClient('${{ secrets.SLACK_BOT_TOKEN }}');

View File

@@ -0,0 +1,38 @@
name: Security Issue Slack Notification
on:
issues:
types:
- labeled
jobs:
on-issue-opened:
runs-on: ubuntu-22.04
timeout-minutes: 5
if: github.event.label.name == 'SECURITY'
steps:
- name: Setting title
uses: actions/github-script@v7
id: vars
with:
script: |
core.setOutput('issue_title', ${{ toJson(github.event.issue.title) }}.replaceAll(/"/g, '\\"'));
- name: Send the issue ${{ github.event.issue.number }} to Slack
id: slack
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ steps.vars.outputs.issue_title }}\n${{ github.event.issue.html_url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SECURITY_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

257
.github/workflows/tag-for-release.yml vendored Normal file
View File

@@ -0,0 +1,257 @@
name: Release 1a - Tag Release Artifact
run-name: Tag ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Metabase version (e.g. v0.46.3)'
type: string
required: true
commit:
description: 'A full-length commit SHA-1 hash'
required: true
auto:
description: 'auto-patch release DO NOT SET MANUALLY'
type: boolean
default: false
jobs:
start-message:
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Send build start message
uses: actions/github-script@v7
env:
SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
script: | # js
const { sendPreReleaseMessage } = require('${{ github.workspace }}/release/dist/index.cjs');
await sendPreReleaseMessage({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: '${{ inputs.version }}',
runId: '${{ github.run_id }}',
releaseSha: '${{ inputs.commit }}',
userName: '${{ github.actor }}',
channelName: '${{ vars.SLACK_RELEASE_CHANNEL }}',
}).catch(console.error);
check-version:
runs-on: ubuntu-22.04
timeout-minutes: 10
outputs:
ee: ${{ fromJson(steps.canonical_version.outputs.result).ee }}
oss: ${{ fromJson(steps.canonical_version.outputs.result).oss }}
steps:
- name: Fail early on the incorrect version format
if: ${{ !(startsWith(inputs.version,'v0.') || startsWith(inputs.version,'v1.')) }}
run: |
echo "The version format is invalid!"
echo "It must start with either 'v0.' or 'v1.'."
echo "Please, try again."
exit 1
- uses: actions/checkout@v4
with:
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get Release Version
uses: actions/github-script@v7
id: canonical_version
with:
script: | # js
const { isValidVersionString, getCanonicalVersion, hasBeenReleased } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
if (!isValidVersionString(version)) {
throw new Error("The version format is invalid! It must start with either 'v0.' or 'v1.'.");
}
const versions = {
ee: getCanonicalVersion(version, 'ee'),
oss: getCanonicalVersion(version, 'oss'),
};
const ossReleased = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.oss,
});
const eeReleased = await hasBeenReleased({
github,
owner: context.repo.owner,
repo: context.repo.repo,
version: versions.ee,
});
if (ossReleased || eeReleased) {
throw new Error("This version has already been released!", version);
}
return versions;
check-commit:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Check out the code to verify the release branch
uses: actions/checkout@v4
with:
fetch-depth: 0 # IMPORTANT! to get all the branches
sparse-checkout: release
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Get Release Branch
uses: actions/github-script@v7
id: release_branch
with:
result_encoding: string
script: | # js
const { getReleaseBranch } = require('${{ github.workspace }}/release/dist/index.cjs');
const version = '${{ inputs.version }}';
const releaseBranch = getReleaseBranch(version);
return releaseBranch;
- name: Ensure that the specified commit exists in the ${{ steps.release_branch.outputs.result }} release branch
run: |
RELEASE_BRANCH=${{ steps.release_branch.outputs.result }}
git checkout $RELEASE_BRANCH
git branch --contains ${{ inputs.commit }} | grep -q $RELEASE_BRANCH \
&& echo "Commit found in correct release branch" \
|| (echo "Commit not found in correct release branch" && exit 1)
tag-uberjar-for-release:
needs: [check-version, check-commit]
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
matrix:
edition: [oss, ee]
env:
INTERACTIVE: false
steps:
- name: Get correct version number
run: | # bash
if [ '${{matrix.edition}}' == 'ee' ]; then
version='${{ needs.check-version.outputs.ee }}'
else
version='${{ needs.check-version.outputs.oss }}'
fi
echo "VERSION=$version" >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17 # 11 throws an error on jar uf
- name: Retrieve test build uberjar artifact for ${{ matrix.edition }}
id: find_release_artifact
uses: actions/github-script@v7
with:
result-encoding: string
script: | # js
const fs = require('fs');
const artifacts = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
name: `metabase-${{ matrix.edition }}-${{ inputs.commit }}-uberjar`,
per_page: 1,
});
if (!artifacts.data?.artifacts?.[0]?.id) {
console.warn(`No existing artifacts found for ${{ inputs.commit }}, need to build jar`);
if ("${{matrix.edition}}" === 'oss') {
// only trigger the build job on OSS, otherwise we'll get double builds
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'build-for-release.yml',
ref: 'refs/heads/master',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
}
});
}
throw new Error('aborting in favor of build script');
}
const artifact_id = artifacts.data.artifacts[0].id;
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact_id,
archive_format: 'zip',
});
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/mb.zip`, Buffer.from(download.data));
- name: Unzip Metabase artifact containing an uberjar
run: |
unzip mb.zip
mv target/uberjar/metabase.jar metabase.jar
- name: Update version.properties in jar
run: | # sh
jar xf metabase.jar version.properties
echo "Old version.properties:"
cat version.properties
sed -i "s/^tag=.*/tag=$VERSION/" version.properties
echo "\n\nNew version.properties:"
cat version.properties
echo "\n\nUpdating metabase.jar with new version.properties"
jar uf metabase.jar version.properties
- name: Store commit's SHA-1 hash
run: echo ${{ inputs.commit }} > COMMIT-ID
shell: bash
- name: Calculate SHA256 checksum
run: sha256sum ./metabase.jar > SHA256.sum
shell: bash
- name: Upload JARs as artifact
uses: actions/upload-artifact@v4
with:
name: metabase-release-${{ matrix.edition }}-${{ inputs.commit }}-uberjar
path: |
./metabase.jar
./COMMIT-ID
./SHA256.sum
trigger-tests:
needs: [tag-uberjar-for-release]
permissions:
actions: write
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: trigger pre-release testing
uses: actions/github-script@v7
with:
script: | # js
github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'pre-release.yml',
ref: '${{ github.ref }}',
inputs: {
commit: '${{ inputs.commit }}',
version: '${{ inputs.version }}',
auto: '${{ inputs.auto }}',
}
});

134
.github/workflows/translation-update.yml vendored Normal file
View File

@@ -0,0 +1,134 @@
name: Update Translations
run-name: Update Translations for v${{ inputs.version }} - ${{ inputs.step }}
on:
workflow_dispatch:
inputs:
step:
type: choice
description: Upload untranslated strings | Download translated strings
options:
- upload
- download
required: true
version:
type: string
description: "The version number for which to update translations (e.g. 43, 58.7)"
required: true
permissions:
contents: write
pull-requests: write
jobs:
upload-translations:
name: Upload Translations
if: ${{ inputs.step == 'upload' }}
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
POEDITOR_API_TOKEN: ${{ secrets.POEDITOR_API_TOKEN }}
POEDITOR_PROJECT_ID: 200535
VERSION: ${{ inputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: manage-translations
- name: install gettext
run: sudo apt-get install gettext
# TODO: check for untranslated strings
- name: Upload strings to be translated
run: | # sh
./bin/i18n/update-translation-template
./bin/i18n/export-pot-to-poeditor
echo "Strings uploaded to POEditor"
- name: Commit changes
env:
GH_TOKEN: ${{ github.token }}
run: | # sh
git config user.name github-actions
git config user.email github-actions@github.com
BRANCH_NAME="update-translations-v$VERSION"
git checkout -b $BRANCH_NAME
git add locales/
git commit -m "Add new strings for v$VERSION"
git push -u origin $BRANCH_NAME
gh pr create \
--reviewer "${GITHUB_ACTOR}" \
--assignee "${GITHUB_ACTOR}" \
--title "Update Translations for v$VERSION" \
--body "Update translations from POEditor for v$VERSION
See [translation update documentation](https://www.notion.so/metabase/Process-for-updating-translations-421db70048fe400da1153ad0b61102f4)
## To Do
- [x] Upload new strings to POEditor
- [ ] Message contributors on POEditor (manual)
- [ ] Copy source strings to english language (manual)
- [ ] Download translations from POEditor (github action)
- [ ] Merge this PR and backport to the release branch (manual)
" \
--label "backport" \
--label "Customization/i18n"
# TODO: notify contributors
# TODO: copy source strings to english language
download-translations:
name: Download Translations
if: ${{ inputs.step == 'download' }}
runs-on: ubuntu-22.04
timeout-minutes: 20
env:
POEDITOR_API_TOKEN: ${{ secrets.POEDITOR_API_TOKEN }}
POEDITOR_PROJECT_ID: 200535
VERSION: ${{ inputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# assumes there's already a branch with that name from the upload step
ref: update-translations-v${{inputs.VERSION}}
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: manage-translations
- name: Prepare build scripts
run: cd ${{ github.workspace }}/release && yarn && yarn build
- name: Automatically translate untranslated strings
uses: actions/github-script@v7
with:
script: | # js
const { autoTranslateSupportedLanguages } = require('${{ github.workspace }}/release/dist/index.cjs');
await autoTranslateSupportedLanguages();
- name: Download translated strings
run: | # sh
cd ${{ github.workspace }}
./bin/i18n/import-po-from-poeditor
./bin/i18n/build-translation-resources
- name: Commit changes
run: | # sh
git config user.name github-actions
git config user.email github-actions@github.com
BRANCH_NAME="update-translations-v$VERSION"
git add locales/
git commit -m "Update translations"
git push -u origin $BRANCH_NAME

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

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

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

13
.gitignore vendored
View File

@@ -1,4 +1,5 @@
*.class
*.*.rej
*.iml
*.jar
*.log
@@ -26,7 +27,7 @@
/.lein-repl-history
/.sqlite.db
/backend-checksums.txt
/backend-docs/uberdoc.html
/backend-docs
/build.xml
/checkouts
/classes
@@ -50,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
@@ -94,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
@@ -106,3 +109,9 @@ modules/drivers/*/.lsp/*
.clj-kondo/metosin/malli-types-clj
.github/static-viz-sources.yaml
# airgap
/resources/airgap/
# swc
.swc/

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