Compare commits

..

2718 Commits

Author SHA1 Message Date
Diogo Mendes
a403e51022 Lint 2022-04-04 12:29:08 -03:00
Diogo Mendes
3263ca1f66 Remove delay to not trigger autocomplete 2022-04-04 12:06:48 -03:00
Nemanja Glumac
450abef662 Run E2E tests using Chrome instead of Electron (#21438)
* Run E2E tests using Chrome

* Create snapshots using Chrome

* Test in GHA once again

* Set browser in the base Cypress config

* Change branch back to `master` for E2E workflow
2022-04-04 11:00:05 +02:00
Nemanja Glumac
1b3c9cda7b Fix subscription flakes related to "Email sent" string (#21441) 2022-04-04 09:55:18 +02:00
Nemanja Glumac
a6078be4fb [E2E] Fix admin datetime flakes (#21440)
* Fix flakes

* Reinforce localization test
2022-04-03 22:52:15 +02:00
Nemanja Glumac
52194cc957 Fix binning click-related flakes (#21436) 2022-04-02 22:36:36 +02:00
Diogo Mendes
ae3c76b216 Fix small typo (#21432) 2022-04-02 15:09:06 -03:00
Nemanja Glumac
3a7779b08c [E2E] Optimize native filters tests (#21427)
* Extract repro for #16756

* Optimize looping through sql date field fitlers

* Optimize looping through sql number field fitlers

* Optimize looping through sql string field fitlers

* Extract common helper

* Run only native filters in the current branch

* Reduce flakiness in `type`

* Merge field filters together

* Run tests on `master` again
2022-04-02 20:07:29 +02:00
Nemanja Glumac
1f0c6d8a97 Upgrade Cypress to the v9.5.3 (#21433) 2022-04-02 20:03:27 +02:00
Alexander Lesnenko
1da02e27a8 FE: Download permission users UI (#20931)
* download permission UI with specs

* permission editor UI tweaks

* reset download permission on blocked data sources

* update specs

* update copy

* update specs
2022-04-01 22:38:00 -04:00
Noah Moss
04473fc5ee QP middleware for download perms (#21021) 2022-04-01 21:34:15 -04:00
Alexander Lesnenko
eb50aafab7 FE: Subscriptions management permission (#21307)
* subscriptions management permission

* specs

* update contract

* specs
2022-04-01 19:08:00 -04:00
Alexander Polyankin
aa0878e372 The skeleton of the new homepage (#21355) 2022-04-01 21:00:25 +03:00
Nemanja Glumac
96aa2f358c [E2E] Fix flake in repro 17514 for good (#21423) 2022-04-01 18:45:44 +02:00
Diogo Mendes
e2a166e3aa Fix name [skip ci] (#21424) 2022-04-01 13:43:19 -03:00
Ngoc Khuat
e36304ec82 Grant Subscription permission by default (#21179)
* add API to fetch general permisisons graph

* add API to update general permissionns

* change author of migration

* update documents

* misc fixes to applease the CIs

* Add tests for general permission APIs and models

* linting and fix a failed test case

* fix some failed tests

* update docs and change /subscription/ to /general/subscription/ for consistency

* Hook and migration to make sure subscription are created for new groups by default

* add schema migrations tests

* set for the win

* address noah's comments

* Parse number as is in http-client for tests

* address Cam's comments

* revert the last commit about parsing API response in tests

* change fk name

* delete a comment

* Changes:
- Rename `changes` column to `after` to keep things consistent
- If a group  has no General Permisions, it'll not be included in the graph
- Update tests and some docs

* fix failing tests in ee

* add some tests and make docstring completes

* polishing comments

* namespaces

* fix namespaces

* Add general permisison flags to `GET /api/user/current` (#21250)

* return general permisison flags for /api/current

* namespaces

* move permission flags to under

* Enforce Subscription permissions (#21285)

* return general permisison flags for /api/current

* namespaces

* enforce general permissions for subscription and tests

* update check-has-general-permisison to add option to require superuser

* adding arity

* add tests for permissions helper function

* Move advanced permissions check funcs to ee namespace

* unpushed changes

* namespaces

* ignore exception when load namespaces

* change helper fn name

* Enforce Monitoring Permissions (#21321)

* return general permisison flags for /api/current

* namespaces

* enforce general permissions for subscription and tests

* update check-has-general-permisison to add option to require superuser

* adding arity

* enforce permissions to call /api/dataset for internal queries

* enforce monitoring permissions for api/task and api/util

* add tests for OSS

* add tests for db-connection-info endpoint

* change test schema

* update name func and fix ns

* whydon't CI run ?

* Enforce Setting Permissions (#21386)

* return general permisison flags for /api/current

* namespaces

* enforce general permissions for subscription and tests

* update check-has-general-permisison to add option to require superuser

* adding arity

* enforce permissions to call /api/dataset for internal queries

* enforce monitoring permissions for api/task and api/util

* add tests for OSS

* add tests for db-connection-info endpoint

* change test schema

* update name func and fix ns

* whydon't CI run ?

* Enforce Setting permissions

* fix failing test

* make sure we could run slack test twice

* make the mock consistent

* address Noah's comments

* shorter permissions check
2022-04-01 23:11:20 +07:00
Gustavo Saiani
29c957c0e6 Cover more entities (#21406) 2022-04-01 16:10:40 +01:00
Noah Moss
01092b5cf5 DB details permissions reads & writes (#21327) 2022-04-01 10:59:17 -04:00
Noah Moss
2d81ec5859 Data model permission writes & reads (#21168) 2022-04-01 09:44:11 -04:00
Diogo Mendes
e2d2e6fea8 Ignore running E2E workflow when not needed (#21384)
* Ignore running E2E workflow when not needed

* Adding - ".**" as suggested

* Playing safe for now
2022-04-01 10:34:11 -03:00
Nemanja Glumac
7dd93f61dc Fix flaking collection tests [ci skip] (#21417) 2022-04-01 09:23:31 -03:00
Nemanja Glumac
c4e96ce099 Fix flaking Percy table snapshot in CCI [ci skip] (#21416) 2022-04-01 08:37:39 -03:00
Anton Kulyk
71d057ed12 Don't autoexpand sidebar on mobile (#21415) 2022-04-01 14:11:08 +03:00
Benoit Vinay
e68fdb16c8 15876 fix time random casting with without timezone (#21340)
* Misc

* parseTime method updated to remove timezone

* parseTime tests added

* formatTime tests added

* Unskip 15876 cypress test
2022-04-01 12:15:11 +02:00
Anton Kulyk
e0dc20a689 Clean up EditBar component (#21395) 2022-04-01 09:35:04 +01:00
Anton Kulyk
7b1fb36f8e Remove getPlainNativeQuery (#21401) 2022-04-01 09:34:51 +01:00
Anton Kulyk
0a1f9f5cbc Remove collection sidebar code (#21400) 2022-04-01 09:34:32 +01:00
Nick Fitzpatrick
82256fe0f1 Updating page title as dashboard loads (#21259)
Updating Page Title and Favicon as Dashboards load
2022-04-01 00:01:02 -03:00
Gustavo Saiani
1e89a2d40b Update bookmark list when archiving Questions in Collection page (#21390) 2022-03-31 20:30:53 -03:00
Anton Kulyk
5c563556bf [E2E] Fix flaky collections sidebar tests (#21397) 2022-03-31 23:07:06 +02:00
Anton Kulyk
64d2f1bc18 Browsing | Automatically close navbar in certain scenarios (#21358) 2022-03-31 21:50:13 +01:00
Anton Kulyk
f18b48f54d Browsing | Show sidebar on collection pages when embedding (#21352) 2022-03-31 21:49:54 +01:00
Dalton
2a5a77d1cd Set visualization mode via QB state when we are zoomed in on a specific row (#21371)
* Set visualization mode via QB state

* Unskip repro
2022-03-31 13:45:49 -07:00
Cam Saul
7272cc940b Skip filter-by-current-quarter-test for :oracle because of #10072 (#21396) [ci skip] 2022-03-31 16:42:19 -03:00
Nemanja Glumac
1f7e12f5d3 [E2E] Reinforce repro for #17514 (#21394)
* Reinforce the repro for 17514

* Fix typos
2022-03-31 16:22:39 -03:00
Anton Kulyk
43997d6357 Browsing | Improve mobile sidebar (#21347) 2022-03-31 19:32:06 +01:00
Nemanja Glumac
b058edd0b5 Set modifyObstructiveCode to false in Cypress config (#21376) 2022-03-31 19:57:08 +02:00
Dalton
e2a0a6190e @sugengsuprayogi's "Fix download question data on embedded dashboard" (#21231)
* Fix download question data on embedded dashboard

* run prettier

Co-authored-by: Sugeng Suprayogi <sugengsuprayogi@users.noreply.github.com>
2022-03-31 10:32:29 -07:00
Diogo Mendes
eb63d0729a Downgrade buildJet instance of Percy (#21391)
* Moving to a 4vCPU

* New tests

* Test Finish
2022-03-31 14:23:55 -03:00
Anton Kulyk
98fc2412bd Browsing | Refactor navigation sidebar (#21298)
* Create sidebar and add collections tree

* Fix dragged collection item's z-index

* Add links (data, archive, users' collections)

* Add ProfileLink

* Add bookmarks

* Use the new sidebar at Navbar

* Fix official collection icon opacity

* Add sidebar width to navigation constants

* Cut long item names

* Fix sidebar's horizontal scroll

* Fix remove bookmark icon position

* Fix bookmark URLs

* Fix how selected item is determined

* Jump to a collection opened from a bookmark

* Fix selected element highlighting edge cases

* Don't check for "users" collection

* Fix collapsing tree nodes

* Fix remove bookmark icon show on hover

* Fix removing a bookmark

* Fix archived collections are disabled in the tree

* Expand collection's parents after move

* Fix UI element lookups in tests

* Accept `icon` object as a SidebarLink prop

* Use "tree" a11y role for collections tree

* Always show the archive link

* Fix "other users' collections" link icon

* Fix e2e test

* Fix e2e tests

* Remove not used prop

* Make bookmarks collapsible

* Fix post-rebase issues

* Fix can't click expanded tree node to collapse

* Fix e2e test

* Remove not used code

* Use bookmark entities icon helper

* Extract renderBookmark function

* Allow custom `icon` element prop on SidebarLink

* Fix bookmarked official collection icon colors

* Fix `personal_owner_id` type

* Move Collections entity file to collections dir

* Reorganize collection entity file
2022-03-31 20:18:49 +03:00
Nemanja Glumac
d921877f73 [E2E] Fix xrays flake (#21389) 2022-03-31 18:49:58 +02:00
Anton Kulyk
947f38e683 Browsing | Fix collection type & move tree utility (#21288)
* Extend `Collection` type definition

* Use correct types

* Move `buildCollectionTree` to collection utils
2022-03-31 19:27:58 +03:00
Anton Kulyk
521cf7589e Fix mobile layout for questions and dashboards (#21349) 2022-03-31 16:39:14 +01:00
Nemanja Glumac
2bf4f9434c Fix flakes in native filters spec [ci skip] (#21387) 2022-03-31 12:29:42 -03:00
Anton Kulyk
522d6d33f0 Clean up SearchBar component (#21369)
* Give methods some space

* Extract `active` state setter methods

* Clean up styled components

* Extract more styled-components

* Extract methods

* Turn SearchBar into functional component

* Convert SearchBar to TypeScript
2022-03-31 17:16:49 +03:00
Luis Paolini
c25bfb2ffb Reverting the unifying Percy+Build PR (#21383) 2022-03-31 11:14:58 -03:00
Nemanja Glumac
6d76b38b54 Fix a flake in repro for #15655 [ci skip] (#21379) 2022-03-31 09:00:42 -03:00
Diogo Mendes
ec61fd9be4 Reverting cache (#21378) 2022-03-31 08:56:54 -03:00
Diogo Mendes
b449a87860 Reverting #21346 (#21375) 2022-03-31 08:10:06 -03:00
Anton Kulyk
7b98a1712b Fix error and new question pages layout (#21329)
* Fix error pages content centering

* Fix `/question/new` route content centering
2022-03-31 13:20:44 +03:00
Nemanja Glumac
520954d0ba Revert "Bump executor (#21036)" (#21373)
This reverts commit 160c3c7231cb1340ee19b98b16937d90828a8b94.
2022-03-31 05:58:03 -03:00
Gustavo Saiani
eabf3cc134 Bookmark Model from Collection page (#21367) 2022-03-30 20:52:53 -03:00
Anton Kulyk
9e49a3708c Browsing | Refactor Tree component (#21287) 2022-03-30 22:32:58 +01:00
Nemanja Glumac
0e8d45700f Fix a flake in models (#21368) 2022-03-30 23:09:26 +02:00
Anton Kulyk
8b341b1ac3 Add global navigation sidebar (#21069)
* Prototype new nav skeleton (#20875)

* yarn

* begin basic layout flip

* rough in collections list

* position query builder

* remove fitViewport from QB to fix layout quirks

* extract search

* clean up props

* position search / style

* fix dashboard layout

* fix search icon

* move ProfileLink

* tweak spacing

* fix burger

* add basic toggle

* tweak layout for sidebar toggle

* tweak style

* tweak sidebar sizing

* Quick fix to prototype starting points init (#20922)

* fix scroll overflow on sidebar

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>

* add currentUser to profile link

* move footer items out of collection sidebar

* tweak footer style

* fix hover style

* clean up footer

* fixup

* remove un-needed overflow hidden

* hide app bar when in admin mode

* merge sidebar header into new color scheme / nav layout

* clean up headers

* fix root collection spacing

* smaller font size for nav items

* provide flex context, fixes metadata editing

* fix login page

* Remove console logs

* Put user's personal collection under Our analytics (#21061)

* Browsing | Handle long item names in the sidebar (#21063)

* Handle long names in the nav sidebar

* Show tooltip with a full item name if its cut

* Browsing | Fix data reference & admin permissions layout (#21101)

* Remove admin navbar CSS fix

* Handle admin navbar in root App component

* Extract styled components

* Fix data reference layout

* Fix main container height

* Browsing | Hide sidebar for questions, models and dashboards on page open (#21064)

* Manage default sidebar visibility

* Handle ad-hoc questions better

* Move nav elements based on feedback (#21190)

* scoot buttons around

* move logo to appbar, scoot search

* remove user footer, home link [ci skip]

* review feedback [ci skip]

* fix accidental removal of links (minimalism was a fad anyway) (#21192)

* add button classes to new button (#21213)

* Nav visual changes (#21223)

* switch nav bg + move styling to NavRoot

* readable text

* increase contrast

* selected icon color

* remove bottom padding

* search bar color

* restructure sidebar position

* fix sidebar header color

* move to fixed when small

* fix multiple scrollbars

* fix sidebar width

* home as own item, gear below

* fix admin nav

* extract nav constant, fix types

* remove unused constant [ci skip]

* New nav - get base colors in order (#21262)

* new sidebar button

* nav bg to bg-light

* fix link track, remove extra home link

* color tweaks

* swap colors

* Fix E2E tests for new navigation UI (#21196)

* Use `main` HTML tag for main page content

* Add extra UI helpers for Cypress

* Fix tests failing due to nav UI changes

* Remove not needed NavBar code

* Fix loading databases list

* Use `navigationSidebar` helper for collections

* Use `navigationSidebar` for collection tests

* Close sidebar in SQL filters tests

* Extract AppBar component to `metabase/nav`

* Fix test

* Fix test

* Skip sidebar visibility control test

* Fix JSON engine DB check

* Fix DatasetEditor edit bar colors

* Fix global containers heights

* Fix tests scrolling target

* Fix styles

* Fix navbar cypress helpers

* [ci nocache]

* Fix scroll in e2e test

* Browsing | Manage sidebar state with redux (#21226)

* Move navbar state to redux

* Hide sidbebar using CSS

* Fix native E2E test

* Fix native e2e test

* Fix model tests

* Use more accurate element getters

* Fix e2e tests

* Browsing | Fix dashboard UI (#21233)

* Fix parameter widgets event listeners

* Attach scroll events to "main" instead of window

* Resize filters panel when navigation sidebar open

* Reorder imports at App

* Hide AppBar and NavBar when editing dashboard

* Fix navbar & appbar visibility

* Fix filter positions

* Extract `getMainElement` helper

* Update unit tests

* Fix test

* Browse fix bulk actions (#21320)

* make bulk action bar aware of sidebar, remove extraneous layout components

* clean up styling

* convert BulkActionBar to tsx

* Fix types

Co-authored-by: Kyle Doherty <5248953+kdoh@users.noreply.github.com>
Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2022-03-30 22:29:50 +03:00
Diogo Mendes
c6aff0bfe8 Downgrade Github actions to version 2 (#21364)
* Downgrade download action version

* Revert upload action
2022-03-30 16:09:56 -03:00
adam-james
3ff3a3e716 Bookmarks remove favorites (#21353)
* Remove errant :bookmarked hydration key

This was left over from an incorrect implementation of :bookmarked status. No :bookmarked hydration function exists
anyway, the key does nothing.

* Remove old favorites models that are superceded by bookmarks

* Remove dashboard favorite require
2022-03-30 11:58:28 -07:00
heckendorfc
3d6858b31c Docs - point Models link to the right directory (#21331) 2022-03-30 15:27:29 -03:00
Nemanja Glumac
72c19e2673 [E2E] Log output to file (#21360) 2022-03-30 20:21:43 +02:00
Gustavo Saiani
6e75652dd5 Use whitelabelable color (#21351) 2022-03-30 15:20:46 -03:00
Jeff Bruemmer
4800159c75 update links (#21356) 2022-03-30 14:16:31 -04:00
Nemanja Glumac
dc9e586df3 Remove unsupported flag from the open mode in Cypress [ci skip] (#21357) 2022-03-30 14:52:33 -03:00
Luis Paolini
d3cd961c38 Unify build + Percy processes (#21104)
* Rebase

* Adding maildev version

copying Pawit's commit on this specific file
2022-03-30 14:50:01 -03:00
Alexander Polyankin
a2ee011bd1 Fix a race condition when creating default timelines (#21354) 2022-03-30 20:06:02 +03:00
adam-james
27c7954760 Added bookmarked-score to enable boosting of bookmarked items (#21171)
* Added bookmarked-score to enable boosting of bookmarked items

* Collection Search Query doesn't error with bookmark left join

* adjust collection id AS in base query

* Set proper bookmark status in collection for search tests

* Actually score bookmarks when bookmarked

* Added a bookmark scoring test

* Remove old todo since it does work. (yay)
2022-03-30 09:29:00 -07:00
Diogo Mendes
a878a169fd Increasing Buildjet machines on Uberjar and E2E for better performance (#21346)
* Test 8vCPU

* Run just uberjar for metrics

* Testing with 8

* Reverting commented code
2022-03-30 12:49:05 -03:00
Ariya Hidayat
02a627e6ee Remove flicker in SQL editing autocomplete (#21302) 2022-03-30 07:20:22 -07:00
Mahatthana (Kelvin) Nomsawadi
61ac7789fc Make it easier to get help (#21212) 2022-03-30 21:19:41 +07:00
Ryan Laurie
617eaffcb4 Fix Time Series Fill When Grouping by Minute (#21323)
* fix minute index

* test specific timeseries intervals
2022-03-30 06:23:57 -06:00
Alexander Polyankin
7cc543f374 Show the events time range in the sidebar (#21293) 2022-03-30 13:32:49 +03:00
Nemanja Glumac
444d16c81b [E2E] Add embedding group to GitHub Actions (#21295) 2022-03-30 11:17:00 +02:00
Howon Lee
3013b5151e JSON column API change and fixes (#21175)
All under the grand path to #708.

Changes field API to be compatible with nfc-paths. Allows joining of nested field columns by shoving the full identifier into the postgres function call. Also fixes arcane macro test bug by not using the macro.
2022-03-29 23:12:30 -07:00
Ariya Hidayat
218f702700 [E2E] Explicitly point to the running Snowplow micro (#21335) 2022-03-29 22:04:40 -07:00
Mahatthana (Kelvin) Nomsawadi
9f9a359391 Make "Invite someone" button not overlapping with other elements (#21279) 2022-03-30 11:47:45 +07:00
Pawit Pornkitprasan
10dec2458f [e2e] use maildev version 1.1.0 (#21333)
New releases of maildev were recently made which has UI changes
as well as changing the default port from 25 to 1025, causing tests
to fail.

While we may want to upgrade maildev in the future, let's stick to
the old version first to unbreak all the tests.
2022-03-30 10:19:40 +07:00
Pawit Pornkitprasan
0a394e37ac Don't log stack trace when opportunistically trying out SSL (#21280)
* Revert "Log database connection error before humanizing it (#10695)"

This reverts commit 426df1631d.

This is no longer needed. The original exception message is kept
in the inner exception and everywhere this is used, the whole
stack trace is logged anyway.

* Don't log exception when opportunistically trying SSL
2022-03-29 22:18:51 -03:00
Alexander Polyankin
c59a1756c1 Merge events by pixel coordinates (#21282) 2022-03-30 00:02:00 +03:00
Ariya Hidayat
f613e81a20 Repro #21034: Autocomplete flicker in SQL Editor (#21301) 2022-03-29 13:11:29 -07:00
Gustavo Saiani
b669bd7cbc Bookmarks: render official icons for collections (#21240) 2022-03-29 17:08:05 -03:00
Nemanja Glumac
c48a2ea1d9 Separate auditing related tests from sharing E2E group (#21324) 2022-03-29 16:41:54 -03:00
Bryan Maass
dc3b6078a7 Fix Loading the SSL root certificate into a TrustManager (#21304)
To be usable in the postgres driver, the _uploaded_ root cert needs to:

  - have its prefix stripped
  - and be base64 decoded

(note: this was not an issue when pointing to a local file)
2022-03-29 12:19:37 -07:00
Ariya Hidayat
435e88ff1a [E2E] Run the tests with Snowplow (Micro) (#21319) 2022-03-29 12:08:13 -07:00
Nemanja Glumac
34dec3c034 [E2E] Refactor parameters-embedded spec into embedding-dashboard (#21292)
* Remove unneeded requests

* Remove tests not related to embedding

* Remove embedded question test

Covered in `embedding-native.cy.spec.js`

* Extract question details

* Extract dashboard details

* Fix question details

* Refactor an anti-pattern

Do not assign return values to previously defained variables.

* Do not use hard coded JWT signed token

* Simplify and merge dashboard tests into one

* Divide context into UI and API

* Extract common code into `beforeEeach` for UI context

* Merge UI tests into one

* Rename spec to `embedding-dashboard`

* Remove unnecessary `beforeEach` block

* Extract data and functions into a separate file

* Make sure we can disable previously set parameters
2022-03-29 20:12:19 +02:00
Alexander Polyankin
1c9b7af74c Add markdown label for events (#21254) 2022-03-29 20:53:11 +03:00
Alexander Polyankin
d373bf308c Scroll to selected event when opening the sidebar (#21317) 2022-03-29 19:50:36 +03:00
Noah Moss
702f2933a7 Misc bug fixes for download permissions (#21275) 2022-03-29 12:15:21 -04:00
Nemanja Glumac
51968bd684 Repro #15876: Incorrect casting to TIME (#21316)
* Add repro for #15876 [ci skip]

* Store database id in a variable [ci skip]
2022-03-29 11:02:17 -03:00
Diogo Mendes
01ceda53bd Changing currents group from folder to edition (#21314)
* Changing group to edition

* Update .github/workflows/e2e-tests.yml

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

* Update .github/workflows/e2e-tests.yml

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

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2022-03-29 11:01:59 -03:00
Noah Moss
abea0e31a8 Allow non-admins to read and write user-local settings via the API (#21235) 2022-03-29 09:55:50 -04:00
Ngoc Khuat
57d0ff0ac7 Add General Permissions graph APIs (#21124)
* add API to fetch general permisisons graph

* add API to update general permissionns

* change author of migration

* update documents

* misc fixes to applease the CIs

* Add tests for general permission APIs and models

* linting and fix a failed test case

* fix some failed tests

* update docs and change /subscription/ to /general/subscription/ for consistency

* address noah's comments

* Parse number as is in http-client for tests

* revert the last commit about parsing API response in tests

* change fk name

* Changes:
- Rename `changes` column to `after` to keep things consistent
- If a group  has no General Permisions, it'll not be included in the graph
- Update tests and some docs

* fix failing tests in ee

* add some tests and make docstring completes

* fix namespaces
2022-03-29 17:42:48 +07:00
Pawit Pornkitprasan
cca7c1701c Speed up cypress start time (#21310)
* Set integrationFolder to avoid cypress globbing all folders

* cypress snapshot: don't upload compress video on pass
2022-03-29 15:59:45 +07:00
Alexander Polyankin
e70de4b5ac Decrease the margin between the event title and author (#21294) 2022-03-29 10:30:49 +03:00
Alexander Polyankin
5024b7a441 Select timeline events from the sidebar (#21289) 2022-03-29 10:30:17 +03:00
Noah Moss
93ea70f02e Add new valid-path-format? predicate for schema validation to fix downgrading issues generically (#21255) 2022-03-28 19:36:44 -04:00
Ryan Laurie
fc23c19ff2 Fix precision error in chart domain pad (#21263) 2022-03-28 15:38:29 -06:00
Ryan Laurie
2affdea94d Fix Padding on Single Database Names (#21283)
* use block elements to pad single database name

* fix readonly proptype console error
2022-03-28 13:06:55 -06:00
Noah Moss
a6ab6f9019 Better key parsing for json in test HTTP responses, and new test for data perms graph GET endpoint (#21216) 2022-03-28 14:07:08 -04:00
Diogo Mendes
1590598243 Fix space (#21284) 2022-03-28 13:48:38 -03:00
Diogo Mendes
02b116d967 Merge branch 'master' into master 2022-03-28 13:41:19 -03:00
Alexander Polyankin
24c7832edf Add a way to unarchive timelines and delete them permanently (#21177) 2022-03-28 18:01:50 +03:00
Ryan Laurie
0e9569788a fix overflowing long schema names (#21252) 2022-03-28 08:46:35 -06:00
Alexander Lesnenko
88afb0c966 Improve backports (#21148)
* extract actions

* check metabase membership
2022-03-28 10:05:29 -04:00
adam-james
37642aaa10 Add :dataset key to card bookmarks (#21261)
* Add :dataset key to card bookmarks

The :dataset key is boolean and indicates when a card (question) has been turned into a model.
The frontend will use this key to determine which icon is used to display the bookmark in the sidebar.

* Reduce some duplication in this test
2022-03-28 06:35:44 -07:00
Mahatthana (Kelvin) Nomsawadi
376f6a3114 Fix Cypress tests not passing on backporting PR (#21281) 2022-03-28 19:43:22 +07:00
Ariya Hidayat
f90692d3d5 Enable subdimensions on time column (type/Time) (#20902) 2022-03-27 22:15:18 -07:00
Ariya Hidayat
23517953fe Resolve node-forge to v1.3.0 (#21273) 2022-03-27 11:59:53 -07:00
Ariya Hidayat
edbd23d026 [E2E] Add sharing test group to GitHub Actions (#21274)
* [E2E] Add sharing test group to GitHub Actions

* Test in branch

* Back to master
2022-03-27 15:18:13 -03:00
Ariya Hidayat
0f46993b89 [E2E] Add models test group to GitHub Actions (#21272)
* [E2E] Add models test group to GitHub Actions

* Test in branch

* Back to master
2022-03-27 07:43:05 -03:00
Diogo Mendes
64508900a5 Moving Currents.dev from CCI to GHA (#21258)
* Removing from CCI

* Adding Currents to GHA

* Let there be run

* Returning to master

* Adding new key to new project on Currents

* Adding --ci-build-id to support GHA Re-Runs

* Returning to branch to test it more

* Removing not needed info (repo)

* Returning to master
2022-03-26 10:24:14 -03:00
Ariya Hidayat
9161ae3bb9 [E2E] Fix accidental branch switch (#21268) 2022-03-26 07:32:06 -03:00
Ariya Hidayat
884cd76dc6 [E2E] Add admin test group to GitHub Actions (#21266) 2022-03-25 20:07:49 -07:00
Ariya Hidayat
03f3269e20 Bump minimist to v1.2.6 (#21256) 2022-03-25 14:12:33 -07:00
Alexander Polyankin
ebf1dec478 Make clicking on the event title open the edit form (#21193) 2022-03-25 20:58:09 +03:00
Diogo Mendes
08f9ea6938 Rollback on version (#21257) 2022-03-25 14:43:53 -03:00
Diogo Mendes
336fe2de17 Updating Github actions to latest ones and making Ubuntu 20.04 LTS default (#21249)
* Updating actions

* [ci noskip] Changing ubuntu to latest lts as default

* [ci noskip] Fix typo
2022-03-25 14:30:23 -03:00
Ariya Hidayat
081f2e840b [E2E] Add native and native-filter test groups to GitHub Actions (#21251) 2022-03-25 10:14:29 -07:00
Luis Paolini
24d600c0d3 Add distro (#21253) 2022-03-25 13:45:51 -03:00
Alexander Polyankin
e6c0cbfdd4 Add timeline permissions (#21126) 2022-03-25 18:57:53 +03:00
Luis Paolini
8b0f2c1368 Fallback cache keys & upgrade caching actions (#21234)
* First commit

* Reverting input deletion
2022-03-25 11:40:59 -03:00
Ariya Hidayat
9c1b22577c Admin E2E tests: guard assertions with element visibility check (#21197) 2022-03-25 06:43:18 -07:00
Gustavo Saiani
b792eedab5 Toggle bookmarks list visibility (#21203) 2022-03-25 10:42:48 -03:00
Gustavo Saiani
5fce46b3ff Bookmarks: render more specific icons when bookmarked item is a question (#21170) 2022-03-25 09:32:26 -03:00
Mahatthana (Kelvin) Nomsawadi
b9602db06c Fix moved model's collection isn't displayed until page refresh (#21178) 2022-03-25 16:04:59 +07:00
Alexander Polyankin
1e445900c6 Add basic markdown support to events (#21214) 2022-03-25 11:57:37 +03:00
Nemanja Glumac
f844381337 Upgrade @types/webpack-dev-server to the latest version 4.7.2 (#21232) 2022-03-25 09:56:29 +01:00
Mahatthana (Kelvin) Nomsawadi
e81a1a31a1 Fix cannot convert questions with snippets to models (#21210)
* Add repro for #20963

* Fix cannot convert question with snippets to models
2022-03-25 15:54:38 +07:00
adam-james
200d4d815c Add :can_write to the :collection hydration for timelines (#21236) 2022-03-25 11:36:51 +03:00
Mahatthana (Kelvin) Nomsawadi
1061477bc7 Fix display values options not updated after the field is updated (#21217) 2022-03-25 11:55:30 +07:00
Ariya Hidayat
769cbef7ae Robustify timeline E2E tests (#21219) 2022-03-24 18:58:59 -07:00
Dalton
781b63d2b6 show loading wrapper until all data is available (#21172) 2022-03-24 16:24:46 -07:00
Cam Saul
9fdb17986b Fix :postgres filtering by current quarter; remove a few unneeded casts in PG SQL output (#21204)
* Fix Postgres filter by quarter

* Fix test for MongoDB to work around #5419

* Spark SQL doesn't allow quarters in intervals either
2022-03-24 16:12:22 -07:00
Ariya Hidayat
68b83a6858 Dashboard filters E2E: sync assertions with important API calls (#21200) 2022-03-24 16:02:00 -07:00
Ryan Laurie
72eaf39606 Ignore Empty Conditional Formatting Queries (#21224)
* ignore empty substrings in conditional formatting filters

* handle not-equal formatter
2022-03-24 17:01:37 -06:00
Ariya Hidayat
ac18cbf836 Remove ScratchApp (#21220) 2022-03-24 15:06:11 -07:00
Ryan Laurie
98761e7ee1 Display Custom Parameter Fields on Mobile (#21189)
* allow question paramater fields on mobile

* hide editor bar on mobile when there are no params

* show editor controls when already open

* add parameter mobile visibility test

* add visibilityToggler unit tests
2022-03-24 14:56:00 -06:00
Alexander Polyankin
20dea3249f Clip voronoi by X axis (#21186) 2022-03-24 23:27:30 +03:00
Nemanja Glumac
9e534c8dab [E2E] Introduce visitDashboard helper (#21218)
* Create `visitDashboard` E2E helper

* Apply helper to the related tests

* Fix waiting for redundant xhrs

* Make helper work for users without permission to access dashboard

* Do not use helper when asserting on individual dashcard queries

* Refactor repro for 18454

* Improve dashboard permissions test
2022-03-24 21:19:42 +01:00
adam-james
c29951e0fa Hydrate Collections on Timelines for card/collection endpoints (#21227)
* Hydrate Collections on Timelines for card/collection endpoints

* Add tests to check that collection is hydrated

* Add missing docstring
2022-03-24 13:08:31 -07:00
Anton Kulyk
4f88e2db71 Attempt to fix SummarizeSidebar flakiness (#21130)
* Refactor SummarizeSidebar

* Fix E2E test
2022-03-24 22:07:53 +02:00
Diogo Mendes
f3432569e8 Remove concurrency (#21225) 2022-03-24 16:16:45 -03:00
Gustavo Saiani
d5b9920b92 Test bookmarking from a Question page (#21164) 2022-03-24 14:33:33 -03:00
Alexander Polyankin
e45ab2b976 Resize mail icon to fix the standard viewbox (#21211) 2022-03-24 20:32:17 +03:00
Cam Saul
7f9aa58ae1 Make mt/with-everything-store parallel capable and mark more tests as ^:parallel (#21207) 2022-03-24 09:29:46 -07:00
Cam Saul
d98fbcf96e Fix expressions with duplicate column names (#21208) 2022-03-24 09:28:44 -07:00
Cam Saul
2eb6139556 Support quarters in Dashboard filters (#21205)
* Support quarters in Dashboard filters

* Mark test as ^:parallel

* 🔧
2022-03-24 09:28:23 -07:00
Ariya Hidayat
309c4058ec E2E repro 17514: another element visibility check before assert (#21199) 2022-03-24 08:31:52 -07:00
Nemanja Glumac
9f33ac3fb6 [E2E] Expand embedding native tests (#21185)
* Remove remapping as it does not have any effect on native questions

* Name filter in sync with the documentation reccommendation

* Enable sharing via UI

* Publish changes via UI

* Set the token expiration in the helper function itself

* Expand the helper to work for both questions and dashboards

* Expand helper to include filter values and hidden filters

* Asert on the `embedding_params` upon publishing embedding changes

* Expand tests with API context

* Properly fix FK filter

* Fix typo and expand helper example

* Add API test for locked parameters

* Separate UI and API tests
2022-03-24 16:13:46 +01:00
Ariya Hidayat
f91bbd0683 Mongo E2E test: fix race condition between typing and dataset (#21123) 2022-03-24 07:53:25 -07:00
adam-james
fca980fb27 Default Icon for Timelines / Events and Root Collection Hydration (#21201)
* Timeline has default icon, Timeline Event default icon from Timeline

* Move the icon schema to Timeline model.

The 'default icon' of a Timeline is concretely 'star', whereas the default icon for an event is taken from the
Timeline it's part of, which could be any of the icons.

Since the default should be one of the icons listed in the Schema, it makes sense for readability that the icon schema
is in the same namespace.

* When timeline's collection_id is nil, build the root collection

Timeline's always have :collection_id, and when the ID is a proper ID, :collection hydration works properrly. When the
ID is nil, we don't pass the necessary data to the frontend. So, match the behaviour for the `GET
/api/collection/root` endpoint and use that data on the :collection key

* Add root collection hydration to GET /api/timeline

* Add tests for collection hydration and timeline default icons
2022-03-24 07:39:18 -07:00
Noah Moss
3eb0d2c256 Fix test for inclusion of global viz settings in viz settings middleware (#21188) 2022-03-24 08:29:16 -04:00
Alexander Polyankin
9d6d560973 Increase the click area for the back button in event modals (#21187) 2022-03-24 10:57:56 +03:00
Cam Saul
38ea154a26 Replace remaining references to qp/query->preprocessed with qp/preprocess (#21047)
* Remove references to qp/query->preprocessed

* Fix Oracle
2022-03-23 19:47:59 -07:00
Ariya Hidayat
a3222b7e4b [E2E] Add collections test group to GitHub Actions (#21159) 2022-03-23 18:54:38 -07:00
adam-james
3d3b507ae1 Escaping quotation marks in a tru string to pass the linter (#21202) 2022-03-23 17:25:06 -07:00
Nemanja Glumac
df44d332ab Unskip repro for #18729 (#21194) 2022-03-23 21:15:23 +01:00
Nemanja Glumac
4a0f335f14 Unskip repro for #20845 (#21195) 2022-03-23 21:15:06 +01:00
Alexander Polyankin
1e51c88ced Add snowplow events for timelines (#21008)
* Add a json schema

* Pass required data for snowplow events

* Pass required data for snowplow events

* Add snowplow event tracking for Timeline event creation

This changes the timeline_event API endpoint to send snowplow tracking when an event is created.
The FE now sends additional information for this purpose:

- source: collections or question. This is null if the event is added via API
- question_id: added if the source is from a question. null if the question is unsaved.

These are dissoc-ed from the body before the db/insert because the backend does not store this information, it's just
from the FE and only relevant for this tracking data.

* Fix json error

* Add ::new-event-created entry to the snowplow test

* Fix json error

* Fix json error

* Fix snowplow test

Co-authored-by: Adam James <adam.vermeer2@gmail.com>
Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
2022-03-23 13:02:03 -07:00
Luis Paolini
dd2b8fa2fc Typo on DashboardSubscriptions (#21013)
* Typo on DashboardSubscriptions

* Update enterprise/backend/src/metabase_enterprise/advanced_config/models/pulse_channel.clj

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update enterprise/backend/src/metabase_enterprise/advanced_config/models/pulse_channel.clj

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

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2022-03-23 12:42:04 -07:00
Ariya Hidayat
4028bcbd23 Exclude /_internals from production build (#21162) 2022-03-23 11:52:30 -07:00
Gustavo Saiani
bf958b678c Add e2e tests to bookmarking in dashboard page (#21059) 2022-03-23 15:04:00 -03:00
adam-james
f80bce03ef Events BE fixes - Hydrate :collection on timelines and default icon "star" (#21169) 2022-03-23 18:55:51 +03:00
Diogo Mendes
8869361ec5 Running Currents only on Master (#21161)
* Running Currents only on Master

* [ci noskip] Ident

* [ci noskip] ident comment

* [ci noskip] Fixing yaml

* [ci noskip] creating forlders

* [ci noskip] space
2022-03-23 12:47:17 -03:00
Ariya Hidayat
62329a4344 Models E2E tests: ensure query and table view before assertions (#21151) 2022-03-23 08:11:28 -07:00
Ryan Laurie
c950e50294 remove explicit z-index on DateOperatorSelector (#21146) 2022-03-23 08:49:34 -06:00
Gustavo Saiani
86d2c72ae0 Add e2e tests on bookmarking in a Collection page (#21058) 2022-03-23 11:39:42 -03:00
Diogo Mendes
615c0436bd Making sure directory is there to restore cache (#21181) 2022-03-23 09:38:44 -03:00
Howon Lee
10a527db60 Postgres JSON nested field columns (#21007)
This is the first vertical slice of #708. There is a material ways to go, including mysql implementation, plinking away at the data model stuff, and frontend. There are also big putative sync speed gains I think I should chip away at.
2022-03-23 01:11:06 -07:00
Benoit Vinay
ef256e3108 Various fixes for errors seen in the console while browsing (#21060)
* shouldNotForwardTransientProp method created for emotion

* BadgeIcon html attributes clean up

* Usage of transient property $hasMargin in Badge for BadgeIcon

* HTML attribute cleanup for LinkRoot

* React key added to ButtonBar child if not defined

* Properties for TableInfoPopover properly typed

* Misc

* analyticsContext property set as non required as non of the parents enforce it or pass a value

* Clean up attributes for SVG in Icon

* CSS fix for share icon special case in Icon

* Checkbox controlled component default value fix

* Misc clean up

* index file for collection side bar

* Collections collectionID type fix

* collection type in NewCollectionItemMenu fix

* Misc

* TokenField fix for value

* noPopover passed properly to WidgetStatusIcon

* Updates to controlled input/checkbox

* VS Code workspace file added to gitignore

* shouldNotForwardTransientProp renamed to shouldForwardNonTransientProp

* AddAggregationButton defaultProps updates

* propTypes for TableInfoPopover added back
2022-03-22 20:56:19 +01:00
Alexander Polyankin
5958d0ff39 Fix incorrect event icon collapsing (#21158) 2022-03-22 22:26:36 +03:00
Alexander Polyankin
650e2a90a7 Fix snowplow test (#21157) 2022-03-22 22:24:57 +03:00
Ariya Hidayat
794cf3ed1b Fix string quoting in custom expression (#21049)
Custom expression does not follow JSON standard (RFC 4627) and therefore
it's not possible to use JSON.stringify to correctly quote a string literal.
2022-03-22 11:04:28 -07:00
Dalton
6ea0489290 parse canonical collection id when saving question (#21145) 2022-03-22 09:57:55 -07:00
Alexander Polyankin
f890cec80d Use option icon in case it exists for selected items (#21152) 2022-03-22 15:59:53 +03:00
Alexander Polyankin
50ba9b3207 Fix text overflow issues in events (#21154) 2022-03-22 15:39:27 +03:00
Alexander Polyankin
0e63aa00c0 Make event icons responsible (#21141) 2022-03-22 15:07:33 +03:00
Benoit Vinay
c80c90ca9f Line chart value replacement for Mongo DB (#21012)
* Tick range fix for timeseries scale

* Revert ticksForRange in timeseries

* Resetting the timestamp parsing based on the unit

* Move startOf reset to getDatas only

* Misc

* Misc

* Cater for null xValue

* Completely rewrite repro for #16170

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2022-03-22 11:05:31 +01:00
Nemanja Glumac
829bf85ae0 Add initial test coverage for native questions embedding (#20909)
* Add inital test coverage for native questions embedding

* Update frontend/test/metabase/scenarios/embedding/embedding-native.cy.spec.js

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2022-03-22 08:52:18 +01:00
Dalton
2fe8ac3f36 use relative urls in app template (#20710) 2022-03-21 17:07:47 -07:00
Dalton
d25d6c4e97 Use TippyPopover in the AddMemberTypeahead component (#21097)
* Use TippyPopover in AddMemberRow component

* Add/fix propTypes
2022-03-21 17:07:34 -07:00
Nemanja Glumac
7dade51afa Repro #21135: CC with the same names as the existing columns causes confusion in the expression editor (#21139)
* Add repro for #21135

* Address feedback and reinforce test
2022-03-22 00:18:51 +01:00
adam-james
69d3d9be24 Bookmark display and authority keys (#21142)
* Add :display to the bookmark query (card specific).

Bookmark results can now optionally show a 'display' key, which is relevant only to cards.

This does not change the db in any way, it just pulls additional data from the left-join in the query already.

This particular key :display is used on the frontend to change the icon that the bookmark renders with in the
sidebar.

* Add a test that confirms `:display` key exists on card bookmarks

* Bookmarks on official collections now have `authority_level` key
2022-03-21 13:54:23 -07:00
Jeff Bruemmer
c322fc0287 docs - link maintenance (#21143) 2022-03-21 16:52:47 -04:00
Alexander Polyankin
fad0a18037 Change event icon sizes in chart (#21128) 2022-03-21 22:40:21 +03:00
Diogo Mendes
801990374c Test 2022-03-21 15:29:42 -03:00
Diogo Mendes
79871528e1 Mix 2022-03-21 15:27:23 -03:00
Diogo Mendes
afe7e39871 Remove 2022-03-21 15:12:34 -03:00
Diogo Mendes
157b24fa42 Revert "Test"
This reverts commit 46fcefc678.
2022-03-21 14:23:05 -03:00
Diogo Mendes
46fcefc678 Test 2022-03-21 14:22:52 -03:00
Diogo Mendes
88c10259c6 Force conflict 2022-03-21 14:14:09 -03:00
Noah Moss
dd8549703d Remove permission path validation from specific functions to preserve downgradability (#21040) 2022-03-21 12:37:35 -04:00
Ariya Hidayat
2f822f059c [E2E] Add a few more query-related CI groups to GitHub Actions (#21122) 2022-03-21 09:29:44 -07:00
Cam Saul
76d5a06d3a Don't format non-temporal columns as datetimes in XLSX exports (#21048)
* Don't format non-temporal columns as datetimes in XLSX exports

* Test fixes 🔧

* Oops uncomment something
2022-03-21 09:22:44 -07:00
Nemanja Glumac
077a9f383c [E2E] Robustify visit question by applying visitQuestion helper (#21127)
* Apply `visitQuestion` helper

* Fix tests for models
2022-03-21 15:02:44 +01:00
Alexander Polyankin
17df467867 Filter timelines by question's dates (#21095) 2022-03-21 11:41:55 +03:00
Ariya Hidayat
1a771a64a6 E2E for repros: check dataset and table view before assertions (#21121) 2022-03-20 16:56:50 -07:00
Ariya Hidayat
6350342a41 MySQL E2E test: wait for dataset and table view before assertions (#21115) 2022-03-20 11:58:30 -07:00
Ariya Hidayat
5d100b0eb7 Binning E2E tests: ensure dataset and table view before assertions (#21118) 2022-03-20 11:42:00 -07:00
Ariya Hidayat
a20a7ef69b E2E tests on master: use Buildjet 4vCPU (#21119) 2022-03-20 15:40:52 -03:00
Ariya Hidayat
173464952f Search E2E test: ensure that the People table is really loaded (#21117) 2022-03-20 09:39:58 -07:00
Ariya Hidayat
3392437acd Dashboard drill E2E tests: ensure element visibility before assertions (#21114) 2022-03-19 21:08:48 -07:00
Ariya Hidayat
30bfb3d466 Smoketest admin E2E: guard assertions with element visibility check (#21110) 2022-03-19 10:53:12 -07:00
Ariya Hidayat
447c915e32 Resolve nanoid to v3.1.31 (#21113) 2022-03-19 10:13:33 -07:00
Nemanja Glumac
8d9924f60d [E2E] Add question CI group to GitHub Actions (#21099)
* Reinforce various `question` tests that were failing in GHA

* Add `question` E2E` group to the GitHub Actions on `master`
2022-03-18 22:36:09 -07:00
Ariya Hidayat
beff8a57e3 Auth E2E tests: wait for the dataset to load before assertions (#21107) 2022-03-18 17:55:55 -07:00
Ariya Hidayat
68e2595a8b Search E2E tests: ensure element visibility before assertions (#21106) 2022-03-18 17:33:56 -07:00
Alexander Lesnenko
2ffd324cd4 fix percy (#21103)
* update timeout and use buildjet

* return percy push job branch constraints

* revert timeouts

* use prepare-cypress
2022-03-18 19:34:53 -04:00
Nemanja Glumac
2e267a21a1 Upgrade percy to the latest version 3.1.1 (#21010)
* Upgrade `@percy/cypress` to the latest version `3.1.1`

* Upgrade `@percy/cli` to the latest version
2022-03-18 18:19:08 -03:00
Maz Ameli
6c92c9fe4c change sharing icon (#21096) 2022-03-18 11:49:32 -07:00
Diogo Mendes
9b252874aa Enabling Currents.dev on CircleCI (#21071)
* Adding currents

* Update .circleci/config.yml

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

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2022-03-18 14:13:49 -03:00
Dalton
5d5deac1da Add validation logic to TemplateTagDimension dimension tag handling (#20878)
* Add validation logic to TemplateTagDimension dimension tag handling

* Add basic error message to query builder

* Update error text

* Add unique error message for validation errors

* Update text of error state

Co-authored-by: Maz Ameli <maz@metabase.com>

* Fix types

* Fix NativeQuery unit test

* Add unit tests for new components

Co-authored-by: Maz Ameli <maz@metabase.com>
2022-03-18 09:25:38 -07:00
Nemanja Glumac
1ba80fd25a [E2E] Fix permissions flakes (#21092)
* Fix sandboxing test related to subscriptions

* Fix subscriptions test related to joins
2022-03-18 16:15:09 +01:00
Nemanja Glumac
107a2388a8 Skip repro for 8406 due to #21026 (#21094) 2022-03-18 12:01:36 -03:00
Jeff Bruemmer
0580c93ab2 docs - remove enterprise refs (#21091) 2022-03-18 10:29:17 -04:00
Nemanja Glumac
d2ce807293 Upgrade @cypress/webpack-preprocessor to the latest version (5.11.1) (#21067) 2022-03-18 13:43:48 +01:00
Nemanja Glumac
626f2ed7eb Fix question E2E flakes (#21085)
* Fix repro 12457 flake

* Fix repro 17397 flake

* Remove redundant tests
2022-03-18 13:42:57 +01:00
Mahatthana (Kelvin) Nomsawadi
ebdc3d2106 Make Models not embeddable #20815 (#21025) 2022-03-18 18:33:05 +07:00
Alexander Polyankin
8220d653e7 Highlight selected events in the query builder (#21038) 2022-03-18 12:47:07 +03:00
Mahatthana (Kelvin) Nomsawadi
329b540b7d Fix regression from fixing #20954 (#21051)
* Fix a regression from fixing #20228

* Reorder code order to make it easier to reason about.
2022-03-18 12:01:52 +07:00
Jeff Bruemmer
37f3ab430f docs - driver guide (#20567) 2022-03-17 20:47:53 -04:00
Noah Moss
b0b8288afc Add autolink support and better email link handling to backend Markdown parsing (#21039) 2022-03-17 20:02:32 -04:00
Luis Paolini
2513967529 Containerizing using the current release container process (#19885)
* Containerizing using the current release container process, as it's not only more representative, but also we use yarn and maven caching which should be faster

* rebasing

* Update uberjar.yml
2022-03-17 18:59:33 -03:00
Ariya Hidayat
c284ee1bc8 Robustify E2E model tests by waiting for the dataset to arrive first (#21068) 2022-03-17 14:43:07 -07:00
frannietrempe
ed2ee1da5d docs - update sql editor page (#21033)
* docs - update sql editor page

* change sql example to upper case

* Apply suggestions from code review

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2022-03-17 16:03:08 -04:00
Diogo Mendes
6d160a093d Adding cy2 to the project (#21070) 2022-03-17 16:59:27 -03:00
Dalton
ecebd2f2a6 Add tippy/popper replacement for PopoverWithTrigger (#20930)
* Add tippy/popper replacement for PopoverWithTrigger

* Refactor and fix types

* Move PopoverWithTrigger components to own folder

* Add tests

* rename children prop to popoverContent

* Fix direct ParameterTargetWidget.jsx reference
2022-03-17 11:48:20 -07:00
Nemanja Glumac
51e8edb625 Fix E2E binning sidebar flakes (#21066)
* Add a guard that reduces flakiness of binning tests
2022-03-17 19:02:54 +01:00
Noah Moss
f917849c19 Delete MetaBot permissions group (#20925) 2022-03-17 13:56:05 -04:00
Nemanja Glumac
8a4cd02a13 Upgrade eslint-plugin-cypress to the lastest version (2.12.1) (#21062) 2022-03-17 18:32:27 +01:00
Gustavo Saiani
3732886c74 Bookmark items in collection page (#21024) 2022-03-17 10:21:49 -03:00
Nemanja Glumac
15e925dd30 Upgrade @cypress/skip-test to the latest version 2.6.1 (#21053) 2022-03-17 14:08:15 +01:00
Nemanja Glumac
59857969b8 Upgrade cypress-grep to the latest version (2.13.1) (#21029) 2022-03-17 13:09:17 +01:00
Nemanja Glumac
048f1c6641 Increase E2E QA DBs timeout (#21052)
* Increase timeout for QA DB sync

* Delete DB after the snapshot was taken

This is a hack that seems to prevent race conditions when one DB's sync interferes with the subsequent DB's sync.
2022-03-17 11:56:56 +01:00
Diogo Mendes
f6d20f204b Increase no_output_timeout to DB tests (#21044) 2022-03-17 06:01:41 -03:00
Bryan Maass
73917b3118 Sharing dashboard subscriptions slack performance (#20570)
* Get slack users and conversations simulatenously

- instead of waiting for the channels, and then getting the users

* Add cache+timeout capability to conversations-list

* extend async approach to users-list

- return timeout+cache warning
- adds tests

* updating docstrings + adding more tests

* Add cache clear and seed slack token settings on-change

- add dox for :on-change for defsettings
- fixing tests

* Fixing tests

- cannot pass a declared (not def'd) value
- some cleanup

* remove unused function

* remove need for slack-configured from timeout fns

- update some docstrings

* pre-populate slack caches

- on app init

* introduce blocking (and cache resetting) endpoint

- this one does not timeout, meant to be called when a user hits a
  button like: "Refetch my slack channels"

* removes -timeout versions of users/channels fn

- the endpoint now returns the cached slack data
- removes tests

* fixes routing layer

* remove trailing whitespace

* add missing docstring

* move the cached slack data into a setting

* add missing docstring

* fix typo

* update form-input-test

* refresh cache in test

* remove un-needed anonymous fn wrapping

* refresh slack cache when user sets new valid token

* refresh the cache when reading from it

- the more its used the more up to date it will be

* code review responses + removes 2-arity refresh-cache!

- clear out cache when slack connection is broken or unset
- add to docstring for slack settings route
- wrap init refresh-cache! with a future
- re-spell parallel

* do not block when returning cached slack data

* rename cache defsetting

* Addressing code review issues

- Adds scheduled updates to the slack users and channels cache
  every 4 hours
- Removes `form_input_refresh` route
- Automatically refreshes cache when `form_input` route is hit,
  if 10 minutes have passed since the last cache fix
- Removes cache refresh on app startup
- Stores only user names, and channel names in the cache, not maps with
  irrelevant data
- Clears out some noisy linter warnings via `#_:clj-kondo/ignore`

* Adds slack task RefreshCache jobs

- Sets up startup-triggered and cron-triggered (every 4 hours at a
  random minute) slack channel/username cache refreshing

* Implements 2 jobs to update slack users/channels

- one on startup, one every 4 hours
- improve docstrings

* ns linter fixes

* more ns linter fixes

* refactor files-channel to look in the cache

- instead of making a tricky api call
- fixing tests

* update files-channel-test to test the cache

* fixup integrations.slack ns decl

* fixup test integrations.slack ns decl

* fix outdated mock of slack/files-channel

* fix a few more tests

* fix api slack-test

* adds locking to refresh-channels-and-usernames!

* re-order requires
2022-03-16 21:54:49 -07:00
Ariya Hidayat
14a421aee4 SQL editor: explicit trigger of autocomplete (#20970) 2022-03-16 17:40:57 -07:00
Cam Saul
6ee13aa266 Google Analytics: use service accounts for auth (#21004)
* Use Service Accounts for Google Analytics auth going forward

* Update GA dox

* Dox tweak

* Fix e2e test

* Remove dead googleanalytics form code

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2022-03-16 17:29:14 -07:00
Cam Saul
f129903c77 Fix [:relative-datetime :current] inside :between filter clause (#20975)
* Fix `[:relative-datetime :current]` inside `:between` filter clause

* Update shared/test/metabase/mbql/util_test.cljc

* Update shared/test/metabase/mbql/util_test.cljc
2022-03-16 17:28:49 -07:00
Alexander Lesnenko
bfa9914055 FE: Download permission management (#20883)
* download permission

* update specs

* remove console log

* fix types

* lint
2022-03-16 18:47:20 -04:00
Nemanja Glumac
98e13e4d89 Upgrade @testing-library/cypress to the latest version (8.0.2) (#21016)
* Upgrade Cypress testing library to the latest version

* Fix collection permissions failing tests

* Fix custom-column failing tests

* Fix `joins` failing test

* Fix visual notebook failing tests

* Fix models failing tests

* Fix `questions` failing tests

* Fix native ee failing test

* Fix onboarding failing tests

* Remove `@types/testing-library__cypress`

058daff38a
2022-03-16 18:06:11 -03:00
Gustavo Saiani
00a8626a6d Remove bookmarked items from list (#20977) 2022-03-16 17:27:32 -03:00
Cam Saul
f9f1bf414d Fix noisy backend tests (#20910)
* Change u/profile from println to log/info

* Change most test printlns to log/info

* Make u/profile message a fn rather than a delay

* Apparently clj-http errors aren't wrapped in :object anymore

* Add running commentary

* Log the amount of time it took to find and run tests

* Sort namespaces

* Update test

Co-authored-by: Diogo Mendes <diogo@metabase.com>
2022-03-16 13:05:23 -07:00
Dalton
9555a4c23d @wilsonpg's "Show download progress/indicator while exporting to avoid multiple clicks" (#21037)
* added status option for rendering widget icon

* mimicked default form behavior using the fetch API

* recreated default html form submit and download

* added GET request functionality to download form

* cleanup

* making requested changes

* onClose, fileName cleanup, blob(), GC link remove

Co-authored-by: Paul Wilson <54870992+wilsonpg@users.noreply.github.com>
2022-03-16 12:59:18 -07:00
Diogo Mendes
70e79af281 Bump executor (#21036) 2022-03-16 16:28:26 -03:00
Dalton
36361c43c8 Fix hook listeners (#20926) 2022-03-16 10:11:09 -07:00
Nemanja Glumac
0cb39acd8f Upgrade cypress-real-events to the latest version (#21011) 2022-03-16 15:31:32 +01:00
Nemanja Glumac
df85cfdbfd Upgrade Cypress to the version 9.5.2 (#21019) 2022-03-16 14:25:14 +01:00
Luis Paolini
492d3ff4b3 Try making the encryption clearer (#20661)
* Try making the encryption clearer

Got the question a few times, so I thought we had to make it more explicit

* Update docs/operations-guide/encrypting-database-details-at-rest.md

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2022-03-16 10:07:38 -03:00
Nemanja Glumac
da6d6f8747 Skip failing visual test caused by #21026 (#21027) 2022-03-16 13:45:53 +01:00
Alexander Lesnenko
2eb6bcd09e feature level permission based routing (#20979)
* permission based routing

* review
2022-03-16 01:52:19 -04:00
Ariya Hidayat
321476ad4b E2E on master: only a subset of selective test groups for now (#21023)
Due to Cypress upgrade, we observed failing and/or flakey E2E tests.
Rather than disabling this completely, let's narrow down to a few good
tests for now while robustifying the rest of them.
2022-03-15 20:28:43 -07:00
Cam Saul
2afa0e5a70 Fix error in send-abandonment-emails task (#20976) 2022-03-15 11:50:53 -07:00
Alexander Polyankin
31a0462944 Add event tooltips in charts (#20982) 2022-03-15 20:36:48 +03:00
Alexander Polyankin
9a036a3c8a Fix the issue with events test (#21009) 2022-03-15 19:25:01 +03:00
Noah Moss
817a548663 Migration to add default download perms for existing DBs (#20964) 2022-03-15 10:54:26 -04:00
Gustavo Saiani
8387da107e Bookmark Dashboards (#20971) 2022-03-15 11:44:59 -03:00
Noah Moss
9ea8dd3fde Backend changes to ensure download perms stay consistent (#20880) 2022-03-15 09:16:30 -04:00
Cam Saul
aaf1b60111 Upgrade Liquibase to latest version; remove final Java source file and need for clojure -X:deps prep (#20611)
* Upgrade Liquibase to latest version

* Try adjusting log

* Fix checksums for the TWO migrations with ID = 32

* FINALLY get Liquibase to use Log4j2

* Set Liquibase ConsoleUIService OutputStream to null OutputStream

* Manually define a package for our H2 proxy class so Java 8 works

* Fix package-name determination code

* Update migrations file spec

* `databasechangelog` shouldn't be upper-case

* Lower-case quartz table names

* More MySQL fixes 🔧

* Properties for all the Quartz tables 😢

* Formatting tweaks [ci skip]

* Revert a few more busted changes

* Fix more busted changes

* Bump Liquibase version to 4.8.0 to fix MySQL defaultValueBoolean bug

* OMG I think I finally fixed MySQL

* Remove Java source file and prep-deps code

* Remove two more references to bin/prep.sh

* Minor cleanup

* Revert unneeded changes

* Fix busted indentation

* Don't search inside java/ anymore since it's G-O-N-E

* Appease the namespace linter

* Update src/metabase/db/liquibase/h2.clj
2022-03-14 19:06:49 -07:00
Noah Moss
faf55fb6fd Write path for download permission graphs (#20759) 2022-03-14 18:02:10 -04:00
Gustavo Saiani
946978d867 Bookmark collections (#20950) 2022-03-14 18:03:32 -03:00
frannietrempe
5128affe21 docs - fix links (#20996)
thanks @qnkhuat for pointing these out! 🙏
2022-03-14 16:17:41 -04:00
Alexander Polyankin
2330ff5d8e Add event creation to the query builder (#20990) 2022-03-14 20:45:52 +03:00
adam-james
65c01bdd44 Adjust GET /api/timeline to allow include=events parameter (#20972)
This lets the Frontend get a list of timelines with the events included, useful in case of having an unsaved question
where timelines should still be showable.

> left comments but seems workable

I'm going to merge this to let FE continue events implementation. 

I will discuss the above concerns in Slack, and we can make adjustments as needed.
2022-03-14 10:19:33 -07:00
Nemanja Glumac
0e145152b0 Reinforce admin field-type E2E tests (#20987)
* Use appropriate query selector

* Wait for the table metadata to load

* Ensure popover contents loaded before we attempt to scroll
2022-03-14 16:53:57 +01:00
Benoit Vinay
f6085da31e Clean up static chart components accessors (#20968)
* accessors constants created

* accessors dependencies removed from all charts

* Removed accessors dependencies from BE JS for static viz

* Removed accessors references in chart editor

* accessors added to defaultProps

* Remove accessors in tests

* defaultProps removed form static viz components
2022-03-14 14:29:36 +01:00
Nemanja Glumac
8e174f0bdc Quarantine caching e2e tests (#20984)
Note: should be revisited and enabled once we fix https://github.com/metabase/metabase/issues/13262.
2022-03-14 12:59:05 +01:00
Mahatthana (Kelvin) Nomsawadi
883e5cd337 Fix sometimes table doesn't resize (#20954) 2022-03-14 13:15:53 +07:00
Mahatthana (Kelvin) Nomsawadi
80b6852c7f Fix no visual feedback when updating data model field details (#20915)
* Revert field update to only notify without allow undoing

* Add feedback when updating field details on datamodel
2022-03-14 13:15:30 +07:00
Cam Saul
b3c8ea8fca Make sure auto binning always has at least one bin (#20978) 2022-03-12 10:56:38 -08:00
Alexander Polyankin
569cdc4d19 Show timeline events in charts (#20899) 2022-03-12 11:54:54 +03:00
Alexander Polyankin
6824d4ada7 Fix date parsing in DateInput (#20967) 2022-03-12 10:42:36 +03:00
Ariya Hidayat
74f89c6f5c yarn upgrade xlsx@0.18.3 (#20894) 2022-03-11 15:17:58 -08:00
Benoit Vinay
cc289e608f Fix x-axis granularity for time series in static viz (#20896)
* TimeSeriesLineChart uses scaleBand instead of scaleTime for x-axis

Similar to TimeSeriesBarChart

* TimeSeriesAreaChart updated to match TimeSeriesLineChart
2022-03-11 08:52:36 -08:00
dpsutton
cdcfc9ecfd Cleanup and schema for bookmarks (#20942)
- sorting in query so don't have to sort in memory afterwards, and
leaves open spot on the api to sort with user preferences if
present (future work)
- adds schema so we know what these bookmarks look like, and return an
explicit structure instead of threading through dissoc and assoc
- combined the remove-nil-values into the normalize function since it
set up preconditions necessary for the normalize.
- use Models in query so we don't have to hardcode the underlying table
2022-03-11 10:18:51 -06:00
Ariya Hidayat
a28a038d1f Custom expression: stricter acceptance of aggregation function (#20949) 2022-03-11 07:53:00 -08:00
Ariya Hidayat
89ca84c7fb Custom expression: escape/unescape field name (#20927)
This way, if the field name contains [ or ], this character will be
handled properly (with escaping and unescaping at the right place).

Ensure escape vs unescape symmetry
2022-03-11 07:19:02 -08:00
Diogo Mendes
a44ea47497 Removing native since was running twice (#20961) 2022-03-11 10:42:42 -03:00
Alexander Polyankin
57909217d1 Add event sidebar to the query builder (#20944) 2022-03-11 10:57:05 +03:00
Noah Moss
572b8fa6c9 Allow user-local settings to be fetched and set via the API (#20736) 2022-03-10 22:53:35 -05:00
Dalton
323e0f5072 Add sizeToFit prop to TippyPopover (#20861) 2022-03-10 13:52:59 -08:00
frannietrempe
9907e01bc2 docs - remove GA version note; fix broken link (#20945) 2022-03-10 15:50:08 -05:00
Dalton
cb5da99c7f Add flip prop to TippyPopover (#20860)
* Match the z-index of old popovers

* Add flip prop to TippyPopover
2022-03-10 12:27:44 -08:00
Cam Saul
cc48450c0b Fix BigQuery incorrectly quoting datetime-truncated field literal forms (#20907)
* Improved error messages when query execution fails

* Pretty-print hx/identifier in a different way if it contains extra keys

* Fix #20806

* Rename key used to record that we should not qualify

* Fix line breaks

* Test fix 🔧
2022-03-10 12:15:36 -08:00
Dalton
75541436c8 use site-url setting when opening links via JS (#20568)
* use site-url when opening links via JS

* fix normalization of 0 value

* make dashboard click drill to same dashboard just update parameters

* fix race condition with location prop

* use Link instead of anchor tag
2022-03-10 12:07:32 -08:00
Ariya Hidayat
2e3ef4fd2e MBQL schema: allows :case for a string expression (#20913) 2022-03-10 11:56:11 -08:00
Diogo Mendes
702833f6aa Creating cypress action on CI (#20904)
* Creating cypress action

* Adding shell
2022-03-10 15:50:38 -03:00
Dalton
9e8b4fc743 Default TippyPopover's interactive prop to true (#20859) 2022-03-10 10:41:22 -08:00
Cam Saul
180175915a Pass H2 options as connection properties; add LOCK_TIMEOUT=60000 (fix flaky tests) (#20914) 2022-03-10 10:30:01 -08:00
Cam Saul
7667e3e702 Handle numeric values for :number parameters in JWTs (#20908) 2022-03-10 10:04:46 -08:00
Ngoc Khuat
363fe22132 Localize personal colections's name (#20884)
* Localize personal colections's name

* adding a macro to generate test data

* use precondition instead of assert

* fix per comment
2022-03-11 00:14:07 +07:00
Bryan Maass
74aa5467bc fix ssl-key name typo (#20855)
* Fix ssl-key connection prop name

* Adds unit test for ssl-key typo fix

* fix ns require ordering

Co-authored-by: Guillermo Ríos <grios@stratio.com>
2022-03-10 08:06:51 -08:00
Luis Paolini
50c2ccd90c Update env vars of SAML (#20653)
* Update env vars of SAML

Adding some very important comments

* Update docs/operations-guide/environment-variables.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2022-03-10 10:46:10 -03:00
Gustavo Saiani
2e3e956e3f Convert Bookmarks component to TypeScript (#20924) 2022-03-10 10:41:14 -03:00
Gustavo Saiani
f5c1479e15 Bookmarks: clean up unnecessary code (#20920) 2022-03-10 06:54:19 -03:00
adam-james
dd1e0bedd9 Add the :archived status of card/dashboard/collection for filtering (#20921)
* Add the :archived status of card/dashboard/collection for filtering

If an item is bookmarked, we can follow the link to that item without issue. But, if we bookmark an item and then
archive that item, the bookmark shouldn't show up, as we don't want to link to an archived item.

The bookmark itself is not removed, it's just filtered away when :archived is true.

* Added test for bookmarked and archived items

The archived items that are still bookmarked should not be sent to the Frontend.
2022-03-09 16:26:25 -08:00
Gustavo Saiani
8ad9254d07 Bookmark questions and display them on sidebar (#20918) 2022-03-09 15:34:04 -03:00
Nemanja Glumac
036aadd5a2 Upgrade Cypress to the latest version (9.5.1) (#20483)
* Upgrade Cypress to the latest version (9.4.1)

* Fix collections tests failures after upgrade

* Fix binning tests failures after upgrade

* Fix dashboard test failures after upgrade

* Fix models test failures after upgrade

* Fix admin test failures after upgrade

* Fix visualizations test failures after upgrade

* Rewrite and fix repro for 17397

Added the missing issue reference.

* Fix question test failures after upgrade

* Fix interception handlers in metabase-visual tests

* Fix the rest of the binning tests after upgrade

* rewrite cypressWaitAll helper with a simple recursion

* Updating to 9.5.0

* Upgrade Cypress to v9.5.1

* Fix repro for 13332

* Fix pinned items `collections` test failures

* Speed `collection-pinned-overview` spec up using the API

* Fix failing localization test

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
Co-authored-by: Diogo Mendes <diogo@metabase.com>
2022-03-09 13:49:20 -03:00
Diogo Mendes
d77abc36d7 Create action for Uberjar (#20905)
* Create action for Uberjar

* Fixing name

* Adding shell bash to SHA

* Adding shell on proper place

* Adding one more shell
2022-03-09 13:22:08 -03:00
Noah Moss
3607b0708f Fix brackets and ordering for two dependencies in deps.edn (#20901) 2022-03-09 11:11:22 -05:00
Howon Lee
378b58fa6b Nested column enrichment for JSON nested columns (#20778)
Put in capability but not link it in for nested column enrichment for postgres JSON columns
2022-03-09 03:37:46 -08:00
Mahatthana (Kelvin) Nomsawadi
808cbf6c46 Fix no visual feedback when updating data model column properties (#20874) 2022-03-09 12:34:45 +07:00
Nemanja Glumac
8b7971b884 Disable auditing e2e CI group (#20897) 2022-03-08 19:40:45 +01:00
Dalton
688109e1ab Fix schemas not loading/showing immediately for a saved question (#20800)
* Fetch db schemas as dependencies of a query

* Update StructuredQuery unit tests
2022-03-08 10:04:34 -08:00
Dalton
74abd3ea02 fix navigation to new dashboard from collection view (#20709) 2022-03-08 10:01:53 -08:00
Nemanja Glumac
25325899b5 Update yarn.lock after upgrading Prism (#20889) 2022-03-08 18:03:06 +01:00
Jeff Bruemmer
b159c6829b Update bigquery-drive.md (#20890) 2022-03-08 12:02:01 -05:00
frannietrempe
3e4cecc4c7 docs - fixing glossary links (#20886) 2022-03-08 10:26:11 -05:00
Ngoc Khuat
3a257c23bd /api/user return only active users when include_deactivated=false (#20844)
* /api/user return only active users when include_deactivated=false

* revert changes in docs/api-documentation.md and fix trailing space for params section

* simplify tests and update api's doc
2022-03-08 14:41:21 +07:00
Ariya Hidayat
48f6f59cbb Enable subdimensions for aggregation (#20837) 2022-03-07 17:57:31 -08:00
Benoit Vinay
fb9e912d0b F/static viz/tester (#20842)
* Types and options constants added to all chart types

* Chart types and options added to StaticChart

* Static viz page refactored to include an editor

* Editing data added

* Error handling added

* Misc

* StaticChart converted to TypeScript

* Stories for StaticChart added to storybook

* Misc

* Updates from PR review
2022-03-07 12:13:22 +01:00
Benoit Vinay
598a126b72 Bugfix/various fixes from console error messages (#20829)
* FunnelChart missing key for React loop added

* BarSeries missing key for React loop added

* TickRendererProps formattedValue method removed from tag attributes

* React loop key added to internal routes

* Table head tagging fixed in internal

* BaseIcon uncheckedColor method removed from being added to SVG tag attributes

* Misc

* ColorPicker fix for maxHeight attribute

* Missing key for CollectionBadge in InfoText added
2022-03-07 11:24:02 +01:00
Mahatthana (Kelvin) Nomsawadi
8f2a077d4e Fix main page show indefinite loading spinner when any API failed (#20840) 2022-03-07 09:54:28 +07:00
Mahatthana (Kelvin) Nomsawadi
651da83c23 Fix "Show error details" keeps showing after clicked (#20824) 2022-03-07 09:54:20 +07:00
Mahatthana (Kelvin) Nomsawadi
68cff20c46 Fix empty state icon in activity page misalignment (#20820) 2022-03-07 09:53:49 +07:00
Nemanja Glumac
d7fe33dbfd Repro #20845: Embedding with Locked parameters does not allow numeric values (#20849)
* Add repro for #20845

* Use API to reproduce the issue

* Make sure this works for both strings and integers
2022-03-06 09:56:33 +01:00
Ariya Hidayat
3188b3d10e Upgrade to Prism v1.27.0 (#20794) 2022-03-04 14:19:28 -08:00
Nemanja Glumac
44040a1099 Add e2e embedding jwt helper (#20853) 2022-03-04 21:33:14 +01:00
Nemanja Glumac
5bffa46e44 Extract hard coded embedding key for e2e tests and store it as a variable (#20852) 2022-03-04 20:14:34 +01:00
Alexander Polyankin
e96d434f42 Fix bugs and add tests for timelines in collections (#20798) 2022-03-04 21:44:07 +03:00
Michiel Borkent
38ce2fd04d Consider modelInstance always a used var (#20847) 2022-03-04 15:21:18 -03:00
Ariya Hidayat
3e44112a15 Modify expression dimension to support subdimensions (#20645) 2022-03-04 08:02:55 -08:00
Gustavo Saiani
16d319400a Document entity api response requirements (#20802) 2022-03-04 11:59:18 -03:00
Pawit Pornkitprasan
136a1f64c5 migrations: remove duplicate comment (#20839) 2022-03-04 16:48:18 +07:00
Dalton
205baeed7a Fetch databases on schema step of DataSelector (#20771) 2022-03-03 11:36:30 -08:00
Nemanja Glumac
34a2641974 Bump buildjet timeout for Cypress tests to 30 minutes (#20826) 2022-03-03 18:25:26 +01:00
Nemanja Glumac
4fd373b376 Fix and reproduce #20499: The term "SQL query" used in DBs that don't support SQL (#20506)
* Use the term "Native query"

* Fix/update e2e tests

* Add repro for #20499

* make text conditional on engine and write permissions

* Revert "Fix/update e2e tests"

This reverts commit 3462cd113e.

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2022-03-03 18:24:08 +01:00
Nemanja Glumac
6dff2cf81c Embedding questions (#20812)
* Add test id to the mini-bar

* Add initial embedding test for the regular GUI question

* Update test with slighlty more complicated formatting

* Extract question details into a separate file

* Add a test for the quesiton with aggregation

* Assert while being signed out

* Add test for the nested question

* Add test for the joined question
2022-03-03 15:01:50 +01:00
Nemanja Glumac
a3de6c5438 Repro #20815: Models should not be embeddable (#20819) 2022-03-03 13:00:39 +01:00
Alexander Lesnenko
63d22fdbe2 split data permissions selectors (#20712)
* refactor data-permissions selectors

* pre refactor

* fix all typescript errors

* fixes

* fixes

* fixes

* use correct types
2022-03-02 21:45:19 -05:00
Alexander Lesnenko
cf505d4e1c Permissions sidebar refactoring (#20693)
* Permissions sidebar refactoring

* move utils specs with the file

* fix spec

* fix sidebar scroll

* fix ratio types
2022-03-02 14:51:57 -05:00
Dalton
05ff0aeffd Fix Help link for nested site users (#20740) 2022-03-02 09:30:48 -08:00
Dalton
fd3351fb09 make init health request a relative url (#20737) 2022-03-02 09:30:23 -08:00
Dalton
59d222b88e use correct urls when setting up on nested path (#20730) 2022-03-02 09:30:11 -08:00
Jeff Bruemmer
988f5647df update links (#20797) 2022-03-02 10:45:08 -05:00
Luis Paolini
0b06f46034 Update env var to disable geocoding (#20804) 2022-03-02 07:49:16 -03:00
Nemanja Glumac
bc98574d36 Increase "randomness" for caching e2e tests (#20801) 2022-03-01 21:43:05 +01:00
Nemanja Glumac
30a1d85f13 Separate "auditing" e2e group from the "admin" (#20793) 2022-03-01 20:56:21 +01:00
Dalton
4d177afb5f Fix 'Compare to the rest' action styling (#20767) 2022-03-01 10:47:23 -08:00
frannietrempe
8eda92eac1 docs - fix & update permissions links (#20788)
* docs - fix & update permissions links

* jeff edit

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2022-03-01 12:11:05 -05:00
frannietrempe
784a9268f5 docs - remove premium embedding, update screenshots (#20785)
* docs - remove premium embedding, update screenshots

* add learn track link
2022-03-01 11:23:03 -05:00
dpsutton
9a8ef14d45 Cleanup some lint errors (#20770)
mostly unused bindings. Had a few redundant lets. One common pattern was
a let binding for a read check but the resulting value was never used,
just checked that we could read or write it. Removed that from a binding
since it throws otherwise
2022-03-01 09:42:36 -06:00
Gustavo Saiani
8c9aeb67df Add basic documentation on entity creation (#20780) 2022-03-01 10:32:42 -03:00
Alexander Polyankin
c7573b2bce Polish timeline events in collections (#20708) 2022-03-01 15:01:18 +03:00
Nemanja Glumac
d8dd9d635b Make conditional describe blocks more readable (#20777) 2022-03-01 12:46:07 +01:00
Alexander Polyankin
1132cb3ba6 Add 12-hour clock support to events (#20704) 2022-03-01 13:57:35 +03:00
Nemanja Glumac
b1629f5b29 E2E oss/ee versions helpers cleanup (#20775)
* Use human readable names for vars

* Apply new version syntax to the related tests
2022-03-01 11:48:05 +01:00
Jeff Bruemmer
4cb7eaad53 update README (#20769) 2022-02-28 19:53:38 -05:00
Nemanja Glumac
9946598ecd Add embedding smoke tests when embedding is enabled (#20764) 2022-02-28 19:32:48 +01:00
Alexander Polyankin
b71676164a Add write checks (#20762) 2022-02-28 20:35:22 +03:00
Dalton
77af6de58d Revert to old template tag validation logic (#20750)
* Handle legacy Field filter parameters that did not specify `:widget-type`

* Fix indentation

* Test fix

* Revert to old template tag validation logic

* Update e2e test

Co-authored-by: Cam Saul <github@camsaul.com>
2022-02-28 09:03:50 -08:00
Cam Saul
26f671e5cd Handle legacy Field filter template tags that did not specify :widget-type (#20751)
* Handle legacy Field filter parameters that did not specify `:widget-type`

* Fix indentation

* Test fix
2022-02-28 09:02:21 -08:00
Nemanja Glumac
422f12b2f8 Add embedding smoke tests when embedding is disabled (#20761)
* Add embedding smoke tests when embedding is disabled

* Fix abstraction
2022-02-28 17:38:53 +01:00
Nemanja Glumac
737c251088 Embedding cleanup: Enable premium embedding token tests (#20753)
* Displace tests that are not related to embedding

* Rename and enable embedding snippets spec

* Add more assertions to the embedding code snippets spec

* Rewrite and enable premium ebmedding token tests

* Fix a timezone related issue in the validity date of the token
2022-02-26 21:43:42 +01:00
Ariya Hidayat
7b4de21ade Teach custom column's type inference about semantic_type (#20748) 2022-02-25 18:39:43 -08:00
JC Louis
bba210123b ScalarValue: display line break (#20652) 2022-02-25 15:52:37 -08:00
Dalton
5ce58dbab1 Make auth page scene img src relative (#20733) 2022-02-25 14:40:16 -08:00
Alexander Lesnenko
9bc8dc0de2 Convert Tree component to Typescript (#20692)
* Convert Tree component to Typescript

* fix types

* review
2022-02-25 13:42:37 -05:00
adam-james
88a4e178ca Events Backend Cleanup and Adding Start/End Range test (#20633)
* Adding tests in collections and card. Fixing some minor test things

* Added Test for timeline event range selection via card API

* Cleaned up a few TODO comments

* Made the timestamp required when POST-ing a timeline-event

* Remove unnecessary nesting of with-temp* forms

* Moved Icons schema into timeline-event model

This schema seems to be validating more than just the API, so we've moved it.

* Added start/end to GET /api/timeline/:id

Also cleaned up some unnecessary nesting in a card API test
Added timeline range test in timeline API test ns too.

* Parse timestamp when it exists in a timeline-event PUT

We saw the db error presented in the FE when updating timeline events. This should fix that problem.

* Add a test to ensure we can change timestamps via timeline-event PUT
2022-02-25 09:36:18 -08:00
Nemanja Glumac
023745459b Remove legacy EE hard coded version info (#20746) 2022-02-25 17:14:42 +01:00
Nemanja Glumac
fd2cfaa7fc Replace hard coded sample database id in ALL e2e tests (#20734) 2022-02-25 15:01:57 +01:00
Nemanja Glumac
7ac6e8c424 Global E2E Config: Solve circular dependency issue in helpers (#20741)
* Add `SAMPLE_DB_TABLES` reference

* Add notes to the cypress data references

* Ensure table ids are correct

Early warning mechanism.

* Use SAMPLE_DB_TABLES in e2e helpers and custom commands

* Use `SAMPLE_DB_ID` in the previously missed helper
2022-02-25 12:55:53 +01:00
Nemanja Glumac
4c44055413 Fix a flake where Cypress cannot click "Exit admin" (#20738) 2022-02-25 11:33:25 +01:00
Ariya Hidayat
5983a7742e Fix the icon for custom column (#20728) 2022-02-24 16:55:22 -08:00
Michiel Borkent
f40a16b58a Linting improvements for modules/drivers: zero errors (#20626)
* Refer all

* allow refer all in tests

* Add toucan test macro config

* wip

* Improve hooks

* Fix formatting issue

* Improve

* presto

* oracle

* mongo

* druid

* zero errors

* undo whitespace change

* ns linter satisfaction
2022-02-24 19:34:37 -03:00
Maz Ameli
4b05a518a4 Small cleanup for Events and Timelines (#20731)
* change paleozoic to mesozoic for accuracy

* switch kebab icons to ellipses
2022-02-24 13:34:40 -08:00
Ariya Hidayat
62ae6d5bab Upgrade MBQL of expression & aggregation dimension to include options (#20713) 2022-02-24 13:02:50 -08:00
Nemanja Glumac
de58c843f4 Replace hard coded ids in E2E custom commands and helpers (#20729)
* Replace hard coded ids in `question.js`

* Replace hard coded ids in ad hoc question helpers

* Replace hard coded ids in `sandboxTable` custom command

* Replace hard coded ids in `updatePermissions` custom command

* Avoid circular dependencies
2022-02-24 21:52:29 +01:00
Dalton
232be18a7e Run unadded additional dashcard series using card query endpoint (#20707)
* Run unadded additional dashcard series using card query endpoint

* add repro for #20637

* Update frontend/test/metabase/scenarios/dashboard/reproductions/20637-add-series-to-dashcard.cy.spec.js

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

* wait on all dashboard save requests in e2e test

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2022-02-24 12:09:11 -08:00
Nemanja Glumac
a37a3a3ab7 Export and use SAMPLE_DB_ID for snapshot generation (#20726)
* Export `SAMPLE_DB_ID`

* Replace hard coded sample database id values in the default snapshot creator

* Replace hard coded values for the SQLite database

* Update function name

* Stop using hard coded values for questions and dashboards
2022-02-24 20:02:45 +01:00
Howon Lee
ea3e8b6ad6 Describe the JSON within tables for postgres (#20547)
Step 1 towards the long path towards whacking #708. We need an interface for describing the weird thing every RDBMS vendor did where they have their own special way of doing JSON columns, every single one of them
2022-02-24 10:33:34 -08:00
Dalton
e9178bb489 Handle missing dataset_query when trying to map parameter targets to fields (#20678)
* Return null when card.dataset_query is missing

* Add unit test for missing card.dataset_query

* Unskip repro

* use optional chaining
2022-02-24 08:59:16 -08:00
Nemanja Glumac
57c738fce3 Embedding e2e group (#20721)
* Copy over admin premium embedding settings to a new file

* Move embedding reproductions to a related folder

* Move over dashboard embedded parameters

* Move over embedding dashboard spec

* Move over repro for 20634

* Enable embedding in CI
2022-02-24 16:56:18 +01:00
Nemanja Glumac
ce5e64af87 Repro #19744: Custom Column after aggregation causes dashboard filtering to be very limited (#20696) 2022-02-24 11:28:48 +01:00
Ariya Hidayat
3eef27a36e E2E tests: add some more question-related test groups (#20706) 2022-02-23 17:53:07 -08:00
Dalton
c3f7bd5cfc Handle nulls in ListField filter (#20680)
* Handle nulls in ListField filter

* filter out nil options
2022-02-23 17:40:33 -08:00
Noah Moss
1e6bc80b08 Update permission path regex & parser to support download permissions (#20699) 2022-02-23 18:29:07 -05:00
Cam Saul
e4e2ec755c Replace add-migrated-collections with Liquibase migrations (#20407)
* Rewrite add-migrated-collections

* Add new tests for the new migrations

* Truncate tables (removing values added by Liquibase migrations) before copying

* Clean namespaces

* Use TRUNCATE TABLE ... CASCADE for Postgres copy

* Update test

* Sort namespaces

* Remove stray println

* Fix Postgres TRUNCATE TABLE behavior

* Disable DB constraints before truncating tables

* Fix fussy postgres
2022-02-23 21:40:13 +00:00
Ariya Hidayat
b64e8f3b4a Move options handling from FieldDimension to the parent class, Dimension (#20690) 2022-02-23 11:44:18 -08:00
Cam Saul
4c327e5593 Remove MetaBot Group (#20565)
* Remove MetaBot Group

* Fix missing :require

* More fixes

* Another fix 🔧

* change default sandboxed group_id

* update group_ids

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2022-02-23 18:09:29 +00:00
Dalton
cd9fd1b585 Always show database sync buttons (#20687)
* Always show sync buttons

* Update unit test
2022-02-23 10:04:37 -08:00
Nemanja Glumac
fd58eeb5da Apply visitQuestion helper to the related tests (#20671)
* Apply `visitQuestion` helper to the related tests

* Adjust interception to account for the pivot tables as well
2022-02-23 18:29:11 +01:00
Cam Saul
8b2877bdd9 Fix resolution of implicit joins inside explicit join conditions (#20697)
* Fix #20519

* Fix busted indentation
2022-02-23 17:18:56 +00:00
Ariya Hidayat
97e2b7d3fb Fix E2E admin l10n tests
Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2022-02-23 08:24:24 -08:00
Cam Saul
9378199ce9 Don't consider :field :join-alias when escaping aliases (#20684)
* Don't consider :field :join-alias when deduplicating aliases

* Unskip Cypress test
2022-02-23 15:55:19 +00:00
Alexander Polyankin
eb9ef86f68 Fix timestamp saving in events (#20679) 2022-02-23 18:49:10 +03:00
Ariya Hidayat
6fa976135d Increase H2 lock timeout for E2E tests (#20688)
The previously set 120-second timeout in PR #19412 is apparently
not sufficient, as admin-ee and sharing-ee still occasionally fail.
2022-02-23 07:31:58 -08:00
Nemanja Glumac
68c66f2bc0 Repro #20683: Error when filtering date by current quarter in Postgres (#20695) 2022-02-23 14:51:53 +01:00
Anton Kulyk
73c71c06b5 Clean up QB sidebar layout components (#20617)
* Convert `ViewButton` to TypeScript

* Convert SidebarContent to TypeScript

* Convert SidebarHeader to TypeScript

* Fix E2E tests

* Remove useMemo usage
2022-02-23 15:45:44 +02:00
Dalton
d9c51ec7df Fix locked parameters in embedded questions (#20635) 2022-02-22 09:07:34 -08:00
Nemanja Glumac
d91878c0ca Repro #20469: Main page loading spinner spins forever on API error (#20675) 2022-02-22 17:21:05 +01:00
Nemanja Glumac
f214d9031c Repro #20471: Ugly error state in Admin > Databases (#20676)
* Add repro for #20471

* Remove deprecated `cy.server()`
2022-02-22 17:20:24 +01:00
aljkor
4eedc1eb67 ì changed to i (#20578)
* ì changed to i

* ì changed to i
2022-02-22 12:34:41 -03:00
Alexander Polyankin
ebe3c275a0 Add time to event dates (#20668) 2022-02-22 17:19:06 +03:00
Nemanja Glumac
fd30233ab4 Add repro for #18814 (#20673) 2022-02-21 22:59:38 +01:00
Nemanja Glumac
fd802e1db3 Add repro for #15353 (#20672) 2022-02-21 22:24:50 +01:00
Nemanja Glumac
5bd243a7e2 Repro 20638: Creating a new dashboard from the New button in a collection should take me to that dashboard (#20667)
* Refactor the existing test for dashboard creation

* Add repro for #20638
2022-02-21 17:28:36 +01:00
Ariya Hidayat
ff6b980e7e yarn upgrade style-loader@0.23.1 (#20644) 2022-02-21 07:27:59 -08:00
Ariya Hidayat
aa2259969f yarn upgrade xlsx@0.18.2 (#20646) 2022-02-21 07:27:40 -08:00
Nemanja Glumac
5de3050a65 Repro #20624: Model metadata not overriding question column settings (#20663) 2022-02-21 15:57:06 +01:00
Nemanja Glumac
82ab3b207d Repro #20656: Dashboard with filter connected to a card that a user doesn't have permissions to view breaks (#20662) 2022-02-21 15:25:12 +01:00
Alexander Polyankin
92d10d4065 Add events search (#20629) 2022-02-21 13:53:26 +03:00
Anton Kulyk
381532504c Accept UnsavedCard type in Question class (#20595)
* Accept UnsavedCard type in Question class

* Fix type
2022-02-21 12:07:01 +02:00
Alexander Lesnenko
398d1adecd permissions table ui fixes (#20640) 2022-02-21 09:43:40 +00:00
Nemanja Glumac
333975a2e2 Repro #20627: Nested queries with long Data Model names causes failing query with incorrect aliasing (#20631) 2022-02-21 09:16:16 +01:00
Nemanja Glumac
f5062adfc8 E2E Helper visitQuestion: Ensure that the query loaded before moving forward with the test (#20630)
* Add `visitQuestion` helper function

* Apply `visitQuestion` to specs related to alerts
2022-02-19 19:15:14 +01:00
Alexander Polyankin
570e4a19e9 Add timeline empty states (#20585) 2022-02-18 11:38:03 +03:00
Nemanja Glumac
a9aee83eb4 Repro #20517: Removing or adding column descriptions to metadata of Models results in "failed save" (#20589) 2022-02-18 09:05:00 +01:00
Nemanja Glumac
b2df93e9ed Repro #20548: Changing Y-axis order can cause duplicate legends when modifying metrics after (#20587) 2022-02-18 09:04:21 +01:00
Anton Kulyk
9e1f03f230 Turn QueryBuilder container into a functional component (#20594)
* Turn QueryBuilder container into a func component

* Remove future code

* Extract hooks

* Fix location change handler
2022-02-18 08:07:43 +02:00
Anton Kulyk
c4a3572f91 Install @testing-library/react-hooks (#20593)
* Install @testing-library/react-hooks

* Return --silent flag to jest
2022-02-18 07:43:02 +02:00
Cam Saul
9b9fa910c2 Migrate clear-ldap-user-local-passwords migration to Liquibase (#20574) 2022-02-17 21:08:48 -08:00
Dalton
66a2cd27d7 Make date widget respect date/time format settings (#20509)
* Make single date widget respect date/time format settings

* handle undefined settings

* Add a repro
2022-02-17 17:54:04 -08:00
Noah Moss
bec20df7fd User-local settings (#20456) 2022-02-17 17:40:03 -05:00
frannietrempe
5caf280738 docs - elaborate on dashboard edit options (#20601) 2022-02-17 17:05:09 -05:00
Noah Moss
86c22ba70f New structure for data permission graphs (#20564)
Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
2022-02-17 16:05:35 -05:00
adam-james
5a67efea0e Events migration (#20452)
* Migrations for the new 'Annotate Useful Events' project

Users will be able to create 'events' in timelines, which are accessible via collections.

Two migrations are introduced to facilitate the new feature: timeline table, and event table. The following columns
are presumed necessary based on the design document:

** TimeLine
    - id
    - name
    - description
    - collection_id
    - archived
    - creator_id
    - created_at
    - updated_by ??
    - updated_at

*** Event
    - id
    - timeline_id
    - name
    - description markdown (max length 255 for some reason)
    - date
    - time is optional
    - timezone (optional)
    - icon (set of 6)
    - archived status
    - created by
    - created at
    - created through: api or UI
    - modified by ??
    - modified at

* Changes to events schema

- add icon onto timeline
- make icon on event nullable
- just move to a single timestamp on event, no boolean or anything
- rename event table to `timeline_events` since "event" is so generic

* dir-locals indentation

* Timeline api and model

- patched up the migration to make collection_id nullable since that is
the root collection
- followed the layout of api/metric and did the generic model stuff

* Select keys with keywords, not destructured nils :(

also, can't return the boolean from the update, but select it again

* Enable the automatic updated_at

* Boolean for "time matters" and string timezone column on events

* clean up migration, rename modified_at -> updated_at

for benefit of `:timestamped? true` bits

* basic timeline event model namespace

* Timeline Events initial API

Just beginning the basics for the API for timeline events.

 - need to find a way to check permissions
 - have to still check if the endpoint is returning stuff properly

* Singularize timeline_event tablename

* Timeline events api hooked up

* Singularize timeline event api namespace

* unused comment

* indent spec maps on routes

* Make name optional on timeline PUT

* Update collection api for timelines endpoints

- add /root/timelines endpoint for when collection id is null
- add /:id/timelines endpoint

Created a hydration function to hydrate the timeline events when fetching timelines.

* TimelineEvent permissions

- crate a permissions objects set via the timeline's permissions

* Move to using new permissions setup

previously was explicitly checking permissions of the underlying
timeline from the event, but now we just do the standard read/write
check on the event, and the permissions set knows it is based on the
permission set of the underlying timeline (which is based on the
permissions set of the underlying collection)

* Items api includes timelines

* Strip of icon from other rows

* Indices on timeline and timeline_event

timeline access by collection_id
timeline_event by both timeline_id and (timeline_id, timestamp) for when
looking for events within a certain range. We will always have been
narrowed by timeline ids (per the collection containing the question, or
by manually enabling certain timelines) so we don't need a huge index on
the timestamp itself.

* Skeleton of range-based query

* Initial timeline API tests

Began with some simple Auth tests and basic GET tests, using a Collection with an id as well as the special root collection.

* Fix docstring on api timeline namespace

* Put timeline's events at `:events` not `timeline-events`

* Add api/card/:id/timelines

At the moment api/card/:id/timelines and api/collection/:id/timelines do
the same thing: they return all of the timelines in the collection or in
the collection belonging to the card. In the future this may drift so
they share an implementation at the moment.

* Put creator on timeline

on api endpoints for timeline by id and timelines by card and collection

* Hydrate creator on events

Bit tricky stuff here. The FE wants the events at "events" not
"timeline-events" i guess due to the hyphen that js can never quite be
sure isn't subtraction.

To use the magic of nested hydration

`(hydrate timelines [:events :creator])`,

the events have to be put at the declared hydration key. I had wanted
the hydration `:timeline-events` for clarity in the code but want
`:events` to be the key. But when you do this, the hydration thinks it
didn't do any work and cannot add the creator. So the layout of the
datastructure is tied to the name of the hydration key. Makes sense but
I wish I had more control since `:events` is so generic.

* Add include param check to allow timeline GET to hydrate w/ events.

The basic check is in place for include=events in the following ways:

GET /api/timeline/:id?include=events
GET /api/collection/root/timelines?include=events

If include param is omitted, timelines are hydrated only with the creator. Events are always hydrated with creator.

* fix hyphen typo in api doc

* Change schema for include=events to s/enum to enforce proper param

Had used just a s/Str validation, which allows the include parameter value to be anything, which isn't great. So,
switched it to an enum. Can always change this later to be a set of valid enums, similar to the `model` parameter on
collection items.

* Fixed card/:id/timelines failing w/ wrong arity

The `include` parameter is passed to `timeline/timelines-for-collection` to control hydration of the events for that
timeline. Since the card API currently calls this function too, it requires that parameter be passed along.

As well, I abstracted the `include-events-schema` and have it in metabase.api.timeline. Not married to it, but since
the schema was being used across timeline, collection, and card API, it seems like a good idea to define it in one
place only. Not sure if it should be metabase.api.timeline or metabase.models.timeline

* used proper migration numbers (claimed in migrations slack channel)

* Add archived=true functionality

There's one subtle issue remaining, and that is that when archived=true, :creator is not hydrated on the events.

I'll look into fixing that.

In the meantime, the following changes are made:

 - :events returs empty list `[]` instead of `null` when there are no events in a timeline
 - archived events can be fetched via `/api/timeline/:id?include=events&archived=true`
 - similarly, archived events can be fetched with:
   - `/api/collection/root|:id/timelines?include=events&archived=true`
   - `/api/card/:id/timelines?include=events&archived=true`

Just note the caveat for the time being (no creator hydrated on events when fetching archived) Fix pending.

* Altered the hydration so creator is always part of a hydrated event

Adjusted the hydration of timelines as follows:

- hydration always grabs all events
- at the endpoint's implementation function, the timeline(s) are altered by filtering on archived true or false

Not sure if this is the best approach, but for now it should work

* Create GET endpoint for /api/timeline and allow archived=true

Added a missed GET endpoint for fetching all the timelines (optionally fetch archived)

* reformat def with docstring

* Timeline api updated to properly filter archived/un-archived

Use archived=true pattern in the query params for the timeline endpoint to allow FE to get what they need.

Work in progress on the API tests too.

* Timeline-events API tests

Timeline Events API endpoint tests, at least the very basics.

* Timeline Hydration w/ Events tests

Added a test for Events hydration in the timeline API test namespace.

* TimelineEvent Model test NS

May be a bit unnecessary to test the hydrate function, but the namespace is there in case we need to add more tests
over time.

Also adjusted out a comment and added a library to timeline_test ns

* Added metabase.models.timeline-test NS

Once again, this may be a bit unnecessary as a test ns for now, but could be the right place to add tests if the
feature grows in the future.

* Clean up handling of archived

- we only want to show archived events when viewing a timeline by id and
specifically asking for archived events. Presumably this is some
administrative screen. We don't want to allow all these options when
viewing a viz as its just overload and they are archived for a
reason. If FE really want them they can go by id of the timeline. Note
it will return all events, not just the archived ones.
- use namespaced keywords in the options map. Getting timelines
necessarily requires getting their events sometimes. And to avoid
confusion about the archived state, we have options like
`:timeline/events?`, `:timeline/archived?`, `:events/start`,
`:events/end`, and `:events/all?` so they are all in one map and not
nested or ambiguous.

* Clean up some tests

noticable differences: timelines with archived=true return all events as
if it is "include archived" rather than only show archived.

* PUT /api/timeline/:id now archives all events when TL is archived

We can archive/un-archive timelines, and all timeline events associated with that timeline will follow suit.

This does lose state when, for example, there is a mix of archived/un-archived events, as there is no notion of
'archived-by' to check against. But, per discussion in the pod-discovery slack channel, this is ok for now. It is also
how we handle other archiving scenarios anyway, with items on collections being archived when a collection is archived.

* cleanup tests

* Include Timeline and TimelineEvent in models

* Add tt/WithTempDefaults impls for Timeline/TimelineEvent

lets us remove lots of the `(merge defaults {...})` that was in the code.

Defaults are

```clojure
   Timeline
   (fn [_]
     {:name       "Timeline of bird squawks"
      :creator_id (rasta-id)})

   TimelineEvent
   (fn [_]
     {:name         "default timeline event"
      :timestamp    (t/zoned-date-time)
      :timezone     "US/Pacific"
      :time_matters true
      :creator_id   (rasta-id)})
```

* Add timeline and timeline event to copy infra

* Timeline Test checking that archiving a Timeline archives its events

A Timeline can be archived and its events should also be archived.
A Timeline can also be unarchived, which should also unarchive the events.

* Docstring clarity on apis

* Remove commented out form

* Reorder migrations

* Clean ns

clj-kondo ignores those but our linter does not

* Correct casing on api schema for include

* Ensure cleanup of timeline from test

* DELETE for timeline and timeline-event

* Poison collection items timeline query when is_pinned

timelines have no notion of pinning and were coming back in both queries
for pinned and not pinned. This adds a poison clause 1=2 when searching
for pinned timelines since none are but they don't have a column saying
that.

* Clean up old comment and useless tests

comment still said to poison the query when getting pinned state and
that function had been added.

Tests were asserting count = 2 and also the set of names had two things
in them. Close enough since there are no duplicate names

* Use TemporalString schema on timeline event routes

Co-authored-by: dan sutton <dan@dpsutton.com>
2022-02-17 14:29:50 -06:00
Ariya Hidayat
a8dabd6ae3 Custom expression editor: do not always suggest an open parenthesis (#20533)
For functions which do not accept any arguments, i.e. COUNT and
CUMULATIVECOUNT, do not suggest the completion with the "(" character.
2022-02-17 10:51:42 -08:00
Cam Saul
2ebb5958a1 Replace add-databases-to-magic-permissions-groups with Liquibase migrations (#20401)
* Rewrite add-databases-to-magic-permissions-groups

* Add a test for v0.43.00-007

* Small test tweak.
2022-02-17 10:24:35 -08:00
Jeff Bruemmer
da771cead7 typo (#20590) 2022-02-17 11:59:19 -05:00
Alexander Lesnenko
5f193ef24c Upgrade webpack dev server (#20583) 2022-02-17 15:26:31 +00:00
Ariya Hidayat
12952daba4 E2E tests on master: add permissions and sharing test groups (#20566) 2022-02-17 07:23:32 -08:00
Ariya Hidayat
445868102d Make time-series filter work with expression dimension (#20510)
The widget to filter time-series dimension should not assume that the
dimension is from a field, as it can be also an expression, i.e. when
the breakout is originated from a custom column. Hence, generalize the
case to avoid any crashing.
2022-02-17 07:23:13 -08:00
Cam Saul
bf9485873c Dashboard Subscriptions *should* use :default param values. Dashboard QP should ignore them. (#20569) 2022-02-17 07:20:09 -08:00
Nemanja Glumac
357ecd76c2 Repro #20560: Shouldn't display filter action menu when clicking on a value in single-record view (#20579)
* Add repro for #20560

* Get only the popover element

* Avoid false positive assertion
2022-02-17 15:34:06 +01:00
Nemanja Glumac
f89b6939a3 Repro #20438: Embed dashboard Field Filter cannot work when choosing single option (#20536)
* Add repro for #20438

* Rewrite repro to use products category
2022-02-17 14:58:53 +01:00
Nemanja Glumac
4e1d406094 Repro #20551: Filter dropdown only allows filtering on "starts with" (#20581) 2022-02-17 14:31:50 +01:00
Dalton
8d2f07400a Use includes instead of startsWith to filter options in ListField (#20561)
* use includes instead of startsWith to filter in ListField

* add autoFocus to ListField input
2022-02-17 12:54:59 +01:00
Alexander Polyankin
8b6a662a7d Add date input for timeline event dates (#20562) 2022-02-17 14:37:59 +03:00
Cam Saul
8f0c6a62b3 Replace add-admin-group-root-entry with Liquibase migrations (#20400)
* Rework add-admin-group-root-entry migration

* Add test for the migration

* Dump/load should not copy the root perms entry for the admin group
2022-02-16 18:30:35 -08:00
Cam Saul
15f3732296 Replace add-users-to-default-permissions-groups with Liquibase migrations (#20399)
* Remove add-users-to-default-permissions-groups data migration

* Revert changes to Cypress tests

* Revert unneeded change
2022-02-16 14:18:56 -08:00
Cam Saul
224cbd0540 Add lots of exclusions to Spark SQL JDBC driver (#20563) 2022-02-16 14:00:16 -08:00
Cam Saul
f0251f09ff Bump SAML lib version (#20539)
* Bump SAML lib version

* Add entry to recognize metabase/saml20-clj as being released under EPL v2
2022-02-16 09:41:05 -08:00
frannietrempe
f1bb5be5e2 docs - expanding google drive instructions in bigquery docs (#20557)
* docs - expanding google drive section of bq docs

* jeff feedback
2022-02-16 11:23:40 -05:00
Luis Paolini
0e3950da9d Adding encryption algo's to docs (#20553)
We get this question a lot
2022-02-16 12:52:05 -03:00
Alexander Polyankin
ac9bbc5b4a Add timeline editing (#20455) 2022-02-16 18:32:27 +03:00
Ariya Hidayat
3010fe6a1d E2E tests on master: run for EE as well (#20542) 2022-02-16 06:40:23 -08:00
Cam Saul
4976869af4 Replace copy-site-url-setting-and-remove-trailing-slashes with a Liquibase migration (#20402)
* Replace metabase.db.migrations/copy-site-url-setting-and-remove-trailing-slashes with a Liquibase migration

* Tweak comment

* `setting`, not `settings`

* Clean namespace

* `key` has to be quoted for MySQL

* Add tests for migrations v0.43.00-008 and v0.43.00-009

* fix new migration for MySQL 5.7
2022-02-15 16:54:58 -08:00
Cam Saul
f6509034a7 Dashboard QP endpoints should ignore :default values and treat them as no value and compile Field filters to 1 = 1 (#20503)
* Fix

* More logging

* Fix unbalanced parens

* Tweak logging

* Add another test

* Tweak test to use :string/=

* More logging

* Updated fix for #20493

* Enable test

* Try disabling the #19494 tests to see what happens.

* Rework #19494 test
2022-02-15 14:50:43 -08:00
Noah Moss
094534e039 Ensure token_features and created_at are included in backend Snowplow events (#20523) 2022-02-15 17:28:25 -05:00
Cam Saul
718c1400fc Replace migrate-humanization-setting with Liquibase migrations (#20404)
* Replace metabase.db.migrations/migrate-humanization-setting with a Liquibase migration

* Apparently key has to be quoted these days in MySQL/MariaDB

* Need to quote key in the preCondition as well

* Fix merge conflicts
2022-02-15 10:36:41 -08:00
Cam Saul
6ae6b43353 Embed query endpoints should handle operator filters with a single arg (#20512)
* Embed query endpoints should handle operator filters with a single arg

* PR feedback
2022-02-15 10:16:17 -08:00
Nemanja Glumac
54c4fa9fa1 Repro #20519: Summarizing with implicit join does not allow subsequent joins and nested query (#20521)
* Add repro for #20519

* Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update frontend/test/metabase/scenarios/joins/reproductions/20519-cannot-join-on-aggregation-with-implicit-joins-and-nested-query.cy.spec.js

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2022-02-15 18:53:46 +01:00
Alexander Lesnenko
6e17955ce2 fix data picker another double scroll and add a visual test (#20524)
* fix data picker another double scroll and add a visual test

* review
2022-02-15 17:23:46 +00:00
Cam Saul
3bab2e445f Replace mark-category-fields-as-list with a Liquibase migrations (#20405)
* Replace metabase.db.migrations/mark-category-fields-as-list with a Liquibase migration

* Fix stray comma
2022-02-15 09:23:20 -08:00
Cam Saul
4dc16403ab Upgrade Hive JDBC driver version from 1.2.2 -> 3.1.2; Bump Spark SQL from 2.1.1 to 3.2.1 (#20353)
* Replace AOT Spark SQL deps with a `proxy` and a `DataSource`

* Support `connection-details->spec` returning a `DataSource`

* Remove target/classes

* Don't need to deps prep drivers anymore

* Fix duplicate `this` params in `proxy` methods; add `:test` alias for Eastwood to make it be a little quieter

* Make sure to call `pool/map->properties`

* Upgrade Hive JDBC driver version from 1.2.2 -> 3.1.2; Bump Spark SQL from 2.1.1 to 3.2.1

* Clean the namespaces

* Don't need to register the a proxy JDBC driver since we're not even using it anymore

* Fix Spark SQL :schema sync for newer versions

* Remove unneeded override

* Fix day-of-week extract for new :sparksql

* Hive/Spark SQL needs to escape question marks inside QUOTED identifiers now 😒

* Some minor SQL generation improvements to avoid duplicate casts

* Revert change to debug test
2022-02-15 09:19:29 -08:00
Cam Saul
f790d66993 Force clojure -X:h2 to use H2 (#20513) 2022-02-15 09:10:17 -08:00
Anton Kulyk
0ed8c0cf8b Fix nested query controls for no-data users (#20317) 2022-02-15 14:17:33 +02:00
Alexander Lesnenko
4a456d1058 fix double scroll bar in the data picker (#20507) 2022-02-15 11:59:36 +00:00
Anton Kulyk
33dd211533 Clean up QueryBuilder top container and view components (#20416)
* Extract methods

* Reorder imports

* Extract method to render left QB sidebar

* Extract method to render right sidebar

* Extract `NewQuestionView` component

* Extract `renderHeader`

* Extract popovers rendering

* Extract styled components

* Fix styled components

* Extract `renderMain` method

* Fix some prop drilling and access

* Minor QB container cleanup

* Reorder QB container imports
2022-02-15 11:59:09 +02:00
Anton Kulyk
55c483e16f Fix permission error when opening revision history (#20421) 2022-02-15 11:46:50 +02:00
Dalton
9f8f810cc7 Add hook which replaces OnClickOutsideWrapper behavior (#20431) 2022-02-14 17:14:45 -08:00
Dalton
d3466c9f2d Disable sample dataset engine form field (#20458)
* Disable sample dataset engine form field

* e2e test
2022-02-14 17:14:20 -08:00
Cam Saul
0a80b825f7 Add aliases for H2 and Liquibase CLIs (#20409)
* Add aliases for H2 and Liquibase CLIs

* Use reflection to invoke Liquibase method so it doesn't bust stuff
2022-02-14 16:56:33 -08:00
Bryan Maass
bab1a39fa4 Disallow engine change on sample db (#20447)
* for sample db do not allow certain updates
- namely to engine in the model layer

* only check for new schedules one time

* remove unnecessary *current-user-id* binding in test
- as per code review

* Use `thrown-with-message?` to check for exceptions
- Previously this would pass if db/update did _not_ throw an excetption,
  which is not what we want here.
2022-02-14 17:31:27 -06:00
Ariya Hidayat
e4eb3f99c3 Custom expression editor: don't suggest a unique matching function (#20485) 2022-02-14 15:06:59 -08:00
Cam Saul
db53127406 Restore version of test from #20434 (#20508) 2022-02-14 14:39:39 -08:00
Cam Saul
5cefe5171f Replace ensure-protocol-specified-in-site-url with a Liquibase migration (#20403)
* Replace metabase.db.migrations/ensure-protocol-specified-in-site-url with a Liquibase migration

* Quote `key` for MySQL/MariaDB
2022-02-14 14:37:36 -08:00
Nemanja Glumac
dcb98c3040 Repro #20436:Restricting and unrestricting access to a table results in the DB-level permission still being "Granular" #20504 2022-02-14 22:21:21 +01:00
Cam Saul
f94d5149e3 Add logic to truncate and uniquely-suffix column alias identifiers (#19659)
* Add failing test for #15978

* Improved test

* Add new metabase.driver.query-processor.escape-join-aliases QP middleware

* Test fix 🔧

* Add reference to #20307

* Add some extra dox

* Test fixes for BigQuery drivers

* revert unneeded change

* Fix :bigquery and :bigquery-cloud-sdk mixup

* Test fixes 🔧

* Test fix 🔧

* Remove comment I meant to remove
2022-02-14 12:46:13 -08:00
Nemanja Glumac
09ac611aef Repro #20493: Dashboard filter with defaults, doesn't work if values are removed, query fails (#20495) 2022-02-14 19:56:46 +01:00
Alexander Lesnenko
a0517d4113 Permissions UI groundwork (#20433)
* keep click

* safari fixes
2022-02-14 18:55:49 +00:00
Nemanja Glumac
0a54b7c30c Repro #20488: Trend visualization percentage rounding decimals (#20492)
* Add repro for #20488

* Update frontend/test/metabase/scenarios/visualizations/smartscalar-trend.cy.spec.js

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update number formatting

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2022-02-14 19:39:16 +01:00
Cam Saul
33502cc9a1 Include (new) site UUID in EE token check request (#20475)
* New site-uuid Setting for token checks

* Move Setting to public-settings; it has to be define afer we define ::uuid-nonce

* Test fix 🔧
2022-02-14 10:23:59 -08:00
Bryan Maass
ad4ded48cc add standard cookie policy to test http client (#20019)
- no longer prints log about invalid expires cookie in tests
2022-02-14 12:01:08 -06:00
Diogo Mendes
ea5aacdc01 Refactor Test to use API Call (#20491)
* Creating reproduction for 20442 + some refactor

* Skipping while waits for fix

* Remove skip

* Fix

* Resolving as requested

* Removing unneeded check

* Update frontend/test/metabase/scenarios/admin/settings/sso/google.cy.spec.js

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

* Remove unneded reload

* Adding assertion

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2022-02-14 14:59:33 -03:00
Ariya Hidayat
7d58b94645 Custom expression editor: use ace-builds instead of brace (#20480)
As documented, react-ace >=8 doesn't need brace anymore.

This reduces the bundle size,
resources/frontend_client/app/dist/vendor.bundle.js, by 218 KB, from
5286809 to 5063129 bytes.
2022-02-14 09:32:10 -08:00
Ariya Hidayat
5ddd3c68c4 Custom expression editor: Esc hides the suggestion list/help text (#20477) 2022-02-14 08:01:57 -08:00
Ariya Hidayat
4ae10228fd yarn upgrade react-motion@0.5.2 (#20481) 2022-02-14 06:39:24 -08:00
Diogo Mendes
aafc68ab11 Creating reproduction for 20442 + some refactor (#20453)
* Creating reproduction for 20442 + some refactor

* Skipping while waits for fix

* Remove skip

* Fix
2022-02-14 10:04:57 -03:00
Nemanja Glumac
0e419dc867 Simplify tests by improving custom cy.createQuestion command (#20441)
* Optionally wrap question id to make it available outside of the original scope

* Use `visitQuestion` to simpliy tests

* Fix pivot_table tests

* Fix repro 12568 for nested questions

* Fix repro for 10803

* No need to rely on UI elements any more
2022-02-13 23:17:11 +01:00
Cam Saul
1a521c41e4 Fix source aliases for Fields from joins not being properly escaped (#20474)
* Fix source aliases for Fields from joins not being properly escaped

* Tweak TODO comment

* Disable the flaky tests when running driver tests

* Rename the new macro

* Dox

* Remove unused :require
2022-02-13 12:30:00 -08:00
Ariya Hidayat
3f0ae2829e yarn upgrade icepick@2.4.0 (#20473) 2022-02-13 00:29:15 -08:00
Ariya Hidayat
537d3c5397 Upgrade type definitions, i.e. @types packages (#20479)
Basically:
```
yarn upgrade @types/eslint@7.29.0
yarn upgrade @types/prettier@1.19.1
yarn upgrade @types/react-motion@0.0.32
yarn upgrade @types/react-router@3.0.28
yarn upgrade @types/react-transition-group@1.1.8
```
2022-02-12 23:49:12 -08:00
Ariya Hidayat
a17a4ca3ca yarn upgrade xlsx@0.18.0 (#20478) 2022-02-12 23:07:47 -08:00
Ariya Hidayat
c8ab176656 yarn upgrade eslint@7.32.0 (#20472) 2022-02-12 08:31:37 -08:00
Cam Saul
cd7a4e4675 Support running Oracle tests with local Docker image (#20358) 2022-02-11 16:18:05 -08:00
Cam Saul
dad00648a7 BigQuery should qualify columns from source query with source in the SELECT clause (#20434)
* Fix BigQuery not qualifying source columns

* Don't fix on 42 for the deprecated BigQuery driver

* You know what I'll fix it after all. Why not.

* Oops I updated the wrong part of the test
2022-02-11 15:15:50 -08:00
Noah Moss
16dc860edc Clear google auth client ID setting if empty string is saved (#20462) 2022-02-11 17:03:26 -05:00
Noah Moss
e6087ad23c Ensure PNG cropping doesn't clip table content (#20448) 2022-02-11 15:41:40 -05:00
Dalton
308090f1a9 use column settings instead of display_name for pivot table value header (#20435) 2022-02-11 09:30:27 -08:00
Ariya Hidayat
4a76c4b053 Fix parsing of some aggregation functions with no args (#20432)
In an expression `COUNT/2`, `COUNT` there should be treated as a
function (i.e. `COUNT()`) instead of a field.
Another function is the same category is `CUMULATIVECOUNT`.
Both don't require any arguments, hence the parentheses are optional.
2022-02-11 08:49:15 -08:00
Diogo Mendes
e6649aff0b Creating regressions for 16621 (#20445) 2022-02-11 13:43:00 -03:00
Alexander Lesnenko
55a5fde20f fix accordion list keyboard nav (#20446) 2022-02-11 14:59:17 +00:00
Alexander Polyankin
01d50f5099 Add basic timeline & timeline events creation (#20344) 2022-02-11 16:36:35 +03:00
Anton Kulyk
5dcf1735c7 Fix object detail browsing (#20101)
* Group `Urls.question` args into object

* Use `Urls.serializedQuestion`

* Fix `tableRowsQuery` URL builder

* Add E2E tests

* Add routes with `/:objectId`

* Add `objectId` support to question URL builders

* Use `queryParams` from `location` in QB init

* Fix `useSyncedQueryString` drops other params

* Add `zoomInRow` action

* Add `resetRowZoom` action

* Add basic selectors

* Modify `getIsObjectDetail` selector

* Handle `objectId` during QB init

* Replace actions opening prev/next object detail

* Use zoomed row in object detail view

* Update `ObjectDetailDrill`

* Fix URLs update for detail views

* Handle browser "back" button in detail view

* Use question name as a fallback for object view title field

* Fix E2E tests

* Fix E2E test

* Fix routes order

* Fix opening a link to filtered out record

* Move tests for object details

* Fix regexp

* Fix link style

* Better routing handling
2022-02-11 10:14:11 +02:00
Michiel Borkent
8f119d6457 Linting improvements (#20424)
* honeysql var improvements

* Define routes

* Define routes

* define-routes improvement

* honeysql helpers

* honesql

* abs in clojure 1.11

* fix logic unresolved vars

* deprecated

* deprecated var warnings

* undo replace
2022-02-10 15:13:27 -08:00
Cam Saul
25f10ee175 Remove unused reducedf metadata param (#20311) 2022-02-10 11:36:03 -08:00
Nemanja Glumac
06f35d71e1 Remove duplicated binning repros (#20429)
* Remove superfluous isolated repro for 15648

* Remove superfluous isolated repro for 11183

* Remove superfluous isolated repro for 15574

* Remove superfluous isolated repro for 15446
2022-02-10 20:21:59 +01:00
Anton Kulyk
8a7e1021f5 Refactor question URL builder arguments (#20366)
* Group `Urls.question` args into object

* Use `Urls.serializedQuestion`

* Fix `tableRowsQuery` URL builder
2022-02-10 18:36:40 +02:00
Anton Kulyk
1c88f5f2c6 Fix revision history display (#20417)
* Fix nested arrays

* Add unit test

* Fallback to original revision message on error
2022-02-10 18:35:59 +02:00
Dalton
7fa377af4d Handle scenario where query props are undefined on a StructuredQuery (#20394)
* Handle scenario where query is undefined

* Add repro
2022-02-10 08:21:52 -08:00
Dalton
ecd65274f6 Pass metadata-populated parameters to the embedded dashboard modal (#20383)
* Fix dashboard embedding locked parameter scripting err

We were not passing the embedding components the correct parameter
objects; instead of dashboard.parameters we need to pass the components
parameters that have had metadata added to them such as the fields they
are mapped to, as child parameters components now expect this metadata
to exist.

* Add e2e tests for embedded parameters
2022-02-10 08:21:35 -08:00
Jeff Bruemmer
a4dec2f0be docs - questions (#20422) 2022-02-10 10:52:48 -05:00
Nemanja Glumac
f62f35250b Bi-basics e2e helpers (#20395)
* Add e2e helpers for bi-basics

* Apply `summarize` helper to the related tests

* Apply `filter` helper to the related tests
2022-02-10 15:02:20 +01:00
Anton Kulyk
b9fe0ff0e8 Remove some stuff from the window (#20415) 2022-02-10 15:20:00 +02:00
Ariya Hidayat
bd6049b6c0 Dashboard checkbox should honor reduced-motion (#20385) 2022-02-09 21:55:46 -08:00
Alexander Lesnenko
9a28255750 wait for all people page requests (#20370) 2022-02-09 19:51:49 +00:00
Cam Saul
9551093d69 Add org.quartz-scheduler/quartz as an explict dep and bump version from 2.1.7 -> 2.3.2 (#20343)
* Add org.quartz-scheduler/quartz as an explict dep and bump version from 2.17 -> 2.3.2

* Add no-op impl for `initialize` for our Quartz `ConnectionProvider`
2022-02-09 09:43:08 -08:00
Ariya Hidayat
b40c453b9e Collection permissions E2E: wait for the complete collection data (#20347) 2022-02-09 07:54:25 -08:00
Jeff Bruemmer
ee8a2b7fc6 update links (#20375) 2022-02-09 10:20:14 -05:00
Nemanja Glumac
fc0ec1f546 Replace BigQuery deprecation test with the Presto driver (#20373) 2022-02-09 16:15:19 +01:00
Jeff Bruemmer
53d220c19d remove mac app reference (#20351) 2022-02-09 09:30:36 -05:00
Alexander Lesnenko
458c06cce2 remove tsc-files (#20369) 2022-02-09 14:02:25 +00:00
Anton Kulyk
7720c2ab1f Remove not used isCardDirty helper (#20367) 2022-02-09 14:24:31 +02:00
Anton Kulyk
08e60aa0b3 Fix drill actions dispatching redux actions are broken (#20098)
* Make `performDefaultAction` usage more readable

* Connect `Visualization` to redux

* Fix visualization unit tests
2022-02-09 10:55:43 +02:00
Cam Saul
9c235d60cc Simplify QP cache middleware (#20310)
* Simplify QP cache middleware

* Fix hanging tests
2022-02-08 20:25:58 -08:00
Cam Saul
9cc38ac4b0 Remove unused dep on aleph (and thus unused transient dep on Netty) (#20342) 2022-02-08 17:50:50 -08:00
Ariya Hidayat
e643f1c4a3 Use Docker Hub credentials to avoid being rate-throttled (#20339) 2022-02-08 13:54:04 -08:00
Alexander Lesnenko
63c607fcb9 Migrate styled-components 3 to the latest emotion (#20275)
* replace attrs to defaultProps (#20260)

* replace attrs to defaultProps

* fix replaced attrs

* fix className in defaultProps

* use emotion (#20265)

* replace attrs to defaultProps

* fix replaced attrs

* use emotion

* fix typo in css

* eliminate innerRefs

* fixes

* fixes

* fixes

* fixes

* flakes

* specs

* specs

* docs

* specs

* fix last spec

* remove classNames from defaultProps
2022-02-08 21:51:29 +00:00
Luis Paolini
f0a01c9bd0 localStorage can't be used in Chrome Incognito (#20345)
* Update full-app-embedding.md

* Update docs/enterprise-guide/full-app-embedding.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update docs/enterprise-guide/full-app-embedding.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update full-app-embedding.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2022-02-08 17:49:18 -03:00
Cam Saul
e273c6bf3b Fix QP remapping middleware not recursing into joins or source queries of source queries (#20154)
* Fix #9236 [WIP]

* Revert unneeded changes

* Only merge namespaced :options into result info

* Revert unneeded changes

* Everything is working 🙀

* Revert unneeded change

* Fix #15578 part 2

* Fix #15578 (second attempt)

* Test fixes

* Sort namespaces

* Clean namespaces

* Add `:test` profile to `namespace-checker` to suppress log messages.

* PR feedback

* Fix namespaces

* Fix docstring
2022-02-08 11:47:43 -08:00
Jeff Evans
22ebe102b4 Remove :bigquery driver (#20142)
* Remove :bigquery driver

Add "migration" to convert existing Database instances from :bigquery to :bigquery-cloud-sdk (with error log if using outdated OAuth mechanisms), by way of `normalize-db-details`

Removing references to :bigquery from various places in the code

* Remove from modules/drivers/deps.edn

* Remove stuff from CircleCI that is running the old driver

Remove `driver-switch-test` since there is no practical way to run this anymore (since we can't initialize the old driver)

Remove buggy redef of `isa?` from `semantic-type-migration-tests`

Co-authored-by: Cam Saul <github@camsaul.com>
2022-02-08 13:28:38 -06:00
Howon Lee
666ad2ced6 Set default waterfall colors static viz (#20334)
Pursuant to issue #20332 - it was blanking out without settings set before
2022-02-08 10:37:20 -08:00
Maz Ameli
998ea65f74 improve spacing above unpinned items table (#20336) 2022-02-08 09:56:18 -08:00
Dalton
9be2d8f280 Add hideOnEsc plugin to TippyPopover (#20299)
* Add hideOnEsc plugin & tweak lazy plugin

* full example

* rmv unused defaultValue
2022-02-08 08:26:57 -08:00
Alexander Lesnenko
8278110d04 fix visual tests command (#20330) 2022-02-08 15:49:55 +00:00
Luis Paolini
860ef3fa4b Fix locking in new Alpine release container (#20298)
* Fix locking in new Alpine release container
Seems like the new Alpine container (3.15) has some issue when doing apk upgrade first which ends up erroring out the process, so moving it to the last part of the process (after installing the packages) makes the trick.
You can test it out by using the current process (errors with a "Unable to lock database: temporary error (try again later)") and the one in this branch which will finish successfully
2022-02-08 12:36:04 -03:00
frannietrempe
a636c75a85 docs - mention prefers-reduced-motion setting (#20325)
* docs - mention prefers-reduced-motion setting

* Update docs/accessibility.md

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2022-02-08 10:00:39 -05:00
Nemanja Glumac
a99ea9d1c3 Remove accidental .debug() from a test (#20324) 2022-02-08 15:59:36 +01:00
Nemanja Glumac
d50f31f498 Rewrite open table helper (#20304)
* Expand the `visitQuestionAdhoc` helper with the selection of the `mode`

* Rewrite `openTable` helpers using the `visitQuestionAdhoc`

* Remove superfluous wait for the `dataset`

* Fix `nulls` test

* Rewrite and fix `trendline` test

* Fix `saved` question test
2022-02-08 15:03:21 +01:00
Anton Kulyk
69fdb2aff0 Add Event and EventTimeline entities (#20313)
* Fix User type

* Add mock user factory

* Add Event and EventTimeline types

* Add mock factories for Event and EventTimeline

* Add Events entity

* Add EventTimeline entity

* Fix exports

* Move new types to `types/api`
2022-02-08 14:45:49 +02:00
Anton Kulyk
c9b999d554 Fix model metadata propagation (#20273)
* Merge field `results_metadata` into field instance object

* Update unit tests

* Fix replacing result metadata on query completion

* Keep previous QB mode in redux

* Rerun model query after saving editor changes

* Ignore table column widths reset event after exiting model editor

* Reload query when entering model editor

* Remove commented out code

* Fix Dimension unit tests get stuck
2022-02-08 14:17:55 +02:00
Alexander Kiselev
f3bd959aac Visual Design Cleanup for Headers - Fix header secondary buttons (#20055)
* Make changes to header buttons as per designer feedback and remove secondary button style from core button

* removed last use of secondary

* fix active notebook button color

* fix View SQL button and modal
2022-02-08 03:23:08 -08:00
Nemanja Glumac
f00b1b03e1 Make Ad hoc question e2e helper automatically wait for the query results (#20295)
* Integrate waiting for the question dataset into the helper function itself

* Remove explicit waiting from visual tests

* Remove explicit waiting from most of the e2e tests

* Handle pivot tables dataset

* Handle assertion callback

* Simplify helper function

* Fix `bar_chart`

* Fix `line_chart`

* Fix `scatter` visualization tests
2022-02-08 12:01:54 +01:00
Anton Kulyk
c7801b8aba Disallow moving items to a collection it's already in via drag-n-drop (#20288)
* Disallow moving items to same collection via DND

* Fix typo
2022-02-08 11:32:02 +02:00
Cam Saul
e35ecacacd Rework how the remappings middleware matches remapped to/from columns for explicit external (FK) remaps (#20009)
* Fix #9236 [WIP]

* Revert unneeded changes

* Only merge namespaced :options into result info

* Revert unneeded changes

* Everything is working 🙀

* Revert unneeded change

* Clean namespaces

* Add `:test` profile to `namespace-checker` to suppress log messages.

* PR feedback

* Fix namespaces
2022-02-08 01:20:17 -08:00
Ariya Hidayat
0e7c7f1e20 E2E tests on master: add dashboard groups (#20302) 2022-02-08 00:58:52 -08:00
Alexander Lesnenko
b78c983267 Add Select and AccordionList keyboard navigation (#19858)
* Select and AccordionList a11y

* fixes

* fixes

* fix keyboard navigation when filtering

* fix missing search input autofocus

* optional chaining

* fix virtualization combined with autofocused input

* remove console warnings

* check ci

* flakes
2022-02-07 21:16:57 +00:00
Jeff Bruemmer
e03f63f4c4 docs - remove filtering on this field (#20294) 2022-02-07 16:09:06 -05:00
Jeff Bruemmer
0162083ec1 Docs - postgres, truststore, and keystore (#20118) 2022-02-07 13:34:56 -05:00
Anton Kulyk
250c46b5ab Clean up ObjectDetailDrill (#20099) 2022-02-07 17:20:07 +02:00
Anton Kulyk
64c6018efa Disable model editor's "Save changes" button when there are no changes (#20191)
* Don't offer to save model changes without changes

* Rename variable

* Assert save button is initially disabled

* Disable save button if model isn't dirty

* Fix prop type

* Clean up metadataDiff after saving changes
2022-02-07 15:23:44 +02:00
Anton Kulyk
45989d1d6a Remove has_field_values form field for models (#20271) 2022-02-07 14:59:37 +02:00
Nemanja Glumac
13cf15e251 Reinforce time-series binning e2e test (#20284) 2022-02-07 08:01:15 -03:00
Diogo Mendes
231186449a Changing circleCI resource (#20270) 2022-02-06 20:06:43 -03:00
Ariya Hidayat
1816509779 Run selected E2E groups with GitHub Actions (#20266) 2022-02-05 07:23:29 -08:00
Ariya Hidayat
195c42a7cc Migrate test-build-scripts CI to GitHub Actions (#20257) 2022-02-05 08:04:31 -03:00
dpsutton
b307a2888c Prevent flaky tests based on contents of TaskHistory (#20240)
* Prevent flaky tests based on contents of TaskHistory

Just check for subsets since we sometimes encounter fingerprint-fields
and analyze information

Output from CI:
```
task_history_cleanup_test.clj:35
Basic run of the cleanup task when it needs to remove rows. Should also add a TaskHistory row once complete
expected: #{"task-history-cleanup"
            "metabase.task.task-history-cleanup-test/task-3"
            "metabase.task.task-history-cleanup-test/task-2"}
  actual: #{"classify-fields"
            "analyze"
            "fingerprint-fields"
            "task-history-cleanup"
            "metabase.task.task-history-cleanup-test/task-3"
            "metabase.task.task-history-cleanup-test/task-2"}
    diff: + #{"classify-fields" "analyze" "fingerprint-fields"}
```

* fix ns
2022-02-04 18:12:05 -06:00
chπ
8565023a1c Add Exasol driver to list of community drivers (#19767) 2022-02-04 16:10:49 -08:00
Jeff Evans
23f78db489 Retain property file path when revisiting database edit page (#20199)
* Retain property file path when revisiting database edit page

Ensuring that the file path (if that is the secret type) is returned via the API response to the admin, so the UX on the form edit page is better

This involved a lot of refactoring to clean up some stuff:

* removed the population of inferred secret properties (ex: last updated timestamp and creator ID) from `handle-db-details-secret-prop!`, since that stores those values into the details blob, defeating some of the purpose of normalizing secrets into a separate table
* moved the logic for injecting such inferred values to a new function, `expand-inferred-secret-values`, which lives within the secret model namespace
* delegating existing calls that require such expansion to the new function
* adding a new helper function, `reduce-over-details-secret-values`, to handle some common logic that is now showing up in a few places (reducing over db-details on secret values and doing some kind of manipulation)

Adding new database API test to ensure that the file path value is, in fact, returned from the API
2022-02-04 17:16:31 -06:00
dpsutton
977841b09e Ignore hidden/archived tables cards and dashboards in recent list (#20238)
*** Code:
- ignore hidden tables and archived cards/dashboards
- correct docstring to indicate we are only getting 5 not 10 as
previously claimed
- in query, set limit to 8 in the case we get archived or non-existing
things and then take 5 in memory
- select extra properties from models that we need for this
determination

*** Tests:
- for mysql we were inserting views with a thread/sleep of one second
between each. Just compute timestamps seconds apart and do them all at
once. Should save 7 seconds off mysql test runs. verified temporal
spacing works with

```
 MB_DB_CONNECTION_URI="mysql://username:password@localhost:3306/cli" \
 clj -X:dev:test :only metabase.api.activity-test
```
- cleanup these activities we were creating with `mt/with-model-cleanup`
which introduces a big looking diff. But checking diff with whitespace
shows its just an indentation and then add the extra keys needed for
identifying which are archived (:archived and :visibility_type for cards
and tables respectively)
2022-02-04 15:56:42 -06:00
Dalton
f2ce41a065 Hide pin action button when user can't pin (#20272)
* Hide pin action button when user can't pin

* unskip repro

* add a new boolean
2022-02-04 13:24:39 -08:00
Dalton
84bc79dc93 disable leaflet pointer-events in collection visualizations (#20267) 2022-02-04 13:24:26 -08:00
Anton Kulyk
b0b8bc8052 Allow to unmap native model column from a real one (#20219)
* Add clear behavior to `SelectButton`

* Removed redundant type

* Allow unmapping model column from a real one
2022-02-04 20:59:32 +02:00
Anton Kulyk
89ae166d27 Remove metadata_checksum from the frontend (#20261) 2022-02-04 20:59:16 +02:00
Alexander Polyankin
bbb91a5666 Remove grid-styled (#20259) 2022-02-04 20:28:09 +03:00
Alexander Polyankin
9b01c526d9 Migrate admin from grid-styled (#20223) 2022-02-04 20:00:50 +03:00
Luis Paolini
b8d454fd20 Update serialization documentation (#19732)
* Update serialization documentation
* Removing archived items

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2022-02-04 13:43:37 -03:00
Alexander Polyankin
1b520c8871 Migrate "enterprise" from grid-styled (#20256) 2022-02-04 19:36:07 +03:00
Alexander Polyankin
18d27b0998 Migrate "internal" from grid-styled (#20255) 2022-02-04 19:26:42 +03:00
Alexander Polyankin
09c15d37c3 Migrate Grid from grid-styled (#20258) 2022-02-04 19:17:35 +03:00
Ariya Hidayat
cc1abf2416 Move Liquibase migration tests to GitHub Actions (#20218) 2022-02-04 07:35:32 -08:00
Alexander Polyankin
16f5a9133f Migrate query-builder from grid-styled (#20220) 2022-02-04 17:47:37 +03:00
Anton Kulyk
7670630de0 Fix table column titles get cut-off when switching to model metadata editor (#20249)
* Remeasure table column when header changes

* Fix virtual measuring columns left in the DOM

* Fix table viz unit test
2022-02-04 16:44:13 +02:00
Alexander Polyankin
894ee55982 Migrate "visualizations" from grid-styled (#20215) 2022-02-04 16:55:06 +03:00
Alexander Lesnenko
1b0ad37919 fix deselecting columns hides custom fields (#20239) 2022-02-04 13:33:29 +00:00
Anton Kulyk
ed8e5907fa Fix Browse Data section items padding (#20224)
* Fix EntityItem padding

* Remove margin
2022-02-04 11:22:37 +02:00
Anton Kulyk
3bc379fa66 Fix timestamp color (#20225) 2022-02-04 10:39:00 +02:00
Nemanja Glumac
d748924066 Repro #20229: Custom columns not appearing in result set when selecting subset of fields (#20242) 2022-02-04 01:02:24 +01:00
Nemanja Glumac
e5ac259d6b Simplify time-series binning e2e test (#20237)
* Limit Orders table to 50 rows

* Export time options into a separate file

* Apply the same principle to longitude options
2022-02-04 00:08:55 +01:00
Gustavo Saiani
b3cdffa3e9 Update copy (#20123) 2022-02-03 19:45:15 -03:00
Cam Saul
9e327469b6 Fix ambiguous run-query-for-dashcard endpoints (#20139)
* Rework QP.dashboard to expect dashcard-id

* Update /api/dashboard endpoints

* Rework public endpoints for running queries for Dashcards

* Tweak parameter order for Dashboard endpoints for consistency

* Pulse should pass Dashcard ID

* Embed should pass Dashcard ID

* Unskip cypress test

* Update API documentation

* Update endpoints and pass dashcardId to endpoint fns

* Update cypress tests that reference previous endpoint

* Update placement of pivot in endpoint

* Update another endpoint + more e2e fixes

* update QB to hold onto dashcardId like it does with dashboardId

* Address PR feedback

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2022-02-03 13:29:34 -08:00
Noah Moss
f6a9f3fcd0 Update filename of sample DB (#20194) 2022-02-03 15:55:38 -05:00
Noah Moss
b44f1530b9 Fix pin map lat/lon column selection when query uses :breakout (#20227) 2022-02-03 15:05:38 -05:00
Cam Saul
cf247b6865 Bump backend dependencies (Feb 2022) (#19827)
* Bump backend dependencies (Jan 2022)

* Revert java-time version upgrade for now until https://github.com/dm3/clojure.java-time/issues/77 is fixed

* Add license overrides

* Bump a few more deps (again). Revert Google/BigQuery and Vertica version bumps

* Revert MariaDB and Redshift version changes
2022-02-03 10:57:44 -08:00
Alexander Polyankin
318529a4c5 Migrate parameters (#20211) 2022-02-03 21:08:50 +03:00
Alexander Polyankin
b48aa5f393 Migrate "nav" from grid-styled (#20210) 2022-02-03 21:08:39 +03:00
Alexander Polyankin
c52c6b9ef3 Migrate "home" from grid-styled (#20209) 2022-02-03 21:08:25 +03:00
Gustavo Saiani
3deafadeae Update style for code in dashboard dark mode (#20172) 2022-02-03 14:48:58 -03:00
Nemanja Glumac
d823f10a65 Repro #20043: Don't show pins or helper on view-only collections (#20217)
* Add repro for #20043

* Reinforce some of the existing tests to reduce flakiness
2022-02-03 18:36:15 +01:00
dpsutton
cbe7475eda When recording activity, indicate if dataset (#20202)
Right now, datasets are all cards. In the future this could change so
record the original model of the dataset as a card. In the future, maybe
we care about the underlying model and this allows us to at least query
and distinguish
2022-02-03 11:32:03 -06:00
Alexander Polyankin
3330b834a9 Migrate pulse from grid-styled (#20213) 2022-02-03 20:25:11 +03:00
Michiel Borkent
92e3b2fe16 Improve linting when third party libs have been linted (#20212)
* Turn defendpoint config macro into analyze-call hook for better linting

* Simplify hook

* Remove previous macro config

* Fix all errors concerning third party libs

* revert whitespace change:
2022-02-03 08:23:09 -08:00
Noah Moss
a2f6076856 Fix display of horizontal lines in dashboard text cards (#20177) 2022-02-03 09:37:30 -05:00
Nemanja Glumac
660a534d29 Repro #20044: "Explore results" shown for no-data users (#20197) 2022-02-03 15:17:26 +01:00
Anton Kulyk
a1c555553b Fix native model editor initial height (#20056)
* Extract native editor height utils into their own file

* Compute initial height for native model query editor

* Fix hook
2022-02-03 12:27:23 +02:00
Anton Kulyk
5a2aa72d6e Fix URL hash appended to model URLs (#20183)
* Enable repro

* Assert query hash after saving query changes

* Fix query hash appears on clean model
2022-02-03 12:26:50 +02:00
Nemanja Glumac
67ccfa09b1 Add repro for #20018 (#20198) 2022-02-03 11:23:21 +01:00
Alexander Polyankin
fbedfb9d2f Migrate from grid-styled in new-query (#20169) 2022-02-03 13:09:05 +03:00
Alexander Polyankin
42b628b093 Migrate "containers" from grid-styled (#20192) 2022-02-03 13:08:43 +03:00
Alexander Polyankin
f8b9105dd8 Migrate "components" from grid-styled (#20184) 2022-02-03 13:08:32 +03:00
Alexander Polyankin
4f428c5db6 Migrate from grid-styled in collections (#20178) 2022-02-03 13:08:20 +03:00
Alexander Polyankin
9322212f7d Migrate from grid-styled in browse (#20173) 2022-02-03 13:08:06 +03:00
Alexander Polyankin
72e1c8f66d Migrate from grid-styled in search (#20171) 2022-02-03 13:07:51 +03:00
Alexander Polyankin
1a93af0aac Migrate "dashboard" from grid-styled (#20193) 2022-02-03 13:07:33 +03:00
Ariya Hidayat
e7c5dd7f80 Use shareable, local actions to avoid workflow repetitions (#20187) 2022-02-02 21:13:29 -08:00
Ariya Hidayat
5196d0bf76 Circle CI: Build with Java 8 (#20156) 2022-02-02 13:08:40 -08:00
Ariya Hidayat
3b3c37cf1f Maps E2E test: ensure that the map data is received (#20195) 2022-02-02 13:07:40 -08:00
Cam Saul
b302a35b96 43 qp middleware overhaul part 6: convert post-processing middleware to new pattern (#20096) 2022-02-02 12:38:38 -08:00
Anton Kulyk
12786c9730 Fix no-data user can't open a model (#20161) 2022-02-02 20:11:31 +02:00
Nemanja Glumac
db9c5d425c Simplify models query e2e tests (#20175)
* Remove superfluous `beforeEach`

* Simplify `locks display to table` test

Cuts the test running time in half. It goes from 10s to 4-5s.

* Simplify `allows to edit GUI model query` test

Cuts the test running time in half. It goes from ~16s to ~8s.

* Group GUI models related tests into a separate `describe` block

* Simplify `allows to edit native model query` test

Cuts the test running time almost in half. It goes from ~12s to ~7s.

* Group native models related tests into a separate `describe` block
2022-02-02 18:21:45 +01:00
Nemanja Glumac
14dc53cade Handle NULL value for integer fingerprints (#20003)
* Handle NULL value for integer fingerprints

Fixes #19976.

* conditionally show some or none of component depending on if numbers are present in fingerprint

* Make jsdoc return type accurate

* add unit tests for this scenario

* rmv unused import

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2022-02-02 09:04:06 -08:00
Nemanja Glumac
f4d57e73d2 Add repro for #19737 [ci skip] (#20137) 2022-02-02 09:01:28 -08:00
Nemanja Glumac
c92f5ad366 Add repro for #20045 [ci skip] (#20164) 2022-02-02 09:01:13 -08:00
Noah Moss
297f2da576 Crop pngs to their content width after rendering to remove extra whitespace (#20032) 2022-02-02 11:48:29 -05:00
Dalton
d0bb85246d let user add missing options to ListField widget (#20136)
* let user add missing options to ListField widget

* let any value that is not an option be added

* remove test regarding search input
2022-02-02 07:40:47 -08:00
Dalton
af54d2ea45 increase font weight on selected AM/PM in filter (#20029) 2022-02-02 07:40:27 -08:00
Anton Kulyk
bcb7771403 Fix data selector crashes and closes after hiding a table (#20166)
* Reproduce #19742

* Filter out undefined tables

* Add a note about repro test
2022-02-02 17:35:14 +02:00
Noah Moss
929b7977af Remove trailing slash from /api/tiles call on frontend (#20091) 2022-02-02 10:23:01 -05:00
Jeff Evans
93cb66672d Fix "source cannot be null" error in MongoDB (#20145)
Break out separate util fn to return the given `authdb` or the canonical default ("admin")

Add invocation to new util fn from the `mcred/create` call
2022-02-02 09:00:49 -06:00
Alexander Polyankin
32b508213c Migrate from grid-styled in sharing (#20168) 2022-02-02 17:07:37 +03:00
Alexander Polyankin
293a3253e0 Migrate from grid-styled in account (#20167) 2022-02-02 17:00:10 +03:00
Alexander Polyankin
343abdb10f Add missing React keys (#20165) 2022-02-02 16:28:27 +03:00
Alexander Polyankin
00016a5145 Add homepage keyboard navigation (#20129) 2022-02-02 15:25:46 +03:00
Anton Kulyk
dd1f61b14d Fix native query editor resizing gets stuck (#20160)
* Fix can't resize native query editor

* Fix DataSelector's onClose prop handling
2022-02-02 13:54:05 +02:00
Alexander Polyankin
e3a48c4723 Make FileInput assessible (#20107) 2022-02-02 13:54:57 +03:00
Cam Saul
11f21375b5 Support MB_DB_USER and/or MB_DB_PASS in combination with MB_DB_CONNECTION_URI (#20135) 2022-02-01 20:45:24 -08:00
Cam Saul
00de179b55 43 QP Middleware Overhaul Part 5: new qp/compile fn and remove some s… (#20095) 2022-02-01 20:15:48 -08:00
Cam Saul
cdd94a6ef9 Metabase QP middleware overhaul part 4: use new-style preprocessing middleware directly (#19938) 2022-02-01 19:18:30 -08:00
Nemanja Glumac
e833d10388 Add repro for #20042 [ci skip] (#20149) 2022-02-01 19:15:24 -08:00
Cam Saul
35a1775829 Metabase 43 QP middleware overhaul part 3: convert all pre-processing middleware to the new pattern (#19937)
* Metabase 43 QP middleware overhaul (part 1)

* Make linter happy

* Test fix

* Fix merge

* Remove perms key after normalization

* Remove unused namespace

* Metabase 43 QP middleware overhaul part 2

* Sort namespaces

* Convert all pre-processing middleware to the new pattern

* Sort namespace

* Minor code cleanup

* Address PR feedback

* Sort namespaces

* Split QP middleware into different groups

* Sort namespaces

* Fix the helper `question` function

* Wait for the card query to load before typing

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2022-02-01 18:30:40 -08:00
Cam Saul
3527d527e1 Fix regression in supporting user:port@host app db connection strings (#20131)
* Fix regression breaking support for user:password@host Postgres connection strings

* Actually we need to handle either Postgres OR MySQL

* Fix the helper `question` function

* Wait for the card query to load before typing

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2022-02-01 17:49:03 -08:00
Nemanja Glumac
da58385e42 Repro #19776: New data picker shows blank after archiving a model (#20138) 2022-02-02 02:26:36 +01:00
Cam Saul
d3d681cb0b Disable remapping when syncing Field values. Handle human readable values in GET /api/field/:id/values (#19901)
* Disable remapping when syncing Field values. Handle human readable values in GET /api/field/:id/values

* Don't require `:has_field_values` to be list to actually return anything.

* Make sure GET /api/field/:id/values returns :field_id or it breaks the FE

* Fix add-dimension-projections middleware not respecting disable-remaps? key
2022-02-01 16:58:28 -08:00
Nemanja Glumac
abd8b475ee Fix models e2e typing flake pt2 (#20146)
* Fix the helper `question` function

* Wait for the card query to load before typing
2022-02-02 01:47:44 +01:00
Howon Lee
6e3cc188f1 BE for stacked area viz for #20004 (#18676) (#20013)
More stuff in #18676. Supposed to be the BE for #20004 Just continuing static viz work. Stacked graphs only have a simple viz-settings flag turned on so making sure that gets to FE bit.

No implementation of normalized stacks.
2022-02-01 16:36:19 -08:00
Ariya Hidayat
b9d69a3cec CI with GitHub Actions: focus on PR trigger (#20128)
To avoid double runs of various checks (linters, tests, etc) on feature
branch, we mainly run on pull_request trigger, i.e. the checks are
carried out once that feature branch appears in a PR, and not before.

We do however still run on push trigger for the important branches
(master, release-*).
2022-02-01 15:23:45 -08:00
Alexander Lesnenko
28d2927404 fix renovate config (#20134) 2022-02-01 22:31:43 +00:00
dpsutton
dd300077a8 Unused bindings part1 (#19995)
* Unused bindings cleanup

`clj-kondo --lint src:shared/src > lint` and then just work my way
through it. Note that there are warnings about deprecations that we will
need to get rid of as well. Most likely by turning off that warning
until we are ready to tackle the project.

* More unused and a sort ns

* Removing unused svg helpers that eastwood is complaining about

* Restore accidentally deleted `begin!` impl for xlsx

* clean ns

* clean ns

* Last few unused bindings

* kondo checks for empty docstrings

* Little more cleanup
2022-02-01 16:18:20 -06:00
Alexander Lesnenko
3ac3fed632 include type defs to tsc-files (#20126) 2022-02-01 19:59:44 +00:00
Alexander Polyankin
37f628bb5d Fix creation type (#20119) 2022-02-01 22:13:56 +03:00
Maz Ameli
6ffe7de573 0.42 translations: adds Indonesian, cleans up some strings, and updates our i18n build script (#20041)
* update translation build script to catch ts and tsx files

* add blank file for indonesian

* makes password resetting less awesome

* get rid of 'this item' text

* add updated translations

* Adjust E2E tests expectation of the strings (after the modification)

Co-authored-by: Ariya Hidayat <ariya@metabase.com>
2022-02-01 11:09:32 -08:00
frannietrempe
1107e0a3ba assorted UI screenshots and text updates for 42 (#20117) 2022-02-01 13:22:43 -05:00
Alexander Polyankin
dafdc6f993 Fix passing treat-before-posting on the FE (#20111) 2022-02-01 20:18:40 +03:00
Jeff Bruemmer
31e1444cf7 update new slack setup in docs (#20112) 2022-02-01 12:17:26 -05:00
Alexander Lesnenko
fbb59b82bb fix crowded ordinal ticks (#20006)
* handle crowded ordinal x ticks

* fix default x tick label offset

* fix weird horizontal padding on ordinal charts
2022-02-01 17:04:11 +00:00
frannietrempe
a30777cc49 docs - fix docker dev branch instructions (#20106) 2022-02-01 12:00:47 -05:00
Alexander Polyankin
92e721080f Simplify Slack setup (#20062) 2022-02-01 19:02:40 +03:00
Dalton
ddd1861721 Remove the empty pinned section banner (#20074)
* remove the empty pinned section banner

* make drop zone show up without any items

* Skip associated unit test
2022-02-01 07:40:08 -08:00
Alexander Lesnenko
cb8dfc63d7 fix datamodel borders (#20103) 2022-02-01 14:17:50 +00:00
Anton Kulyk
8819df06d3 Fix missing item descriptions in search results (#20100) 2022-02-01 15:56:06 +02:00
Alexander Polyankin
ef9a0acc08 Make custom setup buttons accessible (#20053) 2022-02-01 15:23:29 +03:00
Alexander Lesnenko
dbb1973f08 Run ESLint for staged files on pre-commit (#20040)
* upgrade packages, setup lint-staged

* add tsc-files
2022-02-01 12:03:28 +00:00
Anton Kulyk
692e7f44da Enable quick filter drills on aggregated, custom columns and native query results (#20014)
* Update QuickFilterDrill tests

* Extend QuickFilterDrill tests

* Extract `reference` method from `Field`

* Extend Column type

* Add mock column factory

* Extend QuickFilterDrill unit tests

* Extract `getFKFilter` function

* Allow drills on fields without ID

* Simplify condition for filters lookup

* Handle aggregate and expression fields

* Fix filter drills UI

* Add tests for drill availability checks

* Simplify drill availability check

* Remove not used import

* Fix test
2022-02-01 11:26:18 +02:00
Cam Saul
b8865f7622 Don't parse MB_DB_CONNECTION_URI; use javax.sql.DataSource everywhere for app DB connection sources (#19970)
* Use javax.sql.DataSource everywhere for app DB connection sources

* Sort namespaces

* Un-remove Kondo warning

* Minor tweaks to support 'postgres:' ...

* Remove ConnectionDataSource

* Add warning about PG without sslmode back

* PR feedback

* Sort namespaces

* Remove top-level calls to trs (not allowed because app DB isn't initialized yet anyway)

* Test fix 🔧 (MySQL)
2022-02-01 00:32:18 -08:00
Cam Saul
034345550f Split QP middleware into different groups (#19935) 2022-02-01 00:23:28 -08:00
Cam Saul
5d5b33a16b MBQL :expressions should use strings for keys (#19960)
* MBQL :expressions should use strings for keys

* Make some more tests ^:parallel

* Update dox

* Test fix

* Sort namespaces
2022-01-31 21:54:48 -08:00
Cam Saul
6d70af888b Metabase 43 QP middleware overhaul part 1: split pre+post middleware into separate fns (#19931) 2022-01-31 21:45:30 -08:00
Nemanja Glumac
f326f53aa6 Fix typing flake in models query editor test (#20086) 2022-02-01 02:02:28 +01:00
Ariya Hidayat
562b424aaa Joins E2E tests: ensure that the schema is completely loaded (#20067) 2022-01-31 16:58:14 -08:00
Ariya Hidayat
2e894d6f47 Models E2E tests: ensure that the Run button is visible first (#20059) 2022-01-31 16:58:03 -08:00
frannietrempe
f4b6b872c8 docs - updates to reflect new db advanced settings UI (#20076) 2022-01-31 16:18:49 -08:00
Noah Moss
f36b9efa8f Override IP address in Snowplow logging (#20082) 2022-01-31 18:50:53 -05:00
Howon Lee
d31fac77cd Static viz funnel fix (more #18676) (#19983)
Still pursuant to #18676

1. Funnel was previously not doing lato font for the bold bit because visx's text doesn't take weights, it takes styles
2. Columns can be nontrivial with respect to funnels, which was an oversight
3. For some reason the first try for fixing 2 also impinged upon values being strings for funnels, which breaks things at SVG level
4. And let's just shove in a nit for the display of trends if the previous value and current value are the same
2022-01-31 15:32:47 -08:00
Dalton
466f6a4de7 Remove most of the info popovers (#20070)
* Remove DataSelector info popovers

* Remove DimensionList info popover

* Remove expression editor suggestion list info popover

* Remove FieldPicker info popover

* Remove DimensionListItem info popover

* Remove info popover from data selector search results

* remove TableBrowser info popover

* Remove an e2e test
2022-01-31 13:45:41 -08:00
Alexander Lesnenko
ee88eaee4b fix license infinite loop (#20075) 2022-01-31 20:57:51 +00:00
Alexander Lesnenko
d0e1ccd88d fix select button look (#20077) 2022-01-31 20:57:39 +00:00
Muhammad Redho Ayassa
0e5ac72996 Fix empty result with suffix "%" shows "null%" in Gauge visualization (#19558)
* convert null value to 0 for gauge viz

* set null segment range to 0
2022-01-31 11:44:21 -08:00
Dalton
81f2bd1fc2 Hide explore results button for no-data users (#20065) 2022-01-31 10:44:51 -08:00
Howon Lee
385fa88f4f Card copy trs fix (#20063)
CI was broken inasmuch as it wasn't running, so master was broken without us knowing it. Thankfully, to the best of our knowledge, it was a couple of nits. Fixes master.

Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2022-01-31 09:35:42 -08:00
Dalton
65e72dc549 Add drag and drop reordering of pinned items (#19966)
* onDrop unneeded

* basic impl of reordering pinned items

* split cards and dashboards again

* Improve pin drop target styling

* Fix card drop target weirdness

* brand-light border --> brand

* pull out separate styled drop target component

* replace style prop usage

* reduce the z-index

* Remove prop that triggers drill functionality

* Fix clobbering of pinned list on update

* Fix card queries on every rerender

* Add pin drop zone & split drop target components

* lint fix

* fix & add a few tests

* update pin drop zone styling to match sorting
2022-01-31 09:15:15 -08:00
Alexander Polyankin
d7223dc05d Fix focus color (#20054) 2022-01-31 19:05:54 +03:00
Jeff Evans
a2f4563cab Fix NullPointerException in Postgres when using client SSL properties (#20034)
Only attempt to read values that were actually set on the client side

Add test to confirm specific combination from reported issue works
2022-01-31 10:04:55 -06:00
Ariya Hidayat
44a734d42e CI: setup-node@v2 also does yarn caching (#20035)
https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-dependencies
2022-01-31 07:32:19 -08:00
dpsutton
1b9270fd74 Metadata lifecycle improvements master (#19899)
* Improve lifecycle of metadata

Previously we have assumed that if valid metadata is passed into the
card create and udpate, that that is valid metadata for the query. There
are a few scenarios where this can fail, but they all boil down to
editing the query after running it. Examples:

- when creating a query, come up with a query, visualize, realize you
wanted to not select all columns, edit to not select those, possibly
select a few extra, and then save. The saved metadata might only have
the columns from when you ran the query and not after you saved it.
- edit an existing query and save without rerunning. Again, adding and
removing some columns.

How it affects:
- if you remove columns, the preserved metadata can cause us to attempt
to select columns that are no longer in that question, leading to errors
for nested queries
- if you add columns, the query builder won't show the new columns until
that information is populated in the metadata by running the query.

Lifecycle now:
- should be encapsulated in `api.card/result-metadata-async`. But we
only allow metadata to remain if is is valid metadata and the query has
not been edited. If the query has been edited (and new queries always
satisfy this since the previous query will be nil) we rerun the query to
get the metadata. No more drift. However, when dealing with datasets we
will attempt to blend the existing metadata into the newly computed
metadata so that metadata edits can persevere.

Other changes:

- removed an extra indirection in the card api that made it harder to
reason about when to recompute metadata
- moved the `combine-metadata` function into a util namespace and gave
some more generic parameter names
- deleted two tests that are no longer relevant after removing the
checksum on metadata. One had to do with how we hash floats vs ints
which is no longer relevant since we aren't hashing at all (RIP
checksum) and one checked that we accepted "valid" checksum-ed
metadata.
- new test that updating a card will update its metadata by rerunning
the query
- when validating the checksum, do not call s/validate since this WILL
THROW. Instead check `(nil? (s/check ...))`.

* Normalize query before comparing for changes

When comparing db vs api-sent query, need to normalize otherwise they
will always be different and our optimization will never kick in

* Fix ns

* Cleanup after ourselves

* Move `combine-metadata` util functions to a better namespace

* Allow for no query in api/card/:id patch

Cypress tests would do a

```javascript
  describe("simple mode", () => {
    beforeEach(() => {
      cy.request("PUT", "/api/card/1", {
        name: "Orders Model",
        dataset: true,
      });
    });
```

The metadata testing stuff would always use the query from the PUT to
check whether to dump or retain the metadata. In these instances, it
would dump the metadata and then i guess ask the qp for the metadata for
a nil query. Similar scenario if anyone uses the API to update
descriptions, etc.

The method is PUT not PATCH, but in the saving function we have

```clojure
(u/select-keys-when
 card-updates
 :present #{:collection_id :collection_position :description :cache_ttl :dataset}
 :non-nil #{:dataset_query :display :name :visualization_settings
            :archived :enable_embedding :embedding_params
            :result_metadata})
```

So we kinda have a PATCH anyways.

* Normalize metadata before blending

* Ensure api blends metadata correctly

When blending the metadata, need to update the field_ref to keyword the
original. Otherwise we are attempting to match up the field with ref
["field" "subtotal"] against [:field "subtotal"] and they don't match.

* Normalize metadata from api correctly

if you just call normalize/normalize it doesn't know not to change
`:field_ref` -> `:field-ref` so it gets out of whack. Need to pass it
the function appropriate for that level.

Also add a test that you can update _just_ the metadata. This actually
already worked for a subtle reason, and that is possibly buggy. The
reasoning is that the result_metadata is clobbered conditionally now
instead of unconditionally. If the async metadata stuff returns nil it
won't clobber and then whatever was sent over the wire goes in.

* Ensure previous metadata is there

When updating the query of a dataset, handle the case where just the
query is sent, and not the whole card. If the client didn't send the
previous metadata, we did not look it up in the database

* Card api always uses metadata from `result-metadata-async`

Originally this did

    (assoc card-data :result_metadata (a/<! result-metadata-chan))

But I changed that so it only optionally did so when that channel had
information. The problem with this is that if there was :result_metadata
on the original request but the channel returned nil for some reason,
whatever was in the request was going in the db. This includes invalid
metadata, non-json strings, what ever. Obviously bad.

But we need to handle PATCHs where clients don't send metadata or they
_ONLY_ send metadata and no query, etc. So this always uses the results
of `result-metadata-async` so it can go through that logic and we always
clobber.

And remember that if we only update the result_metadata when it is
non-nil (`update-card-async!`). The end result is that switching from a
PATCH model where you expect the full object to a PUT where things can
be optional has lots of footguns. Some examples:
- only updating the query
- updating the query along with edits to the metadata on a card (throw
the metadata away)
- updating the query along with edits on a dataset (save the metadata
but blend it into the fresh computation of the query's metadata)
- updating the query but not sending along the metadata. Need to grab
from the db and blend in.
- Sending invalid metadata, changing the description. We want to toss
away the metadata but save the description.
2022-01-31 09:23:11 -06:00
Alexander Lesnenko
ce4d4e6760 support stacked area static viz series (#20004)
* support stacked area static viz series

* fix x-ticks overflow

* fix types

* add specs, fix area static charts
2022-01-31 15:12:01 +00:00
Ariya Hidayat
bcec502385 Time-series chart E2E tests: ensure that the chart is ready first (#19969) 2022-01-31 06:25:47 -08:00
Alexander Lesnenko
f4388814df run eslint on typescript files (#20021)
* run eslint on typescript files

* fix errors

* bump timeout
2022-01-31 10:28:46 +00:00
Maz Ameli
0ebd2d2592 Change model icon from waffle to building block (#19852)
* change model icon from waffle to building block

* update models education illustration
2022-01-28 15:12:59 -08:00
Alexander Polyankin
b62009ced5 Hide custom GeoJson settings when they are set by the env var (#19621) 2022-01-29 01:50:59 +03:00
Alexander Polyankin
1bf4ae779a Fix rerender when locale changes (#20015) 2022-01-29 01:37:06 +03:00
Alexander Polyankin
bc5ee7362a Fix database created at check (#20031) 2022-01-29 00:43:57 +03:00
frannietrempe
944d914cc3 docs - instructions for running development branch (#19926)
* docs - running development branch instructions

* reorganized content into existing pages

* Jeff edits

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

* remove gh command, minor edits

* reorganizing step numbers

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2022-01-28 15:06:46 -05:00
john-metabase
5918c954aa Updates stats job to run at a random time of day (#19828)
Thanks for the review/approvals.
2022-01-28 12:48:57 -05:00
frannietrempe
ac60949933 docs - collections changes screenshots and UI text (#19958) 2022-01-28 11:02:10 -05:00
Noah Moss
7deffeefa2 Fix clj-kondo warning introduced in #19963 (#20007) 2022-01-28 09:22:36 -05:00
Nemanja Glumac
f78231cf7a PoC: Restore from a custom snapshot in the before hook (#20001) 2022-01-28 11:40:11 +01:00
Howon Lee
002b8b995e Copy API endpoint (BE bit of #15255) (#19940)
Adds an endpoint to the cards which are basically materially like dashboard/:id/copy, only it's for card/:id/copy - POST to it, get a copy of that entity.
2022-01-28 02:19:44 -08:00
Alexander Polyankin
29fdddd15d Make engine widget accessible (#19988) 2022-01-28 13:02:07 +03:00
Alexander Polyankin
b99682b098 Postpone showing syncing modal on the home page (for 0.42) (#19925) 2022-01-28 13:01:46 +03:00
Alexander Kiselev
f09b4b1dc5 Visual Design Cleanup for Headers - Filters and header buttons (#19912)
Move filters over into a separate bar below the header and move the filter button over to the right side of the header
2022-01-27 23:49:12 -08:00
Maz Ameli
4585caf3b4 More collection overview styling (#19972)
* redo tweaks from 19853 that got clobbered in the rebase

* smaller text size for collections list items

* make unpinned items list more compact
2022-01-27 16:21:56 -08:00
Bryan Maass
0526d88f99 Check user exists for setup redirect (#19846)
* Add has-user-setup setting

- iff no user is setup aka has-user-setup == false, then redirect to /setup
- when set from the env variable the setup-token is completely
  immutable, so can remove clear-token!

* make /api/setup only setup accounts when not has-user-setup

- react router changes to respect 'has-user-setup' setting

- include docstring for print-setup-url

* allow tests to setup multiple users via POST /api/setup

* remove unused function hasSetupToken

* Adds a test to enforce a single creation only

- we now throw an ex-info with status-code 403 when has-user-setup and
  /api/setup route is hit (with error message mentioning the route)
- more code review responses

- fixup test to not delete users, (or set locale to spanish...)

* addressing code review concerns

- *disallow... -> *allow... for the dynamic var name
- has-user-settings test: do not assume the test db has users in it
- update test
2022-01-27 14:30:34 -06:00
Gustavo Saiani
4ce1569413 Dashboard Subscription overview: display useful piece of text, instead of null (#19992) 2022-01-27 16:12:35 -03:00
Alexander Polyankin
777667ca50 Fix activation snowplow events on FE (#19986) 2022-01-27 21:46:01 +03:00
Alexander Polyankin
3e73e5d70c Activation fixes for 0.42 (#19947) 2022-01-27 20:55:22 +03:00
Anton Kulyk
a08fc3ffe4 Fix model toast messages say "question" (#19980) 2022-01-27 19:50:34 +02:00
Anton Kulyk
d8bf9942c6 Revision history fixes (#19985)
* Make `getRevisionEvents` accept params object

* Use "You" for current user's revision events

* Fix "moved to" revision display

* Add extra bottom padding to events timeline

* Extract conditions into variables
2022-01-27 19:50:06 +02:00
Noah Moss
60ecd7d9f8 Ensure that XLSX temp files are cleared if output stream closes before export completes (#19963) 2022-01-27 11:42:34 -05:00
Dalton
ac8fcdeeb1 fix cut-off info popover text in Safari (#19887)
* fix cut-off text in Safari

* Actually fix cut-off text in Safari
2022-01-27 08:28:43 -08:00
Ariya Hidayat
c720293421 Binning E2E tests: ensure that the query result is available (#19967) 2022-01-27 07:07:51 -08:00
Alexander Lesnenko
17c5551dd3 always show permission help (#19957)
* always show permission help

* fix permission page layout
2022-01-27 13:45:58 +00:00
Anton Kulyk
f93c156e4a Show model metadata changes revisions (#19913)
* Remove saving changes from `setColumnType` helper

* Use single POST request to create a model in cypress

* Add E2E test

* Display metadata editing revision events

* Change message
2022-01-27 13:51:22 +02:00
Anton Kulyk
829a608bb3 Fix x-raying a nested question (#19922)
* Unksip x-ray test

* Handle nullish dashboard parameters
2022-01-27 11:33:46 +02:00
Anton Kulyk
7fa4675b8e Fix reordering model columns (#19952)
* Add `dataset` to Card type

* Fix "source-table" type

* Don't use original model query in ad-hoc mode

* Handle model using `/dataset` endpoint in Cypress

* Rerun query when entering model editor

* Make it possible to only close the details sidebar

* Close details sidebar when entering model ad-hoc mode

* Move `isAdHocModelQuestion` to data-modeling utils

* Handle TableInteracting column width reset event

* Fix old isAdHoc util usage
2022-01-27 11:31:18 +02:00
Gustavo Saiani
efc6173f04 Remove delete db button from db list (#19951) 2022-01-26 22:10:03 -03:00
adam-james
c8c90a783d Add question link to the 'stopped working' email template. (#19815)
* Add question link to the 'stopped working' email template.

* Adjusted copy from alert email to correctly indicate how to unsubscribe
2022-01-26 15:25:35 -08:00
Jeff Evans
9fb8159595 Trim whitespace around commas in schema filtering code (#19949)
* Trim whitespace around commas in schema filtering code

Change impl of `schema-pattern->re-pattern` so that strings are trimmed before being joined on `|`

Add test to confirm
2022-01-26 17:07:41 -06:00
Noah Moss
2911c4b95c Fix a couple of edge cases in column ordering for exports (#19882)
Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2022-01-26 17:13:14 -05:00
Alexander Lesnenko
75d2371842 License & billing page fixes (#19878)
* fix license and billing page

* fix imports cycle

* specs

* use no-upsell flag

* fix condition
2022-01-26 17:08:19 +00:00
Ariya Hidayat
68b0a87884 Release script: no need for git pull (#19835) 2022-01-26 09:07:39 -08:00
Ariya Hidayat
1cc0b379da Custom expression suggestions: honor database features (#19928) 2022-01-26 08:57:58 -08:00
Jeff Evans
802cc236a8 Support overriding ROWCOUNT for SQL Server (#19267)
* Support overriding ROWCOUNT for SQL Server

Add new "ROWCOUNT Override" connection property for `:sqlserver`, which will provide a DB-level mechanism to override the `ROWCOUNT` session level setting as needed for specific DBs

Change `max-results-bare-rows` from a hardcoded constant to a setting definition instead, which permits a DB level override, and move the former constant default to a new def instead (`default-max-results-bare-rows`)

For `:sqlserver`, set the DB-level setting override (if the connection property is set), via the `driver/normalize-db-details` impl

Add test to confirm the original scenario from #9940 works using this new override (set to `0`)

Move common computation function of overall row limit to the `metabase.query-processor.middleware.limit` namespace, and invoke it from execute now, called `determine-query-max-rows`

Add new clause to the `determine-query-max-rows` function that preferentially takes the value from `row-limit-override` (if defined)
2022-01-26 10:36:06 -06:00
Alexander Lesnenko
954b1c1143 allow enabling eslint (#19934)
* allow disabling eslint

* rename env var

* actually disable eslint by default

* update docs without autoformatting the document
2022-01-26 16:27:16 +00:00
Alexander Polyankin
ae70d15829 Sanitize tracking urls (#19907) 2022-01-26 18:29:00 +03:00
Anton Kulyk
de54fdd15f Add visual tests for model query and metadata editors (#19920)
* Fix metadata editor sidebar formatting UI

* Fix styling

* Add visual tests for model editors

* Add extra awaits
2022-01-26 17:22:10 +02:00
Gustavo Saiani
7d161bae49 Improve error message layout (#19795) 2022-01-26 12:01:30 -03:00
Jeff Bruemmer
e97b5b84a0 docs - update bigquery docs (#19919) 2022-01-26 09:07:04 -05:00
Alexander Lesnenko
199755f8c3 fix trend line on charts without all series visible (#19927) 2022-01-26 12:40:52 +00:00
Alexander Lesnenko
8ff19dc87e preserve colums order when a query changes (#19933) 2022-01-26 12:40:24 +00:00
Ariya Hidayat
e68f2592db Custom expression editor: explicit plain text mode (#19932) 2022-01-26 04:14:18 -08:00
Howon Lee
1f6ff4eb3e Finishing nits for waterfall static viz (#19868)
Waterfall can now have pretty colors and goals now. Y-axis positions reverted back to the way Dan liked less but is more congruent to the dynamic visualizations.
2022-01-26 02:50:35 -08:00
Nemanja Glumac
1b6c1b16a3 Unskip repro for #14178 (#19890) 2022-01-26 11:00:28 +01:00
Jeff Evans
56e0ad1556 Add program_name connectionAttribute for MySQL (#18707)
* Add program_name connectionAttribute for MySQL

Set the program_name connection attribute when creating a MySQL connection, to the same value that we do for other drivers - `config/mb-version-and-process-identifier`

Updating tests

Add test for mysql to ensure `:connectionAttributes` aren't emitted when they are given in `additional-options`

Set `:connectionAttributes` directly in the `jdbc-spec` map (which in turn becomes a property for the JDBC connection) instead of putting in `additional-options`

Fixing some bugs in `additional-options->map`

Relevant links:

* https://dev.mysql.com/doc/refman/8.0/en/performance-schema-connection-attribute-tables.html#performance-schema-connection-attributes-available
* https://mariadb.com/kb/en/performance-schema-session_connect_attrs-table/
* http://mysqlblog.fivefarmers.com/2013/03/26/connection-attributes-in-mysql-5-6/
2022-01-25 17:54:09 -06:00
Jeff Evans
b6d542f82b Apply schema inclusion/exclusion filtering to sql-jdbc drivers (#19651)
* Apply schema inclusion/exclusion filtering to sql-jdbc drivers

Update `sql-jdbc` namespaces to handle schema inclusion/exclusion patterns when filtering schemas

Add new generic schema inclusion/exclusion test for sql-jdbc drivers that define the property

Update Snowflake and Redshift driver manifests to include schema filtering property

Create `db-details->schema-filter-patterns` util fn to turn DB details into the inclusion/exclusion patterns

Move schema inclusion/exclusion filtering code to new namespace (since it's not strictly used by `:sql-jdbc` derived drivers)

Move existing tests accordingly

Add schema inclusion/exclusion check to the new `filtered-syncable-schemas` multimethod (and updating docstring)

Change `:redshift` impl of `filtered-syncable-schemas` to call the `:sql-jdbc` version instead

Use new multimethod instead for `filtered-syncable-schemas`, and have default impl of `syncable-schemas` call that

Mark `syncable-schemas` as deprecated and include notes on the new method (and update driver markdown file accordingly)
2022-01-25 17:52:39 -06:00
Nemanja Glumac
9c8e38ce14 Unskip repro for #17512 (#19891) 2022-01-25 21:22:23 +01:00
Dalton
afc53f401c Collections changes feature branch (#19848)
* Add PinnedItemCard component (#19765)

* convert Card component to typescript

* add open state class to EntityMenu

* Add PinnedItemCard component

* prevent the bubbling of EntityMenu events

* replace class with styled-component stuff

* define a const

* Replace pinned collection items table with pinned overview section (#19787)

* Add PinnedItemOverview component

* Replace the pinned table with overview

* add types to collection utils

* fix pinning + types

* remvoe the old PinnedItemsTable

* fix/remove e2e tests that no longer make sense

* replace 'Datasets' with 'Models'

* Update frontend/src/metabase/collections/components/PinnedItemOverview/PinnedItemOverview.tsx

Co-authored-by: Maz Ameli <maz@metabase.com>

* add unique text for root collection

Co-authored-by: Maz Ameli <maz@metabase.com>

* Collections page UI changes (#19792)

* make a bunch of ui tweaks to collections

* resize Titles for PinnedItemCards

* resize collection description headings

* Add tooltip to pin button

* Fix unit test

* fix e2e tests

* add a default description

* Tbody --> TBody

* Hide long titles & add tooltip to show entire title

Co-authored-by: Maz Ameli <maz@metabase.com>

* Add card visualizations to the pinned section of collections (#19813)

* First pass at card viz in collections

* minor style fixes

* move redux stuff up to CollectionContent

* padding tweaks

* Make the entire card clickable

* add generic error message

* Add propTypes

* a little cleanup

* create ActionMenu component

* Fix pin action fn

* Fix circular dep & storybook story

* actually import the function

* add comment // use EventSandbox

* Add preventDefault prop to avoid breaking things

* Make pinned cards drag-and-droppable into the collections sidebar (#19829)

* first pass at dnd for pinned cards

* use cards instead of viz for performance

* fix type

* Add tests for collection changes (#19851)

* first pass at dnd for pinned cards

* use cards instead of viz for performance

* fix type

* Add tests for collection changes

* fix Button import

* remove async

* Add empty pinned items section banner (#19857)

Fix e2e test

don't show empty states when loading

styling tweaks

Fix test

* datasets --> models

* fix dragging data models

* Make question icons in collections bg-dark

Co-authored-by: Maz Ameli <maz@metabase.com>
2022-01-25 10:39:19 -08:00
Michiel Borkent
a4475dabaa Linting improvements: 0 errors in src + shared/src (#19836)
* Linting improvements: 0 errors in src + shared/src

* satisfy other linter
2022-01-25 10:13:38 -08:00
Cam Saul
a626dad5d9 Add test for #15863 (#19896)
* Add test for #15863

* Remove dead code
2022-01-25 10:10:38 -08:00
Anton Kulyk
e40e295c89 Fix metadata editor sidebar formatting UI (#19916)
* Fix metadata editor sidebar formatting UI

* Fix styling
2022-01-25 19:05:12 +02:00
Noah Moss
ea66ad979e Send snowplow event when user is invited during setup (#19808) 2022-01-25 11:52:50 -05:00
Nemanja Glumac
7a81a9e599 E2e tests housekeeping (#19915)
* Move repro for 12985 to "dashboard-filters" reproductions where it belongs

* Simplify filter tests by visiting question through a function

* Use `intercept` instead of `server/route`

* Extract `trend` visualization test

* Simplify steps for popover hover test

Reduces test time from ~12 to ~5s.

* Move tests over to binning reproductions where they belong

* Rename 6239 repro

* Update repro 4482

- Fix wrong issue references
- DRY code
2022-01-25 17:27:09 +01:00
Anton Kulyk
6250090cb8 Handle failing model queries (#19886)
* Add E2E test

* Fix FE crash when opening the editor

* Hide sidebar for failing queries

* Don't show "tab" hint for failing queries
2022-01-25 17:43:13 +02:00
Anton Kulyk
f3d218ac11 Fix Radio input UI regressions and remove dependency on styled-system (#19917)
* Fix "Admin > People" radio controls

* Fix "Admin > Permissions" tabs

* Fix metadata editor tabs

* Remove `py` from Radio
2022-01-25 17:42:51 +02:00
Ariya Hidayat
833630239d Use GitHub Actions to run shared CLJS tests (#19854) 2022-01-25 06:51:13 -08:00
Alexander Polyankin
12de5f8560 Fix some setup accessibility issues (#19883) 2022-01-25 17:12:30 +03:00
Luis Paolini
912c769628 Switch to Temurin official image (#18923)
* Switch to Temurin official image

This image is a pure musl alpine image
2022-01-25 09:18:27 -03:00
Anton Kulyk
7da70b9e29 Fix metadata table overflow (#19881) 2022-01-25 11:34:40 +02:00
Nemanja Glumac
12d3235657 Enable "Joins" e2e group (#19892) 2022-01-25 00:23:22 +01:00
Luis Paolini
9986a24aff Raising to 15 min timeout on GH actions (#19888)
* Raising to 15 min timeout on GH actions

* Update yaml.yml
2022-01-24 17:51:46 -03:00
Luis Paolini
9d6c7ffd1f Use matrixes to reduce complexity (#19490)
* Use matrixes to reduce complexity

* Cam's suggestions
2022-01-24 17:26:13 -03:00
Anton Kulyk
cb4654a5b1 Fix semantic type picker in model metadata editor (#19877)
* Fix semantic type picker

* Fix styles

* Fix e2e test
2022-01-24 20:08:54 +02:00
Anton Kulyk
a028ddcdb4 Consistent "Verify" button for models (#19800)
* Accept `renderActions` prop on ModerationActions

* Pass verified icon name to render props fn

* Add `reviewBannerClassName` prop

* Render custom verify button for models

* Avoid render prop
2022-01-24 18:58:44 +02:00
Alexander Polyankin
25b2366c2f Mask page urls we track with Snowplow (#19874) 2022-01-24 17:43:46 +03:00
Alexander Polyankin
11fdea21e7 Make Radio accessible (#19840) 2022-01-24 17:14:22 +03:00
Gustavo Saiani
91f564c2f6 Fix typos in translatable strings (#19843) 2022-01-24 11:09:20 -03:00
Alexander Polyankin
7d0e98cca5 Make ExternalLink accessible (#19870) 2022-01-24 16:23:03 +03:00
Nemanja Glumac
fbab510a08 Add models metadata e2e tests (#19788)
* Add models metadata e2e tests

* Simplify test with helper functions

* Extract models-metadata helpers
2022-01-24 13:44:52 +01:00
Anton Kulyk
eb0d69ed75 Handle disabled or not available nested queries for models (#19798)
* Change label for "enable-nested-queries"

* Fix query types compatibility

* Add utility to check if DB supports nested queries

* Accept store initial state for `renderWithProviders`

* Hide model button when nested queries disabled

* Handle nullish database in modeling utils

* Fix var
2022-01-24 10:28:55 +02:00
Anton Kulyk
3da188a52c Add models educational modal to Admin > Data Model (#19832)
* Move DataModelApp to own directory + refactor

* Extract styled components

* Add models education button

* Add images for educational modal

* Add `centeredTitle` prop to `ModalContent`

* Add educational modal to Admin > Data Model

* Fix translation

* "Dataset" > "Model"

* Add link

* update the educational modal illustration

Co-authored-by: Maz Ameli <maz@metabase.com>
2022-01-24 10:28:45 +02:00
Anton Kulyk
780d934ea5 Ensure fields sorting is in sync with viz settings (#19844) 2022-01-24 10:28:30 +02:00
Ariya Hidayat
146d782b4a Eliminate E2E join tests flakiness by ensuring schema loading (#19837) 2022-01-21 17:24:19 -08:00
Jeff Evans
8affd5301e Wrap ex-info message in format (#19698) 2022-01-21 16:40:33 -06:00
Alexander Lesnenko
0a746a2527 Data picker empty state (#19818)
* data-picker-empty-state

* specs
2022-01-21 22:01:30 +00:00
Nemanja Glumac
b4719cd9cf Ignore cypress_sample_database.json (#19842) 2022-01-21 20:14:48 +01:00
Howon Lee
7dc9d02eb8 Static viz card vs. normal errors 18676 (#19771)
Static viz errors are of basically two kinds:
1. Someone futzed up their query, which we can't do anything about
2. We futzed up the rendering, which is our fault.
Display those two errors differently.
2022-01-21 10:34:03 -08:00
Ariya Hidayat
3e8b2bbcf9 E2E tests: give some time for the popover to appear (#19838) 2022-01-21 09:48:18 -08:00
Joe Bordes
84429c3b8a i18n(Syntax) delete repeated words (#19833) 2022-01-21 08:12:34 -08:00
Alexander Lesnenko
816c1e5a61 Make SelectButton accessible (#19782)
* SelectButton component and stories

* update imports

* specs

* fix forwardRef

* update select button usages for data modeling feature

* remove custom enter press handlers

* update specs

* add outline

* specs

* specs

* specs

* specs
2022-01-21 14:22:23 +00:00
Alexander Polyankin
304131efd8 Make checkbox accessible (#19778) 2022-01-21 16:38:56 +03:00
Alexander Polyankin
788b6d2301 Make toggle accessible (#19769) 2022-01-21 16:38:33 +03:00
Ariya Hidayat
b92f1cc0fd Revert "Add option to force latest GitHub release (#19336)" (#19823)
We will fall back to the manual workaround of tweaking the commit
timestamp.
2022-01-20 16:35:57 -08:00
Cam Saul
33ac186226 add-alias-info: recognize :field clauses in join source queries to be the same if it has a :temporal-unit (#19789)
* Backport Debug QP improvements from #19754

* Enable test

* "Fuzzy" matching when looking for Fields in join source queries

* Add/update tests

* Test fix 🔧

* Remove trailing whitespace

* Fix a few docstrings
2022-01-20 16:05:13 -08:00
Cam Saul
97771d563e Add whats new for driver authors in 0.42.0 (#19820)
* Add whats new for driver authors in 0.42.0 [ci skip]

* Apply suggestions from code review [ci skip]

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2022-01-20 15:48:35 -08:00
Cam Saul
65ce20e7b8 Update API documentation for 0.42.0 (#19819) 2022-01-20 15:46:14 -08:00
Cam Saul
f31221d888 Postgres: avoid unnecessary casts of DATE or TIMESTAMPTZ to TIMESTAMP (#19790)
* Postgres: avoid unnecessary casts of DATE or TIMESTAMPTZ to TIMESTAMP

* Update src/metabase/util/honeysql_extensions.clj

* Update test/metabase/driver/postgres_test.clj
2022-01-20 15:13:00 -08:00
Jeff Evans
d4606c477a Add drive scope to BigQuery client (#19629)
* Add drive scope to BigQuery client

Adding new drive auth scope in order to be able to query Google Drive files created in BigQuery as external tables

Adding new test to confirm such a table can be queried successfully
2022-01-20 16:44:52 -06:00
Jeff Bruemmer
73256bcf26 docs - models (#19750) 2022-01-20 16:43:10 -05:00
Cam Saul
ed5a4489bc Don't add :join-alias to :field clauses for fields that came from source query (#19791)
* Don't add `:join-alias` to `:field` clauses for fields that came from source query's source table

* Some test fixes 🔧

* Test fixes 🔧

* Test fix 🔧

* Test fix 🔧
2022-01-20 13:38:40 -08:00
Cam Saul
3822d2cda8 Add test for #7487 (#19810)
* Add test for #7487

* Fix error message

* Update test for new error message
2022-01-20 13:11:54 -08:00
Ariya Hidayat
b32929127b Disable Notebook animation (#19131) (#19806) 2022-01-20 12:40:50 -08:00
Alexander Lesnenko
fef9ee69b1 hide new question menu item when there are no dbs (#19811) 2022-01-20 20:35:50 +00:00
Anton Kulyk
546ff3040b Fix model metadata strength calculation (#19803)
* Use `display_name` for metadata completeness calc

* Fix unit tests
2022-01-20 20:51:27 +02:00
Cam Saul
b49cadb482 The return of parallel tests (#19793)
* The return of parallel tests

* Cleanup
2022-01-20 10:06:42 -08:00
Cam Saul
7a3b212eb3 partial= (#19679)
* `partial=`

* Diff improvements

* Update test/metabase/test_runner/effects.clj
2022-01-20 10:06:16 -08:00
Alexander Polyankin
4bc958c2ad Fix focus-visible bug (#19804) 2022-01-20 20:41:36 +03:00
Alexander Lesnenko
720fcf4faa update yarn lock (#19802) 2022-01-20 17:01:51 +00:00
Noah Moss
491dbdc0e9 Rename sample dataset to "sample database" (#19682) 2022-01-20 11:38:41 -05:00
Anton Kulyk
ed8a8242f7 Update copy for SavedQuestionIntoModal for models (#19801) 2022-01-20 18:38:35 +02:00
Ariya Hidayat
87cca1bdae Custom expression editor: initial overflow to fix text cut-off (#19785) 2022-01-20 06:46:31 -08:00
Anton Kulyk
dc88a9128b Add semantic type icons to metadata editor (#19726)
* Add function returning column type icon

* Display column type icon in the results table

* Add `left` prop to SelectButton

* Display field type icon in SemanticTypePicker

* Remove "three_dots" icon

Replaced with "ellipsis" with background color

* Add `fallback` arg to `getSemanticTypeIcon`

* Switch to `getSemanticTypeIcon`

* Fix `getSemanticTypeIcon`
2022-01-20 15:33:50 +02:00
Nemanja
860ea23e3b Fix prettier linter error 2022-01-20 15:33:50 +02:00
Nemanja Glumac
8c598dcb05 Update paths without navbar
Fixes the appearance of the main navbar while editing metadata.
2022-01-20 15:33:50 +02:00
Anton Kulyk
0b7435eef1 Preserve metadata changes for models (via editor) (#19724)
* RIP checksum

Now that users can edit the metadata the checksum prevents that and
would throw it away when edited. We'll treat the metadata as valid if it
conforms. The UI isn't really expected to modify type information anyways.

* Ns checker is a harsh disciplinarian

* Extract `fields` variable in dataset editor

* Allow extra onChange callback to form fields

* Only show metadata sidebar when field is selected

* Add onChange callback to semantic type picker

* Add action for overwriting results metadata

* Connect essential fields to form

* display_name
* description
* semantic_type

TBD: mapped database column for native datasets

* Fix missing import

* Fix sidebar inputs loosing focus while typing

* Ensure focused field is in sync

* Refactor FK and currency to be form fields

* Use `field.settings` to keep formatting changes

* Remove "display_as" from form definition

* Connect remaining fields

* Remove CurrencyPicker in favor of formatting input

* Fix incomplete field metadata

Results metadata doesn't contain everything we need for the editor.

'Global' metadata is the most complete, though it shouldn't be muted while in the editor, only once a user saves the changes

Now we only keep focused field ref in state and derive the metadata by merging global metadata and query's results metadata. Query results metadata is mutated by the editor, so merging them both will do the job

* Fix ViewSidebar prop type

* Fix prop type warnings

* Add default values for some fields

* Connect MappedFieldPicker

* Fix MappedFieldPicker closes after loading fields

Sidebar dependant on IDFields was rerendering once additional metadata was loaded, causing DataSelector to unmount

Fixed by moving IDFields subscription to FKTargetPicker directly (the only component that actually needs them)

* Hide metadata popovers in dataset editor

* Disable saving invalid dataset editor changes

Disables "Save changes" button if:
* there is at least one field with empty display name
* the underlying query is empty

* Add `onChangeSetting` prop to ColumnSettings

The existing `onChange` passes the whole settings object as an argument. On the other hand, `onChangeSetting` passes only the changed setting which is useful for storing metadata diff

* Keep field metadata diff in redux

* Ignore column width reset events in metadata editor

* Preserve metadata diff between query edits

* A few important changes:

- ensure that we don't throw away metadata and return an empty channel
in the card api if the query hasn't changed
- ensure api/dataset uses `:metadata/dataset-metadata`
- hydrate fields on api/table/card__id/query_metadata so that it has
target and fk information
- preserve id so this information can be recovered†

†: When a user enters an id we preserve it, but it also gets confusing
if that's the actual field's id or the user-identified id. This is
important when we drill down (and probably lots of other places too if
they start assuming an id means they know exactly what is going on).

A situation based on the orders table:

Suppose you make a native question

```sql
SELECT "PUBLIC"."ORDERS"."ID" AS "ID",
  "PUBLIC"."ORDERS"."USER_ID" AS "user_id_bro",  -- note this is renamed
  "PUBLIC"."ORDERS"."PRODUCT_ID" AS "PRODUCT_ID",
  "PUBLIC"."ORDERS"."SUBTOTAL" AS "SUBTOTAL",
  "PUBLIC"."ORDERS"."TAX" AS "TAX",
  "PUBLIC"."ORDERS"."TOTAL" AS "TOTAL",
  "PUBLIC"."ORDERS"."DISCOUNT" AS "DISCOUNT",
  "PUBLIC"."ORDERS"."CREATED_AT" AS "CREATED_AT",
"PUBLIC"."ORDERS"."QUANTITY" AS "QUANTITY"
FROM "PUBLIC"."ORDERS"
LIMIT 15
```

In my db, the "USER_ID" column is field 3 and points at field 22. Our db
knows that field 3 is called "USER_ID". But in the source query that
column is actually called "user_id_bro". And lots of places assume that
if there's a field's `:id` it knows what the name is. This is obviously
incorrect here. It is a very important distinction that this column "is
basically field 3 USER_ID" and this is literally the field "USER_ID".

So if you do a drilldown based on this information, the FE will issue a
query to "select field 3 from card__127" which expands to roughly
"select USER_ID from (select ... USER_ID as user_id_bro ...)" and this
query obviously will fail.

* Don't put nil on a channel, clean ns

i honestly don't know why the results-metadata and encrypt deps were
there. I didn't add them but they just got caught in the linter for some
reason. I don't understand it.

* Update tests to include target and has_field_values

* Correct final test

* Select enough information for FK to work in UI

* Pass mapped column's properties to BE

* Qualify which semantic_type FK/PK we remove

Previously always removed these semantic types. Now only remove when
they do not have an id there. One thing I'm confused about though is
that native fields should never have a semantic type anyways. There's no
way for one to end up there, certainly not FK or PK right? So i want to
delete this entire method because as I understand it it's not possible
to trigger its conditions except for the new user-entered information,
in which case we want to preserve it. But I have no idea why
Mr. Chesterton built this function so I don't want to delete it.

Bug reports and connecting them back to this change is so hard. Because
it can be things like "native query with an aggregation named "blah"
bucketed by month break when you drilldown into this column" and that's
because it includes a semantic_type that breaks something. It's all very
at-a-distance so hard to trace back to this.

* Fix failed queries handling

* Support custom column metadata editing

* Hide empty sections in semantic type picker

* Remove redundant import

* Fetch database ID fields in FKTargetPicker

* Allow aliasing EntityObjectLoader's entity prop

* Reset DataSelector's state when ID props change

* Fix MappedFieldPicker

* Fixed saved question picker regression

* Select description and settings when merging result_metadata

Annotate columns allows for settings to be preserved from
datasets. Example

```clojure
;; shows a little bar in the UI. quite nice
:settings {:show_mini_bar true, :decimals 0},
```

These settings were correctly preserved in annotate.clj but dropped in
the final merging in result_metadata.clj. Fun times in metadata land

* Let dataset revisions preserve metadata

* Only wrap form fields with custom onChange handler

This prevents form fields from extra re-renders

* Fix summarize sidebar behavior

* Fix e2e test

* Update cypress expectations

Previously expected really generic placeholder text in search boxes. But
in `api/table/card__id/query_metadata` we hydrate native columns with
`:has_field_values` so that when a user identifies an underlying field
on datasets, we have extra information.

This change comes about because the hydrate for `:has_field_values`
doesn't hit the db and look for field values but uses a heuristic.  And
this heuristic works for native fields and finds that they are
searchable because when they are text or textlike and improves the
search bar.

Code from models/field.clj below

```clojure
(defn- is-searchable?
  "Is this `field` a Field that you should be presented with a search widget for (to search its values)? If so, we can
  give it a `has_field_values` value of `search`."
  [{base-type :base_type}]
  ;; For the time being we will consider something to be "searchable" if it's a text Field since the `starts-with`
  ;; filter that powers the search queries (see `metabase.api.field/search-values`) doesn't work on anything else
  (or (isa? base-type :type/Text)
      (isa? base-type :type/TextLike)))

(defn- infer-has-field-values
  "Determine the value of `has_field_values` we should return for a `Field` As of 0.29.1 this doesn't require any DB
  calls! :D"
  [{has-field-values :has_field_values, :as field}]
  (or
   ;; if `has_field_values` is set in the DB, use that value; but if it's `auto-list`, return the value as `list` to
   ;; avoid confusing FE code, which can remain blissfully unaware that `auto-list` is a thing
   (when has-field-values
     (if (= (keyword has-field-values) :auto-list)
       :list
       has-field-values))
   ;; otherwise if it does not have value set in DB we will infer it
   (if (is-searchable? field)
     :search
     :none)))

(defn with-has-field-values
  "Infer what the value of the `has_field_values` should be for Fields where it's not set. See documentation for
  `has-field-values-options` above for a more detailed explanation of what these values mean."
  {:batched-hydrate :has_field_values}
  [fields]
  (for [field fields]
    (when field
      (assoc field :has_field_values (infer-has-field-values field)))))
```

* Ignore `has_field_values` for field literals

Field literals are field using a column title instead of a numeric ID. They're usually coming from native or nested queries.

Metadata propagation changes introduced for data models, made the BE send a guessed `has_field_values` property for field literals too. But searching through possible field values isn't properly supported yet and it's difficult to prevent `has_field_values` being sent to the FE, so this makes the FE ignore it for field literals

* Fix E2E test

* Fix field literal check

* Ensure `:has_field_values` only goes on fields with ids

when a user selects an id to back a native field, we want to hydrate the
field_value information and the target info. But _ONLY_ when they have
ids. The hydration for `:has_field_values` works on a heuristic, not by
hitting the db and seeing if we have field values and will give
information about native fields that do not have backing field information.

* Ensure no annotations on numeric field ids

we put the vector id on each field when there's no numeric id field. I
have no idea why and the comment `;; TODO -- what????` explains the
thinking there. So only annotate where we have numeric ids (fields that
we know how to identify fields in the db) and not when we have a made up
vector id

* Revert changes to FieldValuesWidget

* Fix character case

* Show `has_field_values` selector when ID is known

* Undo the testing for indiscriminant hydration

previously had put target and has_field_values on every native field
which doesn't work well for the UI. Had to clean up the remaining tests
to no longer expect it

* Select `:dataset` when creating a new question

when duplicating a question, we send over this info and need to select
it from the existing question.

* Ensure card is saved with boolean dataset info

largely just for testing which does not send a `:dataset false` property
in some cases. In regular usage there should always be an initial value

* Remove dead code

* Replace TODO with a meaningful comment

* Type Field type

* Select only what we need on the source card

Co-authored-by: dan sutton <dan@dpsutton.com>
2022-01-20 15:33:50 +02:00
Anton Kulyk
31b38be175 Add tab-key navigation for metadata editor (#19379)
* Forward form field ref

* Focus "display_name" when selecting a new field

* Hide query editor in metadata mode

This will remove it from the "tab-flow"

* Pass tabIndex prop to form text inputs

* Add basic tab flow for metadata editor

* Allow passing more props to SelectButton

* Allow passing props to AccordionList's search input

* Use numbers for tab indexes

* Fix SelectButton's props type

* Add special type picker to tab flow

* Fix initial field focusing

* Add "tab" icon

* Add basic TabHintToast component

* Show tab hint toast in metadata editor

* Export wrapped CustomFormField

* Forward SelectButton ref

* Add react-virtualized scrollToColumn prop to Table

* Don't open SemanticTypePicker on focus

* Open SemanticTypePicker on "Enter" key press

* Improve tabbing experience

* automatically scroll the InteractiveTable while tabbing through columns
* focus the first column on hitting "Enter" on the last column

* Remove failed experiment

It was my last hope to combine both props, but no lucj

* Animate sidebar when focused field changes

* Minor rename

* Fix mapped field picker component

* Pass visibility callbacks to trigger elements

* Handle focus for mapped field picker

* Pass searchPlaceholder to Select

* Pass triggerable's onClose prop to Select

* Add onClose prop to DataSelector

* Use Select from special type picker

* Handle focus for MappedFieldPicker

* Add :focus style for essential select inputs

* Fix jump from last to first column on tab key
2022-01-20 15:33:50 +02:00
Anton Kulyk
df7fecaece Repeat "Metadata editor styling" (#19397) (#19425) 2022-01-20 15:33:50 +02:00
Anton Kulyk
b0dff620ea Manage column formatting for datasets + add extra form fields (UI) (#19291)
* Convert SelectButton to TypeScript

* Add onClick prop to SelectButton

* Extract FormFieldDivider component

* Pass dataset into field metadata sidebar

* Add function to get field metadata form fields

* Simplify field visibility options generation

* Allow to provide custom form field widgets

* Add `renderSearchSection` prop to AccordionList

* Add SemanticTypePicker component

* Use SemanticTypePicker

* Add FieldSelector (DataSelector subset)

* Allow hiding DataSelector trigger expand control

* Add MappedFieldPicker component

* Use MappedFieldPicker for native datasets

* Simplify mapped field name formatting

* Fix dataset type usage

* Remove redundant props

* Disable fuzzy search for SemanticTypePicker

* Allow hiding empty AccordionList sections in search

* Don't show empty sections in SemanticTypePicker

* Add formatting section to field metadata form

* Fix FormFieldDivider margin

* Add FK target and currency pickers

* Hide column title from formatting section

* Wire up column formatting updates

* Convert ChartSettingsWidget to TypeScript

* Use styled-components for ChartSettingsWidget

* Add "variant" prop to ChartSettingsWidget

* Unify sidebar form UI

* Fix hidden column settings are forcefully shown

* Add "column type" field label

* Fix ChartSettingsWidget label size in defaul mode

* Use "radio" input for "view_as" field

* Use "Text" instead of "Off" for view_as field

* Use tab layout in field metadata sidebar

* Hide Formatting tab if missing formatting opts

* Fix hidden formatting fields behavior

* Fix E2E test using renamed label

* change view_as label to "Display as"

* Remove divider from expanded semantic type picker

* Move FormFieldDivider into sidebar's .styled file

* Choose "view_as" widget depending on options count

* use "radio" for exactly two options
* use "select" when there are > 2 options

* Change selected radio button look

* Use "text-dark" in sidebar form

* Set height for semantic type picker

* Use Field's displayName method for formatting

Co-authored-by: Maz Ameli <maz@metabase.com>
2022-01-20 15:33:50 +02:00
Anton Kulyk
c9084750e8 Add basic dataset metadata editor UI (#19206) 2022-01-20 15:33:50 +02:00
Anton Kulyk
6a6243d472 Add dataset metadata strength indicator (#19194)
* Add "Edit metadata" button

* Add functions calculating metadata completeness

* Add simple metadata completeness bar

* Add animated percent label

* Allow overwriting ProgressBar height

* Decrease progress bar height

* Allow using tippy `delay` prop for tooltips

* Add tooltip for metadata indicator

* Fix percent label position

* Fix optional ProgressBar props

* Allow customizing ProgressBar via styled components

* Only show indication color on hover (except 50% progress)

* Add basic tests for metadata indicator

* Use "Customize metadata" button name

* Fix percent label centering

* slightly increase tooltip delay

* slightly lower threshold for the 'some' text

* Update UI assertions

* Fix TypeScript errors

* Fix percent rounding

* Add useHover hook

* Add transition style to ProgressBar

* Don't compute indication color in CSS

Co-authored-by: Maz Ameli <maz@metabase.com>
2022-01-20 15:33:50 +02:00
Alexander Polyankin
3f08385d72 Make button accessible (#19749) 2022-01-20 14:40:13 +03:00
Cam Saul
30a0d325ac Return more useful error messages when you don't have collection write/"curate" perms (#16481)
* Better error messages on collection permissions errors

* Test fixes 🔧
2022-01-19 20:09:55 -08:00
Dalton
4114e0bfcb Add semantic type icon/name to dimension info popovers (#19731)
* add balloons icon

* add icon prop to semantic type metadata map

* add functions for getting semantic type icon and name

* update/rename DimensionLabel component

* Fix unit tests

* add tests for util fns

* fix e2e tests reliant on old label
2022-01-19 19:42:15 -08:00
Cam Saul
84f64cb724 Add test for #15538 (#19779)
* Add test for #15538

* Add extra validation for native source queries

* Add test for sql-source-query validation
2022-01-19 16:44:38 -08:00
Jeff Evans
2214e20562 Remove hardcoded project-id from bigquery-cloud-sdk tests (#19780)
* Remove hardcoded project-id from `:bigquery-cloud-sdk` tests

Pull out common helper fn to extract project-id from credentials

Update `bigquery_cloud_sdk_test.clj` to have a var that loads the service-account-json from the env var, then uses aforementioned function to determine project-id

Change sensitive-data-redacted-test to use an arbitrary/fake project-id to remove any sort of confusion
2022-01-19 17:33:59 -06:00
Noah Moss
6e5578c5e1 Add retired-setting-names list & clean up metabot code (#19755) 2022-01-19 17:45:26 -05:00
Alexander Lesnenko
c9d66ea1e5 add funnel and progress static viz e2e tests (#19761) 2022-01-19 21:08:23 +00:00
Cam Saul
e8bf22107e Fix Migration number 420.00-070 => 42.00-070 (#19777)
* Fix Migration number 420.00-070 => 42.00-070

* Remove onUpdateSQL
2022-01-19 13:07:22 -08:00
Bryan Maass
8c188e9d5d Log a shortened version of the enterprise token (#19756)
* Log a shortened version of the enterprise token

- when checking that an enterprise token is valid
- test captures the logs, and checks for no token
- in the test, regrettably we print the logs we need to capture

* fix namespace requires order

* remove "Using this URL to check ..." log line

- and update test

* respond to review comments

- no circular dependency with mt, so use that
- "fa3e"*16 -> random token

* print the shortened token one time, and remove let
2022-01-19 14:16:21 -06:00
Anton Kulyk
31836f08be Warn about archived model used as a data source (#19775) 2022-01-19 21:49:00 +02:00
Anton Kulyk
843de17395 Disallow variables usage for native models (#19752) 2022-01-19 20:16:42 +02:00
Cam Saul
a566bd328d Add test for #13932 (#19766) 2022-01-19 09:39:18 -08:00
Alexander Lesnenko
81ce83845e Truncate static viz legend items (#19733)
* truncate legend items

* avoid x ticks overlap
2022-01-19 17:09:48 +00:00
Anton Kulyk
5789dbe933 Allow using models in native queries and dashboards (#19743)
* Add E2E tests

* Allow adding models to dashboards

* Allow using models in native queries

* Fix last edit info vertical alignment

* Change picker's copy

* Handle undefiend question
2022-01-19 17:27:15 +02:00
Nemanja Glumac
2720c3907d Unskip repro for #15352 (#19770)
Fixed by #15555.
2022-01-19 15:16:25 +01:00
Noah Moss
5be15311a9 Fix conditional logic in geojson api endpoint (#19760) 2022-01-19 08:19:15 -05:00
Cam Saul
84904a2373 upgrade-field-literals should do case-insensitive fixes (#19713) 2022-01-18 16:42:14 -08:00
Cam Saul
b9b70cd9eb Nested Queries Overhaul 2022: Split logic for determining appropriate table & column aliases out of SQL QP (#19384) 2022-01-18 14:33:32 -08:00
Luis Paolini
013bf78059 Wipe special chars from branch names (#19673)
This is a safeguard against branch names with special chars which will be replaced by a "-" char
2022-01-18 18:30:53 -03:00
Gustavo Saiani
94fac5977f Render previous scalar value in narrow public embeds (#19746) 2022-01-18 17:56:19 -03:00
Alexander Polyankin
2334803933 Add enter handling to the database delete form/modal (#19719) 2022-01-18 21:00:27 +03:00
Alexander Lesnenko
14847fdb23 big query schemas settings (#19693)
* big query schemas settings

* fix be specs
2022-01-18 16:28:15 +00:00
Alexander Polyankin
39575cea11 Add group mapping on enter (#19718) 2022-01-18 19:21:10 +03:00
Anton Kulyk
5de363b4c3 Fix drill-through popover look for native models (#19138)
* Fix drill-through popover look for native datasets

* Enable some drills for fields from native queries
2022-01-18 17:22:21 +02:00
Alexander Lesnenko
a2585f4640 change email table styles (#19654) 2022-01-18 14:20:07 +00:00
Alexander Polyankin
d051198121 Remove duplicated attach-workspace (#19728) 2022-01-18 14:26:40 +01:00
Anton Kulyk
9f4c2b3e15 Fix native model results disappear when leaving query editor (#19739)
* Reproduce #19180

* Add `cancelQueryOnLeave` prop to NativeQueryEditor

* Don't cancel query when leaving model query editor
2022-01-18 15:02:42 +02:00
Nemanja Glumac
5cf546a5a5 Fix the remaining model icons (#19735)
* Fix model icons in data picker

* Fix model icons in recent views
2022-01-18 13:43:56 +01:00
Alexander Lesnenko
0723702f4f Rotate crowded ordinal ticks on static charts (#19702) 2022-01-18 12:40:01 +00:00
Nemanja Glumac
d486a2fa73 Update dataset to model references in the activity page (#19736) 2022-01-18 02:37:03 +01:00
Gustavo Saiani
df15e68965 Extract HelpText from Expression Editor (#19729) 2022-01-17 20:53:31 -03:00
Ariya Hidayat
5ba299e128 CI for Percy: cache Cypress binaries (#19711) 2022-01-17 15:21:35 -08:00
Nemanja Glumac
6357c81479 Update datasets' route to model (#19730)
* Update the route from `dataset` to `model`

* Update unit tests

* Update e2e tests

* Fix failing e2e tests
2022-01-17 23:51:29 +01:00
Anton Kulyk
3467d911a0 Fix error after turning a question into a modal (#19721) 2022-01-17 21:06:16 +02:00
Nemanja Glumac
a6d96ca99b Fix 19704 - Use "folder" icon for collections everywhere (#19723)
* Update collection icon for collection permissions page

* Update collections icon for the serach filter page

* Update the collection icon in the "New" dropdown menu
2022-01-17 19:42:01 +01:00
Nemanja Glumac
46c3ffcae0 Update all helpers and references from datasets to models (#19703) 2022-01-17 17:40:23 +01:00
Alexander Polyankin
919a8c90f9 Convert the newsletter form to the standard form (#19715) 2022-01-17 18:00:06 +03:00
Ariya Hidayat
0829fc88ef Static viz bundlling: don't bother with ESLint (#19714)
We have a repo-wide CI run to check ESLint error anyway.
Meanwhile, for day-to-day development of static viz frontend, the main
webpack config is already equipped with ESLint check (along with hot
reload etc).
2022-01-17 06:49:54 -08:00
Alexander Lesnenko
8943e1eb4e fix list of values filter height (#19674) 2022-01-17 12:53:42 +00:00
Alexander Polyankin
f5cbd11142 Fix homepage styling issues (#19695) 2022-01-17 15:05:08 +03:00
Alexander Polyankin
f7bd5d3390 Clean up database guide usability during configuration (#19643) 2022-01-17 15:04:15 +03:00
Howon Lee
f0f14798fb Trend visualization fix for trivial trend (#19635)
Trivial trends previously broke. Now they default to basically the ordinary single value viz.
2022-01-17 02:25:00 -08:00
dpsutton
e64d31924b Fix flaky tests (#19701)
Our email tests can be a bit brittle. Sometimes we assert the first
email in the email inbox is some password reset email, but a race makes
it such that its a "logged in from new ip" email. Othertimes, we might
assert that there are only emails to a particular user but maybe another
test might have triggered an email to another user.

We often might just want two predicates: did the user receive an email
with this subject, or did the user receive an email with this body.

This simply adds those.

It should be safe from races as it can handle emails to multiple users
and multiple emails to the same user.
2022-01-14 18:13:27 -06:00
Alexander Kiselev
dbaf2d5884 added ttag i8n to pratt parser (#19697) 2022-01-14 15:46:18 -08:00
adam-james
5a5a789d73 Incorrect progressbar alert 10899 (#19649)
* Comparison for goals depends on alert_above_goal and if progressbar.

This commit sets up the timeseries predicate and writes tests for what I think the correct behaviours should be:

timeseries, alert above -> (<= goal-value value)
 - (<= 5.9 6) true  -> alert sent
 - (<= 6 6)   true  -> alert sent
 - (<= 6.1 6) false -> alert not sent

progressbar, alert above -> (<= goal-value value)
 - (<= 5.9 6) true  -> alert sent
 - (<= 6 6)   true  -> alert sent
 - (<= 6.1 6) false -> alert not sent

timeseries, alert below -> (>= goal-value value)
 - (>= 6.1 6) true   -> alert sent
 - (>= 6 6)   true   -> alert sent. NOTE: this is to match prior behaviour, but I don't understand why it is this way?
 - (>= 5.9 6) faluse -> alert not sent

progressbar, alert below -> (> goal-value value)
 - (> 6.1 6) true   -> alert sent
 - (> 6 6)   false  -> alert not sent. NOTE: this is what should fix the bug (#10899)
 - (> 5.9 6) faluse -> alert not sent

I think there may be a cleaner way to write and present the tests, so the next commit(s) will address that.

* Simplified Tests for goal-met? predicate.

The goal-met predicate is tested directly with mock data to make the tests more readable.

The change to `metabase.pulse/goal-met?` fixes #10899 while preserving the goal-met behaviour for any non-progress
goal. The behaviour should now be as follows:

```
| Timeseries? | alert_above? | goal | val | goal-met? |
+-------------+--------------+------+-----+-----------+
|     f       |      t       |  5   |  4  |     f     |
|     f       |      t       |  5   |  5  |     t     |
|     f       |      t       |  5   |  6  |     t     |
|     f       |      f       |  5   |  4  |     t     |
|     f       |      f       |  5   |  5  |     f     | <--- this is new behaviour
|     f       |      f       |  5   |  6  |     f     |

|     t       |      t       |  5   |  4  |     f     |
|     t       |      t       |  5   |  5  |     t     |
|     t       |      t       |  5   |  6  |     t     |
|     t       |      f       |  5   |  4  |     t     |
|     t       |      f       |  5   |  5  |     t     |
|     t       |      f       |  5   |  6  |     f     |
```

Otherwise, alerts should be triggered as before.

* added issue number to test

* fixed alignment issue

* swapped goal and value around in comparison for readability

* Fixing nits

* Timeseries and progress bar now follow same logic

I asked for clarification about when alerts fire in #ama-product in Metabase's Slack. There was consensus around the
idea that 'reaches the goal' does generally imply 'meets the goal', so we can use the same comparators between
progress bar and timeseries goals now.

This simplifies the goal-met? function again because it's no longer necessary to check if the given data is a
timeseries goal.

* Adjusted text in goal line alert modal

* ran prettier
2022-01-14 15:14:51 -08:00
Nemanja Glumac
1dae912761 Fix 19630 (#19655)
* Fix duplicate model tooltip

* Fix archive model title

* Fix edit model modal title

* Fix model verification title

* Fix add model to dashboard title

* Fix failing unit test

* Update model's archive message
2022-01-14 23:20:42 +01:00
Luis Paolini
05438f7e6f Separate builder from tester (#19491)
* Separate builder from tester

* indentation error

* Final testing [ci nocache]

* [ci nocache]
2022-01-14 18:29:52 -03:00
Jeff Bruemmer
5291b0d3af docs - slack update (#19593) 2022-01-14 16:22:58 -05:00
Jeff Evans
e48b21db70 Fix bigquery-cloud-sdk dataset-id normalization logic (#19663)
Move bulk of dataset-id normalization logic into new private helper fn

Perform app DB update for db-details after dataset-id has been turned into inclusion filter

Add test to confirm that normalization only happens once
2022-01-14 14:35:32 -06:00
Alexander Polyankin
0240072377 Slack app settings polishing (#19666) 2022-01-14 22:36:43 +03:00
Nemanja Glumac
0cba123b38 Update assets related to Models (previously "Datasets") (#19676)
* Update SVG model illustration

* Update dataset -> model icons and their references

* Update icon names in collections
2022-01-14 20:18:43 +01:00
Alexander Polyankin
34b9abfa9c Fix copy for the modal (#19690) 2022-01-14 20:38:21 +03:00
Alexander Polyankin
6315a497d5 Add extra spacing for form toggles (#19689) 2022-01-14 20:38:05 +03:00
Noah Moss
c5c55b0cef Add placeholder text for Snowflake additional JDBC options field (#19691) 2022-01-14 11:53:13 -05:00
Nemanja Glumac
7d1e838859 Fix flaking repro for 11439 (#19692)
* Fix flaking repro for 11439

* Fix linter
2022-01-14 17:47:29 +01:00
Noah Moss
9f681a38e9 Add new copy to description fields in sample dataset (#19681) 2022-01-14 10:14:15 -05:00
Alexander Lesnenko
5d91c0e9a4 Revert "Clean up old static charts (#19653)" (#19688)
This reverts commit 5fdeed907a.
2022-01-14 14:09:29 +00:00
Noah Moss
eba5b71fd3 Validate slack files channel name on save (#19665) 2022-01-14 08:01:30 -05:00
Nemanja Glumac
aebb1c2e53 Update copy: replace "dataset" references with the "model" (#19675)
* Turn this into a ~~dataset~~ model

* Model revision history copy updates

* Datasets -> Models copy update

* "Dataset management -> Model management" copy update

* This is a ~~dataset~~ model now

* Models in data picker copy changes

* Models in search app copy changes

* Update models copy in tests

* Update frontend/src/metabase/lib/revisions/revisions.unit.spec.js

Co-authored-by: Maz Ameli <maz@metabase.com>

* Update frontend/src/metabase/lib/revisions/revisions.js

Co-authored-by: Maz Ameli <maz@metabase.com>

* Fix and update e2e tests

Co-authored-by: Maz Ameli <maz@metabase.com>
2022-01-14 01:16:09 +01:00
Gustavo Saiani
940258e2b3 Fix react-ace basePath console error (#19672) 2022-01-13 21:08:10 -03:00
Alexander Lesnenko
5fdeed907a Clean up old static charts (#19653)
* clean up old static charts

* specs
2022-01-13 23:48:30 +00:00
Nemanja Glumac
fdd30129d9 Extract models into a separate e2e CI group (#19650)
* Extract models into a separate e2e group

* Split models tests into smaller logical units

* Keep `getCollectionItemRow` helper scoped to a single file

* Keep `testDataPickerSearch` helper scoped to a single file

* Update the name from `datasets` to `models`
2022-01-13 23:36:16 +01:00
Ariya Hidayat
08c3fbfb0a Custom expression editor: workaround focus issue on Firefox (#19670) 2022-01-13 13:32:47 -08:00
Gustavo Saiani
a16204b14f Add PropType option to expression editor (#19669) 2022-01-13 18:29:45 -03:00
Jeff Bruemmer
e0af193a06 docs - SAML troubleshooting (#19667) 2022-01-13 15:25:30 -05:00
Alexander Polyankin
8a2d75baca Fix copy for slack setup (#19664) 2022-01-13 20:47:36 +03:00
Luis Paolini
c5b0fdcad6 Build EE on branches (#19639)
We have to build and publish EE, otherwise some features can't be tested
2022-01-13 13:57:20 -03:00
Alexander Lesnenko
b4d777cd8e add waterfall static viz e2e specs (#19652)
* add waterfall static viz e2e specs

* fix createQuestionAndAddToDashboard command

* formatting
2022-01-13 15:52:52 +00:00
Alexander Polyankin
3178b2a5ca Fix copy (#19660) 2022-01-13 16:49:14 +03:00
Cam Saul
ea1f25f395 Add alias info util namespace (#19610) 2022-01-13 01:18:00 -08:00
dpsutton
1c54f6a0d8 Don't update tables in a schema one by one (#19658)
* Don't update tables in a schema one by one

Code had wanted to log each table which is admirable. But on bigquery
there can be 15,000 tables and this will lock up calls to
/api/database. On stats they are taking about 18s for me. Need to do
once and let the db do the heavy lifting

* Also where schema is nil

* slightly better query
2022-01-13 00:08:57 -08:00
Ariya Hidayat
5ba88dbec0 Custom expression editor: handle source reformatting (#19646)
When the text representation gets reformatted, the old caret position
might not be sensible anymore. Hence, just push the caret to the end.

* Add e2e test for caret position after blur and refocus

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
2022-01-12 16:45:07 -08:00
dpsutton
0ba80d1b5c Correct setting access in enterprise/embedding/utils.clj (#19648) 2022-01-12 17:11:02 -06:00
Chris Wu
4ac9b7ded6 Add Pulse URL param to email settings (#18879)
* Add Pulse URL param to email settings

* Undo frontend changes -- make config only allowable by env var

* Make config enterprise only

* Address feedback

* Change namespace and token feature

* newline

* Rename var and add docs
2022-01-12 13:21:39 -08:00
Dalton
d8b6fae9d1 Cache dashboard parameter values (#19479)
* Cache dashboard parameter values

* move some logic to utils files

* Fix e2e tests

* add comment + const to clarify getParameterValuesSearchKey
2022-01-12 13:13:47 -08:00
frannietrempe
8c65915794 add removed detail re: toggle (#19642) 2022-01-12 14:13:18 -05:00
Jeff Evans
526594f429 Sync multiple schemas for BigQuery (#19547)
Add functions to describe-database namespace for performing inclusive/exclusive schema filtering

Add tests for these functions in isolation

Update `:bigquery-cloud-sdk` driver and QP code to remove the single `dataset-id` conn-param

Changing :bigquery-cloud-sdk` driver to use dataset inclusion/exclusion filters instead

Updating `add.cy.spec.js` Cypress test to account for new structure

Add data upgrade (via `driver/normalize-db-details` implementation) to change `dataset-id` property to inclusion filter

Add test to confirm data upgrade

Adding server side expansion of `:schema-filters` type connection property
2022-01-12 11:46:21 -06:00
Noah Moss
9a71f84942 More backend changes to support Slack app integrations (#19592) 2022-01-12 12:07:42 -05:00
Alexander Polyankin
5a9ad24f92 Inline deprecated driver warning (#19636) 2022-01-12 18:05:57 +03:00
Alexander Polyankin
badc6c135e Slack app settings (#19597) 2022-01-12 12:12:56 +03:00
Cam Saul
65c2442b7b Nested queries minor code cleanup (#19613)
* Misc code cleanup

* PR feedback
2022-01-11 20:49:44 -08:00
Cam Saul
99decfb0ab defsetting should put :tag metadata on :arglists, not on var itself (#19628) 2022-01-11 20:49:13 -08:00
Alexander Kiselev
274a7bb069 Custom expression editor: use new parser/compiler to generate diagnostics (#19557)
* pratt parser diagnostics

* ported over tests from custom parser branch

* updated error types to support pos/len for error markers

* updated compiler error to removed unnecessary plural

* updated resolver to use new error type and pass through node information

* updated error text in custom column e2e test

* updated diagnostics to use new resolver error class

* update recursive-parser passes to pass through node information

* roll back error text fix in e2e tests

* deleted fuzzing tests (they will be moved into the metabase/expression repo)

* this is weird, setting e2e error text back to "Expected expression"

* rolled back expression editor changes in handleInputBlur and moved diagnoseExpression first to fix exponent rewrite issue

* roll back changes to compileExpression

* update import paths in expressions case class identities get messed up
2022-01-11 18:53:02 -08:00
Cam Saul
4097d58c63 Add fix-bad-references middleware (#19612) 2022-01-11 17:35:13 -08:00
Cam Saul
e344fb3bd4 Debugging QP Improvements (#19565)
* Debugging QP Improvements

* Appease namespace linter

* Backport additional debug QP changes from #19384

* Test fix 🔧
2022-01-11 17:33:52 -08:00
Alexander Lesnenko
ef597af3e1 Fix creating a new collection from navbar (#19626)
* Fix creating a new collection from navbar

* add specs
2022-01-11 22:55:35 +00:00
Nemanja Glumac
53f40966d7 Repro #19494: Dashboard filter with default value sends the wrong parameters to all cards of the same questions 2022-01-11 21:57:35 +01:00
Nemanja Glumac
9565974b6a Repro #19603: Archived sub-collections are still showing in Permissions (#19615) 2022-01-11 21:55:12 +01:00
Luis Paolini
bad01b825d Build and publish branches (#19562)
* Build and publish branches

* fixup whitespace

* Update docker.yml

Co-authored-by: Kyle Doherty <5248953+kdoh@users.noreply.github.com>
2022-01-11 16:20:16 -03:00
Kyle Doherty
c390bb0232 update nav copy to be clearer (#19622)
* update nav copy to be clearer

* update tests
2022-01-11 13:50:36 -05:00
Ariya Hidayat
92fb07bde3 Custom expression editor: fix the behavior of Tab (#19594) 2022-01-11 10:20:49 -08:00
dpsutton
81d2d24010 Exclude archived collections from tree view (#19609)
* Exclude archived collections from tree view

This is a bit more nuanced that it might first appear. The bug report is
the permissions editor for collections is showing child collections
which are archived. But the api sends back ALL collections, regardless
of archival state. So the FE knows to omit top-level archived
collections but not archived child collections.

So we thought about just having the FE remove all archived ones, but
best to remove it from the response. One worry is that we're not sure if
any callers want archived collections in the tree view or not. So right
now they are removed with a `?exclude-archived=true` query param, but if
we can demonstrate that no callers of the tree api ever want archived
items we can make this the behavior, rather than an optional behavior.

To verify that the tree api is sending back all collections, you can
check

```clj
collection=> (collection/collections->tree
               {}
               [{:archived false
                 :name "foo"
                 :id 1
                 :location "/"}
                {:archived true
                 :name "foo"
                 :id 2
                 :location "/1/"}
                {:archived true
                 :name "its archived"
                 :location "/"
                 :id 3}])
;; we have always sent back archived collections, both top level and children
({:archived false,
  :name "foo",
  :id 1,
  :location "/",
  :children ({:archived true,
              :name "foo",
              :id 2,
              :location "/1/",
              :children ()})}
 {:archived true,
  :name "its archived",
  :location "/",
  :id 3,
  :children ()})
```

* hide archived collections from the collections permissions page (#19616)

* fix incorrect issue number

Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2022-01-11 10:20:03 -08:00
Noah Moss
e32de618db Move is-hosted? check out of memoized function for cloud gateway IP setting (#19576) 2022-01-11 12:58:54 -05:00
Dalton
e39d86ca8f Hide table info popover when the table has no description & when table is a nested card (#19561)
* Hide table popover based on a few conditions

* fix TS id type inference

* use util fn
2022-01-11 09:04:31 -08:00
Alexander Polyankin
23e81907d2 Fix toggle background color (#19623) 2022-01-11 19:31:45 +03:00
Howon Lee
085496d746 Sparkline nits in static viz email (#19550)
Pursuant to the nits from #18678 and #18676
2022-01-10 23:14:53 -08:00
Howon Lee
0c190ec62f Waterfall bignum display fix (#19025) (#19563)
This actually has nothing to do with waterfalls. Really, it's that static viz is brutally incompatible with bignum types, bigint and bigdec. However, nothing will fit in the screen anyways if you actually need a bignum or bigint type so the solution was to just coerce and be OK with exploding if it actually needed bignum range.
2022-01-10 19:45:57 -08:00
Dalton
14e18c5546 add delay prop to table/dimension info popovers (#19560)
* add delay prop to table/dimension info popovers

* move isCypressActive delay check to TippyPopover
2022-01-10 17:37:24 -08:00
Alexander Lesnenko
cf543761f4 add static viz e2e tests for multiseries line/area/bar/combo charts (#19396) 2022-01-10 20:23:29 +00:00
Ariya Hidayat
781f7c809e Docs: explicitly mention to target master for bug fixes (#19599) 2022-01-10 11:11:38 -08:00
Dalton
d5d9a18bb3 rmv TableInfoPopover from nav search (#19532) 2022-01-10 09:25:23 -08:00
Ariya Hidayat
4be64a82d4 Custom expression editor: avoid null ref (#19586)
Seems that the very first focus happens when the element ref isn't ready
yet (the component did not completely get mounted).
2022-01-10 07:42:29 -08:00
Ariya Hidayat
5bb44a6e18 Chromatic in CI: only publish if the token is available (#19600) 2022-01-10 07:22:54 -08:00
Kyle Doherty
3289da97d4 Prototype/simplify starting points (#19572)
* simplify nav options [ci skip]

* icon tweaks [ci skip]

* dismiss when clicking items [ci skip]

* lint

* Prototype/create button (#19587)

* fix create menu not closing

* update specs

* lint

* fix more specs

* fix specs

* specs

* clean up

* specs

Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
Co-authored-by: Aleksandr Lesnenko <alxnddr@gmail.com>
2022-01-10 09:09:24 -05:00
Alexander Polyankin
43eae81dca Convert NewsletterForm to TypeScript (#19511) 2022-01-08 17:56:22 +03:00
Alexander Polyankin
c8093d6c49 Fix typo (#19575) 2022-01-08 17:05:39 +03:00
Alexander Polyankin
c9949a16e4 Converts styled-components folder to TypeScript (#19517) 2022-01-08 12:18:54 +03:00
Dalton
98171041a3 don't try to show number fingerprint for ID fields (#19579)
* don't try to show number fingerprint for ID fields

* add repro
2022-01-07 16:57:25 -08:00
Jeff Evans
2d07f70a8e Allow override of WEEK_START in Snowflake driver (#19375)
* Allow override of WEEK_START in Snowflake driver

Incorporate the following sources of WEEK_START, in decreasing order of precedence:
1) the connection string, a.k.a. additional-options (ex: WEEK_START=N)
2) the Metabase "start-of-week" setting (i.e. day of a week)
3) the default value (7: Sunday)

Adding new fn to the driver.common namespace to parse a connection string param out of additional-settings (plus a test for that)

Adding Snowflake driver test to ensure that all cases above are covered as expected, by invoking the DAYOFWEEK function on a set of fixed dates

Update documentation for start-of-week setting to clarify that it now influences this behavior

Swap out parse-additional-options-value for additional-options->map instead (more generic)

Update test accordingly
2022-01-07 17:32:43 -06:00
Alexander Lesnenko
f8ac74690a downgrade cypress to 6.4 (#19591)
* downgrade cypress to 6.4

* add resolution to cypress 6.4.0
2022-01-08 00:29:20 +01:00
Jeff Evans
e3e0423282 Bump log4j2 from 2.17.0 -> 2.17.1 (#19588) 2022-01-07 14:12:00 -06:00
Jeff Evans
1ff8c269db Add more valid checksums for changeset id 313 (#19570) 2022-01-07 14:06:27 -06:00
Nemanja Glumac
c4f12a09cb Update caniuse-lite (#19585) 2022-01-07 19:08:51 +01:00
Nemanja Glumac
dfee9974ba Update Metabase copyright year (#19582) 2022-01-07 14:12:45 +01:00
Ariya Hidayat
fb845353b4 Custom expression editor: don't commit an invalid expression (#19549) 2022-01-06 19:03:09 -08:00
Alexander Polyankin
0a042b7108 Fix google auth redirect url and sign-in styling (#19568) 2022-01-07 02:05:28 +03:00
Dalton
0ee85271b6 Disable table header info popover when viz is clicked (#19559) 2022-01-06 14:32:44 -08:00
Nemanja Glumac
0f6fb36358 Fix metadata typo for Sample Dataset json (#19578) 2022-01-06 23:32:28 +01:00
Dalton
1e5ea74c57 add mention of FS_CACHE to devenv.md (#19541) 2022-01-06 11:00:33 -08:00
Noah Moss
aa0a6702f9 Backend changes to support Slack App integrations (#19499) 2022-01-06 13:24:47 -05:00
ajatamayo
ac56346ca0 Fix typo in sql parameters user guide (#19564) 2022-01-06 08:36:47 -08:00
frannietrempe
7c03e3e56a docs - screenshots for multiple groupings in GUI QB (#19542)
* docs - qb screenshots

* updated screenshot

* docs - replaced screenshots
2022-01-05 16:03:52 -05:00
Alexander Polyankin
22576258d9 Add yarn caching to chromatic (#19540) 2022-01-05 20:33:02 +03:00
Ariya Hidayat
2f0ef803ca Custom expression editor: show error marker (#19520) 2022-01-05 08:48:36 -08:00
Ariya Hidayat
b989e95b30 Parser fuzzing: remove previous limitations which do not apply anymore (#19474)
The previous Chevrotain-based parser had a few limitations, which need
to be taken account by the expression generator for the fuzzer. With the
new recursive parser (PR #19335), these limitations are not necessary
anymore:

* leading decimal digit, e.g. `.25`
* nested negatives, e.g. `-- 3`
* nested boolean NOT, e.g. `NOT NOT X`
2022-01-05 08:31:30 -08:00
Nemanja Glumac
089fa54763 Unskip repro for #16273 (#19553) 2022-01-05 15:35:33 +01:00
Alexander Polyankin
42ff35d5d8 Add basic types for api and store (#19552) 2022-01-05 16:27:20 +03:00
Alexander Polyankin
c86eecb314 Invalidate tables after manual re-syncing (#19527) 2022-01-05 13:44:43 +03:00
Alexander Polyankin
75be28c269 Fix group caching issue (#19526) 2022-01-05 13:44:29 +03:00
Ariya Hidayat
f3c09a0fa0 Custom expression editor: don't process invalid expression (#19533)
If the expression is not valid, i.e. there is an error message
associated with processing it, do not blindly continue with it, since it
leads to a potential rewrite of the expression (the rest of
the parser/compiler can tolerate certain brokenness).
2022-01-04 16:51:57 -08:00
Jeff Bruemmer
37c3ad4238 typo (#19544) 2022-01-04 18:59:32 -05:00
Alexander Lesnenko
83f4097e87 fix field filter missing schema metadata (#19536) 2022-01-05 00:18:19 +01:00
adam-james
4448b34da9 JWT Login URL configured by user may have URL parameters (#19381)
* JWT Login URL configured by user may have URL parameters
Since params may already exist in the login URL, a check is performed to make sure the generated URL
with 'return_to' param formats correctly. If a param already exists, all subsequent params should
have an '&
character.

* Sorted ns to pass linting

* added issue number to test string for added context.
2022-01-04 14:44:29 -08:00
Alexander Lesnenko
b0309e2c21 Replace enterprise with license page (#19343)
* remove old store page

* add license pages

* add remove webpack cache command

* lint

* fix specs

* remove license widget from the oss version

* add missing translation

* show loader only for unput when updating token

* fix specs

* amend the license page

* unactivated state fix

* add premium embedding page, refactor, fix specs

* amend the license page

* amend the license page

* change license page padding
2022-01-04 23:39:34 +01:00
Alexander Polyankin
f41cb09ec8 Add chromatic (#19539) 2022-01-05 00:03:42 +03:00
Dalton
ba05958ddd Only use webpack filesystem caching when FS_CACHE=true is set (#19463)
* Only use webpack caching in hot mode

* make webpack filesystem caching enabled via flag
2022-01-04 12:58:23 -08:00
Alexander Polyankin
b7cac72c3c Add storybook for database statuses (#19537) 2022-01-04 23:50:13 +03:00
Dalton
0353bf0c0f fix typo (#19531) 2022-01-04 12:07:47 -08:00
Jeff Bruemmer
e7699e1743 docs - remove faq (#19528) 2022-01-04 14:38:16 -05:00
Noah Moss
5f4549b37c Check for and ignore broken table-columns when determining export column order (#19530) 2022-01-04 14:10:15 -05:00
Dalton
f27ab0ecba Show dimension/table info popover immediately when one is already visible (#19521) 2022-01-04 09:12:08 -08:00
Alexander Polyankin
62f9ccd293 Improve login flow (#19498) 2022-01-04 17:03:51 +03:00
Alexander Polyankin
26aef34043 Fix mobile UI bugs in setup (#19509) 2022-01-04 15:10:08 +03:00
Ariya Hidayat
4f078bc389 Custom expression editor: hide error on the correction attempt (#19516) 2022-01-03 16:42:49 -08:00
Jeff Bruemmer
0af13ab444 promote troubleshooting guide (#19518) 2022-01-03 14:27:53 -05:00
Howon Lee
42a6a4dac1 Refactor static viz to be compatible with individual cards with multiple series (#19402)
One possible combination of the many ways to have multiplicity in charts is to have a single card with singular chart type with multiple y-axes. This makes the general line-area-bar chart compatible with this.
2022-01-03 11:04:56 -08:00
Howon Lee
3800cce364 Fix year-change CI breaks (#19507)
We had some CI breaks that are predicated on the year changing. Fix them.
2022-01-03 07:23:27 -08:00
Luis Paolini
2b287bff4b Add checks for _FILE env vars (#18887)
* Add checks for _FILE env vars

* Fixing this for once and for all + documenting

* Update run_metabase.sh
2021-12-30 16:54:29 -03:00
Ngoc Khuat
137c2051fa fix misplaced warning log for enable name tracing (#19502) 2021-12-30 13:03:11 +07:00
Plugner
0cc615bf8a Update suggestion from AdoptOpenJDK to Eclipse Temurin (#18881)
* Update suggestion from AdoptOpenJDK to Eclipse Temurin

Eclipse Temurin is the replacement for AdoptOpenJDK Hotspot, as the project now is part from Eclipse Foundation, and the OpenJ9 build is called now as Semeru.

* Update java-versions.md

* Update running-the-metabase-jar-file.md
2021-12-29 14:50:56 -08:00
Dennis Schridde
fbefc80c1f Fix use of deprecated Liquibase.listUnrunChangeSets (#16085)
Liquibase 3.3.0 deprecated [1,2] (not listed in the changelog [3] for
that version) the overload of `Liquibase.listUnrunChangeSets` without
a `LabelExpression`.

Fix usage of that deprecated method by using the non-deprecated method
with an empty `LabelExpression`, just as the deprecated method does.

[1]: https://www.javadoc.io/doc/org.liquibase/liquibase-core/3.2.3/liquibase/Liquibase.html#listUnrunChangeSets(liquibase.Contexts)
[2]: https://www.javadoc.io/doc/org.liquibase/liquibase-core/3.3.0/liquibase/Liquibase.html#listUnrunChangeSets(liquibase.Contexts)
[3]: https://github.com/liquibase/liquibase/releases/tag/liquibase-parent-3.3.0
2021-12-29 13:30:31 -08:00
Cam Saul
b9bee5dc65 Database-local Settings (#19399)
* Rename setting/get and setting/all; GeoJSON via env var tests

* Fix typo (thanks @noahmoss)

* Support Database-local Settings in metabase.models.setting itself

* Rework Settings code so it can handle possibly-already-deserialized values

* Database-local Settings

* Remove empty part of docstring

* Appease linters

* Update dox again

* Use text.type for the new column

* Test fixes 🔧

* Test fix 🔧

* Test fix 🔧

* All negative integer values when setting :integer Setting with a string
2021-12-28 16:45:23 -08:00
Alexander Polyankin
2ae0f926c8 Improve password reset flow (#19478) 2021-12-28 22:20:09 +03:00
dpsutton
50818a929d Handle nested queries which have agg at top level and nested (#19437)
* Handle nested queries which have agg at top level and nested

Previously when matching columns in the outer query with columns in the
inner query we had use id, and then recently, field_ref. This is
problematic for aggregations.

Consider https://github.com/metabase/metabase/issues/19403

The mbql for this query is

```clojure
{:type :query
 :query {:aggregation [[:aggregation-options
                        [:count]
                        {:name "count"}]
                       [:aggregation-options
                        [:avg
                         [:field
                          "sum"
                          {:base-type :type/Float}]]
                        {:name "avg"}]]
         :limit 10
         :source-card-id 1960
         :source-query {:source-table 1
                        :aggregation [[:aggregation-options
                                       [:sum
                                        [:field 23 nil]]
                                       {:name "sum"}]
                                      [:aggregation-options
                                       [:max
                                        [:field 28 nil]]
                                       {:name "max"}]]
                        :breakout [[:field 26 nil]]
                        :order-by [[:asc
                                    [:field 26 nil]]]}}
 :database 1}
```

The aggregations in the top level select will be type checked as :name
"count" :field_ref [:aggregation 0]. The aggregations in the nested
query will be turned into :name "sum" :field_ref [:aggregation 0]! This
is because aggregations are numbered "on their level" and not
globally. So when the fields on the top level look at the metadata for
the nested query and merge it, it unifies the two [:aggregation 0]
fields but this is INCORRECT. These aggregations are not the same, they
just happen to be the first aggregations at each level.

Its illustrative to see what a (select * from (query with aggregations))
looks like:

```clojure
{:database 1
 :query {:source-card-id 1960
         :source-metadata [{:description "The type of product, valid values include: Doohicky, Gadget, Gizmo and Widget"
                            :semantic_type :type/Category
                            :coercion_strategy nil
                            :name "CATEGORY"
                            :field_ref [:field 26 nil]
                            :effective_type :type/Text
                            :id 26
                            :display_name "Category"
                            :fingerprint {:global {:distinct-count 4
                                                   :nil% 0}
                                          :type {:type/Text {:percent-json 0
                                                             :percent-url 0
                                                             :percent-email 0
                                                             :percent-state 0
                                                             :average-length 6.375}}}
                            :base_type :type/Text}
                           {:name "sum"
                            :display_name "Sum of Price"
                            :base_type :type/Float
                            :effective_type :type/Float
                            :semantic_type nil
                            :field_ref [:aggregation 0]}
                           {:name "max"
                            :display_name "Max of Rating"
                            :base_type :type/Float
                            :effective_type :type/Float
                            :semantic_type :type/Score
                            :field_ref [:aggregation 1]}]
         :fields ([:field 26 nil]
                  [:field
                   "sum"
                   {:base-type :type/Float}]
                  [:field
                   "max"
                   {:base-type :type/Float}])
         :source-query {:source-table 1
                        :aggregation [[:aggregation-options
                                       [:sum
                                        [:field 23 nil]]
                                       {:name "sum"}]
                                      [:aggregation-options
                                       [:max
                                        [:field 28 nil]]
                                       {:name "max"}]]
                        :breakout [[:field 26 nil]]
                        :order-by [[:asc
                                    [:field 26 nil]]]}}
 :type :query
 :middleware {:js-int-to-string? true
              :add-default-userland-constraints? true}
 :info {:executed-by 1
        :context :ad-hoc
        :card-id 1960
        :nested? true
        :query-hash #object["[B" 0x10227bf4 "[B@10227bf4"]}
 :constraints {:max-results 10000
               :max-results-bare-rows 2000}}
```

The important bits are that it understands the nested query's metadata
to be

```clojure
{:name "sum"
 :display_name "Sum of Price"
 :field_ref [:aggregation 0]}
{:name "max"
 :display_name "Max of Rating"
 :field_ref [:aggregation 1]}
```

And the fields on the outer query to be:
```clojure
([:field
  "sum"
  {:base-type :type/Float}]
 [:field
  "max"
  {:base-type :type/Float}])
```

So there's the mismatch: the field_ref on the outside is [:field "sum"]
but on the inside the field_ref is [:aggregation 0]. So the best way to
match up when "looking down" into sub queries is by id and then by name.

* Some drivers return 4.0 instead of 4 so make them all ints

* Handle dataset metadata in a special way

rather than trying to set confusing merge rules, just special case
metadata from datasets.

Previously, was trying to merge the "preserved keys" on top of the
normal merge order. This caused lots of issues. They were
trivial. Native display names are very close to the column name, whereas
mbql names go through some humanization. So when you select price
from (select PRICE ...) its an mbql with a nested native query. The
merge order meant that the display name went from "Price"
previously (the mbql nice name for the outer select) to "PRICE", the
underlying native column name. Now we don't special case the display
name (and other fields) of regular source-metadata.

Also, there were issues with mbql on top of an mbql dataset. Since it is
all mbql, everything is pulled from the database. So if there were
overrides in the nested mbql dataset, like description, display name,
etc, the outer field select already had the display name, etc. from the
database rather than allowing the edits to override from the nested
query.

Also, using a long `:source-query/dataset?` keyword so it is far easier
to find where this is set. With things called just `:dataset` it can be
quite hard to find where these keys are used. When using the namespaced
keyword, greping and finding usages is trivial. And the namespace gives
more context
2021-12-28 09:25:24 -06:00
dpsutton
97e8390e03 Bump tools deps (#19492) 2021-12-28 09:23:15 -06:00
Alexander Polyankin
ef6aa089b1 Fix export type from cljs (#19493) 2021-12-28 16:49:31 +03:00
Reza Lotun
33ea417082 Send credentials with request for manifest. Incorporate changes from #12524 (#19482)
Co-authored-by: michalc
Co-authored-by: rlotun <reza@metabase.com>
2021-12-27 15:39:48 -08:00
Reza Lotun
5b865bc683 Settings/Setup - redirect to metrics/segments page (#19483) 2021-12-27 15:38:04 -08:00
Alexander Polyankin
8e76585418 Add syncing modal to admin (#19475) 2021-12-27 22:36:47 +03:00
xgdgsc
08734c52ba minor edits in upgrading metabase guide (#17725) 2021-12-26 19:16:07 -08:00
Reza Lotun
b1760338b8 Spelling fixes causing i18n syntax errors during translation. (#19481)
* Spelling fixes causing i18n syntax errors during translation.

* include valid fix in #15509
2021-12-26 19:06:29 -08:00
Daksh Shah
92b5126432 Update timezones.md (#18708)
Fix minor formatting issue
2021-12-26 12:33:27 -08:00
Jeff Evans
ae3b15c434 Add option to force latest GitHub release (#19336)
Updating release script with a new build option to force the release to be latest (by overriding the GIT_COMMITTER_DATE env var when creating the tag)
2021-12-26 12:25:01 -08:00
Jeff Evans
18daf4ed5f Update certificates README.md (#19179) 2021-12-26 12:23:17 -08:00
Paul Duran
99821f2b74 fix typo in URL for Sydney AWS region (#16301) 2021-12-26 12:15:36 -08:00
Alexander Lesnenko
689b4310a7 Dashboard and question list filter with checkboxes (#19467)
* Dashboard and table list filter

* fix native question filters tey to render list of values

* Fix specs

* fix specs
2021-12-25 00:36:42 +03:00
Alexander Polyankin
6b3eedaec3 Consolidate first db sync modal and X-ray selection (#19447) 2021-12-24 20:27:34 +03:00
Dalton
f0ad3c3e53 fix lack of metadata in QB when coming from dashcard (#19471) 2021-12-24 07:10:59 -08:00
Dalton
2647d4a11b Add DimensionInfoPopover to DataSelector (#19284)
* Add DimensionInfoPopover to DataSelector

* show popover when there isn't an attached query

* e2e test

* skip flaky e2e test

* use dimension display name as heuristic for showing popover
2021-12-24 07:10:37 -08:00
Dalton
08b6f2a68f Fix forcefully undefaulted number parameter filter from getting set to NaN (#19473) 2021-12-23 22:00:42 -08:00
Dalton
1662761a0e Add TableInfoPopovers to data selector, query builder header, search, and native query reference sidebar (#19468)
* Add TableInfoPopover to DataSelector

* handle undefined table prop and improve fetching logic

* Add popover to search

* add popover to qb header table name

* use TableInfo in TablePane

* Add a few e2e tests

* Make TablePane connected tables change sidebar
2021-12-23 15:04:55 -08:00
Dalton
b9105e2469 replace FieldPane UI with DimensionInfo UI (#19455) 2021-12-23 12:37:20 -08:00
Gustavo Saiani
d24387a075 Update question/save e2e test (#19466) 2021-12-23 06:45:05 -03:00
Ariya Hidayat
58cf109fde Allow SCOPE type (for Min/Max) to aggregate over category and entity (#19416) 2021-12-22 17:35:22 -08:00
Ariya Hidayat
acdc63d2fc Custom expression editor: don't clobber SQL editor (#19448) 2021-12-22 17:21:03 -08:00
Jeff Bruemmer
a9346b39e7 docs - remove mentions of mac application (#19462) 2021-12-22 16:59:39 -05:00
Alexander Kiselev
9f5f6bb001 skip intermitently passing sharing test (#19457) 2021-12-22 12:06:42 -08:00
Dalton
dc59d0851d Add DimensionInfoPopover to FieldsPicker (#19286)
* Add DimensionInfoPopover to FieldsPicker

* add e2e tests

* skip e2e tests for now
2021-12-22 09:51:25 -08:00
Dalton
4e94f68a76 Add DimensionInfoPopover to the Filter sidebar dimension list (#19287)
* Add DimensionInfoPopover to the Filter sidebar dimension list

* add e2e test

* make e2e test less flaky

* skip test for now
2021-12-22 09:51:11 -08:00
Dalton
b59521b4c9 Add DimensionInfoPopover to the Summarize sidebar dimension list (#19288)
* Add DimensionInfoPopover to the Summarize sidebar dimension list

* add e2e tests

* make e2e tests less flaky

* skip tests for now
2021-12-22 09:50:58 -08:00
Dalton
711e770479 Add DimensionInfoPopover to Custom QB expression editor suggestion list (#19285)
* Add DimensionInfoPopover to Custom QB Expression Editor

* add e2e test

* skip flaky test for now
2021-12-22 09:50:44 -08:00
Jeff Bruemmer
0ea6f3eeff note on disabling animations (#19458) 2021-12-22 10:25:20 -05:00
Alexander Polyankin
6e2c44f994 Fix x-ray selection (#19445) 2021-12-22 15:33:22 +03:00
Alexander Polyankin
a39a1f6dde Add setup invitation validation (#19441) 2021-12-22 15:30:57 +03:00
Alexander Kiselev
ae5442a42d Fix intermittent e2e test failures due to race condition in Sample Dataset popover (#19385)
* add should("be.visible") before clicks on Sample Dataset

* add should("be.visible") before clicks when selecting a sample dataset

* added findByTextEnsureVisible command to Cypress
2021-12-22 01:30:37 -08:00
Alexander Kiselev
33123e6a3e added a statement to set connection lock timeout in testing restore api (#19412) 2021-12-21 23:49:10 -08:00
Ariya Hidayat
d2661e0445 Custom expression parser: error messages are i18n-ready (#19438) 2021-12-21 15:52:01 -08:00
frannietrempe
d52f328a6c docs - clarify sql access in sandboxing (#19450)
* docs clarify sql access in sandboxing

* Apply suggestions from code review

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

* promote headings

* revisions from Luis feedback

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-12-21 16:06:37 -05:00
Noah Moss
c4287952d3 Enable inviting second admin during setup flow (#19414) 2021-12-21 15:57:32 -05:00
Noah Moss
8e790ee6fe Support for "advanced options" section in DB connection form (#19262)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2021-12-21 14:50:43 -05:00
Alexander Lesnenko
cadb878291 fix missing text wrapping (#19442) 2021-12-21 19:38:05 +02:00
Dalton
9e0515c6f0 Fix x-ray dashcard drilldown (#19436) 2021-12-21 09:02:45 -08:00
Dalton
b81a929f73 Add DimensionInfoPopover to Table column headers (#19350)
* Add DimensionInfoPopover to TableInteractive column headers

* check for missing query before parsing dimension

* Don't render DimensionInfoPopover until all dependent data is available

* Add a min/max width to the DimensionInfoPopover content

* Don't show DimensionInfoPopover when user has no metadata

* Add e2e test for table column header popover

* some styling tweaks

* Move field value fetching back to FieldValuesList

* table styling tweaks

* lint fix

* add loading state for field values

* handle alternate field values format

* Format numbers

* make comment more specific

* Fix e2e test

* changes per review

* reconcile some styling differences btwn Dimension and Table popovers

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-12-21 09:02:08 -08:00
Alexander Lesnenko
3e9d77956d Indicate selected item in the admin nav (#19424) 2021-12-21 13:45:57 +02:00
Alexander Polyankin
03a80bbf14 Add setup admin invitation (#19404) 2021-12-21 13:29:11 +03:00
Alexander Polyankin
12d71d74b5 Fix navigation with contextual help (#19431) 2021-12-21 09:35:43 +03:00
Dalton
67ed5c396b Add TableInfoPopover and add it to Table cards on the /browse route (#19322)
* add TableInfoPopover

* Finish TableInfo implementation

* Add TableInfoPopover to TableBrowser

* TableInfo & TableInfoPopover styling tweaks

* add a cypress test for the /browse popover

* TableInfo unit tests update

* fix smoketest test

* shorter delay

* Add loading state for table metadata

* Fix table fk link

* make everything typescript

* add more unit tests

* fix types

* fix e2e test

* styles cleanup

* review changes

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-12-20 21:37:43 -08:00
Gustavo Saiani
98da3e5d50 Wrap names in AccordionList (#19430) 2021-12-20 20:51:42 -03:00
Maz Ameli
da45fc2c37 Restyle the Radio component a bit (#19417)
* restyle the Radio component a bit

* tweak color
2021-12-20 14:51:46 -08:00
frannietrempe
c980f5de33 docs - install & setup consolidation (#19433)
* docs - install & setup consolidation

* Apply suggestions from code review

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-12-20 15:20:56 -05:00
Alexander Kiselev
2c9b60cf9b Revert "Attempt to fix flaky tests in e2e-tests-admin-ee by adding retry logic to restore (#19386)" (#19413)
This reverts commit 0bcefdcc54.
2021-12-20 11:27:15 -08:00
Jeff Evans
a4b1af295f Fix Liquibase checksum failure (#19429)
Set validCheckSum values for id 313
2021-12-20 10:44:22 -06:00
Alexander Polyankin
fde7d719af Use spinner for database sync progress (#19427) 2021-12-20 18:34:22 +03:00
Jeff Evans
b8b1b28a95 Fix file upload of secret values (#19398)
* Fix file upload of secret values

Fix logic in `db-details-client->server` to properly consider the `-options` suffixed connection property from the client version, to determine the treatment to be applied (i.e. base64 decode)

Change logic in `db-details-client->server` to `assoc` nil rather than `dissoc` unused keywords (so they override the saved db details on merge)

Update `driver.u/database->driver*` so that the engine loaded from the database instance is *always* a keyword

Update `metabase.test.data.oracle/connection-details` to pass the property vals through the client->server translation layer

Change `creator_id` in `secret` model to be nullable (since, when creating test DBs, the API current user is deliberately set to nil)

Switch the logic in Oracle SSL test to iterate on the file-path and uploaded variants to the test itself to get around weird CircleCI/environment issues

Use `rds_root_ca_truststore.jks` for the test instead since we don't need the full cacerts for this
2021-12-20 08:40:49 -06:00
Jeff Evans
4f84db6284 Update log4j2 from 2.16.0 -> 2.17.0 (#19421) 2021-12-19 15:25:54 -06:00
Ariya Hidayat
29d28f5998 Custom expression: allow a leading decimal point (#19408) 2021-12-18 11:50:59 -08:00
Kyle Doherty
c17b2f28c3 tweak driver deprecation banner BannerCloseIcon size and add hover (#19410) 2021-12-17 16:44:13 -08:00
Ariya Hidayat
50ab8aba87 Custom expression editor: restore the color of string literals (#19415) 2021-12-17 15:13:05 -08:00
Ariya Hidayat
05d6aba5c4 Release script's website update: pull deps using npm (#19394)
Don't use yarn here since it will fetch dependencies specified in
package.json. Instead, use npm so that dependencies frozen in
package-lock.json, which metabase.github.io uses, are downloaded instead.
2021-12-17 08:37:34 -08:00
Ariya Hidayat
fffd3fa1dc Custom expression type-checking: less strict for some aggregations (#19395) 2021-12-17 08:00:20 -08:00
Anton Kulyk
4138b8aeb4 Respect disabled nested queries on the frontend (#19356)
* Reproduce #19341

* Reproduce unexpected behaviour for dataset picker

* Hide "Explore results" button

* Hide "Saved Questions" database from data picker

* Hide "Saved Questions" step from dataset-style data picker

* Set visibility :auth for "enable-nested-queries"

* Fix datasets pickers navigation

* Fix test

* Fix saved questions appear in data selector search
2021-12-17 12:29:57 +02:00
Alexander Kiselev
0bcefdcc54 Attempt to fix flaky tests in e2e-tests-admin-ee by adding retry logic to restore (#19386)
* added some basic retry logic to dataset restore

* added delay to exception handler in restore function
2021-12-16 23:25:52 -08:00
Cam Saul
b260462963 Rename setting/properties and setting/all; GeoJSON via env var tests (#19382)
* Rename setting/get and setting/all; GeoJSON via env var tests

* Fix typo (thanks @noahmoss)
2021-12-16 20:16:46 -08:00
Dalton
790126b4d6 Remove the field-filter-operators-enabled? feature flag (#19378)
* Remove references to flag in FE code

* Remove flag from BE code

* Remove/update tests related to the feature flag

* Show widget-type selection of 'String' for category & location template tags
2021-12-16 16:48:39 -08:00
Ariya Hidayat
c7f106d77c Custom expression: switch to a recursive-descent parser (#19335)
The fault-tolerant/recovery mode of the Chevrotain-based parser isn't
needed anymore since the suggestion was made to be lexical-based in
PR #15688. Therefore, there is no more reason to carry the Chevrotain
baggage. The grammar construct for Chevrotain was converted into a
simple recursive-descen parser. This represents a reduction from over
1,100 LoC to a leaner parser of only 270 LoC.

Also, we remove the dependency to Chevrotain, reducing the front-end
bundle by approx 18 KB.
2021-12-16 16:07:43 -08:00
Cam Saul
42f92c4555 Validate dashboard parameter types (#19261)
* Validate Dashboard parameter types

* Test/lint fixes 🔧
2021-12-16 12:55:36 -08:00
Alexander Lesnenko
435b89e93d add missing typescript configs (#19390) 2021-12-16 22:10:58 +03:00
Alexander Lesnenko
d9a389913b change between filter layout (#19365)
* update between layout, fix incorrect bottom margin of inputs inside filter popup

* lint
2021-12-16 19:44:19 +03:00
Alexander Polyankin
b627d64095 Add database syncing status (#19338) 2021-12-16 19:31:25 +03:00
Gustavo Saiani
29fe9e02e8 Revert expression editor help text y offset (#19392) 2021-12-16 13:12:46 -03:00
Ariya Hidayat
3fa025d8a9 Parser fuzzing: avoid invalid left-hand side in a comparison (#19353)
As described in #15893, a number literal as the left-hand side in a
comparison isn't semantically valid. Therefore the expression generator
for the fuzzer has to avoid it.
2021-12-16 07:54:56 -08:00
dpsutton
77bc5177df Honor enable-nested-queries setting in expansion (#19380)
* Honor `enable-nested-queries` setting in expansion

Honor the nested queries setting when expanding queries in the middleware

* sort ns
2021-12-16 09:18:39 -06:00
Howon Lee
46c7180d48 Fix combos in tables of column cardinality bigger than the columns being used in combo being broken (#19368)
Pursuant to #18676. Whacks a regression from the second fix of the combo viz
2021-12-15 15:29:23 -08:00
dpsutton
5f8bc3057b Datasets preserve metadata (#19158)
* Preserve metadata and surface metadata of datasets

Need to handle two cases:
1. querying the dataset itself
2. a question that is a nested question of the dataset

1. Querying the dataset itself
This is a bit of a shift of how metadata works. Previously it was just
thrown away and saved on each query run. This kind of needs to be this
way because when you edit a question, we do not ensure that the metadata
stays in sync! There's some checksum operation that ensures that the
metadata hasn't been tampered with, but it doesn't ensure that it
actually matches the query any longer.

So imagine you add a new column to a query. The metadata is not changed,
but its checksum matches the original query's metadata and the backend
happily saves this. Then on a subsequent run of the query (or if you hit
visualize before saving) the metadata is tossed and updated.

So to handle this carelessness, we have to allow the metadata that can
be edited to persist across just running the dataset query. So when
hitting the card api, stick the original metadata in the middleware (and
update the normalize ns not to mangle field_ref -> field-ref among
others). Once we have this smuggled in, when computing the metadata in
annotate, we need a way to index the columns. The old and bad way was
the following:

```clojure
;; old
(let [field-id->metadata (u/key-by :id source-metadata)] ...)
;; new and better
(let [ref->metadata (u/key-by (comp u/field-ref->key :field_ref) source-metadata)] )
```

This change is important because ids are only for fields that map to
actual database columns. computed columns, case, manipulations, and all
native fields will lack this. But we can make field references.

Then for each field in the newly computed metadata, allow the non-type
information to persist. We do not want to override type information as
this can break a query, but things like description, display name,
semantic type can survive.

This metadata is then saved in the db as always so we can continue with
the bit of careless metadata saving that we do.

2. a question that is a nested question of the dataset
This was a simpler change to grab the source-metadata and ensure that it
is blended into the result metadata in the same way.

Things i haven't looked at yet: column renaming, if we need to allow
conversions to carry through or if those necessarily must be opaque (ie,
once it has been cast forget that it was originally a different type so
we don't try to cast the already cast value), and i'm sure some other
things. But it has been quite a pain to figure all of this stuff
out. Especially the divide between native and mbql since native requires
the first row of values back before it can detect some types.

* Add in base-type specially

Best to use field_refs to combine metadata from datasets. This means
that we add this ref before the base-type is known. So we have to update
this base-type later once they are known from sampling the results

* Allow column information through

I'm not sure how this base-type is set for
annotate-native-cols. Presumably we don't have and we get it from the
results but this is not true. I guess we do some analysis on count
types. I'm not sure why they failed though.

* Correctly infer this stuff

This was annoying. I like :field_ref over :name for indexing, as it has
a guaranteed unique name. But datasets will have unique names due to a
restriction*. The problem was that annotating the native results before
we had type information gave us refs like `[:field "foo" {:base-type
:type/*}]`, but then this ruined the merge strategy at the end and
prevented a proper ref being merged on top. Quite annoying. This stuff
is very whack-a-mole in that you fix one bit and another breaks
somewhere else**.

* cannot have identical names for a subselect:
    select id from (select 1 as id, 2 as id)

** in fact, another test broke on this commit

* Revert "Correctly infer this stuff"

This reverts commit 1ffe44e900.

* Annotate but de-annotate in a way

To combine metadata from the db, really, really want to make sure they
actually match up. Cannot use name as this could collide when there are
two IDs in the same query. Combining metadata on that gets nasty real
quick.

For mbql and native, its best to use field_refs. Field_refs offer the
best of both worlds: if id, we are golden and its by id. If by name,
they have been uniquified already. So this will run into issues if you
reorder a query or add a new column in with the same name but i think
that's the theoretical best we can do.

BUT, we have to do a little cleanup for this stuff. When native adds the
field_ref, it needs to include some type information. But this isn't
known until after the query runs for native since its just an opaque
query until we run it. So annotating will add a `[:field name
{:base_type :type/*}]` and then our merging doesn't clobber that
later. So its best to add the field_refs, match up with any db metadata,
and then remove the field_refs.

* Test that metadata flows through

* Test mbql datasets and questions based on datasets

* Test mbql/native queries and nested queries

* Recognize that native query bubbles into nested

When using a nested query based on a native query, the metadata from the
underlying dataset is used. Previously we would clobber this with the
metadata from the expected cols of the wrapping mbql query. This would
process the display name with `humanization/name->human-readable-name`
whereas for native it goes through `u/qualified-name`.

I originally piped the native's name through the humanization but that
leads to lots of test failures, and perhaps correct failures. For
instance, a csv test asserts the column title is "COUNT(*)" but the
change would emit "Count(*)", a humanization of count(*) isn't
necessarily an improvement nor even correct.

It is possible that we could change this in the future but I'd want it
to be a deliberate change. It should be mechanical, just adjusting
`annotate-native-cols` in annotate.clj to return a humanized display
name and then fixing tests.

* Allow computed display name on top of source metadata name

If we have a join, we want the "pretty" name to land on top of the
underlying table's name. "alias → B Column" vs "B Column".

* Put dataset metadata in info, not middleware

* Move metadata back under dataset key in info

We want to ensure that dataset information is propagated, but card
information should be computed fresh each time. Including the card
information each time leads to errors as it erroneously thinks the
existing card info should shadow the dataset information. This is
actually a tricky case: figuring out when to care about information at
arbitrary points in the query processor.

* Update metadata to :info not :middleware in tests

* Make var private and comment about info metadata
2021-12-15 16:43:04 -06:00
Gustavo Saiani
51a524193d Fix expression editor’s cursor position in Safari (#19377) 2021-12-15 16:29:18 -03:00
Cam Saul
f4073a150c Fix logging test utils & re-enable tests (#19334)
* Fix logging utils

* Test fixes 🔧
2021-12-15 11:22:00 -08:00
Gustavo Saiani
dc0a49da25 Make expression variable regex less greedy (#19376) 2021-12-15 16:15:08 -03:00
Jeff Evans
7de81ef769 Fix MongoDB path collision error with nested columns (#19252)
Remove any parent fields from the field list when building projections, which should have the same effect as before (only child fields selected) while being compatible with MongoDB 4.4+

Add test to confirm the parent fields are removed
2021-12-15 12:38:18 -06:00
Cam Saul
4361d6f763 Fix X-Rays with filters (#19370) 2021-12-14 21:28:26 -08:00
adam-james
c76ea739b4 Reset password use site url bugfix #14028 (#19367)
* Patch from a 1:1 with Dan.
This is a set of changes made while pairing with Dan, where we tried a few different approaches to getting the proper site url in the email.

* Changed predicate inside forgot password test

* Remove hostname as arg for password reset email
The email template was changed to use siteUrl, so hostname is unused.

* use DateAllOptionsWidget for single date and range date filters (#19360)

* use DateAllOptionsWidget for single date and range date filters

* fix specs

* fix specs

* add more specs

* Patch from a 1:1 with Dan.
This is a set of changes made while pairing with Dan, where we tried a few different approaches to getting the proper site url in the email.

* Changed predicate inside forgot password test

* Remove hostname as arg for password reset email
The email template was changed to use siteUrl, so hostname is unused.

Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
2021-12-14 17:03:47 -08:00
Alexander Lesnenko
f87e26e1a2 use DateAllOptionsWidget for single date and range date filters (#19360)
* use DateAllOptionsWidget for single date and range date filters

* fix specs

* fix specs

* add more specs
2021-12-15 01:39:54 +03:00
Dalton
282bb160b1 Handle unauthed/data mismatch dashcard query builder states better (#19300)
* Handle unauthed/data mismatch dashcard query builder states better

* only run verify fn when deserializedCard has parameters

* fix unit test description
2021-12-14 14:25:14 -08:00
Howon Lee
e6c1299687 Negative progress bars valid, different color (#19352)
Negative progress bars should display as progress bars w/ progress 0.

Also changes default color of progress bar to green.
2021-12-14 14:09:29 -08:00
Alexander Polyankin
b9929e0b1b Add home page analytics (#19363) 2021-12-15 00:07:37 +03:00
Alexander Lesnenko
4a021a42d7 Change admin UI: navbar and premium embedding widget (#19304)
* tune admin nav and remove premium embedding offer

* update SecretKeyWidget style
2021-12-14 23:54:17 +03:00
Gustavo Saiani
5a95d8a149 React Ace: Have custom expression suggestions and help block closer to editor (#19312) 2021-12-14 16:29:01 -03:00
Jeff Bruemmer
0cd28b212b docs - plans blockquotes (#19361)
* plans blockquotes

* update heading
2021-12-14 12:49:10 -05:00
Dalton
182b24354e don't pass dashcard viz settings to query builder (#19329)
* don't pass dashcard viz settings to qb

* mark cards without IDs as dirty in QB
2021-12-14 09:43:30 -08:00
Jeff Evans
1b55784252 Bump log4j2 version to 2.16.0 (#19358)
We probably never want to use message lookups or JNDI integration
2021-12-14 11:25:44 -06:00
Ariya Hidayat
642cd80893 CI with GitHub Actions: Run some of them with BuildJet (#19349) 2021-12-13 16:12:02 -08:00
Luis Paolini
8edff5eb95 Fix typo in Dockerhub repository name (#19351) 2021-12-13 19:05:41 -03:00
Howon Lee
1df1819001 Area static viz (#19306)
Static visualizations for area charts. Pursuant to #18676
2021-12-13 13:52:42 -08:00
Alexander Polyankin
a791da3936 Add database modal to homepage (#19314) 2021-12-14 00:18:09 +03:00
Ariya Hidayat
b8392b373b CI for i18n: Cache those M2 packages (#19332) 2021-12-13 11:53:39 -08:00
Alexander Kiselev
f92d333295 Fix several intermittent test failures in e2e tests with should (#19342)
* fix flake questtion tests by adding should("exist") before click

* add should check to setup tests
2021-12-13 11:30:09 -08:00
Dalton
f32b59d5d9 Add info from field.fingerprint to the DimensionInfo component (#19280)
* add FieldFingerprintInfo component to DimensionInfo

* add getFieldValues selector to the fields entity

* add fingerprint data to example page

* prettier fix

* add a defined const for '35' value
2021-12-13 11:10:47 -08:00
Dalton
a7ad762762 Add useAsyncFunction and useIsMounted (#19321) 2021-12-13 10:31:47 -08:00
Luis Paolini
edbc560d22 Build in GH actions and push to Dockerhub head (#19303)
* Build in GH actions and push to Dockerhub head

* Update build-and-push-head-images.yml
2021-12-13 15:27:06 -03:00
Noah Moss
e9eca85f7c Fix sync issue interfering with Cypress MongoDB snapshots (#19311)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2021-12-13 13:20:40 -05:00
Dalton
df92ead394 Fix ExpressionDimension.prototype.field error when associated with nested question (#19282)
* default undefined expression map to empty object

* add unit test
2021-12-13 10:15:04 -08:00
Dalton
8f4e2d31c2 Add DimensionInfoPopover component (#19281)
* Add DimensionInfoPopover component

* convert DimensionInfoPopover into ts
2021-12-13 10:12:09 -08:00
Dalton
20b514c000 add renderItemWrapper fn to AccordionList (#19279) 2021-12-13 10:11:40 -08:00
Ariya Hidayat
796cced92e Ensure Concat's implicit type casting is honored (#19320) 2021-12-10 18:00:08 -08:00
Ariya Hidayat
acf1309a21 Fix COALESCE with string type (#19305) 2021-12-10 17:10:30 -08:00
Cam Saul
0c4be936ee Big QP parameter refactor; validate param :types for Cards (#19188)
* Refactor: move Card and Dashboard QP code into their own qp.* namespaces

* Disable extra validation for now so a million tests don't fail

* WIP

* Validate template tag :parameters in query in context of a Card

* Fixes

* Disable strict validation for now

* Test fixes [WIP]

* Make the parameter type schema a little more forgiving for now

* Tests & test fixes 🔧

* More test fixes 🔧

* 1. Need more tests
2. Need to actually validate stuff

* More test fixes. 🔧

* Test fixes (again)

* Test fix 🔧

* Some test fixes / PR feedback

* Disallow native queries with a tag widget-type of "none"

Template tags with a widget-type that is undefined, null, or "none" now
cause the query's isRunnable method to return false. Existing questions
that have this defect won't be runnable until they are resaved with a
set widget-type.

* Fix prettier error

* add snippet and card types to validation pass

* Make sure template tag map keys + `:names` agree + test fixes

* Have MBQL normalization reconcile template tags map key and :name

* Test fix 🔧

* Fix tests for Cljs

* Fix Mongo tests.

* Allow passing :category parameters for :text/:number/:date for now.

* Dashboard subscriptions should use qp.dashboard code for executing

* Make sure Dashboard QP parameter resolution code merges in default values

* Add a test for sending a test Dashboard subscription with default params

* Prettier

* If both Dashboard and Card have default param value, prefer Card's default

* Test fix 🔧

* More tests and more fixes 😢

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2021-12-10 17:07:47 -08:00
Luis Paolini
94a3ce2e68 Fix (skip) 17490 repro (#19315)
* Update 17490.cy.spec.js

Seems that we removed the finder

* Update 17490.cy.spec.js

skipping the test as it's no longer relevant
2021-12-10 18:42:38 -03:00
Jeff Bruemmer
2a50f76928 Docs - revamp README (#19299) 2021-12-10 16:17:47 -05:00
Alexander Polyankin
ddaea8c969 Move database schedule fields to the main form (#19290) 2021-12-10 21:44:38 +03:00
Jeff Evans
8f72be702a Fix Presto JDBC test in CircleCI (#19313)
* Fix Presto JDBC test in CircleCI

Maybe sudo isn't needed for the import operation

* Also print the file permission

* Add write permission
2021-12-10 10:33:37 -08:00
Jeff Evans
8bfce98beb Bump log4j from 2.14.1 to 2.15.0 (#19309)
* Bump log4j from 2.14.1 to 2.15.0

* Disable failing logging tests when bumping log4j

0day in log4j requires bump in dependency. These tests look for logs in
testing but our test logger doesn't seem to have levels set
correctly. The disease is certainly worse than the remedy in this case
and each instance is annotated with the reason it is disabled, and we
can reenable them in calmer waters

* Fix unused ns

Co-authored-by: Youngho Kim <miku@korea.ac.kr>
Co-authored-by: dan sutton <dan@dpsutton.com>
2021-12-10 10:30:46 -08:00
Gustavo Saiani
5a64c4931d Only use bold for custom question in expression editor (#19295) 2021-12-10 13:10:08 -03:00
Alexander Polyankin
52346e4d2f Add syncing progress indicators (#19015) 2021-12-10 17:31:27 +03:00
Alexander Polyankin
89dbc5289b Add database driver deprecation notice (#19090) 2021-12-10 15:50:52 +03:00
Gustavo Saiani
30c75e853f Organize expression editor code (#19298) 2021-12-10 05:04:06 -03:00
adam-james
beecceb4bd Site url validation fixes #14491 (#19276)
* Added URL to test for repro of issue #14491

* Allow alphanumeric and _ characters in domains.

Hostnames and domains are not the same. Hostnames have the restriction of alphanum, hyphen, and must start with an
alpha char. This is what our regex seemed to match before.

Relevant RFC for domain names:
[https://www.rfc-editor.org/rfc/rfc2181#section-11](RFC2181 Section 11)

Relevant RFC for hostnames:
[https://www.ietf.org/rfc/rfc1123.html#section-2.1](RFC1123 Section 2.1)

It seems that our url? regex is for hostnames, and is based on the UrlValidator code from apache commons. Though the
issue #14491 author brings up the RFC1034 (which links to RFC1123 with a bit of a spec) to indicate that underscores
SHOULD be allowed, they aren't really in that case. But it seems that there's wiggle room in allowing it for 'domains'
generally, and perhaps we should permit the use of underscores in this URL validation to allow for more configuration
options for our users.

A stackoverflow page with helpful context and explanantion which helped me think about this:
https://stackoverflow.com/questions/2180465/can-domain-name-subdomains-have-an-underscore-in-it

* Fixed spacing
2021-12-09 12:40:04 -08:00
frannietrempe
3b3a2f94cd docs - expanding description of LDAP features (#19272)
* docs - expanding description of LDAP features

* Apply suggestions from code review

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

* docs - edits to LDAP docs based on feedback

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-12-09 14:32:09 -05:00
Ariya Hidayat
9732fa6b7c Custom expression editor: make the I-beam cursor more subtle (#19294) 2021-12-09 11:11:04 -08:00
Ariya Hidayat
58d081bbeb Only reject number literal on the left-hand side of a comparison (#19293) 2021-12-09 10:39:51 -08:00
Dalton
2e8470dd51 Add parameters to GUI query builder & make permissionless title drilldown use parameters (#19027)
* first pass at adding parameters to gui qb

* handle refresh of qb when there are parameters

* second pass

* minor refactoring

* correctly map dashboard params to template tag params

* make click behavior question params work again

* lint fix

* run with dsahboard endpoint in query builder

* fix parameter click behavior

* fix title drill navigating to new question

* add some extra care when setting props on card

* refactor getUrlWithParameters & sprinkle comments

* fix and remove irrelevant unit tests in meta/Card

* fix metadata fetch race condition

* refactor logic

* fix click behavior

* rmv unit tests for function that no longer exists

* add Question unit tests

* add dashboardId to card serialization in qb

* add more title drill e2e tests

* rmv unneeded code in qb initialization

* fix click behavior query param problem

* add targets unit tests

* dashboards unit test + simplification of fn logic

* add cards unit test

* prevent passing of nil parameterValues to native qb
2021-12-09 09:27:15 -08:00
Alexander Polyankin
a4e1e3cfea Add missing ellipses (#19292) 2021-12-09 20:19:06 +03:00
Howon Lee
e3388f14c6 Combo / Multi chart static viz BE (#19151)
Combo type and multiple cards for static viz BE. These go into one FE endpoint but are two really separate things in BE. This one conforms to the FE type but the price is that the previous more-dynamic BE types needed to be changed to conform: this will require a refactoring to whack the js-viz types that already exist, when the FE is refactored also.
2021-12-08 17:48:58 -08:00
Gustavo Saiani
19c1d935d3 Have Custom Expression Editor use React Ace as its engine (#19129) 2021-12-08 20:22:17 -03:00
Alexander Lesnenko
52712b42c1 support ts and tsx in parse-deps (#18329)
* support ts and tsx in parse-deps

* use strip flow types plugin

* remove strip flow types plugin
2021-12-08 23:51:33 +03:00
Dalton
60502ec8ac Add unauthed state to dashboard parameter mapping ui (#19201)
* Rewrite DashCardCardParameterMapper to use tippy + be functional

* add unauthed state

* make the mapper popover interactive

* make Popover and TippyPopover use same selector

* add targets unit tests

* add e2e test for this specific scenario

* kill tippyPopover util because selectors are now the same

* fix e2e tests that rely on anchor tag

* delete old component

* rmv console.log call
2021-12-08 09:39:17 -08:00
Ariya Hidayat
578ff72a5e Skip node_modules caching for Percy CI (#19266)
Caching node_modules (see PR #19202) doesn't seem to _always_ work for
Percy CI workflow, there must be some non-deterministic behavior
somewhere.
Until we figure out that, skip node_modules caching for now to unblock
Percy CI runs.
2021-12-08 08:28:13 -08:00
Jeff Bruemmer
cb9d12eed0 docs - JWT (#19238) 2021-12-08 09:27:26 -05:00
Alexander Lesnenko
bdf684c399 Select no columns in the custom question mode (#19186)
* select none keeps the first one selected

* make "None" and "All" lowercase

* fix select none when a query has joins

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-12-08 13:38:13 +03:00
Jeff Evans
4bf404fbf8 Update presto-kerberos-docker branch used by run-presto-kerberos-test (#19256)
* Update presto-kerberos-docker branch used by run-presto-kerberos-test

Point the Presto Kerberos integration test to a `hacked-dec-2021` branch of `metabase/presto-kerberos-docker`, which contains

* the test_data catalog, which was added under `add-test_data-catalog`
* an updated download location for the `forego` binary dependency, which we now host
2021-12-07 21:24:24 -06:00
Jeff Evans
61828f4ee7 Add linter for metabase-plugin.yaml files (#19240)
Add new deps for finding close misspellings of map keys (spell-spec) and printing more readable spec errors (expound)

Adding spec definitions for driver YAML format

Add call to driver YAML validation from verify.clj

Fixing a couple issues in existing drivers found by the validation
2021-12-07 16:56:32 -06:00
Jérome Perrin
d5b7bff124 docs: typo MB_EMOJI_IN_LOGS (#18886)
MB_EMOJIN_IN_LOGS was a typo
2021-12-07 14:49:36 -08:00
Ben Cook
f201552783 Fix small typos in docstrings (#19170) 2021-12-07 14:49:20 -08:00
dpsutton
a2dfc16070 Only select type information on type inference of coalesce (#19008)
* Only select type information on type inference of coalesce

This previously just selected hte inferred information from the second
argument to the coalesce. For fields this would return the entire field
object which includes an id.

Later, in `source-metadata->fields` this assumes that since an id is
present, we should select `[:field id nil]`, but this confused that the
type of the coalesce column is the same as that field-id, not that we
want to select that field id.

```clojure
add-source-metadata=> (pprint
                        (mbql-source-query->metadata {:source-table 2
                                                      :joins [{:fields [[:field
                                                                         22
                                                                         {:join-alias "People - User"}]
                                                                        [:field
                                                                         15
                                                                         {:join-alias "People - User"}]]
                                                               :source-table 3
                                                               :condition [:=
                                                                           [:field 3 nil]
                                                                           [:field
                                                                            22
                                                                            {:join-alias "People - User"}]]
                                                               :alias "People - User"}]
                                                      :expressions {:coalesce [:coalesce
                                                                               [:field 3 nil]
                                                                               [:field
                                                                                22
                                                                                {:join-alias "People - User"}]]}
                                                      :aggregation [[:count]]
                                                      :breakout [[:expression "coalesce"]]}))
({:semantic_type :type/FK,
  :table_id 2,
  :coercion_strategy nil,
  :name "coalesce",                    ;; merging maintains the correct name
  :settings nil,
  :field_ref [:expression "coalesce"], ;; merging maintains the field ref
  :effective_type :type/Integer,
  :parent_id nil,
  :id 3,                               ;; the type inference selected
                                       ;; the entire field, including its id
  :display_name "coalesce",
  :fingerprint {:global {:distinct-count 929, :nil% 0.0}},
  :base_type :type/Integer}
 {:name "count",
  :display_name "Count",
  :base_type :type/BigInteger,
  :semantic_type :type/Quantity,
  :field_ref [:aggregation 0]})
nil
```

updating to only select the type information:

```clojure
add-source-metadata=> (pprint
                        (mbql-source-query->metadata {:source-table 2
                                                      :joins [{:fields [[:field
                                                                         22
                                                                         {:join-alias "People - User"}]
                                                                        [:field
                                                                         15
                                                                         {:join-alias "People - User"}]]
                                                               :source-table 3
                                                               :condition [:=
                                                                           [:field 3 nil]
                                                                           [:field
                                                                            22
                                                                            {:join-alias "People - User"}]]
                                                               :alias "People - User"}]
                                                      :expressions {:coalesce [:coalesce
                                                                               [:field 3 nil]
                                                                               [:field
                                                                                22
                                                                                {:join-alias "People - User"}]]}
                                                      :aggregation [[:count]]
                                                      :breakout [[:expression "coalesce"]]}))
({:name "coalesce",
  :display_name "coalesce",
  :base_type :type/Integer,
  :effective_type :type/Integer,  ;; no more field information beyond
                                  ;; the types
  :coercion_strategy nil,
  :semantic_type :type/FK,
  :field_ref [:expression "coalesce"]}
 {:name "count",
  :display_name "Count",
  :base_type :type/BigInteger,
  :semantic_type :type/Quantity,
  :field_ref [:aggregation 0]})
```

* Update question in repro now that it doesn't fail on the backend

previously this question would actually fail on the backend and
independently the frontend would go into a stack overflow killing the
page. Fixing the bug actually broke the test as it asserted that the
query would break and look for the error message. Now that the query
returns assert we can find the name of the question "test question"

* Correct same bug for case

When inferring type for a case, we were returning the type information
for the first field we could find in the case statement. And that
information included the field id. We always merge the current column's
name on top of that to remove the analyzed field's name and other
things, but the field-id would remain. `source-metadata->fields` in
add_implicit_clauses will add a field reference if it finds a field id.

Before, the following was returned

```clojure
({:description "The date and time an order was submitted."
  :semantic_type :type/CreationTimestamp
  :table_id 2
  :coercion_strategy nil
  :unit :month
  :name "CREATED_AT"
  :settings nil
  :source :breakout
  :field_ref [:field
              4
              {:temporal-unit :month}]
  :effective_type :type/DateTime
  :parent_id nil
  :id 4
  :visibility_type :normal
  :display_name "Created At"
  :fingerprint {:global {:distinct-count 9998
                         :nil% 0.0}
                :type {:type/DateTime {:earliest "2016-04-30T18:56:13.352Z"
                                       :latest "2020-04-19T14:07:15.657Z"}}}
  :base_type :type/DateTime}
 {:description "The raw, pre-tax cost of the order. Note that this might be different in the future from the product price due to promotions, credits, etc."
  :semantic_type :type/Quantity
  :table_id 2
  :coercion_strategy nil
  :name "distinct case"
  :settings nil
  :source :aggregation
  :field_ref [:aggregation 0]
  :effective_type :type/Float
  :parent_id nil
  :id 6
  :visibility_type :normal
  :display_name "distinct case"
  :fingerprint {:global {:distinct-count 340
                         :nil% 0.0}
                :type {:type/Number {:min 15.691943673970439
                                     :q1 49.74894519060184
                                     :q3 105.42965746993103
                                     :max 148.22900526552291
                                     :sd 32.53705013056317
                                     :avg 77.01295465356547}}}
  :base_type :type/BigInteger})
```

The important bit above is that the metadata for the "distinct case" has
the correct field_ref but also has a field id.

After, we now return the following metadata:
```clojure
({:description "The date and time an order was submitted."
  :semantic_type :type/CreationTimestamp
  :table_id 2
  :coercion_strategy nil
  :unit :month
  :name "CREATED_AT"
  :settings nil
  :source :fields
  :field_ref [:field
              4
              {:temporal-unit :default}]
  :effective_type :type/DateTime
  :parent_id nil
  :id 4
  :visibility_type :normal
  :display_name "Created At"
  :fingerprint {:global {:distinct-count 9998
                         :nil% 0.0}
                :type {:type/DateTime {:earliest "2016-04-30T18:56:13.352Z"
                                       :latest "2020-04-19T14:07:15.657Z"}}}
  :base_type :type/DateTime}
 {:base_type :type/BigInteger
  :effective_type :type/Float
  :coercion_strategy nil
  :semantic_type :type/Quantity
  :name "distinct case"
  :display_name "distinct case"
  :source :fields
  :field_ref [:field
              "distinct case"
              {:base-type :type/BigInteger}]}
 {:semantic_type :type/Quantity
  :coercion_strategy nil
  :name "cc"
  :expression_name "cc"
  :source :fields
  :field_ref [:expression "cc"]
  :effective_type :type/Float
  :display_name "cc"
  :base_type :type/Float})
```

* Add tests looking for full field analysis without id
2021-12-07 16:30:21 -06:00
frannietrempe
f6950640c3 docs - edit FAQ (#19254) 2021-12-07 16:35:35 -05:00
frannietrempe
bf8c394ab1 docs - fixed links and replaced screenshots (#19251)
* docs - fixed links and replaced screenshots

* Apply suggestions from code review

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-12-07 15:32:53 -05:00
Alexander Lesnenko
a21b5f023a fix progress bar text alignment and missing translations (#19249) 2021-12-07 21:33:19 +03:00
frannietrempe
411e69e42f docs - created troubleshooting permissions (#19234)
* Created troubleshooting - permissions

* Additional links and reorg to troubleshooting
2021-12-07 12:12:29 -05:00
Jeff Bruemmer
befec53d9d update link (#19242) 2021-12-07 12:12:03 -05:00
Alexander Lesnenko
94a1feadb7 add renovate config (#19145) 2021-12-07 20:11:47 +03:00
Ariya Hidayat
756b1c101f Percy CI: fix node_modules caching (#19243)
Since Cypress is need, we need to cache ~/.cache/Cypress as well.
2021-12-07 09:09:14 -08:00
Alexander Lesnenko
cfc65993ec fix link types (#19239) 2021-12-07 19:17:00 +03:00
Alexander Polyankin
b912e4f911 Convert homepage to TypeScript (#19204) 2021-12-07 16:15:04 +03:00
Alexander Polyankin
3201c9761c Remove flow support (#19235) 2021-12-07 15:48:03 +03:00
Alexander Polyankin
c90c88ed5e Convert metabase-lib to TypeScript (#19224) 2021-12-07 15:28:25 +03:00
Alexander Polyankin
4281509320 Convert basic components to TS (#19237) 2021-12-07 15:16:53 +03:00
Alexander Polyankin
6233874ea1 Remove flow from EE (#19236) 2021-12-07 15:14:03 +03:00
Ariya Hidayat
8c611b88ee CI with GitHub Actions: cache node_modules (#19202) 2021-12-06 15:23:35 -08:00
Jeff Bruemmer
607857efd2 update links (#19231) 2021-12-06 16:31:10 -05:00
Alexander Polyankin
56c4422842 Enable Snowplow only for Cypress tests (#19225) 2021-12-07 00:06:18 +03:00
Alexander Polyankin
bceca3b31e Remove broken flow types (#19227) 2021-12-06 23:33:46 +03:00
Noah Moss
ede9600751 Omit thousands separator in XLSX format string if specified in viz setting (#19228) 2021-12-06 15:30:33 -05:00
Alexander Polyankin
095ca01835 Remove flow from modes (#19216) 2021-12-06 21:57:27 +03:00
Alexander Polyankin
c7511274c2 Add helper text to database form fields (#19105) 2021-12-06 20:59:25 +03:00
Alexander Polyankin
923bfcc1b4 Convert metabase-types to TypeScript (#19222) 2021-12-06 20:46:36 +03:00
Noah Moss
8f2cc20461 Backend for DB sync progress UX (#18952) 2021-12-06 12:42:40 -05:00
Alexander Polyankin
7fcab259d7 Remove flow from public (#19219) 2021-12-06 20:27:37 +03:00
Alexander Polyankin
f37183e919 Remove flow from lib (#19215) 2021-12-06 20:13:05 +03:00
Alexander Polyankin
c210984c87 Remove flow from parameters (#19218) 2021-12-06 20:04:39 +03:00
Alexander Polyankin
fad4bc8ab5 Remove flow from new query (#19217) 2021-12-06 20:04:26 +03:00
Alexander Polyankin
2a5e86fbcb Remove flow from internal (#19214) 2021-12-06 20:01:05 +03:00
Alexander Polyankin
fc55225142 Remove flow from questions (#19220) 2021-12-06 20:00:28 +03:00
Alexander Polyankin
e152e67f72 Remove flow from reference (#19221) 2021-12-06 20:00:16 +03:00
Alexander Polyankin
e167014370 Remove flow from hoc (#19213) 2021-12-06 19:59:21 +03:00
Alexander Polyankin
713952561b Remove flow from entities (#19212) 2021-12-06 19:59:11 +03:00
Alexander Polyankin
98dd210f2f Remove flow from dashboard (#19211) 2021-12-06 19:58:58 +03:00
Alexander Polyankin
e8d1a6040b Remove flow from containers (#19210) 2021-12-06 19:57:42 +03:00
Alexander Polyankin
001aeedc1f Remove flow from components (#19209) 2021-12-06 19:55:46 +03:00
Alexander Polyankin
4df22f934d Remove flow from admin (#19208) 2021-12-06 19:54:23 +03:00
Alexander Lesnenko
a50fd9b898 fix miscalculation of y ticks width (#19195) 2021-12-06 14:31:14 +03:00
Alexander Polyankin
915f577534 Change homepage sections for activation (#19162) 2021-12-06 13:48:02 +03:00
Alexander Lesnenko
99a002f898 fix rendering of the progress bar static viz without a grouping separator (#19196) 2021-12-04 10:51:26 +04:00
Ariya Hidayat
20b3dcb2e9 Custom expression: improve the type-checker (#19187)
Use an improved semantic validation layered on top of the existing
resolver (around ~40 LoC) instead of its own dedicated logic
(~240 LoC).  Not only the improved type-checker is leaner and faster,
it's also more accurate in some corner cases.
The type-checking process is also deferred to the compilation stage,
instead of earlier in the parsing stage.
2021-12-03 15:18:48 -08:00
Jeff Evans
f8d712d6e1 Secrets 🔐 PR 7 - Enable Postgres driver to use secrets for configuring SSL parameters (#18968)
* Enable Postgres driver to use secrets for configuring SSL parameters

Adding secret related properties for SSL options to Postgres driver

Move `conn-props->secret-props-by-name` to secret.clj since it's needed directly there, too

Add `us-east-2-bundle.pem` to `test-resources/certificates` for testing Postgres with SSL connectivity to our RDS instance (and a README.md explaining how it differs from the existing `ssl` directory)

Updating `value->file!` to have better logic for building the error message when the existing file is not found (for better UX from the Database admin page)

Updating frontend to support the `visible-if` value being an array, in which case any value may match the current details value, in order for that field to be visible

Adding secret related properties for SSL options to Postgres driver

Updating CircleCI config.yml to refer to the RDS instance when running Postgres SSL test

Implement server side expansion of transitive visible-if dependency chain

Update shouldShowEngineProvidedField on client to consider multiple key/value pairs in the visible-if map, and only show the field if ALL are true

Adding new test to confirm transitive visible-if resolution, and cycle detection

Add Cypress test for SSL field visibility
2021-12-03 16:38:55 -06:00
Noah Moss
5460e4b983 Ensure dashcard order is deterministic in dashboard subscription tests (#19199) 2021-12-03 17:28:04 -05:00
Maz Ameli
1d900799b4 Datasets educational modal restyling (#19168)
* restyle the dataset education modal

* restructure the modal code and styling

* add t tags to strings
2021-12-03 14:10:02 -08:00
Dalton
252fa25c5e Add TippyPopover component (#19042)
* move Popover to subfolder

* Add TippyPopover component

* Add popover theme styling

* Add/use EventSandbox component

* make TippyPopover lazy

* improve demo page

* add unit tests for TippyPopover

* let most defaulted props be overridable

* rename cypress helper fn

* clean up .info example
2021-12-03 12:48:00 -08:00
Noah Moss
efab1e44f5 Snowplow backend integration (#18784) 2021-12-03 12:53:10 -05:00
Kyle Doherty
c869d9202d update about copy to reflect the real world (#19163) 2021-12-03 11:13:16 -05:00
Noah Moss
79fc7f9281 Add cloud-ip-address-info to DB connection config (#19147) 2021-12-03 10:37:59 -05:00
Noah Moss
f1606cb2bd Fix LDAP port validation and add LDAP API tests (#19185) 2021-12-03 10:37:35 -05:00
Anton Kulyk
7fc4fc7c37 Hide collections without datasets in dataset picker (#19153)
* Add tests for buildCollectionTree

* Rename test objects for better readability

* Allow filtering collection tree items by models

* Hide collections without datasets in dataset picker

* Keep parent nodes if they don't have target models
2021-12-03 12:04:50 +02:00
Cam Saul
be0dc4e671 Require data permissions to set parameter mappings (#19130)
* Require data permissions to set parameter mappings

* Impl for sandboxed permissions

* Allow updating dashboard if parameters haven't changed; more tests

* Fix premature i18n lookups
2021-12-02 20:32:50 -08:00
Cam Saul
563c5ba790 Make sure API response streaming context helpers preserve dynamic variables (#19169) 2021-12-02 15:42:37 -08:00
Cam Saul
42ad315180 Block permissions should require the :advanced-permissions feature (#19132) 2021-12-02 15:42:20 -08:00
Jeff Evans
17c3f73936 Fix google-api-client version from google driver (#19176)
* Fix google-api-client version from google driver

Update google-api-client version `1.30.7` -> `1.32.1`, so that `google-http-client` ends up as `1.39.2` to match the other drivers

Add explicit `google-http-client-jackson2` dependency for google driver since it's no longer included transitively for some strange reason, but the `:google` driver itself directly uses it

Add new CircleCI test run for multiple Google related drivers (to ensure there aren't cross-driver classpath issues)
2021-12-02 15:40:05 -06:00
Tieu Philippe KHIM
89ffe40608 Fix/mongo srv connection string (#19114)
Generate correct connection string when srv is defined, including `authDb`

Default `authDb` to `admin` if not set
2021-12-02 15:33:40 -06:00
frannietrempe
2bf3b4283d Added test email steps; minor reorganizing (#19183)
* Added test email steps; minor reorganizing

* Update docs/troubleshooting-guide/cant-send-email.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-12-02 15:53:10 -05:00
Howon Lee
98b82c4eb2 Funnel static viz BE (#19172)
Static viz for funnel plots. Pursuant to #18676.
2021-12-02 12:26:57 -08:00
Jeff Evans
31a3d361c2 A truststore is still a keystore (#19178) 2021-12-02 13:32:59 -06:00
Anton Kulyk
40bf56981b Dataset query editor (#19103)
* Pass real dataset instance to QB components

* Add basic support for "dataset" QB mode

* Add simple DatasetEditor page

* Fix dataset editor turns into ad-hoc mode on any change

* Navigate back from the editor

* Use `getQuestion` selector for datasets too

* Allow removing "Visualize" button from Notebook

* Allow hiding native query editor's parameters list

* Add `isInitiallyOpen` prop to native query editor

* Add "Edit query" button to question sidebar

* Add ResizableNotebook component

* Add query editor to dataset editor

* Fix native dataset updates change QB mode to "view"

* Hide NavBar on dataset editor page

* Add ability to save updated dataset query

* Extend Cypress helper to create native datasets

* Add E2E tests for dataset query editor

* Use ActionButton for "Save changes" button

* Reset query changes on "Cancel" button click

* Move DatasetEditor to QB components

* Fix QB selectors unit tests

* Test `getIsResultsDirty` tests for datasets

* Test `getQuestion` QB selector

* Lock dataset display to table in editor

* Allow to disable visualization click handlers

* Disable table click actions for dataset editor

* Fix can't open native query sidebars

* Remove not used component

* Fix scroll effect when resizing notebook

* Fix "back" button behavior

* Fix missing translation

* Fix template tags assignment in dataset QB mode
2021-12-02 16:32:05 +02:00
Noah Moss
36fe84c432 Expand GeoJSON validation to all link-local addresses (#19164) 2021-12-01 20:09:29 -05:00
Ariya Hidayat
a287a4fb97 Fix type-checking with COALESCE (#19157) 2021-12-01 15:07:33 -08:00
Jeff Evans
78ca34713a Bump connection-pool version (#19064)
Bump metabase/connection-pool version from 1.1.1 to 1.2.0 to get the updated c3p0 version (0.9.5.5)
2021-12-01 16:07:40 -06:00
dpsutton
04ed8d32ba Datasets collection tree archived fix (#19156)
* Only annotate collection tree with unarchived information

* Update docstring of api to include here and below info
2021-12-01 11:49:44 -06:00
Jeff Bruemmer
451b7893bb docs - small formatting changes (#19144) 2021-12-01 12:10:33 -05:00
Alexander Lesnenko
a79c601db5 Sort static viz data (#19149) 2021-12-01 15:53:06 +04:00
frannietrempe
fa94477d41 docs - new field types page; delete database basics (#19126) 2021-11-30 16:47:28 -05:00
Ariya Hidayat
0b43e4d879 Remove unused parseOperators() (#19137) 2021-11-30 12:12:14 -08:00
Jeff Bruemmer
adc895fcec remove errant redirect (#19125) 2021-11-30 11:57:55 -05:00
Jeff Evans
4137054d6f Limit autocomplete results for tables and fields (#19066)
* Limit autocomplete results for tables and fields

Add limit of 50 total fields or tables returned from the autocomplete_suggestions API, which can be a mixture of tables and/or fields

Adding test that confirms results are limited properly
2021-11-30 08:52:52 -06:00
Alexander Lesnenko
d59ff667fc Implement funnel chart renderer (#19106)
* add funnel static viz

* prettier

* support funnel formatting options, change measureText signature

* fix tests

* fix types

* unhardcode legend text style

* decrease static funnel step font size, fix warnings

* update specs
2021-11-30 18:46:22 +04:00
Alexander Lesnenko
c2dfd8d440 upgrade deps with vulnerabilities (#19128) 2021-11-30 17:27:36 +04:00
Ariya Hidayat
8ea40b69b4 Custom expression: use an improved field resolver (#19100)
Field references in custom expression must be correctly resolved as
dimensions, segments, or metrics. For instance, `[Rating] > 4 AND
[Expensive]` means that [Rating] is a dimension and [Expensive] is a
segment.

Before this change, this process was carried out inside the parser. This
led to various corner cases which were not handled well, e.g.
`COALESCE(CASE([X], [Y]))` apparently resolved both [X] and [Y] as
dimensions. This was incorrect, as [X] has to be a segment, since it's
part of the conditional clause in CASE().

With this change, all field references are resolved as an additional
pass. Thus, the resolver has the full visibility of the operand types
for both unary and binary operators, as well as argument types of all
functions, including variadic ones such as CONCAT, COALESCE, and CASE.
2021-11-29 17:37:42 -08:00
Ariya Hidayat
54550299a7 interval function: lossless conversion between GUI and MBQL (#19095) 2021-11-29 14:30:59 -08:00
Ariya Hidayat
a8a5846124 CI with GitHub Actions: Bump timeout (#19127) 2021-11-29 14:02:02 -08:00
Alexander Polyankin
183b245a52 Fix pivot tables with missing pivot columns (#19116) 2021-11-29 21:30:08 +03:00
Alexander Polyankin
0046bb64a2 Update driver icons (#19115) 2021-11-29 21:29:44 +03:00
Noah Moss
b4ecfc7cae Drop invalid column refs when normalizing viz settings (#19075) 2021-11-29 11:13:12 -05:00
Alexander Polyankin
a3c5fe04d0 Simplify additional options in set up flow db configuration (#19058) 2021-11-29 16:35:26 +03:00
Alexander Polyankin
eb0d21aafe Add storybook (#19083) 2021-11-29 14:54:21 +03:00
Howon Lee
85db2cdc30 Progress bar static viz BE bits (#18945)
BE for progress bar for static viz, sasha put in the FE bits a bit ago
2021-11-28 17:47:02 -08:00
Alexander Lesnenko
60889e09d4 Static multi-series Line/Area/Bar chart (#19019)
* XYChart

* support axes formatting, support negative values for bars and areas

* calculate chart bounds based on axes presence, ticks sizes

* Add legend

* legend for single column, more examples

* polish, unit tests

* clean mess

* fix XYChart renders bars with the same names, add demo for an edge case

* goal line support

prettier

* legend folder rename
2021-11-27 17:28:16 +04:00
Alexander Lesnenko
2c71ebfcb6 show trend previous value in full-screen mode (#19109)
* show trend previous value in full-screen mode

* remove unused variable
2021-11-27 01:56:20 +04:00
Anton Kulyk
f0df2e1e17 Simple mode for native datasets (#19102)
* Add E2E test for native dataset view

* Use simple mode for native datasets
2021-11-26 18:20:16 +02:00
Alexander Polyankin
187ef00be5 Remove unneeded driver deprecation messages (#19084) 2021-11-26 18:49:44 +03:00
Anton Kulyk
0250b0a31d Update dataset simple mode implementation (#19101) 2021-11-26 15:26:55 +02:00
Anton Kulyk
6bef464f91 Add "radio" form widget (#19104) 2021-11-26 15:26:31 +02:00
Alexander Polyankin
bb95c115a0 Fix analytics settings (#19091) 2021-11-25 14:18:20 +03:00
Ariya Hidayat
fc57651b7c Fuzz the parser with CASE and COALESCE functions (#19068) 2021-11-24 17:22:10 -08:00
frannietrempe
ba80c2624b Remove data types section and minor reorganization (#19089) 2021-11-24 15:21:08 -05:00
Alexander Lesnenko
3854c56a0a update prettier for Typescript (#18778)
* update prettier

* run prettier
2021-11-24 23:34:46 +04:00
Ngoc Khuat
1d05eb9487 add support expression for time-interval clause (#19054) 2021-11-24 06:58:30 +07:00
Noah Moss
9173259d29 Validate suffix & strip whitespace from Google auth client id (#19036) 2021-11-23 18:23:06 -05:00
Jeff Evans
e0f62af1f5 Harmonize Google dependency versions (#19059)
Update bigquery and googleanalytics drivers dependencies to newer versions, such that their transitive dependencies on google-api-client/google-http-client match the versions used in the new BigQuery driver
2021-11-23 17:10:19 -06:00
Cam Saul
01af58e482 Add index on QueryExecution card_id + started_at (#19065)
* Add index on QueryExecution card_id + started_at

* Migrations linter shouldn't disallow legacymigrations > 382

* Remove old test
2021-11-23 14:40:14 -08:00
Noah Moss
f9aef5cbd2 Add ga-enabled setting (#19077) 2021-11-23 16:52:12 -05:00
Cam Saul
0e82065527 New dashboard query endpoints and consolidate Dashboard API/Public/Embed parameter resolution code (#18994)
* Code cleanup

* Make the linters happy

* Add pivot version of the new endpoints

* implement usage of the new dashboard card query endpoint (#19012)

* add new endpoints to services.js

* replace CardApi.query with the new endpoint + pass dashboardId

* add parameter id to parameter object found on query body

* run dashchards using card query endpoint when they're new/unsaved on dashboard

* Update endpoint references in e2e tests

* Remove count check from e2e test

We can make sure a double-mapped parameter filter shows results from
both fields, but unfortunately with the new endpoint, the results don't
seem to work anymore. I think that's OK? Maybe?

* skip corrupted filters test

the query endpoint now results in a 500 error caused by a schema
mismatch

* fix a few e2e intercepted request mismatches

* unskip filter corruption test and remove the part that no longer works

Co-authored-by: Dalton <daltojohnso@users.noreply.github.com>
2021-11-23 13:47:16 -08:00
Noah Moss
b51cf24867 Add snowplow-enabled setting (#19074) 2021-11-23 14:53:55 -05:00
Alexander Polyankin
8efdc6498c Add snowplow CI (#19040) 2021-11-23 22:06:14 +03:00
Maz Ameli
add40bbd1e new lock icon, and remove unused outlined lock icon (#19026) 2021-11-23 09:00:14 -08:00
Jeff Bruemmer
0c8912cec7 update link (#19072) 2021-11-23 09:50:21 -05:00
Alexander Polyankin
814d38f1d7 Add default value for webpack bundle to prevent errors (#18916) 2021-11-23 14:13:00 +03:00
Noah Moss
7110c31732 Add snowplow-available and snowplow-url settings (#19060) 2021-11-22 17:06:58 -05:00
Noah Moss
73062d030b Mock site-name setting in dashboard subscription tests (#19050) 2021-11-22 16:48:00 -05:00
dpsutton
2f2d66bfe7 Remove errant tap>s (#19047) 2021-11-22 15:25:26 -06:00
Alexander Polyankin
6c83c8a288 Fix sorting and add tests (#19045) 2021-11-22 21:32:43 +03:00
Dalton
dec0d84a50 fix chart tooltip isOpen boolean evaluation (#19052) 2021-11-22 09:37:30 -08:00
Anton Kulyk
008ea7bf4a Use /dataset URLs for datasets (#19032)
* Use /dataset URL for datasets

* Show 404 when opening a question with dataset path

* Add E2E tests

* Fix URL change when changing dataset status
2021-11-22 11:35:03 +02:00
Ariya Hidayat
a6056bd6b1 Custom expression suggestion: tackle a dangling single/double quote (#19033)
If the expression is invalid due to an unterminated string (perhaps the
user is still not finished typing the expression), do not try to suggest
possible matches (functions etc) for an identifier following that
dangling quote.
2021-11-19 15:40:06 -08:00
Ariya Hidayat
e46db354c8 Custom expression suggestion: don't highlight too many characters (#19024) 2021-11-19 15:39:24 -08:00
Alexander Lesnenko
c29ee0fd97 fix funnels with zero initial step (#19030) 2021-11-19 23:44:55 +04:00
Anton Kulyk
6e683cdb4f Remove accidentaly commited files (#19043) 2021-11-19 12:38:39 +02:00
Anton Kulyk
69ac8ffbb2 Simple mode for datasets, update dataset headers (#18993) 2021-11-18 21:31:24 +02:00
Dalton
80d81a10c3 Reimplement tooltips using tippy.js (#18880)
* add tippy and react-is

* add tippy styles to vendor.css

we'll probably override most things but it handles
apply the triangle to tooltips

* reimplement Tooltip using tippy

* reimplement ChartTooltip using Tooltip

* add tooltip theme styling

* fix StoreLink styling

* remove TooltipPopover

* add util for easy mapping to innerRef

* use innerRef util with StoreLink target

* react-is type defs

* convert Tooltip into tsx

* convert styled-components util into typescript

* fix Tooltip fallback return

* use Tooltip in Icon over Tooltipify

* remove Tooltipify

* pass ref all the way through Icon

* fix DimensionListItem styling caused by missing ref

* fix ChartTooltip event target bug

* fix unit test by making Icon.tsx grosser

* replace popover() util with tooltip() in cy tests

* fix random broken e2e test

* improve types in Tooltip

* move everything to a separate folder + add tests

* add more examples

* rmv accidental deps

* fix run button styling

* add Link tooltip prop to avoid tooltip on icon

* wrap MetabotLogo in forwardRef

* support reduced motion

* remove flow type from dom.js so we can use in ts files

* pass isEnabled prop to tippy's disabled prop

once you've activated "control mode" in tippy you can't turn it off so
using "visible" as a toggle doesn't work. instead, use disabled.

* fix uncentered tooltip the right way

tippy includes padding/margin in its centering calculations, unlike
tether, so we will need to be careful about adding one-sides
padding/margins to a tooltip target, otherwise the tooltip will appear
offcenter

* workaround for absolutely positioned element

the tooltip appeared on the far end of the target because of a child div
that is absolutely positioned. quick fix is to instead target the icon

* fix positioning of HintIcon tooltip

* lint fix

* add placement prop

* fix styled component tooltip target styling

* place QuestionNotebookButton tooltip below

* Make the NativeQueryButton an actual button

* set tooltip placement to bottom

* lint fix warning
2021-11-18 09:30:02 -08:00
Dalton
c7c4975bac Use filesystem caching in webpack (#19022)
* enable webpack caching

* only enable in devMode

* invalidate cache when build deps change
2021-11-18 09:28:39 -08:00
Anton Kulyk
3047ba70e1 Adding collection items from collection page (#19009) 2021-11-18 15:31:49 +02:00
Anton Kulyk
9e026ac04b Display datasets in recent searches and on activity page (#18987)
* Display dataset model name in recent searches

* Fix dataset URLs in activity

* Fix icons in activity recent views

* Distinguish datesets from questions in activity

* Fix message
2021-11-18 09:19:37 +02:00
dpsutton
0a83bd3c78 Add fixture warning to rebuild static viz on failures (#18995)
Had wanted to make a heuristic that would look at timestamp of the
bundle and timestamps of the sources and compare. But this could fail
when switching branches. Simpler and easier to just throw a warning on
all failures

```clojure
js-svg-test=> (binding [*test-out* *out*] (run-tests))

Testing metabase.pulse.render.js-svg-test

FAIL in (foo) (js_svg_test.clj:28)
[PRO TIP] If this test fails, you may need to rebuild the bundle with `yarn build-static-viz`

expected: 1
  actual: 2
    diff: - 1
          + 2

Ran 8 tests containing 29 assertions.
1 failures, 0 errors.
{:test 8, :pass 28, :fail 1, :error 0, :type :summary}
```

For posterity, attempt using timestamps was

```clojure
(deftest bundle-up-to-date-test
  (let [js-bundle (io/file (io/resource js-svg/bundle-path))
        to-date   (fn [epoch] (java.time.Instant/ofEpochMilli epoch))]
    (is (.exists js-bundle) bundle-recreate-warning)
    (when (.exists js-bundle)
      (let [source-files       (file-seq (io/file "frontend/src/metabase/static-viz"))
            most-recent-source (apply max-key #(.lastModified %) source-files)]
        (is (.isAfter (to-date (.lastModified js-bundle))
                      (to-date (.lastModified most-recent-source)))
            bundle-recreate-warning)))))
```
2021-11-17 19:58:11 -06:00
dpsutton
b51d178878 Fix flaky email tests (#19023)
Docstring for `regex-email-bodies` states:

> "Return messages in the fake inbox whose body matches the
regex(es). The body will be replaced by a map with the stringified regex
as it's key and a boolean indicated that the regex returned results."

But it does ont return messages in the fake inbox whose body matches any
of the regex. It returns them all regardless, with information if they
match or not. Simply correct this behavior to match the docstring

```clojure
{"rasta@metabase.com"
 ({:from "notifications@metabase.com",
   :to #{"rasta@metabase.com"},
   :subject "We've Noticed a New Metabase Login, Rasta",
   :body {"https://metabase.com/testmb" false, "has any results" false, "My question" false}}
  {:from "notifications@metabase.com",
   :to #{"rasta@metabase.com"},
   :subject "We've Noticed a New Metabase Login, Rasta",
   :body {"https://metabase.com/testmb" false, "has any results" false, "My question" false}}
  {:from "notifications@metabase.com",
   :to #{"rasta@metabase.com"},
   :subject "You set up an alert",
   :body {"https://metabase.com/testmb" true, "has any results" true, "My question" true}})}
```
2021-11-17 17:38:20 -06:00
Jeff Evans
0480c2cc53 Secrets 🔐 PR 6 - Update Oracle properties (#18320)
* Add SSL keystore and truststore secret properties to Oracle driver YAML files


Update Oracle driver to set keystore and truststore connection options from secret values

Adding new `select-keys-sequentially` helper function for dealing with assertions on transformed conn props

Add new function to the secret namespace to return a lighter weight "secret map", and remove that functionality from the `handle-db-details-secret-prop!`, so that it can be reused from connection testing

Modifying CircleCI to set the corresponding truststore secret conn prop vars instead of JVM-level truststore settings, as the test had been doing previously

Expand Oracle test connection details to incorporate all SSL related properties, and also make it a function instead of delayed def (so changes can be picked up later)

Misc. fixes in Oracle driver YAML files

Update `exception-classes-not-to-retry` to include SSLHandshakeException

Fix misc issues in secret and database model code

Update CircleCI config to use correct secret based env var keys and values

Add *database-name-override* dynamic var in `metabase.test.data.interface` to allow for DB name overriding

Fix up ssl connectivity test so all parts pass successfully

Get rid of crazy with-redefs to swap in the existing test-data's schema, and instead, just dropping the DB if it was created under a different schema (similar to what H2 does)

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
2021-11-17 15:45:03 -06:00
frannietrempe
fa7b5ffc93 Docs – jar install page and getCallerClass error (#19018)
* added links and edited headings

* documented getCallerClass error

* Added create directory section

* Wording and spacing edits per Jeff feedback

* Fixing error in ToC from last commit

* punctuation and spacing

Co-authored-by: ft-metabase <ft-metabase@ft-metabases-MacBook-Pro.local>
Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-11-17 16:16:06 -05:00
Alexander Polyankin
afb9a03912 Track new question creation (#19007) 2021-11-17 21:24:49 +03:00
Ariya Hidayat
064d815e99 Fuzz the parser of custom expression (#18942) 2021-11-16 15:58:49 -08:00
Dalton
2d5766a89f add BooleanPicker component (#18950)
* add BooleanPicker component

* add BooleanPicker unit test

* fix typo

* fix bool filter cy tests

* fix button styling

* remove 'admin' colorScheme and tweak design a lil
2021-11-16 09:54:42 -08:00
Dalton
4afdb6bb44 Fix issue with moment locale not working (#18943)
* add fn that maps from our locale string to moment's

* use moment with locales

* add a require for the specific locale

* don't require en

* ensure locale is lowercased for moment more generally

* default locale to a string
2021-11-16 09:54:22 -08:00
Maz Ameli
68a8a0315a new archive and unarchive icons (#19004) 2021-11-16 09:51:50 -08:00
Maz Ameli
2d729f9360 new folder icon (#19001) 2021-11-16 08:43:56 -08:00
Alexander Polyankin
6ff5ad66ca Show inactive tables in database & table pickers in the query builder (#18717) 2021-11-16 12:02:40 +03:00
Alexander Polyankin
5333f09ab8 Put new dashboards in edit mode (#18990) 2021-11-16 12:01:24 +03:00
Alexander Polyankin
f8e6d9e303 Open in a new tab on ctrl key (#18985) 2021-11-16 12:00:23 +03:00
Cam Saul
71ee1ea27b New logging utility functions for REPL usage (#18859)
* New logging utility functions for REPL usage

* Test fix 🔧

* Add support for `:off` and `:fatal` levels.

* Remove NOCOMMIT
2021-11-15 14:16:00 -08:00
Dalton
54c88b046a add quarters to qb date options (#18970) 2021-11-15 14:09:17 -08:00
Alexander Polyankin
f2f8d227b5 Elevate database engines in setup (#18949) 2021-11-15 20:13:57 +03:00
john-metabase
61c30c08d6 Move initial user setup from hash data to env var plus token (#18763) 2021-11-15 19:57:04 +03:00
dpsutton
c64ef9096f Dataset recent activity (#18967)
* Get rid of the n-queries

old logic: select last view logs, and then for each one, select its
associated model (card, table, etc).

new logic: get the last view logs, and do three batch queries, one each
to card, dashboard, table, for the ids from the view logs

* Mark datasets in api/activity/recent_views

* Get rid of `(db/delete! Activity)` in tests

* Handle datasets in activity list
2021-11-15 10:42:43 -06:00
Alexander Lesnenko
0a8eaab349 Suppress bundle size warnings for the static visualizations bundle (#18991) 2021-11-15 20:24:12 +04:00
Ariya Hidayat
449d5d3bcb Custom expression tokenizer: rewind on an unterminated string literal (#18969) 2021-11-15 07:41:17 -08:00
Alexander Polyankin
b334ccd603 Show inactive tables in search results & recent items (#18743) 2021-11-15 18:15:15 +03:00
Howon Lee
3fdf8e0dd9 Static viz waterfall, including backend bits (#18915)
Static viz waterfall needs BE bits. Here are the BE bits. Color and total summation coming...
2021-11-15 06:00:30 -08:00
Alexander Lesnenko
064ccff804 add show total setting to the waterfall static viz (#18989)
* add show total setting to the waterfall static viz

* specs
2021-11-15 17:38:28 +04:00
Alexander Polyankin
c2b4e01913 Add firewall info block when connecting to a database on Metabase Cloud (#18671) 2021-11-15 16:23:24 +03:00
Anton Kulyk
88cc45c4e7 Cleanup QuestionDataSource and fix breadcrumb links issues (#18962)
* Remove not used `noLink` prop

* Namespace URL generators

* Fix HeaderBreadcrumbs font-size in "head" mode

* Add unit-tests for QuestionDataSource

* Allow using react nodes in breadcrumbs

* Use func declaration for QuestionDataSource

* Add prop-types

* Simplify query assignment expr

* Don't swallow errors in QuestionDataSource tests

* Add repro for #17961 (unit)

* Allow passing custom divider for HeaderBreadcrumbs

* Fix join tables breadcrumb links

* Add extra saved question utils

* Add tests for nested questions

* Fix source question link

* Don't show source question's schema

* Fix breadcrumb colors

* Fix tests

* Fix breadcrumb colors

* Use saved-questions lib utils for DataSelector
2021-11-15 15:12:29 +02:00
Pawit Pornkitprasan
1593064acb Disable all pivot tests on redshift (#18979) 2021-11-15 16:05:16 +07:00
Alexander Polyankin
ad0f099d25 Fix sending a test subscription with non-default parameters (#18965) 2021-11-15 12:01:50 +03:00
Dalton
d32a252d46 pass 'noEvent' api option to prevent unauthed event (#18920)
* pass 'noEvent' api option to prevent unauthed event

* unskip repro
2021-11-12 12:19:39 -08:00
Dalton
e07909e197 add TableLabel and TableInfo components (#18940) 2021-11-12 12:19:18 -08:00
Jeff Bruemmer
e87127d36c docs - update sql parameter page (#18934)
* update sql parameter page

* Flamber edits

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* revisions

* add mongo example

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-11-12 09:31:00 -08:00
Noah Moss
4879f8740f Add cloud-gateway-ips setting (#18931) 2021-11-12 12:29:12 -05:00
Alexander Polyankin
3721a1e304 Fix clicking on a legend item in the query builder on unsaved question (#18790) 2021-11-12 19:44:26 +03:00
Noah Moss
db36fc2830 Put migrations in correct order to fix check-migrations script in CI (#18959) 2021-11-12 11:35:46 -05:00
Alexander Polyankin
de071e7f93 Show inactive tables in data browser (#18699) 2021-11-12 15:54:54 +03:00
Jeff Evans
6a40ee3800 Change query_cache.results column to correct blob type (#18848)
* Change query_cache.results column to correct blob type

Add Liquibase changeSet to modifyDataType of query_cache.results to ${blob.type} (an idempotent operation on most DBs)

Add schema migrations test to confirm, which simulates the broken app DB state, then runs the migration, then confirms the fixed type
2021-11-11 13:38:22 -06:00
Dalton
11cf75d773 update postcss deps (#18860)
* update postcss deps

* update the postcss config

* replace color fn with color-mod fn

* remove webpack-postcss-tools

* fix postcss config

* fix negated vars
2021-11-11 09:54:30 -08:00
dpsutton
1c70882be8 Map tiles improvements (#18912)
* Speed up interger or string recognition

jeff helpfully pointed this out. I did some repl benchmarks

```clojure
(comment
  (doseq [x ["3" "bob"]]
    (dotimes [_ 3] (time (dotimes [_ 10000] (try (Integer/parseInt x)
                                                  (catch NumberFormatException _ x))))))
  (doseq [x ["3" "bob"]]
    (dotimes [_ 3] (time (dotimes [_ 10000] (if (re-matches #"\d+" x)
                                              (Integer/parseInt x)
                                              x))))))

tiles-test=> (doseq [x ["3" "bob"]]
               (dotimes [_ 3] (time (dotimes [_ 10000] (try (Integer/parseInt x)
                                                            (catch NumberFormatException _ x))))))
"Elapsed time: 5.72825 msecs"
"Elapsed time: 1.531042 msecs"
"Elapsed time: 0.797041 msecs"
"Elapsed time: 32.120875 msecs"
"Elapsed time: 27.848375 msecs"
"Elapsed time: 23.820542 msecs"
nil
tiles-test=> (doseq [x ["3" "bob"]]
               (dotimes [_ 3] (time (dotimes [_ 10000] (if (re-matches #"\d+" x)
                                                         (Integer/parseInt x)
                                                         x)))))
"Elapsed time: 5.356417 msecs"
"Elapsed time: 1.97225 msecs"
"Elapsed time: 1.868708 msecs"
"Elapsed time: 1.214666 msecs"
"Elapsed time: 1.185625 msecs"
"Elapsed time: 1.19025 msecs"
nil
tiles-test=>
```

* Only select lat/lon fields in api/tiles

We required the index of lat and long columns, ran the whole query, and
then just grabbed those columns in a `(for [row rows] [(nth row
lat-idx)..])`. But of course we can just update the fields we want to
select in the query.

MBQL and native queries flow through this codepath depending on the
source of the query of the card being mapped. For mbql queries, it is
straightforward, add a filter on the lat long and replace the fields
with just lat and long fields. For native, we nest the native query as a
nested query and then proceed on the resulting mbql query. The only
difference is requiring the type annotation for the field type.

mbql field: [:field 32 nil] vs [:field "latitude" {:base-type :type/Float}]

This addresses memory concerns. The query is not limited and we don't
need to select an entire row for these purposes. Dropping lots of text
fields, id fields, etc could save quite a bit of memory when resolving
the entire result set in memory.

* Add limit to number of coordinates per tile

these queries were unbounded in getting coordinates for each tile. But
in a visualization, can there really be more information provided? We
were leaving them unbounded and getting back millions of rows (reported
on #4844). So we were adding unnecessary detail at the price of OOM
errors.

Note tests have been changed to show that the limit of the original mbql
query is clobbered and the limit of the original native query is only
present in the nested query whereas the outer query selects its own
limit.

As always, should this number be exposed as a setting? Configurable in
the UI? Leaving as a hardcoded and documented number for the moment.

* docstring

* Remove col indices from api/tiles

since we just select the actual columns we want, we no longer need the
index in the results of those cols. they are always the first and second
columns

* Trim final slash on url
2021-11-11 09:33:40 -06:00
dpsutton
11d9bd558a Nest qbnewb under /modal to allow for other modals (#18926)
* Nest qbnewb under /modal to allow for other modals

move the api from api/user/:id/qbnewb -> api/user/:id/modal/qbnewb to
allow for the upcoming new dismissable modal

* Add additional datasetnewb route

staying with the same naming scheme as qbnewb. the db field is
is_datasetnewb, the route just takes datasetnewb.

I'm not wild about the default is true, set to false, and the naming
scheme. But will be easier to migrate and easier for FE to use if we
continue the defaults/logic etc.

* Remark on db change in migration file
2021-11-11 09:24:03 -06:00
Alexander Polyankin
2538046a30 Remove unneeded loading and error wrappers (#18947) 2021-11-11 16:21:30 +03:00
dpsutton
7890fead70 mark dataset queries in the qp (#18900) 2021-11-10 17:30:28 -06:00
Jeff Bruemmer
98bd28611f update link (#18937) 2021-11-10 16:15:35 -05:00
Jeff Evans
276118de36 Disable these tests for Redshift, since they are consistently failed with Out of Memory errors (#18935)
* pivot-parameter-dataset-test
* pivot-public-dashcard-test

Re-enable if/when #18834 is resolved
2021-11-10 14:23:54 -06:00
Ariya Hidayat
8c6ddd6a43 Custom expression editor: Press Tab to select (#18919) 2021-11-10 11:45:34 -08:00
Anton Kulyk
bc30e18d31 Skip JoinStep tests (#18929) 2021-11-10 17:38:46 +02:00
Ariya Hidayat
80e76d6ee6 Custom expression editor: use icons to distinguish the suggestions (#18744)
Co-authored-by: Maz Ameli <maz@metabase.com>
2021-11-09 20:29:22 -08:00
Alexander Lesnenko
8f10ae6d9f Implement waterfall static visualization (#18885)
* add waterfall static viz

* review fixes
2021-11-10 01:18:37 +04:00
Anton Kulyk
ab3d9be8e8 Update question header breadcrumbs (#18903)
* Slightly simplify QuestionDataSource

* Extract and cleanup HeaderBreadcrumbs

* Only keep database icon in breadcrumbs

* Fix object ID not shown in detail view

* Use `text-light` color for CollectionBadge

* Support icon name as a prop of Badge

* Add `inactiveColor` prop to Badge

* Unify head and subhead breadcrumb components

* Fix ad-hoc view items alignment

* Fix invalid CSS

* Use isStructured question method

* Fix filters display in adhoc question header

* Fix E2E selector

* Fix saved question filters alignment
2021-11-09 21:13:07 +02:00
Ariya Hidayat
44c4b919d2 GitHub Actions CI: split docs-triggered workflow (#18904) 2021-11-09 10:28:30 -08:00
Jeff Evans
13e9414b5e Secrets 🔐 PR 5 - Translate secret connection-properties into existing types understood by frontend (#18236)
* Translate secret connection-properties into existing types understood by frontend

For all :type :secret properties, before returning over the wire (i.e. from `available-drivers-info`), translate the connection-property into one or more new client side properties, using the existing types, to encapsulate the behavior of that individual secret "unit".  Depending on the :secret-kind and hosting environment, this could mean there are multiple additional properties injected (one for the file upload versus local path option field, one for the value itself on upload, and one for the file path)

Adding utility function to do the reverse (i.e. translating those client side properties back to the server secret property definition)

Adding tests for both (including updating secret-test-driver to cover all of these)

Add support for the treat-before-posting connection property config

* Fix bug in `delete-orphaned-secrets!`
2021-11-09 11:03:10 -06:00
Alexander Polyankin
7325197954 Show inactive tables in admin (#18732) 2021-11-09 14:47:52 +03:00
Anton Kulyk
b3a5c2b211 Extract DataSourceSelector (#18905) 2021-11-09 13:11:42 +02:00
Anton Kulyk
6bc2fb9fff Add ability to turn a dataset back into a question (#18873)
* Add `hasPlugin` check to moderation plugin

* Remove border from QuestionModerationSection

* Remove padding from question description

* Reorder imports and exports

* Remove not used prop

* Manage section border in the sidebar

* Add tests for question details sidebar

* Add basic dataset management section

* Add icon for dataset > question action

* Test dataset —> question change

* Add ability to turn a dataset into a question

* Use HTML buttons for dataset management

* Show question verification section

* Fix datasets e2e test helper

* Fix hover effect for dataset action buttons

* Fix question sidebar button alignment

* Use CSS to handle sidebar border
2021-11-09 12:46:08 +02:00
Pawit Pornkitprasan
6ee4e0dd2b Use SameSite=None for EMBEDDED_SESSION and DEVICE cookies (#18824)
* Use SameSite=None for EMBEDDED_SESSION and DEVICE cookies

 - EMBEDDED_SESSION previously did not specify SameSite attribute
   and assumed that the browser would default to SameSite=None, but
   recent browsers default to SameSite=Lax which does not work
   with cross-domain full-app embedding.
 - DEVICE was previously set to SameSite=Lax causing devices to not
   be remembered during login with cross-domain full-app embedding
   resulting in superfluous "We've Noticed a New Metabase Login"
   emails. Setting it to SameSite=None is safe because the cookie is
   not used to authenticate a user.

* Only print SameSite warning if not over https
2021-11-09 09:18:47 +07:00
Pawit Pornkitprasan
9b5aa4bc03 embed: call postMessage to "*" origin (#18838)
`embedding-app-origin` may contain multiple origins but postMessage
supports only a single origin, so we need to use `*` instead.

The risk should be very low because
 - the data we send is not sensitive data (frame size, current URL)
 - we are already using frame ancestor policy to limit domains that
   can embed Metabase
2021-11-09 09:06:59 +07:00
Jeff Evans
3ef50788a6 Update new BigQuery driver to only use project-id in qualified names if it differs from credentials (#18843)
* Update new BigQuery driver to only use project-id in qualified names if it differs from credentials

Add new key to db-details for :bigquery-cloud-sdk when a database is updated, called :project-id-from-credentials, and extract the project-id from the service account creds when the database is saved

Updating logic in bigquery-cloud-sdk QP to only include the project-id when qualifying an Identifier, if the project-id (override) value is set, and its value differs from the :project-id-from-credentials value mentioned above

Adding a test to confirm that a card query continues to work after changing the associated DB's driver from :bigquery to :bigquery-cloud-sdk

Change all syncs in the test to {:scan :schema} to speed them up (deeper level not needed)
2021-11-08 16:47:07 -06:00
Tomás Pinho
a620cb29f1 docs: reworks SAML group syncing parts to add example of mapping (#18216)
multiple user groups from Okta
2021-11-08 13:32:53 -08:00
Greg Wilson
3b5de2db81 Editing Google Analytics documentation (#17693)
* Added documentation on how to connect to Google Analytics

* Added section explaining how to enable Google Analytics API

* Reduced png size by 35 percent using optipng

* Update docs/administration-guide/databases/google-analytics.md

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

* Update docs/administration-guide/databases/google-analytics.md

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

* Update docs/administration-guide/databases/google-analytics.md

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

* Update docs/administration-guide/databases/google-analytics.md

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

* Update docs/administration-guide/databases/google-analytics.md

Co-authored-by: Damon P. Cortesi <d.lifehacker@gmail.com>

* Update docs/administration-guide/databases/google-analytics.md

Co-authored-by: Damon P. Cortesi <d.lifehacker@gmail.com>

* Removed reference to Google Analytics versions for API scopes

* Update docs/administration-guide/databases/google-analytics.md

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

* Editing the Google Analytics docs

Co-authored-by: Leandro Lamaison <leandro.lamaison@ank.app>
Co-authored-by: Leandro Lamaison <69637098+lama-ank@users.noreply.github.com>
Co-authored-by: Jeff Bruemmer <jeffbruemmer@gmail.com>
Co-authored-by: Damon P. Cortesi <d.lifehacker@gmail.com>
Co-authored-by: etoulas <etoulas@users.noreply.github.com>
2021-11-08 16:23:08 -05:00
Alexander Lesnenko
f1c5b787e8 Implement progress static visualization renderer (#18884)
* add progress static viz

* fix negative values, amend contract
2021-11-09 01:09:57 +04:00
Alexander Polyankin
08ffae653a Add list to reload function for entity polling (#18883) 2021-11-08 23:58:21 +03:00
Anton Kulyk
daf0b746fd Add "Datasets" search filter (#18878) 2021-11-08 20:13:35 +02:00
Jeff Evans
e50e167b46 Secrets 🔐 PR 4 - Add backend support for keystore type secrets (#17756)
* Add backend support for keystore type secrets

Adding code to handle keystore type secrets

Adding test code to create and verify a keystore through the secret DB roundtrip

Adding util fn to secret namespace for converting the value to file, and adding test for that
2021-11-08 11:14:52 -06:00
Alexander Polyankin
5cd729d32c Add syncing state snackbar & sample dataset modal (#18816) 2021-11-08 19:52:40 +03:00
Noah Moss
bdfd7833c4 Catch all exceptions when parsing strings as datetime values in XLSX exports (#18896) 2021-11-08 11:37:25 -05:00
Alexander Polyankin
7bf2e71d6b Track tracking permission changes (#18893) 2021-11-08 19:18:52 +03:00
Jeff Bruemmer
210948d332 remove outdated kubernetes page (#18892) 2021-11-08 10:18:44 -05:00
Anton Kulyk
9dad583769 Show verified and official statuses in data picker search (#18876)
* Support datasets in search

* Extend SearchResult not to be a link on demand

* Use common SearchResult component for data picker

* Wrap data picker search results in `li`

* Fix E2E test selector

* Fix E2E test selector
2021-11-08 13:50:39 +02:00
Anton Kulyk
14324392cc Fix data picker's bucket step look (#18869)
* Extract BaseSelectListItem component

* Remove redundant prop types

* Switch to custom SelectList for data bucket step

* Remove iconPosition prop from AccordionList

* Fix SelectListItem
2021-11-08 11:38:36 +02:00
Anton Kulyk
feeeb1f32a Add revision messages for datasets (#18875) 2021-11-08 11:37:38 +02:00
Dalton
dcc05a22c6 add DimensionInfo component (#18819)
* add DimensionInfo component

* reorder imports

* add a max height to the description

* add index.js
2021-11-06 01:03:39 -07:00
Dalton
1f83ecd3c5 simplify logic for checking if a parameter's fields are populated with values (#18721)
* simplify logic for checking if a parameter's fields are populated with values

* lint fix

* always define a fields array

* make sure fields is defaulted to array in template tag sidebar
2021-11-06 00:45:15 -07:00
Dalton
559c6f5356 add DimensionLabel ui component (#18796)
* add DimensionLabel ui component

add index.js

Update size

convert jsx to tsx

move logic from info file to unit test

go back to jsx

* replace IconWrapper with a styled(Icon)
2021-11-05 17:18:17 -07:00
Alexander Polyankin
8494390696 Add created at to instance analytics context (#18711) 2021-11-05 23:57:58 +03:00
Cam Saul
eda46e8332 with-temporary-setting-values should use Setting's getter to fetch orig value (#18861) 2021-11-05 10:50:41 -07:00
Cam Saul
d72e1918d5 Fix query->preprocessed when the query has cached results (#18858)
* Fix sandboxing when the source query gets cached

* Fix circular references
2021-11-05 10:21:47 -07:00
Noah Moss
3bf31a700a Add instance-creation setting for inclusion in Snowplow analytics (#18684) 2021-11-05 12:23:57 -04:00
Alexander Polyankin
62ea1333ae Add temporary defaults for initial_sync (#18868) 2021-11-05 18:31:22 +03:00
Anton Kulyk
4060c30ce1 Update undo toast look (#18854)
* Remove eslint comment

* Reorder imports

* Extract UndoList

* Use func declaration for DefaultMessage

* Remove class decorators

* Turn UndoListing into a func component

* Cleanup UndoListing

* Fix undo and dismiss

* Restyle UndoListing

* Fix Cypress test using undo toast
2021-11-05 16:01:48 +02:00
Ariya Hidayat
14177c7b37 Static hourglass indicator when reduced motion is preferred (#18847)
The rotating spinner is replaced by a static hourglass icon.
2021-11-05 06:49:31 -07:00
Alexander Lesnenko
e5a74bf39f fix permissions page race condition (#18863) 2021-11-05 15:29:37 +04:00
Anton Kulyk
28321b7d4c Undo turning a question info a dataset (#18855)
* Add an E2E test

* Undo turning a question into a dataset
2021-11-05 11:24:12 +02:00
Phil Brown
2181d8b2df Make jetty client SSL auth configurable (#13297)
Add :mb-jetty-ssl-client-auth boolean config key to require ssl client
auth when set.
2021-11-05 00:46:57 -07:00
Jeff Evans
a48e6a4b02 Don't qualify breakout field name for BigQuery when source is not from a table (#18772)
Add a new dynamic var - *source-query* - to sqp.qp to bind the current source-query, and bind that in the same place that *table-alias* is currently bound

Update bigquery-cloud-sqp qp implementation to check the sqp.qp/*source-query*, and only qualify the source query alias if the type of source query is a table (which is apparently required; see #15074)

Add test for #18742
2021-11-04 15:58:20 -05:00
Ariya Hidayat
8fc321aca3 CI with GitHub Action: run tokenizer fuzzing tests (#18841) 2021-11-04 12:35:09 -07:00
Anton Kulyk
8d8e472bc8 Refactor question ViewHeader component (#18827)
* Add basic tests for GUI question header

* Reorganise tests

* Add basic tests for native questions header

* Group saved question tests

* Test filters in question header

* Test "Started from ..." label

* Test refresh button

* Add useToggle hook

* Turn ViewHeader into a functional component

* Reorder imports

* Extract some components

* Extract ViewTitleHeader components

* Fix padding

* Extract visual components

* Fix backticks

* Fix padding

* Fix header items alignment

* Minor fix
2021-11-04 21:21:57 +02:00
Anton Kulyk
61bfcb85c0 Fix notebook editor crash when joining on a custom column (#18845)
* Add repro for #18818

* Fix date time field check in JoinStep
2021-11-04 20:53:03 +02:00
Alexander Polyankin
48e78559b9 Add special case for sample dataset exploration (#18832) 2021-11-04 21:18:31 +03:00
Jeff Bruemmer
4586f0812a bigquery + java notes (#18846) 2021-11-04 14:06:56 -04:00
dpsutton
d55ea82343 Handle api/tiles requests for native queries (#18810)
* Handle api/tiles requests for native queries

Ordinarily the api takes the source query and adds in a filter clause
for a region:

```clojure
{:database 19
 :query {:source-table 88
         :fields [[:field 562 nil]
                  [:field 574 nil]
                  [:field 576 nil]]
         :limit 2000}
 :type :query}

{:database 19
 :query {:source-table 88
         :fields [[:field 562 nil]
                  [:field 574 nil]
                  [:field 576 nil]]
         :limit 2000
         :filter [:inside
                  [:field 576 nil]
                  [:field 574 nil]
                  -40.97989944013222
                  -179.99999564141046
                  -66.51326189011354
                  -134.99999673105785]}
 :type :query
 :async? false}
```

But when native, this would break, for three different reasons:
- native queries don't necessarily (or possibly) know their field
ids. So the api request it would construct would have `undefined` in the
slot where the field-id would normally go. This would cause the route to
404 as it would fail to match the expected numeric part of the url
- just passing in the field name isn't suffiencient, because mbql cannot
natively use an mbql filter clause into a native snippet. We do this to
a limited extent with filters and substitution but this requires a
marker like `{{filter}}` placeholder for us to add the filter text.
- when using `[:field name ...]` type field references we need the
base-type of a field in order to construct a query.

So the solution:
- allow the route to take field ids or names
- if native, rewrite the query to be a nested query using the native
query as the source query. ie, "select name, lat, long from table" ->
"select source.* from (select name, lat, long from table) source" but in
mbql so we can add our fliter clause
- if a string name is passed in, annotate it with a base-type of
:type/Float since we are dealing with lats and longs.

A concern was that we need to include the source-metadata. I'm omitting
this because we are essentially "select * from nested" so we just take
what we want, and the route already expects the index of the lat and
long columns and then selects only those from the query results.

As it stands we end up with a working query but a log

```
2021-11-02 14:37:25,470 DEBUG middleware.log :: GET /api/tiles/2/1/1/latitude/longitude/1/2/ 200 47.3 ms (5 DB calls) App DB connections: 2/13 Jetty threads: 9/50 (2 idle, 0 queued) (128 total active threads) Queries in flight: 0 (0 queued); postgres DB 19 connections: 3/6 (0 threads blocked)
2021-11-02 14:37:25,474 WARN middleware.add-implicit-clauses :: Warning: cannot determine fields for an explicit `source-query` unless you also include `source-metadata`.
2021-11-02 14:37:25,490 WARN middleware.add-implicit-clauses :: Warning: cannot determine fields for an explicit `source-query` unless you also include `source-metadata`.
2021-11-02 14:37:25,501 DEBUG middleware.log :: GET /api/tiles/2/0/2/latitude/longitude/1/2/ 200 39.4 ms (5 DB calls) App DB connections: 1/13 Jetty threads: 8/50 (2 idle, 0 queued) (128 total active threads) Queries in flight: 0 (0 queued); postgres DB 19 connections: 2/6 (0 threads blocked)
```

It might be possible to suppress these logs when we are in a query
context of `:map-tiles`. Or we might be able to require the frontend to
send along the metadata to include in the query. I didn't do this yet
since it seems to work fine and it would just make the urls quite long
if there are lots of columns (and the metadata can get quite verbose).

```clojure
;; source query of the card
{:type :native
 :native {:query "select name, latitude, longitude from zomato limit 2000;"
          :template-tags {}}
 :database 19}

;; nest it into a source query
{:database 19
 :type :query
 :query {:source-query {:template-tags {}
                        :native "select name, latitude, longitude from zomato limit 2000;"}}}

;; add the `:inside` filter for the tile

{:database 19
 :type :query
 :query {:source-query {:template-tags {}
                        :native "select name, latitude, longitude from zomato limit 2000;"}
         :filter [:inside
                  [:field
                   "latitude"
                   {:base-type :type/Float}]
                  [:field
                   "longitude"
                   {:base-type :type/Float}]
                  0.0
                  89.99999782070523
                  -66.51326189011354
                  179.99999564141046]}
 :async? false}
```

* Add docstring and make function private

* url encode column names to api/tiles
2021-11-04 12:32:26 -05:00
dpsutton
cba582868b Annotate collection tree with datasets and cards (#18833)
* Annotate collection tree with datasets and cards

In order to know which collections have items of interest, they are
annotated with two new keys: `:here` and `:below`. These keys will have
a collection (in clojure a set, in js an array) which could contain
dataset and card, depending if they have those items "here" or in
collections below this node.

We include information about which subtrees are interesting so we know
to show or highlight those. We include information about which nodes
have interesting things versus which contain nodes which have things so
we can possibly implement drilldown in an intelligent manner.

ie

```
.
├── root
```

could expand automatically to

```
.
├── root
│   ├── collection
│   │   ├── collection that actually has items
```

without requiring someone to click on the intermediate collection which
has no items itself, just a collection with items.

http://localhost:3000/api/collection/tree?tree=true

```js
{
    "name": "super",
    "id": 154,
    "location": "/",
    "below": ["dataset"]  ;; indicates collections below have datasets
    "children": [{
        "name": "parent",
        "id": 155,
        "location": "/154/",
        "below": ["dataset"]  ;; indicates the same
        "children": [{
            "children": [],
            "slug": "contains",
            "name": "contains",
            "here": ["dataset"],  ;; this node has datasets
            "id": 157,
            "location": "/154/155/",
        }],

    }, {
        "children": [],
        "name": "sibling",
        "id": 156,
        "location": "/154/",
    }],
}
```

* docstring

* Alignment for readability
2021-11-04 12:15:45 -05:00
Jeff Evans
b461087789 Change all active TEXT columns in MySQL app DB to LONGTEXT (#18749)
* Change all active TEXT columns in MySQL app DB to LONGTEXT

Add new text.type Liquibase property to dynamically select the correct text type to use, per DB (which is LONGTEXT for MySQL), very similar to the existing blob.type one

Adding new migrations that update all existing app DB TEXT columns to LONGTEXT columns, only for mariadb/mysql

Update migrations linter to ensure no new text types get added, via a new predicate that searches for text types being added

Do the same logic for "blob" now (should be "${blob.type}"), update rule and test

Add test for migrations, that checks the new types, for all types in scope for this PR, to ensure that they have all been changed to their expected DB-specific type (either LONGTEXT for MySQL or TEXT/CLOB for others)

Updating a couple migrations to remove special casing that was originally done only for MySQL to simply make them universally "${text.type}", in order to unify behavior and reduce surprises going forward

Co-authored-by: Cam Saul <github@camsaul.com>
2021-11-04 12:00:12 -05:00
Alexander Polyankin
92213a238b Increase node memory limit for FE dev build (#18839) 2021-11-04 18:02:11 +03:00
Ariya Hidayat
c7d0aeb29b Disable run button's animation when reduced motion is preferred (#18831) 2021-11-04 07:45:29 -07:00
Jeff Bruemmer
fc31d2b8b3 docs - custom expressions (#18836) 2021-11-04 10:23:24 -04:00
Cam Saul
83de3e8672 Add NOT NULL constraint to Card.database_id; attempt to set database_id if possible (#18472)
* Drop long-unused Table.entity_name column

* Add NOT NULL constraint to Card.database_id

* Test fix 🔧

* Test fix 🔧

* Fix migration

* Add note about H2 shell to deps.edn

* Add new SQL migration to attempt to set database_id when unset

* Remove data migration that is now done in Liquibase land

* Oops, '$.database', not '$.database_id'

* Parse ints as signed rather than unsigned just to be safe (they *might* be -1337 if they're really broken)

* Don't run for H2

* Update comment

* Fix migration indentation

* Clean namespace

* Use new migration number.

* Use the new migration numbers

* Adopt new migration numbering scheme

* Fix comments

* Fix MySQL + MariaDB insanity

* Fix ID range validation

* Actually 382 is the last legacy ID

* Improved validation and tests

* Adopt the new-new migration ID format.

* Test fixes 🔧

* Fix merge

* Simplify precondition
2021-11-03 15:21:17 -07:00
Cam Saul
7d6146230f Add index to ModerationReview moderated_item_type + moderated_item_id (#18799)
* Revert changes from Jeff's PR

* Add index to ModerationReview moderated_item_type + moderated_item_id

* Add to 0.41.2 instead

* Require explicit index name for createIndex

* Move 41.2 migrations to after the 41.0 migrations

* Adopt new migration numbering scheme

* Fix comments

* Fix MySQL + MariaDB insanity

* Fix ID range validation

* Actually 382 is the last legacy ID

* Improved validation and tests

* Adopt the new-new migration ID format.

* Test fixes 🔧
2021-11-03 14:16:24 -07:00
Cam Saul
2fee04b772 Adopt new migration numbering scheme (#18821)
* Adopt new migration numbering scheme

* Fix comments

* Fix MySQL + MariaDB insanity

* Fix ID range validation

* Actually 382 is the last legacy ID

* Improved validation and tests

* Adopt the new-new migration ID format.

* Test fixes 🔧
2021-11-03 13:35:30 -07:00
Anton Kulyk
868f8782fe Update query builder data selector for datasets (#18764)
* Add unit tests for schema utils

* Add data bucket step to DataSelector

* Go to next steps from the data bucket step

* Add different type of AccordionList icons layout

* Add back navigation from 'Raw Data' tab

* Fix selecting a database in 'Raw Data'

* Enable search on data bucket step

* Only render data bucket step if there are datasets

* Prevent opening the data bucket step without datasets

* Update picker search placeholder text

* Update searchable models

* Fix displaying datasets in search results

* Hide "Saved Questions" in "Raw Data" tab

* Encode data in schema str

* Add ability to request dataset virtual tables

* Support datasets in SavedQuestionPicker

* Use saved question picker for datasets too

* Add E2E tests

* Show dataset icon in search results

* Fix E2E selectors

* Fix AccordionList icon rendering

* Fix dataset can't be selected in search

* Fix data selector step hydration

* Fix JoinStep unit tests

* Fix dataset icon size in picker view

* Fix schema picker without datasets

* Fix DataSelector tests

* Fix error about null data selector step

* Move schema utils to `metabase/lib`

* Fix questions don't appear in pickers after created

* Fix JoinStep unit tests

* Test can create a question based on a dataset

* Simplify schema ID parsing

* Fix typo

* Fix search models

* Fix ellipsis character

* Fix "Raw Data" button click area

* Remove temp comment

* Fix URL in personal collection contents request
2021-11-03 16:31:36 +02:00
Ariya Hidayat
f4217cf774 Do not bin numerical fields on join condition (#18800) 2021-11-03 07:15:35 -07:00
Anton Kulyk
b7cf663bae Add visual tests for table visualisation (#18826)
* Add visual tests for table visualisation

* Wait until spinner disappears
2021-11-03 14:35:43 +02:00
Cam Saul
cba9a8a0b9 Revert changes from Jeff's PR (#18798) 2021-11-02 18:18:38 -07:00
Ariya Hidayat
e7cf99c16e Disable menu transition if reduced motion is preferred (#18813) 2021-11-02 12:32:23 -07:00
Ariya Hidayat
d126e7492a Remove Mac App (#18811)
https://www.metabase.com/blog/Metabase-0.41/index.html
2021-11-02 11:06:09 -07:00
Dalton
bebaa0f7db improve support for variable type TemplateTagDimensions (#18795) 2021-11-02 10:00:22 -07:00
Dalton
00e4226b1a fix expression dimension failing to find underlying field (#18748)
* fix expression dimension failing to find underlying field

* add a repro
2021-11-02 10:00:10 -07:00
Dalton
f121d4d8bd Refactor the Parameters component and rename it to SyncedParametersList (#18683)
* move querystring-syncing logic to new hook

* rename <Parameters> to <SyncedParametersList>

* Remove syncQueryString prop

* remove unused 'query' prop

* remove 'isQB' prop

* remove ParametersWidget in favor of ParametersList handling empty parameters list

* Rely on value-populated parameters objects over parameterValues map

* remove unused pass-through prop 'vertical'

* make props passed from Dashboard to SyncedParametersList explicit

* Update name of component

* create a more generic hook for syncing the url query string
2021-11-02 09:59:50 -07:00
Alexander Lesnenko
49ef1f1072 mute ts warning in settings.ts (#18812) 2021-11-02 19:26:29 +03:00
Ariya Hidayat
cb02d4214d Bump the threshold for front-end coverage to 40% (#18809) 2021-11-02 08:37:16 -07:00
Ariya Hidayat
c1f06d62d0 Custom expression editor: decouple suggestions and diagnostics (#18773)
With the suggestions and highlighting being done through via lexical analysis
only, there is no need to run the computationally-expensive syntactical
analysis on every keystroke anymore. We only need to do that when the
user finishes the editing and wants to use the expression.
2021-11-02 07:27:09 -07:00
Anton Kulyk
7b4fb50f29 Fix image link click area (#18806) 2021-11-02 14:48:48 +02:00
Anton Kulyk
b663c23536 Fix linter warning about not used variable in the Icon component (#18805)
* Fix typo

* Don't warn about unused variables prefixed with _

* Fix unused var warning for Icon component

* Add `varsIgnorePattern` for JS files too
2021-11-02 13:17:38 +02:00
Alexander Polyankin
e0dc4dd810 Add entity polling to EntityListLoader (#18786) 2021-11-02 11:33:27 +03:00
Nemanja Glumac
a459f19ac8 #18573 Repro: Remapped columns do not use renamed titles in exports (#18793) 2021-11-01 21:45:08 +01:00
dpsutton
daed46d5b2 Dataset search (#18715)
* Move the multimethods over to strings not classes

datasets are Cards so don't have a good way to intercept. And this kinda
took all of the keywords, turned them into classes, and then didn't
actually use those classes-- they were just opaque keys in the
hierarchy. No bueno.

* Include datasets in search results

* Docstring for the linter. Thank you clj-kondo

* Fix namespace decls

* Update tests

* Clean up ns and make test more resilient

these tests that test global collections can be sensitive to test order
and the CI dbs that continually exist rather than be
recreated. Sometimes "table" shows up in these available models. Kinda
don't care so just check for subset

* Rename for confusion
2021-11-01 15:44:21 -05:00
Nemanja Glumac
50c3530030 #18729 Repro: XLSX export of "X of Y" (eg. Month of Year) is formatted as date column (#18792) 2021-11-01 21:10:47 +01:00
dpsutton
8947f42aac tree view for datasets (#18704)
* tree view for datasets

* Update docstring
2021-11-01 14:34:27 -05:00
Alexander Lesnenko
81b9fb6fd5 Fix table name gets included in pinned dimension names even for the query root table (#18753) 2021-11-01 22:31:59 +03:00
Ngoc Khuat
5fcf4a3aa2 fix failed to start front-end development due to missing version.properties file (#18523) 2021-11-01 10:33:42 -07:00
Dalton
1fdc984ca2 wrap moderation plugins in feature flag (#18768) 2021-11-01 10:11:13 -07:00
Howon Lee
e3fcb9953c MAX_INT as default audit query limit (#18583)
There were global audit query limits which defaulted to 1000 previously. This makes them less limited.
2021-11-01 09:07:41 -07:00
Alexander Polyankin
9d3bab9209 Change information collection page (#18756) 2021-11-01 17:40:30 +03:00
Nemanja Glumac
1f3fc98038 Abstract e2e downloads helpers (#18746)
* Expose the e2e downloads helper function

* Apply the new e2e downloads helper to the #18382 repro

* Apply the new e2e downloads helper to the #18440 repro

* Update the helper so it applies both for saved and unsaved questions

* Add additional helper options

* Redirect to a non-existing page

* Reafactor `downloads` spec

* Extract repro for #10803
2021-11-01 13:38:36 +01:00
Noah Moss
145ecc6cbb Skip sending dashboard subscription if dashboard is archived (#18712) 2021-10-29 14:33:58 -04:00
Nemanja Glumac
fb383fe5a6 Improve downloading test logic (#18745) 2021-10-29 18:53:39 +02:00
Anton Kulyk
4e445b7b8d Add helper to run jest tests in enterprise environment (#18529)
* Move UI mocks into separate file

* Mock ace and Google Analytics by default

* Add helper to run a test in EE environment

* Add test ID to CacheTTLField

* Migrate tests to new EE helper
2021-10-29 16:27:31 +03:00
Alexander Polyankin
639addfaaa Fix border width for the spinner (#18727) 2021-10-29 11:58:12 +03:00
Jeff Evans
fa7a89d792 Prevent secret records from being orphaned (#18714)
Delete Secret instances from the app DB, when the corresponding Database instance is deleted

Updating existing test (and renamed it to `secret-db-details-integration-test`) to confirm this behavior
2021-10-28 21:29:25 -05:00
Ariya Hidayat
e514ed4457 Remove the remaining of syntactical-based highlighting (#18720) 2021-10-28 17:22:38 -07:00
Alexander Lesnenko
3ff1635d48 Unblock UI development in Typescript (#18528)
* fix invalid js

* install typings using typesync

* upgrade classnames to get its own typings

* convert colors, settings, Icon to TS
2021-10-29 00:48:01 +03:00
Ariya Hidayat
d4ccbd4dab Custom expression editor: less intrusive suggestions (#15688)
The possible matching/choices for function names, dimensions, segments,
and metrics are only shown when there is at least ONE matching character.
Thus, when the user hasn't inputted anything yet, there won't be any
suggestions.
2021-10-28 14:22:30 -07:00
Anton Kulyk
69f64d3ca6 Fix questions with field literals in joins cause an infinite loop on the frontend (#18668)
* Repro #18630

* Ignore field literals in Join's isValid check

* Don't use Join's `isValid` method at `clean`
2021-10-28 19:57:17 +03:00
dpsutton
d33d83f485 Update the keys we consider to unverify a card (#18734)
* Update the keys we consider to unverify a card

Previously when almost anything changed we would unverify a card. But
this was way too aggresive. We really only want to unverify when a query
changes. Far simpler to specify the keys we do want to consider rather
than the keys to ignore.

Was prompted because when we marked a question as a dataset it would
unverify because the `:display` was changed and also `:dataset`. Neither
of these matter for verification purposes

* Update testing context string [ci skip]

* Empty commit to trigger CI

had skipped ci since it was a docstring change but that prevents merging
sad face :(
2021-10-28 11:52:28 -05:00
Anton Kulyk
06c100f458 Repro #18589 (#18730) 2021-10-28 19:18:48 +03:00
Alexander Polyankin
638063dc94 Enable anonymous tracking (#18726) 2021-10-28 16:53:35 +03:00
Pawit Pornkitprasan
24975664f7 Fix SSH tunnel with ED25519 keys (#18697)
`org.apache.sshd` requires `net.i2p.crypto/eddsa` dependency
to work with ED25519 keys.

This worked in 0.40 because `eddsa` was included as a transitive
dependency of another unrelated dependency (`buddy`) but stopped
working in 0.41 because the new version of `buddy` no longer depends
on `eddsa`. Thus, we must explicitly include the dependency.

To prevent this from breaking again, switched one of the test
keys to an ED25519 key.
2021-10-28 09:38:56 +07:00
Dalton
51174e4a59 move dashboard parameter utils (#18694)
* move dashboard parameter utils

* Move the ParameterSection type to type/Parameter.js
2021-10-27 15:39:46 -07:00
Ariya Hidayat
c911db3069 Fuzz the tokenizer of custom expression (#18586) 2021-10-27 15:14:48 -07:00
Nemanja Glumac
7f4addcf97 Fix 18061 flake by obtaining uuid from the xhr response (#18713) 2021-10-27 22:04:50 +02:00
Jeff Evans
e076514938 Handle long running sync in connection pool hash check (#18664)
* Handle long running sync in connection pool hash check

Modify the logic in `db->pooled-connection-spec` to check for the latest `DatabaseInstance` from the app DB in case of a hash mismatch, before deciding that the pool needs to be invalidated (based on changing hash of db details)

This is to handle the case where a long running sync keeps passing in a stale version of the `DatabaseInstance` over a period of many minutes/hours, long after the app DB has received an updated version that was saved through the UI

In this case, the connection pool code will get the latest `DatabaseInstance` from the app DB, on a hash mismatch, then compare that against the in-memory has for the given DB ID.  And if it still doesn't match, then the invalidation kicks in

Updating the test accordingly
2021-10-27 14:22:14 -05:00
Anton Kulyk
9da42b9c20 Add ability to turn a saved question into a dataset (#18702)
* Add dataset icon

* Add getter and setter for Question's `dataset` flag

* Add action to turn a saved question into a dataset

* Add UI for turning a question into a dataset

* Use dataset icon for questions turned into datasets

* Show datasets on collections page

* Change colors for dataset icons in collections

* Test can turn a question into a dataset

* Fix unit test

* Fix color literal

* Hide "Turn into a dataset" button for datasets

* Rerun non table question when turned into a dataset

* This was a mistake
2021-10-27 21:31:13 +03:00
Jeff Evans
5a76ef7007 Make the checkins_interval transient datasets more uniquely named in BigQuery test runs (#18600)
* Make the checkins_interval transient datasets more uniquely named

Append a timestamp suffix (initialized when the namespace was loaded) to transient dataset names

Add verbose comments explaining what we're doing

Add transient-dataset? functions for both BQ drivers to put logic in one place (which currently just see if the dataset is named `checkins_interval_*`

Ditch the "legacydriver_" prefix from the legacy BigQuery driver when creating new datasets; it's no longer needed now that transient datasets will have a much more unique suffix

Update the logic for the transient dataset suffix so that it can be more easily detected/parsed later (for cleanup)

Remove old (more than 2 hours) transient datasets when test extensions namespaces load

Add various docstrings
2021-10-27 12:29:34 -05:00
Ariya Hidayat
e14930e7c4 Disable dashboard transition when reduced-motion is preferred (#18693) 2021-10-27 10:18:35 -07:00
Dalton
275e6112d8 move parameter ui utils to separate file (#18690)
* move parameter ui utils to separate file

* move utils for building parameters from cards to own utils file (#18691)
2021-10-27 09:57:47 -07:00
Alexander Polyankin
688bd8aefc Use setup schema with data validation (#18696) 2021-10-27 17:32:05 +03:00
Ariya Hidayat
a95fbe7327 Circle CI: do not remove .git directory for release branch (#18649)
.git is necessary so that some later steps (determining Uberjar version)
can work correctly.
2021-10-27 07:26:07 -07:00
Nemanja Glumac
db32149dc5 Attempt to fix flaking repro for 18061 (#18700) 2021-10-27 15:49:06 +02:00
Alexander Lesnenko
8df6c4d1c8 tune static viz appearance (#18686) 2021-10-27 12:22:25 +03:00
Gustavo Saiani
d18706b528 Improve TokenizedInput readability (#18681) 2021-10-26 22:49:43 -03:00
Noah Moss
933de84376 Add hosting to token-features setting (#18654)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2021-10-26 14:54:19 -04:00
Dalton
cd643cba13 move parameter values logic to separate utils file (#18639)
* move parameter values logic to own utils file

* fix lint error resulting from rebase
2021-10-26 11:32:47 -07:00
Nemanja Glumac
6804ecf313 #18646 Repro: Cannot select granularity/binning on fields from SQL question, which is joined (#18661) 2021-10-26 20:06:55 +02:00
Gustavo Saiani
ef52b4f258 Extract getDataSelectors function from NativeQueryEditor (#18628) 2021-10-26 14:49:08 -03:00
Dalton
edb0d49393 move parameter target utils to new file (#18662)
* move target utils to own file

* move parameter to mbql functions to own utils file (#18663)
2021-10-26 10:12:49 -07:00
Alexander Lesnenko
5951e47f7b Summarize sidebar improvements (#18587)
* Summarize sidebar improvements

* Summarize sidebar specs

* cursor pointer for add aggregation button

* review fixes
2021-10-26 20:03:18 +03:00
Alexander Polyankin
ae455a0867 Remove steps from non-step events (#18673) 2021-10-26 19:40:48 +03:00
Dalton
f6b4c0f2ce move mapping options function into own utils file (#18638)
* move mapping options function into own utils file

* pull out option-building logic into own functions
2021-10-26 08:54:49 -07:00
Alexander Polyankin
b12e72607b Add setup tracking (#18645) 2021-10-26 17:50:27 +03:00
Pawit Pornkitprasan
ff312a056d Revert "VACUUM and ANALYZE after insert" (#18665)
This reverts commit c6688f5caf.

Redshift only supports VACUUM command at a time on the whole
cluster, so running VACUUM can fail with parallel executions.
2021-10-26 21:40:02 +07:00
Jeff Evans
d7b6dfab3c Update Redshift JDBC driver version (#18653)
v2.0.0.3 -> v2.1.0.1
2021-10-26 09:39:12 -05:00
dpsutton
977a1765fa Dataset schema (#18629)
* Add dataset flag to Card

* Set dataset viz type to table

* Include datasets in collection children

* Ensure can write as dataset, include more tests
2021-10-26 09:33:56 -05:00
Alexander Polyankin
7a7c42b08d Add global instance context for Snowplow events (#18623) 2021-10-26 13:13:17 +03:00
Dalton
a0acf6e901 move template-tag options logic to own file (#18637) 2021-10-25 16:24:33 -07:00
Dalton
ff76417dd1 move dashboard parameter options logic to own file (#18635)
* add parameters/constants file for options-related constants

* add feature-flag utils file

* move dashboard parameter options logic to own utils file

* pull out mapping logic into own function
2021-10-25 14:50:22 -07:00
Nemanja Glumac
40380d831b #18011 Repro: Post aggregation drill-through by dragging/selecting a portion of a chart results in an error (#18651)
* Add repro for #18011

* Expand the repro to include different granularity

Confirms that the issue doesn't work for "foo-of-bar" granularities.
2021-10-25 21:40:48 +02:00
Gustavo Saiani
897754e591 Extract VisibilityToggler component from NativeQueryEditor (#18627) 2021-10-25 16:32:13 -03:00
Ariya Hidayat
ae573b0e2d Disable expanding content transition when reduced-motion is preferred (#18636) 2021-10-25 12:30:20 -07:00
Gustavo Saiani
b8c7ee22ee Extract right click popover from NativeQueryEditor (#18609) 2021-10-25 15:33:53 -03:00
Dalton
c9fc20b339 move parameter operator logic into own utils file (#18633)
* move parameter type utils into own file

* move parameter operator logic into own utils file

* update reference in meta/Dashboard.js

* move parameter filter utils to own file (#18634)
2021-10-25 10:14:56 -07:00
Gustavo Saiani
09b0c53aa6 Extract sidebar component from NativeQueryEditor (#18596) 2021-10-25 14:04:30 -03:00
Dalton
58462139f0 move parameter type utils into own file (#18632) 2021-10-25 09:46:11 -07:00
Nemanja Glumac
233ee7ceaa Remove deprecated email helper (#18625)
* Enable email setup smoke test

* Remove deprecated e2e helpers
2021-10-25 12:11:06 +02:00
Pawit Pornkitprasan
416a5ddcd1 Hide password reset screen until token is loaded (#18595) 2021-10-25 09:17:19 +07:00
Pawit Pornkitprasan
31f71bf8a7 Overworld: use consistent CSS for close buttons (#18592) 2021-10-25 09:16:39 +07:00
Nemanja Glumac
c6760ff129 Refactor alert e2 tests (#18624) 2021-10-24 19:41:21 +02:00
Cam Saul
4eefe9a4f6 Optimize classloader/require a bit (#17813)
* Optimize classloader/require a bit (avoid lock + try-catch if already loaded)

* Even faster
2021-10-22 14:45:54 -07:00
Alexander Polyankin
f351459b68 Add snowplow tracking (#18293) 2021-10-22 19:47:52 +03:00
Noah Moss
2b839d43d2 Add analytics-uuid setting for snowplow (#18607) 2021-10-22 11:30:56 -04:00
Nemanja Glumac
dfd30e5af9 Register mocked Slack configuration (global e2e helper) (#18618)
* Refactor and register global Slack configuration e2e helper

* Use slack helper in tests
2021-10-22 14:52:12 +02:00
Nemanja Glumac
2c9f4d6003 Fix margin right for "Set up alert" icon (#18606)
Closes #17701
2021-10-22 13:01:19 +02:00
Nemanja Glumac
7136c3420a Refactor pulse specs (#18603) 2021-10-22 10:34:32 +02:00
Jeff Evans
497f433dba Secrets 🔐 PR 3 - Integrate secret handling with db-details (#17677)
Integrate secret handling with db-details

Add helper function to database model namespace to "swap out" secret values with inserted IDs

Calling this from the pre-update fn

Add pre-insert fn for database model to perform the same

Adding test to database model test ns

Add creator_id to secret model to capture the user who created this secret instance/version

Add creator-id and created-at sub properties for each secret in db details
2021-10-21 21:01:55 -05:00
Jeff Bruemmer
ef80526ab6 docs - ee caching note (#18604) 2021-10-21 17:16:18 -04:00
Nemanja Glumac
057b6a942b Unskip repro for #18317 (#18599) 2021-10-21 20:22:02 +02:00
Ariya Hidayat
94300ff502 Disable modal transition when reduced-motion is preferred (#18588) 2021-10-21 09:48:43 -07:00
Pawit Pornkitprasan
7f7cb5d05b Fix SSH tunnel for SSH servers with certain configuration (#18591)
Version 2.6.0 until 2.7.0 of org.apache.sshd has a bug that
will fail to connect to SSH servers configured to use
`-oKexAlgorithms=diffie-hellman-group-exchange-sha256`.

Reverting to the known working version. We can upgrade
to 2.7.1 once it is released.

Reference: https://issues.apache.org/jira/browse/SSHD-1163

Fixes #18316
2021-10-21 21:37:18 +07:00
Jeff Evans
0d7786a1db Secrets 🔐 PR 2 - Add secret model (#17649)
Add secret model

Add Liquibase migration for secret table

Implement bare bones model namespace for secret

Add simple test to ensure secret values are stored and retrieved under an encryption key (or not)

Add :creator_id to secret model to capture the user who created this secret instance/version

Support updating secret values as part of encryption key rotation

Add test assertions for secret values in the `rotate-encryption-key!-test`
2021-10-21 09:18:03 -05:00
Gustavo Saiani
de1682cea5 Small readability improvements to NativeQueryEditor (#18585) 2021-10-21 11:00:00 -03:00
Gustavo Saiani
5d350be754 Reorder imports in NativeQueryEditor (#18582) 2021-10-21 10:59:26 -03:00
Nemanja Glumac
6fc3c973be Fix #18547 - Wrong id applied to the link to the question added to the dashboard [Activity log] (#18578)
* Fix wrong id applied when constructing a link to the question added to the dashboard

Closes #18547

* Unskip repro

* Add unit tests for question ids

* Guard against the dashboard questions with no names
2021-10-21 15:35:48 +02:00
Gustavo Saiani
b8ccc4af8c Remove animation from notebook editor under reduced motion (#18532) 2021-10-21 04:21:53 -03:00
Cam Saul
41d69e834b Drop long-unused Table.entity_name column (#18470) 2021-10-20 17:42:57 -07:00
dpsutton
ff539b3b3c Correctly ignore cache (.cache) (#18561)
also move it down with the other lsp bits
2021-10-20 15:24:30 -05:00
Jeff Evans
2dc34cd6eb Fix calculation in ttl-hierarchy (#18495)
Fix calculation in `ttl-hierarchy`

The `ttl-hierarchy` function falls back to `query-magic-ttl` if no stored (card, dashboard, database) cache settings are available.  But that function returns its TTL value in milliseconds, while the model level, granular TTLs are stored in hours.  Convert those to seconds before returning, so that `ttl-hierarchy` is always returning in seconds

Add backend test for this scenario (no stored model ttls, but an average query execution time is available, and hence the `query-magic-ttl` should be used)

Unskip Cypress repro
2021-10-20 14:01:34 -05:00
Nemanja Glumac
9c0ab06d54 #18547 Repro: Wrong id used in links for questions added to dashboard in the activity page (#18575) 2021-10-20 20:38:05 +02:00
Alexander Polyankin
e662260e93 Autofill inputs for repeated fields during self-serve set up (#18471) 2021-10-20 21:23:19 +03:00
Nemanja Glumac
852e36f24d Create E2E visualize (notebook results) helper (#18520)
* Register new notebook e2e helper `visualize`

* Apply new `visualize` helper to a several different specs as a PoC

* Apply `visualize` helper to all related specs
2021-10-20 18:59:53 +02:00
Gustavo Saiani
5add11f66f Refactor notebook editor container (#18130) 2021-10-20 13:06:34 -03:00
Ariya Hidayat
6254179d0c For reduced motion, snap the motion translation (#18564)
Also, in case reduced motion is preferred, increase the spring stiffness
of the motion to finish the transition faster (timing-wide, the actual
animation won't appear due to the above snapping).
2021-10-20 07:07:31 -07:00
Pawit Pornkitprasan
341702e09f cypress: 16693: add note for future reference (#18569) 2021-10-20 18:55:34 +07:00
Pawit Pornkitprasan
ff9b99d0b9 fix wrong drill down query when using nested query (#17942)
* qp: fetch_source_query: store card-id for each query

we want to be able to determine further in the pipeline
whether a query came from a card (i.e. saved question)
or not

* qp: annotate: remove join-alias if source is a card

If the source is a card, the front-end should be able to treat it
similar to a database view so we should not expose the join
aliases outside.

If the card is on the right side of the join though, the alias
should still exists and refers to the current-level join alias.
2021-10-20 10:22:37 +07:00
Jeff Evans
2e891f1da8 Support encryption of binary data (#17646)
Update encryption code to be able to operate on byte arrays directly (without dealing in base64 String representation), delegating existing methods to point to these new ones

Adding test
2021-10-19 21:18:17 -05:00
Jeff Evans
22d23a988f Prevent duplicate connection properties (#18359)
Removing duplicate property declaration from presto-jdbc driver YAML

Add test that executes against all drivers to confirm that no duplicate names come out of connection-properties

Change the way the test runs to avoid needing to initialize test data namespace (to make googleanalytics happy)

Unskip repro Cypress test
2021-10-19 20:44:57 -05:00
Dennis Schridde
2d88ae4814 Fix precondition of change set 97 (#16095)
* Fix precondition of change set 97

Without the `type` and with the space Liquibase is unable to parse this
precondition.

During `lein test` it outputs:
```
[clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Running Changeset:migrations/000_migrations.yaml::97::senior
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Changeset migrations/000_migrations.yaml::97::senior
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Added 0.32.0
[clojure-agent-send-off-pool-0] INFO  liquibase.changelog - Marking ChangeSet: migrations/000_migrations.yaml::97::senior ran despite precondition failure due to onFail='MARK_RAN':
          liquibase.yaml : DBMS Precondition failed: expected null, got h2

[clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Skipping ChangeSet: migrations/000_migrations.yaml::97::senior
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Executing with the 'jdbc' executor
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - 1 row(s) affected
```

After this change the output changes to:
```
[clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Running Changeset:migrations/000_migrations.yaml::97::senior
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Changeset migrations/000_migrations.yaml::97::senior
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Added 0.32.0
[clojure-agent-send-off-pool-0] INFO  liquibase.changelog - Marking ChangeSet: migrations/000_migrations.yaml::97::senior ran despite precondition failure due to onFail='MARK_RAN':
          liquibase.yaml : DBMS Precondition failed: expected mysql,mariadb, got h2

[clojure-agent-send-off-pool-0] DEBUG liquibase.changelog - Skipping ChangeSet: migrations/000_migrations.yaml::97::senior
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - Executing with the 'jdbc' executor
[clojure-agent-send-off-pool-0] DEBUG liquibase.executor - 1 row(s) affected
```

For documentation of the syntax cf.
 https://docs.liquibase.com/concepts/advanced/preconditions.html

* Extend migration linter to check dbms preconditions

* Also validate the `type` field of the `dbms` precondition

Co-authored-by: dpsutton <dan@dpsutton.com>
2021-10-19 16:33:48 -07:00
Noah Moss
423236a100 Normalize field refs in viz settings, rework column ordering approach, and expand test coverage (#18490) 2021-10-19 18:01:48 -04:00
Howon Lee
1feb52e776 Coalesce audit question query runs to be 0 if no query executions (#18559)
Null query runs show up at the top previously. This is because they are a null set. This is a thing that there is an affordance to happen, because you can just create cards without running them in the notebook builder. Coalesces the null to 0 to make things sort right.
2021-10-19 13:48:12 -07:00
Alexander Lesnenko
8ad622da54 Fix no databases on embedded new question page (#18556)
* Fix no databases on embedded new question page

* Add an explanation just in case, replace lifecycle method
2021-10-19 22:26:17 +03:00
Eric Dallo
0499ddfefe Add custom hooks for some of metabase macros (#17964) 2021-10-19 12:10:16 -07:00
Ariya Hidayat
c8b22c465b Circle CI: build a complete Uberjar on a release branch (#18550)
Make sure that the built Uberjar contains translations etc.
Also, build with "large" resource_class on Circle CI.
2021-10-19 12:08:42 -07:00
Howon Lee
4bd2c5b177 Audit cards data display problem (#18527)
Underlying problem was that the cardinality of dates were getting limited by the default 1000 limit imposed by EE queries. Whack it for this specific instance. I think if we see it ever again we just remove the 1000 limit instead.
2021-10-19 11:46:06 -07:00
Dalton
bef09e293d add more parameters unit tests (#18308)
* add more parameters unit tests

* add a few meta/Dashboard tests

* remove some old, unnecessary comments

* fix assertions in tests

* fix getParameterTargetField tests

* delete nonsensical test
2021-10-19 08:56:08 -07:00
Pawit Pornkitprasan
2c69dc7315 Fix X-Ray table field shown as "null" in the title (#18066)
Field were not normalized before being processed
resulting in the result being `null`

Fixes #15737
2021-10-19 09:57:23 +07:00
Pawit Pornkitprasan
3db89e2a0a Allow caching of fonts and images (#18239)
Webpack generate multiple resources with the name of
"/[md4-hash].ext". We should allow those to be
cached.
2021-10-19 09:54:37 +07:00
Ariya Hidayat
7ea4b56709 Revert "Circle CI: build a complete Uberjar on a release branch (#18370)" (#18544)
This reverts commit adb2f715 as it broke Uberjar builds on CircleCI.
2021-10-18 16:30:24 -07:00
Cam Saul
a610b92bda Consolidate DB connection timeouts; raise default to 10 seconds (#18541) 2021-10-18 14:26:31 -07:00
Ariya Hidayat
adb2f7157b Circle CI: build a complete Uberjar on a release branch (#18370)
Make sure that the built Uberjar contains translations etc.
2021-10-18 13:47:04 -07:00
Howon Lee
9e38803276 Tools for fixing errors problems with postgres semantics of limits (blank display of error table) (#18432)
Previously sometimes error table blanks out in postgres because of limit semantics of postgres. Get it to not do that by whacking the limit and doing the display of latest error another way.
2021-10-18 12:23:32 -07:00
Howon Lee
5c819b89c2 Mongo custexp fixes: group by and filters (#18403)
Previously mongo custexps were just columns: you couldn't have group bys with them and you couldn't have filters with them. This allows those, because those weren't really tested before. Also enabled nemanja's tests for them.
2021-10-18 11:16:14 -07:00
Noah Moss
5252d8c4e8 Cap XLSX column widths at 255 characters (#18535) 2021-10-18 13:50:47 -04:00
Dalton
a48733a004 Use Dimensions to access Fields in Parameters code (#18431)
* fix virtual field access when connecting parameters to dimensions

* fix tests

* lint fix

* maybe keep things a little more backwards compatible

* fix cy test

* stop messing with field array ids

* look for virtual fields on nested questions + tests

* fix dashboard mapping test

* fix cy test

* add parameterToMBQLFilter tests

* remove direct FIELD_REF usage

* revert a few changes

* Update frontend/src/metabase-lib/lib/Dimension.js

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
2021-10-18 09:46:41 -07:00
Ariya Hidayat
11be395972 Custom expression editor: use lexical-based highlighting (#18482)
This reduces the memory pressure since the spans (for the
contentEditable) will be flat (before, they construct a tree).
2021-10-18 07:46:54 -07:00
dpsutton
a33fa56831 Ensure we are paginating resultsets (#18477)
* Ensure we are paginating resultsets

Made big tables in both pg and mysql

pg:
```sql
create table large_table
(
    id         serial primary key,
    large_text text
);

insert into large_table (large_text)
select repeat('Z', 4000)
from generate_series(1, 500000)
```

In mysql use the repl:
```clojure

  (jdbc/execute! (sql-jdbc.conn/db->pooled-connection-spec 5)
                 ["CREATE TABLE large_table (id int NOT NULL PRIMARY KEY AUTO_INCREMENT, foo text);"])

  (do
    (jdbc/insert-multi! (sql-jdbc.conn/db->pooled-connection-spec 5)
                        :large_table
                        (repeat 50000 {:foo (apply str (repeat 5000 "Z"))}))
    :done)

  (jdbc/execute! (sql-jdbc.conn/db->pooled-connection-spec 5)
                 ["ALTER TABLE large_table add column properties json default null"])

  (jdbc/execute! (sql-jdbc.conn/db->pooled-connection-spec 5)
                 ["update large_table set properties = '{\"data\":{\"cols\":null,\"native_form\":{\"query\":\"SELECT
                 `large_table`.`id` AS `id`, `large_table`.`foo` AS `foo` FROM `large_table` LIMIT
                 1\",\"params\":null},\"results_timezone\":\"UTC\",\"results_metadata\":{\"checksum\":\"0MnSKb8145UERWn18F5Uiw==\",\"columns\":[{\"semantic_type\":\"type/PK\",\"coercion_strategy\":null,\"name\":\"id\",\"field_ref\":[\"field\",200,null],\"effective_type\":\"type/Integer\",\"id\":200,\"display_name\":\"ID\",\"fingerprint\":null,\"base_type\":\"type/Integer\"},{\"semantic_type\":null,\"coercion_strategy\":null,\"name\":\"foo\",\"field_ref\":[\"field\",201,null],\"effective_type\":\"type/Text\",\"id\":201,\"display_name\":\"Foo\",\"fingerprint\":{\"global\":{\"distinct-count\":1,\"nil%\":0.0},\"type\":{\"type/Text\":{\"percent-json\":0.0,\"percent-url\":0.0,\"percent-email\":0.0,\"percent-state\":0.0,\"average-length\":500.0}}},\"base_type\":\"type/Text\"}]},\"insights\":null,\"count\":1}}'"])

```

and then from the terminal client repeat this until we have 800,000 rows:
```sql
insert into large_table (foo, properties) select foo, properties from large_table;
```

Then can exercise from code with the following:

```clojure
(-> (qp/process-query {:database 5 ; use appropriate db and tables here
                        :query {:source-table 42
                                ;; :limit 1000000
                                },
                        :type :query}
                        ;; don't retain any rows, purely just counting
                        ;; so resultset is what retains too many rows
                       {:rff (fn [metadata]
                               (let [c (volatile! 0)]
                                 (fn count-rff
                                   ([]
                                    {:data metadata})
                                   ([result]
                                    (assoc-in result [:data :count] @c))
                                   ([result _row]
                                    (vswap! c inc)
                                    result))))
                        })
     :data :count)
```

PG was far easier to blow up. Mysql took quite a bit of data.

Then we just set a fetch size on the result set so that we (hopefully)
only have than many rows in memory in the resultset at once. The
streaming will write to the download stream as it goes.

PG has one other complication in that the fetch size can only be honored
if autoCommit is false. The reasoning seems to be that each statement is
in a transaction and commits and to commit it has to close resultsets
and therefore it has to realize the entire resultset otherwise you would
only get the initial page if any.

* Set default fetch size to 500

;; Long queries on gcloud pg
;; limit 10,000
;; fetch size | t1   | t2   | t3
;; -------------------------------
;; 100        | 6030 | 8804 | 5986
;; 500        | 1537 | 1535 | 1494
;; 1000       | 1714 | 1802 | 1611
;; 3000       | 1644 | 1595 | 2044

;; limit 30,000
;; fetch size | t1    | t2    | t3
;; -------------------------------
;; 100        | 17341 | 15991 | 16061
;; 500        | 4112  | 4182  | 4851
;; 1000       | 5075  | 4546  | 4284
;; 3000       | 5405  | 5055  | 4745

* Only set fetch size if not default (0)

Details of `:additional-options "defaultRowFetchSize=3000"` can set a
default fetch size and we can easily honor that. This allows overriding
per db without much work on our part.

* Remove redshift custom fetch size code

This removes the automatic insertion of a defaultRowFetchSize=5000 on
redshift dbs. Now we always set this to 500 in the sql-jdbc statement
and prepared statement fields. And we also allow custom ones to persist
over our default of 500.

One additional benefit of removing this is that it always included the
option even if a user added ?defaultRowFetchSize=300 themselves so this
should actually give more control to our users.

Profiling quickly on selecting 79,000 rows from redshift, there
essentially no difference between a fetch size of 500 (the default) and
5000 (the old redshift default); both were 12442 ms or so.

* unused require of settings in redshift tests

* Appease the linter

* Unnecessary redshift connection details tests
2021-10-18 09:35:21 -05:00
Ariya Hidayat
76a35846af Unskip the repro for 14776 (#18525)
The issue has been fixed in the past with PR 15839.
2021-10-18 07:31:17 -07:00
Alexander Lesnenko
b1a74fffae Fix missing card descriptions (#18501)
* fix missing description info icon on dashboard cards

* update test
2021-10-18 15:37:50 +03:00
Alexander Polyankin
6b11989d0a Remove deprecated lifecycle methods in auth (#18459) 2021-10-18 15:35:18 +03:00
Anton Kulyk
1018c5fc6b Friendly revision history messages (#17858)
* Move revision helpers to own directory

* Add simple utility to format revision messages

* Add messages for basic dashboard cards changes

* Handle null values for dashboard card actions

* Add basic card series revision message support

* Batch multiple changes in a single revision

* Add `isValidRevision` helper

* Return title and description instead a single string

* Filter out unknown fields in revisions

* Fix viz settings revision descriptions

* Add helpers to revisions unit tests

* Use new revision messages util

* Filter out invalid or unknown revisions

* Capitalize revision descriptions

* Wrap new item name with double-quotes

* Move revisions unit tests to source code directory

* Add basic HistoryModal tests

* Add getChangedFields helper

* Revert getRevisionMessage return type back to str

* Extend isValidRevision check

* Fix getRevisionEventsForTimeline work with updated helper

* Expsoe revision utils

* Use new messages in HistoryModal

* Remove getRevisionDescription function

* Handle cases when revision's after / before state is null

* Simplify getRevisionMessage

* Use "description" instead of "message"

* Fix dataset_query revision not parsed correctly

* Filter out unknown field change types

* Support collection_id change event

* Return array of changes instead of batching in a single message

* Return JSX from getRevisionEventsForTimeline

* Fix UI

* Remove console.log

* Use "rearranged the cards" message

* Fix e2e test using old revision messages

* Prefer 'after' state to get changed fields

* Fix timeline revision event

* Fix translations

* Add `key` prop to `jt`

* Merge revision files

* Add an option not to lowercase the capitalize str

* Use updated capitalize function

* Fix test string

* Display question's "display" change messages

* [ci nocache]

* Fix tests

* [ci nocache]
2021-10-18 12:27:02 +03:00
Anton Kulyk
01f442a871 Add custom react-testing-library render function (#18353)
* Add custom @testing-library/react render wrapper

* Migrate unit tests to custom render function

* Rename helper to `renderWithProviders`

* Remove irrelevant eslint rule disable
2021-10-18 11:51:29 +03:00
Nemanja Glumac
4107683e93 #18512 Repro: Cannot join saved questions with the same implicit/explicit grouped field (#18516) 2021-10-18 00:59:16 +02:00
Nemanja Glumac
6e3e521fd1 #17767 Repro: Summarizing with implicit join does not allow subsequent joins (#18515) 2021-10-18 00:34:50 +02:00
Nemanja Glumac
8cf2c06a93 #18317 Repro: Audit > Questions > Total runtime displays link instead of an actual time (#18514) 2021-10-18 00:34:22 +02:00
Nemanja Glumac
c28672c609 #18476 Repro: Visible columns list in table options sidebar does not respect renamed columns (#18507) 2021-10-17 11:05:41 +02:00
Nemanja Glumac
33a6981154 #18502 Repro: Cannot join two saved questions based on the same table (#18508) 2021-10-17 11:04:47 +02:00
Nemanja Glumac
331f63a29d #18382 Repro: Downloads missing renamed columns when using old field dimensions (#18494) 2021-10-16 18:46:55 +02:00
Nemanja Glumac
517dc86f72 Refactor repro for 15578 (#18504) 2021-10-16 18:44:55 +02:00
Jeff Evans
82b3147c57 Fix flaky rotate-encryption-key!-test (#18371)
Fix flaky `rotate-encryption-key!-test`

Bind a temporary site locale when running the test, and disable the settings cache

Now, a full explanation of what was making the test flaky, for posterity:

When this test runs, it first tries to create a blank app DB.  This is either postgres, h2, or mysql, depending on the driver under test, which is slightly confusing, but anyway...

In order to populate all the app DB tables (since the "real" app DB has already been initialized at this point to even run the test), it first rebinds the appropriate dynamic vars for the db type, spec, connection, etc. and then loads a test fixture H2 file into the app DB.  This h2 test fixture file, evidently, contains all the current app DB tables, etc.

When initializing the app DB from H2 (in `metabase.cmd.copy/copy!`), the code needs to internationalize certain loading message strings.  And in order to internationalize messages, it has to look up the current site locale, which is itself an application setting, which of course comes from the setting entity table.

For the "regular" blank app DB scenario (i.e. when Metabase first starts with a blank app DB), there is some code in the `metabase.util.i18n.impl` namespace to handle this chicken and egg problem (basically, defaulting to "en" if it can't be loaded from the app DB because there is no app DB yet).  But after this tricky process finishes, that temporary, hacked lookup is replaced by the real one (since now, the app DB exists and the locale can just be loaded normally).

For the purpose of our test, that is the problem.  That state (which swaps out the `site-locale-from-setting` fn) has already run (remember, we have already initialized the app DB to even run this test in the first place, and now we are swapping in a temporary one).  So the call to load the site locate from the settings table (which is needed to print the loading message to initialize this temp app DB) fails, and hence the test fails.

Now, the reason this test was flaky, instead of just always failing, is because of the settings cache.  If the site locale had been loaded anywhere within some short time frame before this test needs to load it, to print init messages, then it succeeds!  But that doesn't always end up happening, of course, since it's effectively a race condition (setting cache expiration versus test execution timing).
2021-10-15 20:43:58 -05:00
Howon Lee
ff6a56bd7e Make EE audit app frontend display error if queries fail
Currently it only displays JS errors. Now, it still displays JS errors first but if there's a query error and no JS error it'll display the query error
2021-10-15 11:40:25 -07:00
Alexander Lesnenko
60bc250f67 Revert removing ci commands (#18493) 2021-10-15 20:40:02 +03:00
Dalton
10de89ec3d refactor getMappingsByParameter function in metabase/meta/Dashboard.js (#18340)
* refactor getMappingsByParameter

* handle dashcard.series and dashcard.parameter_mappings being undefined

* pull out getMapping fn from getMappings

* rmv hasDisjointValueSets code + ui warning
2021-10-15 10:09:53 -07:00
Nemanja Glumac
75663e9417 #18458 Repro: Caching does not respect user defined settings (#18479)
* Expand `openNativeEditor` helper for use with multiple databases
2021-10-15 17:10:43 +02:00
Alexander Lesnenko
003cf757c5 Add type check on CI, remove obsolete unused commands (#18489) 2021-10-15 17:40:01 +03:00
Ariya Hidayat
1db3751040 CI with GitHub Actions: another bump in the unit tests timeout (#18481) 2021-10-15 07:34:21 -07:00
Nemanja Glumac
58f0d75f88 Remove deprecated e2e helper createNativeQuestion (#18486) 2021-10-15 12:47:24 +02:00
Nemanja Glumac
df0d235d65 Attempt to fix GH Actions sql-field-filter-string flake (#18466) 2021-10-15 09:50:22 +02:00
Nemanja Glumac
afe3b2425d #8283 Repro: Not possible to sort by metric (#18473) 2021-10-14 22:19:41 +02:00
Noah Moss
f2fffe3b33 Refactor field ordering logic in exports to avoid dropped fields (#18441) 2021-10-14 15:43:36 -04:00
Ariya Hidayat
5cc93f8809 Remove sortable limitation for aggregation (#18429) 2021-10-14 12:04:47 -07:00
Alexander Kiselev
d399c8d70b Make axis labels selectable (#18449) 2021-10-14 10:30:27 -07:00
Ariya Hidayat
c124175109 Only allow the dimensions suitable for aggregation (#18260)
* Move #18069 to custom column reproductions

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-10-14 09:37:04 -07:00
Alexander Lesnenko
1ba00d958c adapt prettier and eslint for typescript files (#18457) 2021-10-14 17:32:12 +03:00
Nemanja Glumac
08efcff51a #18440 Repro: Exports drop columns with remapped display values (#18443) 2021-10-14 16:27:07 +02:00
Nemanja Glumac
ffa1252eeb #18219 Repro: Temporal breakout fields are not formatted in export (#18436) 2021-10-14 16:26:30 +02:00
Alexander Polyankin
bf25f10568 Add codenotify files (#18456) 2021-10-14 16:08:45 +03:00
Alexander Polyankin
7444c8d39f Add codenotify (#18390) 2021-10-14 15:38:49 +03:00
Alexander Lesnenko
0fcd5e7d23 Fix broken pin map when there are no valid points (#18427) 2021-10-13 23:41:15 +03:00
dpsutton
2a6d813340 Relativize links when emitting html from md in pulse/subscriptions (#18428)
* Relativize links when emitting html from md in pulse/subscriptions

Helpful links:
- https://awesomeopensource.com/project/vsch/flexmark-java
- https://github.com/vsch/flexmark-java/blob/master/flexmark-java-samples/src/com/vladsch/flexmark/java/samples/PegdownCustomLinkResolverOptions.java
- 8a881b7310/flexmark/src/main/java/com/vladsch/flexmark/html/HtmlRenderer.java (L433)
- 8a881b7310/flexmark/src/main/java/com/vladsch/flexmark/html/renderer/ResolvedLink.java (L10)

This was a pain in the ass. I had been looking for a way to just easily
traverse the ast, but this might cause problems since there are spans
and text positions everywhere. So i looked at how to change the
parser. Everything is so difficult to change. Luckily there was a
built-in way to do this with link resolvers, found in a github issue
https://github.com/vsch/flexmark-java/issues/308 . And ideally this
would be done in the parser but it seems to be done in the html
emitter.

https://github.com/vsch/flexmark-java/blob/master/flexmark-java-samples/src/com/vladsch/flexmark/java/samples/CustomLinkResolverSample.java

And then I got turned around on what is relative or not. What happens if
you do something seemingly sane like:

```markdown
[a link to google](www.google.com)
```

This is apparently a relative link since it lacks a protocol. And our
`resolve-uri` code treats it as such:

```clojure
markdown=> (resolve-uri "www.google.com")
"http://localhost:3000www.google.com"
markdown=>
```

This seems strange to me but is also the behavior on gist.github.com:
https://gist.github.com/dpsutton/412502ffa89186487e41885855dfa781 has a
link to https://gist.github.com/dpsutton/www.google.com

In all, trying to figure out this object oriented factory mess i had 24
tabs open to the source of NodeVisitor, NodeVisitorBase,
AstActionHandler, VisitHandler, ParserExtension,
NodePostProcessorFactory, etc. It was truly unpleasant.

* Remove errant require of mb.util.urls

* Ensure the site setting always has a slash when resolving relative

The URI class will do some wonky things. Sometimes it feels structural,
but it can also just feel like it is combining strings willy nilly.

```clojure
(.. (URI. "http://example.com") (resolve "www.google.com") toString)
"http://example.comwww.google.com"
```

So ensure that there is a final trailing slash
2021-10-13 09:46:42 -05:00
Nemanja Glumac
8da16d629b Extract downloads into a separate CI e2e group (#18424) 2021-10-13 16:31:06 +02:00
Luis Paolini
dfdae12190 Updating the account docs for Snowflake (#18434)
We had a few users who reported that they couldn't connect, this simple lineshould fix that
2021-10-13 11:17:33 -03:00
Ariya Hidayat
9e92743de3 CI with GitHub Actions: make some jobs conditional on the context (#18425) 2021-10-12 14:47:58 -07:00
Anton Kulyk
abc5594183 Fix saved question DB displayed in native editor DB picker (#18419) 2021-10-12 22:17:53 +03:00
Alexander Polyankin
2503fa35ef Replace deprecated lifecycle methods in admin (#18409) 2021-10-12 21:36:10 +03:00
Alexander Polyankin
e1ec57863e Fix line charts with missing values and duplicate X (#18415) 2021-10-12 21:35:17 +03:00
Anton Kulyk
d950c7415d Fix rendering markdown links (#18417) 2021-10-12 19:23:55 +03:00
Ariya Hidayat
49dd6369bf Convert simple filter with case-insensitive string function (#18374)
This is more of a quick workaround (read: hack) until we have a better
parsing infrastructure.

The idea is to have an extra argument to contains/startsWith/endsWith,
which will be "case-insensitive" if the comparison is to be carred out
by ignoring the case. If this extra argument wasn't specified, then
it'll be assumed that the case-sensitive comparison is intended.

IOW, this MBQL `["contains", X, Y`] or `["contains", X, Y,
{case-sensitive: true}]` will be equivalent to the user-visible custom
expression `CONTAINS(X)`.

Meanwhile, MBQL `["contains", X, Y, {case-sensitive: false}]`
will be mapped to the user-visible custom expresson
`CONTAINS(X, Y, "case-insensitive")`.

With this, we achieve a lossless conversion for 3 string functions
(contains, startsWith, endsWith) when involving case-sensitivity.
2021-10-12 07:31:14 -07:00
Alexander Lesnenko
5186f6a6b7 Fix filtering by null (#18400) 2021-10-12 17:03:12 +03:00
Luis Paolini
dce0a7d4b6 Add MB_SEND_EMAIL_ON_FIRST_LOGIN_FROM_NEW_DEVICE (#18401)
* Add MB_SEND_EMAIL_ON_FIRST_LOGIN_FROM_NEW_DEVICE

* Update docs/operations-guide/environment-variables.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-10-12 09:19:41 -03:00
Alexander Polyankin
e9d37e11aa Add approved domains FE validation (#18327) 2021-10-12 13:21:23 +03:00
Ariya Hidayat
382e07432e Binning time-series: wait for @dataset to reduce potential flakiness (#18399) 2021-10-11 17:48:36 -07:00
dpsutton
57506cc0f6 Two column table (#18392)
* Don't render bar charts are sparklines

https://github.com/metabase/metabase/issues/18352

A simple select `SELECT 'a', 1 UNION ALL SELECT 'b', 2` would trigger as
a sparkline and blow up when comparing. There are two issues:
- don't render tables as a sparkline even if it only has two columns
- don't compare things that aren't comparable.

this solves the first issue, ensuring that tables aren't matched as
sparklines

* Sparkline should only compare comparable values

Check that the columns are temporal or numeric before comparing them. It
is only to optionally reverse the order of the results which seems
questionable in itself, but we can at least check that they are
comparable before attempting to

* Ensure tests render as sparklines

default was a :table and that adds csv attachments which throw off our
tests

* unskip repro

* remove unnecessary extra line
2021-10-11 17:13:45 -05:00
dpsutton
6dd76f4ade Correctly format 0 decimal places (#18397)
Input:    12345.65432
Expected: 12346
Actual:   12346.

We were unconditionally adding "." (repeat decimals "0") to the base
formatting string. Obviously when the decimals are 0, we are appending
"." to the base format string
2021-10-11 16:37:45 -05:00
Ariya Hidayat
f144a6ecb7 Conditionally scope the PR run for the new Presto JDBC driver (#18395) 2021-10-11 13:02:35 -07:00
Noah Moss
77a02e6eb3 Use dashcard title instead of card name in dashboard subscriptions, if it is set (#18360) 2021-10-11 14:29:55 -04:00
Anton Kulyk
bea54e1e3d Fix saving nested questions to Our Analytics (#18383)
* Unskip the repro test

* Fix duplicate variable calc

* Fix schema update with blank tables state
2021-10-11 21:26:48 +03:00
Alexander Lesnenko
3a4ff619cb Fix inability to change field schema (#18385)
* test

* Fix inability to change field schema

* include db name for diff

* unskip repro
2021-10-11 21:23:33 +03:00
Nemanja Glumac
fe0fca0f5c #18384 Repro: Data Model shows blank page if there are any hidden tables in the database (#18391) 2021-10-11 18:21:14 +02:00
Nemanja Glumac
f725073cfd #18386 Repro: Cannot filter on the null values using the inline context menu (#18387) 2021-10-11 17:43:33 +02:00
Nemanja Glumac
7eb3265f2b Add Presto database e2e coverage with #18351 repro (#18366) 2021-10-11 16:46:33 +02:00
Nemanja Glumac
3bf0170763 #18364 Repro: Unable to save a nested question in the "Our analytics" collection (#18380) 2021-10-11 13:36:29 +02:00
Ariya Hidayat
54a2477b66 GitHub CI: Switch to Temurin distribution (#18369)
tl;dr AdoptOpenJDK is now Temurin (part of Eclipse Adoptium)

https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/
2021-10-09 09:34:40 -07:00
Jeff Bruemmer
e8628387b6 docs - update docs landing pages (#18367) 2021-10-08 16:51:37 -04:00
Nemanja Glumac
9573f6d808 #18352 Repro: Pulse table cards with INT64 values fail to render in 0.41.0 (#18356) 2021-10-08 20:37:51 +02:00
Nemanja Glumac
ca14538beb #18344 Repro: The original question title is shown in the subscription instead of the curated title (#18355) 2021-10-08 20:28:54 +02:00
Alexander Kiselev
e4fbbcbc5a Enable allowJs and some other options in tsconfig (#18332)
* set `allowJs` to true in tsconfig. This allows TS to infer types from JS files

* added decorators
2021-10-08 08:16:20 -07:00
Nemanja Glumac
d657ebb663 Extract "custom column" into a separate e2e and CI group (#18336)
* Extract cc reproductions from `question` group

* Extract custom-column spec

* Extract custom column help-text spec

* Extract custom column typing-suggestion spec

* Extract custom column error-feedback spec

* Expand typing-suggestions spec

* Consolidate repros

* Extract custom column data-type spec

* Remove references to `cy.server` from custom-column spec

* Extract custom column expression-editor spec

* Remove duplicate tests

* Extract and unskip repro for #13289

* Register custom column helpers

* Use CC helper in tests

* Move related tests to help-text spec

* Enable "custom-column" e2e group in CI

* Delete a duplicate repro for #13289

* Remove obsolete test

* Expand error-feedback spec

* Extract and expand repro for #14843

* Fix linter errors
2021-10-08 16:55:26 +02:00
Noah Moss
965469d55d fix xlsx exports for data with big integer values (#18323) 2021-10-08 09:33:35 -04:00
Jeff Bruemmer
239139496a tag official collections (#18328) 2021-10-08 09:01:52 -04:00
Nemanja Glumac
538d92d009 Update assertions in repro for #15612 (#18313) 2021-10-08 13:19:15 +02:00
Anton Kulyk
ad1cc3b22b Append indexes to duplicate expression names (#18152)
* Clean up query expressions unit tests

* Add tests for StructuredQuery's expression methods

* Append indexes to duplicate expression names

* Fix expression update test

* Test renaming an expression

* Fix handling gaps in expression names with indexes

* Handle duplicate names when updating expressions

* Add issue id to repro test

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

* Add E2E helper to select notebook steps

* Simplify Cypress test

* [ci nocache]

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2021-10-08 13:10:43 +03:00
Pawit Pornkitprasan
aab206cb7c expressions->subselect: exclude fields used only inside expressions (#18065)
The expressions are executed inside the sub-query, so the fields do not need to be exposed outside.
2021-10-08 11:45:39 +07:00
Alexander Kiselev
a4a4e9cb2b Copied delay utility function into Cypress backend (#18330)
runner to decouple from incoming TS refactors
2021-10-07 15:02:18 -07:00
Alexander Polyankin
47eaae2835 Fix color issue with step action buttons (#18318) 2021-10-07 21:49:16 +03:00
Alexander Lesnenko
994bd3d9f3 Fix add series modal freezes the entire app (#17609)
* [ci nocache] Use virtualization in AddSeriesModal question list, load metadata for question in chunks

* [ci nocache] add empty state
2021-10-07 21:18:26 +03:00
Ariya Hidayat
eac16ca273 Circle CI: build without cache for the release branch (#18280)
* Check also for master branch
2021-10-07 11:14:33 -07:00
Alexander Lesnenko
8114af48f9 add basic typescript configuration (#18284)
* add basic typescript configuration

* convert a tiny hook use-debounced-value to typescript

* allow any for now?

* update terser and static viz configs

* adjust config

* change extension of QuestionActivityTimeline from jsx to js to match jest config

* adjust config

* skip failing tests

* Fix missing question method in unit tests (#18314)

* review fix

* fix

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2021-10-07 19:00:08 +03:00
Anton Kulyk
28291680cd Fix invalid import (#18311)
* Fix invalid import

* Blank

* [ci nocache]
2021-10-07 15:02:46 +03:00
Nemanja Glumac
20fa050786 #17963 Repro: MongoDB cannot use filter expression comparing two fields (#18305) [ci nocache] 2021-10-07 12:38:51 +02:00
Anton Kulyk
8c43bd6218 Fix new questions don't appear in the Saved Questions picker (#18095)
* Enable repro

* Move saved questions virtual DB id to own file

* Add saved question helpers

* Add test-id to Metabase logo component

* Extend repro test to cover archived items handling

* Handle saved question actions in schema entity

* Handle saved question actions in table entity

* Fix moved file import

* Fix Cypress can't find logo in EE (whitelabeling)

* Fix saved questions order

* Fix saved questions included in database tables
2021-10-07 13:07:41 +03:00
Anton Kulyk
f68e1d49f6 Fix auto expanding nested collections (#18240)
* Remove not used prop

* Make CollectionSidebar a functional component

* Fix accidentaly closing some collections
2021-10-07 13:07:25 +03:00
Gustavo Saiani
d4110fda9a Fix typo in object key (#18306) 2021-10-06 19:08:28 -03:00
Alexander Polyankin
193547c460 Fix CSP issue for Google Analytics (#18295) 2021-10-06 22:34:13 +03:00
Nemanja Glumac
ab3c3955e1 #12439 Repro: Clicking on legend in native question breaks the UI (#18294) 2021-10-06 20:50:13 +02:00
Cam Saul
a98eb1d8c3 Static viz: allow rendering non-timeseries line charts (#18279)
* Static viz: respect custom X and Y axis labels

* Static viz: allow rendering non-timeseries line charts

* Test fixes 🔧
2021-10-06 11:32:54 -07:00
Alexander Polyankin
aec9462406 Approved domains tests (#18075) 2021-10-06 21:21:36 +03:00
Alexander Polyankin
3ea737ad55 Reset filter value when widget type changes (#18256) 2021-10-06 21:20:07 +03:00
Alexander Polyankin
7f1b701aaa Fix whitelabel issues with color function (#18217) 2021-10-06 21:18:54 +03:00
Cam Saul
e85c11228a Static viz: respect custom X and Y axis labels (#18276) 2021-10-06 10:19:37 -07:00
Jeff Evans
e622519f0e Change implementation of docsUrl to handle RC suffixes for EE versions (#18270)
Change implementation of docsUrl to handle RC suffixes for EE versions

Change the regex used to test the tag to detect any OSS or EE version, including (possibly) an arbitrary suffix after the major and minor parts, and normalize to the major OSS equivalent version instead.  If the suffix, OTOH, is `-SNAPSHOT` (ignoring case), then the doc tag will be `latest`, on the theory that this is as local development build.

v0.41.0 => v0.41
v1.41.1 => v0.41
v1.41.2-RC1 => v0.41
v1.42.0-SNAPSHOT => latest

Adding unit tests for all cases

Update behavior so that -SNAPSHOT suffix points to "latest"
2021-10-06 11:16:29 -05:00
Cam Saul
7bf631074b Static viz: respect whitelabel colors (#18277) 2021-10-06 08:46:00 -07:00
Nemanja Glumac
76cc6ca94d #18114 Repro: Dashboard Textbox does not render links unless using Markdown (#18265) 2021-10-06 16:48:59 +02:00
Noah Moss
6f2baf6f5f Add is-hosted? setting based on metastore token (#17256) 2021-10-06 10:30:36 -04:00
Jeff Bruemmer
ab6a473b41 docs - updates to auditing, landing page, and more (#18266) 2021-10-06 09:52:56 -04:00
Noah Moss
3d7a1c53de Fix datetime formatting for pulse/dashboard subscription attachments (#18225) 2021-10-06 09:49:07 -04:00
Nemanja Glumac
ea87c9303b #18148 Repro: "Save" button shouldn't appear before one selects the source for a native question (#18259) 2021-10-06 14:19:50 +02:00
Nemanja Glumac
f94c3c96f6 Cypress email setup (#18247)
* Add `setupSMTP` helper function

* Remove deprecated `setupDummySMTP` helper

* Re-use `setupSMTP` helper in tests

* Always clear Webmail's inbox after setting up the SMTP
2021-10-06 13:46:26 +02:00
Pawit Pornkitprasan
86fb6c5d86 Fix subscriptions being sent for the wrong dashboard (#18281) 2021-10-06 12:06:26 +03:00
Howon Lee
384218e646 Erroring question page nits (#18190)
Previous PRs for error cards page were laser focused on getting everything to work, as opposed to actually conforming to spec. This one gets it closer to spec, although product wants reloading animations which are not there yet. To wit,

- Indicates to end user what the current running state is. Given the many orders of magnitude in DB query run times I think something robust and non-ephemeral is necessary here (looking at some sort of expanded QE model) but Maz suggested expedient method and I took it
- No more left nav on the table page
- Page heading for table page
- Independent scroll-x behavior on the table
- Styling for the error section on the table page
- Select-all component. Note that the interaction behavior with pagination is fiddly. (but less fiddly now that it's all based on card id's instead of row numbers)
- Coalescing default behavior for Our Analytics collection (default collection) and null number of dashboards
Rename error name to error content search
2021-10-06 00:59:38 -07:00
Raphaël Merx
a1d08db6fa Currency list: Add Papua New Guinean kina (#18234) 2021-10-06 09:31:24 +07:00
Maz Ameli
e56ba89e5c pull in translations for 0.41 (#18268) 2021-10-05 15:05:14 -07:00
Alexander Lesnenko
6600f4c596 Fix virtual fields are not passed to ParameterValueWidget (#18223)
* Fix virtual fields are missing in ParameterValueWidget

* fix fk filter parameters
2021-10-06 00:17:40 +03:00
Jeff Evans
e441ff30ee Snowflake: fix error in aggregation expression having different casing in order clause (#18221)
Remove the `driver/format-custom-field-name` implementation for :snowflake, which was causing the problem and appears to be no longer needed anyway

Add test for this scenario to `metabase.query-processor-test.expression-aggregations-test`
2021-10-05 15:57:33 -05:00
Cam Saul
8f4d867bc4 Fix Dashboard Subscription email validation (second pass) (#18237)
* Fix Dashboard Subscription email validation (second pass)

* Always validate Pulse channels in test endpoint
2021-10-05 13:10:52 -07:00
Noah Moss
a7e1d254a1 Use UTC as default timezone in alert template when report timezone isn't set (#18257) 2021-10-05 15:54:36 -04:00
Anton Kulyk
78f4ab6b43 Disable question's "Save" button until native query can be run (#18252)
* Update Link component's code style

* Add disabled style to Link

* Disable "Save" button when can't run query

* Animate Link color and opacity changes
2021-10-05 22:30:02 +03:00
Maz Ameli
93e7efcdd3 Restyle the Verify button (#18134)
* restyle the Verify button

* remove unused components

* make the verify button blue
2021-10-05 12:23:20 -07:00
Ariya Hidayat
8c62e8a047 Docker build: just one build stage (#18196) 2021-10-05 10:48:25 -07:00
Alexander Polyankin
3f07a31838 Static viz whitelabel colors (#18248) 2021-10-05 20:27:38 +03:00
Howon Lee
194d1dc0d5 Fix cache native queries not working (underlying problem is unit conversion actually) (18160) (#18230)
Cache TTL is defined in the nice new column things as per hour. The actual cache wanted it in seconds. There wasn't a conversion hours->secs before, which was the underlying illusion that gave rise to #18160 - with a properly set cache ttl the cache works fine. But the cache ttl's weren't getting set to proper values because of that lack of unit conversion. So here's the conversion, hours->secs.
2021-10-05 09:59:17 -07:00
Alexander Lesnenko
5c34833326 decrease data picker search results to 50 (#18250) 2021-10-05 19:49:02 +03:00
Alexander Polyankin
90a77fb5b8 Add missing categorical charts (#18186) 2021-10-05 16:40:49 +03:00
Alexander Polyankin
fc535276ce Fix empty state in the Erroring questions page (#18188) 2021-10-05 15:57:38 +03:00
Pawit Pornkitprasan
3ab0a13f8e Make webpack output closer to webpack 4 and fix whitelabelling (#18238)
* Make webpack output closer to webpack 4 and fix whitelabelling

* Fix recently-viewed.cy.spec.js

Not sure why it's started failing with this PR, but adding wait for text.
2021-10-05 17:13:28 +07:00
Alexander Polyankin
b7a8b4291d Fix composite chart layout (#18195) 2021-10-05 13:03:39 +03:00
Alexander Polyankin
7e201eaa9b Revert "Fix combined tooltip for charts (#17946)" (#18227) 2021-10-05 13:03:17 +03:00
Dalton
295f40d75a Remove unused function props passed to ParameterWidget (#18202) 2021-10-04 16:01:33 -07:00
Dalton
651386bdeb Fix DataSelector infinite loop (#18228)
When all the necessary data hasn't been fetched you can find yourself in
stuck in a loop between the invalid state checks in DataSelector's
componentDidUpdate method and the skipSteps method.

1. there seems to always be a single schema (the "Everything Else"
   schema) available on instantiation
2. the skipSteps method auto-selects this schema when no other schemas
   exist
3. there's some pre-existing logic to avoid getting in this loop by
   checking the is_saved_questions property of the database in the
   selectedSchema. However, for whatever reason this property doesn't
   exist until AFTER we've fetched some things.

The fix is checking a property that is guaranteed to exist, the ID for
the "Everything Else" database
2021-10-04 15:47:50 -07:00
Cam Saul
38faad602e GET /api/database/:id/schemas should not return 'empty' schemas (#18123) 2021-10-04 11:38:17 -07:00
Ariya Hidayat
6725c0cf15 Make temporal fields selectable for max/min summary (#18135) 2021-10-04 10:18:34 -07:00
Noah Moss
e6023765b6 Fix exports for queries with aggregations (#18205) 2021-10-04 10:50:09 -04:00
Alexander Lesnenko
ae2027e768 fix missing prop types import after renaming (#18213) 2021-10-04 16:08:25 +03:00
Alexander Polyankin
ed4ec6c92c Fix /account authentication and session deletion behavior (#18151) 2021-10-04 14:05:42 +03:00
Ariya Hidayat
3a67ddc1ff Rename NODE_ENV to WEBPACK_BUNDLE (#18087)
NODE_ENV interferes with other tools (e.g. `yarn` won't pull
devDependencies). Since what we need is only a flag indicating Webpack
to bundle for production vs developement, invent our own env.

This also solves the mystery of unable to call `yarn build` in the build
script `bin/build-mb/src/build.clj`.
2021-10-03 21:44:55 -07:00
Pawit Pornkitprasan
c7b2fd5ceb Allow JDBC additional-options in Redshift plugin (#18111)
Co-authored-by: Justin McCarthy <justin@strongdm.com>
2021-10-04 09:40:51 +07:00
Ariya Hidayat
465480d35e Reject less/greater than operators on booleans (#18206) 2021-10-03 11:20:22 -07:00
Alexander Lesnenko
8c0858638d Show permissions for hidden tables (#18171)
* Show hidden tables permissions, load tables only when needed

* fix padding

* remove loader div wrapper

* remove redundant wrappers
2021-10-02 00:43:17 +03:00
Dalton
9588033b0f Fetch and use fields associated with a parameter to parse parameter values found in URL query (#18104)
* move logic in dashboard selectors to meta/Dashboard

* rmv usage of syncQueryParamsWithURL

* add syncQueryParamsWithURL logic to meta/Parameters.js

* Fix public questions

* fix dashboards

* fix query builder

* don't normalize when value is empty string

* rmv unused setMultipleParameterValues fn

* replace selector logic with meta/Dashboard fn

* filter out nil fields

we need to do more work before we can properly use
fields from nested questions when parsing parameter values.

* add field to dash parameter so we can correctly type nested native query fields

* fix tests

* code style tweaks per review
2021-10-01 12:14:44 -07:00
Nemanja Glumac
de22490dd6 Cypress E2E MySQL snapshot (#18193)
* Create `mysql-8` snapshot

* Use `mysql-8` snapshot in tests

* Extract repro for #15342

* Relocate mysql `add` spec

* Extract mysql GUI query tests

* Relocate mysql `query` spec

* Extract repro for #12445

* Remove `metabase-db` from Cypress

* Update Cypress README
2021-10-01 20:57:15 +02:00
Noah Moss
9b2fbc7162 Convert deprecated k:mm time style to HH:mm on viz settings normalization (#18167) 2021-10-01 11:21:36 -07:00
Nemanja Glumac
2cf6dc552f Cypress E2E Mongo snapshot (#18184)
* Create `mongo-4` snapshot

* Use `mongo-4` snapshot in tests

* Restore and authenticate

* Relocate mongo `line` spec

* Relocate mongo `native` spec

* Relocate mongo `add` spec

* Extract repro for #13097

* Relocate mongo `query` spec

* Remove mongo from `metabase-db`
2021-10-01 18:09:44 +02:00
Nemanja Glumac
170a2b849f Separate qa db snapshots (#18179)
- a56b640 broke Percy workflow on master and introduced a major inconvenience for developers who wish to run Cypress locally. In both cases, it's required to have all supported QA DB docker images running at all times. Otherwise, the Cypress snapshot creation phase breaks.

This PR:
- uses the existing ENV var to conditionally skip qa db snapshots
- this doesn't affect CircleCI workflow - it merely makes life easier for developers running Cypress locally and for a Percy workflow that runs on GitHub Actions (where we still don't have QA docker images available)
2021-10-01 14:10:14 +02:00
Alexander Polyankin
2b91b3e8b2 Add scrolling to SQL error messages (#18144) 2021-10-01 12:14:31 +03:00
Jeff Evans
cb05523b06 Fix errors from disallowed characters in BigQuery custom expression names (#18055)
Add `escape-alias` multimethod to `sql.qp` to handle translating an alias (whether for a field or expression) into something supported by the driver in quesion

Add default impl that is essentially identity

Marking `sql.qp/field->alias` as deprecated, and changing its default implementation to invoke the new `sql.qp/escape-alias` on the field's `:name` (with the intention of removing it in a future release, since individual driver won't need to override this, so much as they'll need to override `escape-alias` itself).

Override `sql.qp/escape-alias` method for both BigQuery drivers to run through the same `->valid-field-identifier` function already defined for this purpose

Add test for a custom expression with weird characters
2021-09-30 16:44:21 -05:00
Nemanja Glumac
6978a836dc Translate Whitelabel color options (#18170)
Closes #18168.
2021-09-30 23:26:21 +02:00
Nemanja Glumac
a56b640dfc Cypress E2E postgres snapshot (#18106)
* Create `postgres-12` snapshot

* Use `postgres-12` snapshot in tests

* Relocate postgres `add` spec

* Relocate postgres `sandboxes` spec

* Relocate postgres `native` spec

This actually didn't have anything to do with the native questions.
We simply used native editor because it was easier to reproduce the issue.

* Relocate postgres `permissions` spec

* Relocate postgres `query` spec

* Relocate postgres `custom-column` spec

* Remove postgres from `metabase-db`
2021-09-30 20:51:06 +02:00
Alexander Lesnenko
c56df9ce6f fix filters alignment (#18139) 2021-09-30 21:34:29 +03:00
Howon Lee
9eced49570 Do not emit view logs when there's no card id for query viewlogs (fixes #18136) (#18138)
There is a problem when there are no card ids for a userland query (so not all userland queries are non-adhoc queries: they can be adhoc), where viewlog needs a card id so it chokes. Just adds a check so it doesn't even try to emit a viewlog, since the auditing is for non-adhoc queries only.
2021-09-30 11:14:48 -07:00
Gustavo Saiani
f87ce232f3 Don't compress content when opening sidebar in Question page (#18128) 2021-09-30 13:17:43 -03:00
Jeff Bruemmer
d0e0325190 docs - updated permissions (#17882) 2021-09-30 11:26:33 -04:00
Nemanja Glumac
538a5e6c0a Run all QA DB docker images at once in CI (#18129) 2021-09-30 17:04:25 +02:00
Jeff Bruemmer
2a48071e59 docs - question details sidebar (#17926) 2021-09-30 09:28:22 -04:00
Jeff Bruemmer
349fc25ee4 docs - multi-column joins (#17948) 2021-09-30 09:23:43 -04:00
Alexander Polyankin
ec1496debf Fix cutting of data points in line/area/bar charts (#18119) 2021-09-30 16:07:31 +03:00
Alexander Polyankin
12ff480ede Add cypress tests (#18140) 2021-09-30 15:13:25 +03:00
Jeff Evans
6ff4eda63e Check feature flag on backend /graph PUT API for block permission (#18109)
Check feature flag on backend /graph PUT API for block permission

Check for the `:advanced-permissions` flag in `update-db-permissions!`, when a `:schemas` `:block` entry is present in the graph

Set feature flag in tests when using API

Add new test to ensure failure in the case that feature flag is missing
2021-09-29 19:02:41 -05:00
Noah Moss
d4bc553cba Alert schedule in email template (#18084) 2021-09-29 15:58:52 -07:00
Gustavo Saiani
f044c7d7a8 Remove animation from ViewSidebar under reduce motion (#18102) 2021-09-29 19:07:10 -03:00
Noah Moss
ba1f8dcb63 Include dashboard filters in email & slack subscriptions (#17824) 2021-09-29 14:47:04 -07:00
Nemanja Glumac
c897ff8fea Programmatically wait for the QA DB metadata to load (#18116)
* Set the timeout to 2s because of Mongo
2021-09-29 23:41:54 +02:00
Cam Saul
27e32d7f1a Remove placeholder code for the new 41 premium features (#18126) 2021-09-29 14:31:29 -07:00
Cam Saul
2b0a6c79d7 Remove special cases in tests for Snowflake (#18127) 2021-09-29 13:15:10 -07:00
Cam Saul
ee134cf91d Enforce allowed domains when sending test Pulses (#18122) 2021-09-29 12:20:33 -07:00
Gustavo Saiani
cac3beaaa6 Refactor query builder sidebar (#18098) 2021-09-29 16:06:12 -03:00
Cam Saul
44ccf236cf Minor async require cleanup (#18059)
* Minor async require cleanup

* Sort namespaces
2021-09-29 10:57:45 -07:00
Howon Lee
4853b79368 Revert reversion of error cards details page (#18107)
Overall purpose of PR is to add row drill-ins to the tools to fix broken questions, so you can take a look-see into what the broken questions are.

A tiny nit thing wasn't caught by CI and broke master. This was because there's a CI cache. I can confirm that this didn't hit the CI cache and the other thing that broke isn't breaking anymore
2021-09-29 10:55:11 -07:00
Noah Moss
4dc3974c0d unskip repro for markdown in dashboard subscriptions (#18110) 2021-09-29 09:51:49 -07:00
Alexander Polyankin
b27c8f4b77 Do not truncate X labels in timeseries charts (#18100) 2021-09-29 19:09:10 +03:00
Pawit Pornkitprasan
a31a7d087e Fix loading sample dataset in Redshift (#18089)
- `TEXT` in Redshift is equivalent to `VARCHAR(256)`, use
  `VARCHAR(1024)` instead
- Unskip all tests skipped on Redshift due to sample dataset issue
- Add explicit `:order-by` to `join-source-queries-with-joins-test`
  to make it pass in Redshift as Redshift does not preserve order
  after join (like a lot of other distributed query engines)
- Add `VACUUM` and `ANALYZE` call after INSERT to improve performance
2021-09-29 09:37:13 +07:00
dpsutton
a750e4a57a Unverify cards when they are edited (#17997)
from maz in slack:
Should not remove verification:
 - Moving to another collection
 - Pinning/unpinning
 - Adding/removing an alert on the question
 - Turning sharing on the question on/off
Should remove verification:
 - Editing the query
 - Editing the visualization or viz settings
 - Editing the title or description

This really just identifies when not to remove verification, otherwise
does remove verification. Alerts are not related to questions through
the api so no worries there. Everything else is just excluding
attributes from the diff calculation.

In tests, went perhaps a bit haywire with the macrolet, allowing to
define macros inline rather than farther away from the call site. Used
twice:
- once to optionally add in moderation review into the with-temp. This
macro is handy to ensure we always have a fresh state of card and don't
have leftover changes or verifications. Has to be a macro since i want
to dynamically change whether there are verifications in the with-temp*
vector binding
- a way to more easily reduce repetition when asserting something is
verified, do an action, and assert it is still verified
2021-09-28 16:27:21 -07:00
Howon Lee
d7898af888 Audit cache controls 2 (#18046)
Cache controls all landed but is lacking in the audit capacity wanted for in the notion doc. This PR adds that audit capability and by the by changes the ViewLog model in order to be able to deliver on the question of whether ViewLogs were cache hits or not.
2021-09-28 14:10:57 -07:00
Howon Lee
72a5584d29 Revert "Tool to fix broken questions, details page (#18022)" (#18103)
This reverts commit f94510a34a.
2021-09-28 13:35:09 -07:00
Alexander Lesnenko
20ec1869ee Do not change display on drill to questions (#18008)
* Do not change display on drill down to questions

* unskip repro

* include displayIsLocked explicitly otherwise it breaks almost the entire app
2021-09-28 22:56:05 +03:00
Alexander Lesnenko
64bbf8e7cd do not show time for date columns (#18056) 2021-09-28 22:42:45 +03:00
Howon Lee
f94510a34a Tool to fix broken questions, details page (#18022)
Details page for tools to fix broken questions. Also the PR ran long enough that nemanja found some bugs in the details page. Does not include any loading overlay or anything to indicate that reloads are happening, which is for 41.1 I guess
2021-09-28 12:10:32 -07:00
Jeff Bruemmer
6e487b33fa revise activation guide (#17861) 2021-09-28 15:06:02 -04:00
Alexander Polyankin
e70c2e7ed8 Fix stacked charts breaking waterfall charts (#18093) 2021-09-28 21:19:10 +03:00
Jeff Evans
bca22d9766 Fix BigQuery Percentile and Median expressions not using correct backtick quoting (#17979)
Fix BigQuery Percentile and Median expressions not using correct backtick quoting

Ensure the identifier components are quoted by reifying `ToSql` for the `APPROX_QUANTILES` expression

Add test to ensure query is created properly

Mark `:percentile-aggregations` as being supported in the new driver
2021-09-28 11:16:46 -05:00
Gustavo Saiani
0bcf87123a Simplify function in LoadingAndErrorWrapper (#18081) 2021-09-28 10:02:51 -03:00
Gustavo Saiani
a46baf7ee4 Simplify LoadingSpinner animation in reduced motion (#18082) 2021-09-28 09:23:19 -03:00
Alexander Polyankin
3a2c4d3848 Add total value to static donut chart (#18091) 2021-09-28 15:13:28 +03:00
Nemanja Glumac
f1fcb7544e #18021 Repro: "Recents" list in search should display the Verified badge (#18080) 2021-09-28 13:59:46 +02:00
Alexander Polyankin
9784b89fe8 Revert "Separate positive / negative stacked charts (#18007)" (#18088)
This reverts commit 46c76c95ae.
2021-09-28 11:39:27 +03:00
Pawit Pornkitprasan
3565136042 Fix {0} being shown when locale is "pt" (#17875)
This is a combination of 2 issues:
 1) pt got renamed to pt_BR in x.39.x but the old
    "pt" value may still be stored in the database
 2) when making a release, an unclean build
    directory may be used containing old "pt"
    resource which gets leaked into the release build

1) is fixed by adding a function to treat "pt" as "pt_BR"
to support users who were on "pt" since pre-x.39.
(This is done by finding the closest fallback locale)

2) is fixed by emptying the folder before generating locales
so any old locales are deleted.

Fixes #16690
2021-09-28 10:28:04 +07:00
Pawit Pornkitprasan
594c4b070a Fix saving chart with custom expressions only retains first 2 data series (#17855)
See https://github.com/metabase/metabase/issues/15882#issuecomment-917984049 for detailed explanation.

Fixes #15882
2021-09-28 10:26:44 +07:00
Pawit Pornkitprasan
3826966878 Fix slow query when using nested native question with many rows (#18023)
`query->native` works by having `nativef` throws an exception
which causes `mbql->native` to set native query to `nil` which
then cause the rest of the execution to be skipped.

However, because the existing code skips overriding the native
query for queries already native, the execution is not skipped.

This causes bad performance for nested native question because
`query->native` is called for the sub-query which causes the
sub-query to be executed on its own, potentially without any
limit or filtering.
2021-09-28 09:18:35 +07:00
Jeff Evans
deeebec986 Adjust driver deprecation language ("a future" instead of "the next") (#18083)
Because we can't fully implement all the driver deprecation UX in time for release 41, we will adjust the language to allow flexibility for when to actually start the deprecation clock
2021-09-27 18:29:30 -05:00
Jeff Evans
25aac41480 Add test for ordering when nils are present (#17914)
Add test for ordering when nils are present

Adding test to ensure that we can handle a column containing nils in an ORDER BY clause

Adding `format-name` override for `bigquery-cloud-sdk` to convert dash to underscore in test table names

Adding comment showing IDs of each row in the daily-bird-counts.edn file

Format last column as int to make Oracle happy

Add impls for `presto` and `presto-jdbc` `sorts-nil-first?` as false

Make the `sorts-nil-first?` multimethod accept a base type in order to return an answer

Vertica, at least, has a different answer for different types; see:
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/AnalyzingData/Optimizations/NULLPlacementByAnalyticFunctions.htm#2

Updating Vertica implementation to consider the `base-type` as per its documentation

Updating all invocations of `sorts-nil-first?` in tests to pass the relevant base type
2021-09-27 16:56:35 -05:00
Greg Wilson
db7e7a0c9b Troubleshooting the app database (#17669) 2021-09-27 16:21:50 -04:00
Jeff Evans
3aeac641be Support query cancellation in new BigQuery driver (#17959)
Support query cancellation in new BigQuery driver

Remove now unused 60 second timeout

Remove a bunch of unneeded code (`with-finished-response`) from the legacy driver

Add support for canceling query, which stops pagination of results

Add test to confirm pagination stops upon cancellation

Add test to confirm that max rows enforcement via middleware prevents unnecessary pages from being fetched
2021-09-27 14:41:45 -05:00
Nemanja Glumac
e157821d61 #9027 Repro: New questions do not appear in 'Saved Questions' until you refresh the browser (#18076) 2021-09-27 20:39:02 +02:00
Nemanja Glumac
4e70f2012b Add initial E2E coverage for "Tools to fix question errors" (#18057)
* Add initial e2e test for erroring questions

* Add repro for #18050

* Add repro for #18048

* Add test section with that contains broken questions

* Improve test and add another scenario
2021-09-27 20:06:38 +02:00
Gustavo Saiani
6fbb1311b4 Start Cypress browser with prefers-reduced-motion set to true (#18041) 2021-09-27 14:54:55 -03:00
Nemanja Glumac
450bbfd297 #18063 Repro: Pin map with null locations shows tooltip of the wrong row (#18070) 2021-09-27 18:58:57 +02:00
Nemanja Glumac
8fd9318e32 Git ignore clj-kondo cache (#18071) 2021-09-27 18:57:40 +02:00
Alexander Polyankin
46c76c95ae Separate positive / negative stacked charts (#18007) 2021-09-27 19:35:50 +03:00
Nemanja Glumac
53c85aa80c #18061 Repro(s): Pin map only containing null location results crashes the frontend (#18073)
Covers all three scenarios listed in the original issue.
2021-09-27 18:32:29 +02:00
Alexander Polyankin
3c0bb00c31 Add labels to settings fields (#18072) 2021-09-27 18:50:41 +03:00
Anton Kulyk
0c81e4fdf5 Fix personal sub-collections are hidden in item picker (#18068)
* Enable repro test

* Fix personal subcollection in item picker hidden
2021-09-27 18:35:13 +03:00
Alexander Lesnenko
c276ea3381 Fix drillPK for composite keys (#18039) 2021-09-27 14:33:43 +03:00
Alexander Polyankin
24988bba20 Do not stack up channels when creating a new dashboard subscription (#18054) 2021-09-27 13:04:10 +03:00
Anton Kulyk
ba95b27028 Fix dashboard filters get invisible while dragging & text selection while dragging (#18053) 2021-09-27 11:48:25 +03:00
Alexander Kiselev
67470a082c Fix #18003 regression by adding a check for borderless buttons (#18020)
* added check for borderless buttons when setting compact padding

* fix my own silly regression

* added visual tests for run button regressions

* added minWidth to percy snapshot

* shoudl have read the docs

* Sync VIEWPORT_WIDTH and percy snapshot width
2021-09-24 14:01:32 -07:00
Jeff Bruemmer
e521360ac2 update link in troubleshooting article (#18037) 2021-09-24 16:53:46 -04:00
Alexander Polyankin
1280096183 Fix approved domains validation for alerts and dashboard subscriptions (#18049) 2021-09-24 21:55:31 +03:00
Noah Moss
97906486c4 Escape HTML in markdown cards when rendered for emails (#18000) 2021-09-24 10:26:49 -07:00
Alexander Lesnenko
42e2bda817 Update subscriptions and alerts tables when data changes (#18052) 2021-09-24 19:41:44 +03:00
Maz Ameli
f9143d322e Grammar and microcopy tweaks to Unsubscribe modal (#18040)
* grammar and microcopy tweaks

* update cypress test

* fix another test

* update test again
2021-09-24 09:40:36 -07:00
Anton Kulyk
571488b05a Fix x-ray dashboards crash on first open (#18045) 2021-09-24 18:47:05 +03:00
Anton Kulyk
c51553d645 Fix Audit logging not showing ad-hoc native queries (#18044)
* Fix test's describe block

* Mention #16845 repro

* Assert native query text is displayed in Audit

* Enable the repro test

* Fix ad-hoc native query not displayed in Audit correctly

* Don't display native query sidebar in read-only mode
2021-09-24 18:44:13 +03:00
Anton Kulyk
c225ace8e6 Fix text selection while rearranging table columns (#18032) 2021-09-24 11:34:09 +03:00
Anton Kulyk
3f7420d63a Fix drag-n-drop in dashboard visualisation settings modal (#18031)
* Add a prop to bubble mouse events on SandboxedPortal

* Fix drag-n-drop on dashoboard's viz settings modal

* Enable repro test
2021-09-24 11:32:36 +03:00
Alexander Polyankin
b557b69ce2 Skip subscriptions audit tests (#18038) 2021-09-23 23:13:05 +03:00
Nemanja Glumac
92f7549bc4 #18009 Repro: Nodata user can create dashboard subscription, but receives an error (#18014) 2021-09-23 21:37:21 +02:00
Alexander Lesnenko
10f40205f5 Handle composite pk filters (#18016)
* Handle composite PK filters as well as filtering by non unique PK fields

* unskip repro

* fix

* fix

* fixes
2021-09-23 22:35:30 +03:00
Howon Lee
82742ccc1f Tools to fix broken questions timeout fix (#17985)
Previous implementation was dog slow. This one is faster
2021-09-23 12:33:24 -07:00
Alexander Lesnenko
a4e85417bd add PK icon (#18015)
* add PK icon

* key -> label
2021-09-23 22:05:06 +03:00
Nemanja Glumac
4bb0042959 #18028 Repro: X-ray dashboards crash on first opening immediately after they are saved (#18033) 2021-09-23 20:02:25 +02:00
Alexander Polyankin
14a775f173 Revert changes to ModalRoute (#18034) 2021-09-23 20:51:05 +03:00
Jeff Bruemmer
7014115160 docs - update api doc gen code (#17994)
* update api doc gen code

* update test
2021-09-23 13:37:21 -04:00
Dalton
c74164ea3c Fetch fields before parsing parameter values so we correctly parse values for boolean fields (#17999)
* add template tag fields as dependent metadata for native queries

* check for a field_id property added by getValueAndFieldIdPopulatedParametersFromCard

* Add NativeQuery dependentMetadata unit test

* add test for loadMetadataForQuery
2021-09-23 09:22:31 -07:00
Nemanja Glumac
4188b2b5dd #6239 Repro: Not possible to sort by Custom Expression fields (#18029) 2021-09-23 18:21:27 +02:00
Ariya Hidayat
d5377a5a08 Fix #15893 by disallowing literal left-hand side in comparison (#18017) 2021-09-23 07:47:26 -07:00
Alexander Lesnenko
9393a03b1d Subscriptions and alerts audit (#17765)
* subscriptions and alerts audit

* Add tables

* Add tables

* Extract to lib

* Extract to lib

* Add modal

* Add modal

* Add modal

* Fix modals

* Fix modals

* Add children for displaying modals

* Add children for displaying modals

* Add children for displaying modals

* Add children for displaying modals

* Add edit dialogs

* Add edit dialogs

* Add edit dialogs

* Add edit dialogs

* Remove deletion

* Remove deletion

* Add users

* Add users

* Fix selection issues

* Add placeholder

* Add placeholder

* Add delete button

* Fix wrapping issues

* F

* Small fixes

* Add reloading

* fixes

* cypress specs

* fixes

* post rebase fixes

* rebase fixes

* review fixes

Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2021-09-23 17:35:10 +03:00
Nemanja Glumac
a5b85e2c3b Fix ENV case for QA_DB_ENABLED (#18027) 2021-09-23 15:44:14 +02:00
Jeff Bruemmer
419a8266ad docs - restore original file name (#18026)
* restore original file name

* links
2021-09-23 09:01:10 -04:00
Alexander Lesnenko
467eca89ac show meaningful error for waterfall chart of multiple series questions (#17992)
* show meaningful error for waterfall chart of multiple series questions

* increase readability
2021-09-23 14:31:04 +03:00
Alexander Polyankin
7401832362 Fix default formatting options for numeric types (#17978) 2021-09-23 14:27:55 +03:00
Alexander Lesnenko
14e742b89c fix tables are not clickable in recents (#17995) 2021-09-23 12:32:59 +03:00
Ariya Hidayat
2bd3d707a1 Fix #17975 by supporting getting MBQL field literal (#17982) 2021-09-22 17:24:35 -07:00
dpsutton
de39de8a35 Static Viz Formatting (#17957)
* Formatting

return a format string so it can be used over multiple rows. The rules
for formatting are quite annoying because there are defaults that are
assumed rather than present. IE, if you set a column as currency it
doesn't set the number style sometimes and defaults to USD without that
being in the settings. In the future would be far preferable to always
create a fully fleshed map of defaults rather than inferring them in
random places.

* appease our doc string supervisor

* Include column information for formatting numbers

really important for requiring two decimal places by default on doubles
and none on integers. Its close to correct ignoring it and using
"#,###.##" and this leaves non decimal places on integers and allows
only up to two on doubles, but things like 31.10 will format as 31.1 and
that is improper

* Remove unneeded metabase.test

* Update tests with nil column

* Get global viz settings in middleware, pass entire to formatting

Passing the entire viz settings to the formatting stuff makes the
calling code much simpler and the places where we merge global settings,
possibly get currency settings, etc, just in one place. We already had
the col information there so just use it.

* Remove public settings now that we get it from the metadata
2021-09-22 17:02:06 -07:00
Alexander Kiselev
428bbe31d4 Fix #17397 - "Showing first 2000 rows" is always displayed when results are loading (#17954)
* Check for existing result set when displaying
"Showing [X] rows" instead of the max limit

* added cypress test

* broke up nested ternary operators in QuestionRowCount
2021-09-22 16:10:51 -07:00
Alexander Kiselev
1fe1c7a649 Fix #16810: Dashboard "isDirty" property is set to true after the Dashboard title is updated. (#17955)
* added isDirty flag to SET_DASHBOARD_ATTRIBUTES action

* added reducer tests for SET_DASHBOARD_ATTRIBUTES with isDirty

* lint
2021-09-22 13:03:07 -07:00
Gustavo Saiani
0bb97c2039 Wrap long question titles to prevent overflows (#17996) 2021-09-22 16:26:16 -03:00
Alexander Polyankin
713ff5a84e Add unsubscribe user modal in admin (#17803) 2021-09-22 20:34:50 +03:00
Anton Kulyk
1982ba3ab9 Allow searching a table in a specific database in DataPicker (#17987) 2021-09-22 19:19:48 +03:00
Howon Lee
adc985e0b6 Audit cache controls (#18001)
We added cache control fields for dashboard and database and actually use it for cards: presumably EE folks want to audit that stuff. Here is the addition of those fields to the table views.
2021-09-22 04:25:53 -07:00
pawit-metabase
fa86e49180 fix wrong data used for click actions in old pivot table (#17937)
In `getTableClickedObjectRowData`, we try to get the
original row of the data from the rowIndex but because
the rowIndex of the pivoted table and the original table
does not necessarily match, we get the wrong data.

This commit fixes it by storing a mapping between
pivoted (row, col) and the original row number and using
that to determine which row to use for the data.

Fixes #17920
2021-09-22 09:23:33 +07:00
pawit-metabase
ae25011ff2 fix dashboard subscription default value for non-field filters (#17967)
When loading dashboard filters, the default value is in `:default`
not in `:value`. In the field filter code path, the default is
copied to `:value`. Fix the issue by calling the same code for
non-field filters too.

Fixes #15705
2021-09-22 09:23:00 +07:00
Cam Saul
da1c518eb6 Improve defsetting validation and other misc small tweaks (#17896)
* Move email->domain and email-in-domain? util functions to metabase.util

* Improve the error handling for with-temp a little more.

* Extra error context for with-temporary-setting-values

* Improve Setting docstring forms validation: handle aliased forms like `i18n/deferred-tru`

* Fix missing :require
2021-09-21 17:55:56 -07:00
Cam Saul
faf007aaa4 DELETE /api/ee/audit-app/user/:id/subscriptions archive Pulses created by user (#17981) 2021-09-21 17:55:38 -07:00
Cam Saul
d925eeb5e0 Add DashboardSubscription and Alert audit queries (#17818)
* Add DashboardSubscription and Alert table audit queries

* metastore -> premium-features
2021-09-21 17:55:29 -07:00
Dalton
d7c1e458bc When fetching field also fetch field associated with its human_readable_field_id (#17958)
* When fetching Field also fetch its associated human_readable_field_id

* add unit tests
2021-09-21 15:39:05 -07:00
Noah Moss
0305c346d6 Fully deprecate alert deletion, and rename some alert/subscription endpoints (#17740)
Co-authored-by: Alexander Polyankin <alexander.polyankin@metabase.com>
2021-09-21 12:16:21 -07:00
Noah Moss
094211eb26 GeoJSON URL validation fix (#17990) 2021-09-21 11:14:03 -07:00
Alexander Lesnenko
1f3b45aba7 handle unaggregated data warning for waterfall chart (#17988) 2021-09-21 19:15:10 +03:00
Dalton
595d75f284 treat empty string parameter in url like it is unset (#17912)
* treat empty string parameter in url like it is unset

* refactor parameter collection utils
2021-09-21 08:57:57 -07:00
Dalton
7ec9b026c6 Disable parameter widget input when not mapped to a card on dashboard (#17956)
* Add meta/Dashboard utils for checking mapped dash params

* Add tests for meta/Dashboard utils

* Add disabled prop to TextWidget

* Disable widgets using isDashboardParameterWithoutMapping fn

* Update tooltip text

Co-authored-by: Maz Ameli <maz@metabase.com>

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-09-21 08:57:25 -07:00
Alexander Lesnenko
c4ab8329df Allow using Grid map in native questies questions (#17930)
* Fix grid map is not rendered for native questions

* add check for map button
2021-09-21 17:24:55 +03:00
dpsutton
6d440668a7 For sparklines, check that viz type is line (#17950)
* For sparklines, check that viz type is line

this actually goes to fix waterfalls. They would match these
requirements but the viz type of waterfall would give results that would
dip out of the viewport. Fallback to table rendering

* Prevent waterfall rendering as sparkline

* please run that cancelled test again, GitHub®
2021-09-21 08:45:33 -05:00
Alexander Polyankin
3c417b001b Fix whitelabel overriding CSS value priority (#17924) 2021-09-21 15:06:19 +03:00
Anton Kulyk
3ea94d1503 Fix incorrect table names on join dimensions (#17976)
* Add reproduction for #17968

* Fix showing incorrect join field table names

* Test previous results str
2021-09-21 11:11:06 +03:00
Ariya Hidayat
5581b7ba6b Add repro for #17975 (#17980) 2021-09-20 14:26:05 -07:00
Jeff Evans
9b7c713b2a Handle retryable exceptions in new BigQuery driver (#17908)
Add separate catch clause for BigQueryException, to `execute-bigquery`, which conveniently includes a property to indicate whether it's retryable, and add that to the ex-data map

Add test that confirms a retryable exception is, in fact, retried
2021-09-20 16:21:17 -05:00
Alexander Polyankin
d92338ba61 Fix combined tooltip for charts (#17946) 2021-09-20 20:54:40 +03:00
Cam Saul
da97222e59 EE API endpoint code reorganization (#17913)
* EE API endpoint code reorganization

* Remove accidental commit

* test fixes 🔧

* Remove unused namespace

* Remove unused var

* Rename metabase-enterprise.audit.* -> metabase-enterprise.audit-app.*

* Move the new delete subscriptions endpoint from :advanced-config -> :audit

* Prettier
2021-09-20 10:37:29 -07:00
Alexander Lesnenko
6035c777d8 Fix missing translation of Others on the row chart (#17972) 2021-09-20 20:37:14 +03:00
Alexander Lesnenko
91d12f3765 Fix missing formatting on the x axis of the row chart (#17974) 2021-09-20 20:36:51 +03:00
Alexander Kiselev
361d8816ec added padding override to .RunButton class (#17953) 2021-09-20 09:57:49 -07:00
Anton Kulyk
3ecc0044b1 Select temporal units for join date-time dimensions (#17883)
* Test join's setDimension methods can remove dimensions

* Specify temporal-unit for Join unit tests data

* Ensure join dimensions' temporal units are the same

* Display dimension's temporal unit on Join UI

* Add E2E test for join fields temporal units

* Select temporal units for join dimensions

* Sync parent and join dimensions temporal units

* Refactor Join dimension setters

* Update subdimension check

* Update overwrite check
2021-09-20 19:45:04 +03:00
Ariya Hidayat
08d0e20971 Update order-by field when the breakout changes (#17960)
This should fix #16770.
2021-09-20 09:25:41 -07:00
Anton Kulyk
3a38c1b267 Fix questions with joins or filters cause re-run overlay after first save (#17971)
* Fix typo

* Add unit tests for `normalizeQuery`

* Normalize query clause classes for comparison

* Enable the repro test

* Rename variable
2021-09-20 19:13:33 +03:00
Alexander Polyankin
9b2064e270 Fix data points for scatter charts (#17973) 2021-09-20 18:23:18 +03:00
Alexander Lesnenko
25179f743e Move block permission under advanced permissions flag (#17927)
* Move block permission under advanced permissions flag

* fix flag name
2021-09-20 14:48:14 +03:00
Alexander Polyankin
c039d43239 Fix grid map tooltips without metric column (#17969) 2021-09-20 14:26:16 +03:00
Kim Hallen
a18eb400ea Make docs a bit more clear what values to use for MB_LDAP_SECURITY. (#17745) 2021-09-20 15:57:56 +07:00
Anton Kulyk
da6f78d57e Fix SaveQuestionModal's submit button state (#17951) 2021-09-20 10:36:44 +03:00
pawit-metabase
4dc1ab826a Fix issues reverting dashboard (#17899)
* fix reverting dashboard with card deletion

`delete-dashboard-card!` expects the :dashboard_id
parameter to be defined.

* fix frontend issues related to dashboard reverts

1) fix the dashboard not being reloaded to the
   reverted version after revert
2) fix the history list being reloaded to include
   the latest change
2021-09-20 09:30:38 +07:00
Alexander Polyankin
43cf431767 Fix the bulk actions bar on the archive page to reveal the last item (#17947) 2021-09-17 21:37:00 +03:00
Dalton
0d9ffe2e52 fix clearing of sidebar state when removing a parameter (#17934)
* fix clearing of sidebar state when removing a parameter

* add a cy test
2021-09-17 09:25:34 -07:00
Alexander Lesnenko
4e8716c6e6 Add approved domains for notifications setting (#17685) 2021-09-17 19:02:58 +03:00
Alexander Polyankin
5e961419ba Show error messages when rendering card fails (#17929) 2021-09-17 15:42:20 +03:00
Anton Kulyk
7d6e031bb0 Feature | More Granular Caching Controls (Frontend) (#17802)
* Rename dashboard details edit action

* Use render props at dashboard edit form

* Add enterprise caching plugin

* Move dashboard entity forms to own file

* Make FormField's margin configurable

* Pass custom style to FormField

* Use null as a default cacheTTLFormField value

* Add tests for DashboardDetailsModal

* Add cache_ttl field to DashboardDetailsModal

* Add tests for CreateDashboardModal

* Test cache_ttl is invisible when creating a dashboard

* Remove not used mocks

* Add tests for EditQuestionInfoModal

* Move question entity forms to own file

* Add cache_ttl field to EditQuestionInfoModal

* Test cache_ttl is invisible when creating a question

* Extract CacheTTLField component

* Don't show cache field if caching is disabled

* Fix typo

* Update cache_ttl field look

* Revert "Pass custom style to FormField"

This reverts commit 3944ca8ff1dcad478f0f1c3a1973f454447c88c1.

* Revert "Make FormField's margin configurable"

This reverts commit ca7dc434532038da736012147f6889e6cc01ec11.

* Fix CacheTTLField width

* Add descriptionPosition prop to FormField

* Add DatabaseCacheTTLField

* Show cache_ttl field on database form

* Use 24h as a default database cache TTL field value

* Fallback to database cache_ttl in question form

* Remove console.log

* Fix request body assertion for CreateDashboardModal

* Fix request body assertions for EditQuestionModal

* Fix request body assertions for DashboardDetailsModal

* Fix cache_ttl not included in `PUT /api/card/:id`

* Use simple for for EditQuestionInfoModal

* Refactor how unit tests mock caching settings

* Add dashboard caching EE test

* Add question caching EE test

* Add caching e2e test for database add/edit

* Remove debug stuff

* Add error state to CacheTTLField

* Fix DB cache field reverts to default value on 0

* Validate cache_ttl field

* Add getQuestionsImplicitCacheTTL helper

* Remove redundant tests

* Remove not used import

* Nomalize `cache_ttl: 0` to null

* Fix duplicated card update request

* Add QuestionCacheTTLField component

* Add test-id to Radio's option names

* Use a new cache TTL field for questions

* Check setting cache_ttl to null in E2E tests

* Style question cache TTL field

* Add dashboard ID to query request body

* Extend `duration` formatting helper to support hours

* Fix default caching duration display

* Fix tests

* Fix old dashboard edit action title

* Fix missing translations

* Add prop types to EditQuestionInfoModal

* Remove `test.todo`

* Simplify `getQuestionsImplicitCacheTTL`

* Use `space` style helper

* Add `key` prop to `jt`

* Move time coverting utils to lib/time

* Hide caching field label if just showing the input

* Fix unit tests

* Fix flacky E2E test

* Add hover style for "More options" control

* Fix missing translation

* Use placeholder for cache inputs

* Fix E2E tests to use cache field's placeholder

* Feature flag for caching UI
2021-09-17 12:15:58 +03:00
Dalton
550152d5c5 invalidate revision entities cache when questions/dashboards updated/deleted (#17887)
* invalidate revision entities when questions/dashboards updated/deleted

* you can't update a revision

* add a cy test to cover revision cache clearing

* let's be a little looser with revision text
2021-09-16 16:57:17 -07:00
Jeff Evans
f0b4f2f7a1 Handle REPEATED mode fields in BigQuery sync (#17907)
Recognize mode=REPEATED and return :type/Array for it

Add test for temp table using an array type column to ensure base type is recongized properly
2021-09-16 13:14:32 -05:00
Gustavo Saiani
b1d63f4a06 Do not display dashboard sticky filter container if no filters set (#17928) 2021-09-16 15:05:55 -03:00
Cam Saul
81a1a95952 Add subscription-allowed-domains allow list Setting (#17897)
* Add subscription-allowed-domains allow list Setting

* Move email->domain and email-in-domain? util functions to metabase.util

* Fix missing require

* Test fix 🔧

* Remove useless namespace

* Make subscription-allowed-domains a :string Setting rather than :csv
2021-09-16 11:02:09 -07:00
Alexander Polyankin
624e5c1179 Fix data points formatting for multi-series (#17925) 2021-09-16 20:49:40 +03:00
Howon Lee
b4b5200ee8 Tools to fix broken questions (ee) (#16842)
Tools are there. Modal is not, along with some styling, but BE has been languishing for months so I wanted to get this in
2021-09-16 01:04:38 -07:00
Ariya Hidayat
80172ee61c Test the JAR with Java 17, the new LTS (#17911) 2021-09-15 19:41:43 -07:00
pawit-metabase
72727a23d6 dashboard filter: do not display "No matching..." if not filtered (#17900)
Fixes #17211
2021-09-16 09:21:34 +07:00
Dalton
aab00d7922 fix a few prop errors causing console warnings (#17840)
* fix a few prop errors causing console warnings

* fix LastEditInfoLabel test
2021-09-15 18:19:29 -07:00
Ariya Hidayat
6939d4af39 Remove some left-over references to Leiningen (#17909)
Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-09-15 14:06:42 -07:00
Alexander Lesnenko
0d90f0adfe do not unlock question display if it was locked in unsensible visualization (#17860) 2021-09-15 20:36:27 +02:00
Alexander Polyankin
55f5b9e77d Fix whitelabling for chart colors (#17903) 2021-09-15 20:33:18 +03:00
Ariya Hidayat
227a1e9c6b Tweak Avatar: don't use attrs() with styled (#17890) 2021-09-15 09:46:47 -07:00
Jeff Evans
66ac8c99d3 Presto JDBC driver: hide Kerberos related properties when Kerberos is not enabled (#17868)
Make use of new visible-if property in plugin definition
2021-09-15 09:29:21 -05:00
pawit-metabase
5017651f35 Update URL when converting to native query (#17873)
In addition, mode should be switched to "view" to
remove "/notebook" from URL.
2021-09-15 09:24:35 +07:00
pawit-metabase
eaf06d2131 Fix showing saved value in language picker (#17853)
The locale list sent to the UI is formatted "pt-BR" but
when it is saved to the database, we re-format the locale to
"pt_BR", thus on next load, the UI cannot match the saved locale
with the locale list.

Fix the issue by using normalized value (e.g. "pt_BR") in the
available locale list.

Fixes #15657, fixes #16654
2021-09-15 09:22:59 +07:00
pawit-metabase
77c202ebe3 Fix "Include today" for relative "Next" (#17854)
"include-current" was implemented for "prev" but not for "next".

Fixes #17551
2021-09-15 09:21:08 +07:00
pawit-metabase
b178e30e81 i18n: do not remove missing plural from translation (#17799)
The ttag library expect the plural array to be exactly the size as
the number of plural forms defined in the header.

If we remove empty plural, the array will have the wrong size and
the library will crash when the trying to use the non-existent
plural.

By leaving the empty string there, the ttag library will correctly
detect it and use the English version for the missing variant.

This does not affect the backend because the backend does not
support plurals.

Fixes #16323
2021-09-15 09:19:05 +07:00
Cam Saul
8efd53712e Add new Settings (placeholders) for the new 0.41.0+ premium features (#17891)
* Add new Settings (placeholders) for the new 0.41.0+ premium features

* Code cleanup

* Add new features to the `:premium-features` Setting (for FE consumption)

* Fix busted ns declarations
2021-09-14 19:02:10 -07:00
Dalton
698109ece4 combine sidebar state for various dashboard sidebars (#17843)
* combine sidebar state for various dashboard sidebars

* replace hideClickBehaviorSidebar action with closeSidebar

* move sidebar name strings to a constants file

* add some tests
2021-09-14 18:40:26 -07:00
Cam Saul
e14854c938 Better with-temp error messages (#17889)
* Better with-temp error messages

* Undo wacky indentation
2021-09-14 17:10:39 -07:00
Alexander Kiselev
3c83fb6e54 Removed extra border-bottom on EntityItemWrapper (#17867)
styled component
2021-09-14 16:54:27 -07:00
Cam Saul
86be4ce403 Test fix 🔧 (#17888) 2021-09-14 16:41:31 -07:00
Jeff Bruemmer
bd53aed6bc docs - update API docs format (#17716)
* update API docs format

* account for other terminal punctuation

* clarify api namespace target

* update schema test, add-period test

* update period test

* parens

* test endpoint-section

* cleanup

* Cam edits

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

* trim whitespace

* file newlines

* Sort namespaces

Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
Co-authored-by: Cam Saul <github@camsaul.com>
2021-09-14 14:52:57 -07:00
Alexander Polyankin
99e9e3304d Do not reset filters when saving, cancelling, refreshing dashboards periodically (#17165) 2021-09-14 21:17:09 +03:00
Alexander Lesnenko
a9dd888e4c unskip 17738 repro (#17877)
* unskip 17738 repro

* move the repro to run in EE
2021-09-14 19:11:49 +02:00
Alexander Polyankin
b7d52e5f23 Add extra space and text trimming for static viz axes labels (#17859) 2021-09-14 18:09:44 +03:00
Ariya Hidayat
4158b783ae Remove outdated resolutions in package.json (#17863) 2021-09-14 08:01:13 -07:00
dpsutton
89b1cbe72b Handle expressions viz settings (#17866)
added the viz-settings parsing middleware to static viz. Column settings are
spec'd for regular columns and by name, but we forgot expressions apparently.
2021-09-14 09:34:02 -05:00
dpsutton
c1de8e1397 Ignore hidden tables in search (#17804) 2021-09-14 09:29:14 -05:00
Anton Kulyk
6aae28233d Add E2E test for joins on multiple fields (#17878) 2021-09-14 14:18:13 +03:00
Anton Kulyk
277e83f483 Fix removing a notebook section can remove other sections (#17727)
* Add test ID for notebook's action buttons

* Add repro for #17712

* Use `Join.clean` in join step's clean callback

* Always show a remove icon

* Fix referencing an empty dimension

* Improve Join's validity check

* Don't cleanup incomplete join sections

* Fix structured query tests

* Don't use MBQL field literals in notebook tests

https://github.com/metabase/metabase/issues/14824
2021-09-14 13:06:41 +03:00
pawit-metabase
d4e71d076e Unskip: Cannot add filter for an integer field in a question based on a saved native question (#17872)
This was already fixed since 0.40.
2021-09-14 16:34:31 +07:00
Noah Moss
552ab7d94a New email design for dashboard subscriptions, alerts and pulses (#17781) 2021-09-13 15:05:53 -07:00
Cam Saul
075124cc90 Refactor audit queries to use defmethod instead of ^:internal-query-fn metadata (#17817)
* Refactor audit queries to use defmethod instead of weird ^:internal-query-fn metadata

* Sort namespaces

* Test fix 🔧

* invoke-internal-query -> resolve-internal-query

* Fix indentation 🔧

* Minor code cleanup

* Revert change to pulse/schedule-frame?

* More test fixes 🔧
2021-09-13 14:56:14 -07:00
Cam Saul
b0e5822fd0 Fix race conditions when loading drivers (part 2) (#17368)
* Fix race conditions when loading drivers (part 2)

* Test fixes & code cleanup
2021-09-13 14:55:52 -07:00
Ariya Hidayat
90930dc6ea Fix test title (#17864)
Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-09-13 12:48:18 -07:00
Dalton
0025354d1a split dashboard.js into actions + reducers + utils (#17816)
* split dashboard.js into actions + reducers + utils

* move test files
2021-09-13 12:40:09 -07:00
Gustavo Saiani
7905f34515 Update logic to hide db add/edit fields (#17845) 2021-09-13 16:35:15 -03:00
Alexander Lesnenko
86e196b997 permissions fixes (#17757)
* permissions fixes

* database block to granular should set no self service

* unskip repro
2021-09-13 21:43:40 +03:00
Howon Lee
fd8865a845 Cache ttls nillable now (#17852) 2021-09-13 11:18:20 -07:00
Cam Saul
1a29ab8b28 Delete user pulse/alert/dashboard sub subscriptions when User becomes inactive (#17809)
* Delete user pulse/alert/dashboard subscription subscriptions when they get archived

* Automatically archive Pulses when last subscription is deleted (#17812)

* Automatically archive Pulse when its last subscription is deleted

* Test fix 🔧

* Fix occasionally-failing rotate-encryption-key!-test

* Update pulse_test.clj
2021-09-13 11:17:31 -07:00
Albert Lai
90289d4a7a Update 05-visualizing-results.md (#17684)
Correct typos
2021-09-13 10:04:05 -07:00
Ariya Hidayat
e229c5dbde Visual test for UserAvatar component (via _internal) (#17847) 2021-09-13 09:38:29 -07:00
Dalton
1129627336 move fullscreen toggle onClick to button from icon el (#17844) 2021-09-13 09:35:32 -07:00
Dalton
48658c630a Don't pass a component with propTypes to forwardRef (#17836) 2021-09-13 09:35:17 -07:00
Gustavo Saiani
fdcb310112 Update link to e2e doc page (#17857) 2021-09-13 13:26:14 -03:00
Alexander Polyankin
e865ed59f1 Fix dashboard subscriptions sidebar for sandboxed users (#17823) 2021-09-13 19:07:42 +03:00
Jeff Evans
75f2207de3 Fix support for NUMERIC and BIGNUMERIC types (#17837)
Add parameter handling for BigDecimal that checks whether the value is in range for BIGNUMERIC or BIGDECIMAL and sets accordingly

Updating parameter test to hit both these cases

Modifying test code/macros to support a with-table semantic for testing the decimal types via a temp table

Writing new test to confirm that all numeric types are synced correctly and can be queried for
2021-09-13 10:02:34 -05:00
Greg Wilson
874750ee04 Filling in missing text (#17835) 2021-09-13 10:23:15 -04:00
Jeff Bruemmer
6e046fb87e docs - dev guide links (#17842)
* raw tags

* index to start

* update toc link

* reference link
2021-09-11 09:08:02 -04:00
Ariya Hidayat
f3a170994c Basic skeleton of front-end dependencies analyzer (#17743)
* Basic skeleton of front-end dependencies analyzer

* Parse enterprise/frontend

* Handle good ol' require

* For sanity, bail out immediately when encountering a parse errr

* Split into commands (currently returning JSON)

* Filter dependents from stdin

* Track down all dependents, including the indirect/transitive ones

* Fix filtering not including the enterprise

* Map a directory to its index.js, if it exists

* Refactor common functions

* Matrix and count dependents
2021-09-10 20:40:17 -07:00
Howon Lee
9774e08da5 BQ expression fixes (#17347)
This was a miserable grind in the old BQ syntax but a happy fun time in the new BQ syntax, basically just turning it on and squashing a bunch of test bugs.

One test bug to note especially is that the underscore-transformed set of bird scarcity data for the bird scarcity tests is actually necessary, because BQ will hit you with a complaint about underscores even if you successfully and correctly quote the table names.
2021-09-10 14:49:37 -07:00
Ariya Hidayat
9863bd7834 Ignore the coverage of semi-constructors only for type hints (#17841) 2021-09-10 14:48:09 -07:00
Dalton
b26fadd75a fix PropTypes console warning (#17838) 2021-09-10 14:32:26 -07:00
Dalton
520a8a16fc add keys to arrays of routes (#17839) 2021-09-10 14:32:14 -07:00
pawit-metabase
af83e559a9 Do not bin relation fields even if they have fingerprints (#17782)
Fixes #17768
2021-09-10 14:45:45 +07:00
Howon Lee
73c7a9d1ac DB and Dashboard-contingent caching backend (#17679)
There's more to come WRT the audits, but anton and I agreed to merge something faster and work on that stuff after
2021-09-09 18:20:00 -07:00
Dalton
faad557b6d don't show exact seconds for a formatted relative time (#17828)
* don't show exact seconds for a formatted relative time

* add a couple of getRelativeTimeAbbreviated tests
2021-09-09 16:04:55 -07:00
Alexander Polyankin
bae75e2045 Fix settings saving behavior (#17810) 2021-09-09 21:59:48 +03:00
Cam Saul
3e86afd683 Unify .dir-locals.el files (#17815) 2021-09-09 10:02:33 -07:00
Gustavo Saiani
1872363942 Remove unused arguments from functions (#17805) 2021-09-08 18:50:38 -03:00
Noah Moss
5c30146b6d Allow creating & editing dashboard subscriptions if you have view-only access to a collection (#17722) 2021-09-08 14:41:24 -07:00
Dalton
9a0c989fd1 translate options in SchedulePicker (#17792) 2021-09-08 14:25:51 -07:00
Dalton
76ccd32a46 remove a random console.log call (#17806) 2021-09-08 13:19:46 -07:00
Alexander Polyankin
755d8a1aa7 Adds paid plan-specific links (#17748) 2021-09-08 23:03:35 +03:00
dpsutton
6aba6f1e8a Static viz send viz settings (#17736)
* Pass along date formatting

* extract and rename some things

* Number formatting

* Update tests

* Improve test validation of svg labels

* Clean up tests

* Move static-viz interface file to custom file
2021-09-08 14:31:19 -05:00
Nemanja Glumac
8bdcb06c1d Attempt to fix #17751: filter widget input value overflowing (#17761)
Merging on behalf of Nemanja

* Attempt to fix #17751

* Revert limiting max-width on a parent div

* Inherit min-width from a parent div

* Unskip repro
2021-09-08 19:48:40 +02:00
Dalton
a697c29aad don't set pulse on SharingSidebar mount to prevent race condition when moving between sidebar views (#17791)
* don't set pulse on SharingSidebar mount

* remove some old, unused code
2021-09-08 09:50:48 -07:00
Dalton
037ee68ccd let users disable attachments with questions checked (#17793)
* let users disable attachments with questions checked

* use more declarative assertions in unit tests

* use aria-label over testid

* translate aria label
2021-09-08 09:50:31 -07:00
Nemanja Glumac
0f2aa5aff7 Move notifications spec to the onboarding folder (#17794) 2021-09-08 12:43:45 +02:00
Doni Rubiagatra
faf54500a0 bugfix: browse data sorted using display name (#17542) 2021-09-08 14:35:01 +07:00
pawit-metabase
2ffb8cb0a7 dimension list: hide sub-dimensions for fields that are FK (#17783)
Fixes #16787
2021-09-08 10:37:30 +07:00
pawit-metabase
e10adcdff6 Fix SAML login with OpenAM (#17785)
OpenAM SAMLResponse contains "\r\n" every 76 characters
leading our SAML code to think it's not base64-encoded.

Fix by relaxing our valid base64 check to ignore all spaces.

Fixes #15567
2021-09-08 10:33:51 +07:00
pawit-metabase
32c5b2a4ba Fix unable to click "Learn more" on custom expression (#17774)
* expression editor: allow clearing help text with Escape key

Move the code to clear help text to "clearSuggestions" method
allowing the Escape key to also be used to close the help popup.

* expression editor: don't show error on window unfocus

* expression editor: allow clicking on "Learn more"

Clicking on the "Lean more" link removes the focus
from the input box, causing the help dialog to get
hidden and become unclickable.

Fix by cancelling the mouse down event causing the
input box to maintain the focus.

Fixes #17548

* add cypress test
2021-09-08 09:49:53 +07:00
Nemanja Glumac
3ffed24722 #17763 Repro: Trying to set "Granular" permissions after "Block" is broken (#17787) 2021-09-08 00:07:56 +02:00
Nemanja Glumac
15b2a6d1af #17777 Repro: Hiding all tables in data model removes them from the permissions page (#17779) 2021-09-07 23:51:26 +02:00
Dalton
6561cda1d8 remove Parameters component defaultProps to get rid of warning message (#17788) 2021-09-07 13:09:51 -07:00
Dalton
37810686b6 rmv .info.js files from coverage (#17766) 2021-09-07 10:24:05 -07:00
Noah Moss
6df2894bab XLSX export formatting for pulse attachments (#17755) 2021-09-07 07:05:01 -07:00
Nemanja Glumac
3f083b8da8 #16785 Repro: Search shows hidden tables (#17786) 2021-09-07 15:29:40 +02:00
Alexander Polyankin
5ae6e2d0c1 Fix sorting admin sections by order (#17759) 2021-09-07 14:58:06 +03:00
Greg Wilson
6a6e1c6cd3 Fixing a missing link in Markdown (#17735) 2021-09-07 07:46:59 -04:00
Nemanja Glumac
8bda46bd01 #17775 Repro: Dashboard filter on a custom column doesn't work (#17780) 2021-09-07 12:54:09 +02:00
Nemanja Glumac
7809582168 New permissions E2E CI group (#17778) 2021-09-07 09:30:27 +02:00
Anton Kulyk
9ecd368043 Refactor CollapseSection (#17754) 2021-09-07 10:14:51 +03:00
Nemanja Glumac
9a9a987d61 #17768 Repro: If Entity Key fields are fingerprinted, then they show binning options in GUI (#17776)
* Add repro for #17768

* Wait for the sync to finish programatically
2021-09-06 22:41:41 +02:00
pawit-metabase
52c9a610ad Fix field filter no longer responding after selecting "None" (#17746)
Uncontrollable.jsx treats "undefined" value specially breaking
the onClick handler

Fixes #13825
2021-09-06 09:28:10 +07:00
Gustavo Saiani
ceb0af3762 Make dashboard filters sticky in edit mode (#17719) 2021-09-03 21:16:25 -03:00
Nemanja Glumac
f200351569 #17738 Repro: "Native query editing" permission selector is inconsistent between "No self service" and "Block" permissions (#17742)
* Add repro for #17738

* Update repro according to the product requirements
2021-09-04 01:05:30 +02:00
Nemanja Glumac
e0ded3a98f #17751 Repro: Filter with a single long value hides the remove-button (#17760) 2021-09-04 00:51:59 +02:00
Nemanja Glumac
b4a41beef1 Edit Permissions help text (#17741) 2021-09-03 17:35:26 +02:00
Nemanja Glumac
dd5d635f68 Run Percy (sanity check) visual tests in CircleCI (#17747)
* Run percy (sanity check) visual tests in CircleCI

* Update path for visual tests

* Make `--folder` flag optional

* visual tests docs

Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
2021-09-03 14:42:14 +02:00
Noah Moss
f9a649db41 Remove deprecated pulse DELETE API (#17700) 2021-09-02 19:49:24 -07:00
Alexander Lesnenko
70d905be4f fix percy cypress tests (#17733) 2021-09-02 18:39:05 +03:00
Alexander Polyankin
0c646eb9d2 Hide configurations that are handled by Cloud (#17730) 2021-09-02 18:35:09 +03:00
Alexander Polyankin
7aecb4ef27 Donut fixes (#17731) 2021-09-02 17:44:18 +03:00
Alexander Polyankin
1a22829120 Refactor static viz, add formatting, add area chart (#17728) 2021-09-02 15:54:55 +03:00
Alexander Lesnenko
bf67b51329 Block permission front-end (#17638)
* Block permission

* Update frontend/src/metabase/admin/permissions/components/DataPermissionsHelp/DataPermissionsHelp.jsx

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

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2021-09-02 09:54:33 +03:00
Ariya Hidayat
e11b1c9f32 Migrate frontend docs from wiki (#17720) 2021-09-01 17:31:05 -07:00
Noah Moss
512c9deab6 Add archived parameter to GET /api/alert/question/:id (#17645) 2021-09-01 15:45:01 -07:00
Cam Saul
4a0db8e1e0 Fix chain filter search against FieldValues that contains nil (#17706)
* Fix the chain filter functions with nil FieldValues (fix #17659)

* Reorganize test a bit.

* Simplify test

* More simplification

* Test fix 🔧

* Test fix part 2

* [ci nocache]
2021-09-01 14:04:45 -07:00
Cam Saul
4d4ca72f46 Make sure built drivers do not contain clojure core classes. Handle either string or keyword args to build scripts (#17608)
* No Clojure core classes please

* Don't try to make paths absolute twice. Build scripts should handle keyword args like ':driver'

* parse-as-keyword should return keywords as is

* Test fix 🔧

* Test fix 🔧

* Test fix part 2
2021-09-01 14:04:29 -07:00
Dalton
1803035951 use preventScroll in focus call in ListSearchField (#17692)
* use preventScroll in focus call in ListSearchField

* add a few ListSearchField unit tests
2021-09-01 12:01:29 -07:00
Dalton
786a4b7ee0 only apply DataSelectorContainer css hack in QuestionDataSelector (#17676)
* only apply DataSelectorContainer hack in QuestionDataSelector

* unskip repro
2021-09-01 12:01:18 -07:00
Anton Kulyk
8dab3a31de Fix joins with incomplete conditions are removed on query run (#17708) 2021-09-01 21:58:13 +03:00
Noah Moss
f092db5a36 Only delete alert for card with multiple breakouts when a goal is defined (#17678) 2021-09-01 11:52:28 -07:00
Anton Kulyk
e1fbaad296 Add jest-watch-typeahead plugin (#17713) [ci nocache]
* Install jest-watch-typeahead
2021-09-01 19:35:22 +02:00
Gustavo Saiani
7f175cdf6b Close all descendant collections when clicking on an open parent (#17703) 2021-09-01 13:24:37 -03:00
Gustavo Saiani
37b84980cd Collection sidebar: expand/collapse children when clicking on parent collection name (#17680) 2021-09-01 13:24:01 -03:00
dpsutton
4717d2ff6c Collapse small donut slices into a single "Other" category (#17637)
* Collapse small donut slices into a single "Other" category

* Locale aware decimal formatting

A followup PR will add all of the formatting options for scalars and
smart scalars so this function is largely temporary and will be
subsumed into a namespace that knows about all formatting options.

* empty with no cache [ci nocache]
2021-09-01 10:40:10 -05:00
Nemanja Glumac
9baebf4dc0 Remove Cypress from yarn resolutions (#17715)
Since the Webpack and Babel upgrades, this shouldn't be needed any more. In the past, we had to explicitly resolve to the specific version of Cypress. Now it resolves to this version by default.
2021-09-01 16:06:01 +02:00
Nemanja Glumac
d1e086efd8 Fix #17673: Rounded buttons have excessive white background (#17697)
* Remove white background from `Select` component's container

* Remove superfluous `text-bold` class from the `Select` component
2021-09-01 14:45:09 +02:00
Luis Paolini
44e5987a26 Fix Cypress binary not being available (#17705)
The node_modules folder was being persisted in the first step (checkout) as it's doing the building of the static viz package. This had an impact in the fe-deps step, so wiping the folder and doing a clean install should make the trick
2021-09-01 09:18:48 -03:00
pawit-metabase
2b037d838b sqlite: update sqlite-jdbc to 3.36.0.1 and improve date/time handling (#17567)
* update sqlite-jdbc to 3.36.0.1

The new version includes arm64 binaries and allows Cypress,
which uses SQLite, to run on Apple Silicon.

* Improve date/time handling in SQLite
2021-09-01 17:28:51 +07:00
Cam Saul
cd758c966f Fix failing geolocation test 🔧 (#17707) 2021-09-01 11:00:16 +02:00
Cam Saul
6593266572 Test init code: read driver parents from driver deps.edn (#17612)
* Test init code: read driver parents from driver deps.edn

* Rename :metabase.build-driver/parents -> :metabase.driver/parents
2021-08-31 19:04:52 -07:00
Nemanja Glumac
404e6f8865 #17658 Repro: Not possible to delete dashboard subscription unless dashboard is in root collection (#17699) 2021-09-01 01:44:09 +02:00
Cam Saul
e6358cc9fb Fix setting Block permissions in the permissions/graph API endpoints (#17651)
* Fix setting Block permissions in the permissions/graph API endpoints

* Revert changes to .dir-locals

* Perms graph: don't validate DB :schemas + :native unless both are present.

* PR feedback
2021-08-31 16:33:15 -07:00
Noah Moss
3344e09e81 Only include dashboard subscriptions in GET /api/pulse if user_id param is included (#17647) 2021-08-31 15:36:14 -07:00
dpsutton
538c94a9dd Svg test improvements (#17652)
* Ensure that data_readers functions are included in tests

`clj -X:dev:test :only metabase.pulse.render.js-svg-test` uses the
`#t` data reader, which passes the value to
`metabase.util.date-2/parse` but this function hasn't been evaluated
yet and it errors

```shell
% clj -X:dev:test :only metabase.pulse.render.js-svg-test
Warning: environ value /Users/dan/.sdkman/candidates/java/current for key :java-home has been overwritten with /Users/dan/.sdkman/candidates/java/11.0.11.hs-adpt
Running tests in metabase.pulse.render.js-svg-test
Syntax error reading source at (metabase/pulse/render/js_svg_test.clj:71:27).
Attempting to call unbound fn: #'metabase.util.date-2/parse
```

* Throw an error if resource is not found when loading sources

```shell
ERROR in metabase.pulse.render.js-svg-test/categorical-donut-test (js_engine.clj:37)
Uncaught exception, not in assertion.

clojure.lang.ExceptionInfo: Javascript resource not found: frontend_client/app/dist/lib-static-viz.bundle.js
    source: "frontend_client/app/dist/lib-static-viz.bundle.js"
   metabase.pulse.render.js-engine/load-resource    js_engine.clj:   37
    metabase.pulse.render.js-svg/load-viz-bundle       js_svg.clj:   94
 metabase.pulse.render.js-svg/static-viz-context       js_svg.clj:  100
                 metabase.pulse.render.js-svg/fn       js_svg.clj:  106
                                             ...
                              clojure.core/deref         core.clj: 2324
metabase.pulse.render.js-svg/timelineseries-line       js_svg.clj:  167
         metabase.pulse.render.js-svg-test/fn/fn  js_svg_test.clj:   75
            metabase.pulse.render.js-svg-test/fn  js_svg_test.clj:   74
                        clojure.test/test-var/fn         test.clj:  717
                           clojure.test/test-var         test.clj:  717
                   metabase.test-runner/run-test  test_runner.clj:  107

...
```

```shell
ERROR in metabase.pulse.render.js-svg-test/categorical-donut-test (Objects.java:221)
Uncaught exception, not in assertion.

java.lang.NullPointerException:
                java.util.Objects.requireNonNull     Objects.java:  221
      org.graalvm.polyglot.Source$Builder.<init>      Source.java:  725
          org.graalvm.polyglot.Source.newBuilder      Source.java:  546
   metabase.pulse.render.js-engine/load-resource    js_engine.clj:   34
    metabase.pulse.render.js-svg/load-viz-bundle       js_svg.clj:   94
 metabase.pulse.render.js-svg/static-viz-context       js_svg.clj:  100
                 metabase.pulse.render.js-svg/fn       js_svg.clj:  106
```

* Sort effects namespace
2021-08-31 17:31:27 -05:00
Noah Moss
f696b25f55 Don't throw exception when archiving a dashboard in non-root collection (#17670) 2021-08-31 15:31:17 -07:00
Ariya Hidayat
0165980760 Remove some superfluous return types in the queries library (#17681)
All of these can be correctly inferred already, thus there is no need to
the explicit type annotations.
2021-08-31 13:29:14 -07:00
Nemanja Glumac
8e4dc2960d Add "on" string to translation (#17696) 2021-08-31 21:01:11 +02:00
dpsutton
fd6414e8c7 Turn dataset_query into structured data in search results (#17690)
* Turn dataset_query into structured data in search results

* sort scoring test ns

* Fixup tests

we are no longer returning string results. The cards in the test have
empty queries, which the model turns into {} but normalization removes
empty clauses and returns nil. The tests would be too annoying to hook
this up to work properly and this functionality is tested in other
places.

* Unskip repro for #15959

* Update repro test

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2021-08-31 12:49:23 -05:00
dpsutton
ab75c941e5 Add i18n to js engine (INTL) (#17688) 2021-08-31 10:23:40 -05:00
Anton Kulyk
7eb47a9289 Allow joins on multiple fields in the notebook editor (#17633)
* Separate Join unit tests with newlines

* Refactor Join's unit tests

* Add join type getters (by conditions count)

* Add getter and setter for join conditions by index

* Remove old comment

* Extract method converting dimensions

* Update setParentDimension

* Update setJoinDimension

* Update joinDimensions method

* Update joinDimensions method

* Update join alias setter

* Update default condition setter

* Update isValid method

* Add getConditions method

* Add addEmptyDimensionsPair method

* Render multiple join conditions

* Fix JoinStep align-items

* Fix join dimension methods usage

* Fix join dimensions alignment

* Temporary disable auto opening pickers

* Test adding a new dimensions pair

* Fix "add" join icon visibility

* Add "on" label between join conditions

* Remove redundant `else`

* Add `removeCondition` method for `Join`

* Fix JoinDimensionPicker's prop types

* Allow removing empty dimension pairs

* Add space between join dimensions

* Simplify JoinStep tests setup

* Automatically open dimension pickers

* Test JoinStep updates `Join` instance correctly

* Display dimensions source name

* Allow overwriting NotebookCell's padding

* Fix JoinStep layout

* Allow to clear a selected dimension

* Disable "no-unused-vars" for Join file

* Fix parentDimension usage

* Fix StructuredQuery's `Join` usage

* Update notebook visual test

* Fix E2E test

* Fix JoinStep look when no dimensions selected

* Extract JoinDimensionsRightControl component

* Extract JoinDimensionCellItem component

* Increase JoinStep's tests timeout

* Extract `_getExplicitJoinsSet` from StucturedQuery

* Fix unused variables in Join class

* Add a comment about setTimeout

* Fix join condition label

* Fix dimensions picker opens when dimension is set

* Make table icon container clickable

* Hide fields picker tooltip on picker open

* Fix Preview button overflowing JoinStep

* Fix table picker click area
2021-08-31 17:19:48 +03:00
Noah Moss
0c48f947e4 unskip repro (#17674) 2021-08-31 07:14:44 -07:00
Nemanja Glumac
e55cbe36db Fix #17657: No recipients causes error resulting in blank screen (#17668)
* Invalidate the pulse if it contains no recipients

Switch statement was returning `true`, resulting in falsely "valid" pulse
in the case there were no recipients but the schedule was set to month.

This commit fixes that.

* Move all conditions before the switch statement

* Enable repro for #17657

* Guard against the error that causes the white screen

* Add another repro for #17657

* Fix typo in the test name

* Fix typo in the unrelated comment
2021-08-31 15:02:10 +02:00
Gustavo Saiani
c762e34ef2 Fix better source map option and add documentation (#17675) 2021-08-31 09:12:17 -03:00
Alexander Polyankin
e5dbebd032 Add vertical labels for bar chart (#17664) 2021-08-31 14:40:40 +03:00
Ariya Hidayat
b0a9dbeec2 CI with GitHub Actions: bump the timeout for front-end unit tests (#17682)
With the code being instrumented for code coverage, and another
additional time to analyze + send the code coverage to codecov.io,
the typical execution runs awfully close to the 10-min limit.
Hence, add some extra room.
2021-08-30 21:18:57 -07:00
Gustavo Saiani
a7351e9b30 When creating database, pass syncing schedule options to api (#17639) 2021-08-30 15:52:47 -03:00
Nemanja Glumac
8c33a9d465 #17657 Repro: Subscriptions are enabled without the recipient, which leads to an error (#17666) 2021-08-30 19:09:47 +02:00
Kyle Doherty
23f6b761d0 match tick stroke color to axis stroke color (#17665) 2021-08-30 12:43:50 -04:00
Jeff Evans
417736688b Isolate BigQuery legacy and new driver test runs (#17626)
* Randomize BigQuery test view names

Use tu/random-name instead of a name based on the output of gensym

* Add extra prefix for legacy BigQuery driver created databases

* Update legacy BigQuery driver to have unique name for transient datasets

For those datasets created and destroyed by the legacy BigQuery driver QP tests, add an additional prefix so that it doesn't conflict with the new BigQuery driver tests
2021-08-30 11:43:30 -05:00
Alexander Polyankin
dd6f0cc453 Vertical legend fixes for LineAreaBarChart (#17552) 2021-08-30 19:10:35 +03:00
Alexander Polyankin
c5058a78e0 Fix notification management FE issues (#17618) 2021-08-30 17:00:14 +03:00
Nemanja Glumac
eff984039d Consolidate dashboard sql filters (#17661)
* Rename file to make it more specific

* Extract dashboard sql filters into separate folder and CI group

* Add short descriptions to dashboard filters repros

* Extract dashboard sql filters helpers (data objects)
2021-08-30 15:41:42 +02:00
Ariya Hidayat
864e78d6af ESLint rules to prevent prop shorthands for w and h (#17656) 2021-08-30 06:07:54 -07:00
Nemanja Glumac
1a062c36d9 Add test for dashboard filter applied to the explicitly joined field (#17650) 2021-08-28 21:13:25 +02:00
Gustavo Saiani
eb6708b593 Extract sidebar component from DatabaseEditingApp (#17597) 2021-08-28 06:04:20 -03:00
Ariya Hidayat
f16bf7b021 GridItem should not use prop shorthand (#17610) 2021-08-27 23:13:54 -07:00
Ariya Hidayat
1b75128f47 Avoid prop shorthand in month-year parameter widget (#17654) 2021-08-27 19:28:43 -07:00
Noah Moss
76514a2e59 Fix options menu in visualization settings sidebar (#17629) 2021-08-27 17:55:28 -07:00
Ariya Hidayat
ccdbb8e999 Components in store admin should not use prop shorthands (#17640) 2021-08-27 17:19:01 -07:00
Alexander Lesnenko
ea95633064 Add recent views list (#17582)
* slightly split existing search components

* add recent views list

* fix recent items moving when reopened

* extract TablePath component

* Add e2e specs for recents

* add specs

* add in table view logs so we get recent table looks

* review fixes

* use display_name for tables in recents list

* display name

* add loader threshold, return only 5 recents

Co-authored-by: Howon Lee <hlee.howon@gmail.com>
2021-08-28 01:39:09 +03:00
Alexander Lesnenko
de7141af6e slightly split existing search components (#17581)
* slightly split existing search components

* address review comments

* review fixes
2021-08-28 01:39:09 +03:00
Nemanja Glumac
4826248e13 [Dashboard filters coverage] Add test for required and default values set on dashboard SQL filters (#17628)
* Add test for required and default values set on dashboard SQL field filters

* Add test for required and default values set on dashboard SQL simple filter
2021-08-27 21:59:47 +02:00
Nemanja Glumac
245004dde1 Unskip and relocate (extract) repro for #13960 (#17641) 2021-08-27 21:59:13 +02:00
Greg Wilson
5f8366a5a2 Troubleshooting: can't log in (#17558)
* Outline for login troubleshooting guide

* Update docs/troubleshooting-guide/cant-log-in.md

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

* Update docs/troubleshooting-guide/cant-log-in.md

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

* Importing material

* Prosifying

* Updates based on feedback

* Another update to login troubleshooting

* Fixing typo

* One more update

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-08-27 15:26:08 -04:00
Jeff Bruemmer
4beb075747 docs - troubleshooting sandboxing (#17593)
* draft update to sandbox troubleshooting

* update link

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Update docs/troubleshooting-guide/sandboxing.md

* Removing double blank line

* updates based on feedback from flamber

Co-authored-by: Greg Wilson <gvwilson@third-bit.com>
2021-08-27 15:25:54 -04:00
Ariya Hidayat
5e6da0d198 Revamped Developer's Guide (#17625) 2021-08-27 08:48:05 -07:00
Nemanja Glumac
813bb1f5f9 Add initial set of tests around SQL dashboard ID filters (#17607) 2021-08-27 14:43:55 +02:00
Nemanja Glumac
e913ee907f #17490 Repro: Field Filter variable type cut off by Nav for SQL questions (#17605) 2021-08-27 14:42:07 +02:00
Nemanja Glumac
e1324eb874 #17615 Repro: Valid Email settings disappear on save (#17624) 2021-08-26 22:54:08 +02:00
Nemanja Glumac
517ffdc97c Unskip "email" part of the reproduction for #16226 (#17623) 2021-08-26 22:25:24 +02:00
Nemanja Glumac
029d717886 #17619 Repro: "More options" menu not opening (#17622) 2021-08-26 21:12:28 +02:00
Jeff Evans
babbffbc44 Improve driver deprecation UX (#17281)
* Improve driver deprecation UX

Reworking the DriverWarning component to be able to change the engine itself by firing the event (so that the "go to older/newer version" links actually work)

Some styling fixes to match Figma mockup

Remove all grid-styled usage

Remove all styling (except class names) from DriverWarning jsx file, move to the styled-component

Implement db-ids-with-deprecated-drivers API endpoint for fetching DB IDs using deprecated drivers

Add some plugin test init code to properly handle the test legacy/new drivers

Adding test for new API

Adding new entry in `MetabaseApi` frontend component for new API method
2021-08-26 14:02:11 -05:00
Nemanja Glumac
60146bf4ce Keep mongo 4.0 for backend tests until its end of life (#17575) 2021-08-26 20:47:26 +02:00
dpsutton
18659376eb categorical bar on the backend (#17620) 2021-08-26 13:25:43 -05:00
Cam Saul
da3a3f5824 Support building and hacking on third-party drivers with our new Clojure CLI setup (#17606)
* Determine MB project root directory relative to source directory of build scripts

* Support calling build-driver! as a -X fn, and support dirs outside of modules/drivers

* Support loading 3rd-party driver manifest files at (dev) launch

* Fix log4j not working on latest version of CIDER (unrelated)

* Fix dissoc

* project-root-directory is supposed to be a string
2021-08-26 10:11:57 -07:00
Alexander Polyankin
e498004c99 Add simple static categorical bar (#17600) 2021-08-26 18:26:27 +03:00
Ariya Hidayat
25a5fd4ea7 Correct the instruction to run E2E tests (#17603) 2021-08-26 06:06:42 -07:00
Ariya Hidayat
a951668d23 Avoid prop shorthand in query download widget (#17611) 2021-08-25 17:47:57 -07:00
Cam Saul
bf2ba1f31d Block permissions backend (#17428)
* ⛔ B L O C K ⚠ permissions ✅

* Fix test failure in OSS since EE namespace doesn't exist.

* Remove unused var

* Oops, uncomment a commented-out test

* Clean up the new perms documentation a bit
2021-08-25 17:03:44 -07:00
Ariya Hidayat
7dc5d97797 Example snippet should not use prop shorthand (#17604) 2021-08-25 16:58:04 -07:00
Noah Moss
9da5466553 Include markdown cards in Slack dashboard subscriptions (#17457) 2021-08-25 12:31:13 -07:00
Jeff Evans
0023987f49 Update Presto JDBC lib version (#17591)
0.254 -> 0.260
2021-08-25 14:04:45 -05:00
Alexander Lesnenko
5c3e84ec25 fix permissions editor missing scroll (#17595) 2021-08-25 21:03:21 +03:00
Alexander Lesnenko
80f8813b89 use backticks in auto-backport workflow (#17594) 2021-08-25 20:50:27 +03:00
Alexander Polyankin
3d874e2732 Add modals to unsubscribe from and archive notifications (#17516) 2021-08-25 20:35:17 +03:00
Anton Kulyk
548358a4b1 Fix run overlay not going away on GUI questions (#17590)
* Enable repro tests

* Don't sync stuctured questions on query complete
2021-08-25 10:00:49 -07:00
dpsutton
c8c984feb6 User details on moderation review (#17482)
```bash

% curl 'http://localhost:3000/api/card/760' -H <stuff omitted> | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2003    0  2003    0     0   102k      0 --:--:-- --:--:-- --:--:--  102k
{
  "description": null,
  "archived": false,
  "collection_position": null,
  "table_id": 2,
  "creator_id": 1,
  "moderation_reviews": [
    {
      "most_recent": true,
      "moderator_id": 1,
      "updated_at": "2021-08-16T21:30:00.665952Z",
      "status": "verified",
      "id": 1026,
      "user": {
        "email": "dan@metabase.com",
        "first_name": "dan",
        "last_login": "2021-08-10T21:17:35.366176Z",
        "is_qbnewb": false,
        "is_superuser": true,
        "id": 1,
        "last_name": "sutton",
        "date_joined": "2021-03-15T20:42:55.751834Z",
        "common_name": "dan sutton"
      },
      "moderated_item_id": 760,
      "created_at": "2021-08-16T21:30:00.665952Z",
      "moderated_item_type": "card",
      "text": null
    }
  ],
  "dataset_query": {
    "database": 1,
    "query": {
      "source-table": 2
    },
    "type": "query"
  },
  "id": 760,
  "display": "table",
  "last-edit-info": {
    "id": 1,
    "email": "dan@metabase.com",
    "first_name": "dan",
    "last_name": "sutton",
    "timestamp": "2021-05-12T22:04:57.205978Z"
  },
  ...
}
```
2021-08-25 09:50:30 -05:00
dpsutton
32a0d6cb54 Effective type in result cols (#17533)
* Include the results base type as the cols effective type

previously was merged the effective type from the col which caused
issues with dates when selecting a particular temporal unit, ie month.

Queries like this return months as integers so the base and effective
types are :type/Integer, and something somewhere else is responsible
for the unit conversion of `1` to January (or feb, months get weird i
think)

```clojure

;; after
{:description "The date and time an order was submitted.",
 :unit :month-of-year,
 :name "CREATED_AT",
 :field_ref [:field 4 {:temporal-unit :month-of-year}],
 :effective_type :type/Integer, ;; we have the proper effective type
 :display_name "Created At",
 :base_type :type/Integer}

;; before:
{:description "The date and time an order was submitted.",
 :unit :month-of-year,
 :name "CREATED_AT",
 :field_ref [:field 4 {:temporal-unit :month-of-year}],
 :effective_type :type/DateTime, ;; included effective type from db
 :display_name "Created At",
 :base_type :type/Integer}
```

* tests

* Driver tests

* Ignore effective/base types in breakout tests

sparksql is weird and its totally unrelated to the file under test

* Use correct options for datetimes that are projected to month, etc

When aggregating by a datetime column, you can choose a unit: month,
hour-of-day, week, etc. You often (always?) end up with an
integer. Previously the base_type was (inexplicably) :type/Integer and
the effective_type was :type/DateTime which really just didn't make
sense. The ideal solution is :type/DateTime as the base_type and
:type/Integer as the effective_type. But this breaks the frontend as
it expects to treat these columns in a special way. But it expected
them to report as date columns.

I've changed it only here. I thought about making isDate understand
the `column.unit` attribute and recognize that these are in fact
dates, but that seems wrong. These are integers that are special
cases. It seems that the contexts that need to talk about dates should
understand integers in a special way than all date code needs to be
aware that integers might flow through.

This might mean extra work but ultimately feels better as the correct
solution.

* unit is not default
2021-08-25 09:37:21 -05:00
Nemanja Glumac
d469362e71 Fix references to the possessive form of 'its' (#17589) 2021-08-25 15:25:45 +02:00
Anton Kulyk
79ea2d32d3 Update notebook editor's join step UI (#17523)
* Move JoinStep's NotebookCell down to JoinClause

* Break JoinClause into two NotebookCells

* Update labels

* Use `space` helper function

* Simplify conditional statement

* Fix not translated string
2021-08-25 15:34:20 +03:00
Alexander Polyankin
5a79539ed4 Add read-only Notifications tab (#17503) 2021-08-25 15:25:21 +03:00
Ariya Hidayat
6a815f5d34 Make the front-end metadata sources valid JavaScript (#17539) 2021-08-24 20:04:00 -07:00
Gustavo Saiani
0136165b96 Unify styled component file extensions: .styled.js → .styled.jsx (#17580) 2021-08-24 20:28:05 -03:00
Jeff Evans
f5cf47480b Add Kerberos support to Presto JDBC Driver (#16307)
* Add Kerberos support to Presto JDBC Driver

Adding Kerberos properties as DB details properties

Refactoring utility methods for dealing with additional options

Adding test for Kerb properties -> connection string

Adding GitHub action to run integration test

Start to move logic for capturing necessary files to new script, and calling that from mba run

Adjust settings in `metabase.test.data.presto-jdbc` to capture test parameters
2021-08-24 17:18:26 -05:00
Jeff Evans
ee73902a68 Support counting grouped on an aggregated field in BigQuery (#17536)
Fix counting on grouped aggregated field

Adding QP test

Reworking the BigQuery version of the :breakout to more closely match the structure of the standard sql.qp version
2021-08-24 17:17:13 -05:00
Gustavo Saiani
c9799b16a9 Improve EntityForm component (#17583) 2021-08-24 18:33:40 -03:00
Noah Moss
163fa801ae Keep collection_id of dashboard subscriptions in sync with same field on dashboard (#17537) 2021-08-24 13:59:24 -07:00
Nemanja Glumac
2f446214e0 #17512 Repro: Custom Expression case is using wrong field reference when nested query (#17576) 2021-08-24 20:56:04 +02:00
Alexander Lesnenko
d012c89b17 New Permissions Pages (#17328)
* add PermissionSelect component

* add PermissionSidebar component

* add PermissionTable component

* add PermissionEditor component

* add useLeaveConfirmation hook

* add selectors for the collections permissions page

* add selectors for the data permissions pages

* add confirmation creators to use in selectors

* sandboxing permissions modal: redirect to parent route when closed

* Add PermissionsPageLayout component

* Adjust CollectionPermissionsModal to use new permissions UI

* Add CollectionPermissionsPage

* Add data permissions pages

* Adjust collection permissions modal route

* Adjust permissions routes according new pages structure

* update permissions actions, reducers

* adjust sandboxing

* remove old permissions code

* support admin colorScheme in Radio

* support admin colorScheme in TextInput

* support admin colorScheme in Tree

* update permissions specs

* fix data permissions url typo

* fix sandboxing

* add search debounce to permission pages

* exclude schemas from search, make it flat

* fix permissions for databases without schemas

* fix copy for native queries permissions, show table display_name instead of raw name

* fix before leave warning shown when change collections

* permissions sidebar: make database name clickable

* fix string groupIds lead to bugs in permissions editor

* fix disabling table permissions shows all tables permission disabled

* fix permissions copy

* fix permissions disabled tooltips copy

* fix, add specs

* fix permissions edit bar button colors, fix breadcrumbs on schemaless dbs

* fix official collection color, make sidebar tree scrollable

* fix scroll in permissions modal

* fix breadcrumbs

* change table icon

* create helpers for entity ids and permissions url creation

* remove hardcoded colors

* make confirmations an array

* store confirmAction in state

* add ModalRoute specs

* fix propTypes, typo

* build permission pages urls with helpers

* revert switching from ref to state for confirm action function due to react invokes it on a render

* move mapStateToProps to the top of the files

* add visual specs

* add more specs

* fix edit sandbox access action

* add cypress spec for sandboxing
2021-08-24 21:30:21 +03:00
Ariya Hidayat
6ef0eceb72 Move our E2E guide from wiki to in-repo .md (#17540) 2021-08-24 10:27:13 -07:00
Ariya Hidayat
9bec76bc8f Visual tests for static-viz (via _internal) (#17561) 2021-08-24 10:24:06 -07:00
Nemanja Glumac
32ffbadfb4 #17524 Reproductions: Visualization type is not always respected, when filters are applied (#17565) 2021-08-24 15:34:43 +02:00
Nemanja Glumac
1278500b79 Update dev guide with info on deprecated Debugger for Chrome (#17571) 2021-08-24 15:33:33 +02:00
Nemanja Glumac
2948df3023 Revert Mongo QA Docker image update back to the version 4.0 (#17574)
* Try reverting mongo QA image back to 4.0

* Update mongo query assertion
2021-08-24 14:22:02 +02:00
Nemanja Glumac
240a189322 #17547 Repro: Editing an alert causes it to be deleted in some circumstances (#17563) 2021-08-24 09:51:22 +02:00
Ariya Hidayat
b795f9f102 Avoid prop shorthand in the login page (#17566) 2021-08-23 21:03:59 -07:00
Dalton
3776db6c27 enable default parameters to be unset on dashboards (#17522)
* enable unset default params on dashboard

* add unit tests
2021-08-23 18:34:52 -07:00
Gustavo Saiani
1096573bac Do not track testing coverage for styled.js* files (#17505) 2021-08-23 18:54:58 -03:00
Nemanja Glumac
35b272d8b5 Refactor cy.editDashbardCard Cypress custom command (#17560)
* Update parameter names in `editDashboardCard` Cypress custom command

* Update tests
2021-08-23 23:34:50 +02:00
Howon Lee
eb25bc7113 Mongo custom expressions (#17117)
Mongo custom expressions now are turned on for mongo 5.0 and after only. One idiosyncrasy is that we don't really support the BSON ID format at all in our typesystem despite having it in there, but both of my attempts to get them to work with the native mongo pipeline commands bounced because they really aren't strings, they're BSON ID's. We do rely on the pipeline commands heavily which is the reason for the version requirement.
2021-08-23 14:33:24 -07:00
Ariya Hidayat
83d3fd73f6 Avoid prop shorthand in the database/schema/table browser (#17559) 2021-08-23 14:03:15 -07:00
Ariya Hidayat
6d0bb1515d Add typing hints to isa to assist type inference (#17530)
This requires unfortunately an additional layer of indirection, however
I believe it's super cheap and it shouldn't impact execution speed.

In the mean time, many other predicates (isFoo etc) which rely on isa()
will be correctly type-inferred, which gives a huge win for editing and
debugging purposes.
2021-08-23 14:02:38 -07:00
Noah Moss
ea56ae35b5 New endpoints for fetching alerts & subscriptions (#17531) 2021-08-23 13:42:08 -07:00
Nemanja Glumac
538835f0d0 #17551 Repro: Dashboard date filter "Include today" does not work for relative "Next" (#17557)
* Expand `setAdHocFilter` helper function to include current date

* Add repro for #17551

* Update test title
2021-08-23 22:10:51 +02:00
dpsutton
d765d16da1 Don't warn when running interpreted js (#17529)
I'm not sure we can fix this. We need the graal compiler which doesn't
appear to be jdk 8 compatible but I can't actually find javadocs for
it. Its not clear from
https://github.com/oracle/graaljs/blob/master/docs/user/RunOnJDK.md
how you can actually run it.

I tried adding the graal compiler but that seems to assume you are in
a graal vm and fails not finding a class.

To get a list of all the options available for a context's engine,

```clojure
(doto 'metabase.pulse.render.js-engine require in-ns)
(map (comp (juxt :name :help) bean)
     (.getOptions (.getEngine (context))))
```

I've done some profiling

```clojure
(dotimes [_ 5]
  (time
   (do (let [rows [["apples" 2]
                   ["bananas" 3]]
             colors {"apples" "red" "bananas" "yellow"}]
         (js-svg/categorical-donut rows colors))
       nil)))

"Elapsed time: 210.32659 msecs"
"Elapsed time: 193.211736 msecs"
"Elapsed time: 190.97775 msecs"
"Elapsed time: 195.843254 msecs"
"Elapsed time: 188.077405 msecs"
nil
```

For interpreted and in another language, this doesn't seem the end of
the world.

And adding more quantities
```clojure
(letfn [(rand-string [] (str/join "-" (repeatedly 4 #(rand-nth ["banana" "horse" "battery" "cloak"]))))]
  (dotimes [_ 5]
    (let [rows (repeatedly 20 (fn [] [(rand-string) (rand-int 100)]))
          colors (zipmap (map first rows) (cycle ["red" "green" "blue" "yellow"]))]
      (time
       (js-svg/categorical-donut rows colors)))))

"Elapsed time: 288.659887 msecs"
"Elapsed time: 334.733071 msecs"
"Elapsed time: 317.369294 msecs"
"Elapsed time: 272.084918 msecs"
"Elapsed time: 272.7203 msecs"
nil
```

For a timeline line chart, rendering one datapoint per day for a whole
year:

```clojure
(dotimes [_ 5]
  (let [dates (take 365 (iterate #(.plusDays % 1) #t "2020"))
        rows   (map (fn [d] [d (rand-int 200)]) dates)
        labels {:left "count" :bottom "year"}]
    (time
     (js-svg/timelineseries-line rows labels))))

"Elapsed time: 569.691124 msecs"
"Elapsed time: 544.415676 msecs"
"Elapsed time: 539.131092 msecs"
"Elapsed time: 492.60486 msecs"
"Elapsed time: 523.765691 msecs"
nil
```
2021-08-23 14:35:13 -05:00
Noah Moss
356dd75b71 Formatting & whitespace fixes in Clojure files (#17441) 2021-08-23 10:05:45 -07:00
Alexander Lesnenko
93f5851191 add workflow that creates backport PRs which had a backport label before merge (#17550) 2021-08-23 19:38:55 +03:00
Greg Wilson
42f2a1e528 Unifying all troubleshooting guides so far (#17553)
* Troubleshooting guide for filters.

After conversation with @flamber, split this into one guide for simple filters and one for linked filters. The explanation at the top of the second page may still need some work...

* Updating filter troubleshooting

* Troubleshooting when you can't see the tables you should.

* Why is my dashboard slow?

* Troubleshooting: can't send email

* Adding @flamber's batch script-style guide

* Update docs/troubleshooting-guide/cant-send-email.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update docs/troubleshooting-guide/cant-send-email.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update docs/troubleshooting-guide/cant-send-email.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Fixing first item

* Addressing feedback

* Update docs/troubleshooting-guide/cant-send-email.md

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

* Update docs/troubleshooting-guide/cant-send-email.md

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

* Update docs/troubleshooting-guide/cant-send-email.md

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

* Adding flamber's comment

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Splitting entry

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Troubleshooting timezones

* Reformatting the filter troubleshooting guides

* Partial update to troubleshooting filters

* specify sql questions

* link

* update relative links

* more link fixes

* still more links

* specify dashboard filters

* fix typo

* Italicizing one more word

* Unifying all troubleshooting guides so far

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Update docs/troubleshooting-guide/cant-see-tables.md

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

* Incorporating suggestion

* Update docs/troubleshooting-guide/my-dashboard-is-slow.md

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

* Update docs/troubleshooting-guide/my-dashboard-is-slow.md

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

* Update docs/troubleshooting-guide/my-dashboard-is-slow.md

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

* Update docs/troubleshooting-guide/my-dashboard-is-slow.md

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

* Update docs/troubleshooting-guide/my-dashboard-is-slow.md

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

* Another small fix

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
Co-authored-by: jeff bruemmer <jeff.bruemmer@gmail.com>
2021-08-23 11:37:12 -04:00
Alexander Polyankin
591684bba1 Add day of week formatting with formatting options (#17549) 2021-08-23 15:32:18 +03:00
Alexander Polyankin
5a057ea905 Add formatTimeWithUnit (#17527) 2021-08-23 12:28:52 +03:00
Nemanja Glumac
60e9778f0d #17514 Repros: Run-overlay not going away on GUI question (#17534) 2021-08-22 03:30:37 +02:00
Nemanja Glumac
06b50d65af #13468 Repro: Question with joins causes re-run overlay after first save (#17535) 2021-08-22 03:29:41 +02:00
Jeff Evans
e8c7140a04 Fix serialization P2 issues (#17388)
* Fix serialization dump error when there are no collections

Update `select-collections` to correctly handle the case where there are no collections

Adding new test that removes all collections, then ensures that dump works with no errors

* Fix serialization load error into empty/blank target DB

Rethrowing exception in cmd when overall load fails

Add test to ensure that a dump containing a user can be loaded into a blank target app DB successfully

Adding a few missing bindings to the `with-temp-empty-app-db` code to set the connection vars under metabase.db.connection

In upsert, add hooks for a :pre-insert-fn and :post-insert-fn to be invoked for new entity instances created by the upsert process, since whether an entity will be an insert or update isn't necessarily known by the load process (only by upsert once identity-condition is checked for each)

In load, setting the pre and post insert functions for a User instance to initialize :password with a random value, and to generate and send a password reset email to the newly inserted user's email, respectively

NOTE: this post insert fn (to send a password reset email for newly inserted users) is NOT hooked up for User as of x.41 release, since it is considered a bugfix, but this can be enabled in a future release)

Adding new defs for the magic permission group names to make those easier to override from tests that might need to (such as the one added for this commit)

* Fix serialization objects being incorrectly updated on skip

Remove `maybe-fixup-card-template-ids!`, which was forcing mode :update, since the existing retry logic should cover what it was trying to do

Update Card and Metric models to delete any Dependency instances for which they are the `:model_id` (to make serialization tests after other tests created temporary Card/Dependency pairs)

Adding missing assertions for Dependency serialization

* Serialization: Fix reload entity logic

Now that the `:mode` is always respected instead of being ignored sometimes, we need to update our "second pass" reload functions to always make the mode `:update` on the second pass, or else that entity would just be skipped, which is bad

Also updated the test to use `:mode` `:skip` from the beginning to be more stringent
2021-08-20 17:04:13 -05:00
Dalton
02713dd302 refactor/move parameter object transformations to one place (#17461)
* refactor/move parameter object transformations to one place

* use hasParameterValue in place of nil check

* remove enableDefaultParameters arg since it is unused
2021-08-20 10:23:36 -07:00
Gustavo Saiani
c9bbfbc7c2 Make filters sticky in Dashboard page (#17406) 2021-08-20 13:19:30 -03:00
Jeff Evans
a980e08588 New BigQuery Driver (#16746)
New BigQuery Driver

Create new :bigquery-cloud-sdk driver using the google-cloud-bigquery library instead, and whose source is adapted from the :bigquery driver

https://cloud.google.com/bigquery/docs/reference/libraries

Marking existing :bigquery driver as deprecated, and superseded-by the new one (bigquery-cloud-sdk)

Update new driver and query processor code to use newer Google SDK

Switch test data loading over to use new API

Add project-id connection property to override the value from the service account JSON, and use it as part of qualified names in the query processor if set

Updating google driver so its libraries are compatible with the newer ones used in BigQuery

Update date bucketing tests to skip :bigquery-cloud-sdk (new driver) where :bigquery is skipped

Update `with-bigquery-fks` to take in the driver, since there are now multiple ones

Adding test to confirm that overriding project-id for a public BQ project works (sync and query)

Fixing a bunch of whitespace alignment errors in tests
2021-08-20 10:04:59 -05:00
Ariya Hidayat
91640fdacb Enable proper type inference for call, bind, and apply (#17518)
https://www.typescriptlang.org/tsconfig#strictBindCallApply
2021-08-20 06:01:19 -07:00
Ariya Hidayat
3480ca8941 Remove some superfluous return types in the metadata code (#17519)
Type inference can already correctly infer those return types, no need
to explicit anymore.
2021-08-20 06:00:23 -07:00
Ariya Hidayat
57e50c79ef Avoid prop shorthand in collections (#17517) 2021-08-20 05:59:57 -07:00
Nemanja Glumac
184be52396 Edit Cypress custom command cy.createDashboard() (#17521)
* Update `dashboard` custom Cypress command

* Update composite custom commands to accommodate new syntax

* Update tests that use `cy.createDashboard()` custom command

* Update default snapshot generator
2021-08-20 13:37:41 +02:00
Anton Kulyk
4b0afb6768 New columns picker for notebook editor (#17511) 2021-08-19 20:58:17 +03:00
Dalton
99380075be don't prefetch data for the data selector (#17455)
* don't prefetch data for the data selector

* rmv prefetch cy test

* fix mongo test
2021-08-19 09:38:09 -07:00
Alexander Lesnenko
b63ea17253 replace backport label with a more flexible backport command (#17497)
* replace backport label with a more flexible backport command

* fix backport bot command
2021-08-19 19:23:38 +03:00
Ariya Hidayat
3d5b0524d4 Fix tracking and reporting front-end coverage for EE (#17506) 2021-08-19 07:47:34 -07:00
Alexander Polyankin
ae26bb6e60 Split UserSettings into routes and individual components (#17474) 2021-08-19 17:07:18 +03:00
Anton Kulyk
6f8324debe Add right prop to NotebookCellItem (#17435)
* Remove not displayed NotebookCell's 'icon` prop

* Refactor NotebookCell to accent `right` prop

* Fix cypress getter

* Fix icons opacity

* Fix margins and paddings

* Pass initialState to getStore test helper

* Add basic tests for JoinStep

* Test automatic join fields assignment

* Add selectTable test helper

* Fix private property access

* Add join fields tests

* Test join is correctly applied to query

* Add more tests for join dimension pickers

* Test selecting joined table columns

* Disable failing JoinStep test (jest timeout)

* Extend timeout for JoinStep tests
2021-08-19 13:30:29 +03:00
Alexander Lesnenko
129644413b fix ModalRoute close removes last segment instead of navigating to the parent path (#17508) 2021-08-19 12:00:10 +03:00
dpsutton
ecf10466ad Build static viz in the dockerfile (#17507) 2021-08-18 22:12:34 -04:00
Nemanja Glumac
ce406d242a Add editDashboardCard Cypress custom command (#17493) 2021-08-19 00:23:58 +02:00
Jeff Bruemmer
ef46b7642d docs headings (#17492) 2021-08-18 16:22:03 -04:00
Ariya Hidayat
15465b2d18 Fix incorrect navbar width (#17496)
Regression in PR #17460
2021-08-18 10:01:27 -07:00
Anton Kulyk
b874ab1835 Display official collection tooltips (#17453)
* Add tooltips to authority level configs

* Use tooltips for CollectionAuthorityLevelIcon

* Pass tooltips to getCollectionIcon result

* Display tooltip in CollectionHeader

* Display tooltip in collections sidebar

* Display tooltip on the homepage

* Display tooltip in ItemPicker

* Accept icon props as a TreeNode's icon prop value

* Display tooltip in saved question picker

* Accept icon props as a SelectListItem's icon prop value

* Display tooltip in dashboard's question picker

* Add "Belongs to an Official collection" tooltip

* Fix prop-types errors

* Add tests for CollectionAuthorityLevelIcon

* Add tests for isRegularCollection

* Fix search results collection icons

* Show "Official Collection" label in search results

* Don't show tooltips for official collections in search

* Fix ItemPicker's prop type

* Add basic test for ItemPicker

* Test read-only collections are not displayed

* Add test IDs to ItemPicker

* Refresh Redux store in each ItemPicker's test

* Test opening a nested collection

* Test default breadcrumbs state

* Fix ItemPicker's header test ID

* Test ItemPicker read-only items visibility

* Add test for onChange prop

* Test navigating back from an open collection

* Test personal collections are grouped in ItemPicker

* Assert number of ItemPicker items

* Test getCollectionIcon in EE

* Add a workaround for tooltip offsets

* Add describe block for CollectionsList tests

* Make CollectionsList test shorter

* Test collection types on CollectionList

* Fix SearchResult's info

* Add SearchResult tests

* Use isRegularCollection for AuthorityLevelIcon
2021-08-18 19:41:48 +03:00
Ariya Hidayat
6e9900e70b codecov config: disable patch checking (#17502)
codecov patch calculation is incorrect. Thus, let's rely only on the
whole-project calculation and threshold (which is working fine).
2021-08-18 09:22:51 -07:00
Nemanja Glumac
921e7dd663 [Dashboard filters coverage] Add initial set of tests for dashboard SQL date filters (#17483) 2021-08-18 17:56:31 +02:00
Nemanja Glumac
b838f4a77a Refine create question custom commands (#17459)
* Refactor and dry up `question` custom Cypress commands

* Example of `loadMetadata` custom option in action

* Example of `visitQuestion` custom option in action

* Annotate functions using JSDoc
2021-08-18 14:03:32 +02:00
Cam Saul
97bcb67055 Warn if .lein-env is present on launch (dev-only) (#17477)
* Help avoid the .lein-env gotchas

* Learn to spell @camsaul

* Revert the .gitignore change -- too  D A N G E R O U S

* Fix version numbers (thanks @jeff303)
2021-08-17 20:52:49 -07:00
Cam Saul
94432ff14f Ensure Setting :default values match the Setting :type; fix user-facing-value for calculated Settings. Cleanup & extra tests for email settings (#17442)
* Change of plans. get-string (etc) only return default if it matches the type

* Better docstrings

* More tests & rework the validate-default-value logic a bit.

* Fix lint error

* Add an additional test for GET /api/setting

* Consolidate exception-chain util functions

* Email error message humanization improvements

* More tests for util ex-chain

* Clean up email error handling and add lots of extra tests

* Fix docstring indentation

* Even more email tests

* Test fixes 🔧

* Update Cypress test again

* Code cleanup
2021-08-17 17:03:09 -07:00
dpsutton
31df07b9d0 Svg/percentages (#17415)
* Backend SVG rendering proof of concept [ci skip]

* Update cssbox to 5.0.0

* Render bar, line, and pie charts in js to svg

sparkline is now done in js, bar is now recognized and done in js, new
:categorical/donut as well

* Remove api route for render

* pass along render-type, not hardcoded to :inline

* Move bar chart above sparkline and remove line check

In order to introduce the bar chart type need it above the sparkline
check since it is otherwise the same except for display property of
the card. But lots of tests assume that this will get hit with a nil
display type set in testing so remove checking for `:line` allows all
the testing cases to hit the right type

* Fix tests now that bar graphs aren't html but images

* Include attachments for bar charts

* Move over to in-tree bundle

* Force everything [ci noskip]

trying to ensure that the built jar includes the newer
"resources/frontend_client/app/dist/lib-static-viz.bundle.js"

* Run `yarn build-static-viz` in backend-deps in CI

this js file is now a hard dependency of the backend so it fits in
this tsk. All such things that depend on the backend sources will need
it. Makes me think perhaps we want a checked in version but i'm not
sure yet.

* Look on classpath not filesystem for js bundle [ci noskip]

* Move yarn build-static-viz into the checkout step

* License information for antlr4-runtime

* create attachment for categorical donuts

* add ordinal legend to donuts (#17177)

* set widths of html image and svg image to 1200

* Revert "add ordinal legend to donuts (#17177)"

This reverts commit 1eb81d2ebf.

* Helper functions to render html easily

* readme in dev

* readme ensure that static viz bundle exists

* Cleanup ns after removing proxy

* Donut chart colors and legend (#17251)

* use external color map for fill per dimension

* Add support new color legend for donut

* Ensure text doesn't appear as link

entire thing is actually the body of a link tag for emails but we want
a decent text color rather than a default link color

* use chart colors from https://stats.metabase.com/_internal/colors

* Make checkers happy

- remove unused imports
- add a docstring
- don't shadow fn with a local

* cleanup ns import

* Remove reflective call

* Cleanup ns on correct branch

Co-authored-by: dan sutton <dan@dpsutton.com>

* X-axis: just use (approx) 5 ticks to avoid overlapping labels (#17287)

* increase gap between arcs (#17271)

* Set rendering hints on html->image

* ignore width for now and make them larger

* Ns deprecation and some cleanup

* make namespace checker happy

* Simple tests for detecting chart type

* Rename from poc

* Tests for scalar/smartscalar

* cleanup js svg namespace a bit

* Tests of svg engine

* ns sorting after renaming

* Unify our two different js engine usages

settled on the js context. Has typed returns `(.asString ^Value ...)`
instead of perhaps capturing std out?
https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Value.html

Context is a bit more friendly for getting source into it. One
downside is that the invocable bit isn't quite as nice. The old way
would return a java.util.functionFunction but the difference is

(.apply function (object-array args))

vs

(.execute fn-ref (object-array args))

* Don't io/resource the io/resource

* js engine tests

* Ns cleanup in js-svg

type hints in the js-engine ns mean we don't need as many classes from
polyglot here

* Include percentages in rendered donut charts

* Testing for percentages

Co-authored-by: Cam Saul <github@camsaul.com>
Co-authored-by: Kyle Doherty <5248953+kdoh@users.noreply.github.com>
Co-authored-by: Ariya Hidayat <ariya@metabase.com>
2021-08-17 18:01:49 -04:00
Kyle Doherty
b8c9302932 Svg/labels (#17413)
* Backend SVG rendering proof of concept [ci skip]

* Update cssbox to 5.0.0

* Render bar, line, and pie charts in js to svg

sparkline is now done in js, bar is now recognized and done in js, new
:categorical/donut as well

* Remove api route for render

* pass along render-type, not hardcoded to :inline

* Move bar chart above sparkline and remove line check

In order to introduce the bar chart type need it above the sparkline
check since it is otherwise the same except for display property of
the card. But lots of tests assume that this will get hit with a nil
display type set in testing so remove checking for `:line` allows all
the testing cases to hit the right type

* Fix tests now that bar graphs aren't html but images

* Include attachments for bar charts

* Move over to in-tree bundle

* Force everything [ci noskip]

trying to ensure that the built jar includes the newer
"resources/frontend_client/app/dist/lib-static-viz.bundle.js"

* Run `yarn build-static-viz` in backend-deps in CI

this js file is now a hard dependency of the backend so it fits in
this tsk. All such things that depend on the backend sources will need
it. Makes me think perhaps we want a checked in version but i'm not
sure yet.

* Look on classpath not filesystem for js bundle [ci noskip]

* Move yarn build-static-viz into the checkout step

* License information for antlr4-runtime

* create attachment for categorical donuts

* add ordinal legend to donuts (#17177)

* set widths of html image and svg image to 1200

* Revert "add ordinal legend to donuts (#17177)"

This reverts commit 1eb81d2ebf.

* Helper functions to render html easily

* readme in dev

* readme ensure that static viz bundle exists

* Cleanup ns after removing proxy

* Donut chart colors and legend (#17251)

* use external color map for fill per dimension

* Add support new color legend for donut

* Ensure text doesn't appear as link

entire thing is actually the body of a link tag for emails but we want
a decent text color rather than a default link color

* use chart colors from https://stats.metabase.com/_internal/colors

* Make checkers happy

- remove unused imports
- add a docstring
- don't shadow fn with a local

* cleanup ns import

* Remove reflective call

* Cleanup ns on correct branch

Co-authored-by: dan sutton <dan@dpsutton.com>

* X-axis: just use (approx) 5 ticks to avoid overlapping labels (#17287)

* increase gap between arcs (#17271)

* Set rendering hints on html->image

* ignore width for now and make them larger

* Ns deprecation and some cleanup

* make namespace checker happy

* Simple tests for detecting chart type

* Rename from poc

* Tests for scalar/smartscalar

* cleanup js svg namespace a bit

* Tests of svg engine

* ns sorting after renaming

* Unify our two different js engine usages

settled on the js context. Has typed returns `(.asString ^Value ...)`
instead of perhaps capturing std out?
https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Value.html

Context is a bit more friendly for getting source into it. One
downside is that the invocable bit isn't quite as nice. The old way
would return a java.util.functionFunction but the difference is

(.apply function (object-array args))

vs

(.execute fn-ref (object-array args))

* Don't io/resource the io/resource

* js engine tests

* Ns cleanup in js-svg

type hints in the js-engine ns mean we don't need as many classes from
polyglot here

* add custom labels

* clean up margin

* Include labels in backend

* alignment

Co-authored-by: Cam Saul <github@camsaul.com>
Co-authored-by: dan sutton <dan@dpsutton.com>
Co-authored-by: Ariya Hidayat <ariya@metabase.com>
2021-08-17 15:47:59 -04:00
Jeff Bruemmer
efce02166d docs - links to dashboard subscriptions (#17489) 2021-08-17 15:08:10 -04:00
Cam Saul
bf00aa99c7 Backend SVG rendering proof of concept [ci skip] (#15781)
* Backend SVG rendering proof of concept [ci skip]

* Update cssbox to 5.0.0

* Render bar, line, and pie charts in js to svg

sparkline is now done in js, bar is now recognized and done in js, new
:categorical/donut as well

* Remove api route for render

* pass along render-type, not hardcoded to :inline

* Move bar chart above sparkline and remove line check

In order to introduce the bar chart type need it above the sparkline
check since it is otherwise the same except for display property of
the card. But lots of tests assume that this will get hit with a nil
display type set in testing so remove checking for `:line` allows all
the testing cases to hit the right type

* Fix tests now that bar graphs aren't html but images

* Include attachments for bar charts

* Move over to in-tree bundle

* Force everything [ci noskip]

trying to ensure that the built jar includes the newer
"resources/frontend_client/app/dist/lib-static-viz.bundle.js"

* Run `yarn build-static-viz` in backend-deps in CI

this js file is now a hard dependency of the backend so it fits in
this tsk. All such things that depend on the backend sources will need
it. Makes me think perhaps we want a checked in version but i'm not
sure yet.

* Look on classpath not filesystem for js bundle [ci noskip]

* Move yarn build-static-viz into the checkout step

* License information for antlr4-runtime

* create attachment for categorical donuts

* add ordinal legend to donuts (#17177)

* set widths of html image and svg image to 1200

* Revert "add ordinal legend to donuts (#17177)"

This reverts commit 1eb81d2ebf.

* Helper functions to render html easily

* readme in dev

* readme ensure that static viz bundle exists

* Cleanup ns after removing proxy

* Donut chart colors and legend (#17251)

* use external color map for fill per dimension

* Add support new color legend for donut

* Ensure text doesn't appear as link

entire thing is actually the body of a link tag for emails but we want
a decent text color rather than a default link color

* use chart colors from https://stats.metabase.com/_internal/colors

* Make checkers happy

- remove unused imports
- add a docstring
- don't shadow fn with a local

* cleanup ns import

* Remove reflective call

* Cleanup ns on correct branch

Co-authored-by: dan sutton <dan@dpsutton.com>

* X-axis: just use (approx) 5 ticks to avoid overlapping labels (#17287)

* increase gap between arcs (#17271)

* Set rendering hints on html->image

* ignore width for now and make them larger

* Ns deprecation and some cleanup

* make namespace checker happy

* Simple tests for detecting chart type

* Rename from poc

* Tests for scalar/smartscalar

* cleanup js svg namespace a bit

* Tests of svg engine

* ns sorting after renaming

* Unify our two different js engine usages

settled on the js context. Has typed returns `(.asString ^Value ...)`
instead of perhaps capturing std out?
https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/Value.html

Context is a bit more friendly for getting source into it. One
downside is that the invocable bit isn't quite as nice. The old way
would return a java.util.functionFunction but the difference is

(.apply function (object-array args))

vs

(.execute fn-ref (object-array args))

* Don't io/resource the io/resource

* js engine tests

* Ns cleanup in js-svg

type hints in the js-engine ns mean we don't need as many classes from
polyglot here

* Cleanup of text, ns docstrings, alignment

* Fix fill->fill-opacity with parsed doc, not regex

* Make a single helper that loads a static viz bundle context

* Docstrings and make private in js-svg

* Sort imported classes in js-svg

* Make width passed down through rendering aparatus

- svgs are always rendered at 1200 for quality
- slack images of html are rendered at 1200 so that they can be zoomed
  in in the ui but slack automatically scales down
- email sends html and the full svg but includes img width tags so
  that is handled appropriately

* docstring

Co-authored-by: dan sutton <dan@dpsutton.com>
Co-authored-by: Kyle Doherty <5248953+kdoh@users.noreply.github.com>
Co-authored-by: Ariya Hidayat <ariya@metabase.com>
2021-08-17 14:21:17 -04:00
Anton Kulyk
6bdd27c605 Refactor notebook editor's join step (#17445)
* Fix imports order

* Extract JoinClausesContainer

* Refactor JoinClause container element

* Extract JoinTypePicker component

* Refactor JoinStepPicker

* Extract JoinTablePicker

* Extract JoinedTableControlRoot

* Extract label components

* Extract RemoveJoinIcon

* Add prop types

* Turn JoinClause into func component, fix ref usage

* Update notebook's step prop-types shape

* Extract callbacks
2021-08-17 19:04:55 +03:00
Nemanja Glumac
631b9fa8a9 #17450 Repro: New databases with "This is a large database ..." still uses the default sync+scan settings (#17476)
* Add helper function to choose/select a database

* Apply helper function to BigQuery and GA

* Add repro for #17450
2021-08-17 14:57:10 +02:00
pawit-metabase
baed054fdf upgrade to @percy/cypress 3.x (#17485)
* upgrade to @percy/cypress 3.x

@percy/cypress 2.x uses deprecated @percy/agent which includes
an old version of puppeteer. The old version of puppeteer causes
`yarn` command to fail on M1 macOS environment.

Upgrade to @percy/cypress 3.x removes the dependency and thus
solves the issue.

The upgrade was done by running `npx @percy/migrate`.

* remove percy healthcheck task

This no longer exists in 3.x, see
https://github.com/percy/percy-cypress/blob/master/README.md#upgrading

* remove deprecated percy/exec-action

and moved `percy exec` to the correct command

* run 'yarn install' before running percy
2021-08-17 16:56:51 +07:00
Cam Saul
5f6a1a0148 Change clj-kondo linter levels from :warn to :warning so it exits with nonzero status (#17475)
* Enable clj-kondo warnings

* (when (seq ...) ...) instead of (when-not (empty? ...) ...)
2021-08-16 20:01:40 -07:00
Ariya Hidayat
31917c110d Avoid prop shorthand in chart sidebar (#17478) 2021-08-16 17:14:49 -07:00
Nemanja Glumac
34c638f6bf Add "moderation" folder to e2e CI groups (#17481)
* Add "moderation" folder to e2e CI groups

* fix question-moderation tests

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2021-08-17 01:15:33 +02:00
Jeff Evans
19a2daab78 Update Snowflake JDBC driver version (#17452)
From 3.12.13 -> 3.13.6
2021-08-16 17:35:19 -05:00
Jeff Evans
18f6eb3612 Make DB name in c3p0 name more robust (#17447)
Consult any of these keys when trying to determine the "name" portion of the c3p0 data: :db :dbname :sid :catalog

Update existing `c3p0-datasource-name-test` to more robustly check the different portions of the c3p0 dataSourceName
2021-08-16 16:33:42 -05:00
Nemanja Glumac
306dca7e4a [Dashboard filters coverage] Add initial set of tests for dashboard SQL location filters (#17423) 2021-08-16 22:43:50 +02:00
Ariya Hidayat
0eea666305 Avoid prop shorthand in _internal (#17471) 2021-08-16 11:55:19 -07:00
Nemanja Glumac
260a17efa3 Fix propType warning for RawMaybeLink (#17464) 2021-08-16 20:15:39 +02:00
Dalton
82a146977c add moderation events to question timeline (#17401)
* add moderation events to question timeline

* tweak the height of the DrawerSection header

* replace history modal & control drawer state via redux

* add/fix cy tests

* fix banner unit tests

* prevent leakage of 'null' moderation icon

* rename styled component

* add tests / rmv redundant fn

* remove should('exist') from moderation cy tests

* refactor to make biz logic of a null mod status clearer

* add selector unit test
2021-08-16 09:54:25 -07:00
Luis Paolini
7141db02cd Update 03-metadata-editing.md (#17470) 2021-08-16 13:36:02 -03:00
Luis Paolini
f47e2a8b43 Update Snowflake documentation (#17449)
* Update docs/administration-guide/databases/snowflake.md
We pushed https://github.com/metabase/metabase/issues/10142 but we never upgraded the documentation :(

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-08-16 13:09:40 -03:00
Ariya Hidayat
e49aea2f0c Avoid prop shorthand in the navbar (#17460) 2021-08-16 08:08:41 -07:00
Alexander Polyankin
c27349976e Prevent infinite re-rendering when the scroll bar appears/disappears (#17444) 2021-08-16 17:22:16 +03:00
Nemanja Glumac
9aec494584 Add initial set of tests around SQL dashboard number filters (#17395) 2021-08-16 15:38:27 +02:00
Alexander Polyankin
0407511474 Add vertical legends with Popover (#17433) 2021-08-16 15:29:09 +03:00
Alexander Polyankin
56b0802c7c Add LegendLayout to LineChart (#17467) 2021-08-16 14:41:25 +03:00
Ariya Hidayat
212c2d8600 codecov config: enable carryforward (#17454)
With flags, and potentially not all coverage info will be submitted on
every commit, it seems that carryforward is necessary.

https://docs.codecov.com/docs/carryforward-flags
2021-08-15 21:48:29 -07:00
Dalton
ac6b4ac315 add verification badge to question lists (#17426)
* add verification badge to question lists

* make rightIcon movable via grid/justify-self

* lint fix
2021-08-13 16:26:30 -07:00
Ariya Hidayat
828ece695d Don't use prop shorthands for some home containers (#17451) 2021-08-13 14:03:12 -07:00
Alexander Polyankin
0124b59706 Use LegendCaption directly in LineChart (#17396) 2021-08-13 21:57:54 +03:00
Ariya Hidayat
b3e5e5c8cd Upload front-end code coverage to codecov.io (#17440)
* Tweak Codecov settings to account for front-end coverage
* Scope back-end coverage with the correct codecov flag
* Add enterprise/frontend
2021-08-13 10:37:40 -07:00
Anton Kulyk
4b8a541c83 Polish CollectionBadge for official items (#17408)
* Group Badge's icon props into a single `icon` prop

* Allow overwriting Badge's hover color

* Fix CollectionBadge hover for official items

* Fix CollectionBadge size for official items

* Fix QuestionDataSource badge

* Use iconPropTypes in Badge

* Make CollectionBadge icon code more compact
2021-08-13 20:28:54 +03:00
Anton Kulyk
49e0d4e4cf Increase official collection badge in search results (#17409) 2021-08-13 20:23:37 +03:00
Anton Kulyk
179e229d37 Update homepage official collection display (#17404) 2021-08-13 12:26:48 +03:00
Anton Kulyk
2950365bbf Update collection type input (#17405)
* Add SegmentedControl variants

* Update CollectionAuthorityLevel widget look
2021-08-13 12:26:29 +03:00
Noah Moss
38b1d10631 Add "Send to Slack now" button (#17438) 2021-08-12 23:35:35 -07:00
Ariya Hidayat
0953c37cfa Trigger front-end linter CI if ESLint configs are modified (#17437) 2021-08-12 21:07:56 -07:00
Noah Moss
b11689473c Add hourly option for email scheduling (#17425) 2021-08-12 10:51:41 -07:00
Ariya Hidayat
8baa77fcf7 Do not use prop shortands in the database edit (#17421) 2021-08-12 09:55:47 -07:00
Noah Moss
b19028c3b6 Fix order of cards in dashboard subscriptions (#17419) 2021-08-12 09:28:30 -07:00
Ariya Hidayat
ffebacf2f0 Remove Flex/Box prop shorthand in metabase/components (#17345)
* Remove Flex/Box prop shorthand in metabase/components

* Grid's width is an array (responsive sizes)
2021-08-12 08:12:46 -07:00
Anton Kulyk
8789a427ef Add visual smoke test for notebook editor (#17432)
* Add visual smoke test for notebook editor

* Rename notebook visual test

* Update min height for Percy
2021-08-12 18:11:36 +03:00
Gustavo Saiani
329c53fa53 Improve Dashboard component: separate semantics from styles and extract subcomponents (#17366) 2021-08-12 08:30:26 -03:00
Ariya Hidayat
eb09025c5e Do not use Flex prop shorthands in version notice (#17416) 2021-08-11 17:03:13 -07:00
Howon Lee
a4fded555d #13136 dynamically determining supporting features by database instance (#17319)
Previously the multifunction for supporting features was always implemented as a trivial true function. However, for mongo we need an actual version number, so here we go
2021-08-11 11:12:41 -07:00
Noah Moss
33bc4dde43 XLSX auto-sized columns, frozen header and auto-filters (#17325) 2021-08-11 10:26:35 -07:00
dpsutton
c60dfc5f26 Changing type (#16776)
* Move sync executor to bespoke namespace

* Refingerprint fields on type change

* Check if can connect in refingerprint-field!

* docstring update

* Cleanup tests a bit

* Error handling

* Table field values endpoint on sync.concurrent executor

* ns sort api field

* ns cleanup
2021-08-11 13:06:15 -04:00
Noah Moss
3ec2c8a83c Fix column settings button if column settings side bar is already open (#17355) 2021-08-11 07:30:06 -07:00
dpsutton
4066fee5f9 Namespace for extensions to clojure.test (#17400)
* Namespace for extensions to clojure.test

if you do a subselection of tests, you might not get the `schema=`
defmethods and then your tests won't compile. Ns docstring to keep the
namespace simple and targeted to global effects. we don't want to load
models and do extra work, just install some test utilities that aren't
ever required directly

* Add aliases

clojure.test had been refer :all

* require the effects in metabase.test.util as well

Namespace cleaner got a bit too aggressive

stupid ns

* Poke github actions empty commit
2021-08-11 10:19:12 -04:00
Anton Kulyk
adafc8132d Fix collection sidebar chevrons vertical alignment (#17403) 2021-08-11 16:01:58 +03:00
Anton Kulyk
a5992af000 Refactor CollectionBadge component (#17393)
* Add prop-types to CollectionBadge

* Convert CollectionBadge into functional component

* Fix CollectionBadge's prop drilling

* Fix Badge's import order

* Add prop-types to Badge

* Extract Badge's MaybeLink to styled file

* Extract Badge icon styled component

* Export MaybeLink
2021-08-11 12:40:37 +03:00
Noah Moss
0c4f3dc723 XLSX export formatting (#17226) 2021-08-10 17:46:50 -07:00
Gustavo Saiani
a69a75d66b Add visual regression tests for dashboard page (#17376) 2021-08-10 20:42:28 -03:00
Ariya Hidayat
35209ed4ee Fix babel loader when the cache is not desired (#17398)
https://webpack.js.org/loaders/babel-loader/#options
2021-08-10 16:05:16 -07:00
Dalton
d17e12bf9b add unit tests for (most) metabase-lib/metadata classes (#17367)
* add unit tests for metabase-lib/metadata classes

* fix typo
2021-08-10 10:56:01 -07:00
Alexander Polyankin
d3ec6cddbd Remove TitleLegendHeader (#17374) 2021-08-10 20:42:41 +03:00
Cam Saul
06c0017be0 Whitespace linting (#17348)
* Add the whitespace linter

* Fix whitespace linter errors [except for one file]

* Add a line that will intentionally break stuff to verify the linter is working.

* Ok, remove the line that caused the linter to fail.

* Use latest version of the linter

* Fix missing newline
2021-08-10 10:12:33 -07:00
Cam Saul
c18ff17a44 Java + Spark SQL prep steps should delete target dir on failure (#17360) 2021-08-10 10:10:48 -07:00
dpsutton
feafe08295 Include moderated status on virtual db/table information (#17340) 2021-08-10 12:25:41 -04:00
dpsutton
381d2f72dc Verification in search (#17329)
* Include and bump moderation status in search results

* Include limit 1 and order by for moderation review latests

backend does work to ensure there is an invariant that there is 1
most_recent true entry and all the rest are most_recent false. But if
there's some bug this invariant is violated we don't want to blow up
with multiple rows returned in these queries.

* Verification scoring is enterprise now

* wip moving moderation review to enterprise

still need to delete the old non-moved file

* add moderation icon to search results

* update names of icon props in SavedQuestionHeaderButton

* move moderation cypress tests, add test for search results

* Move moderation review api and test to enterprise

* fix props for getVerifiedIcon call

* add moderation status icon to collections

* add/improve moderation cypress tests

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2021-08-10 12:01:40 -04:00
Ariya Hidayat
a8a8189e28 Remove unused Slack's client library (JavaScript) (#17384) 2021-08-10 07:25:06 -07:00
Greg Wilson
c7e06d46a2 Missing last letters in troubleshooting guide titles (#17392) 2021-08-10 09:50:29 -04:00
Nemanja Glumac
5b9851b0df Add initial set of tests around SQL dashboard filters for text/category (#17382) 2021-08-10 12:48:56 +02:00
Ariya Hidayat
0a1b0db007 Visual test: consistent baseline with no randomization (#17380) 2021-08-09 13:25:35 -07:00
Ariya Hidayat
bde391e9f2 Percy GitHub Actions: shortcut the process to get the version (#17370)
Since it needs to grab the built JAR anyway, it's faster to obtain the
version.properties from the JAR.

This shaves off approx. 1 minute from Percy CI run.
2021-08-09 13:15:20 -07:00
Noah Moss
054a9e8bcb Include card names in export filenames (#17349) 2021-08-09 13:09:08 -07:00
Ariya Hidayat
7a93245285 Webpack prod build: exclude ESLint loader (#17371)
There's no point of processing files via ESLint loader when building
for production. If there's any linting issue at all, it should be
caught with a different CI run.

This shave off >2 minutes from Uberjar build (front-end step).

Development/hot-reload isn't affected at all.
2021-08-09 13:02:36 -07:00
Nemanja Glumac
38bb142a31 Fix wrong link in dashboard-filters user documentation (#17378) 2021-08-09 17:18:37 +02:00
Nemanja Glumac
0ff90d1a04 #17060 Repro: Duplication of the displayed table columns (#17361) 2021-08-08 02:58:12 +02:00
Nemanja Glumac
2186c69f95 #17211 Repro: No matching dashboard filter found when it clearly has been found (#17364) 2021-08-08 02:57:34 +02:00
Ariya Hidayat
ee68906484 Visual tests for some important URLs post on-boarding (#17358) 2021-08-07 10:35:29 -07:00
Ariya Hidayat
014d3c6ddb Continuously check when Metabase is ready, instead of waiting 3 mins (#17369) 2021-08-06 20:19:05 -07:00
Alexander Lesnenko
b5cc69e099 fix percy bot command (#17362) 2021-08-06 18:36:26 -07:00
Gustavo Saiani
57c7bbe618 Clean up prop destructuring in Dashboard component file (#17338) 2021-08-06 18:48:40 -03:00
Gustavo Saiani
74b02afd80 Remove flow types (#17337) 2021-08-06 16:58:58 -03:00
Dalton
7bc3013f22 use target of 'web' when using webpack-dev-server (#17356) 2021-08-06 12:08:25 -07:00
Luis Paolini
1d2bfe43de Update log-configuration.md (#16652)
Show how to increase Jetty verbosity

* Update docs/operations-guide/log-configuration.md

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-08-06 15:15:17 -03:00
Greg Wilson
87771b2aff Regularizing titles of troubleshooting guides. (#17296)
- Make all specific problems H2-level headings.
- Create a `doc-toc` div at the top for the table of contents.
  - Don't use `learn-doc` because we may want to style/show this one independently.
- Link to all problem headings.

Note: can't use metadata in a page header because our CI tools splat their own headers into these pages, so anything we add becomes part of the page body.
2021-08-06 08:39:21 -04:00
Nemanja Glumac
c3e8a9c928 #17212 Repro: Not possible to apply dashboard ID filter to a nested QB question (#17343)
* Add sane defaults to the card size in `createQuestionAndDashboard` custom command

* Add repro for #17212
2021-08-06 14:33:18 +02:00
Nemanja Glumac
12dbf0d590 Repro for #17339: collection tree should expand/collapse on parent collection name click (#17344) 2021-08-06 13:37:12 +02:00
Jeff Evans
988ae665cf Invalidate cached pooled connection when DB details change (#17307)
Adding new cache to `metabase.driver.sql-jdbc.connection` that tracks the DB details hash values per DB id

Checking if the non-empty hash value of DB details changed in `db->pooled-connection-spec` in order to invalidate an existing pool

Adding test that redefines the log fn to assert that the pool is invalidated on hash change
2021-08-05 21:14:57 -05:00
Ariya Hidayat
182124007d GitHub Actions: remove the check for Clojure version (#17341)
It's redundant since the job explicitly installs the proper version in
the previous step, and also running that prematurely pulls a bunch of
JARs from Maven Central.

This should shave 20 seconds from the CI runs.
2021-08-05 18:30:25 -07:00
Nemanja Glumac
28f7d87cd5 e2e test for "About Metabase" modal (partial repro for #15656) (#17308)
* Add parial repro for #15656

* Update frontend/test/metabase/scenarios/onboarding/about.cy.spec.js

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-08-06 02:34:01 +02:00
dpsutton
cf96df32b9 correct typo in driver prestor -> presto (#17334) 2021-08-05 15:27:10 -05:00
Cam Saul
2af2ba952d Bump some more backend dependencies (#17326)
* Bump some more backend dependencies

* Add license info for com.sun.activation/jakarta.activation

* Fix reflection warnings

* Revert bump of MariaDB for now
2021-08-05 11:29:52 -07:00
Ariya Hidayat
ae9f1d8c80 devcontainer: Remove Leiningen and use the latest Clojure (#17327) 2021-08-05 10:23:22 -07:00
Jeff Evans
7285e3d4a2 Fix Presto JDBC connection error (#17293)
Remove the `driver/can-connect?` implementation and move the `select-keys` logic instead to the existing place in `sql-jdbc.conn/connection-details->spec`

Update test to also include the `:let-user-control-scheduling` details entry
2021-08-04 17:05:52 -05:00
Cam Saul
f9600eadf6 Bump Jetty/Bouncycastle/Jackson/Apache Commons dep versions (#17318)
* Bump some backend deps.

* Update i18n/locale to work with new version of LocaleUtils
2021-08-04 14:32:13 -07:00
Cam Saul
ad69111e02 Minor test runner/config fixes (#17323)
* Fix JUnit output not correctly stripping ANSI color codes

* Remove find-tests profiling log message

* 1-arg arity of metabase.test-runner/run

* Fix bug with metabase.test-runner/find-tests with a single test name
2021-08-04 14:19:02 -07:00
Noah Moss
089e02dd6d Change default for currency style to code if symbol not supported (#17301) 2021-08-04 14:06:43 -07:00
Dalton
bfbd259905 improve searchability of metabase-lib class instantiations (#17320) 2021-08-04 13:58:32 -07:00
Jeff Bruemmer
df5a5d0b95 docs - troubleshooting logs (#17304) 2021-08-04 16:56:12 -04:00
Alex Ghiculescu
97b4ee93d8 Fix location of share icon (#15919)
* Fix location of share icon

* Update 12-public-links.md

Differentiate between dashboard and question sharing

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
2021-08-04 13:07:28 -07:00
Cam Saul
fc7f961195 Bump depstar version to prevent annoying messages about having multiple SLF4J bindings (#17309) 2021-08-04 10:47:38 -07:00
dpsutton
69bb775885 Remove last of leiningen, update comment in shadow and lsp classpath (#17317)
* Remove last of leiningen, comment in shadow and lsp cp [ci skip]

* empty commit to flush [ci skip]
2021-08-04 10:44:58 -07:00
Ariya Hidayat
de2ce4f9cb Fix the styling of the buttons in the notebook (#17313) 2021-08-04 05:57:44 -07:00
dpsutton
84f4509dbe correct moderation review hydration (#17311)
* remove moderation reviews hydration

* Restore hydration of moderation_reviews and handle correctly

nested hydration is (i think) positional. So if you get something
handed to you you must return something in that position. Prevoiusly
was removing nils and then returning a smaller collection of hydrated
items (cards here). But this meant input might look like this

[card1 nil card2] and return [card1 card2] and in the nested hierarchy
things didn't get matched up correctly.

In the real world application it might look like this:

```clojure
{:ordered-cards
 [{:card-id 1}
  {:card-id nil
   :viz-settings {info-for text-card}}
  {:card-id 2}]}
```

And the nil card comes into this function and we return them in a
strange manner things get wonky
2021-08-03 17:19:24 -07:00
Maz Ameli
730cb5918e update strings for 0.40.2 2021-08-03 15:58:03 -07:00
Nemanja Glumac
af99fc023d Update project.clj references (#17294)
* Remove `project.clj` from Percy workflows

* Replace `project.clj` with `deps.edn` in `build-for-test` script

* Update reference to the `project.clj` in the comment
2021-08-03 23:58:24 +02:00
Howon Lee
6331c3b130 Make the field search do limits (whacks #17228) (#17283)
We're playing this whackamole because we added the middleware to universally sorta stomp on any `limit` or `offset` params, and they got stomped on. Which, in turn, led to my PR to make the default not limited. Which, in turn, led to the other issue this PR solves which makes the search things we relied upon to not have a limit, have a limit.
2021-08-03 13:59:58 -07:00
Nemanja Glumac
84a6abd1ad Use jest-dom/extend-expect library globally (#17292)
* Register `@testing-library/jest-dom/extend-expect` globally

* Remove unnecessary imports from unit tests
2021-08-03 21:42:51 +02:00
Luis Paolini
8c344e2457 Remove .git directory in .dockerignore so version can build correctly (#17300) 2021-08-03 12:38:47 -07:00
Cam Saul
c24fc9dd7c Cloverage shouldn't instrument tests/test utils (#17298) 2021-08-03 12:00:53 -07:00
Cam Saul
e1e815f84b 🏎️🏎️🏎️ test runner improvements 🏎️🏎️🏎️ (#17286)
* Add some dox

* Rename test-runner & cloverage -> metabase.test-runner & metabase.cloverage-runner

* Move JUnit-related test runner code to separate namespace

* Bespoke JUnit-output code

* Delete unused .lein-classpath file

* Do JUnit writes in a cached thread pool

* Add failing test to make sure JUnit output works as expected...

* Move bad-test to metabase.bad-test so the FAILING tests actually run

* FASTER TEST LOADING 🏎️

* Test CircleCI :system-out

* Final cleanup (hopefully)

* Sort some namespaces; allow initializing :plugins when namespaces get loaded for now.

* Need those [[tags]] in docstrings

* Fix bad docstring
2021-08-03 11:01:30 -07:00
Nemanja Glumac
9e1491362b Upgrade @cypress/webpack-preprocessor (#17180) 2021-08-03 19:29:19 +02:00
Nemanja Glumac
9e33322ce2 Prepare jest config for FE code coverage (#17182) 2021-08-03 19:28:27 +02:00
Alexander Lesnenko
88b3b536f9 Fix incorrect props are passed to CollectionPermissionModal when used for snippets folders (#17284) 2021-08-03 20:18:12 +03:00
Dalton
b7fa2f34d5 Add the ability to verify/unverify questions (#17030)
* rmv old bucm icons and remove verified fill color

* add moderation action section to sidebar

* add moderation review icon to the saved question header button

* hide moderation section when is not a moderator

* add UI for ModerationReviewBanner

* Backend for moderation-review

- create table moderation_review. Same as before but also has a
  "most_recent" boolean flag for the most recent moderation for easy
  lookup
- POST /moderation-review/ . Status can be "verified" or nil
- must be an admin to post
- No PUT or edit route yet. Not sure if this is even
  necessary. _MAYBE_ to edit the text, but certainly not for the
  status, ids, etc. If there's to be history, let's build some history
- Ensure we never have more than 10 reviews. Adding a new review will
  delete the older ones, mark all old ones as not `most_recent`, and
  add the newest one as `most_recent true`
- Ensure the card actually exists before creating the mod review
- Since admin only at this time, don't need to check moderate
  permission or view permission
- When hydrating ensure reviews are ordered by id desc. Should mimic
  the created_at desc

* fix moderation review banner tooltip offset

* disable verification button when already verified

* rmv iconOnly prop because it seems to do nothing

* update getLatestModerationReview to rely on most_recent boolean

* Return 400 on invalid status to post /moderation-review

the schema was using keywords on the left hand side rather than the
symbols. Required a change to the docstring generator, when it made a
docstring for enums, it would call (sort (:vs enum)) and need to
string em.

* Add ModerationReview model to models.clj and copy infra

* hydrate moderation reviews on cards

* clean up + wire up to BE + ensure mod buttons don't show for normal users

* rmv unused moderation redux logic from QuestionDetailsSidebarPanel

* finish writing unit tests for FE

* ensure getIconForReview returns an object

* enable/disable verify button tooltip when unverified/verified

* add e2e tests

* fix tests

* styling tweaks

* more styling on moderationReviewBanner

* add function for abbreviated timestamp

* increase fontsize of timestamp back to 12

* fix tooltip offset

* ensure custom locale is separate from 'en' and not used for other languages

* Deletion moderation reviews when deleting cards

i had actually thought this was a much larger problem. But it turns
out we almost never delete cards (thanks comment!). And so we won't
really generate a lot of garbage.

I was worried that since we aren't using actual foreign keys but just
`moderated_item_type "card"` and `moderated_item_id 2` we would have
deleted cards with these moderation reviews but that is not the case
as the cards aren't deleted.

* hide verify disabled button when a question is verified

* update test to use queryByTestId

* Hydrate moderation reviews on cards on ordered cards

* Handle mysql's lack of offset functionality

mysql cannot handle just a `offset` clause, it also needs a limit

clause grammar from
https://dev.mysql.com/doc/refman/8.0/en/select.html:

[LIMIT {[offset,] row_count | row_count OFFSET offset}]

select id, name from metabase_field offset 5;         -- errors
select id, name from metabase_field limit 2 offset 5; -- works

Since our numbers are so small here there is no worry and just do the
offset in memory rather than jump through hoops for different dbs.

* Batch hydrate moderation reviews

* Don't let /api/user/:userId failure conceal moderation banner

* fix moderation cy tests

* work around possible bug in toucan hydration

dashboards hydrate ordered cards
(hydrate [:ordered_cards [:card :moderation_reviews] :series])

Ordered_cards are dashboard_cards which have an optional card_id. But
toucan hydration doesn't filter out the nils as they go down. It seems
toucan returns a nil card, and then when hydrating the
moderation_review, passes the collection of all "cards" including the
nil ones into the hydration function for moderation_reviews

This feels like a bug to me

* Cleanup moderation warnings

* Docstring in moderation review

* include hoisted moderated_status on cards in collections api

* Expect unverified in test 🔧

Co-authored-by: dan sutton <dan@dpsutton.com>
Co-authored-by: Maz Ameli <maz@metabase.com>
Co-authored-by: alxnddr <alxnddr@gmail.com>
2021-08-03 09:36:18 -07:00
Dalton
dee19dfbd6 Handle mutation of vizSetting column when syncing columns in a native question (#17279)
* Handle mutation of vizSetting column when syncing columns of a native question

When calling Question's _syncNativeQuerySettings method we need to treat
existing, mutated columns as invalid so that they are filtered out and a
new column takes the existing column's place.

The function we use to find valid columns, findColumnIndexForColumnSetting,
will return true if it finds a matching field_ref OR a matching name, so we
also need to check the addedColumns array we just created in order to remove
any columns from vizSettings that also exist there, since we combine the two
at the end of this method.

* add unit tests for _syncNativeQuerySettings
2021-08-03 09:21:48 -07:00
Nemanja Glumac
c4d777ac6b Update lein references in scripts (#17291)
* Remove `yarn start` script

* Remove `lein docstring-checker` and `lein-bikeshed` scripts

* Update `lein` references in `ci-backend` script
2021-08-03 16:42:04 +02:00
Luis Paolini
d5b89f6636 Fix Elastic Beanstalk deployment in v40 (#17261)
* Intermediate commit

* Add the step to include .platform dir into the bundle
2021-08-03 07:36:27 -03:00
Alexander Lesnenko
b604fb164c fix dev run (#17270) 2021-08-03 00:04:02 +03:00
Gustavo Saiani
9b4c9a22c1 Close collection sidebar on mobile (#17278) 2021-08-02 18:01:36 -03:00
Nemanja Glumac
4a198de03e #17268 Repro: Snippet folder permissions applied to root (#17280) 2021-08-02 22:58:29 +02:00
Nemanja Glumac
f9983424db Update yarn build scripts (#17269) 2021-08-02 22:39:15 +02:00
Gustavo Saiani
49b6954e0e Improve CollectionsList component (#17277) 2021-08-02 17:35:30 -03:00
Jeff Evans
f4050ff1a9 Fixing Presto JDBC issues (#17265)
Updating schema connection property to have proper display name

Updating display name for database to be "Schema"

Fixing `driver/can-connect?` impl in `presto_jdbc.clj` to actually use the correct driver, and dissoc `:engine` before calling the `sql-jdbc.conn` method

Adding test for the `test-database-connection` method, which is what led to the error from the UI
2021-08-02 14:45:25 -05:00
Cam Saul
5f613399de Fix failing tests after #16749 (#17274)
* Revert changes to activity and activity-test namespaces

* Add some sanity-checks to help debug the failing test

* Delete accidental newline
2021-08-02 12:11:18 -07:00
Cam Saul
dfc211e3a4 Add :nrepl alias [ci skip] (#17276) 2021-08-02 11:37:51 -07:00
Ariya Hidayat
847e28b286 Let VS Code recognize decorators (#17258)
https://www.typescriptlang.org/tsconfig#experimentalDecorators
2021-08-02 09:27:10 -07:00
Cam Saul
0eef2252a9 Switch to tools.deps (#16749) 2021-07-30 18:41:24 -07:00
Howon Lee
39e87603ac Default pagination #17200 (#17210)
Change default behavior of pagination to be what i imagined it to be. Really should've taken Dan's question to heart and actually tested that bit...
2021-07-30 18:16:44 -07:00
Jeff Evans
313f097927 Only build currently active drivers (#17262)
Only build currently active drivers

Update `all-drivers` fn so that it only "finds" drivers that have either a `project.clj` or `deps.edn` file (i.e. some build file), and ignores the directory otherwise. This is to deal with cached artifacts hanging around between builds in a shared executor type environment (ex: CircleCI), where even though the checkout won't bring in some driver directory that doesn't exist on the target branch, some other files (such as `pom.xml` or a `target` directory), might still be hanging around
2021-07-30 17:24:33 -05:00
Noah Moss
63d5dbfaa6 Visualization settings query processor middleware (#16972) 2021-07-30 13:41:58 -07:00
Greg Wilson
746e5b9c0e Troubleshooting sync/fingerprint/scan (#17255)
* First draft of sync/fingerprint/scan troubleshooting

* Merging fixes from @flamber.

* Merging Jeff's suggestions.
2021-07-30 15:06:01 -04:00
Dalton
3a7c3987f6 Upgrade babel to 7.x.x and jest to 27.x.x (#17137)
* Update babel dependencies to latest

* Remove some old babel dependencies

The dependencies in this commit include dependencies that have been
renamed, such as babel-cli which is now @babel/cli. It also includes
dependencies that have been replaced, such as babel-preset-stage-0 and
its ilk, which have been replaced with @babel/preset-env.

* Remove babel-register dependency

This is referenced in our webpack.config.js file. I don't think we need
Babel in our Node envionment, but I could be wrong, so leaving this as a
separate commit.

* Remove @babel/standalone and dependent code

We're using @babel/standalone to support the writing of JSX in our
internal-only ScratchApp editor. Unfortunately, this dependency is
large--1.5mb not gzipped--and our current build does not intelligently
split bundles, meaning our users our burdened by the size of this
dependency whenever they must redownload the Metabase JS bundle.

I'm removing it. We should still be able to write JS in the ScratchApp,
but JSX no longer.

* Add @babel/node to dev deps

Needed by a cypress command

* Add browserslist config

Babel's preset-env dep needs this config to determine how to transform
our JavaScript. By default I believe it ends up defaulting to
"defaults."

"defaults" is equivalent to the following rules:
> 0.5%, last 2 versions, Firefox ESR, not dead

A comma between rules represents a UNION operator.

Per
https://www.metabase.com/docs/latest/faq/general/supported-browsers.html
we have deprecated IE 11 so I am including that explicitly in our
browserslist.

* Update babelrc plugins and presets

- Replaced presets with preset-env and preset-react
- Updated the names of some plugins, like transform-decorators-legacy,
  which is now @babel/plugin-proposal-decorators with an explicit
  "legacy: true" passed in the config.
- Removed add-react-displayname because it is included in preset-react
- Removed transform-builtin-extend because it is included in preset-env*
- Removed syntax-trailing-function-commas because it is supported by
  all browsers we support

* note: There is a "loose" config option for handling the extension of builtin
classes. We may need it, but I am not sure.

* Update babel cli args

Replace -q with --quiet because -q no longer exists

* Fix circular dep in auth.js by making it async

Our app unfortunately contains MANY circular dependencies. Some, like
this one, caused problems when the app instantiates because the
"refreshCurrentUser" method is undefined when auth.js is initially run.

While we should in the future avoid having circular deps in the first
place, making them run async by requiring the dep and function run-time
fixes this particular issue.

* Fix circular dependency in metabase/redux/requests.js

The handleActions and createAction methods imported from
"metabase/lib/redux" are actually just methods from the "redux-actions"
dependency... so importing those methods directly from that dep fixes
this circular dependency problem.

* Remove references to global.services and exports in metabase/services

This line breaks the build. Git blame says the line is 5 years old, and
I wouldn't expect such code to be used with how our app now requires
deps.

* Fix MBQLArrayClause problem caused by Array extension

* Explicitly pass args from flatMap to function via anonymous cb

I think the old Array.prototype.flatMap prototype must've had different
args. They are now "currentValue, index, array" so when we passed it
"enumeratePaths" as a callback, the second arg of enumeratePaths gets
set to a number. This breaks the logic of enumeratePaths because it is a
recursive function that depends on that second arg getting initialized
as an empty array by default.

* Remove code that spreads non-iterable value in array

New Babel is stricter about handling this sort of code that doesn't
match the JS spec. You can't spread an undefined value inside of an
iterator.

* Update jest and babel-jest to latest

Updating Babel breaks our unit tests. Updating nothing causes every test
to fail due to a Babel version mismatch. Updating only babel-jest causes
the following error:

TypeError: Jest: a transform must export a `process` function

There may be a way around updating Jest, but updating it does not appear
to be too difficult.

* Set the testEnvironment to jsdom

This was the default testEnvironment in our old version of jest. At some
point the default was changed to node.

* Remove unfinished "pending" unit tests

I'm unfamiliar with this pending function, but the function no longer
exists, causing the tests to fail.

* don't pass async callback to describe

* Update name of runTimersToTime to advanceTimersByTime

* Fix incorrectly nested unit test

* mock SVGElement.prototype.getBBox method

* Don't return values in describe callback

* Move variable declaration to above usage

* Fix prettier error

* Upgrade `documentation` library to the latest version (13.x.x)

This library was the only one left that was still using Babel 6.

* Return an MBQLClause instance after using Array methods

* remove 'not IE 11' from browserslist

* Remove mock that breaks unit test

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-07-30 09:50:10 -07:00
Noah Moss
e10ec3e393 Hide currency symbol option if not supported (#17240) 2021-07-29 17:33:17 -07:00
Noah Moss
042abc928a Move currency list from JS to Clojure (#17243) 2021-07-29 14:13:26 -07:00
Cam Saul
89382bae96 Run Eastwood linter against test namespaces. Remove reflection-warning script (#17193)
* Fix some Eastwood failures

* Fix a lot of Eastwood errors now that it runs against test namespaces [ci skip]

* Run Eastwood against test namespaces [WIP]

* Bump Eastwood version to fix some errors in Eastwood itself

* Fix another lint warning

* Fix test failure

* More test fixes 🔧

* Fix all the warnings!

* Test fix 🔧

* Bump Eastwood GH action timeout to 20 minutes (!)
2021-07-29 11:01:18 -07:00
Jeff Bruemmer
9aefcfb734 docs - update troubleshooting section (#17236) 2021-07-29 12:45:43 -04:00
Cam Saul
a967c2a6e5 Run namespace checker linter on test namespaces (#17239) 2021-07-28 16:38:53 -07:00
Ariya Hidayat
bc9f0d54ba devcontainer: Ensure that Node.js and Yarn are installed (#17237)
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
2021-07-28 15:02:29 -07:00
Alexander Lesnenko
1a926314c9 Fix autobackport job fails because of branches like release-x.39.4-something (#17241) 2021-07-29 00:16:54 +03:00
Alexander Lesnenko
04799fe8a2 auto cherry pick to release branch on merge into master (#17225)
* auto cherry pick to release branch on merge into master

* rename workflow, label
2021-07-28 23:44:09 +03:00
Anton Kulyk
8002af2208 Display official collection badge on the homepage (#17215) 2021-07-28 09:36:53 -07:00
Anton Kulyk
47dadae096 Fix plural form for CollectionList.styled.js 2021-07-28 09:36:53 -07:00
dpsutton
0dd4b8fcee Include authority_level on collections in collection items (#17204) 2021-07-28 09:36:53 -07:00
Anton Kulyk
3051de19c8 Fix horizontal FormField label 2021-07-28 09:36:53 -07:00
Anton Kulyk
a728bafe82 Allow only admins to edit collection types, hide form field for personal collections (#17170)
* Rename collection's plugin `formFields`

* Add tests for collection type field visibility

* Limit collection types visibility

* Fix cypress tests
2021-07-28 09:36:53 -07:00
Anton Kulyk
0f4597d786 Display official question's badge when it's in regular dashboard (#17167)
* Add icon prop to LegendItem

* Add icon prop to LegendHeader components

* Add headerIcon prop to Visualization

* Add headerIcon prop to DashCard

* Display official badge on questions in regular dashboards

* Add headerIcon prop to Funnel

* Add headerIcon prop to LineAreaBarChart

* Extract hasLegendHeader variable

* Pass headerIcon to visualisations with custom header

* Add E2E tests

* Add Icon prop-types

* Use imported Icon prop-types

* Fix post-rebase issue
2021-07-28 09:36:53 -07:00
Anton Kulyk
d7e0838c97 Add ability to make all children collections official or regular (#17168)
* Add `update_collection_tree_authority_level` field

* Add authority level tree update

* Test authority level children bulk update
2021-07-28 09:36:53 -07:00
Anton Kulyk
32a88aa447 Display official badge throughout the application (#17125)
* Add getCollectionIcon function

* Add isRegularCollection function

* Display official badge in collections sidebar

* Don't dim official badge icon in collections sidebar

* Show root collection icon

* Use `CollectionsList.Icon` for "All personal collections"

* Fix CollectionBadge icon color

* Display official collection badge in search results

* Test official badge displayed correctly in sidebar

* Test official badge is shown throughout the app

* Show official badge icon in SavedQuestionPicker

* Use existing isPersonalCollection utility

* Show official badge icon in QuestionPicker

* Show official badge icon in CollectionPicker

* Minor CollectionIcon refactoring

* Use function declaration for isRegularCollection

* Add editCollection test helper

* Add changeCollectionTypeTo helper

* Remove duplicated assertions

* Add helper to create official collection

* Add testOfficialBadgeInSearch helper
2021-07-28 09:36:53 -07:00
Anton Kulyk
0a6877824d Bootstrap collections plugin, add collection types form (#17071)
* Add badge icon

* Add empty PLUGIN_FORM_WIDGETS

* Add empty PLUGIN_COLLECTIONS

* Extract `getWidgetComponent` from FormWidget

* Allow adding EE-only form widgets

* Add `authority_level` field to collections

* Fix SegmentedControl's `value` prop-type

* Specify icon sizes for SegmentedControl's options

* Add FormCollectionAuthorityLevel form widget

* Add `PLUGIN_COLLECTION_COMPONENTS`

* Add CollectionAuthorityLevelIcon

* Move ToggleMobileSidebarIcon out of PageHeading

* Display official badge on collection page

* Add authority level to collections plugin

* Rename `AUTHORITY_LEVELS` to `EE_AUTHORITY_LEVELS`

* Patch collections plugin with EE authority levels

* Fix authority level value for new collection form

* Add `cy.createCollection` command

* Add `describeWithoutToken` Cypress helper

* Test user can manage collection authority level

* Test collection types available only in EE

* Run prettier

* Keep regular collection opts in AUTHORITY_LEVEL

* Fix test comment

* Translate collection type names

* Avoid aliasing regular authority level
2021-07-28 09:36:53 -07:00
Anton Kulyk
9687939646 Fix POST /api/collection ignores authority_level (#17070) 2021-07-28 09:36:53 -07:00
Greg Wilson
502e860d8c Troubleshooting guide for sandboxing (#17207)
* Outlining items for troubleshooting guide for sandboxing.

* Update docs/troubleshooting-guide/sandboxing.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Incorporating minor suggestions

* Incorporating comment from @flamber

* Converting sandboxing troubleshooting guide to prose

* Update docs/troubleshooting-guide/sandboxing.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Johannes' fixes

* Update docs/troubleshooting-guide/sandboxing.md

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

* Update docs/troubleshooting-guide/sandboxing.md

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

* Update docs/troubleshooting-guide/sandboxing.md

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

* Update docs/troubleshooting-guide/sandboxing.md

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

* Update docs/troubleshooting-guide/sandboxing.md

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

* Update docs/troubleshooting-guide/sandboxing.md

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

* Update docs/troubleshooting-guide/sandboxing.md

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

* Update docs/troubleshooting-guide/sandboxing.md

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

* Jeff's edits

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-07-28 12:20:10 -04:00
Alexander Lesnenko
2cdc8df2b7 Skip Percy job triggered by comment early (#17232) 2021-07-28 16:02:41 +03:00
Greg Wilson
6bcc6b54dd Minor fixes to performance troubleshooting guide (#17221)
* Minor fixes to performance troubleshooting guide

* Update docs/troubleshooting-guide/performance.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Fixing a few small issues with the performance troubleshooting guide.

* Another fix to performance troubleshooting

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-07-28 08:10:11 -04:00
Cam Saul
490b40fd20 Update auto-generated API documentation [ci skip] (#17227) 2021-07-27 17:18:43 -07:00
Cam Saul
51f92486bd Enable clj-kondo failures on missing docstring; remove bikeshed (#17224)
* Enable clj-kondo failures on missing docstring; remove bikeshed

* Add missing docstrings
2021-07-27 16:13:55 -07:00
Alexander Lesnenko
92451f958a Fix image is rendered as url when there is a click behavior for the column (#17219)
* Fix image is rendered as url when there is a click behavior for the column

* add unit spec repro
2021-07-27 22:55:20 +03:00
Alexander Lesnenko
36be7a88cc Fix people dropdown goes outside of the screen (#17218)
* Fix people dropdown goes outside of the screen

* unskip repro
2021-07-27 22:54:55 +03:00
Alexander Lesnenko
f667c25305 add basic percy setup (#17162) 2021-07-27 22:54:37 +03:00
Greg Wilson
c4ce4bca00 Performance troubleshooting guide (#17174)
* First draft of performance troubleshooting guide.

* Update docs/troubleshooting-guide/performance.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update docs/troubleshooting-guide/performance.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Update docs/troubleshooting-guide/performance.md

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>

* Incorporating @flamber suggestions

* Updating troubleshooting guide

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-07-27 13:28:03 -04:00
Jeff Bruemmer
221f09720b docs - troubleshooting guide: load from h2 (#17209) 2021-07-27 13:12:37 -04:00
Greg Wilson
0e4aaed595 Editing FAQ. (#17153)
* Editing FAQ.

- Minor updates to wording.
- Changed a couple of links to point at /learn articles.
- Regularizing title levels.
- Moved all out-of-page links into page foot to simplify consistency checking.

* Update docs/faq/general/do-we-need-a-data-processing-agreement.md

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

* Update docs/faq/general/does-metabase-do-x.md

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

* Update docs/faq/general/does-metabase-have-access-to-my-companys-data.md

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

* Update docs/faq/general/how-do-i-ask-for-help.md

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

* Update docs/faq/general/is-metabase-508-compliant.md

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

* Update docs/faq/general/is-metabase-508-compliant.md

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

* Update docs/faq/general/is-metabase-508-compliant.md

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

* Update docs/faq/using-metabase/cant-access-data-i-need.md

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

* Update docs/faq/using-metabase/i-am-not-getting-email-notifications.md

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

* Update docs/faq/using-metabase/how-do-i-reset-my-password.md

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

* Update docs/faq/using-metabase/how-do-i-ask-questions.md

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

* Update docs/faq/using-metabase/how-do-i-answer-questions-with-joins.md

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

* Update docs/faq/general/supported-browsers.md

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

* Update docs/faq/general/what-if-i-find-a-bug.md

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

* Update docs/faq/general/what-languages-can-be-used-with-metabase.md

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

* Update docs/faq/setup/how-do-i-integrate-with-sso.md

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

* Update docs/faq/setup/i-am-having-trouble-running-metabase.md

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

* Update docs/faq/setup/what-is-h2.md

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

* Update docs/faq/setup/which-databases-does-metabase-support.md

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

* Update docs/faq/using-metabase/cant-access-data-i-need.md

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

* Update docs/faq/using-metabase/how-do-i-answer-questions-when-data-is-in-multiple-databases.md

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-07-27 11:35:04 -04:00
Ariya Hidayat
22138b39df Don't use extend for PaddedTextButton (#17197)
extend is deprecated, see the previous PR #17048
2021-07-26 10:42:48 -07:00
Greg Wilson
3b368fd118 First editing pass through troubleshooting guide (#17154)
* First editing pass through troubleshooting guide

* Update docs/troubleshooting-guide/application-database.md

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

* Update docs/troubleshooting-guide/application-database.md

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

* Update docs/troubleshooting-guide/application-database.md

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

* Update docs/troubleshooting-guide/timezones.md

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

* Update docs/troubleshooting-guide/application-database.md

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

* Update docs/troubleshooting-guide/datawarehouse.md

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

* Update docs/troubleshooting-guide/docker.md

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

* Update docs/troubleshooting-guide/index.md

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

* Moving comma

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-07-26 12:19:49 -04:00
Nemanja Glumac
3ad4c3b95a #17186 Repro: People search dropdown goes outside of the screen (#17203) 2021-07-26 17:05:02 +02:00
Anton Kulyk
1211ded01d Repro for #15342: The order of join-type causes query fail (#17201) 2021-07-26 16:52:13 +03:00
Nemanja Glumac
996835caf6 #17200 Repro: Only the first 50 user groups are displayed (#17202) 2021-07-26 15:43:28 +02:00
Anton Kulyk
10caf59b5a Refactor FormField component (#17089)
* Improve prop-types, move to the top of the file

* Make FormField a functional component

* Simplify default props assignment

* Remove redundant comparisons

* Add InputContainer component

* Extract ALL_DOT_CHARS regexp for form field id

* Simplify Label

* Extract rootClassNames

* Fix formFieldId

* Fix FormField prop type
2021-07-26 13:54:17 +03:00
Dalton
bc90e06915 add question details sidebar (#16803)
* add question details sidebar (code from bucm)

update some cy tests

rmv moderation-related code

rmv padding on description

merge history button logic into label

lint fix

update some clicks in cy tests

update styles to use styled-components

fix more cy tests

rmv unused component

rmv unused reference

rmv unused prop

remove styling code that is no longer necessary

rmv extraneous space

fix translation

rmv added util class

move styled component to own file

* add revision util tests

* rmv some unneeded question panel styling

* move files into query_builder directory

* rearrange stuff in file

* ClampedDescription unit test

* add QuestionActionButtons unit tests

* add SavedQuestionHeaderButton test

* add QuestionActivityTimeline tests

* tweak/improve props/propTypes

* fix cy test referencing question description

* fix revision history cy test

* Question sidebar visual polish (#16942)

* style tweaks

* restyle Revert button

* add a little breadcrumb spacing

* make LastEditInfoLabel use Badge instead of TextButton

* bring back TextButton

* Revision History => History

* fix activity timeline unit test

* rmv unused styled components

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>

* hide 'add a description' button when read only

* update permissions cy tests

* update ClampedDescription unit test

* use size enum instead of boolean

* move export to bottom of file

* move modal magic strings to a constants file

* clobber all qb state when reloading

* Fix reversion cy tests

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-07-23 15:05:04 -07:00
Jeff Evans
80b46b1f75 Implement JDBC based Presto driver (#16194)
Implement JDBC based Presto driver

Adding new Presto JDBC driver using the PrestoDB JDBC driver from `https://github.com/prestodb/presto`

Marking the old Presto driver as being `superseded-by` the new one

Pulling out common Presto code into new presto-common driver (modeled after the relationship between, ex: `googleanalytics` and `google)`

Putting common QP/HoneySQL logic into the new (abstract) :presto-common driver

Updating :presto driver to extend from the new common driver and only adding HTTP/REST API related methods

Adding implementation of Presto JDBC driver, named :presto-jdbc, extending from :presto-common and :sql-jdbc

Using com.facebook.presto/presto-jdbc as underlying JDBC driver dependency (since this is explicitly for Presto clusters, as opposed to Trino)

Adapting code from the existing Presto driver where appropriate

Adding new dependency-satisfied? implementation for :env-var, to allow for a plugin to require an env var be set, and making the Presto JDBC driver depend on that (specifically: `mb-enable-presto-jdbc-driver`)

Adding CircleCI configuration to run against the newer Presto (0.254) Docker image

Adding explicit ordering in a few tests where it was missing

Fixing presto-type->base-type (timestamps were being synced as :type/Time because the regex pattern was wrong)

Add tx/format-name test implementation for :presto-jdbc to lowercase table name

Make modified test Oracle friendly

Fixing bug parsing the `[:zone :time]` case within `metabase.util.date-2.parse/parse-with-formatter`; the offset is nil so it can't be passed directly in this case, so use the `standard-offset` fn (which was moved from `date-2` to `common` to get a standard offset for that zone

Fixing more test failures by adding explicit ordering

Changing sync to check whether the driver supports foreign keys before attempting to sync those (since drivers might throw an exception if attempting to check)

Moving some common test dataset functionality between :presto and :presto-jdbc to a new test.data ns for :presto-common

Adding HoneySQL form for :count-where, since we have to explicitly give a higher precision Decimal in order for Presto to not reduce the precision in results

Put limit within subquery for `expression-using-aggregation-test` (since ordering from subquery is not guaranteed in Presto)

Adding impls for ->prepared-substitution to handle substitutions for native query params

Adding HoneySQL impls for `mod` (to do as "mod(x,y)" and `timestamp` (since it's a function with no parens to invoke) functions

Adding various `sql.qp/date` impls that use the `AT TIME ZONE` operator to account for report tz, and make bucketing tests happy
2021-07-23 17:03:06 -05:00
Nemanja Glumac
5836393347 [Dashboard filters coverage] Add initial set of tests for dashboard text/category filters (#17192) 2021-07-23 22:34:08 +02:00
Nemanja Glumac
2a51e37906 [Dashboard filters coverage] Add initial set of tests for dashboard location filters (#17191) 2021-07-23 21:42:56 +02:00
Nemanja Glumac
7748d094b7 [Dashboard filters coverage] Add initial set of tests for dashboard number filters (#17188)
* Add initial set of tests for dashboard number filters

* Fix `describe` title for date fitlers
2021-07-23 21:17:43 +02:00
Nemanja Glumac
35ccbbead1 [Dashboard filters coverage] Add initial set of tests for dashboard ID filter (#17190) 2021-07-23 21:17:12 +02:00
Jeff Evans
3ddcb2638c Add support for driver deprecation (#17028)
# Backend changes

Introducing new `superseded-by` property to plugin manifest YAML, which will indicate the driver that is to eventually replace this one (and will drive UI/UX behavior).  If a driver declares this property, then it's considered to be deprecated in favor of the specified one.

Adding top level `test_modules` directory (with the same structure as modules) for the sole purpose of module/plugin testing of YAML files, which will not be included with the driver build

Updating `driver-plugin-manifest` to look for the new `test_modules` directory in addition to `modules`, when loading the driver manifest

# Frontend changes

Calculate `supersededBy` and supersedes maps from the "superseded-by" property for each engine

Change the options for the engine field to use a function to dynamically show the legacy driver if allowed by rules (either the new driver is selected, or the legacy driver was already selected for an existing DB, or the driver is not superseded by anything)

Add new `DriverWarning` component to show these warnings based on supersede status

Co-authored-by: Anton Kulyk <kuliks.anton@gmail.com>
2021-07-23 14:03:46 -05:00
Nemanja Glumac
33939b0cf0 [Dashboard filters coverage] Add initial set of tests for dashboard date filters (#17173) 2021-07-23 15:58:57 +02:00
Gustavo Saiani
4d62207377 Improve Collection Sidebar UI for mobile (#17163) 2021-07-23 09:52:12 -03:00
Gustavo Saiani
3d3c63d1c9 Improve Collection Sidebar component (#17114) 2021-07-23 09:15:14 -03:00
Nemanja Glumac
a8d1e94627 Upgrade xlsx library (#17181) 2021-07-23 13:52:41 +02:00
Jeff Evans
940154d9a5 Remove regionid from Snowflake config (#16740)
Remove regionid from plugin YAML file

Add new driver multimethod to `normalize db-details`, and implementing to handle this particular "migration" within Snowflake

Adding hook from database model post-select to invoke the new multi

Adding test
2021-07-22 18:30:10 -05:00
Jeff Evans
eb59ab27a7 Fix serialization: Visualization column settings lost (#17127)
Update visualization_settings.cljc to handle the table.columns submap

Update dump and load to handle :visualization_settings on a Card (basically identically to how they are handled for a DashboardCard)

Updating test to have a card include :visualization_settings and ensure they fields are properly handled

Updating visualization_settings test case to incorporate table.columns as well as :show_mini_bar (under ::column_settings)
2021-07-22 18:04:05 -05:00
Alexander Lesnenko
fc47146132 change iframe-resizer height calculation method to max (#17158) 2021-07-22 23:43:25 +03:00
Kyle Doherty
0fdd82a2f1 add basic static-viz internal route and examples (#17172) 2021-07-22 14:57:30 -04:00
Maz Ameli
cadd71015b fix Radio component with new syntax (#17103) 2021-07-22 11:58:53 -03:00
Ariya Hidayat
7ec6f154a3 Bundle static viz charting code (#17157)
* yarn add @visx/axis@1.8.0 @visx/grid@1.16.0 @visx/group@1.7.0 @visx/scale@1.7.0 @visx/shape@1.8.0

* Import static viz charting code

* Format code with yarn prettier

* Silence linting violations

* Build static-viz bundle
2021-07-22 10:39:39 -04:00
Alexander Polyankin
f0ab4de743 Fix waterfall visualization with ordinal and numeric X-axis (#17150) 2021-07-22 15:19:06 +03:00
Nemanja Glumac
a2dd1cf45e Add and enable cypress-grep library (#16930)
* Add `cypress-grep` library

https://github.com/cypress-io/cypress-grep

* Register `cypress-grep` plugin
2021-07-22 13:23:21 +02:00
Nemanja Glumac
3462edcd66 Remove image diff (#17159)
* Remove `image-diff` library

* Remove `compare-screenshots` script
2021-07-22 00:41:32 +02:00
Gustavo Saiani
1127578af2 Extract component from ParameterFieldWidget (#17091) 2021-07-21 12:28:36 -03:00
Noah Moss
65cfb4ef10 site-url test improvements (#17142) 2021-07-21 08:22:00 -07:00
Anton Kulyk
8d644391ee Fix dashboard card hovering buttons drag behavior (#17130) 2021-07-21 16:14:20 +03:00
Anton Kulyk
100406fd25 Add Metabase Cloud link to admin settings for hosted instances (#17134)
* Add `storeUrl` method to MetabaseSettings

* Use `storeUrl` method

* Add Cloud settings tab

* Add E2E tests for cloud settings page
2021-07-21 15:43:44 +03:00
Nemanja Glumac
ca7be424e5 #17139 Repro: Clicking on cancel edit dashboard without any changes removes the dashboard filter (#17140) 2021-07-21 11:15:28 +02:00
Alexander Polyankin
7ad2d6fddf Do not change route in case collection archiving is cancelled (#17135) 2021-07-21 11:01:05 +03:00
Noah Moss
0691bfbfb7 Don't guess site url from requests to healthcheck endpoint (#17136) 2021-07-20 16:02:54 -07:00
Alexander Lesnenko
b5d4817247 fix stacked buttons on embedded dashboards (#17126) 2021-07-20 20:14:27 +03:00
Anton Kulyk
28aab0f61e Fix can't select card text while editing dashboard (#17124) 2021-07-20 19:32:51 +03:00
Alexander Polyankin
5a848b4421 Do not reload settings on error when explicit Save is used (#17123) 2021-07-20 18:50:52 +03:00
Alexander Polyankin
8b83319dc8 Fix padding for Add a map button (#17120) 2021-07-20 18:34:06 +03:00
Alexander Lesnenko
648996f69a Fix partial commits (#17121) 2021-07-20 16:20:45 +03:00
Ariya Hidayat
2ee56db865 Don't use extend with styled-components anymore (#17048)
It's deprecated and thus removed in v4:
https://styled-components.com/docs/api#deprecated-extend
2021-07-19 15:50:13 -07:00
Nemanja Glumac
5512dd1295 Upgrade Webpack to the v5 (#16113)
* Update Webpack to the latest version (5.37.0)

* Update `webpack-dev-server` to the latest version (3.11.2)

* Install `webpack-cli`

* Replace `CommonsChunkPlugin` with `splitCunks`

* Remove `NamedModulesPlugin`

* Remove `UnusedFilesWebpackPlugin`

* Replace `extract-text-webpack-plugin` with `mini-css-extract-plugin`

* Upgrade `html-webpack-plugin` to the latest version (5.3.1)

* Upgrade `html-webpack-harddisk-plugin` to the latest version (2.0.0)

* Remove `banner-webpack-plugin`

* Replace deprecated `[hash]` in the config

* Add `mode` to the config

* Upgrade `file-loader` to the latest version (6.2.0)

* Don't include polyfills for `path` and `crypto`

* Remove `uglifyjs-webpack-plugin` and use terser instead

* Workaround CLJS_GLOBAL needs top-level `process` object

* yarn add node-polyfill-webpack-plugin

* Use some polyfills

Apparently, the polyfill for crypto is still necessary since the front-end
code isn't migrated yet to the browser's native Crypto API
(https://www.w3.org/TR/WebCryptoAPI/)

See also https://www.npmjs.com/package/node-polyfill-webpack-plugin

* Admin smoke test: fix getting the empty DB path

* Onboarding setup test: fix getting the empty DB path

* Replace file-loader with type: "asset/resource"

See https://webpack.js.org/guides/asset-modules/

* upgrade react-markdown (#16934)

* Use large CI resource since webpack consumes a lot of memory [ci nocache]

https://circleci.com/docs/2.0/configuration-reference/#resourceclass

* Tidy up `NODE_ENV` references

* Remove Webpack `DefinePlugin`

Co-authored-by: Ariya Hidayat <ariya@metabase.com>
Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
2021-07-20 00:47:22 +02:00
Nemanja Glumac
856d25c109 Run Cypress jobs in CircleCI as a matrix (#17104) 2021-07-20 00:28:29 +02:00
Nemanja Glumac
b48e0bd3d7 #17043 Repro: With Whitelabel custom name, Metabase name is still shown multiple places in Admin Panel (#17112) 2021-07-19 23:27:06 +02:00
Alexander Polyankin
3927d0c706 Remove Number from semantic types (#17109) 2021-07-19 23:25:09 +03:00
Gustavo Saiani
02d0adcbf5 Improve Collections Header component (#17098) 2021-07-19 16:14:30 -03:00
Nemanja Glumac
fb0eab4d3f [Cypress runner] Run Cypress (#17099)
Related issue: https://github.com/metabase/metabase/issues/17005

* Add `arg` library

* Rewrite the main Cypress runner logic

* Destructure Cypress snapshot results

* Rename Cypress snapshots runner

* Update CircleCI config to reflect `folder` changes

* Update readme for smoke tests

* Run `metabase-db` tests conditionally based on env `QA_DB_ENABLED`
2021-07-19 20:49:52 +02:00
Anton Kulyk
e01d0c7d5b Replace ButtonGroup component with SegmentedControl (#16958)
* Add icons-only mode to SegmentedControl

* Add `fullWidth` mode to SegmentedControl

* Use SegmentedControl at SchedulePicker

* Use SegmentedControl at EmailAttachmentPicker

* Use SegmentedControl at ChartNestedSettingSeries

* Replace ChartSettingButtonGroup with SegmentedControl

* Remove ButtonGroup component

* Don't show labels for some viz settings

* Increase SegmentedControl's click area

* Add `inactiveColor` prop to SegmentedControl

* Fix icons-only SegmentedControl padding
2021-07-19 21:29:26 +03:00
Anton Kulyk
6aaf5c4ff1 Use saturated-yellow instead of warning (#17085) 2021-07-19 21:29:08 +03:00
Anton Kulyk
6a6cdfd737 Fix SearchResult.info page broken (#17086) 2021-07-19 21:28:51 +03:00
Anton Kulyk
ae38449276 Fix missing icons (#17088) 2021-07-19 21:27:52 +03:00
Ariya Hidayat
2448065e92 Separate the (whitelabel) color theme tests (#17106)
This is for easier troubleshooting (rerun from failed, separated
recording) since those tests are quite hard to run smoothly with Circle
CI.

Also, move away from using the API (/api/setting/application-colors)
and just use the color picker from the UI to choose invididual custom color.
2021-07-19 11:24:00 -07:00
Noah Moss
3fd87094ba Link to MB docs from Google Sign-In admin page instead of Google docs (#17075) 2021-07-19 10:22:07 -07:00
dpsutton
64062e8752 offset is a reserved word in mariadb as of 10.6 (#17101)
* offset is a reserved word in mariadb as of 10.6

- https://mariadb.com/kb/en/reserved-words/
- https://github.com/MariaDB/server/commit/299b935320

I think it is related to https://jira.mariadb.org/browse/MDEV-23908
"Implement SELECT ... OFFSET ... FETCH ..."

* Handle new names for utf8 in mariadb

https://mariadb.com/kb/en/unicode/

- utf8: Until MariaDB 10.5, this was a UTF-8 encoding using one to
three bytes per character. Basic Latin letters, numbers and
punctuation use one byte. European and Middle East letters mostly fit
into 2 bytes. Korean, Chinese, and Japanese ideographs use 3-bytes. No
supplementary characters are stored. From MariaDB 10.6, utf8 is an
alias for utf8mb3, but this can changed to ut8mb4 by changing the
default value of the old_mode system variable.

- utf8mb3: UTF-8 encoding using one to three bytes per
character. Basic Latin letters, numbers and punctuation use one
byte. European and Middle East letters mostly fit into 2
bytes. Korean, Chinese, and Japanese ideographs use 3-bytes. No
supplementary characters are stored. Until MariaDB 10.5, this was an
alias for utf8. From MariaDB 10.6, utf8 is by default an alias for
utf8mb3, but this can changed to ut8mb4 by changing the default value
of the old_mode system variable.
2021-07-19 08:52:43 -05:00
Gustavo Saiani
4452329a60 Add propTypes, remove Flow types from ParameterFieldWidget component (#17081) 2021-07-16 13:37:32 -03:00
Anton Kulyk
233f8fdbca Allow displaying info tooltips on FormFields (#17073) 2021-07-16 08:42:33 +03:00
Anton Kulyk
1153473c2c Refactor entity getIcon to return icon props (#17074) 2021-07-16 08:42:24 +03:00
Jeff Evans
4ed4c57d56 Set program name on Oracle connections (#16968)
Update Oracle driver to set the v$session.program property on the connection, which appears in the PROGRAM column of the v$session table

Update tests accordingly
2021-07-15 22:03:27 -05:00
Cam Saul
3311b62119 Fix Card async-metadata running query even when metadata can be deter… (#17053)
* Fix Card async-metadata running query even when metadata can be determined programatically

* Update another test

* Adjust affected repros by waiting for the metadata to load (#17068)

* Wait for the `result_metadata` to load

* Reduce the number of bins for the faster execution

* Update repro for #12568

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2021-07-15 15:35:55 -07:00
Nemanja Glumac
5de2d22efa [Dashboard filters] Create initial infrastructure and group repros (#17079)
* Extract repro for #15279 into a separate file

* Extract repro for #15689 into a separate file

* Extract repro for #15695 into a separate file

* Extract repro for #15119 into a separate file

* Extract repro for #12614 into a separate file

* Extract repro for #12720 into a separate file

* Extract repro for #6660 into a separate file

* Extract repro for #16103 into a separate file

* Extract repro for #13150 into a separate file

* Move existing tests related to the dashboard filters into a new folder

* Create new CI group `dashboard-filters`
2021-07-15 21:53:42 +02:00
Gustavo Saiani
4da53d5e80 Fix popover footer when is not equalOps (#17076) 2021-07-15 16:19:46 -03:00
Nemanja Glumac
a42fec8e50 Rename CI group filters -> native-filters (#17066)
This group already takes close to 10 minutes to finish.

We need to have an additional extended coverage for dashboard filters and for query builder filters.
It doesn't make sense to keep them all together under the `filters` CI group because that group on its own could take more than half an hour to finish.
2021-07-15 15:04:40 +02:00
Nemanja Glumac
132899db5e Add createNativeQuestionAndDashboard Cypress custom command (#16970)
* Add `createNativeQuestionAndDashboard` Cypress custom command

* Apply custom command to the existing test as an example

* Add sane defaults for the dashboard card size

* Apply custom command to 16181 reproduction
2021-07-15 00:28:49 +02:00
Nemanja Glumac
c43a7828cc Remove db paging (#16990) (#17054)
I thought (and assured dpsutton, lol) that the default behavior of the pagination spliced in was just not paginating, if there wasn't a limit passed in. Unfortunately, it appears that I tested this on the endpoint without pagination spliced in... so the default behavior isn't that way, it paginates if you don't pass in stuff.

So rip it out of the DB endpoint (only) for now and put it back in when we paginate

Authored-by: Howon Lee <hlee.howon@gmail.com>
2021-07-14 23:55:22 +02:00
Nemanja Glumac
673981a06f 🍒 Cherry pick changes from July 9, 2021 from release -> master (#17051)
* Add `addFilterToDashboard` Cypress custom command (#16964)

* Apply custom command to a few tests as an example

* #16918 Repro: Pulse fails when question has date field with "Month of Year" (#16921)
2021-07-14 23:50:52 +02:00
Nemanja Glumac
25373f96a8 docs - fix pulse link [closes #16953] (#16959) (#17055)
Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-07-14 23:36:44 +02:00
Jeff Evans
ee3bdc70de Remove Multi-Release from manifest (#17027)
Undoes #16005, because performance was significantly impacted; see issue #16380
2021-07-14 15:25:47 -05:00
Nemanja Glumac
d4932745a4 Scroll to selected collection and question in the saved question picker (#16957) (#17052)
* Scroll to selected collection and question in the saved question picker

* fixup! Scroll to selected collection and question in the saved question picker

Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
2021-07-14 22:21:49 +02:00
Alexander Lesnenko
99da074b1a minimal hack fix search results being below the data picker (#16998) 2021-07-14 12:06:39 -07:00
Nemanja Glumac
2ebaf71a1a [Cypress runner] Use Cypress Module API to generate Cypress snapshots (#17010) 2021-07-14 20:58:23 +02:00
Nemanja Glumac
005c221e18 [Cypress runner] Get version (#17015) (#17047)
* Extract `readFile` into runner utils

* Extract `getVersion` function into a separate file
2021-07-14 20:21:48 +02:00
Nemanja Glumac
a209702b57 [Cypress runner] Extract print helper functions (#17008) (#17017)
* Extract print helper functions for the Cypress runner

* Re-order Cypress messages to the more appropriate position
2021-07-14 20:01:36 +02:00
Nemanja Glumac
0fea0879f6 [Cypress runner] Set HAS_ENTERPRISE_TOKEN using Configuration API (#17006) (#17016)
* Set `HAS_ENTERPRISE_TOKEN` using Cypress Configuration and Plugins API

* Re-organize webpack preprocessor options
2021-07-14 20:01:14 +02:00
dpsutton
90435d6dfe Smartscalars (#17020)
* Smartscalars

* smartscalar html styling

* Docstring, ns, prevent top-level trs/tru
2021-07-14 11:54:21 -05:00
Anton Kulyk
b2098b6072 Fix error when opening a public question with filters having default parameters (#17034) 2021-07-14 15:55:34 +03:00
Gustavo Saiani
94369c541c Humanize coercion strategy strings (#17029) 2021-07-14 09:01:18 -03:00
Anton Kulyk
8ac3883ceb [P0] Fix filters don't work for public and embedded questions (#17032)
* Enable repro for #17019

* Fix filters don't work for public questions
2021-07-14 14:53:58 +03:00
Anton Kulyk
d38a2ff471 Fix long titles in collections push out the last-edited-by and last-edited-at columns (#16992)
* Handle long collection item titles

* Fix EntityItemMenu's margin-left

* Remove `span` attribute from cols

* Fix "name" column is too close to "type"

* Fix "last edit" columns width

* Hide "last-edit" column at medium breakpoint
2021-07-14 08:53:49 +03:00
Anton Kulyk
f0ac47d34c Fix native question looses visualisation settings if query fails (#17009)
* Add test IDs for visualization buttons

* Add `runNativeQuery` helper to e2e-misc-helpers

* Add repro for #16914

* Don't sync native query columns if it failed

* Fix `table.columns: []` treated as "all hidden"
2021-07-14 08:53:34 +03:00
Ariya Hidayat
980518f2f4 Form: guard against undefined submit function (#17023) 2021-07-13 20:26:26 -07:00
Ariya Hidayat
5a8c8f4d46 When running some TokenField unit tests, shim Element.closest (#17021) 2021-07-13 20:26:13 -07:00
Nemanja Glumac
de5f85971a #17019 Repro: Question filters don't for for embed/public scenarios (#17024) 2021-07-13 21:28:33 +02:00
Ariya Hidayat
7403c196f9 Entities search: guard against undefined data (#16996) 2021-07-13 10:34:03 -07:00
Ariya Hidayat
bd606e7f03 Data selector: avoid toggling popover when it's not ready (#16987) 2021-07-13 10:25:08 -07:00
Anton Kulyk
6db73b0cfa Unskip #16617 (#17004) 2021-07-13 13:11:51 +03:00
Gustavo Saiani
e14d88c448 Improve SettingsUpdatesForm component (#16988) 2021-07-12 21:23:28 -03:00
Ariya Hidayat
4fdf2b85bf When running some Jest unit tests, use a MutationObserver shim (#16985) 2021-07-12 17:07:31 -07:00
Bruno Bergher
3d6dd7762e Remove email quotations which could be deemed controversial. (#16944)
* Remove email quotations which could be deemed controversial. Address part of #11155

* Trigger deploy

Co-authored-by: Bruno Bergher <me@brunobergher.comexport>
2021-07-12 16:32:18 -07:00
Ariya Hidayat
aeedcc078e When running <Logs> unit tests, mock XMLHttpRequest (#16974)
Since Jest runs with JSDom and JSDom doesn't really implement XHR,
provide a mock implementation to avoid a thrown exception.
2021-07-12 16:24:35 -07:00
Jeff Bruemmer
cb63c67a8b Don't offer to save on visualize unless dirty (#16994) 2021-07-12 16:10:43 -04:00
dpsutton
0d43803629 Easy checking for missing library licenses (#16989)
* Easy checking for missing library licenses

* include bin/build-mb readme
2021-07-12 15:05:43 -05:00
Alexander Lesnenko
cde652ba88 Update iframeResizer.js (#16952)
Co-authored-by: Mário Valney <mariovalney@gmail.com>
2021-07-12 09:31:02 -07:00
Anton Kulyk
b96a477f0b Fix console errors for Radio and SegmentedControl (#16950) 2021-07-12 19:21:41 +03:00
Ariya Hidayat
8df69c589a VS Code launch config to facilitate debugging (#16975) 2021-07-12 08:25:51 -07:00
Gustavo Saiani
bc2a3ac00c Test CTA renders for Enterprise and Cloud in Settings › Admin › Updates (#16966) 2021-07-12 11:01:52 -03:00
Anton Kulyk
02fddd8a4f Remove console logs (#16982) 2021-07-12 15:45:51 +03:00
Ariya Hidayat
3c71c5186d Run unit tests with Jest with --silent (#16967)
The console messages (mostly about React warning on deprecated methods)
are useful when debugging a running application but they are atrocious,
extremely noisy, and barely useful when running the unit tests.

In the CI, those console messages drown the more useful PASS/FAIL status
of each individual test.
2021-07-09 21:19:25 -07:00
Nemanja Glumac
1d107a0664 [SQL filters coverage] Add initial set of e2e tests around SQL field filter type of ID (#16926)
* Add test for SQL field filter of the type ID

* Fix spelling

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
2021-07-10 00:51:46 +02:00
Nemanja Glumac
f6f4f0c794 [SQL filters coverage] Add initial set of e2e tests around SQL field filter type of "None" (#16928)
* Add test for SQL field filter of the type "None"

* Add repro for #13825

* Fix spelling

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
2021-07-09 23:29:48 +02:00
Ariya Hidayat
f97e2deeff CI GitHub Actions: Cache JARs for Shadow CLJS (#16965)
Some front-end tasks require Shadow CLJS to compile files into
JavaScript, therefore let's cache the JARs which it needs.
2021-07-09 14:25:35 -07:00
dpsutton
c04e9a63f5 Render/scalar (#16955)
* Scalar rendering as text in slack

* Fix tests for pulse

* Tests for slack scalars
2021-07-09 15:29:48 -05:00
Anton Kulyk
250118d264 Refactor CheckBox and StackedCheckBox components (#16913)
* Disable react/prop-types for .info files

* Refactor Checkbox

* Refactor StackedCheckBox

* Add a comment about Checkbox colors

* Remove not used prop

* Don't show outline for focused unchecked checkbox

* Pass custom Checkbox label element

* Refactor EmailAttachmentPicker to use label

* Refactor FieldsPicker to use label

* Refactor FilterOptions to use label

* Refactor DisplayOptionsPane to use label

* Refactor ScratchApp to use label

* Refactor AddSeriesModal to use label

* Add "danger" color to colors

* Refactor DeleteModalWithConfirm to use label

* Add label usage examples for CheckBox

* Add label usage examples for StackedCheckBox

* Add disabled state to CheckBox

* Add disabled state to StackedCheckBox

* Fix label prop-types

* Add space between examples

* Fix StackedCheckBox layout

* Add. StackedCheckBox label

* Fix disabled state for StackedCheckBox

* Migrate FieldsPicker to use label

* Migrate EmailAttachmentPicker to use label

* Add .styled files for checkbox components

* Fix e2e tests

* Fix `uncheckedColor` passed to HTML elements

* Revert eslint overwrite for .info files

* Display focus outline
2021-07-09 14:34:55 +03:00
Nemanja Glumac
3555b7b2d4 Mark "Every field is hidden right now" string for translation (#16915) 2021-07-09 13:11:16 +02:00
Nemanja Glumac
a0af486924 Remove recompose (#16829)
* Replace `pure` with `React.Memo`

* Fix eslint error

* Use `shallowEqual` directly as a utility function

* Remove `recompose` library
2021-07-09 13:10:14 +02:00
Maz Ameli
961caedc99 update remaining strings for 0.40 (#16945) 2021-07-08 17:07:49 -07:00
Alexander Lesnenko
a44054f612 Fix home page our analytics (#16910)
* Fix home page our analytics section not showing collections

* increase limit for root collection children and pinned dashboards that are loaded on the home page
2021-07-09 00:54:34 +03:00
Alexander Lesnenko
e481e5197d Saved question picker bug bash (#16940)
* fix Saved questions string translation

* fix Everything else folder is not showing items in the saved question picker for other languages

* translate query builder header

* Fix saved questions db on the client side

* i18n on "Saved Questions"

Co-authored-by: dan sutton <dan@dpsutton.com>
2021-07-08 23:47:13 +03:00
Bonifacio de Oliveira
8d21e2dae1 fix typos (#16734) 2021-07-08 11:34:17 -07:00
Tim Macdonald
a7257112ca [Fixes #16855] Avoid error when user searches with no data perms (#16925) 2021-07-08 13:31:10 -05:00
Alexander Lesnenko
97da3c5eae Saved question picker fixes (#16904)
* adjust saved question picker layout

* fix saved question picker does not work with collection names that have a colon

* unskip repro

* make saved question picker usable on the mobile device
2021-07-08 19:36:48 +03:00
Gustavo Saiani
b8e92c8a2e Update logic and labels for settings updates preferences in Cloud and Enterprise (#16920) 2021-07-08 11:36:52 -03:00
Ariya Hidayat
a7d10a74a6 GitHub Actions: correct the way yarn is supposed to pull the deps (#16933)
There's no `--lockfile` option, the valid one is `--frozen-lockfile`.

https://classic.yarnpkg.com/en/docs/cli/install/#toc-yarn-install-frozen-lockfile
2021-07-08 07:36:30 -07:00
Dalton
e96cf05b2c don't show error card in prod & make it fullscreen when running cypress (#16908)
* don't show error card in prod & make it fullscreen when running cypress

* fix height styling
2021-07-07 18:13:02 -07:00
Noah Moss
19936cc365 Hardcode fake salt and pw hash for timing attack prevention (#16932) 2021-07-07 17:18:00 -07:00
Ellie Mary
22c44da5d9 docs - sso tutorial auth0 14185 (#14206) 2021-07-07 12:55:26 -04:00
Alexander Lesnenko
58b35cacc6 add autofocus to some of inputs (#16858)
* add autofocus to some of inputs

* add autofocus to the snippet form
2021-07-07 19:51:19 +03:00
Anton Kulyk
2ac51762e9 Fix "Run selected text" removes everything but the selected text from the query (#16917) 2021-07-07 18:40:28 +03:00
Gustavo Saiani
799fe86ca6 Test collection sidebar responsiveness (#16896) 2021-07-07 09:40:55 -03:00
Howon Lee
29af77046d Backwards compatibility for friendly field names (#16860)
We defriendlified but the migration running in the first place is not happening for some users. Investigating but it's better just to be safe on this front
2021-07-06 19:22:58 -07:00
Gustavo Saiani
297fb1b482 Add instructions on running enterprise FE (#16911) 2021-07-06 20:05:37 -03:00
Nemanja Glumac
fb1ab412f8 #16855 Repro: Search does not work for users without data access (#16903) 2021-07-06 23:11:33 +02:00
Howon Lee
b65f466409 Excise 45 day clause from view line graph in audit (#16906) 2021-07-06 13:22:47 -07:00
Alexander Lesnenko
37c50bb2af Fix data picker initial state (#16894)
* Fix data picker not showing saved question picker initially

* fixup! Fix data picker not showing saved question picker initially
2021-07-06 23:10:55 +03:00
Noah Moss
f66d35c081 Consistent request timing for login and password reset endpoints (#16837) 2021-07-06 12:45:06 -07:00
Jeff Bruemmer
9ab0bf9d6a docs - connecting to dbs with ssl certificates (#16341) 2021-07-06 15:01:41 -04:00
Jeff Bruemmer
8d5594d216 docs - update links (#16905) 2021-07-06 14:41:52 -04:00
Nemanja Glumac
a36f0dc596 #16886 Repro: "Run selected text" removes everything but the selected text from the query (#16902) 2021-07-06 20:06:59 +02:00
Nemanja Glumac
67248552bc [SQL filters coverage] Group reproductions (#16898)
* Extract repro for #12228 into a separate file

* Extract repro for #15444 into a separate file

* Extract repro for #15460 into a separate file

* Extract repro for #15700 into a separate file

* Extract repro for #15981 into a separate file

* Extract repro for #16739 into a separate file

* Extract repro for #13961 into a separate file

* Extract repro for #14145 into a separate file

* Extract repro for #12581 into a separate file

* Extract repro for #14302 into a separate file

* Extract repro for #15163 into a separate file

* Extract repro for #11580 into a separate file

* Extract repro for #11480 into a separate file

* Extract repro for #9357 into a separate file
2021-07-06 19:14:01 +02:00
Gustavo Saiani
15c02bb008 Make mobile Collections Sidebar hidden on page load (#16878) 2021-07-06 12:53:02 -03:00
Anton Kulyk
3fc29afef1 Add SegmentedControl component (#16885)
* Add basic segmented control component

* Specify segmented control's selected option color

* Update SegmentedControl's padding

* Use `PropTypes.node` instead of a bunch of types

* Remove `aria-selected` from CSS
2021-07-06 12:00:17 +03:00
Nemanja Glumac
37f9c8edc6 [SQL filters coverage] Extract and apply SQL field filter data (#16893)
* Extract and apply SQL field filter data objects

* Refactor object key `term` -> `value`
2021-07-06 01:12:57 +02:00
Nemanja Glumac
f41e4eb624 Simplify openEntryForm helper function (#16895)
- Simplifies openEntryForm helper function
- Fixes `frontend/test/metabase/scenarios/filters/sql-field-filter-string.cy.spec.js` and `frontend/test/metabase/scenarios/filters/sql-field-filter-number.cy.spec.js` logic.
2021-07-06 00:58:13 +02:00
Nemanja Glumac
9b1d72e04a [SQL filters coverage] Extract and apply date filter helpers (#16892)
* Extract date filter helpers

* Apply date filter helper filters to the `sql-field-filter-date.cy.spec.js`

* Simplify `openDateFilterPicker` function
2021-07-06 00:50:34 +02:00
Nemanja Glumac
9fbd0d25fb [SQL filters coverage] Extract and apply SQL field filter helpers (#16891)
* Extract SQL field filter helpers

* Apply field filter helper filters to the `sql-field-filter-string.cy.spec.js`

* Apply field filter helper filters to the `sql-field-filter-number.cy.spec.js`

* Apply field filter helper filters to the `sql-field-filter-date.cy.spec.js`
2021-07-05 23:49:54 +02:00
Nemanja Glumac
ed264af503 [SQL filters coverage] Extract and apply basic SQL filter helpers (#16887)
* Extract the basic SQL filter helpers

* Apply basic helper filters to the `sql-filters.cy.spec.js`

* Fix typos

* Simplify banner comments

* Apply basic helper filters to the `sql-field-filter-string.cy.spec.js`

* Apply basic helper filters to the `sql-field-filter-number.cy.spec.js`

* Apply basic helper filters to the `sql-field-filter-date.cy.spec.js`
2021-07-05 23:26:55 +02:00
Nemanja Glumac
5dd4e994f0 [Cypress Helpers] Extract functions into separate files (#16884)
* Extract e2e setup helpers

* Extract e2e ui elements helpers

* Extract e2e dashboard helpers

* Extract e2e open table helpers

* Extract e2e database metadata helpers

* Extract e2e qa databases helpers

* Extract e2e ad-hoc question helpers

* Extract e2e enterprise helpers

* Extract e2e mock app settings helpers

* Extract e2e assertion helpers

* Extract e2e data model helpers

* Extract e2e misc helpers

* Extract e2e deprecated helpers

* Remove `getIframeBody` from global helper functions

* Remove `generateUsers` from global helper functions

* Remove `enableSharingQuestion` from global helper functions

* Remove unused functions
2021-07-05 17:26:09 +02:00
Nemanja Glumac
13ea1e0233 [SQL filters coverage] Add initial set of e2e tests around SQL field filter type of Date (#16854)
* Add initial set of e2e tests around sql field filter type of Date

* Expand SQL date filter tests to include required filter flow
2021-07-05 14:06:16 +02:00
Alexander Lesnenko
26f6cfeeb8 Group personal collections in the saved question picker (#16875)
* hide other personal collections folder when no other users

* expand collections on click but disallow to select all personal collections, show all empty collections
2021-07-05 12:22:50 +03:00
Nemanja Glumac
7b1a39d24f [Cypress Helpers] Add filterWidget helper function (#16882)
* Add Cypress helper function `filterWidget`

* Apply `filterWidget` helper to the related specs

* Annotate the function using JSDoc
2021-07-05 10:21:51 +02:00
Ariya Hidayat
32494b193c Ensure the unique key for this Link instance (#16864) 2021-07-02 12:08:40 -07:00
Ariya Hidayat
7fec494244 When used in data picker, Popover's children is actually an array (#16866) 2021-07-02 12:08:21 -07:00
Anton Kulyk
178720b7e7 Extract getInitialCollectionId selector helpers, add unit tests (#16867) 2021-07-02 16:57:00 +03:00
Anton Kulyk
2a34dc5662 Clean up Radio component (#16874) 2021-07-02 16:56:06 +03:00
Nemanja Glumac
3c96f15c92 Move stray folders into existing CI e2e groups (#16868)
* Move `browse` spec to the "Onboarding" directory

* Reorganize `search` specs

- Rename stray "seach" to "search-pagination" and move it to the new "search" directory under "onboarding"
- Rename existing "search" to "search-typeahead" and move it to the new "search" directory under "onboarding"
- Move old "seach" spec to the new "search" directory under "onboarding"
2021-07-02 11:29:26 +02:00
Anton Kulyk
4ea4b2d961 Fix random collection is suggested when saving a new dashboard (#16853)
* Add repro for #16832

* Add `isCollectionPath` URL utility

* Fix getInitialCollectionId uses non-collection IDs

* Handle `location` not starting with a slash
2021-07-02 11:15:43 +03:00
Ariya Hidayat
bc4941b0e4 VS Code: Add the tasks to format code and to run linters (#16835) 2021-07-01 17:08:52 -07:00
Nemanja Glumac
b08f8b0a6d Add initial set of e2e tests around sql field filter type of String (#16851) 2021-07-01 23:06:48 +02:00
Nemanja Glumac
a60cf94806 Add initial set of e2e tests around sql field filter type of Number (#16852) 2021-07-01 23:06:27 +02:00
Alexander Lesnenko
6b8accf9c6 Add saved questions picker (#16808)
* Add Tree component

* Add Saved Question picker

* fix tree spec

* Basic sanity E2E tests

* fix bugs, minor refactoring

* keep item selected in saved question picker

* E2E tests for scoped search

* adjust tree item icon color, prevent saved question list flickering

* remove unused function

* fix incorrectly hidden collections in the saved question picker

* change icon for personal collections

* make collection tree and question list scroll bars independent

* review fixes

Co-authored-by: Ariya Hidayat <ariya@metabase.com>
2021-07-01 22:24:17 +03:00
Anton Kulyk
12b814ad7c Fix native editor is covered with run-overlay if filter is empty (#16850)
* Enable #16739 repro

* Fix isResultDirty selector when filter is empty

* Enable repro for #16811
2021-07-01 19:58:32 +03:00
Ariya Hidayat
5353a9129e Supress invalid props to a div element (#16841)
This happens because StaticParameterWidgetList is used an alternative to
SortableParameterWidget. The sorting handlers make sense for the latter
but not for the former.
2021-07-01 09:39:41 -07:00
Nemanja Glumac
ab50eaaa2f Add Cypress helper function openNativeEditor (#16846)
* Add new Cypress helper function `openNativeEditor`

- exports the function
- documents the function using JSDoc

* Apply new helper function to the related tests
2021-07-01 15:47:06 +02:00
dpsutton
8e684e3f78 Chain filters cpu utilization (#16817)
* Breadth first search on graph for chain filters

- abandons at max-depth and looks in breadth first fashion rather than
descending as far as possible on each possible path

* Add loop detection

not actually fooled by loops since we abandon after a certain path
length. But will remove some false starts before they have to be
killed by the path length check.

* Add seen optimization of nodes

We reach nodes in the shortest path possible, so keep a list of nodes
visited and don't revisit them: we got to them as fast as possible,
and once there, there's no new nodes that we can see from that vantage
point.

This allows a serious speedup and should hopefully fully resolve the
cpu issues seen by some.

* alignment
2021-06-30 10:11:21 -05:00
Jeff Bruemmer
8da7de0c85 docs - update column header formatting image (#16833) 2021-06-30 10:04:42 -04:00
Alexander Lesnenko
80550eb5fd Add Tree component (#16812)
* Add Tree component

* fix tree spec

* fix review
2021-06-30 17:00:26 +03:00
Gustavo Saiani
753afa586a Add unit tests for syncQueryParamsWithURL (#16821) 2021-06-30 09:54:37 -03:00
Alexander Lesnenko
2bb878c177 Extract SelectList component (#16814) 2021-06-30 14:29:22 +03:00
Maz Ameli
aa78e38494 update strings for 0.40 and add Serbian (#16815) 2021-06-29 17:43:47 -07:00
Nemanja Glumac
3acbf9109e [SQL filters coverage] Basic SQL filter types (#16813)
* Add initial set of e2e tests around sql basic filter types

- Reproduces #16811

* Add new `filters` e2e group to the CI
2021-06-30 00:11:39 +02:00
Ariya Hidayat
e8c8d20a51 Sort deps in package.json (#16809)
Because the next `yarn add` will resort them anyway
2021-06-29 09:34:55 -07:00
dpsutton
c9a844ba0b Correct static interop (#16804)
on java 16 there's a handy (newFilesystem path) but i don't think we
want to require java 16 yet. On previous versions we can use
(newFileSystem Path ClassLoader) which is what it was before. Really
just need to typehint the nil, but nils don't carry
metadata (sensibly) so would have to introduce a local binding

```clojure
(let [^ClassLoader cl nil]
  (FileSystems/newFileSystem jar-path cl))
```

feels a bit weird, so just send the proper classloader through.
2021-06-29 08:24:08 -07:00
Nemanja Glumac
8671f6db08 #16789 Repro: Clicking column name when dropdown menu is open should close menu (#16807)
* Simplify the existing test

* Add repro for #16789
2021-06-29 14:13:32 +02:00
Nemanja Glumac
f5fc2bae4b #16784 Repro: The list of collections available on homepage "Our analytics" depends on the name of the first 50 objects (#16806) 2021-06-29 12:37:47 +02:00
Noah Moss
e009424238 Tell user their account is deactivated in password reset email (#16744) 2021-06-28 17:33:14 -07:00
Gustavo Saiani
ac6481ffff Retrieve multiple get params for Public Question (#16795) 2021-06-28 19:49:30 -03:00
Gustavo Saiani
b667214d74 Refactor before fix: Retrieve multiple get params for Public Question (#16765) 2021-06-28 19:19:06 -03:00
Cam Saul
01957714f8 Fix race conditions when loading drivers (#16750) 2021-06-28 14:43:39 -07:00
Cam Saul
3953323ac2 Fix Oracle filtering against empty strings (#16725)
* Fix Oracle/Vertica comparison against empty string

* Remove extra println

* Add test for ::empty-string-is-null
2021-06-28 14:38:30 -07:00
Nemanja Glumac
27faa0369e #16781 Repro: Error when setting column type to Number in data model settings (#16799)
* Extract field type tests

* Add repro for #16781
2021-06-28 23:20:48 +02:00
Cam Saul
fdb0b1da09 Fix SQL saved question reference to Saved Questions with parameters (#16724)
* Fix SQL saved question reference to Saved Questions with parameters

* Test fixes 🔧

* Don't run test for drivers that don't support FKs

* Test fix 🔧

* Test fix 🔧
2021-06-28 13:08:45 -07:00
Howon Lee
e932bf44be Xray joins 14793 mk3 (#16723)
When metrics get macro-expanded in xrays, they don't have joins in them. I stick joins in them. Joins! Joins! Joins!

But the underlying problem is that the metric macros have no idea what this "join" business is. Unhappy times!
2021-06-28 11:03:19 -07:00
Anton Kulyk
be98b105ac Fix newly added columns don't appear after some columns are hidden (#16761) 2021-06-28 18:13:59 +03:00
Ariya Hidayat
2d890cb134 Unskip the repro for #16379 (fixed by PR #16707) (#16779) 2021-06-26 13:02:00 -07:00
Ariya Hidayat
c040f155ba Reimplement subdimensions menu in the time-series footer (#16768)
The temporal units for the time-series footer were hardcoded. This is
now changed to stay consistent with the e.g. the query builder and the
summary sidebar, i.e. by getting it from the breakouts dimension itself.

* Standardize propTypes and defaultProps
2021-06-25 17:51:26 -07:00
Dalton
2df6188262 filter possible native question mapping options by parameter operator (#16747)
* filter possible native question mapping options by parameter operator

* update cy test to ensure contains-->contains title drill works

* add test to ensure you cannot map a parameter to a field filter with differing types
2021-06-25 17:03:24 -07:00
Nemanja Glumac
886de205e3 #16770 Repro: Changing granularity/binning of a field, which is already used for sorting, will fail the query (#16777) 2021-06-26 00:31:22 +02:00
Alexander Lesnenko
8c8deeca50 Fix invalid calculation of chart dimensions caused collapsing (#16717)
* Fix invalid calculation of chart dimensions caused collapsing

fix cap calculation for row bar chart

* fix typo

* add spec for null
2021-06-25 22:01:54 +03:00
Ariya Hidayat
6d7c9707de Fix duplicated temporal subdimensions (#16755)
* Fix and unskip the test for custom column time series binning

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-06-25 10:12:55 -07:00
Nemanja Glumac
b956c920cc Divide SSO spec into separate files (for each of the providers) (#16772) 2021-06-25 17:15:19 +02:00
Nemanja Glumac
53488ad9e1 Unskip repro for #15974 (#16769)
* Add a timeout to the `saveSettings` function

* Update and unskip the test for #15974

* Put `Google` SSO test in its own `describe` block

* Update the test
2021-06-25 16:02:54 +02:00
Jeff Bruemmer
a39faf248d docs - note on pivot table database support [closes #14876] 2021-06-25 09:27:43 -04:00
Nemanja Glumac
8bd6ccf5c6 Unskip repro for #15397 (#16760) 2021-06-25 00:18:40 +02:00
Alexander Lesnenko
40d52e1b03 fix linear interpolation of missing values (#16733)
* fix linear interpolation of missing values

* add repro
2021-06-24 21:29:06 +03:00
Nemanja Glumac
a2c07a1088 #16739 Repro: Filter feature flag causes Run-overlay of results in Native editor unless editor is expanded (#16753) 2021-06-24 20:13:40 +02:00
Ariya Hidayat
1764725322 Since CodeQL check is required, always have it run (#16758) 2021-06-24 09:20:25 -07:00
Anton Kulyk
feb068db8f Fix line chart's y-axis for filtered multi-series charts (#16713)
* Unskip repro

* Fix incorrect y-axis label for line charts

* Update tests
2021-06-24 12:43:18 +03:00
dpsutton
d4121d044c Cache results dont affect average execution time (#16720)
* Only save successful-query-execution if it wasnt a cached result

the only thing this function does is update the rolling average query
execution time

* Failing tests for cache execution stats

These tests fail, but they shouldn't.

The save-execution information should not be called twice, and the
average execution duration should remain the same. What's happening is
that it is getting called twice just in the cache call, and only one
of those has the new key `:metrics/ignore-execution-time`. This
remains a mystery to me

* Don't call completion arity from step arity

the `(rf acc)` call violated the terms of transduction. If it does
need to be there, perhaps it could be used with reduced

wary of #12207 (which fixes #12165) and seeing if that crops up again.

- i had introduced :metrics/ignore-execution-time but this was because
i thought that we were running a simple query (limit 1) to get col
metadata. Now that i know we were just being a bit careless with `(rf
acc)` this extra information is no longer needed, and we can just
react to cached data.

* hoist closing paren
2021-06-23 16:28:22 -05:00
dpsutton
6061797706 Licenses file (#16554)
* wip for licenses

* Lots of changes

- bump clojure.data.xml to prevent illegal access
- had to change navigators because of this
- switch to full text of license
- algo is now:
  1. check for a license file in jar
  2. check for an override pointing to a license file locally in
     resources
  3. Check pom file for license information and just use that

can be invoked as:
```bash
% clj -X mb.licenses/process :classpath \"$(cd ../.. && lein classpath)\" :backfill "\"overrides.edn\"" :output-filename "\"backend-licenses.txt\""
License information written to  backend-licenses.txt
/Users/dan/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar  : No license information found.
org.clojars.brenton:google-diff-match-patch  : No license information found.

% wc backend-licenses.txt
   33638  299118 2092948 backend-licenses.txt
```

* xml/parse without the strings

* Add tests

* remove comment form

* namespace comments

* readme

* instructions to create backend license files

* Add version information to the build script

need to either yank it out of the separate project or just use it as a
local root. not sure which

todos: move to s3 once i get access and figure out the proper bucket
       copy to a place so it ends up in the jar
       generate frontend versions as well

* Build frontend and backend license files

put them in the jar at
META-INF/leiningen/metabase-core/metabase-core/license-frontend-third-party
META-INF/leiningen/metabase-core/metabase-core/license-backend-third-party

need to be named ^license.* for lein uberjar to pick them up

* Rename and reformat

* remove old stuff

* combine with a newline

* Tests ensure all jars have an identifiable license

* Extra information if backfill is malformed or missing

* correct name for apache2_0 backfill

* print out classpaths in CI

* print

* see whole classpath. it's empty on ee for some reason

* assert they are there

* Get deps before attempting classpath

for some reason the first one fails. but subsequent re-runs work.

* loop on deps until satisfied

* Include message if cannot satisfy

* include all drivers when getting deps

* rearrange ns docstring

* Hoist functions on pom inside of `with-open` on the input streams

* Update to inversion of pom parsing

* Move to nio from java.io
2021-06-23 16:27:52 -05:00
Alexander Lesnenko
97cc0cf8bf fix map visualization is not suggested with first numeric column (#16706)
* make map visualization sensible for more than 1 column of any type

* actually check if there is at least one metric

* actually check if there is one string in addition to metric
2021-06-23 23:42:58 +03:00
Nemanja Glumac
16b01629c7 Move smoke tests to the CircleCi (#16742)
* Move smoke tests to the CircleCi

Closes #16741.

* Remove smoketest script
2021-06-23 20:59:36 +02:00
Cam Saul
f3847cb8fd 👋 get-id (#16730) 2021-06-23 11:06:14 -07:00
Noah Moss
9e3bccbad5 Check environment variable before db or cache in setting/get-string (#16644) 2021-06-23 13:02:04 -04:00
Ariya Hidayat
c12006e25f Expand the supported filters for coordinate type (#16728) 2021-06-23 09:31:53 -07:00
Ariya Hidayat
fe14063b3f Fix a regression in getting subdimensions (#16707)
* Wait for the SQL query to load `result_metadata`

* Decrease the number of bins to 50

* Update the default bucket for time series

* Remove comment and the issue reference from "column popover" number test

* Unskip "column popover" longitude test

* Enable number binning test via custom question

* Enable longitude tests

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-06-23 08:20:41 -07:00
Nemanja Glumac
d5a2d69165 #16672 Repro: Implicit binning on longitude from SQL question results in error (#16738)
* Add repro for #16672

* Skip the whole `describe` block
2021-06-23 17:07:46 +02:00
Nemanja Glumac
693b2835e5 #16671 Repro: Auto-binning on time series field is different for SQL than it is for QB (#16737) 2021-06-23 16:47:48 +02:00
Nemanja Glumac
3f94179753 #16670 Repro: Auto-binning on number field is different for SQL than it is for QB (#16735) 2021-06-23 16:32:31 +02:00
Nemanja Glumac
7586017469 [Binning e2e coverage] Asserting on the bins from the regular QB table (#16712)
* Add initial binning tests for QB regular table (via simple question)

* Add initial binning tests for QB regular table (via custom question)

* Add initial binning tests for QB regular table (via column popover)
2021-06-23 16:07:01 +02:00
Nemanja Glumac
d1cb2c3376 [Binning e2e coverage] Longitude Correctness (#16630)
* Add initial set of checks for longitude correctness

* Update longitude spec

* Update representative values for "1 degree" bucket size

* Rename function

* Extract x-axis ticks check into a separate function

* Expand and enable all tests
2021-06-23 12:15:56 +02:00
Nemanja Glumac
98ee3ec301 [Binning e2e coverage] Time Series Correctness (#16643)
* Add initial set of checks for time series binning correctness

* Fix selected value for "Year"

* Rename the function

* Extract x-axis ticks check into a separate function

* Extract time series footer check into a separate function

* Expand tests
2021-06-23 12:15:44 +02:00
Gustavo Saiani
545f0734c7 Add marginBottom to SelectPicker (#16716) 2021-06-23 07:04:05 -03:00
Noah Moss
88fd71e0cc Fix admin setup smoke test (#16729) 2021-06-22 20:18:15 -04:00
Noah Moss
956b7215c6 Better error message when logging in as a deactivated user with email or LDAP (#16685) 2021-06-22 18:50:52 -04:00
dpsutton
83f948ff60 Move *ignore-cached-results* to middleware (#16695)
* Move *ignore-cached-results* to middleware

Had tried to adjust the binding to work, but the binding ended before
all of the bound functions and such were submitted to work, so when
that code actually executed the binding was no longer in
place. Annoying and it should be in middleware anyways

* Remove now unused import (cache became keyword in middleware not binding)
2021-06-22 17:28:44 -05:00
Noah Moss
8a851034a9 Clean up styles on password reset button (#16721) 2021-06-22 18:15:40 -04:00
Gustavo Saiani
f3115355da Remove " (ms)" from "Query Runs" label in Enterprise admin section (#16715) 2021-06-22 18:02:35 -03:00
Noah Moss
9587fdbc4e Surface error message during Google login if there's no corresponding MB account (#16719) 2021-06-22 15:29:28 -04:00
Dalton
f61b74a317 Fix "Zoom in" and "View these X" drilldown actions for charts based on custom columns (#16664)
* skip some field logic when dealing with ExpressionDimensions

* hide xray drilldowns when there are expression dimensions

* fix tests by limiting filtering to just expression dimensions

* add a cy test

* update comment

* mild cleanup
2021-06-22 09:37:36 -07:00
Noah Moss
be6efbed41 GeoJSON validation and support for Feature type (#16688) 2021-06-22 11:25:06 -04:00
Anton Kulyk
1a5a69b08d Fix Data Model page blank if database doesn't exist (#16694)
* Add repro for #14652

* Fix blank screen when DB does not exist

DataSelector assumes `schemas` is an array.
But it's `undefined` if db does not exist

* Fix data model page state when DB does not exist

* Move prop-types to the top

* Fix invalid database request
2021-06-22 17:46:33 +03:00
Ariya Hidayat
b92ad6cf17 Do not break waterfall when there is 0 in the series (#16687)
* Do not break waterfall when there is a null
2021-06-21 17:58:34 -07:00
Jeff Bruemmer
3ac6205b6e docs - 0.40 (#16696)
* links and collection checkbox image

* not on card movement

* managing people

* permissions

* auditing question table fields
2021-06-21 12:03:46 -07:00
Nemanja Glumac
138fcd5702 #16693 Repro: Binning from a column popover (distribution) on explicitly joined field renders incorrect title (#16705) 2021-06-21 20:54:26 +02:00
Nemanja Glumac
0ae01e7fe9 #16675 Repro: UI inconsistencies for bucket display on tables from explicitly joined tables (#16703) 2021-06-21 20:07:51 +02:00
Howon Lee
2d6f8208ca Localization also works already without reference to null semantic type, here is test to memorialize this (#16641)
It works, here's a test for it
2021-06-21 10:26:15 -07:00
Noah Moss
46845b721e Restore Google sign-in deactivated account message (#16689) 2021-06-21 12:39:37 -04:00
Howon Lee
ae6a0da4e9 FK table search on data model admin screen (#16632)
Previous behavior searched only on columns backend name. This one searches on column frontend name (field name), table name, schema name - but not on all of them at once, just each of them separately
2021-06-21 09:35:43 -07:00
Nemanja Glumac
9680cf98bb #16674 Repro: UI inconsistencies for bucket display on tables from implicitly joined tables (#16698) 2021-06-21 18:34:53 +02:00
Nemanja Glumac
90cd9a7295 [Binning e2e coverage] Asserting on the saved QB question with explicit joins (#16661)
* Add initial binning tests for saved QB question with explicit joins (via simple question)

* Add initial binning tests for saved QB question with explicit joins (via custom question)

* Add initial binning tests for saved QB question with explicit joins (via column popover)

* Update base question query

* Update tests for simple question mode

* Update tests for custom question mode

* Update tests for the column popover entry mode

* Fix comments
2021-06-21 17:03:38 +02:00
Nemanja Glumac
d353fa92de [Binning e2e coverage] Asserting on the bins from the saved QB question using implicit joins (#16662)
* Add initial binning tests for saved QB question using implicit joins (via simple question)

* Update tests for simple quesiton mode

* Add initial binning tests for saved QB question using implicit joins (via custom question)
2021-06-21 13:27:03 +02:00
Gustavo Saiani
fcb1c7a74d Move block of code about getting input placeholder out of render function in FieldValuesWidget component (#16686) 2021-06-21 07:03:20 -03:00
Alexander Lesnenko
6c8c6fe862 support date ranges for click behavior that updates dashboard filter parameters (#16682)
* support date ranges for click behavior that updates dashboard filter parameters

* fix spec

* reorganize tests
2021-06-20 15:51:48 +03:00
Alexander Lesnenko
c3dbafe03c unskip and fix repro (#16684) 2021-06-19 10:38:59 +03:00
Dalton
d7c1b79f1c wait for schemas/tables to load before running permissions grid logic (#16677)
* wait for schemas/tables to load before running permissions grid logic

* don't return grid when given schema's tables are unavailable
2021-06-18 14:33:48 -07:00
Alexander Lesnenko
b81d75e039 fix inability to change series settings when its title is an empty string (#16602) 2021-06-18 23:59:36 +03:00
Noah Moss
a3e3a83aca Show login history tab for LDAP/Google auth logins (#16676) 2021-06-18 11:33:47 -07:00
Gustavo Saiani
afae40b633 Restore admin Tasks pagination (#16678) 2021-06-18 15:26:45 -03:00
Alexander Lesnenko
0ab9364fe8 adjust row bar chart appearance (#16657) 2021-06-18 21:18:48 +03:00
Howon Lee
5156d881f6 Fix issue with the collections appearing in the list page (#16562)
I thought the collections appearing in the list page problem was solved, but this turned out to be a bug with the ttest. Upon actual inspection the lists remained.

To fix this without changing all sorts of crap that depended upon collections api contract (we futzed with the output but the futzing of the output is transparent to the frontend because of the entity thing they got going on), needed a way to elicit null response from collections endpoint. shoved one in. then renamed it because the first name, "dummy", makes it all sound kind of jank, so 'no-model' for explicitly asking for no model without handing in an empty set, which turns into the set of all models.

This is an 80% unjankening. Full unjankening would entail whacking this special case.
2021-06-18 11:10:39 -07:00
Ariya Hidayat
1006c3a63b Simple question summary sidebar: highlight the selected binning (#16665)
This mimics the situation in the notebook (custom question). A minor
difference, hence the omission of the previous implementation, is that
notebook breakout selection only allows one table at a time (the other
tables are "folded" in the accordion list component). In the case of a
simple question, every breakout selection happens in a sidebar, a long
list of all tables and all dimensions. Thus, it needs to support
multiple selection at once, which this commit finally implements.
2021-06-18 10:32:40 -07:00
Anton Kulyk
8827471755 Fix can't share dashboard containing only text cards (#16586)
* Test can't share dashboard without cards

* Fix can't share dashboard with markdown cards only

* Fix public dashboard crash while loading

* Remove duplicated test

* Add `aria-disabled` prop to Triggerable

* Subscribe to dashboards only if it has data cards
2021-06-18 18:40:31 +03:00
Anton Kulyk
fd9d28168d Fix can't unarchive question without data access (#16590)
* Fix can't unarchive question without data access

* Test API checks perms when unarchiving a card
2021-06-18 17:16:29 +03:00
Nemanja Glumac
3a69422d5c [Binning e2e coverage] Asserting on the saved SQL question (#16660)
* Add initial binning tests for saved SQL (via simple question)

* Add more binning tests for saved SQL (via custom question)

* Add more binning tests for saved SQL (via column popover)

* Simplify the query

* Update visualization for custom question, time series

* Update comments with the references to the created issues
2021-06-18 15:52:54 +02:00
Alexander Lesnenko
0aff59131a Fix funnel appearance (#16626)
* Fix funnel appearance

* fix wide funnels get trimmed
2021-06-18 15:28:38 +03:00
Anton Kulyk
04449c2d3a Fix questions used in SQL query aren't linked correctly from variables sidebar (#16651)
* Fix incorrect question variable links

* Extract method building question URL
2021-06-18 14:30:31 +03:00
Anton Kulyk
608cab0806 Hide permission controls for personal collection's sub-collections (#16668)
* Unskip the repro

* Add `isPersonalCollectionChild` utility

* Hide permission control for personal collections

* Hide permissions modal for personal collections

* Handle missing `collection.effective_ancestors`

* Use `sidebar` cypress selector
2021-06-18 14:29:19 +03:00
Ariya Hidayat
d81424ebbd Do not let boolean literals break standard filter (#16655) 2021-06-17 16:46:12 -07:00
Noah Moss
fb9625980e Hit new API for reading GeoJSON data in custom map settings form (#16610) 2021-06-17 14:13:02 -07:00
Alexander Lesnenko
1593806768 fix trend visualization is not visible if the first column is not date (#16638)
* fix trend visualization is not visible if the first column is not date

* skip repro

* review fix
2021-06-17 23:18:13 +03:00
Dalton
f30d0df3fb don't apply parameter filters to object queries (#16637)
* don't apply parameter filters to object queries

* unskip #8055 repro as well
2021-06-17 11:33:36 -07:00
Noah Moss
d556a3fe4d New endpoint for fetching geojson from URL (#16607) 2021-06-17 11:08:35 -07:00
Alexander Lesnenko
5eded8846a Audit questions BugBash fixes (#16545)
* add units to new columns, add hover state for column headers

* fixup! add units to new columns, add hover state for column headers

* hide loader when filtering or sorting audit table

* fix tests
2021-06-17 20:00:55 +03:00
dpsutton
6b869c4b84 Fix misspelling and duplication in h2 unix timestamp conversions (#16631)
No tests caught this because of compounding errors on top of a generic
solution that already worked:

for h2, defined unix-timestamp->honeysql on [:h2 :millisecond] but
:millisecond is not a valid dispatch key, it is always
milliseconds (plural). And it was duplicated forgetting to use
:microseconds.

But this all worked because there are defaults in the
sql/query_processor

```clojure
(defmethod unix-timestamp->honeysql [:sql :milliseconds]
  [driver _ expr]
  (unix-timestamp->honeysql driver :seconds (hx// expr 1000)))

(defmethod unix-timestamp->honeysql [:sql :microseconds]
  [driver _ expr]
  (unix-timestamp->honeysql driver :seconds (hx// expr 1000000)))

```

so h2 was always using these fallbacks with the division:

```sql
"SELECT \"PUBLIC\".\"INCIDENTS\".\"ID\" AS \"ID\",
        \"PUBLIC\".\"INCIDENTS\".\"SEVERITY\" AS \"SEVERITY\",
        timestampadd('second', (\"PUBLIC\".\"INCIDENTS\".\"TIMESTAMP\"/1000000),--note division
                     timestamp '1970-01-01T00:00:00Z') AS \"TIMESTAMP\"
 FROM \"PUBLIC\".\"INCIDENTS\" LIMIT 1048575"
 ```

rather than the h2 optimized form:

```sql
"SELECT \"PUBLIC\".\"INCIDENTS\".\"ID\" AS \"ID\",
        \"PUBLIC\".\"INCIDENTS\".\"SEVERITY\" AS \"SEVERITY\",
        timestampadd('microsecond', --note microseconds
                     \"PUBLIC\".\"INCIDENTS\".\"TIMESTAMP\",
                     timestamp '1970-01-01T00:00:00Z') AS
                     \"TIMESTAMP\"
FROM \"PUBLIC\".\"INCIDENTS\" LIMIT 1048575"
```

The end result is that the defmethods were never called and the
default was used. So a bug, but not one that was visible. Good catch
jeff
2021-06-17 09:31:33 -05:00
Cam Saul
e253d10c91 Merge pull request #16648 from metabase/merge-39.4-into-master
Merge `39.4` into `master`
2021-06-16 20:21:26 -07:00
Ariya Hidayat
7b8af22153 Data picker search: do not complain on empty string (#16642) 2021-06-16 18:51:05 -07:00
Noah Moss
ffafbf525b post merge fix 2021-06-16 17:33:26 -07:00
Dalton
be41030259 expose error in UI when database GET fails (#16645) 2021-06-16 17:04:05 -07:00
Nemanja
51199d0f7c Merge branch 'release-x.39.x' into merge-39.4-into-master 2021-06-17 01:47:30 +02:00
Cam Saul
0665fe2936 Merge pull request #16647 from metabase/merge-39-including-ae6e9d9
Merge `release-x.39.x` including ae6e9d9 without squash merging
2021-06-16 16:25:58 -07:00
Nemanja
f6c388f0ee Merge commit 'ae6e9d9' into merge-39-including-ae6e9d9 2021-06-17 01:08:01 +02:00
Nemanja Glumac
8ae7d8f216 #16379 Repro: Selecting bin count on intermediate data question fails (#16633)
* Move test inside a describe block

* Add repros for #16379
2021-06-16 23:06:17 +02:00
Gustavo Saiani
2567b5c71a Pass along redirect URL search parameter in Google auth to email/password form (#16634) 2021-06-16 16:56:45 -03:00
Howon Lee
89d1b96f62 Hour of day was fixed 0.39 but test enabled here (#14124) (#16636) 2021-06-16 12:27:12 -07:00
Gustavo Saiani
f7da048421 Show email/password login errors when SSO is active (#16593) 2021-06-16 15:52:56 -03:00
Alexander Lesnenko
d65533abe6 Keep click behavior when reset settings (#16600)
* keep click_behavior settings when reset cards settings

* unskip repro

* review fix
2021-06-16 20:58:25 +03:00
Ariya Hidayat
14c6dbd5d9 Exclude non-standard filter from being propagated to the view header (#16614) 2021-06-16 10:42:26 -07:00
Nemanja Glumac
2435827e13 Group existing binning repros together (#16629) 2021-06-16 19:09:32 +02:00
Nemanja Glumac
3fdf9da06f #11503 Repros: Filters from dashboard not used in question (#16627) 2021-06-16 19:08:38 +02:00
Dalton
ec33a15dc3 Fix drilldown on multi-series chart (#16608)
* add seriesIndex back to clicked object

* use transformed series when handled viz click

* unskip repro for related issue

* add additional test for this bug
2021-06-16 09:57:30 -07:00
Dalton
b88f8e63f7 use is-null filter when value is null (#16601) 2021-06-16 09:09:20 -07:00
Anton Kulyk
cd33b54ad2 Add repro for #16617 (#16618) 2021-06-16 19:01:29 +03:00
Jeff Evans
b0746b4039 Typo in connection pool diagnostic JSON download (#16599)
Fix typo in DS name for app DB

Add test assertion
2021-06-16 10:37:36 -05:00
Nemanja Glumac
af704d35eb [Binning e2e coverage] Binning options (#16622)
* Add new 'binning' e2e group to the CI

* Add initial set of tests for the binning options (buckets)
2021-06-16 17:19:00 +02:00
Alexander Lesnenko
68a29a575c fix inability to use hidden columns for click behavior (#16589) 2021-06-16 18:17:51 +03:00
Dalton
bf99dd58f4 stop hiding broken dashboard parameters so that they are removable (#16582)
* stop hiding broken params

* Refactor and unskip the repro for #15279 (#16592)

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2021-06-16 07:58:47 -07:00
Dalton
70ca874630 refetch card on qb/RELOAD_CARD action (#16571)
* refetch card on RELOAD_CARD action

* fetch via question entity to update cache

* unskip & fix cy test
2021-06-16 07:58:32 -07:00
Gustavo Saiani
efa657a4eb Add propTypes to LoginApp component (#16595) 2021-06-16 11:19:03 -03:00
dpsutton
0574766ee3 Extract largish sort-order function (#16577)
* Extract largish sort-order function

also, running tests locally could run into timezone issues. only
interested in comparisons (<) so just make sure that its 24 hours in
the past so no issues with time zones

* tests are pretty literal but just satisfying the test checker

* bump coverage from 71 to hopefully 75%
2021-06-16 08:48:13 -05:00
Nemanja Glumac
0e5230ea0f #16555 Repro: Collections appear in items list for user with revoked access to collections (#16624)
* Add repro for #16555

* Extract common logic into variables

* Update the assertion
2021-06-16 15:39:32 +02:00
Nemanja Glumac
345c5429d0 Fix flake in repro for #14114 (#16623) 2021-06-16 14:04:10 +02:00
Nemanja Glumac
a980d3f146 Fix broken smoke test (#16620) 2021-06-16 12:56:16 +02:00
Gustavo Saiani
12491d7ca0 Add propTypes to PasswordResetApp component (#16597) 2021-06-16 06:35:37 -03:00
Gustavo Saiani
2826188079 Add propTypes to LogoutApp component (#16596) 2021-06-16 06:34:48 -03:00
Dalton
df02ca999b exclude parameters from isDirty check to avoid unnecessarily showing the "Save" button (#16579)
* exclude parameters from isDirty check

* prevent calling methods on null originalQuestion

* rmv Save reliance in e2e test

* code refactor

* unskip repro

* rmv #520 workaround test because bug is fixed

* revert to previous sandbox.cy.spec.js

* skip workaround test

* add explanatory comment
2021-06-15 17:33:48 -07:00
Noah Moss
e24be66a0a Bump up REPL timeout by a minute (#16604) 2021-06-15 14:39:26 -07:00
dpsutton
0f5de39bf5 Don't compute only on non-zero scores (#16598)
* Don't compute only on non-zero scores

I was removing a helper function when refactoring the scoring. That
had a filter on :score?. I'm not sure why i translated this to only
interpret the denominator of scoring to only include scores that were
positive. This is obviously wrong.

Also, previously, all databases would be returned in the archived
query which seems obviously wrong. Databases cannot be archived and so
should never appear when searching for archived items.

* Add some tests

- had been asserting that ee-score = os-score if not in an official
collection. This is actually hard to do under the current scheme, and
actually not important. The important bit is that the relative
ordering is the same. It had been adding 0 score 2 weight previously,
and removing all scores with a score of 0. This created a bad way to
score, as something with 1/2, 0/3, 0/4, 0/10 (net score 1/2=0.5) would
appear higher than something with 1/2, 1/3, 1/4, 3/10 (net score
6/19=0.315) and it really shouldn't. The former really should
be (1/19=0.05). And since we are adding in a denominator of
2 (official collection weight) all of the scores are actually smaller,
but that's ok, as they are all proportionately smaller.
2021-06-15 16:18:27 -05:00
Alexander Lesnenko
b08f49a2f4 fix click behavior on pin maps (#16568)
* fix click behavior on pin maps

* fix repro parameterMapping

* allow click behavior on pin maps even without PK
2021-06-15 20:41:16 +03:00
Noah Moss
e5075488a0 Re-throw error in custom map form so that it appears on frontend (#16580) 2021-06-15 09:49:44 -07:00
Alexander Lesnenko
c34dac7aaf fix click behavior on pie charts (#16574) 2021-06-15 19:40:21 +03:00
Alexander Lesnenko
4a44cbbcf2 hide snippets folders from the collections sidebar (#16576)
* hide snippets folders from the collections sidebar

* namespace test thing

Co-authored-by: howon lee <hlee.howon@gmail.com>
2021-06-15 19:35:52 +03:00
Reza Lotun
ffec85fab5 Merge pull request #16572 from metabase/0.40-collections-metadata
Feature | Collection metadata
2021-06-15 08:36:25 -07:00
Gustavo Saiani
0b445306c9 Cherry pick ExpressionEditorTextfield from release branch (#16587) 2021-06-15 12:32:27 -03:00
Nemanja Glumac
5dcb401742 Repros for #12782 and #4995: Problems with the labels when showing only one row in the results (#16585)
* Add repro for #4995

* Add repro for #12782

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-06-15 16:55:59 +02:00
dpsutton
f538050317 Lookup ip address for new login email off thread (#16348)
* Lookup ip address for new login email off thread

* Deref with timeout
2021-06-15 09:43:07 -05:00
Anton Kulyk
c5aa62690e Fix pivot tables don't show stand-alone values on the upper level grouping (#16566) 2021-06-15 15:54:55 +03:00
Gustavo Saiani
c1495cf090 Remove unused code from auth/selectors (#16578) 2021-06-15 09:21:15 -03:00
Anton Kulyk
1de72beb1d Add tests for collections metadata (#16538) 2021-06-15 13:30:12 +02:00
Anton Kulyk
76decc8ae4 Rename Header's showBadge into hasBadge 2021-06-15 13:30:12 +02:00
Anton Kulyk
1310da7845 Fix border radius for circle icon 2021-06-15 13:30:12 +02:00
Anton Kulyk
a5a5cf24a0 Fix UI flash when sorting collection items (#16511)
* Optionaly keep prev list value in EntityListLoader

* Use prop-types in EntityListLoader

* Fix UI flash when sorting collection items

* Fix empty state displayed before items are fetched

* Alias condition statement

* Unify shouldUpdatePrevList condition

* Fix react/display-name

* Rename keepPreviousList —> keepListWhileLoading

* Swap list and previous list internally

* Replace `_.isEqual` check with plain `!==`
2021-06-15 13:30:12 +02:00
dpsutton
2c948c7232 Order by _revision_ id, not _user_ id (#16536) 2021-06-15 13:30:12 +02:00
Anton Kulyk
b454510c57 Add sorting to collection items (#16385)
* Add sorting params to Search entity

* Remove pinned items sorting by `collection_position`

* Add default sorting to collection items

* Add sorting controls

* Add test IDs to table head and columns

* Move pagination tests into separate file

* Make pagination tests independent from dataset

* Allow creating pinned items via API in Cypress

* Add sorting E2E tests

* Fix sorting by "Last edited at" column

* Add sorting by "Last edited by" column

* Fix BaseItemsTable unit test
2021-06-15 13:30:05 +02:00
Anton Kulyk
e2a765fc80 Add tooltip displaying the exact time of the last collection item edit (#16492) 2021-06-15 13:26:00 +02:00
dpsutton
a80ac9073a Fix last edit query (#16520)
* Correct query for last edits

* tests ensure we get latest revisions
2021-06-15 13:26:00 +02:00
Anton Kulyk
a9586b23e2 Add drag-n-drop to collection items tables (#16360)
* Don't wrap ItemDragSource children with <div />

react-dnd allows wrapping only native DOM elements with DND helpers.

With the new table layout, we now need to drag table rows (td elements).

Rendering a td with ItemDragSource results in invalid HTML as table body's direct children should only include td elements.

* Rename `selected` prop to `selectedItems`

* Pass ItemDragSource props to table item

* Replace styled TableRow with plain <tr />

Table row is wrapped with ItemDragSource, that only accepts native DOM elements as its children

So styled-components can't be used here

* Make table row draggable

* Add headless mode to BaseItemsTable

* Add prop hiding table row's bottom border

* Fix typo and split large comment

* Render full table row when dragging

* Add empty PinnedItemsTable drop area

* Add empty ItemsTable drop area

* Wrap PinnedItemsTable with drop area

* Wrap ItemsTable with drop area

* Extract `<tr />` style

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>

* Fix width style

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>

* Run prettier

* Reference issue about post-pulses work

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
2021-06-15 13:26:00 +02:00
Anton Kulyk
a29727818e Remove "Pinned items" text assertion
The category title is removed in this PR by design
2021-06-15 13:26:00 +02:00
dpsutton
f08bea47d7 Sort by last_edited_by (#16388)
for last edits, now can sort by last_edited_at (previously
last_edited) and last_edited_by
2021-06-15 13:26:00 +02:00
Anton Kulyk
67f41ac653 Switch the collection page to table-based layout, display last edit info (#16357)
* Extract color functions from EntityItem body

* Refactor EntityItem not to use `switch` statement

* Extract `<EntityItem.Icon />` component

* Extract `<EntityItem.Name />` component

* Extract `<EntityItem.Menu />` component

* Add basic table components for collection items

* Update item name style

* Update `last-edit-info` columns text style

* Make CollectionContent wider

* Highlight pinned items

* Add `renderItem` prop to BaseItemsTable

* Add links to table items' entity pages

* Connect `data-metabase-event` to table items

* Make table items selectable for bulk actions

* Remove filtering E2E test

Collection items filtering is going to be replaced with sorting

* Fix cypress collection item selectors

* Fix cypress pinned items assertions

* Add collection item actions menu

* Fix "Type" column style

* Fix layout when there are no pinned items

* Add CollectionContent's empty state

* Fix typo

* Update table row height

* Add table rows separators

* Remove replaced components

* Remove filtering logic from CollectionContent

* Fix pulses display in collection items table

* Remove note about filtering E2E tests

Collection items filtering is going to be replaced with sorting

* Move BaseTableItem into its own file

* Remove redundant conditional render

* Fix col's span attribute

* Don't use `useCallback` for itemRenderer

* Extract ItemsTable's renderItem

* Extract PinnedItemsTable's renderItem

* Fix `EntityItemIcon` margin prop usage

* Remove not used props from `EntityItem`

* Fix string prop notation

* Add IconButtonWrapper component

* Use IconButtonWrapper for EntityItem's icon

* Update BaseTableItem's EntityIcon usage

* Move EntityItemWrapper to .styled file

* Rename `EntityItemIcon` to `EntityIconCheckBox`
2021-06-15 13:25:59 +02:00
Anton Kulyk
4f08c4cdbd Display last edit info in Question and Dashboard headers (#16354)
* Add LastEditInfoLabel component

* Fix Header component's import order

* Display last edit info in Dashboard header

* Display last edit info in Question header

* Show "edited by you" if user is the last editor

* Add prop types for Header component

* Add prop-types for ViewHeader component
2021-06-15 13:25:59 +02:00
Nemanja Glumac
835fba843f Merge release-x.39.x including ae6e9d9 (#16575)
* Cleanup from dump-load-entities-test (#16281)

Updating dump-load-entities-test test so that dump dir is actually deleted at the end

* Revamp Cypress custom commands (#16292)

* Extract UI custom commands

* Extract user related custom commands

* Extract overwrites

* Extract permissions related custom commands

* Extract API custom commands

* Extract helpers custom commands

* Extract database related custom commands

* Rename `helpers` group to `visibility`

* Rename custom command `isInViewport` to `isRenderedWithinViewport`

* Unskip repro for #15119 (#16297)

* Create composite Cypress custom command `cy.createQuestionAndDashboard` (#16294)

* Add composite Cypress custom command `createQuestionAndDashboard`

* Refactor the existing test to use new Cypress custom command

* Refactor repro for #13062 using the new Cypress custom command

* Use the `describe` block instead of using `forEach` for complex repro

* Add space between test cases

* #12629 Repro: Human-readable number formatting not working properly (#16231)

* Fix `nosql` user's email address (#16306)

* Generate correct SQL for columns from joins inside other joins or source queries (#16254)

* Fix joining a join inside a nested queries (#12928)

* Code cleanup & dox

* Tests for #13649

* Test fixes 🔧

* Remove unit tests snapshots (#16321)

* Remove snapshots from `Calendar.unit.spec.js`

* Remove snapshots from `DashCard.unit.spec.js`

* Remove snapshots generated for "internal" components

* Remove unused import

* Remove snapshot related command from `scripts`

* Remove `noSnapshotTest` from internal components

* Remove `react-test-renderer`

* filter nulls out of histograms (#16345)

* #15993 Repro: Click behavior with filter pass-thru does not show filters defined on question (#16342)

* #16334 Repro: Click Behavior targeting a question with filter mapped causes the visualization type to change (#16343)

* Add repro for #16334

* Expand test assertion

* #16327 Repro: Double binning menu for date fields when using Saved Question (Native) (#16359)

* #16322 Repro: "Custom mapping" is only available, when "A list of all values" is set (and after a browser refresh) (#16361)

* #16226 Repro: LDAP/Email settings gets cleared if validation fails (#16364)

* Add repro for #16226

* Extract email settings into a separate file

* Add repro for #16226 (Email)

* switch to column settings when sidebar is already open (#16368)

* align labels on non-bars in combo charts (#16369)

* #16378 Repro: Cannot enable JWT authentication (#16384)

* Fix JS error on JWT settings form (#16394)

* fix default updateSettings function in SettingsBatchForm

* unskip repro

* #12128 Repro: Can't change label on empty row value (#16426)

* Post-merge fix

* Post-merge fix 2
I didn't solve this merge conflict properly in the original merge.

Co-authored-by: Jeff Evans <jeff303@users.noreply.github.com>
Co-authored-by: Cam Saul <1455846+camsaul@users.noreply.github.com>
Co-authored-by: Paul Rosenzweig <paulrosenzweig@users.noreply.github.com>
Co-authored-by: Noah Moss <32746338+noahmoss@users.noreply.github.com>
2021-06-15 13:17:57 +02:00
Anton Kulyk
bd40d2e15e Revert "Feature | Collection Metadata (#16510)" (#16570)
This reverts commit 82757d60b9.
2021-06-14 21:54:09 +03:00
Anton Kulyk
82757d60b9 Feature | Collection Metadata (#16510)
* Display last edit info in Question and Dashboard headers (#16354)

* Add LastEditInfoLabel component

* Fix Header component's import order

* Display last edit info in Dashboard header

* Display last edit info in Question header

* Show "edited by you" if user is the last editor

* Add prop types for Header component

* Add prop-types for ViewHeader component

* Switch the collection page to table-based layout, display last edit info (#16357)

* Extract color functions from EntityItem body

* Refactor EntityItem not to use `switch` statement

* Extract `<EntityItem.Icon />` component

* Extract `<EntityItem.Name />` component

* Extract `<EntityItem.Menu />` component

* Add basic table components for collection items

* Update item name style

* Update `last-edit-info` columns text style

* Make CollectionContent wider

* Highlight pinned items

* Add `renderItem` prop to BaseItemsTable

* Add links to table items' entity pages

* Connect `data-metabase-event` to table items

* Make table items selectable for bulk actions

* Remove filtering E2E test

Collection items filtering is going to be replaced with sorting

* Fix cypress collection item selectors

* Fix cypress pinned items assertions

* Add collection item actions menu

* Fix "Type" column style

* Fix layout when there are no pinned items

* Add CollectionContent's empty state

* Fix typo

* Update table row height

* Add table rows separators

* Remove replaced components

* Remove filtering logic from CollectionContent

* Fix pulses display in collection items table

* Remove note about filtering E2E tests

Collection items filtering is going to be replaced with sorting

* Move BaseTableItem into its own file

* Remove redundant conditional render

* Fix col's span attribute

* Don't use `useCallback` for itemRenderer

* Extract ItemsTable's renderItem

* Extract PinnedItemsTable's renderItem

* Fix `EntityItemIcon` margin prop usage

* Remove not used props from `EntityItem`

* Fix string prop notation

* Add IconButtonWrapper component

* Use IconButtonWrapper for EntityItem's icon

* Update BaseTableItem's EntityIcon usage

* Move EntityItemWrapper to .styled file

* Rename `EntityItemIcon` to `EntityIconCheckBox`

* Sort by last_edited_by (#16388)

for last edits, now can sort by last_edited_at (previously
last_edited) and last_edited_by

* Remove "Pinned items" text assertion

The category title is removed in this PR by design

* Add drag-n-drop to collection items tables (#16360)

* Don't wrap ItemDragSource children with <div />

react-dnd allows wrapping only native DOM elements with DND helpers.

With the new table layout, we now need to drag table rows (td elements).

Rendering a td with ItemDragSource results in invalid HTML as table body's direct children should only include td elements.

* Rename `selected` prop to `selectedItems`

* Pass ItemDragSource props to table item

* Replace styled TableRow with plain <tr />

Table row is wrapped with ItemDragSource, that only accepts native DOM elements as its children

So styled-components can't be used here

* Make table row draggable

* Add headless mode to BaseItemsTable

* Add prop hiding table row's bottom border

* Fix typo and split large comment

* Render full table row when dragging

* Add empty PinnedItemsTable drop area

* Add empty ItemsTable drop area

* Wrap PinnedItemsTable with drop area

* Wrap ItemsTable with drop area

* Extract `<tr />` style

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>

* Fix width style

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>

* Run prettier

* Reference issue about post-pulses work

Co-authored-by: Gustavo Saiani <gustavo@poe.ma>

* Fix last edit query (#16520)

* Correct query for last edits

* tests ensure we get latest revisions

* Add tooltip displaying the exact time of the last collection item edit (#16492)

* Add sorting to collection items (#16385)

* Add sorting params to Search entity

* Remove pinned items sorting by `collection_position`

* Add default sorting to collection items

* Add sorting controls

* Add test IDs to table head and columns

* Move pagination tests into separate file

* Make pagination tests independent from dataset

* Allow creating pinned items via API in Cypress

* Add sorting E2E tests

* Fix sorting by "Last edited at" column

* Add sorting by "Last edited by" column

* Fix BaseItemsTable unit test

* Order by _revision_ id, not _user_ id (#16536)

* Fix UI flash when sorting collection items (#16511)

* Optionaly keep prev list value in EntityListLoader

* Use prop-types in EntityListLoader

* Fix UI flash when sorting collection items

* Fix empty state displayed before items are fetched

* Alias condition statement

* Unify shouldUpdatePrevList condition

* Fix react/display-name

* Rename keepPreviousList —> keepListWhileLoading

* Swap list and previous list internally

* Replace `_.isEqual` check with plain `!==`

* Fix border radius for circle icon

* Rename Header's `showBadge` into `hasBadge`

* Add tests for collections metadata (#16538)

Co-authored-by: dpsutton <dan@dpsutton.com>
Co-authored-by: Gustavo Saiani <gustavo@poe.ma>
2021-06-14 21:08:51 +03:00
Nemanja Glumac
ea8f76aca7 #16386 Repro: Filtering on boolean=true column causes blank screen or "Something went wrong" (#16495)
* Add repros for #16386

* Update the test to include filtering on the "false" column
2021-06-14 16:15:06 +02:00
Noah Moss
6a8546138b Fix typo in lint-config (#16561) 2021-06-11 21:05:14 -07:00
Noah Moss
31d6e648ad Support multiple domains for Google Auth in EE (#16549) 2021-06-11 16:53:16 -07:00
Cam Saul
c074318b22 more dox updates [ci skip] 2021-06-11 15:55:19 -07:00
Cam Saul
8facda45a8 Clarify Mac App build steps 2021-06-11 15:49:44 -07:00
Cam Saul
0a120324ef Don't need to download uberjar yourself anymore [ci skip] 2021-06-11 15:48:17 -07:00
Gustavo Saiani
0c690cc4fe Fix Popover proptypes (#16560) 2021-06-11 16:41:02 -03:00
Gustavo Saiani
e2e6abdc4a Add propTypes to QuestionEmbedWidget (#16557) 2021-06-11 15:08:21 -03:00
Cam Saul
02686bbc46 MBQL: allow case statements inside arithmetic operators (#15126)
* MBQL: support case statements inside arithmetic operators (#15107)

* SQLite test fix 🔧

* More test fixes 🔧

* Another test fix

* Presto test fix
2021-06-11 10:51:53 -07:00
Gustavo Saiani
9a8894d894 Add tooltip to question share icon (#16556) 2021-06-11 14:37:05 -03:00
Howon Lee
f74203a546 Compacted scalars over different widths (#16528)
Compaction of scalars was previously dependent upon the card width alone. Now it also depends upon the number of digits in the scalar.
2021-06-11 10:05:35 -07:00
Nemanja Glumac
360668ac87 Replace real TLDs with .test in frontend tests (#16552)
* Update default users' emails

* Update email addresses in e2e tests

* Update email addresses in unit tests

* Fix smoke test
2021-06-11 12:06:49 +02:00
Nemanja Glumac
dd5d5ee396 Unskip repro for #15695 (#16551) 2021-06-11 10:54:18 +02:00
Cam Saul
b85840d2b4 Dashboard param values endpoints should return 1000 results max (up from 100) (#16546) 2021-06-10 23:01:53 -07:00
Noah Moss
815fcb3c80 Allow LDAP logins even if givenName or sn attributes are missing (#16139) 2021-06-10 18:24:47 -07:00
Gustavo Saiani
65e76a39fa Close Custom Expression Helper after blurring (#16541) 2021-06-10 18:21:42 -03:00
Howon Lee
bfafbb33e3 Capitalize only first letter, don't mess with existing caps for unfriendly field name (#16539)
If you put in fooBarID, previous behavior on `simple` was to change to Foobarid. New behavior is to keep the caps on non-initial letters, turning it into FooBarID. So camelCaps turns into PascalCaps. ALLCAPS is Titlecapsed, tho.
2021-06-10 12:36:28 -07:00
Noah Moss
311f50bf0a Move Google auth code into separate namespace (#16530) 2021-06-10 12:06:31 -07:00
Nemanja Glumac
a4bcdb20c0 Fix and unskip repro for #8333 (#16537) 2021-06-10 18:28:13 +02:00
Ariya Hidayat
186619bbf3 Fix missing time series footer (#16478)
* Ensure a proper local field reference for time series footer

* Fix the filter search by doing a proper MBQL comparison on the field
2021-06-10 07:55:46 -07:00
Nemanja Glumac
87fd840830 Unskip repro for #13751 (#16535)
Fixed by the work done in #15952.
2021-06-10 16:11:42 +02:00
Noah Moss
a4878a1e68 Allow custom filters for LDAP group search (#16240) 2021-06-09 17:22:39 -07:00
Cam Saul
2a7fefc4a6 Merge x.39.3 -> master (#16477)
Merge x.39.3 -> master
2021-06-09 16:03:55 -07:00
Nemanja Glumac
6d63fb26fa #16498 Repro: Should be possible to drag items to the root collection (#16525) 2021-06-09 23:40:53 +02:00
Alexander Lesnenko
94ad50b3e7 add husky with precommit hook for linting FE code (#16515) 2021-06-09 23:37:06 +03:00
Jeff Evans
e97bb2a153 Point CircleCI to 0.186 version of Presto CI image (#16527) 2021-06-09 14:56:05 -05:00
Jeff Evans
d1f62c922e Presto test fixes (#16524)
Point CircleCI presto test to the tagged older version (0.186)
2021-06-09 14:42:45 -05:00
Noah Moss
c80b5bab7a Refactor Google sign-in settings page to use Form component (#16506) 2021-06-09 10:43:54 -07:00
Anton Kulyk
22fd86f46c Move items to root collection via drag-n-drop (#16502) 2021-06-09 18:10:29 +03:00
Alexander Lesnenko
7b6c8276be add a spec for checking values render on combo chart (#16513) 2021-06-09 15:59:45 +03:00
Nemanja Glumac
3d82064e4a #16181 Repro: Dashboard Contains filter doesn't apply when clicking on Question title (#16503) 2021-06-09 14:54:59 +02:00
Anton Kulyk
798478976b Fix can't archive a question from the Question page (#16514)
* Fix question archiving test

* Fix archiving a question

* Add repro note for #16512
2021-06-09 15:31:13 +03:00
Anton Kulyk
4b6233873a Fix bulk archive broken (#16500)
* Add repro for #16496 (bulk archive broken)

* Add E2E test for bulk move

* Fix bulk archive

* Remove reduntant checks

* Use `cy.button()`

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-06-09 13:07:24 +03:00
Alexander Lesnenko
738afe07c1 fix missing value labels on timeseries for combo charts (#16488) 2021-06-09 12:55:43 +03:00
Anton Kulyk
130f73f292 Fix can't "Select All" collection items if all items are pinned (#16501)
* Add repro for #16497 (pinned items bulk selection)

* Fix pinned items bulk selection

* Remove redundant check

* Refactor existing "bulk actions" tests

* Extract test that is not related to bulk actions

* Add `pinAllRootItems()` helper function

* Unify "bulk selection" tests

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-06-09 11:04:34 +02:00
Cam Saul
c80be55d7f Add helpers to define Settings with multiple impls (#16365)
* Add helpers to define Settings with multiple impls

* Add docstrings

* Fix missing :require

* Add namespace docstring per @dpsutton suggestion
2021-06-08 19:27:12 -07:00
Howon Lee
c00ffb45d3 Friendly names bugfix 2 (#16482)
Friendly names bugfix 1 was a noop because of a typo in the WHERE clause of the DB migration. This one has been manually tested to go and sync on all 4 supported MB db's.
2021-06-08 18:28:53 -07:00
Cam Saul
7cdbc59a6f Post-merge fix 🔧 2021-06-08 16:18:08 -07:00
Noah Moss
d19be7f597 Ignore unmapped groups during SSO group syncs (#16314)
* changes to sync-group-memberships! and unit tests

* update jwt and saml code

* fix admin sync tests

* fix misplaced docstrings

* address review comment
2021-06-08 14:22:19 -07:00
Cam Saul
a685affdcb Fix #16299 MongoDB empty results when filtering against array (#16480)
* Fix #16299 MongoDB empty results when filtering against array

* Ok, we still need to use $expr if the VALUE in the expression isn't simple

* More test fixes 🔧

* More fixes 🔧
2021-06-08 13:39:09 -07:00
dpsutton
d243369638 Pass UTF8 as a literal into grouping by a bytes->temporal column (#16336)
Repro:
db setup:

```sql
create table wut2 (t bytea, ts text);
insert into wut2 (t, ts) values ('20210421164300'::bytea, '20210421164300');
```

Mark t as :Coercion/YYYYMMDDHHMMSSBytes->Temporal, ts as
:Coercion/YYYYMMDDHHMMSSString->Temporal

Do a simple query, and then aggregate count by the two dates. ts
should succeed and t fails.

We are passing in the UTF8 as a parameter rather than just emitting a
literal.

Before:

```clojure
{:sql
 "-- Metabase\nSELECT CAST(to_timestamp(convert_from(\"public\".\"wut\".\"t\", ?), 'YYYYMMDDHH24MISS') AS date) AS \"t\", count(*) AS \"count\" FROM \"public\".\"wut\" GROUP BY CAST(to_timestamp(convert_from(\"public\".\"wut\".\"t\", ?), 'YYYYMMDDHH24MISS') AS date) ORDER BY CAST(to_timestamp(convert_from(\"public\".\"wut\".\"t\", ?), 'YYYYMMDDHH24MISS') AS date) ASC",
 :params ("UTF8" "UTF8" "UTF8"),
 :type :invalid-query}
```

After:

```sql
SELECT CAST(to_timestamp(convert_from(\"public\".\"wut\".\"t\", 'UTF8'), 'YYYYMMDDHH24MISS') AS date) AS \"t\",
       count(*) AS \"count\" FROM \"public\".\"wut\"
GROUP BY CAST(to_timestamp(convert_from(\"public\".\"wut\".\"t\", 'UTF8'), 'YYYYMMDDHH24MISS') AS date)
ORDER BY CAST(to_timestamp(convert_from(\"public\".\"wut\".\"t\", 'UTF8'), 'YYYYMMDDHH24MISS') AS date) ASC
```

Note there's a lot of extra casting that perhaps we can clean up
2021-06-08 13:56:53 -05:00
Gustavo Saiani
394034aa32 Update criterion for checking language in onboarding setup e2e test (#16493) 2021-06-08 15:49:58 -03:00
Noah Moss
edb896f96d Fix broken LDAP group lookups for Active Directory (#16331)
* adapt ldap test helpers to be able to test AD memberOf attribute

* fix ldap search to handle memberOf attributes with a single group

* use one-or-many instead of if statement

* fix tests
2021-06-08 11:16:59 -07:00
Howon Lee
eb89b7669d Detect if file is blank or bad for SQLite DB connection (#16372)
Previously just used JDBC. However, JDBC will merrily execute queries on empty file locations for SQLite, because it'll create a new SQLite file. This one checks that there exists a SQLite file already to be querying in the first place
2021-06-08 10:38:00 -07:00
Howon Lee
6cad34731e DB Pagination Backend 11806 (#16346)
Folks wanted DB pagination in #11806 and apparently others but it didn't make it to notion. Well, it made it to my attention, anyhow, and here is some DB pagination, but just for the backend.
2021-06-08 10:28:54 -07:00
Nemanja
68c8a19875 Fix test with old syntax 2021-06-08 14:52:37 +02:00
Nemanja
9da8e0e35f Merge branch 'master' into merge-x.39.3 2021-06-08 14:37:47 +02:00
Noah Moss
bbd4f63522 Adjust CSP header to make React Dev Tools work on Firefox (#16375)
* adjustments to CSP header in dev environment to make react dev tools work on Firefox

* add test for script-src directive

* fix position of doc string

* fix error in common_test
2021-06-07 13:49:30 -07:00
Howon Lee
72455c368e Migrate friendly names (#16330)
There was no DB migration for previous friendly field name defriendlification. This adds DB migration.
2021-06-07 12:31:56 -07:00
Nemanja Glumac
a9025e0078 Unskip merged repros (#16390) 2021-06-07 21:29:49 +02:00
Nemanja Glumac
ae6e9d9f91 #12128 Repro: Can't change label on empty row value (#16426) 2021-06-07 21:16:28 +02:00
Noah Moss
2a67d44899 Fix JS error on JWT settings form (#16394)
* fix default updateSettings function in SettingsBatchForm

* unskip repro
2021-06-07 11:28:11 -07:00
Reza Lotun
7f9bab2f9d Update feature/project epic issue template
Signify this is for internal use for the Metabase team, and remove ETA from the template (since that's tracked outside of GitHub).
2021-06-07 10:00:17 -07:00
Alexander Lesnenko
e736e6b295 add missing prop-types to question audit (#16383) 2021-06-07 16:01:18 +03:00
Nemanja Glumac
6ff0cb7989 #16378 Repro: Cannot enable JWT authentication (#16384) 2021-06-07 13:57:20 +02:00
Paul Rosenzweig
a790cd4f82 align labels on non-bars in combo charts (#16369) 2021-06-04 16:15:50 -07:00
Paul Rosenzweig
d8def98dbc switch to column settings when sidebar is already open (#16368) 2021-06-04 16:15:42 -07:00
Nemanja Glumac
70c61213bd #16226 Repro: LDAP/Email settings gets cleared if validation fails (#16364)
* Add repro for #16226

* Extract email settings into a separate file

* Add repro for #16226 (Email)
2021-06-05 01:01:30 +02:00
Jeff Bruemmer
90f4fc94ab fix hash link (#16367) 2021-06-04 13:43:09 -07:00
Nemanja Glumac
2908d73150 #16322 Repro: "Custom mapping" is only available, when "A list of all values" is set (and after a browser refresh) (#16361) 2021-06-04 18:23:08 +02:00
Nemanja Glumac
9404edb689 #16327 Repro: Double binning menu for date fields when using Saved Question (Native) (#16359) 2021-06-04 18:12:24 +02:00
Nemanja Glumac
0d0122d774 #16334 Repro: Click Behavior targeting a question with filter mapped causes the visualization type to change (#16343)
* Add repro for #16334

* Expand test assertion
2021-06-04 17:10:35 +02:00
Nemanja Glumac
21d532e8f3 #15993 Repro: Click behavior with filter pass-thru does not show filters defined on question (#16342) 2021-06-04 16:34:16 +02:00
Nemanja Glumac
571c855b78 #16350 Repro: "Invite someone" button overlaps activate/deactivate radio buttons on small screen widths (#16355) 2021-06-04 16:31:07 +02:00
Paul Rosenzweig
70a795e130 filter nulls out of histograms (#16345) 2021-06-04 08:14:17 -04:00
Noah Moss
dd7e12a1d6 prevent sending password reset email when LDAP is active (#16349) 2021-06-03 17:22:16 -07:00
Howon Lee
e8378db372 Audit optimization for questions (#16220)
Peeps want to make questions faster, but we don't give the data about query execution in a very user-friendly way. Here's it in a user-friendly way.

Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
2021-06-03 14:51:27 -07:00
dpsutton
8e3b4ad8fb Paginated collection metadata (#16275)
* Add the last-edit-info to the child query

just for cards right now, need to extend to dashboards and then make
sure we clean it up into the proper map.

Have a set of all columns that are required and ensure those are in
each query. Nulls need to be cast to the correct type if they aren't a
text column (at least on postgres, need to investigate h2 and mysql).

* Correct find last-edit-info for cards and dashboards

* Move from group-by max id to self join

* Paginate and search on collection items

- include the metadata information in the query
  - to accomplish this, make a backstop to add all columns into each
    query
  - need types to union the null. in postgres it assumes all nulls are
    text. Haven't checked what mysql and h2 do here yet
- sort_column: name, last_edited, model
- sort_direction: asc, desc

* Add default sort column and direction

* handle mysql

mysql doesn't need types on nulls to unify them

* Correct batch post processing for cards and dashboards

* Correct order of expectations

they were alphabetical inside of models
previous order:
- acme products           | pulse
- electro-magnetic pulse  | pulse
- birthday card           | card
- dine & Dashboard        | dashboard

and is now ordered solely by name

* Tests and sort on lower name after timestamp

When sorting by last edited, lots of things don't have this, so don't
want arbitrary sorting, but sort by name afterwards

* Ensure nulls go to the end of the list

* Tests

* trying to make h2, mysql, and pg happy

sorting timestamps and always having nulls last is quite difficult

* Make diff bigger

this was going in as a string and losing the timezone information, so
was actually advancing time.

Now: (java.time.OffsetDateTime/now)
"2021-06-01T13:59:33.165483Z"

Minus 2 hours: (.minusHours (java.time.OffsetDateTime/now) 2)
"2021-06-01T11:59:27.528500Z"

As seen in the code:
;; unaltered "now"
"2021-06-01T08:55:28"
;; altered "two hours ago"
"2021-06-01T11:55:29" <- UTC shenanigans. so just bump back 24 hours

* Sort by model ranking

* Remove clj-time and use ZonedDateTime instead of OffsetDateTime
2021-06-03 12:24:39 -05:00
Anton Kulyk
5a892e9c42 Fix "Edit collection permissions" btn disappeared (#16339) 2021-06-03 19:40:46 +03:00
Ariya Hidayat
62a955fcac VS Code: bind the default build task (#16325) 2021-06-03 07:04:31 -07:00
Ariya Hidayat
5c4ac148b6 Expand PK/FK filter operators to cover some more comparisons (#16238)
...since the back-end is already capable of handling those.

* Handle PK/FK of the type STRING or STRING_LIKE
2021-06-02 18:08:59 -07:00
Gustavo Saiani
3e4aa7dbe7 Always show Popover footer regardless of Popover inner scroll (#16308) 2021-06-02 19:36:30 -03:00
Luis Paolini
714ad35d3d Warn users about sandboxing and public sharing (#15951)
* Warn users about sandboxing and public sharing

* Update docs/enterprise-guide/data-sandboxes.md

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-06-02 14:55:58 -07:00
dpsutton
ad753b18cd Authority Level on collections (formerly Typed collections) (#16191)
* Add type on collection

* Search with collection type

* Cleanup bounded heap accumulator

* Make search conditionally bump official collection items

* collection api and tests

* Put collection type onto hydrated cards on dashboards

* Move official collection type scoring into ee codebase

* ensure ee and oss agree when not official collection

* Mark Collections tree with type

* Remove unnecessary `and`s when no check for enhancements

* Tests for setting collection tree type

* Include hydration for collection type on dashboards

* Make sure created test collections are cleaned up

* Cleanup tests, don't search on collection_type

looks for all text fields and searches the term against that. official
would bring back all official types. no bueno

* Docstring on protocol and don't shadow comparator

* update to new ee impl var passing style

* Collection model ensures no type change on personal collection

* Check for personal collection when updating type

model checks for personal collection and rejects in the update but
doesn't check for children of personal collection.

* Update checking for unchangeable properties of a personal collection

* Cleanup: type collection tree, batched hydration, combine error checks

* Cleanup

* move bounded-heap accumulator to utils

* switch to test.check testing

* Bad test just to see what our CI will report

* remove purposeful failing test (was for CI)

* collection.type -> collection.authority_level

* Test the actual ee scoring impl, not the wrapped one

locally i had enhancements enabled so the tests were passing, but in
CI it was failing as it did not have enhancements enabled
2021-06-02 12:35:33 -07:00
Nemanja Glumac
671148e76b Remove unit tests snapshots (#16321)
* Remove snapshots from `Calendar.unit.spec.js`

* Remove snapshots from `DashCard.unit.spec.js`

* Remove snapshots generated for "internal" components

* Remove unused import

* Remove snapshot related command from `scripts`

* Remove `noSnapshotTest` from internal components

* Remove `react-test-renderer`
2021-06-02 18:20:29 +02:00
Gustavo Saiani
5f78a90cc6 Add Prop Types to a few Popover components (#16313) 2021-06-02 11:34:55 -03:00
Anton Kulyk
a26f2242a1 Fix incorrect slugs for collections (#16296) 2021-06-02 14:50:10 +03:00
Anton Kulyk
6826b2ad17 Fix database docs card style, add in-out animation (#16302) 2021-06-02 14:48:24 +03:00
Cam Saul
beca114dc0 Generate correct SQL for columns from joins inside other joins or source queries (#16254)
* Fix joining a join inside a nested queries (#12928)

* Code cleanup & dox

* Tests for #13649

* Test fixes 🔧
2021-06-01 11:07:36 -07:00
Nemanja Glumac
3cf82b7378 Fix nosql user's email address (#16306) 2021-06-01 18:07:11 +02:00
Nemanja Glumac
76c2bc275f #12629 Repro: Human-readable number formatting not working properly (#16231) 2021-06-01 17:46:34 +02:00
Nemanja Glumac
c0679f89b9 Create composite Cypress custom command cy.createQuestionAndDashboard (#16294)
* Add composite Cypress custom command `createQuestionAndDashboard`

* Refactor the existing test to use new Cypress custom command

* Refactor repro for #13062 using the new Cypress custom command

* Use the `describe` block instead of using `forEach` for complex repro

* Add space between test cases
2021-06-01 10:44:09 +02:00
Ariya Hidayat
8c95fdaa98 Aggregation query should always specify name (#16259) 2021-06-01 00:06:33 -07:00
Nemanja Glumac
a92db169f4 Unskip repro for #15119 (#16297) 2021-05-31 21:56:27 +02:00
Nemanja Glumac
91d6444393 Revamp Cypress custom commands (#16292)
* Extract UI custom commands

* Extract user related custom commands

* Extract overwrites

* Extract permissions related custom commands

* Extract API custom commands

* Extract helpers custom commands

* Extract database related custom commands

* Rename `helpers` group to `visibility`

* Rename custom command `isInViewport` to `isRenderedWithinViewport`
2021-05-31 16:11:37 +02:00
Alexander Lesnenko
8191050827 fix missing plural form for the total people number (#16278) 2021-05-29 00:54:49 +03:00
Jeff Evans
558299e1a8 Cleanup from dump-load-entities-test (#16281)
Updating dump-load-entities-test test so that dump dir is actually deleted at the end
2021-05-28 12:31:04 -05:00
Nemanja Glumac
2da743d36b #16273 Repro: Relative date filter applied to the custom column doesn't work (#16280) 2021-05-28 18:28:08 +02:00
Luis Paolini
620ab40f0e Upgrade devcontainer to Java 11 (#16276) 2021-05-28 10:56:25 -03:00
Alexander Lesnenko
d2e199a504 Add basic sidebar for adding questions on a dashboard (#16242)
* add useDebounceValue hook

* add AddCardSidebar components

* extract DashboardSidebars component

* use AddCardSidebar component

* remove the old modal for adding questions

* fix specs, unify dashboard toolbar buttons

* fix enterprise specs

* lint

* fix more specs

* maz empty state tweaks

* review

* specs

* add role attributes

* `Add question` => `Add questions`

* add missing onkeydown handler to the QuestionPickerItem

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-05-28 13:54:22 +03:00
Jeff Evans
598a112405 Serialization fixes for x.39 (#15858)
Serialization refactoring and fixes

*********************************************************
* Support loading linked cards in different collections *
*********************************************************

Architectural changes:
Lay foundation for more generic retry mechanism
Establish a keyword to represent a failed name->id lookup that can happen during load, and map that to information about which part of the card resolution failed (for logging purposes)
Similar to dashboards, add a separate fn for performing a load of cards
Invoking the load-cards fn from the load multimethod implementation when some cards failed name resolution

Test enhancements:
Add new multimethod to perform more specific assertions on the loaded entities
For cards - check that the native SQL of the loaded card matches that of the original (pre-dump) instance
For dashboards - check that the linked card for each dashboard card series matches

Bug fixes:
Apply the mbql-id->fully-qualified-name fn on serialize to filter, breakout, and aggregation clauses
Updating "My Test" card to include filter clause so that fix is exercised
Instead of upserting users with a "changeme" password, simply do not attempt to change the password
Adding :engine to the identity condition of Database (so unrelated test-data instances don't get trashed on load)

Cleanup:
Remove unused specs namespace

****************************************
* Support dashboard card click actions *
****************************************

Architectural changes:
Add visualization settings shared model namespace with utility functions

Adding tests for viz settings

Changes to serialization:
Update visualization_settings in dump to convert column_settings keys from field ID to fully qualified name, and update the click action target with the fully qualified name
Also converting targetId in top level click action to fully qualified name

Doing the reverse in load, using the same utility code

Changes to serialization tests:
Updating the existing dashcard in the "world" roundtrip test to include the click action

Adding assertion for the click action in the assert-loaded-entity implementation for Dashboard

******************************************************************
* Stop nesting cards and check for unresolved query dependencies *
******************************************************************

In names.clj, stop qualifying a card's name by its dataset query's source card ID (this is what caused the "nested" directory structure)

In load.clj, start checking that either the source query [:dataset_query :query] is resolved properly as a card ID or table ID, and if neither, then propagate an ::unresolved-names entry up into the card (causing it to be reloaded on second pass)

Fix logging of unresolved name info

Test changes:
Add two new cards to the "world", one that lives in the root collection but depends on a card within a collection for its query, and one opposite (i.e. lives in a collection but depends on a root card for its query)

Adding new check that collection names match after loading

************************
* Logging improvements *
************************

Include causes when logging errors to aid with diagnosis

Add BEGIN and END messages for both dump and load commands

Add dynamic var to suppress printing of name lookup error on first pass load

*************************************************
* Handle collection namespaces and retry pulses *
*************************************************

Architectural changes:
Considering a collection namespace to be part of its fully qualified name (putting in a subdirectory called :namespace when writing to disk)
Accounting for that change when dumping and loading, and upsert (i.e. namespace is part of unique columns)
Bumping serialization format version to 2 because of this

Changes to load:
Add load-pulses fn that works similarly to others, to facilitate reloading
Add similar logic as other entities to reload a pulse if the :card_id is not found

Model changes:
Add hack fn to compare namespace values for the "namespace does not change" assertion with appropriate comment

Test changes:
Added test for pulse with reload

***********************************************
* Handle dimension entry within template-tags *
***********************************************

Add :field to the recognized clauses under mbql-entity-reference? (since that is how field refs are now represented in MBQL)

Add temp-field helper fn in test_util.clj to reduce some of the "world" verbosity

Adding new test card to world that uses template-tags with a field reference under dimension

************************
* Handle textbox cards *
************************

Add support for passing textbox (virtual) cards through visualization_settings.cljc

Updating load test to add a textbox type card to the dashboard and ensuring it is persisted

***************************************
* Handle dimension parameter mappings *
***************************************

In visualization_settings.cljc:
Adding handling for parameterMapping
Adding new roundtrip test for parameter mappings
Some refactoring to split up larger fns

In serialize.clj, convert all parts of the map that contain the dimension key to use fully qualified names for the respective fields

In load.clj, do the opposite (convert back to new IDs)

Updating test to add parameter mapping to an existing click action, and adding new assertions for that to ensure it is preserved

Fixing serialize test now that the "ids" can themselves be maps (i.e within dimension vector)

In visualization_settings_test.cljc
Adding new roundtrip test for problem dashboard

***********************************
* Handle field literals correctly *
***********************************

On load, only attempt to translate field name to ID if it's actually a fully qualified field name

Adding new fn to names.clj to provide that logic

Adding new test card that uses such a field reference

**************************************
* Accept only-db-ids option for dump *
**************************************

Accept options map for the dump command.  Currently, the only supported option is `:only-db-ids`, which is expected to be a set of DB IDs to dump.  If set, then only these databases (and their respective tables, fields, and segments) will be dumped to the dump-dir.  If not set, then the previous behavior takes effect (all DBs).

Update the load_test.clj to set this to be only the new temporary DB to avoid tramping on existing `sample-dataset` and other instances

*****************************************************
* Don't include personal collections of other users *
*****************************************************

Use the `select-collections` fn to filter only collections that are public, or owned bythe given user (by way of email), plus all collections with those as an ancestor

Updating test to assert a non-owned personal collection is not persisted (including nested), but all nested personal collections are

Adding new wrapped macro to also bind collection/*allow-deleting-personal-collections* true around the with-temp* call so that personal collections can legitimately be deleted (since they're temporary); the name of this macro was chosen to preserve the same amount of spacing within `with-world`

*********************************
* Support native query snippets *
*********************************

Adding support for NativeQuerySnippet:

- in names
- in dump (putting into subdirectory of collection, as cards)
- in upsert (identity condition of :name :collection_id)
- in load (no retry fn necessary since they should not have any dependencies themselves)

Adding a snippet and a card referencing it to roundtrip test (including a deeply nested snippet)

Fixing up handling of snippet namespaced collections and adding relevant name tests

*********************************
* Handle source-table for joins *
*********************************

Adding `mbql-fully-qualified-names->ids*` for recursive calls, which does not normalize its args, keeping mbql-fully-qualified-names->ids` as a wrapper to that

Adding clause to `mbql-fully-qualified-names->ids*` to resolve `:source-table` when it's a fully qualified table name

Adding util fn to names.clj to support that scenario

Updating "My Card" test card to include a join

Skipping two more drivers from `dump-load-entities-test` - SQLite and Spark because they don't support FKs

***************************
* Cleanup and refactoring *
***************************

Responding to PR feedback

Updating upsert_test.clj to check that the identity-condition keys actually exist for the models

Removing legacy MBQL syntax in a couple places

Adding ordering by `:id` to serialization load command for predictability

Lots of fixes and refactorings in visualization_settings.cljc:
 - added lots of specs and fdefs
 - added test fixture that instruments all the speced fns and required it from both visualization_settings.cljc and load_test.clj
 - renamed a bunch of fns for more consistency
 - added and fixed some docstrings
 - fix implementation of `parse-json-string` for cljs

*************************************************
* Preserve temporal-unit in source-field clause *
*************************************************

Update serialize and match macros to keep the rest of the match, when modifying the source field ID

Adding a bunch of new tables in order to perform a "bucketing on implicit join" type query

Updating test_util.clj to initialize the query processor with all the new temp tables so that queries actually work

**************************
* Misc cleanup and fixes *
**************************

Fixing the implementation of `fully-qualified-name->context` to work properly when the entity name itself is also a model name

***************************
* Handle joining to cards *
***************************

Recognize :source-table pointing to a fully qualified card name in `mbql-fully-qualified-names->ids*`, and adding the unresolved name capture to that lookup

Adding new util fns to capture the unresolved named entries from anywhere within the MBQL query tree: `paths-to-key-in` and `gather-all-unresolved-names`

Updating `resolve-card-dataset-query` to call this new `gather-all-unresolved-names` to pull all unresolved names from the MBQL query tree into card itself

Renaming `fully-qualified-name->id-rec` to `resolve-source-query` for clarity, and removing now unneeded clause

To the test case, adding a card that joins to another card
2021-05-27 11:59:21 -05:00
Nemanja Glumac
47cf018d24 #16246 Repro: Incorrect values on data points for waterfall charts when one of the values is 0 (#16265) 2021-05-27 18:40:20 +02:00
Cam Saul
8f18c64d1b Fix expansion of :metric macros inside nested queries (#16241)
* Failing test

* Fix expansion of :metric macros inside nested queries

* Unskip Cypress test

* Test fix 🔧

* Rewrite (fix) repro for #12507

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-05-27 09:26:08 -07:00
Nemanja Glumac
6e8b081c33 #16249 Repro: Tooltip of combined dashboard cards does not show the correct column title (#16263)
* Add repros for #16249

* Use "month" breakout for all questions

* Add assertions for the legend and y-axis
2021-05-27 17:37:13 +02:00
Anton Kulyk
dfca7086fe Improve dashboards drag-n-drop and resizing experience, make them more responsive (#16255)
* Basic `react-gird-layout` usage for Dashboards (#16167)

* Install react-grid-layout

* Add basic NewGridLayout implementation

* Wrap DashboardGrid with WidthProvider

* Bind DashboardGrid's onDrag methods

* Coerce layout item IDs to string

* Add method rendering NewDashboardGrid

* Refactor `onLayoutChange` method to handle new grid

* Use react-grid-layout's CSS classes

* Fix lag while dragging grid items

* Switch back to ExplicitSize HOC

* Fix grid in editing state is too short

* Import missing `react-grid-layout` CSS

* Fix RGL overwrites dragging placeholder color

* Hide default RGL's resize handle

* Fix random dashboard layout rearrangements

Before dashboard cards' parameters (x, y, width, height)
were updated individually for each card
It worked fine because there was only one card moving at a time

Now when cards are automatically moving when a user drags another card,
a race conditon appears, cards' parameters get overwritten, and layout breaks

Fixed by using bulk updates for dashboard cards drag and resizing events

* Fix dashboard background grid

* Align RGL with parent component edges

* Fix grid offset

* Fix dashboard grid height

* Fix no automatic page scroll while dragging

* Fix navbar is stuck when scrolling dashboard

* Remove previous grid component

* Fix grid doesn't respect item min size

* Extract grid background into a separate utils file

* Fix dashboards layout issues (#16236)

* Fix RGL cards are higher than the previous ones

* Return the fixed header in editing mode back

* Add support for responsive dashboard layouts (#16213)

* Fix `gridItemWidth` calculation

* Memoize grid children

* Add utility to adapt layout for breakpoints

* Use responsive react-grid-layout for dashboards

* Don't overwrite main layout with smaller ones

* Pass correct `isMobile` prop to DashCard component

* Extract `renderGridItem` method

* Increase dashboard cards vertical margin for mobile

* Remove dashboard's old renderMobile method

* Add isMobileBreakpoint utility function

* Disable dashboard drag and resize for mobile

* Remove old method disabling mobile drag and resize

* Fix grid background rendering

* Switch to desktop and mobile breakpoints

* Update card heights for dashboard's mobile view

* Add a comment about `!important` in CSS

* Minor code style fix

* Remove not used functions
2021-05-27 16:11:07 +03:00
Luis Paolini
94f28ee67f Bring the dockerfile build to release branch (#16247) 2021-05-26 19:17:31 -03:00
Ariya Hidayat
4415a111e9 Search: do not complain on empty string (#16251) 2021-05-26 13:33:13 -07:00
Nemanja Glumac
88507cac40 #16229 Repro: Drag functionality not working in dashboard visualization options modal (#16252) 2021-05-26 20:22:42 +02:00
Cam Saul
3fb213e5ac Delete appropriate GTAPs when permissions change (#16222) 2021-05-26 11:10:02 -07:00
Gustavo Saiani
f76d83337c Restore Custom Expression suggestion highlights (#16215) 2021-05-25 15:44:51 -03:00
Alexander Lesnenko
0401256292 Fix incorrect numeric tooltip values (#16230)
* Fix #15998: Tooltip only shows first Y-axis value when X-axis is numeric and style is Ordinal/Histogram

* Fix #15998: Tooltip only shows first Y-axis value when X-axis is numeric and style is Ordinal/Histogram

* prettier

Co-authored-by: Roman Abdulmanov <roman.abdulmanov@gmail.com>
2021-05-25 20:25:53 +03:00
Nemanja Glumac
06a91889ea #16173 Repro: LDAP setting should hit the correct endpoint (#16205) 2021-05-25 17:40:25 +02:00
Ariya Hidayat
67bcfdd023 Fix standard filter detection (#16174)
When attempting to convert a filter, check first if the filter is a
comparison against a constant. Otherwise, preserve the filter is in its
custom expression (MBQL) form.

Each in the following list can be converted into a standard filter
(since the simple UI for the standard filter only allows literal
comparison):

  [Total] < 300
  between([Discount], 5, 15)
  [Name] = "Joe"

but none of these should be converted

  [Discount] <= [Tax]
  between([Rating], 0, [MaxRating])
  [Reviewer] != UPPER([Name])

* Allow standard filter to be invalid

This is necessary to allow an incomplete filter, i.e. the user hasn't
filled Y in "X < Y" form yet (hence Y is undefined). The filter is not
valid but it is still considered in the standard form.

* Check whether string comparison can be considered a standard filter

* Idiomatic with array destructuring
2021-05-25 07:59:12 -07:00
Ariya Hidayat
e3e584c7f5 Fix standard filter detection (#16174)
When attempting to convert a filter, check first if the filter is a
comparison against a constant. Otherwise, preserve the filter is in its
custom expression (MBQL) form.

Each in the following list can be converted into a standard filter
(since the simple UI for the standard filter only allows literal
comparison):

  [Total] < 300
  between([Discount], 5, 15)
  [Name] = "Joe"

but none of these should be converted

  [Discount] <= [Tax]
  between([Rating], 0, [MaxRating])
  [Reviewer] != UPPER([Name])

* Allow standard filter to be invalid

This is necessary to allow an incomplete filter, i.e. the user hasn't
filled Y in "X < Y" form yet (hence Y is undefined). The filter is not
valid but it is still considered in the standard form.

* Check whether string comparison can be considered a standard filter

* Idiomatic with array destructuring
2021-05-25 07:58:45 -07:00
Nemanja Glumac
c1d596bf0d #16212 Repro: Questions used in SQL query aren't linked correctly from variables sidebar (#16228) 2021-05-25 15:04:23 +02:00
Nemanja Glumac
aaf4bab611 #16198 Repro: Specific combination of filters can cause frontend reload or blank screen (#16209)
* Add repros for #16198

* Refine the assertion in the second scenario

Guard against the changes in #16174.

* Add repro for the third scenario

* Use full filter name for non-CE expressions

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-05-25 15:03:08 +02:00
Nemanja Glumac
c8033d22a1 #13313 Repro: It shouldn't be possible to save invalid (non-numeric) LDAP port (#16204)
* Add repro for #13313

* Add comment related to #16255
2021-05-25 13:21:45 +02:00
dpsutton
6a63276469 Yyyymmddhhmmss date strings (#15790)
* Add yyyymmddhhss coercions to type system

* Implementations for h2/mysql/postgres for yyyymmddhhss bytes and strings

* Mongo and oracle

* Adding checksum on migration it said was bad

* import OffsetDateTime

* Redshift and bigquery

* snowflake expectations

* sql server yyyymmddhhmmss. have to format the string then parse

sqlserver lacks a parse function that takes a format string, they just
take an integer that specifies a predefined format string. So we have
to make the string into the right format then parse.

* presto yyyymmddhhmmss

* Test byte conversions

* Remove errant `mt/set-test-drivers!`

* Remove sqlite, change keyword for multiple native types in def

the spec couldn't handle different shapes under the same keyword. so
just use :natives {:postgres "BYTEA"} :native "BYTEA"

* Make schema work with different shape maps

* hx/raw "'foo'" -> hx/literal "foo" and remove checksums

* _coercion_strategy -> _coercion-strategy

* Handle coercion hierarchy for :Coercion/YYYYMMDDHHMMSSBytes->Temporal
2021-05-24 15:44:48 -05:00
dpsutton
17aca2d354 Parse number filter inputs (#15992)
* Parse number filter inputs

The frontend feels a bit off on this. It's sending `"string/="`
instead of `"number/="` but the backend code knows that number filters
can ignore it. It's also sending strings from the text inputs when it
should be sending number types.

We've had a convention that the types come across as they should be:
numbers come in as numbers and strings as strings. This seems to break
that convention.

* Unskip the "number" part of the repro for #15981

* use normalized parameter values when diffing for dirtiness

* update tag parameter parsing fns to handle number --> number/= types

* tweak & unskip cypress repro test

* wrap fn in parens to invoke it?

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2021-05-24 15:40:18 -05:00
dpsutton
256fd26358 Don't cast in the outer select when inner select will (#16118)
* Don't case in the outer select when inner select will

Expressions create subselects

```clojure
(-> {:database 1,
     :query {:source-table 2
             :expressions {:test ["*" 1 1]}
             :fields [[:field 2 nil]
                      [:expression "test"]]}
     :type "query"
     :parameters []}
    qp/process-query
    (update-in [:data :rows] count)
    pprint)
```

```sql
SELECT "source"."QUANTITY" AS "QUANTITY",
       "source"."test" AS "test"
FROM (SELECT timestampadd('second', "PUBLIC"."ORDERS"."QUANTITY", timestamp '1970-01-01T00:00:00Z')
     AS "QUANTITY",
     (1 * 1) AS "test"
     FROM "PUBLIC"."ORDERS") "source"
LIMIT 1048575
```

The bug was that source quantity was marked as a coerced integer to
timestamp, and it coerced in both the inner and outer select.

There's of course a few ways to solve this:
- the easiest way is when fetching the field information, throw away
the coercion strategy. Didn't want to do this as less information gets
confusing. Preferred to add information about _why_ it should be
ignored rather than just suppressing information.
- (solution here) add a marker to just not coerce on the outer
select.

The metadata is a bit strange to me. I'm honestly not sure what it
should be. What is the base type, effective type, and coercion
strategies of the things returned? At the moment they are:

```clojure
{:semantic_type :type/Quantity,
 :coercion_strategy :Coercion/UNIXSeconds->DateTime,
 :name "QUANTITY",
 :field_ref [:field 2 nil],
 :effective_type :type/Instant
 :base_type :type/DateTime}
```

Should this still have coercion information and a base type of
integer (ie, promote the inner field type's information to the
toplevel) or is this properly the type information now?

* tests

* Add bigquery into test

mongo doesn't support expressions, druid doesn't have a great table
laying around

* dumb oracle is dumb

its probably the only "proper" way to do this but i'm still mad

* clean up tests

* Check for string and number in tests
2021-05-24 15:38:20 -05:00
Noah Moss
3532897055 Fix API endpoints used by LDAP and email settings forms (#16187)
* Fix dispatch for SettingsBatchForm

* run prettier

* update email settings cypress test
2021-05-24 11:32:50 -07:00
Howon Lee
d872122db1 Collections pagination for #15769 (#15941)
This ballooned in scope by a bit.
1. FE landed onto this. So both BE and FE
2. Added an offset-pagination middleware
3. Refactored collection in addition to paginating it so it works by a giant UNION ALL
4. Refactored effective collections to work by a moderately complicated query with very many WHERE clauses to execute the effective visibility, instead of doing it in clojureland
2021-05-24 11:29:46 -07:00
Noah Moss
1da77343a1 Fix "remember me" checkbox on login (#15995)
* respect `remember` field on backend if session tokens are not enforced via env variable

* modify docs to describe new behavior

* fix indentation

* use get-in to access remember field of request

* add a session api test

* expose session-cookies as a public setting

* hide remember me checkbox if session-cookies is set
2021-05-24 10:04:52 -07:00
Ariya Hidayat
143ec2ca4a Don't fetch field (values) when in a dashboard (#16056)
* Add a Cypress test
2021-05-24 07:59:25 -07:00
Alexander Lesnenko
b06b79d6f9 Fix #15980: Refresh on hover (#16207)
* Fix #15980: Refresh on hover

* unskip repro for #15980

Co-authored-by: Roman Abdulmanov <roman.abdulmanov@gmail.com>
2021-05-24 16:28:15 +03:00
Ariya Hidayat
b1acd6ce8c Fix admin setup test by adjusting the expected message (#16196) 2021-05-22 11:28:00 -07:00
Cam Saul
badb0bfaf2 Merge x.39.2 -> master 🔀 (#16155) 2021-05-21 18:54:18 -07:00
Cam Saul
93e5e8d08c Test fix 2021-05-21 17:22:31 -07:00
Nemanja Glumac
84894f9a11 Fix #16188 (React unsupported style property warning in NewQueryOption) (#16192) 2021-05-21 23:49:29 +02:00
Ariya Hidayat
39368b5e58 fix replacement for plural message (#15988) (#16186)
Co-authored-by: Yoshiki Iida <lhclrt176@gmail.com>
2021-05-21 14:21:15 -07:00
Nemanja Glumac
af67265cda #16170 Repro: Line Chart on MongoDB drops all values when using "Replace Missing Values with nothing or zero" (#16183)
* Add repro for #16170

* Skip describe block in mongo `native.cy.spec.js`

* Skip describe block in postgres `native.cy.spec.js`
2021-05-21 15:53:27 +02:00
Anton Kulyk
e58df52252 Fix database schemas browsing (#16156) 2021-05-21 08:51:18 +03:00
Gustavo Saiani
8edda18c52 Add PropTypes to TokenizeInput (#16162)
* Add PropTypes and simplify TokenizeInput

* Add PropType for forwardedRef
2021-05-20 22:31:47 -03:00
Luis Paolini
1ce787f77d Update running-metabase-on-debian.md (#16163) 2021-05-20 12:06:15 -07:00
Noah Moss
d64253e15a Async validation of new password in account settings (#16051)
* Add async validation of password in account settings, and change schema error message

* run prettier

* add period to error message for consistency

* revert change to api-documentation
2021-05-20 11:56:31 -07:00
Ariya Hidayat
f93680ae2b Fix a regression in getting the default dimension (#16140) 2021-05-20 08:40:44 -07:00
Nemanja Glumac
bab15e94ee Fix #16131: Refactor "hacky" helper functions (#16164)
* Remove helper type functions from the global scope

We are using `_typeUsingPlaceholder` and `_typeUsingGet` only in `frontend/test/metabase/scenarios/question/custom_column.cy.spec.js`.
There is no point in exporting them and keeping them available in the global scope.

* Create `enterCustomColumnDetails()` helper function

* Use new helper function in repro for 13241

* Refactor existing test with the new helper function

This test is interesting and a good litmus for this new helper function.
It clearly shows that issues with `contentEditable` field were truly fixed in #16157.

Formula `[Quantity] * [Product.Price]` resolves in the UI as `[Quantity] * [Product → Price]` and the test doesn't break, which means race conditions were solved.

* Use new helper function in repro for 12762

* Refactor repro for 13289

* Refactor repro for 12649

* Refactor repro for 15741

* Use helper function in ExpressionEditorTextfield describe block

Confirms #16157 is working as expected.

* Erase `_typeUsingPlaceholder` and `_typeUsingGet` functions

* Refactor repro for 13122

* Refactor repro for 13217

* Refactor repro for 15922
2021-05-20 17:05:51 +02:00
Gustavo Saiani
03bdd075c8 Fix UX bugs in ExpressionWidget (#16157)
* Update ExpressionWidget state criteria

* Remove isRequired from onClose propType
2021-05-20 11:04:04 -03:00
Gustavo Saiani
43052b4da7 Fix AccordionList PropType (#16160) 2021-05-20 11:02:19 -03:00
Howon Lee
c3f97bbb9e Reduce fieldname friendliness (#16119)
We made fieldname friendliness, people didn't like it, we tried to fix it, people still didn't like it, now we're just making the fieldnames all mildly unfriendly again. Not like, snake_case unfriendly, but Pascal Case With Spaces unfriendly
2021-05-20 02:12:23 -07:00
Cam Saul
4347464b04 Merge x.39.1 -> master (#16154) 2021-05-19 17:28:12 -07:00
Ariya Hidayat
e855d84103 Dashboard: do not break filter dropdown (#16117)
Guard against undefined `options` passed from FieldValuesWidget to the TokenField
component, which happens in some cases.
2021-05-19 15:19:46 -07:00
Cam Saul
e62e4c68ab Merge v0.39.2 into master
v0.39.2
2021-05-19 11:57:01 -07:00
Cam Saul
a2ae9fd7be Merge tag 'v0.39.1' into merge-x.39.1
v0.39.1
2021-05-19 11:42:09 -07:00
Anton Kulyk
9ea3518ab9 Display link to database integration docs when connecting a new database (#16018)
* Add basic AddDatabaseHelpCard component

* Display database engine on HelpCard

* Display help link for cloud instances

* Display link to database setup docs

* Dispaly help card at `/admin/database/create`

* Test help card changes copy on new db page

* Display db setup help card on Setup

* Display help card only when db engine is selected

* Fix not translated string

* Use styled-components for AddDatabaseHelpCard
2021-05-19 20:27:49 +03:00
Nemanja Glumac
9b43755d4a #15211 Repro: Pivot table don't show stand-alone values on the upper level grouping (#16149) 2021-05-19 19:11:34 +02:00
Nemanja Glumac
f184a0db3c Synchronize ExternalLink component with the release-x.39.x (#16145) 2021-05-19 17:00:44 +02:00
Nemanja Glumac
fd6510fce6 #15558 Repro: Login History tab not available for LDAP/Google logins (#16146)
* Abstract and reuse `mockProperty` function

* Add repro for #15558
2021-05-19 16:59:51 +02:00
Cam Saul
5caf4de89a Coercion strategy hierarchies [PoC] (#16088)
* Coercion strategy hierarchies

* Don't rebuild hierarchy on every change

* Emacs config tweaks

* clojurescript-mode is derived from clojure-mode, combine the dir locals

* Remove log statements and improve dir locals

* Use new api from app

- add coercions for text (iso stuff)
- function to get the effective type for a strategy
- extra validation in saving field to ensure that the triple
   `[coercion base effective]` is valid

* remove unnecessary `coercions` map

Co-authored-by: dan sutton <dan@dpsutton.com>
2021-05-19 09:10:26 -05:00
Nemanja Glumac
d8b0256dd5 #15882 Repro: Only retains first 2 data series when saving chart with custom expressions (#16143)
* Add repro for #15882

* Assert on the number of lines
2021-05-19 15:00:54 +02:00
Nemanja Glumac
9e42eb3230 #15974 / #11659 Repro: Google sign-in client ID setting fails to save on subsequent tries (#16142) 2021-05-19 13:13:10 +02:00
Nemanja Glumac
211bbad881 #16122 Repro: Normal login errors are not surfaced if SSO is also active (#16135) 2021-05-18 19:10:24 +02:00
Nemanja Glumac
2652dd34e4 #16108 Repro: Missing tooltip for sharing individual question (#16133) 2021-05-18 17:27:58 +02:00
Nemanja Glumac
2bc8dc5e17 #16103 Repro: Filter dropdown sends request for values every time widget is opened (#16128) 2021-05-18 14:08:15 +02:00
Cam Saul
b0d9436a5c Fix Druid queries with temporal Fields that don't have a :temporal-unit (#16028)
* Fix Druid queries with multiple filters if some but not all are temporal

* Fix Druid queries with temporal Fields that don't have a :temporal-unit

* Test fix 🔧

* Fix syntax errors

* Query result metadata should return the :unit from the source query when applicable

* Test fix 🔧

* Clarify comment in test

* More test fixes 🔧

* Test fix 🔧
2021-05-17 20:03:57 -07:00
Ariya Hidayat
55540f8d97 Use ExternalLink to automatically use noopener/noreferrer (#16111)
* Use ExternalLink to automatically use noopener/noreferrer

* Address code review feedback
2021-05-17 18:00:22 -07:00
Cam Saul
9700fe5bd4 Add Semantic/* and Relation/* ancestor types (#15994)
* Port legacy data type migrations -> Liquibase

* Fix migration IDs

* Field type validation/error handling

* Have semantic type fallback to nil

* Fix semantic-type-migrations-test

* Fix migrations

* Revert accidental changes

* Semantic/* & Relation/* ancestor types

* Fix stray Relation/PK and Relation/FKs

* Semantic/* and Relation/* ancestor types

* cljs test fix

* Fix :require

* FE test fixes 🔧

* Test fixes 🔧

* prettier

* PR  f e e d b a c k

* Use medium size CircleCI image for Presto to prevent all the OOMs

* Backport dir-locals tweaks from hierarchy PR

* Redshift: only sync the test schema (faster CI and fix failure)

* Better error handling for sync in tests

* Revert accidental commit

* Redshift test fixes 🔧
2021-05-17 17:28:05 -07:00
Noah Moss
2590f77830 use lower case email when fetching user from DB (#16091) 2021-05-17 16:59:51 -07:00
Noah Moss
250b14dec8 test that LDAP works with $ in password (#16092) 2021-05-17 16:57:22 -07:00
Gustavo Saiani
75e3d76f41 Refactor ExpressionEditorSuggestions (#16110) 2021-05-17 14:48:56 -03:00
Alexander Lesnenko
bcfec8180d hide pagination controls when there is only one page, increase page sizes for people management pages (#16084)
* hide pagination controls when there is only one page, increase page sizes for people management pages

* fix specs
2021-05-17 18:23:09 +03:00
Howon Lee
d379d82f3d Search pagination single model postgres 9 fix (#16060)
In postgres 9 only (not 10 11 12 or 13) search pagination is not happy when it gets exactly one model (when the union all query is trivial). Fix this
2021-05-14 11:52:19 -07:00
Cam Saul
d33c7523c9 Fix multi-stage Dockerfile used by head images not building version info (#16052) 2021-05-14 11:45:45 -07:00
Noah Moss
aad24de711 Remove extra space before colon in form validation errors (#16057) 2021-05-14 08:52:02 -07:00
Anton Kulyk
01a06c9762 Add slugs to URLs to make them friendlier (#15989)
* Install slugify

* Add utils to slugify and parse entity URLs

* Add `<Entity.Link />` component

Basically just a `<Entity.Name />`,
but wrapped inside `<Link />`

* Add slugs to `/browse/:databaseId` URLs

* Use constant for "Saved Questions" database ID

* Fix "Saved Questions" not displayed in breadcrumbs

* Fix opening browse page for "Saved Questions"

* Add slugs to `/collection/:id` URLs

* Fix personal collection page slug

* Remove `describe.only`

* Remove unnecessary type coercion

* Fix typo

* Fix collections not highlighted in the sidebar

* Add slug to collection `/archive` URL

* Add slug to collection `/edit` URL

* Add slug to collection `/permissions` URL

* Use slug in `getInitialCollectionId` selector

* Explicitly pass root ID to `Urls.collection`

* Pass prop to EntityLink's Link component

* Fix DashboardMoveToast collection link

* Allow overwriting EntityLink's Link component

* Fix links in QueryBuilder's search

* Fix collection link in search results

* Fix navigating to collection after question archived

* Fix navigating to collection from pulse edit

* Slugify users' personal collection URLs

* Test slugified collection URLs are opened correctly

* Add slugs to `/dashboard/:id` URLs

* Fix dashboard URLs at admin public sharing page

* Fix opening dashboards from main page

* Fix navigation to saved automatic dashboard

* Fix dashboard moving

* Fix dashboard history

* Fix closing dashboard editing modal

* Fix dashboard details form is empty

Reproduced if opening the form via URL
(`/dashboard/:id/details`)

Works correctly if the details modal is opened from a dropdown menu

* Fix dashboard copy form crash

Reproduced if opening the form via URL (`/dashboard/:id/copy`)

* Fix copying dashboard

* Fix closing dashboard copy modal

* Fix navigation once dashboard is created

* Replace hardcoded "root" id with a constant

* Assert pathnames instead of URLs

* Fix duplicate modal not closing automatically

* Fix URLs on Activity page

* Fix navigating to dashboard question is added to

* Fix archiving dashboard

* `dashboardId` —> `slug`

* Add slugs to `/question/:id` URLs

* Fix links to questions on Activity page

* Switch questions to slugified URLs

* Remove not used import

* Update pathname assertion

* Fix collection URL builder fails receiving `null`

* Ensure question URL builder returns valid URL

* Update pathname assertions

* Update pathname assertions

* Update pathname assertions

* Update pathname assertion

* Update pathname assertion

* Add question URL builder unit tests

* Fix collection URL builder

* Fix `null` collection ID when building URL

* Fix repro test issue reference

* Move URLs tests into onboarding folder

* Enable #15256 repro test

* Fix slugs for edge cases
2021-05-14 11:33:09 +03:00
Nemanja Glumac
999dfa8fa7 Fix Whitelabel favicon not working in all browsers (#16022)
* Delete obsolete Safari favicon

* Set the default favicon path to the existing icon

* Delete fallback png favicons

* Fix placeholder in related Cypress test
2021-05-13 23:56:03 +02:00
Cam Saul
43701102a8 ./bin/build should give EE a snapshot version starting with 1 (#16050) 2021-05-13 13:29:50 -07:00
Alexander Lesnenko
daa805f3e6 Fix table visualization flaky spec (#16041)
* hack table visualization flaky spec

* Fix the flake by waiting for the table to update

Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-05-13 23:08:43 +03:00
dpsutton
acd8afb187 Fix reflection warnings (#16005)
log4j includes different class files for different jvm versions. This
means our uberjar includes these versions so we are a multi-release
jar. Need to set this in our manifest.

Fixes the reflection warning seen on startup on jdk 11's

~/p/w/metabase ❯❯❯ java -jar target/uberjar/metabase.jar
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
2021-05-13 15:03:24 -05:00
Cam Saul
8d3ae7b0ea Fix Druid queries with multiple filters if some but not all are temporal (#16027)
* Fix Druid queries with multiple filters if some but not all are temporal

* Fix syntax errors
2021-05-13 11:42:56 -07:00
dpsutton
b8c81d0277 Cleanup logging diagnostic info (#16008)
not-empty so that we don't output a dumb string like

>  null DB null connections: null/null (null threads blocked)

Also put the call to `name` behind a some-> so there's no
NPE. Everything else will just output a null if its missing
2021-05-13 12:52:38 -05:00
Gustavo Saiani
76ed655a56 Update js lib: recompose (#16039) 2021-05-13 14:20:50 -03:00
Nemanja Glumac
e1320c174c #15959 Repro: Adding cards to dashboard via search can cause the card to show spinner until browser refresh (#16040) 2021-05-13 17:43:39 +02:00
Nemanja Glumac
b5f9b6151b Add cypress-real-events library (#16033) (#16036)
* Install `cypress-real-events` library

* Register `cypress-real-events` globally
2021-05-13 16:00:03 +02:00
Nemanja Glumac
19a3defe74 Add cypress-real-events library (#16033)
* Install `cypress-real-events` library

* Register `cypress-real-events` globally
2021-05-13 15:17:34 +02:00
Nemanja Glumac
5dae52c053 Cypress run: guard against unspecified specs (#15969) (#16019)
Co-authored-by: Ariya Hidayat <ariya@metabase.com>
2021-05-13 14:07:13 +02:00
Yoshiki Iida
4f749d8bda fix replacement for plural message (#15988) 2021-05-13 01:39:20 -07:00
Anton Kulyk
3cb56f2196 Fix "Our analytics" is initially suggested only to admins when saving items (#15999)
* Fix 'Our collection' is suggested only to admins

* Fix permission test

* Fix test according to new collections behavior
2021-05-13 00:00:25 +03:00
Alexander Lesnenko
2243616816 format links on the table visualization (#15964)
* fix question level link display settings

* add cypress spec for the question-level link settings on the table visualization

* Address review comments: add a spec for clicn behavior with view_as = link, fix admin column settings

* revert a straightforward fix for hiding irrelevant settings

* fixup! Address review comments: add a spec for clicn behavior with view_as = link, fix admin column settings

* prettier

* handle link_text null value
2021-05-12 23:41:27 +03:00
Cam Saul
e09f889711 Dashboard param value (chain filter) endpoints should return cached FieldValues (#15943)
* Dashboard param value (chain filter) endpoints should return cached FieldValues

* Test fix 🔧

* Test fixes 🔧

* PR feedback/appease linters

* Hydrate :table to avoid lots of DB calls

* Use hash of current user perms set for sandboxed field values cache key

* Fix missing :require

* Test fix 🔧
2021-05-12 11:51:41 -07:00
Raimon Grau
a9ad9e8d61 Handle token-like values in encryption key rotation (#15796) (#16009)
Co-authored-by: Raimon Grau <raimonster@gmail.com>

Co-authored-by: Walter Leibbrandt <23798+walterl@users.noreply.github.com>
2021-05-12 18:17:39 +01:00
Nemanja Glumac
5acd6831f7 Cherry pick Cypress custom command cy.button() (#16011)
* Add Cypress custom command `button` (#16007)

* Apply new custom command to the missed occurrences on `master`
2021-05-12 19:00:48 +02:00
Nemanja Glumac
142b80bb1e Add Cypress custom command button (#16007) 2021-05-12 15:03:23 +02:00
Ariya Hidayat
140f7d2f71 Dimension type inference: handle CASE and COALESCE (#15996)
* Remove stray it.only
2021-05-12 00:18:33 -07:00
Ariya Hidayat
aed6976ad8 Type inference can have access to the environment. (#15982)
In this case, to fetch the field type.
2021-05-11 23:54:39 -07:00
Ariya Hidayat
a336f639fc Use type inference in ExpressionDimensions (#15965) 2021-05-11 23:13:23 -07:00
Luis Paolini
3f2f92c3f8 Add Microsoft Azure deployment guide (#14733)
* Add Azure Guide

* Change links to access the guide

* Add Azure AD SAML SSO guide

* Fix error in pages

* Apply suggestions from code review

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

* A couple of changes proposed by Jeff

* Update docs/operations-guide/running-metabase-on-azure.md

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

* Apply suggestions from code review

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

* Wrap connection strings in triple backticks

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-05-11 17:59:56 -07:00
Luis Paolini
019322b256 Parallel building (frontend & backend) + unify running scripts (#15819)
* Separate steps for faster build

* Fix typo
2021-05-11 21:42:49 -03:00
Nemanja Glumac
92428fa629 Use GitHub Actions to run front-end tests (#15507) (#16001)
- Cherry picks 274be949d5 from `master`, which extracted unit and timezone tests from CircleCi and made them run using GitHub actions
- Synchronizes the "state" between the `master` and `release-x.39.x` branches

Co-authored-by: Ariya Hidayat <ariya@metabase.com>
2021-05-11 21:54:07 +02:00
Nemanja Glumac
c3bbf8a1c2 #15998 Repro: Tooltip only shows first Y-axis value when X-axis is numeric and style is Ordinal/Histogram (#16003) 2021-05-11 21:36:46 +02:00
Alexander Lesnenko
a7998d693f search pagination (#15923)
* add global search results pagination

* fixup! add global search results pagination

* nit fix to allow aleksander test without borking perf too much

* fix incorrect question object in the search spec

* translate pagination

* show filters only for existing types of items for a specified search query

* fixup! show filters only for existing types of items for a specified search query

* fixup! show filters only for existing types of items for a specified search query

* Search pagination models (#15972)

* querying the models by a buncha queries

* up max filtered response because of limits

* archived string and table db id is still a thing cuz of weirdo joins and stuff

* shove models given in the normal api endpoint

* misplaced docstring

* redshift root is actually bonafide different than other roots

Co-authored-by: howon lee <hlee.howon@gmail.com>
2021-05-11 19:12:38 +03:00
Cam Saul
765cef443d Field type validation/error handling (#15991)
* Port legacy data type migrations -> Liquibase

* Fix migration IDs

* Field type validation/error handling

* Have semantic type fallback to nil

* Fix semantic-type-migrations-test

* Fix migrations

* Revert accidental changes
2021-05-10 20:04:42 -07:00
Luis Paolini
367b14e17e Bump version due to security alert (#15662) 2021-05-10 20:19:14 -03:00
Cam Saul
53aa2e6640 Port legacy data type migrations -> Liquibase (#15990)
* Port legacy data type migrations -> Liquibase

* Fix migration IDs

* Fix migrations
2021-05-10 15:07:42 -07:00
Noah Moss
41d4a4eba1 update Google sign-in docs (#15973)
Clarifies which part of the Google link is relevant to Metabase, and modifies some language to better mirror the terms used by Google/OAuth
2021-05-10 14:11:39 -07:00
Noah Moss
dea5093096 Add deny list of common passwords (#15912)
* Add deny list of common passwords

* replace filtered pw list with full list

* switch to using a FileReader to check password line-by-line

* bypass deny list if complexity is set to easy

* fix tests

* more test fixes and remove unneeded ns

* fix typos

* fix reflection warning

* needed to import File

* fix final tests, and update docs to reflect change

* address initial review comments

* fix build after removing import statement

* address more review comments

* use InputStreamReader to read password file in JARs
2021-05-10 14:10:04 -07:00
Nemanja Glumac
8547077b1f Repro #15980: Gauge visualization causes re-render on hover when there are no labels (#15987)
Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-05-10 21:51:21 +02:00
Kyle Doherty
ddae0bc923 Add Explore results button to saved SQL questions (#15984)
* add Explore results button

* lint
2021-05-10 15:49:01 -04:00
dpsutton
742ebf7552 Fix geocode test failures (#15970) (#15986)
Update tests in accordance with changed geocode API results ("Begles" -> "Talence")

See output of: https://get.geojs.io/v1/ip/geo.json?ip=185.233.100.23

Co-authored-by: Jeff Evans <jeff303@users.noreply.github.com>
2021-05-10 13:55:49 -05:00
Nemanja Glumac
27f5495dce #15981 Repro: Feature flag causes problems with Text and Number filters in Native query (#15985)
Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-05-10 20:04:49 +02:00
Jeff Evans
a2b76be2dd Fix geocode test failures (#15970)
Update tests in accordance with changed geocode API results ("Begles" -> "Talence")

See output of: https://get.geojs.io/v1/ip/geo.json?ip=185.233.100.23
2021-05-10 11:43:17 -05:00
dpsutton
2405216e17 Emit events outside of db/transaction (#15909)
* Emit events outside of db/transaction

When emitting events (particularly revision events), the event handler
loads the item from the db to ensure that all post-processing is
done. If done from inside a transaction, there's a race between the
event handler looking up the object from the db and the transaction
completing to put the item in the db. When the event handler wins, the
following code fails:

```clojure
(push-revision! :entity       Dashboard,
                :id           id,
                :object       (Dashboard id), ;; this is nil
                :user-id      user-id,
                :is-creation? (= :dashboard-create topic)
                :message      revision-message)
```

and then the schema check for `push-revision!` fails `(map? object)`
and there is no event recorded for creation. On edit, it might get the
pre-edit version and record an incorrect message or not create the
revision for the latest change, preventing going back in the future.

I'm only doing this in dashboard but these changes should be audited
and applied everywhere

* Remove `:dashboard-card-update` and `:dashboard-card-create` events

These events were introduced 5 years ago and never have had an event
handler. No worries about race conditions when emitting them from a
transaction if nothing ever cared in the first place.
2021-05-10 10:15:38 -05:00
Nemanja Glumac
2c643cd57e #15947 Repro: Hiding a table makes it impossible to edit related questions (#15966)
* Add repro for #15947

* Expand the assertion with the joined table

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-05-10 15:40:02 +02:00
Ariya Hidayat
24b84de24a Cypress run: guard against unspecified specs (#15969) 2021-05-07 14:31:57 -07:00
Nemanja Glumac
b9f5c2bda4 #15946 Repro: Converting mongo question to native query doesn't pre-select table (#15968) 2021-05-07 22:33:58 +02:00
Alexander Lesnenko
5bd6dd30e9 fix broken permissions editing (#15962) 2021-05-07 18:48:36 +03:00
Maz Ameli
15c3a40d7a Reduce tabs font size down to 14px (#15955)
* reduce tabs font size down to 14px

* tweak admin tabs padding

* update snapshots
2021-05-07 08:17:57 -07:00
Gustavo Saiani
754ecb8edc Omit revision history item from list if no diff (#15942)
* Omit dashboard revision history items if no description

* Skip Revert button on topmost visible revision history entry

* Test that topmost revision history entry omits Revert button

* Lint

* Use diff as criterion for omitting revision entry

* Detail comment in shouldRenderRevisionHistory

* Render revision item if either before or after in diff is populated

* Update e2e test

* Use a more durable string to find element in test
2021-05-07 11:49:40 -03:00
Nemanja Glumac
60d35e5a3e include new line before source hash in version.properties (#15881) (#15933)
Co-authored-by: Paul Rosenzweig <paulrosenzweig@users.noreply.github.com>
2021-05-07 12:58:21 +02:00
Ariya Hidayat
ff7e29cb19 Basic type inference for custom expression (#15940)
* Make it work with MBQL instead

* Update frontend/test/metabase/lib/expressions/typeinferencer.unit.spec.js

Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-05-06 16:49:26 -07:00
Jeff Evans
9dc522a490 Add diagnostic info for connection pools to Help page (#15704)
Add diagnostic info for connection pools to Help page

Backend changes:
Add org.clojure/java.jmx dependency to project.clj for use in JMX bean querying
To troubleshooting.clj, add some functions to capture details from the c3p0 connection pool beans to a map
Add new API endpoint to invoke that from util.clj
Add content-disposition header to API endpoint to make it a download

Frontend changes:
In the Help page, add a new paragraph below the existing "Diagnostic Info" JSON blob for advanced details, envisioned as a list of download links (which users can then attach to tickets, etc.)
2021-05-06 16:54:23 -05:00
dpsutton
45c4d2fea8 Fall back to base_type when calling parse-value-for-field-type (#15905)
I don't exactly follow what's going on in #15901. But it seems that
the field information can be kept in the db

> ""field_ref"":[""field"",""count(*)"",{""base-type"":""type/BigInteger""}]

And so we need to handle this base type here. Note that in the
function that calls `update-filter-for-field-type` it checks that the
field has a base_type.

I'm also a bit confused by the base_type vs base-type in the above
snippet. But again the calling code has

```clojure
(and (= param-type :dimension)
     (get-in value [:field :base_type]))
(update-filter-for-field-type value)
```

So it seems the field has a base_type rather than a base-type.
2021-05-06 16:09:53 -05:00
Ariya Hidayat
54b6d5102e Custom expression: improved message for dangling closing brackets (#15939) 2021-05-06 07:51:43 -07:00
dpsutton
494b820bef Restore table visibility (#15916)
* Move unhidden table sync off-thread

* Test bulk hide/unhide syncing

* Check can connect to db and serialize syncs

rather than allowing us to create threads willy nilly, serialize them
and reuse them in a fixed thread pool with a single thread. This helps
if someone "multiple clicks" and launches a few table syncs. It's not
appropriate to use the existing deduplicating stuff in the sync which
prevents later tasks from happening while the current sync step
happens since we want to sync with the most recent changes. So just
serialize them to go one at a time rather than off to the races.

* Clean up ns, make private, and type hints

* Block waiting on table sync to finish

* Use driver.util can connect helper

uses the timeout of 5seconds and catches errors

* disable ToggleHiddenButton during request

Co-authored-by: Dalton Johnson <daltojohnso@users.noreply.github.com>
2021-05-06 09:35:26 -05:00
Anton Kulyk
27726dbbc5 Fix item picker suggests to select items user does not have write access to (#15613)
* Test adding question to dashboard

* Test collections filtering when adding a question

When adding a question to dashboard,
we need to display collections a user has "write" access to.
Collection with "read" access have to be hidden

* Fix adding question to dashboard without access

* Add a note about permissions test suite

* Move question permission tests to collection suite

* Revert initial collections filtering

* Fix adding question to dashboard without access

* Remove redundant state field

* Enable #15281 issue repro test

* Remove requireCollectionWritePermission prop

* Filter items user doesn't have `write` access to

* Fix permission tests

* Fix dashboard test

* Fix part of permission tests disabled for nodata user

* Bring back issue reference to Cypress test

* Remove underscore prefixes for component methods

* Test offers saving dashboard to opened collection

* Fix tests nested incorrectly

* Split dashboard permission test

* Fix suggest saving items to read-only collections

* Fix collection permission filtering

See comment:
https://github.com/metabase/metabase/pull/15613#discussion_r614460504

* Move comment

* Fix test failing due to fixed collection suggestion

* Remove `should("exist")` from Cypress tests

* Merge "adding question to dashboard" tests

* Merge similar permission tests

* Merge similar tests into one

* Use sidebar test ID in permissions test

* Select by .AdminSelect

* Remove redundant search test case

* Revert native query test

* Add React list key to ItemPicker items

* Add collection suggestions tests

* Configure Form's `overwriteOnInitialValuesChange`

* Wrap CollectionSelect with `@Collection.loadList`

When suggesting an initial collection,
we need to check a user has `write` access to it.
For that, collection objects have to be present in Redux store,
so we can retrieve a collection by ID and check the `can_write` flag

* Allow modifying CreateDashboardModal's onSave prop

* Fix collection suggestsions for new dashboard

* Fix collection suggestions when copying dashboards

* Add defaultProps to Form

* Fix SaveQuestionModal unit test

* Fix SaveQuestionModal collection suggestion

* Simplify CollectionSelect wrapper

* Fix dashboard header test selector

* Rename permission tests

* Mock HTTP requests at SaveQuestionModal test

* Pass correct params to initialCollectionId
2021-05-06 15:19:24 +03:00
Nemanja Glumac
95771ddaa2 #15922 Repro: isNull function in Custom Columns does not work (#15938) 2021-05-06 12:50:27 +02:00
Cam Saul
afd5eafad8 Druid docker image (#15873)
* Druid Docker image [WIP]

* More Druid Docker stuff [WIP]

* Test fixes 🔧

* Remove maxRowsQueuedForOrdering from query, don't think we need it

* Force test Druid host -> localhost for now

* Update sync tests for updated test data

* Revert unused changes
2021-05-05 16:40:24 -07:00
Cam Saul
a815de18d8 Add with-temp-env-var-value and with-temp-file test util macros (#15921) 2021-05-05 16:40:12 -07:00
Nemanja Glumac
69f5ccef0c #15893 Repro: Cannot use numeric value before an operator in Custom Expression (#15934) 2021-05-05 21:53:28 +02:00
Nemanja Glumac
41133d17ac #15891 Repro: Don't show Custom Expression helper when input is not in focus (#15936) 2021-05-05 21:47:03 +02:00
Howon Lee
23c6f07d8d Search 15768 15738 (#15875)
Whacks in search changes for backend needed in #15768 and #15738. Also whacks in the changes for frontend needed in #15738 but not for #15768.
2021-05-05 10:58:56 -07:00
Nemanja Glumac
3542180d84 Fix react/jsx-key errors (#15448)
* Handle errors in `ColorSchemeWidget.jsx`

* Handle errors in `audit_app/routes.jsx`

* Fix missing key prop warnings

* Turn on `react/jsx-key` lint rule

Co-authored-by: alxnddr <alxnddr@gmail.com>
2021-05-05 19:32:39 +02:00
Nemanja Glumac
8d37c85eea Merge split e2e ci groups from release branch (cherry-pick from release-x.39.x) (#15932)
* Allow multiple `--spec` arguments in Cypress `run` command (#15917)

* Split e2e CI groups (#15924)

* Add option to choose between source-folder and test-files in CCI

* Rearrange Cypress files

* Split e2e workflows

* Split native queries into a separate CI group
2021-05-05 18:29:48 +02:00
Nemanja Glumac
fc3a527953 Split e2e CI groups (#15924)
* Add option to choose between source-folder and test-files in CCI

* Rearrange Cypress files

* Split e2e workflows

* Split native queries into a separate CI group
2021-05-05 18:00:15 +02:00
Anton Kulyk
964a80404d Make it more difficult to change Site URL (#15849)
* Change site-url description copy

* Display part of site-url description as bold text

* Replace custom description with warningMessage prop
2021-05-05 13:11:28 +03:00
Jeff Evans
8a596208cc Change applicationName to include local process identifier for SQL Server connections (#15908)
Similar to #15664, update the applicationName to include the local process identifier

Updating test accordingly
2021-05-04 17:23:45 -05:00
Nemanja Glumac
f5f07e3dc4 Allow multiple --spec arguments in Cypress run command (#15917)
* Extract `printBold()` function

* Allow multiple `--spec` arguments
2021-05-04 23:01:53 +02:00
Jeff Evans
6987567cf6 Fix flaky diagnostic-info-capture-test (#15920)
How does Lisp work, again?
2021-05-04 15:08:24 -05:00
Luis Paolini
db613e4458 Add hidden embedding parameters to the documentation (#15739)
* Update 13-embedding.md

* Update docs/administration-guide/13-embedding.md

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

* Update 13-embedding.md

* Update docs/administration-guide/13-embedding.md

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

* Update docs/administration-guide/13-embedding.md

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-05-04 13:01:12 -07:00
Luis Paolini
8e19ffc4e1 Update running-the-metabase-mac-app.md (#15735) 2021-05-04 13:01:06 -07:00
Luis Paolini
662a722d96 Update environment-variables.md (#15340)
* Update environment-variables.md

* Update docs/operations-guide/environment-variables.md

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

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-05-04 13:01:00 -07:00
Ariya Hidayat
d0fed8e0aa Custom expression: consistent message for missing parentheses (#15910) 2021-05-04 12:53:42 -07:00
Luis Paolini
bb87338bba Update helper_text_strings.js (#15906) 2021-05-04 15:04:49 -03:00
dpsutton
b718069354 Collections metadata backend work (#15718)
* Provide `:last-edit-info` information on collection items

only provided for cards and dashboards. At the moment, collections can
have:
- cards (☑️)
- dashboards (☑️)
- snippets (❌)(not in UI)
- pulses (❌)(deprecated)
- other collection (💪 to be done. needs a table for these
changes. they are revisioned)

* Send edit info along with cards

* Last-edit-info on dashboards

* Move last-edit-info functions into a bespoke namespace under revision

Under revision as the source of changes all come from revisions at the
moment. This might be ill-considered once we add collections into the
mix since they are not good candidates for revisions.

* Renames and docstring update on the last-edit namespace

* Add types

* Add `:last-edit-info` on card and dashboard creation

* Expect last-edit-info in creation repsonse for cards/dashboard

* Docstring on last-edit types

* Make the namespace checker happy

* namespace checker

* Remove moved function

* Add edit info to api/card/ and api/dashboard/

* Move event emission outside of transaction
2021-05-04 11:35:22 -05:00
Walter Leibbrandt
69a8eff9ea Reorder test setup so that outer with-secret-key uses test driver (#15911) 2021-05-04 03:48:32 +02:00
Noah Moss
e02187e5e5 Return 401 on auth failure instead of 400 (#15883)
* Change 400 errors to 401s on failed authentication

* remove TODO comment

* return 401 for expired JWT in enterprise code

* keep existing exception message when JWT is expired

* fix test failures

* remove comment about timeout on CI that's no longer relevant
2021-05-03 13:35:48 -07:00
Nemanja Glumac
d83cd8f05e Merge e2e CI improvements from the release-x.39.x branch (#15907)
* Improve Cypress runner command line config (#15854)

* Rename Cypress CI groups to `e2e-tests` (#15877)

* Remove the `node` parameter from Cypress CI job matrix (#15878)

* Merge EE Cypress tests with the OSS ones (#15887)

* Reorganize test folder: Move e2e support files into a separate folder (#15899)

* Refine CI checksum calculation - extract e2e files (#15900)
2021-05-03 22:00:32 +02:00
Walter Leibbrandt
a676a1a094 Handle token-like values in encryption key rotation (#15796)
Co-authored-by: Raimon Grau <raimonster@gmail.com>
2021-05-03 19:37:23 +01:00
Jeff Evans
47ab8f2292 Capture and log diagnostic info about DW connection pools (#15682)
Add new namespace to manage diagnostic info about the DW DB connection pools

Adding new atom/fn/macro to wrap the capture of diagnostic info, modeled after the call counting functionality of toucan.db

Capturing diagnostic info from a new `datasource-with-diagnostic-info!` fn in the execute namespace, and calling that from the various drivers (instead of `datasource`)

Adding to log message generated for the "stats" portion of the line logged via middleware to output this information
2021-05-03 13:01:51 -05:00
Nemanja Glumac
4829a8c3dd Refine CI checksum calculation - extract e2e files (#15900)
* Move assets inside `e2e` folder

* Separate checksum calculation for e2e files

* Fix logo path

* Remove whitespace character from the test title
2021-05-03 17:54:20 +02:00
Ariya Hidayat
0684bc6d76 Custom expression: tweak error messages (#15890) 2021-05-03 08:50:45 -07:00
Nemanja Glumac
cf77e306fe Reorganize test folder: Move e2e support files into a separate folder (#15899) 2021-05-03 14:22:31 +02:00
Ariya Hidayat
4615909de3 Custom expression: refactor the logic for the help text (#15897)
Use the lexical determination of enclosing function, which makes it more
robust agains syntax error or incompleteness. Also, increase the test
coverage.

* Fix testing the operator

* Offer the help text upon a complete field reference (with some tests)
2021-05-02 13:59:04 -07:00
Ariya Hidayat
1c8292f398 Custom expression suggestion: refactor the logic for partial matching (#15889)
Add some more extensive unit tests.

* Test for operator, not whitespace
2021-05-01 18:58:27 -07:00
Ariya Hidayat
2e2e5c2463 Waterfall test: use absolute date range (#15895) (#15896)
This ensures that the test is deterministic, i.e not exhibiting different
behavior relative to the current date.
2021-05-01 18:57:50 -07:00
Ariya Hidayat
47c765d2f2 Waterfall test: use absolute date range (#15895) (#15896)
This ensures that the test is deterministic, i.e not exhibiting different
behavior relative to the current date.
2021-05-01 17:00:07 -07:00
Ariya Hidayat
8a597c6e4d Waterfall test: use absolute date range (#15895)
This ensures that the test is deterministic, i.e not exhibiting different
behavior relative to the current date.
2021-05-01 14:09:06 -07:00
Nemanja Glumac
9c0db5e0a1 Merge EE Cypress tests with the OSS ones (#15887)
* Merge all enterprise specs together with the OSS ones

* Move whitelabel under `/admin/settings`

* Move specs under `/admin/audit` folder

* Merge `admin/database/add` specs

* Group snippets

* Merge OSS and EE sso specs

* Move sandboxes under `admin/permissions`

* Delete custom drill-throughs spec

* Return boolean value

* Use `Cypress.env` instead of global vars

* Delete empty spec

* Update paths for `eslint` script
2021-05-01 15:21:37 +02:00
Alexander Lesnenko
ec207f29b5 fix groups not updating after a change (#15888) 2021-04-30 23:37:06 -07:00
Tim Macdonald
c05e6aaa15 Search for filter values in questions with contains, not starts-with (#15879)
[Fixes #8219]
2021-04-30 15:00:42 -05:00
Howon Lee
b5a427b49f Admin people pagination backend (#15687)
* limit and offset work upon hand exercise

* limit added

* add the test

* docstring is wrong make it not wrong

* fix namespace decl

* they were test bugs only

* stick that limit and offset in there

* Permissions imports

* make it work in dbs that are not just h2

* add limit test get

* needs integer

* juice the coverity lol

* just stick querying in the overall dealie

* tests pass

* add counter

* rip out the clauses

* not just if limited

* docstring misplaced

* more linting

* cool tests

* tests pass but lacking test lol

* group id works

* test works

* fix jeff nits

* break that api

* add test for count

* cypress works for some reason lol

* fix capitalizations

* admin people pagination frontend (#15821)

* admin people pagination frontend

* admin people pagination and search specs

* address review comments

* fix rebase

* address review comments

Co-authored-by: Alexander Lesnenko <alxnddr@users.noreply.github.com>
2021-04-30 22:26:41 +03:00
Nemanja Glumac
784b5a76e3 Remove the node parameter from Cypress CI job matrix (#15878) 2021-04-30 20:54:39 +02:00
Jeff Bruemmer
e936139e2a docs - database connections (#15856) 2021-04-30 11:45:55 -07:00
Ariya Hidayat
274be949d5 Use GitHub Actions to run front-end tests (#15507) 2021-04-30 11:15:40 -07:00
Nemanja Glumac
28723ac283 Rename Cypress CI groups to e2e-tests (#15877) 2021-04-30 20:13:42 +02:00
Luis Paolini
9a6d5f7835 Delete whitespaces to fix be-linter-bikeshed (#15880)
Co-authored-by: Nemanja <31325167+nemanjaglumac@users.noreply.github.com>
2021-04-30 19:46:32 +02:00
Paul Rosenzweig
cba3acc77e include new line before source hash in version.properties (#15881) 2021-04-30 13:44:13 -04:00
Ariya Hidayat
8df9d954ec Custom expression editor: correctly accept the suggestion (#15872)
This is carried out via lexical replacement, i.e. finding the token to
be replaced, instead of the rather-brittle and often-incorrect regex for
prefix/postfix.

* Always place the caret after the replacement text

* Only accept suggested "(" when there is no forthcoming "(" already
2021-04-30 10:27:54 -07:00
Ariya Hidayat
d6a2b32f18 Cap the method cyclomatic complexity in the front-end code (#15871)
As we progress better with refactoring and simplification, the
complexity threshold should be reduced as well.
2021-04-30 08:29:53 -07:00
Alexander Lesnenko
77f71047cd fix funnel dashboard card overflow (#15869) 2021-04-30 03:32:23 +03:00
Noah Moss
1762578a46 Minor copy-editing in information collection docs (#15852) 2021-04-29 11:33:38 -07:00
Luis Paolini
251628e433 Adding the changes from 15780 (#15868) 2021-04-29 15:16:14 -03:00
Luis Paolini
740161c04e Add new endpoints in .39 (#15823) 2021-04-29 14:34:17 -03:00
Luis Paolini
10ddc5172b Update API key documentation (#15780)
* Update notify.clj

* Update auth.clj
2021-04-29 14:27:21 -03:00
Dalton
6324cefc73 set Example <pre> overflow to auto (#15859) 2021-04-29 10:00:59 -07:00
Alexander Lesnenko
b889d81fa2 fix incorrect selection range in expression triggers popover (#15865) 2021-04-29 18:32:42 +03:00
Ariya Hidayat
1e4ca55dcf Cypress: also open DevTools when using Chromium (#15864) 2021-04-29 08:31:07 -07:00
Nemanja Glumac
ef2cc2a4b2 Improve Cypress runner command line config (#15854) 2021-04-29 17:29:56 +02:00
Ariya Hidayat
b360880651 Custom expression: First cut at removing operator suggestions (#15839) 2021-04-28 12:53:26 -07:00
Jeff Evans
77862352a7 Serialization: support dashboard cards being in a different collection (#15842)
Make the load multimethod return a function, which serves as a "reload function", to be called after the first entire pass is complete (via cmd)

Updating various places to combine these functions together and invoke at the top level from cmd.clj when load finishes

Updating dashboard load implementation to check for presence of cards referred to by its dashcards, and if missing, reload those dashboards(s) on a second pass

Splitting out a separate load-dashboards fn that contains the bulk of the body from the previous multimethod implementation (which now delegates to it) to support easier reload functionality
2021-04-28 14:15:51 -05:00
Dalton
ee82ff40f4 make TableInteractive cell more button-like (#15833)
* replace onMouseUp with onClick

* make TableInteractive cell keyboard accessible
2021-04-28 09:31:23 -07:00
Ariya Hidayat
6ec336fd45 Use GitHub Actions to run smoke tests (#15792) 2021-04-28 09:27:56 -07:00
Anton Kulyk
e51e90e02d Fix sidebar loading causes UI jump (#15719)
* Fix sidebar loading causes UI jump

* Fix sidebar blinks betweed data refreshes

* Replace `...` with `…` character

* Test collection is open immediately after moving

* Update sidebar children cypress selector

* Add comment about sidebar's loadingAndErrorWrapper

* Fix typo

* Add role props to sidebar and its children
2021-04-28 12:11:41 +03:00
Anton Kulyk
ebf0f39ae2 Fix not possible to select pinned collection items using checkbox (#15826) 2021-04-28 09:36:10 +03:00
Ariya Hidayat
9bb6e83f64 Custom expression tokenizer shouldn't barf on undefined char (#15845) 2021-04-27 17:45:48 -07:00
Alexander Lesnenko
72ecddef9f Fix-broken-ref (#15846)
An example of failed smoke tests run prior to this fix: https://app.circleci.com/pipelines/github/metabase/metabase/15496/workflows/d4937774-3ef6-412b-a7c8-a6b9e47b5515/jobs/594197
2021-04-28 02:33:56 +02:00
Cam Saul
6beba48698 Merge pull request from GHSA-m29w-4r8p-v657 2021-04-27 15:18:32 -07:00
Ariya Hidayat
60d861a663 Custom expression: display only one error message (#15818)
It's terrifying to see lots of error messages when the expression is
invalid or not completed yet. To overcome this, we display only one, the
highest-priority and most friendly one. The rank is:
* tokenization error, e.g. mismatched parentheses
* type-checking error, e.g. incorrect count of function arguments
* syntax error (from the parser)

* Fix coding style issue

* Robust against non-Array compileError
2021-04-27 13:45:56 -07:00
Noah Moss
d1f1e8546b Small grammar/typo fixes in developers guide (#15836)
* fix grammar in developers guide

* more small dev guide fixes
2021-04-27 12:47:07 -07:00
Nemanja Glumac
cbda9c5ae2 #13217 Repro: Custom Field concat only shows filter options as numeric (#15830) 2021-04-27 17:26:56 +02:00
Nemanja Glumac
0bdbd391e6 #14307 Repro: User shouldn't have to scroll to see the add-filter button in the popover (#15827) 2021-04-27 15:49:07 +02:00
Nemanja Glumac
cdf676f10f #13095 Repro: Data point values uses formatting style of first serie on all series (#15825) 2021-04-27 15:16:06 +02:00
Luis Paolini
ddfac7edf2 Update .ebextensions (add Cloudwatch agent & AWS Inspector) (#14718)
* Update .ebextensions to send memory usage to Cloudwatch and also install inspector agent to actively monitor threats. Added full Cloudwatch agent with metrics config, simplified config file. Fix #9021

* Adding a few items to documentation

* Apply suggestions from code review

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

* Add a few more changes to finish this PR

Co-authored-by: Jeff Bruemmer <jeff@metabase.com>
2021-04-26 21:37:40 -03:00
Jeff Evans
478ec730cc Set c3p0 dataSourceName property to include Metabase specific info (#15681)
Set c3p0 dataSourceName property to include Metabase specific info

Change data-warehouse-connection-pool-properties multimethod to include database as 2nd param

Setting the dataSourceName c3p0 property to have the format db-<N>-<D>-<DB> where <N> is the DW database ID, <D> is the driver name, and <DB> is the database name from the db details

Adding test

Setting c3p0 dataSourceName for the app DB pool as well
2021-04-26 15:56:57 -05:00
Gustavo Saiani
0fa915db0b Fix typo in documentation (#15798) 2021-04-26 12:08:05 -07:00
Nemanja Glumac
88e84de311 #9772 Repro: View only user cannot resize column width (#15815) 2021-04-26 21:01:25 +02:00
Nemanja Glumac
91d8fc60a0 #15620 Repro: Filter doesn't work on twice summarized questions (#15810) 2021-04-26 20:12:57 +02:00
Nemanja Glumac
5d2d591573 #13122 Repro: Custom Column does not maintain data type (#15811)
* Add repro for #13122

* Skip all versions of the repro for #15734
2021-04-26 20:12:04 +02:00
Nemanja Glumac
288acbd5d7 #15393 Repro: Cannot add new columns after hiding some (#15813) 2021-04-26 19:12:00 +02:00
Ariya Hidayat
420e7be80a Custom expression: friendlier message on failing tokenization (#15787)
* Custom expression: friendlier message on failing tokenization

This covers cases such as:
* invalid characters
* unterminated quoted string
* unterminated bracket/field reference

* Ensure that tokenizerError is initialized properly
2021-04-26 08:40:55 -07:00
Alexander Lesnenko
68a392350c remove flow suppressions (#15805) 2021-04-26 18:36:47 +03:00
Ariya Hidayat
85013a9055 Custom expression: allow parenthesized logical operations (#15802) 2021-04-26 08:36:37 -07:00
Nemanja Glumac
b1fca6f815 #15808 Repro: Cannot add filter for an integer field in a question based on a saved native question (#15809)
* Add `data-testid` for the left and right sidebar for the GUI questions

* Add repro for #15808
2021-04-26 17:01:47 +02:00
Nemanja Glumac
c2e509edcc #15734 Repro: Contenteditable field losing value and resetting CC formula (#15736)
* Add repro for #15734

* Expand the test to cover all 3 scenarios
2021-04-26 14:19:45 +02:00
Nemanja Glumac
8888de3342 [SCHEDULED, Week 19] Fix react/no-string-refs errors (#15547)
* Fix `eslint-react/no-string-refs` errors (#15427)

* Handle errors in `AdminLayout.jsx`

* Rmove unused ref from `MetadataEditorApp.jsx`

* Remove unused ref from `EditBar.jsx`

* Handle errors in `Confirm.jsx`

* Handle errors in `Header.jsx`

* Handle errors in `NewsletterForm.jsx`

* Handle errors in `ColorPicker.jsx`

* Remove unused ref from `PasswordReveal.jsx`

* Handle errors in `Triggerable.jsx`

* Handle errors in `TokenField.jsx`

* Handle errors in `DashboardHeader.jsx`

* Handle errors in `RefreshWidget.jsx`

* Handle errors in `DatabaseEditApp.jsx`

* Handle errors in `FieldRemapping.jsx`

* Handle errors in `ObjectActionsSelect.jsx`

* Handle errors in `ObjectRetireModal.jsx`

* Remove unused ref from `UserGroupSelect.jsx`

* Handle errors in `PermissionsGrid.jsx`

* Handle errors in `ParameterTargetWidget.jsx`

* Handle errors in `ParameterValueWidget.jsx`

* Handle errors in `PulseEdit.jsx`

* Handle errors in `PulseEditName.jsx`

* Handle errors in `DataSelector.jsx`

* Remove unused ref from `FieldWidget.jsx`

* Handle errors in `NativeQueryEditor.jsx`

* Handle errors in `SearchBar.jsx`

* Handle errors in `ExpressionEditorTextfield.jsx`

* Remove unused ref from `FieldWidget.jsx`

* Remove unused ref from `SpecificDatePicker.jsx`

* Handle errors in `RevisionMessageModal.jsx`

* Handle errors in `Setup.jsx`

* Handle errors in `LeafletMap.jsx`

* Handle errors in `TableSimple.jsx`

* Handle errors in `PieChart.jsx`

* Handle errors in `Progress.jsx`

* Remove unused refs from `QueryBuilder.jsx`

* Remove unused ref and methods from `MetadataHeader.jsx`

* Remove unused ref from `DashboardActions.jsx`

* Handle errors in `DatabaseListApp.jsx`

Note: dynamic refs

* Handle errors in `LegendHorizontal.jsx`

Note: dynamic refs

* Disable linting rule `react/no-string-refs` in `LegendVertical.jsx`

Note: dynamic refs

* Partially handle errors in `GuiQueryEditor.jsx`

* Disable linting rule `react/no-string-refs` in `GuiQueryEditor.jsx`

Note: dynamic refs

* Revert "Remove unused ref from `DashboardActions.jsx`"

This reverts commit 5facb9d60e.

* Handle errors in `DashboardActions.jsx`

* Remove redundant `ReactDOM.findDOMNode` from `Setup.jsx`

* Revert "Handle errors in `DashboardActions.jsx`"

This reverts commit b3d64b8f7a.

* Disable linting for `DashboardActions.jsx`

* Fix prettier error

* Delete non-existing prop `getTarget`

* Fix typo

* Fix typos in more places

* Fix `footerRef` check

* Turn on `react/no-string-refs` lint rule

* Disable `react/prop-types` in files that are breaking the build

* Fix broken refs

Co-authored-by: alxnddr <alxnddr@gmail.com>
2021-04-26 14:15:50 +02:00
Nemanja Glumac
f16c811e1c #15785 Repro: Tooltip shows incorrect values on unaggregated data with breakout (#15788) 2021-04-26 12:15:34 +02:00
Nemanja Glumac
0d0868bc9f #15465 Repro: Waterfall visualization is not working with unaggregated data (#15786) 2021-04-26 11:29:32 +02:00
Ariya Hidayat
64e70c91a7 Custom expression: friendlier message on mismatched parentheses (#15775) 2021-04-23 11:19:25 -07:00
Ariya Hidayat
1f4ff05945 Custom expression: a new exception-free, safe (bounded) tokenizer (#15659)
* Custom expression: a new exception-free, safe (bounded) tokenizer

* Address code review feedback
2021-04-23 11:10:21 -07:00
Paul Rosenzweig
c01d8d1462 look for column by id rather than first PK (#15779) 2021-04-23 13:30:02 -04:00
Alexander Lesnenko
1bb847cae6 Cherry pick fix tooltip on unaggregated data (#15783)
* Revert "Fix tooltip value on unaggregated data (#15472)"

This reverts commit 057b6bbc35.

* Fix wrong tooltip on charts with unaggregated data

* unskip repro for #11907

* temporary set resize throttling to 0 when the app is open in Cypress to reduce flakiness
2021-04-23 20:14:16 +03:00
Alexander Lesnenko
9c8fa21967 Fix wrong tooltip on charts with unaggregated data (#15778)
* Fix wrong tooltip on charts with unaggregated data

* unskip repro for 11907
2021-04-23 20:11:15 +03:00
Dalton
c0b72ce047 Add a basic ClampedText UI component (#15723)
* Add a basic ClampedText UI component

* sprinkle some classes

* rmv some unneeded css props

* update component section

* make line-breaks work correctly

* fix prop type error

* safeguard ref reference
2021-04-23 10:03:45 -07:00
Dalton
85360241db add timeline component (#15777)
* add timeline component

* rmv BEM classes
2021-04-23 10:03:33 -07:00
Alexander Lesnenko
ecbeb81566 temporary set resize throttling to 0 when the app is open in Cypress to reduce flakiness (#15522) 2021-04-23 18:38:47 +03:00
Nemanja Glumac
cf8e99a761 Fix alignment of company logo when whitelabelling is turned on (#15755) 2021-04-23 14:48:44 +02:00
dpsutton
a88351d7af Rename collection revision (#15616)
* Table collection_revision -> collection_permission_graph_revision

in anticipation of getting collection revisions in, need the table
name as the previous table named this was tracking changes to the
permission graph

* rename collection permission graph revision alias

* Remove unnecessary or for precondition

* Rename sequence in sql

liquibase has a renameSequence changeset but it doesn't work for h2
obviously. However, it doesn't allow this constraint to be honored
with a precondition. Just having this changeset on h2 blows up
2021-04-22 22:52:24 -05:00
Nemanja Glumac
43bf107dc1 #15754 Repro: Can't use parentheses as expected in filter expressions (#15758) 2021-04-22 22:13:31 +02:00
Nemanja Glumac
a6e7df3c58 #15748 Repro: Custom Expression filter is showing a reference to the field id (#15757) 2021-04-22 21:28:44 +02:00
Dalton
e4e1587546 add icons for bucm (#15717)
* add icons for bucm

* 32px wide icons

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-04-22 11:18:58 -07:00
Ariya Hidayat
b0c9940d2a CI GitHub Actions: No need to mark Java >= 15 as known issue anymore (#15750) 2021-04-22 11:18:39 -07:00
Nemanja Glumac
9a6e4031f8 #15744 Repro: Dashboard subscriptions don't include text cards (#15749) 2021-04-22 19:56:49 +02:00
Nemanja Glumac
54dd79ec56 #15737 Repro: X-Rays auto generated titles contain "null" (#15751) 2021-04-22 19:55:49 +02:00
Nemanja Glumac
8de7412069 #15741 Repro: Custom expressions don't recognize floating point numbers with 0 omitted (#15753) 2021-04-22 19:49:54 +02:00
Cam Saul
d5dadaa6bf Merge pull request #15721 from metabase/release-x.39.x
Merge `release-x.39.x` to `master`
2021-04-22 10:11:48 -07:00
Nemanja Glumac
fee8834606 #15725 Repro: Summarize on saved question drops user defined metric (#15747)
* Add repro for 15725

* Test both repro steps scenarios
2021-04-22 16:38:22 +02:00
Anton Kulyk
7007d6b7a1 Fix collections page loads slowly if contains lots of data (#15715)
* Optimize hasChildren collection check

* Extract ItemList renderItem method

* Optimize VirtualizedList

* Fix collection page scroll behavior

* Remove redundant import
2021-04-22 13:23:20 +03:00
Ariya Hidayat
007c5353b3 Correct the arguments for PERCENTILE function (#15724)
This fixes #15714
2021-04-21 19:36:44 -07:00
Nemanja Glumac
05b4011f71 #15694 Repro: Dashboard filter shows placeholder instead of expected value for translated languages (#15729)
Co-authored-by: flamber <1447303+flamber@users.noreply.github.com>
2021-04-22 00:46:15 +02:00
Nemanja Glumac
79b9fb1be1 #15705 Repro: Dashboard subscription fails when using default dashboard filter value on native query with required parameter (#15727)
* Use real SMTP instead of a dummy one

* Add repro for #15705
2021-04-21 22:43:09 +02:00
Cam Saul
43eff56581 Switch from Nashorn to GraalVM JS engine; support Java 15+ (#15708)
* Run tests on Java 8 again (fix #15707); run tests against Java 16

* Switch from Nashorn to GraalVM JS engine

* Remove unused var
2021-04-21 13:40:38 -07:00
Nemanja Glumac
22d46412bc Add repro for #15714 (#15722) 2021-04-21 12:40:32 -07:00
Nemanja Glumac
e01bebc15e #15655 Repro: X-rays from a nested question fail (#15684)
* Test both action items
2021-04-21 16:02:57 +02:00
Nemanja Glumac
eb65eaf8d7 Test sandboxed dashboard subscriptions (#15686) 2021-04-21 14:32:46 +02:00
Nemanja Glumac
c9cff672f1 #15695 Repro: Dashboard filters only search the first 100 values (#15703) 2021-04-21 11:07:39 +02:00
Alexander Lesnenko
785060d44a Move dashboard card action buttons in a popover (#15623)
* move dashboard card action buttons in a popover

* add more top margin for actions menu when editing dashboard, fix tests

* Fix spec broken due to changed height of dashboard cards
2021-04-21 01:34:19 +03:00
Nemanja Glumac
47bb5f2d5f Add repro for #15700 (#15702) 2021-04-20 14:17:47 -07:00
Dalton
820762f0e9 add category/location options back to meta/Parameter options (#15701) 2021-04-20 12:57:30 -07:00
Nemanja Glumac
07d1592610 #15689 Repro: Dashboard filters should allow multiple selections (#15699) 2021-04-20 21:14:24 +02:00
Dalton
892467bca4 map category/location to string so we can treat them like string/= in UI (#15698)
* map category/location to string so we can treat them like string/= in UI

* update associated unit test
2021-04-20 11:11:07 -07:00
Nemanja Glumac
950237e67d #15648 Repro: Binning on values from joined table should work (#15691) 2021-04-20 19:38:27 +02:00
Cam Saul
5e40366a59 Build script fixes 🔧 2021-04-19 17:22:20 -07:00
Cam Saul
6df0c91849 Merge 38.4 (except for #15472) into release-x.39.x 2021-04-19 16:41:30 -07:00
Cam Saul
53cd03ceba Merge commit '32af568' into merge-32af568 2021-04-19 15:58:46 -07:00
Nemanja Glumac
495e48964b Fix react/no-children-prop errors (#15546)
* Fix `react/no-children-prop` error (#15122)

* Turn on `react/no-children-prop` lint rule
2021-04-19 23:03:00 +02:00
Anton Kulyk
2845ccc33b Fix archived personal sub-collections are displayed in the sidebar (#15674)
* Enable #15343 repro test

* Rearrange CollectionSidebar methods

* Remove comment

* Fix sidebar lists archived personal collections

* Fix collection expand button is visible

Reproduced if collection's children were archived
2021-04-20 00:01:34 +03:00
Cam Saul
94c0ebbf6d Include application identifier in pg connections (#15664)
* Change PG app name to version + process uuid e.g. `Metabase v0.39.1-SNAPSHOT [04d518eb-df2d-4781-93b3-8701286fd45e]`

* Code cleanup

* Test fixes 🔧
2021-04-19 13:56:36 -07:00
Anton Kulyk
bca1745b09 Return "Duplicate" action for read-only dashboards (#15652)
* Return "Duplicate" action for read-only dashboards

* Remove findEllipsisMenuFor test utility

* Test can copy dashboard in read-only collection

* Remove test for wrong behavior
2021-04-19 23:13:12 +03:00
Anton Kulyk
313113150d Fix dashboard and question actions visibility depending on user's permissions (#15654)
* Fix dashboard edit action visibility

Hiding "Change title and description" from users with read-only access to dashboard

* Fix dashboard archive action visibility

Hiding "Archive" action from users with read-only permission to dashboard

* Enable #13229 repro test

* Test user with read permissions can't revert question history

* Fix user with read-only permissions sees revert buttons
2021-04-19 20:57:50 +03:00
Anton Kulyk
a721a558ba Fix "select all" button in collections footer (#15670) (#15676)
* Enable test reproducing #14705

* Test can deselect all items using bulk actions

* Fix bulk select button in collections footer

* Group bulk select tests, use data-testid

* Group bulk actions tests into one
2021-04-19 20:51:40 +03:00
Nemanja Glumac
8c3201e4ea Enable maildev SMTP server in CI for Cypress tests (#15665)
* Add SMTP server for testing

* Try running maildev in the default executor for Cypress

* Add first email-based Cypress test

* Try different ports

* Stop using ENVs for maildev

* Use camelCase for `const`

Co-authored-by: Luis Paolini <paoliniluis@gmail.com>
2021-04-19 18:36:08 +02:00
Anton Kulyk
1723ea443f Fix "select all" button in collections footer (#15670)
* Enable test reproducing #14705

* Test can deselect all items using bulk actions

* Fix bulk select button in collections footer

* Group bulk select tests, use data-testid

* Group bulk actions tests into one
2021-04-19 18:57:23 +03:00
Raimon Grau
390a085e1a Fix typo (#15669) 2021-04-19 12:54:26 +01:00
Nemanja Glumac
03398cd683 #15598: Data reference database list is unsorted (#15631)
* Add custom command for adding another H2 Sample Dataset

* Add repro for #15598

* Expand test coverage for different UIs
2021-04-17 19:46:21 +02:00
Alexander Lesnenko
693dec2634 fix missing x-axis in Firefox because of wrong positioning of empty svg groups which led to miscalculations (#15661) 2021-04-16 23:20:02 +03:00
dpsutton
899467c331 Munge setting names (#15640)
* Watch for munge collisions

* Always have to check for munge collisions

was thinking only in the case where munging made a difference did we
have to check, but if the first one defined is foo? -> foo as the
munge, defining foo later will cause a collision

* Prettier fix
2021-04-16 12:46:02 -05:00
Alexander Lesnenko
abea595cb6 Fix image width on Text Cards to use max-width (#15653)
Co-authored-by: Natalie Casey <ncasey@faros.ai>
2021-04-16 20:00:00 +03:00
Nemanja Glumac
82c3b834d3 Unskip repro for #15591 (#15643) 2021-04-16 02:18:51 +02:00
Dalton
75e0da350c add sizeToFit to DimensionList popover (#15645) 2021-04-15 16:21:34 -07:00
Cam Saul
b610662152 Remove unused ./bin/deploy-webhook script (#15639) 2021-04-15 15:58:53 -07:00
Jeff Bruemmer
36fd740821 doc - clarify IE11 support (#15644) 2021-04-15 15:18:14 -07:00
Jeff Bruemmer
49683fd030 docs - drop support for IE 11 (#15641) 2021-04-15 14:41:08 -07:00
Dalton
82722c9817 revert to pre react 16 popover and calc popover height before tether positions things(#15608)
* revert popover to before react 16 changes

* move tether/sizeToFit logic to render callback

* set ParameterFieldWidget free

* add debounce to maxheight futzing

* do popover height calc BEFORE updating tether when attached above target

* do height calcs for both top/bottom before tether stuff

* ignore tetherOptions prop
2021-04-15 13:39:47 -07:00
Nemanja Glumac
9c3e21522f #15612 Repro: Wrong tooltip labels and values for multiple series charts in dashboard (#15638) 2021-04-15 22:10:12 +02:00
Anton Kulyk
441d9d1a35 Fix collections without subcollections have an expand arrow (#15626)
* Fix collections without children have expand arrow

* Bring back issue reference to Cypress test
2021-04-15 20:16:35 +03:00
Dalton
5529e1ce79 Replace "Other Categories" with "Text or Category" section (#15557)
* add string parameter to dashboards instead of replacing location/category

* merge category and string sections

* make location options strings when flag flipped

* update strings in cy tests

* filter location fields when using text/category parameter

* Microcopy tweaks

* update more cy strings

* replace location switch default with isLocation

Co-authored-by: Maz Ameli <maz@metabase.com>
2021-04-15 09:43:38 -07:00
Maz Ameli
fe9903b3d5 update translations and the import script (#15630) 2021-04-15 09:43:17 -07:00
Nemanja Glumac
9a2ae40cc2 Add Cypress test for typeahead search (#15629) 2021-04-15 14:48:16 +02:00
Jeff Evans
65e1c01e85 Fix settings left-hand nav being in opposite order in EE edition (#15607)
Updated the updateSectionsWithPlugins fn to sort the sections again after reducing by PLUGIN_ADMIN_SETTINGS_UPDATES, because those update functions might change the order of keys

Adding explicit order property for the items in SECTIONS to facilitate that re-sorting

Fix expected property type for SettingsEditorApp sections (which is truly an object, not an array), and fixed the null case accordingly

Incorporate Cypress test written by Nemanja

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2021-04-14 21:38:15 -05:00
Howon Lee
8576dce44c Fullscreen scroll fix #15596 (#15621)
Scrolling gets disabled for the modal and then is supposed to be reenabled when modal is closed. However, SandboxedPortal eats the events that would tell the modal to go and do this. Do it on React lifecycle bits instead.
2021-04-14 17:51:51 -07:00
Nemanja Glumac
612a0fc7d8 Fix (or at least greatly reduce) flakiness of custom_column.cy.spec.js (#15622) 2021-04-15 01:03:42 +02:00
Nemanja Glumac
4ddcc00163 Fix data_ref.cy.spec.js flake (#15619) 2021-04-14 23:09:00 +02:00
Nemanja Glumac
33f83a84c7 #15578 Repro: Remapped columns failure in joined subquestions (#15617) 2021-04-14 22:12:55 +02:00
Tim Macdonald
b5d6ce822b Make search typeahead available to non-admins (#15614)
Bit of context here:
https://metaboat.slack.com/archives/C505ZNNH4/p1618417989013200
2021-04-14 14:20:19 -05:00
Nemanja Glumac
aa5d18c6ad #15591 Repro: Data selector popover is too small (#15597) 2021-04-14 20:06:18 +02:00
Nemanja Glumac
8384a1c111 #15596 Repro: Not possible to scroll vertically after fullscreen layer is closed (#15601) 2021-04-14 19:55:53 +02:00
Alexander Lesnenko
9ddaac7779 fix inability to filter by a field of a joined table (#15605)
* fix inability to filter by a field of a joined table

* fix filtering by columns of other tables in the simple question mode
2021-04-14 20:10:40 +03:00
Tim Macdonald
6824fad005 Fix archive search (#15080) (#15604)
* #15080 Repro: Archived items not shown in archive (#15198)

* /search returns archived items again [Fixes #15080]

Co-authored-by: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
2021-04-14 10:13:22 -05:00
Nemanja Glumac
2deb0c2a59 #15563 Repro: Date foreign key references produce duplicates when remapped (#15592)
* Add repro for #15563

* Fix "post-join filters" flake

* Unskip the test (fixed by #15582)

* Use explicit assertion
2021-04-14 15:28:01 +02:00
Cam Saul
9990c81f6f Fix login history emails (#15606)
* Much simpler impl

* Remove unused var

* Java 11+ test fixes 🔧
2021-04-13 18:50:14 -07:00
Howon Lee
6cb3341c91 Date breakout quicker fix #15445 (#15600)
Does not make it so window scrolling will mutate position of the second popover. However, you will be able to see the actual contents of the second popover.
2021-04-13 18:06:07 -07:00
Cam Saul
fb948981f3 Fix bad parameterized i18n template strings on FE (#15599) 2021-04-13 15:10:36 -07:00
Cam Saul
54a9e85eab CircleCI: restore backend deps cache before building uberjar FE (#15587) 2021-04-13 15:09:40 -07:00
Ariya Hidayat
65b6582efc Don't add temporal subdimensions to a FieldIDDimension (#15582)
* Don't add temporal subdimensions to a FieldIDDimension

This restores the behavior just like before MBQL field refactoring (back
when FieldIDDimension still existed).

* Adjust expectation in another test
2021-04-13 12:32:54 -07:00
Jeff Bruemmer
f25ac9244e docs - account settings page (#15583) 2021-04-13 11:54:41 -07:00
Ellie Mary
9251035612 Update Python code snippet for Python 3.7 (#14424)
This is the fastest resolution for this bug: https://github.com/metabase/metabase/issues/14423
2021-04-13 15:28:01 -03:00
Tim Macdonald
ce939219f8 Don't show duplicate descriptions in search results (#15572) 2021-04-13 13:25:18 -05:00
dpsutton
223cf250a4 Cleanup migration comment (#15594) 2021-04-13 10:36:43 -05:00
dpsutton
4910a3e279 Remove unixtimestamp type (#15533)
* Remove type/UNIX* and type/ISO8601* from frontend

* Set effective-type and coercion strategy when syncing

these values will most likely only be available when using tests, as
metadata is very unlikely to have this. As far as I can tell the
toucannery apparatus is the only bit that has this. Its quite
artificial. I'm not sure if this is a good idea.

* :type/UNIXTimestampSeconds and type/ISO8601DateTimeString out of type

remove the coercions from the type hierarchy. This brought up a
strange issue that has been present for a while: all liquidbase
migrations run and then all data migrations run. They are not
interleaved. This allows for the following scenario:

- data migration migrates all X values to Y in version 26
- liquibase migration migrates all Y values to Z in version 28

But these are not run in version order, but all liquibase migrations
are run and then all data migrations are run. If you were on an old
version for a while, you could end up with Y values even though the
liquibase migration which comes "after" the data migration turns all Y
values into Z values.

This impacts this change because a data migration in this way:
- liquibase changesets 287, 288, 289, and 290 remove all 'type/UNIX*'
and 'type/ISO8601*' semantic types. These were in 0.39
- data migration `migrate-field-types` added in 0.20.0 was looking for
special_type's of "timestamp_milliseconds" and migrating them to
"type/UNIXTimestampMilliseconds".

Since the liquibase runs before the migrate-field-types, it's possible
for a 'type/UNIX*' semantic type to reappear. And since these were
removed from the type system it would fail validation and blow up. In
this case it actually can't happen since the field its attempting to
migrate (special_type) no longer exists. But since the migrations are
not interleaved this problem still exists.

* whatever prettier

* Appease the machines

* Restore the unix and iso semantic types to hierarchy

migration tests still use these
`(impl/test-migrations [283 296] [migrate!] ...)`

A few things in tension: the field requires valid semantic_types,
these _were_ valid semantic_types until v39.

* Remove old "coercion" semantic types

* Migrate the v20 version semantic types for unix epoch

* Time travelling migrations

these target v20 and v29 which at the time they existed had a column
special type not semantic type. But these run after all of the schema
migrations, not interleaved, so they will have a semantic_type not
special_type when they actually run even though they target v20 or v29
data. strange world

* add migration's new checksum
2021-04-13 09:30:17 -05:00
Anton Kulyk
22e039bdc4 Fix Duplicate action visibile with read permission (#15573)
* Fix Duplicate action visible with read permission

For `/collection/root` page

* Fix Duplicate action visible with read permission

For `/dashboard/:id` page

* Move dashboard permission test to collection suite
2021-04-13 15:51:48 +03:00
Cam Saul
cf383c6b06 Merge pull request #15588 from metabase/merge-x.38.4
Merge x.38.4 -> release-x.39.x
2021-04-12 20:06:15 -07:00
Cam Saul
25d994dc21 Merge pull request #15589 from metabase/release-x.39.x
Merge release-x.39.x -> master 4/12/2021
2021-04-12 19:34:24 -07:00
Cam Saul
7f4ffc9347 Merge branch 'release-x.39.x' into merge-x.38.4 2021-04-12 19:23:32 -07:00
Nemanja Glumac
f06180f5aa Add repro for #15574 (#15580) 2021-04-12 15:31:29 -07:00
Howon Lee
9baaff7621 Popover movement #15502 (#15524)
Popover movement is with reference to #15502 but also with reference to #15277 and #15534 and #15502 but not #15445, except for the mutation movement portion of #15445 which is not a whole fix.

Confusingly, the overlap portion of #15502 is almost a completely separate bug but a fix is in here anyways.
2021-04-12 15:01:59 -07:00
Alexander Lesnenko
bfbc3c4516 Support both 0 and null values in a dimension for X axis (#15554)
* support both 0 and null values in a dimension for X-axis
2021-04-13 00:50:58 +03:00
Nemanja Glumac
acf71a3766 #15570 Repro: Can't create a filter on joined table (#15579) 2021-04-12 23:34:56 +02:00
Dalton
a362e2f327 Dashboard parameter field filter operators feature flag (#15519)
* Backend feature flag for new field filters

* Feature flag new parameter options

When the "field-filter-operators-enabled?" flag is disabled we do the following:
1. Replace new operator options with old category and location/city, etc., options
   in the PARAMETER_OPTIONS list found in metabase/meta/Parameter.js
2. Hide numbers section in the PARAMETER_SECTIONS list found in
   metabase/meta/Dashboard.js
3. Return args as-is in the mapUIParameterToQueryParameter function
   found in metabase/meta/Parameter.js

React/UI code handles both old options and new options so doesn't need
to change. Old parameter types like "category" and "location/city" are
treated like "string/=" in the UI but retain their own parameter type
when used to send a new query.

* Fix FE issues caused by meta/Parameter refactor

* mock the field operator param flag to make tests pass

* add/fix cypress tests

* fix import in ParametersPopover

* update widget tag type

* Enable field filter operators for cypress tests

* Question marks are questionable

* Conditionally use category or string/= if field filters are enabled

* rmv mocks where we don't need them

* rmv mock from chained-filters test

* env vars as string in project.clj, alignment

Co-authored-by: dan sutton <dan@dpsutton.com>
2021-04-12 13:04:16 -07:00
Cam Saul
aba3772c71 Request IP address logic should use X-Forwarded-For by default (#15553) 2021-04-12 11:41:18 -07:00
Jeff Evans
9392ddd7d4 Various improvements to version update checks (#15517)
* Various improvements to version update checks

***************************
* Release project changes *
***************************

Updating version_info.clj code to build version-info-ee.json file for Enterprise Edition build

Adding test for both oss and ee version info file generation logic

Decoupling GitHub milestone from version and setting it to be the OSS value for :ee release build

Adding nREPL alias for release deps.edn project and usage note

************************
* Core product changes *
************************

Adding new :ee version of :mb-version-info-url (:mb-version-info-ee-url) with default value to match the file name generated by the release code

Making enterprise-edition? public from core.clj, since it's now needed from the upgrade check code to switch between the URLs

Adding new setting to store when updates were last checked (since it's on a 12-hour interval)

Changing update check code to both set this new timestamp setting (always) to the current time, and set version-info itself to nil if the update check fails (so that users won't see "latest and greatest" if the update check succeeded at some point in the past, but then started failing

Frontend changes:

Showing the "last checked" timestamp (in user's browser timezone) when we show the "Sorry" text because of being unable to check for updates, so they know when the last check was made

Removing custom implementation of MetabaseSettings.versionInfo from EE frontend code since it's no longer needed (and never worked), because the EE backend will now be hitting a different URL with the version info specifically for EE releases

Linking to https://www.metabase.com/docs/<newVersion>/operations-guide/upgrading-metabase.html URL instead of simply /start
2021-04-12 13:34:17 -05:00
Dalton
5117a252c6 re-enable search for category and location/* params (#15556) 2021-04-12 10:02:06 -07:00
Nemanja Glumac
3423b36e6f Open Chrome dev tools in Cypress --open by default (#15569) 2021-04-12 18:42:02 +02:00
Nemanja Glumac
4b393e9ea2 Fix nested links error in BrowseHeader component (#15568) 2021-04-12 16:11:17 +02:00
Nemanja Glumac
575714be0e Fix react/no-unescaped-entities errors (#15545)
* Fix `react/no-unescaped-entities` error

* Handle untransalted string

* Turn on `react/no-unescaped-entities` lint rule
2021-04-09 20:55:32 +02:00
Nemanja Glumac
919530a86e Fix jsx/no-target-blank React errors (#15532)
* Fix `react/jsx-no-target-blank` error (#15110)

* Fix `react/jsx-no-target-blank` error

* Handle untranslated string

* Add `dataMetabaseEvent` prop to `ExternalLink`

* Update missed `ExternalLink` component in `frontend/src/metabase/query_builder/components/template_tags/TagEditorHelp.jsx` with `dataMetabaseEvent`

* Turn on `react/jsx-no-target-blank` lint rule
2021-04-09 00:29:12 +02:00
Nemanja Glumac
c29b44b94f Upgrade eslint-plugin-react (#15529)
* Upgrade `eslint-plugin-react` 

* Disable `react/prop-types` warning in stray files

* Register breaking rules and turn off warnings

* Fix wrong `eslint-disable` comment

* Fix `react/display-name` error in `NotebookCell.jsx`
2021-04-08 22:26:34 +02:00
Nemanja Glumac
11a6994d41 Merge Cypress fixes into master (#15527)
* Quarantine flaky test in `auditing.cy.spec.js` (#15501)

* Quarantine possible offenders behind CI timeouts (#15504)

* Quarantine possible offenders behind CI timeouts

* Fix brush date filter test (#15505)

* Fix flakiness in `scatter` visualization tests (#15520)

- Fixes a flake in scatter.cy.spec.js that started appearing after throttle was introduced to the ExplicitSize component in #15235
- Also fixes a flake with brush filter that apparently wasn't fully fixed in the previous attempt

## Additional Info:
- Stress testing this fix in isolation with GitHub actions shows 20/20 runs passing ✅
- Stress testing "brush date filter" revealed that it still fails approximately 4-5x out of 20!

- The reason seems to be that `mouseup` event doesn't always happen at the same time so the resulting filter doesn't have the same ending month every time (for example I've seen: "Created At between May, 2016 September, 2016", "Created At between May, 2016 July, 2016" and even "Created At between May, 2016 May, 2016")
- It is more than enough that we assert that this filter exists in the first place so I changed the assertion to: `cy.contains(/^Created At between May, 2016/);` since the beginning of this string is the only thing we care about
2021-04-08 18:27:27 +02:00
Tim Macdonald
cab052f70c Add databases to search results (#15518) 2021-04-08 09:58:34 -05:00
Alexander Lesnenko
057b6bbc35 Fix tooltip value on unaggregated data (#15472)
* fix wrong tooltip value on unaggregated data

* use reduced values from crossfilter groups inside tooltip
2021-04-08 00:46:21 +03:00
Alexander Lesnenko
32af568859 always show axis settings (#15492) 2021-04-08 00:19:49 +03:00
Alexander Lesnenko
d4f2a8814e always show axis settings (#15492) 2021-04-08 00:19:04 +03:00
4913 changed files with 555849 additions and 197680 deletions

View File

@@ -1,28 +1,30 @@
{
"plugins": [
"babel-plugin-styled-components",
"transform-flow-strip-types",
"add-react-displayname",
"transform-decorators-legacy",
["transform-builtin-extend", {
"globals": ["Error", "Array"]
}],
"syntax-trailing-function-commas"
"@emotion",
"@babel/plugin-proposal-export-default-from",
["@babel/plugin-proposal-decorators", { "legacy": true }]
],
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"presets": ["es2015", "stage-0", "react"],
"env": {
"development": {
"presets": []
},
"extract": {
"plugins": [
["ttag", {
"extract": {
"output": "locales/metabase-frontend.pot"
},
"discover": ["t", "jt"],
"numberedExpressions": true
}]
[
"ttag",
{
"extract": {
"output": "locales/metabase-frontend.pot"
},
"discover": ["t", "jt"],
"numberedExpressions": true
}
]
]
}
}

File diff suppressed because it is too large Load Diff

136
.clj-kondo/config.edn Normal file
View File

@@ -0,0 +1,136 @@
{:config-paths ["macros"]
:linters {:unresolved-symbol
{:exclude [schema= re=
(metabase.util/prog1 [<>])
(metabase.mbql.util/match-one)
(metabase.mbql.util/match)
(metabase.mbql.util.match/match)
(metabase.mbql.util.match/match-one)
(metabase.mbql.util.match/replace)
(metabase.mbql.util/replace)
(metabase.mbql.util/replace-in)
(metabase.query-processor.middleware.cache-backend.interface/with-cached-results)
(metabase.util.regex/rx [opt])
(metabase.async.streaming-response/streaming-response)
(clojure.core.logic/fresh)
(clojure.core.logic/matcha)
(clojure.core.logic/run)
(metabase.test/with-temporary-setting-values)
(clojure.test/is [query= sql=])
(toucan.util.test/with-temp*)
(metabase.test/with-temp*)
(taoensso.nippy/extend-freeze)
(taoensso.nippy/extend-thaw)
(metabase.driver.druid.query-processor-test/druid-query-returning-rows)
(clojure.tools.macro/macrolet)]}
:refer-all {:exclude [clojure.test
monger.operators]}
:unexpected-recur {:level :off}
:unused-referred-var {:exclude {compojure.core [GET DELETE POST PUT]}}
:deprecated-var {:exclude {metabase.query-processor.util/normalize-token
{:namespaces ["metabase.*"]}
metabase.driver/supports?
{:namespaces ["metabase.*"]}
metabase.driver/current-db-time
{:namespaces ["metabase.*"]}
metabase.driver.common/current-db-time-native-query
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.common/current-db-time-date-formatters
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql-jdbc.execute.old-impl/read-column
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.common/first-successful-parse
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.common/ThreadSafeSimpleDateFormat
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.common/create-db-time-formatters
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.common/current-db-time
{:namespaces ["metabase.*"]}
metabase.driver.sql.query-processor.deprecated/*field-options*
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql.query-processor.deprecated/*source-query*
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql.query-processor.deprecated/field->identifier
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql.query-processor.deprecated/field->alias
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql.query-processor.deprecated/prefix-field-alias
{:namespaces ["metabase\\.driver.*"]}
metabase.query-processor.middleware.resolve-joins/maybe-resolve-source-table
{:namespaces ["metabase.*"]}
metabase.driver.sql-jdbc.execute.old-impl/set-timezone-sq
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql-jdbc.execute.old-impl/set-timezone-sql
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql.query-processor.deprecated/*table-alias*
{:namespaces ["metabase\\.driver.*"]}
metabase.public-settings.premium-features/enable-enhancements?
{:namespaces ["metabase\\.models.*"]}
metabase.driver.sql.query-processor.deprecated/escape-alias
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql-jdbc.execute/set-time-zone-if-supported!
{:namespaces ["metabase\\.driver.*"]}
metabase.driver.sql-jdbc.sync.interface/syncable-schemas
{:namespaces ["metabase\\.driver.*"]}
schema.core/either
{:namespaces ["metabase.*"]}
schema.core/both
{:namespaces ["metabase.*"]}}}
:unresolved-var {:exclude [colorize.core]}}
:lint-as {metabase.api.common/let-404 clojure.core/let
metabase.db.data-migrations/defmigration clojure.core/def
metabase.query-processor.error-type/deferror clojure.core/def
metabase.models.setting/defsetting clj-kondo.lint-as/def-catch-all
metabase.mbql.schema.macros/defclause clj-kondo.lint-as/def-catch-all
metabase.public-settings.premium-features/define-premium-feature clojure.core/def
metabase.sync.util/sum-for clojure.core/for
metabase.sync.util/with-emoji-progress-bar clojure.core/let
metabase.driver.sql-jdbc.execute.diagnostic/capturing-diagnostic-info clojure.core/fn
metabase.util.files/with-open-path-to-resource clojure.core/let
metabase.util.ssh/with-ssh-tunnel clojure.core/let
metabase.db.liquibase/with-liquibase clojure.core/let
metabase.models.setting.multi-setting/define-multi-setting clojure.core/def
metabase.integrations.ldap/with-ldap-connection clojure.core/fn
metabase.test/defdataset clojure.core/def
metabase.test/with-temp-file clojure.core/let
metabase.test/with-open-channels clojure.core/let
metabase.test.data.interface/defdataset clojure.core/def
metabase.test.data.interface/defdataset-edn clojure.core/def
metabase.driver.mongo.util/with-mongo-connection clojure.core/let
metabase.driver.mongo.query-processor/mongo-let clojure.core/let
toucan.db/with-call-counting clojure.core/fn
potemkin.types/defprotocol+ clojure.core/defprotocol
potemkin/defprotocol+ clojure.core/defprotocol
potemkin.types/defrecord+ clojure.core/defrecord
potemkin/defrecord+ clojure.core/defrecord
potemkin.types/deftype+ clojure.core/deftype
potemkin/deftype+ clojure.core/deftype
clojurewerkz.quartzite.jobs/defjob clojure.core/defn
honeysql.util/defalias clojure.core/def
honeysql.helpers/defhelper clj-kondo.lint-as/def-catch-all
clojure.core.logic/defne clj-kondo.lint-as/def-catch-all
monger.operators/defoperator clojure.core/def}
:hooks {:analyze-call {metabase.test.data/dataset hooks.metabase.test.data/dataset
metabase.test/dataset hooks.metabase.test.data/dataset
metabase.test.data/$ids hooks.metabase.test.data/$ids
metabase.test/$ids hooks.metabase.test.data/$ids
metabase.test.data/mbql-query hooks.metabase.test.data/$ids
metabase.test/mbql-query hooks.metabase.test.data/$ids
metabase.test/data-query hooks.metabase.test.data/$ids
metabase.test/query hooks.metabase.test.data/$ids
metabase.test/run-mbql-query hooks.metabase.test.data/$ids
metabase.test.data/run-mbql-query hooks.metabase.test.data/$ids
metabase.api.common/defendpoint hooks.metabase.api.common/defendpoint
metabase.api.common/defendpoint-async hooks.metabase.api.common/defendpoint
metabase.test/with-temp hooks.toucan.util.test/with-temp}
:macroexpand {metabase.query-processor.streaming/streaming-response
metabase.query-processor.streaming/streaming-response
metabase.api.common/define-routes macros.metabase.api.common/define-routes
toucan.models/defmodel toucan.models/defmodel
clojurewerkz.quartzite.jobs/build macros.quartz/build-job
clojurewerkz.quartzite.triggers/build macros.quartz/build-trigger
clojurewerkz.quartzite.schedule.cron/schedule macros.quartz/schedule}}
:config-in-comment {:linters {:unresolved-symbol {:level :off}}}}

View File

@@ -0,0 +1,23 @@
(ns hooks.metabase.api.common
(:require
[clj-kondo.hooks-api :as api]
[clojure.string :as str]))
(defn route-fn-name
[method route]
(let [route (if (vector? route) (first route) route)]
(-> (str (name method) route)
(str/replace #"/" "_")
symbol)))
(defn defendpoint [{:keys [node]}]
(let [[method route & body] (rest (:children node))]
{:node
(api/list-node [(api/token-node 'do)
;; register usage of compojure core var
(api/token-node (symbol (str "compojure.core")
(str method)))
;; define function with route-fn-name
(api/list-node (list* (api/token-node 'clojure.core/defn)
(route-fn-name (api/sexpr method) (api/sexpr route))
body))])}))

View File

@@ -0,0 +1,55 @@
(ns hooks.metabase.test.data
(:require
[clj-kondo.hooks-api :as hooks]
[clojure.string :as string]
[clojure.walk :as walk]))
(defn dataset [{:keys [node]}]
(let [[dataset & body] (rest (:children node))]
{:node (with-meta
(hooks/list-node
(list*
(hooks/token-node 'clojure.test/testing)
(hooks/string-node (str dataset))
body))
(meta dataset))}))
(defn $ids [{:keys [node]}]
(let [args (rest (:children node))
[table-name & body] args
unused-node (hooks/token-node '_)
vars (atom #{})
_ (walk/postwalk (fn [node]
(when (hooks/token-node? node)
(let [str-node (str (hooks/sexpr node))]
(when (or (string/starts-with? str-node "$")
(string/starts-with? str-node "!")
(string/starts-with? str-node "&")
(string/starts-with? str-node "*")
(string/starts-with? str-node "%"))
(swap! vars conj node))))
node)
body)
nil-bindings (vec (interpose (hooks/token-node nil) @vars))
unused-bindings (vec (interpose unused-node @vars))
final-bindings (concat
(when-not (= "nil" (str table-name))
[table-name (hooks/token-node nil)])
[unused-node table-name]
(if (seq nil-bindings)
(conj nil-bindings (hooks/token-node nil))
[])
(if (seq unused-bindings)
(conj (next unused-bindings)
(first unused-bindings)
unused-node)
[]))]
{:node (with-meta
(hooks/list-node
(with-meta
(list*
(hooks/token-node 'let)
(hooks/vector-node (vec final-bindings))
body)
(meta body)))
(meta body))}))

View File

@@ -0,0 +1,11 @@
(ns hooks.toucan.util.test
(:require [clj-kondo.hooks-api :as api]))
(defn with-temp [{:keys [node]}]
(let [[_ db-ref binding+opts & body] (:children node)
[args opts] (:children binding+opts)]
{:node (api/vector-node [db-ref
opts
(api/list-node (list* (api/token-node 'fn)
(api/vector-node [args])
body))])}))

View File

@@ -0,0 +1,5 @@
(ns macros.metabase.api.common)
(defmacro define-routes [& args]
`(do (def ~'routes)
~@args))

View File

@@ -0,0 +1,6 @@
(ns metabase.query-processor.streaming)
(defmacro streaming-response [[x y z] & body]
`(clojure.core/let [~x ~y]
~z
~@body))

View File

@@ -0,0 +1,16 @@
(ns macros.quartz)
(defmacro build-job
[& body]
`(let [jb# (org.quartz.JobBuilder/newJob)]
(clojurewerkz.quartzite.jobs/finalize (-> jb# ~@body))))
(defmacro build-trigger
[& body]
`(let [tb# (org.quartz.TriggerBuilder/newTrigger)]
(clojurewerkz.quartzite.triggers/finalize (-> tb# ~@body))))
(defmacro schedule
[& body]
`(let [s# ~(first body)]
(-> s# ~@(rest body))))

View File

@@ -0,0 +1,8 @@
(ns toucan.models)
(defmacro defmodel [model-name & ks]
`(do (clojure.core/defrecord ~model-name ~(vec (map (comp symbol name) ks)))
(clojure.core/defrecord
~(symbol (str model-name "Instance"))
~(vec (map (comp symbol name) ks)))
~(symbol (str model-name "Instance"))))

10
.clj-kondo/test.clj Normal file
View File

@@ -0,0 +1,10 @@
(ns test
(:require [metabase.query-processor.streaming :as streaming]
[toucan.models :as models]))
(models/defmodel Card :foo)
(map->Card {:foo 1})
(map->CardInstance {:foo 1})
(streaming/streaming-response [x 1 (inc x)])

View File

@@ -1,5 +1,11 @@
FROM mcr.microsoft.com/vscode/devcontainers/java:0-8
FROM mcr.microsoft.com/vscode/devcontainers/java:11
RUN apt-key adv --refresh-keys --keyserver keyserver.ubuntu.com\
&& apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends leiningen
&& apt-get -y install --no-install-recommends yarn
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash
RUN apt-get update && apt-get -y install --no-install-recommends nodejs
RUN curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh \
&& bash ./linux-install-1.10.3.933.sh

View File

@@ -1,45 +1,84 @@
((nil . ((indent-tabs-mode . nil) ; always use spaces for tabs
(require-final-newline . t) ; add final newline on save
(cider-shadow-default-options . "node-repl")
(cider-default-cljs-repl . shadow)))
(js2-mode . ((js2-mode-show-parse-errors . nil) ; these settings will let flycheck do everything through eslint,
(js2-mode-show-strict-warnings . nil))) ; because js2-mode can't handle flowtype
(clojure-mode . ((eval . (progn
;; Specify which arg is the docstring for certain macros
;; (Add more as needed)
(put 'defendpoint 'clojure-doc-string-elt 3)
(put 'defendpoint-async 'clojure-doc-string-elt 3)
(put 'api/defendpoint 'clojure-doc-string-elt 3)
(put 'api/defendpoint-async 'clojure-doc-string-elt 3)
(put 'defsetting 'clojure-doc-string-elt 2)
(put 'setting/defsetting 'clojure-doc-string-elt 2)
(put 's/defn 'clojure-doc-string-elt 2)
(put 'p.types/defprotocol+ 'clojure-doc-string-elt 2)
((nil
;; always use spaces for tabs
(indent-tabs-mode . nil)
;; add final newline on save
(require-final-newline . t)
;; prefer keeping source width about ~118, GitHub seems to cut off stuff at either 119 or 120 and it's nicer
;; to look at code in GH when you don't have to scroll back and forth
(fill-column . 118)
;; tell find-things-fast to always use this directory as project root regardless of presence of other
;; deps.edn files
(ftf-project-finders . (ftf-get-top-git-dir)))
;; Define custom indentation for functions inside metabase.
;; This list isn't complete; add more forms as we come across them.
(define-clojure-indent
(let-404)
(macros/case 0)
(match 1)
(mbql.match/match 1)
(mbql.match/match-one 1)
(mbql.match/replace 1)
(mbql.match/replace-in 2)
(l/matche '(1 (:defn)))
(l/matcha '(1 (:defn)))
(p/defprotocol+ '(1 (:defn)))
(p.types/defprotocol+ '(1 (:defn)))
(p.types/def-abstract-type '(1 (:defn)))
(p.types/deftype+ '(2 nil nil (:defn)))
(p/def-map-type '(2 nil nil (:defn)))
(p.types/defrecord+ '(2 nil nil (:defn)))
(tools.macro/macrolet '(1 (:defn))))))
(clojure-indent-style . always-align)
;; if you're using clj-refactor (highly recommended!)
(cljr-favor-prefix-notation . nil)
;; prefer keeping source width about ~118, GitHub seems to cut off stuff at either 119 or 120 and
;; it's nicer to look at code in GH when you don't have to scroll back and forth
(fill-column . 118)
(clojure-docstring-fill-column . 118)
(cider-preferred-build-tool . lein))))
(js2-mode
;; these settings will let flycheck do everything through eslint,
(js2-mode-show-parse-errors . nil)
;; because js2-mode can't handle flowtype
(js2-mode-show-strict-warnings . nil))
(clojure-mode
;; Specify which arg is the docstring for certain macros
;; (Add more as needed)
(eval . (put 'defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'define-premium-feature 'clojure-doc-string-elt 2))
(eval . (put 'api/defendpoint 'clojure-doc-string-elt 3))
(eval . (put 'api/defendpoint-async 'clojure-doc-string-elt 3))
(eval . (put 'defsetting 'clojure-doc-string-elt 2))
(eval . (put 'setting/defsetting 'clojure-doc-string-elt 2))
(eval . (put 's/defn 'clojure-doc-string-elt 2))
(eval . (put 'p.types/defprotocol+ 'clojure-doc-string-elt 2))
;; Define custom indentation for functions inside metabase.
;; This list isn't complete; add more forms as we come across them.
;;
;; `put-clojure-indent' is a safe-local-eval-function, so use a bunch of calls to that
;; instead of one call to `define-clojure-indent'
(eval . (put-clojure-indent 'c/step 1))
(eval . (put-clojure-indent 'db/insert-many! 1))
(eval . (put-clojure-indent 'db/update! 2))
(eval . (put-clojure-indent 'impl/test-migrations 2))
(eval . (put-clojure-indent 'let-404 0))
(eval . (put-clojure-indent 'macros/case 0))
(eval . (put-clojure-indent 'match 1))
(eval . (put-clojure-indent 'mbql.match/match 1))
(eval . (put-clojure-indent 'mbql.match/match-one 1))
(eval . (put-clojure-indent 'mbql.match/replace 1))
(eval . (put-clojure-indent 'mbql.match/replace-in 2))
(eval . (put-clojure-indent '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 'prop/for-all 1))
(eval . (put-clojure-indent 'qp.streaming/streaming-response 1))
(eval . (put-clojure-indent 'u/select-keys-when 1))
(eval . (put-clojure-indent 'u/strict-extend 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'
(eval . (define-clojure-indent
(l/matcha '(1 (:defn)))
(l/matche '(1 (:defn)))
(p.types/def-abstract-type '(1 (:defn)))
(p.types/defprotocol+ '(1 (:defn)))
(p.types/defrecord+ '(2 nil nil (:defn)))
(p.types/deftype+ '(2 nil nil (:defn)))
(p/def-map-type '(2 nil nil (:defn)))
(p/defprotocol+ '(1 (:defn)))
(p/defrecord+ '(2 nil nil (:defn)))
(p/deftype+ '(2 nil nil (:defn)))
(tools.macro/macrolet '(1 ((:defn)) :form))))
(cider-clojure-cli-aliases . "dev:drivers:drivers-dev:ee:ee-dev:user")
(clojure-indent-style . always-align)
(cljr-favor-prefix-notation . nil)
(clojure-docstring-fill-column . 118)
(cider-preferred-build-tool . clojure-cli))
("shared"
(clojure-mode
(cider-default-cljs-repl . shadow-select)
(cider-shadow-default-options . "node-repl")
(cider-preferred-build-tool . shadow-cljs)))
("bin"
(clojure-mode
(cider-clojure-cli-aliases . "dev"))))

View File

@@ -1,12 +1,24 @@
.babel_cache/*
.babel_cache
docs/*
OSX/*
target/*
**node_modules
.circleci
.cpcache
.devcontainer
.github
.husky
.lsp
.shadow-cljs
.github
.vscode
hooks/*
test/*
test_config/*
test_modules/*
test_resources/*
node_modules
**metabase.jar
*.db
.dockerignore
Dockerfile
.dockerignore

View File

@@ -18,20 +18,5 @@ indent_style = tab
indent_size = 2
max_line_length = 120
[*.css]
indent_size = 2
[*.html]
indent_size = 2
[*.mustache]
indent_size = 2
[*.js]
indent_size = 2
[*.jsx]
indent_size = 2
[*.json]
[*.{html,css,mustache,js,jsx,ts,tsx,json}]
indent_size = 2

View File

@@ -3,7 +3,10 @@
"strict": [2, "never"],
"no-undef": 2,
"no-var": 1,
"no-unused-vars": [1, { "vars": "all", "args": "none" }],
"no-unused-vars": [
1,
{ "vars": "all", "args": "none", "varsIgnorePattern": "^_" }
],
"no-empty": [1, { "allowEmptyCatch": true }],
"curly": [1, "all"],
"eqeqeq": [1, "smart"],
@@ -16,12 +19,22 @@
"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": ["w", "h"] }],
"react-hooks/exhaustive-deps": [
"warn",
{ "additionalHooks": "(useSyncedQueryString|useAsyncFunction)" }
],
"prefer-const": [1, { "destructuring": "all" }],
"no-useless-escape": 0,
"no-only-tests/no-only-tests": "error"
"no-only-tests/no-only-tests": "error",
"complexity": ["error", { "max": 54 }]
},
"globals": {
"pending": false,
"before": true,
"cy": true,
"Cypress": true
@@ -52,5 +65,24 @@
"ecmaFeatures": {
"legacyDecorators": true
}
}
},
"overrides": [
{
"extends": ["plugin:@typescript-eslint/recommended"],
"files": ["*.ts", "*.tsx"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
},
"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/no-unused-vars": "off"
}
}
]
}

View File

@@ -30,12 +30,12 @@ If applicable, add screenshots to help explain your problem.
You can get this information by going to Admin -> Troubleshooting.
- Your browser and the version: (e.x. Chrome 52.1, Firefox 48.0, Safari 11.1, …)
- Your operating system: (e.x. OS X 10.10, Windows 10.1809, Ubuntu 16.04, …)
- Your databases: (e.x. MySQL, Postgres, MongoDB, …)
- Metabase version: (e.x. 0.19.3)
- Metabase hosting environment: (e.x. Mac app, Elastic Beanstalk, Docker, Heroku, Jar-file on Ubuntu, …)
- Metabase internal database: (e.x. H2 (default), Postgres or MySQL)
- Your browser and the version: (e.g., Chrome 52.1, Firefox 48.0, Safari 11.1, …)
- Your operating system: (e.g., OS X 10.10, Windows 10.1809, Ubuntu 16.04, …)
- Your databases: (e.g, MySQL, Postgres, MongoDB, …)
- Metabase version: (e.g., 0.19.3)
- Metabase hosting environment: (e.g., Elastic Beanstalk, Docker, Heroku, Jar-file on Ubuntu, …)
- Metabase internal database: (e.g., H2 (default), Postgres or MySQL)
**Severity**
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?

View File

@@ -1,9 +1,9 @@
---
name: Feature or Project Implementation
name: Feature or Project Implementation (Internal Use)
about: This issue is used to track a feature implementation for a solution to a user
problem that may span days to weeks to implement. This is used by the core Metabase
team to project plan and mange work.
title: Feature/Project X Implementation
team to project plan and manage work.
title: X - Internal Use - Feature/Project X Implementation
labels: ".Epic"
assignees: ''
@@ -19,9 +19,6 @@ assignees: ''
**Implementation Plan**
***ETA***: MM/DD/YYYY (ETA of merged feature when we start work)
_(each individual item in list should correspond to a PR and be less than one week of work maximum!)_
***Milestone 1*** )_(note, each milestone should correspond to a point at which product/design can jump in to apply polish, evaluate changes, etc)_
- [x] step 1: #somePRnumber

View File

@@ -5,7 +5,6 @@
### Tests
- [ ] Run the frontend and Cypress end-to-end tests with `yarn lint && yarn test`)
- [ ] If there are changes to the backend codebase, run the backend tests with `lein test && lein lint && ./bin/reflection-linter`
- [ ] If there are changes to the backend codebase, run the backend tests with `clojure -X:dev:test`
- [ ] Sign the [Contributor License Agreement](https://docs.google.com/a/metabase.com/forms/d/1oV38o7b9ONFSwuzwmERRMi9SYrhYeOrkbmNaq9pOJ_E/viewform)
(unless it's a tiny documentation change).

View File

@@ -0,0 +1,30 @@
name: Find squashed commit
description: Finds squashed commit in master by pull request name
inputs:
pull-request-number:
required: true
base-ref:
required: true
outputs:
commit:
value: ${{ steps.find-squashed-commit.outputs.commit }}
description: Found commit SHA
runs:
using: "composite"
steps:
- run: |
git checkout $BASE_REF
git fetch --all
echo "Looking for a commit that contains pull request number $PULL_REQUEST_NUMBER in $BASE_REF"
COMMIT=$(env -i git log $BASE_REF --grep="(#$PULL_REQUEST_NUMBER)" --format="%H")
echo "commit SHA $COMMIT"
echo "::set-output name=commit::$COMMIT"
id: find-squashed-commit
shell: bash
env:
PULL_REQUEST_NUMBER: ${{ inputs.pull-request-number }}
BASE_REF: ${{ inputs.base-ref }}

View File

@@ -0,0 +1,41 @@
name: Get latest release branch
outputs:
branch-name:
value: ${{ steps.get-latest-release-branch.outputs.result }}
runs:
using: "composite"
steps:
- uses: actions/github-script@v4
id: get-latest-release-branch
with:
result-encoding: string
script: |
const releaseBranches = await github.git.listMatchingRefs({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "heads/release-x.",
});
const getVersionFromBranch = branch => {
const match = branch.match(/release-x\.(.*?)\.x/);
return match && parseInt(match[1]);
};
const latestReleaseBranch = releaseBranches.data
.filter(branch => getVersionFromBranch(branch.ref) !== null)
.reduce(
(prev, current) =>
getVersionFromBranch(prev.ref) > getVersionFromBranch(current.ref)
? prev
: current,
{ ref: "" },
);
const latestReleaseBranchName = latestReleaseBranch.ref.replace(
/^refs\/heads\//,
"",
);
console.log(`Latest release branch: ${latestReleaseBranchName}`);
return latestReleaseBranchName;

View File

@@ -0,0 +1,34 @@
name: Notify Pull Request
inputs:
message:
required: true
include-log:
required: false
default: true
runs:
using: "composite"
steps:
- uses: actions/github-script@v4
id: get-latest-release-branch
with:
result-encoding: string
script: |
const message = "${{ inputs.message }}"
const shouldIncludeLog = ${{ inputs.include-log }}.toString() === "true";
const author = context.payload.sender.login;
let body = `@${author} ${message}`;
if (shouldIncludeLog) {
const { GITHUB_SERVER_URL, GITHUB_REPOSITORY, GITHUB_RUN_ID } = process.env;
const runUrl = `${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}`;
body += ` [[Logs]](${runUrl})`;
}
github.issues.createComment({
issue_number: context.payload.number,
owner: context.repo.owner,
repo: context.repo.repo,
body,
});

View File

@@ -0,0 +1,35 @@
name: Prepare back-end environment
inputs:
java-version:
required: true
default: '11'
clojure-version:
required: true
default: '1.10.3.933'
m2-cache-key:
description: 'Key to cache M2 packages from Maven Central'
required: true
default: 'm2'
runs:
using: "composite"
steps:
- name: Prepare JDK ${{ inputs.java-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: 'temurin'
- name: Install Clojure CLI
shell: bash
run: |
curl -O https://download.clojure.org/install/linux-install-${{ inputs.clojure-version }}.sh &&
sudo bash ./linux-install-${{ inputs.clojure-version }}.sh
- name: Get M2 cache
uses: actions/cache@v2
with:
path: |
~/.m2
~/.gitlibs
key: ${{ runner.os }}-${{ inputs.m2-cache-key }}-${{ hashFiles('**/deps.edn') }}
restore-keys: |
${{ runner.os }}-${{ inputs.m2-cache-key }}-

View File

@@ -0,0 +1,16 @@
name: Prepare cypress environment
runs:
using: "composite"
steps:
- name: Get Cypress cache
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: ${{ runner.os }}-Cypress-${{ hashFiles('**/yarn.lock') }}
- name: Ensure that Cypress executable is ready
run: |
yarn cypress install
yarn cypress cache path
yarn cypress cache list
yarn cypress verify
shell: bash

View File

@@ -0,0 +1,21 @@
name: Prepare front-end environment
runs:
using: "composite"
steps:
- name: Prepare Node.js
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: 'yarn'
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-cljs-${{ hashFiles('**/shadow-cljs.edn') }}
- name: Get node_modules cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile --prefer-offline
shell: bash

View File

@@ -0,0 +1,18 @@
name: Prepare Uberjar Artifact
runs:
using: "composite"
steps:
- name: Mark with the commit hash
run: git rev-parse --short HEAD > COMMIT-ID
shell: bash
- name: Calculate SHA256 checksum
run: sha256sum ./target/uberjar/metabase.jar > SHA256.sum
shell: bash
- name: Upload JARs as artifact
uses: actions/upload-artifact@v2
with:
name: metabase-${{ matrix.edition }}-uberjar
path: |
./target/uberjar/metabase.jar
./COMMIT-ID
./SHA256.sum

View File

@@ -0,0 +1,13 @@
name: Run Snowplow micro
runs:
using: "composite"
steps:
- name: Download Snowplow micro JAR
run: curl -L -o snowplow-micro.jar https://github.com/snowplow-incubator/snowplow-micro/releases/download/micro-1.2.1/snowplow-micro-1.2.1.jar
shell: bash
- name: Launch Snowplow micro
run: java -cp snowplow-micro.jar:snowplow com.snowplowanalytics.snowplow.micro.Main --collector-config snowplow/micro.conf --iglu snowplow/iglu.json &
shell: bash
- name: Wait until Snowplow micro is ready
run: while ! curl -s 'http://localhost:9090' | grep '404'; do sleep 1; done
shell: bash

3
.github/scripts/README.md vendored Normal file
View File

@@ -0,0 +1,3 @@
# GitHub Action Test Scripts
Scripts related to running integration tests (ex: through GitHub actions)

View File

@@ -0,0 +1,64 @@
#! /usr/bin/env bash
# runs one or more Metabase test(s) against a Kerberized Presto instance
set -eo pipefail
# Need Java commands on $PATH, which apparently is not yet the case
export PATH="$PATH:$JAVA_HOME/bin"
# ensure java commmand is available
which java
# install clojure version needed for Metabase
curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh
chmod +x linux-install-1.10.3.933.sh
./linux-install-1.10.3.933.sh
RESOURCES_DIR=/app/source/resources
# ensure the expected files are in place, in the resources dir
if [ ! -f "$RESOURCES_DIR/ssl_keystore.jks" ]; then
echo "$RESOURCES_DIR/ssl_keystore.jks does not exist; cannot run test" >&2
exit 11
fi
if [ ! -f "$RESOURCES_DIR/krb5.conf" ]; then
echo "$RESOURCES_DIR/krb5.conf does not exist; cannot run test" >&2
exit 12
fi
if [ ! -f "$RESOURCES_DIR/client.keytab" ]; then
echo "$RESOURCES_DIR/client.keytab does not exist; cannot run test" >&2
exit 13
fi
# Copy the JDK cacerts file to our resources
cp $JAVA_HOME/lib/security/cacerts $RESOURCES_DIR/cacerts-with-presto-ca.jks
# Capture the Presto server self signed CA in PEM format
openssl s_client -showcerts -connect presto-kerberos:7778 </dev/null \
| openssl x509 -outform PEM >$RESOURCES_DIR/presto-ssl-root-ca.pem
# Convert the Presto server self signed CA to DER format
openssl x509 -outform der -in $RESOURCES_DIR/presto-ssl-root-ca.pem -out $RESOURCES_DIR/presto-ssl-root-ca.der
# Add Presto's self signed CA to the truststore
keytool -noprompt -import -alias presto-kerberos -keystore $RESOURCES_DIR/cacerts-with-presto-ca.jks \
-storepass changeit -file $RESOURCES_DIR/presto-ssl-root-ca.der -trustcacerts
ADDITIONAL_OPTS="SSLKeyStorePath=$RESOURCES_DIR/ssl_keystore.jks&SSLKeyStorePassword=presto\
&SSLTrustStorePath=$RESOURCES_DIR/cacerts-with-presto-ca.jks&SSLTrustStorePassword=changeit"
# Set up the environment variables pointing to all of this, and run some tests
DRIVERS=presto-jdbc \
MB_ENABLE_PRESTO_JDBC_DRIVER=true \
MB_PRESTO_JDBC_TEST_HOST=presto-kerberos \
MB_PRESTO_JDBC_TEST_PORT=7778 \
MB_PRESTO_JDBC_TEST_SSL=true \
MB_PRESTO_JDBC_TEST_KERBEROS=true \
MB_PRESTO_JDBC_TEST_USER=bob@EXAMPLE.COM \
MB_PRESTO_JDBC_TEST_KERBEROS_PRINCIPAL=bob@EXAMPLE.COM \
MB_PRESTO_JDBC_TEST_KERBEROS_REMOTE_SERVICE_NAME=HTTP \
MB_PRESTO_JDBC_TEST_KERBEROS_KEYTAB_PATH=$RESOURCES_DIR/client.keytab \
MB_PRESTO_JDBC_TEST_KERBEROS_CONFIG_PATH=$RESOURCES_DIR/krb5.conf \
MB_PRESTO_JDBC_TEST_ADDITIONAL_OPTIONS=$ADDITIONAL_OPTS \
clojure -X:dev:test:drivers:drivers-dev :only metabase.driver.presto-jdbc-test

70
.github/workflows/auto-backport.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
name: Auto-backport
on:
pull_request:
types: [closed, labeled]
jobs:
create-backport:
if: github.event.pull_request.merged == true && (contains(github.event.pull_request.labels.*.name, 'backport') || github.event.label.name == 'backport')
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ./.github/actions/find-squashed-commit
name: Find commit
id: find_commit
with:
pull-request-number: ${{ github.event.pull_request.number }}
base-ref: ${{ github.event.pull_request.base.ref }}
- uses: ./.github/actions/get-latest-release-branch
name: Get latest release branch
id: get_latest_release_branch
- id: create_backport_pull_request
run: |
git config --global user.email "metabase-github-automation@metabase.com"
git config --global user.name "$GITHUB_ACTOR"
BACKPORT_BRANCH="backport-$COMMIT"
git checkout ${TARGET_BRANCH}
git fetch --all
git checkout -b ${BACKPORT_BRANCH}
git cherry-pick ${COMMIT} || true
CONFLICTS=$(git ls-files -u | wc -l)
if [ "$CONFLICTS" -gt 0 ]; then
echo "Could not cherry pick because of a conflict"
echo "::set-output name=has-conflicts::true"
git cherry-pick --abort
git checkout master
exit 0
fi
git checkout master
git push -u origin ${BACKPORT_BRANCH}
hub pull-request -b "${TARGET_BRANCH}" -h "${BACKPORT_BRANCH}" -l "auto-backported" -a "${GITHUB_ACTOR}" -F- <<<"🤖 backported \"${ORIGINAL_TITLE}\"
#${ORIGINAL_PULL_REQUEST_NUMBER}"
env:
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: ${{ secrets.GITHUB_TOKEN }}
COMMIT: ${{ steps.find_commit.outputs.commit }}
- uses: ./.github/actions/notify-pull-request
if: ${{ steps.create_backport_pull_request.outputs.has-conflicts == 'true' }}
with:
include-log: false
message: could not create a backport due to conflicts
- uses: ./.github/actions/notify-pull-request
if: ${{ failure() }}
with:
include-log: true
message: something went wrong while creating a backport

View File

@@ -1,20 +1,11 @@
name: Backend
on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
tags:
- '**'
paths:
- '**.clj'
- '**.edn'
- '**.java'
- '**/metabase-plugin.yaml'
- '.github/workflows/**'
- 'master'
- 'release-**'
pull_request:
jobs:
@@ -22,87 +13,30 @@ jobs:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Run clj-kondo
run: docker run -v $PWD:/work --rm cljkondo/clj-kondo clj-kondo --config /work/lint-config.edn --lint /work/src /work/enterprise/backend/src /work/backend/mbql/src /work/shared/src
be-linter-bikeshed:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Prepare JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-bikeshed-${{ hashFiles('**/project.clj') }}
- run: lein with-profile +ci bikeshed
be-linter-eastwood:
runs-on: ubuntu-20.04
timeout-minutes: 10
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Prepare JDK 11
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
java-version: 11
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-eastwood-${{ hashFiles('**/project.clj') }}
- run: lein with-profile +ci eastwood
be-linter-docstring-checker:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Prepare JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-docstring-checker-${{ hashFiles('**/project.clj') }}
- run: lein with-profile +ci docstring-checker
m2-cache-key: 'eastwood'
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood
name: Run Eastwood linter
be-linter-namespace-decls:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Prepare JDK 11
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
java-version: 11
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-namespace-decls-${{ hashFiles('**/project.clj') }}
- run: lein with-profile +ci check-namespace-decls
be-linter-reflection-warnings:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Prepare JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-reflection-warnings-${{ hashFiles('**/project.clj') }}
- run: ./bin/reflection-linter
name: Run reflection warnings checker
m2-cache-key: 'namespace-decls'
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:namespace-checker
name: Check ns forms

135
.github/workflows/backport.yml vendored Normal file
View File

@@ -0,0 +1,135 @@
# Cherry-picks commits from current branch to a specified one in a command "@metabase-bot backport release-x.40.x"
name: Backport
on:
issue_comment:
types: [created]
jobs:
create_pull_request:
name: Creates a pull request
if: contains(github.event.comment.body, '@metabase-bot backport')
runs-on: ubuntu-20.04
steps:
- id: is_organization_member
uses: JamesSingleton/is-organization-member@1.0.0
with:
organization: metabase
username: ${{ github.event.issue.user.login }}
token: ${{ secrets.GITHUB_TOKEN }}
- run: |
result=${{ steps.is_organization_member.outputs.result }}
if [ $result == false ]; then
echo User ${{ github.event.comment.user.login }} is not a member of Metabase organization
exit 1
fi
- uses: actions/github-script@v4
id: branch_info
with:
script: |
// Example: @metabase-bot backport release-x.40.x
const [_botName, _command, targetBranch] = context.payload.comment.body.split(" ");
console.log(`Target branch is ${targetBranch}`);
const { data: originalPullRequest } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.issue.number,
});
const { data: commits } = await github.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.issue.number,
});
const targetRef = await github.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${targetBranch}`,
});
const backportBranch = `backport-${originalPullRequest.head.ref}`
try {
await github.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `heads/${backportBranch}`,
});
} catch(e) {
if (e.status === 404) {
await github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/heads/${backportBranch}`,
sha: targetRef.data.object.sha,
});
}
}
return {
backportBranch,
targetBranch,
originalPullRequest,
startSha: commits[0].sha,
endSha: commits[commits.length - 1].sha
}
- uses: actions/checkout@v3
name: Cherry-pick commits and create PR
with:
fetch-depth: 0
- run: |
git config --global user.email "metabase-github-automation@metabase.com"
git config --global user.name "$GITHUB_ACTOR"
git fetch --all
git checkout "${BACKPORT_BRANCH}"
git reset --hard origin/${TARGET_BRANCH}
if [[ -z $(git ls-remote --heads origin ${ORIGINAL_HEAD_REF}) ]]; then
echo "PR has been merged, searching for a squashed commit in the base branch"
echo "searching for a commit in a ${ORIGINAL_BASE_REF} that contains pull request number ${ORIGINAL_PULL_REQUEST_NUMBER}"
SQUASHED_COMMIT=$(env -i git log ${ORIGINAL_BASE_REF} --grep="(#${ORIGINAL_PULL_REQUEST_NUMBER})" --format="%H")
echo "found commit ${SQUASHED_COMMIT}"
git cherry-pick ${SQUASHED_COMMIT}
else
echo "PR has not been merged, copying all commits"
git cherry-pick ${ORIGINAL_BASE_SHA}..${ORIGINAL_HEAD_SHA}
fi
git push origin "${BACKPORT_BRANCH}" --force-with-lease
if [[ $(hub pr list -b "${TARGET_BRANCH}" -h "${BACKPORT_BRANCH}" -s "open") ]]; then
echo "PR already exists"
else
hub pull-request -b "${TARGET_BRANCH}" -h "${BACKPORT_BRANCH}" -l "auto-backported" -a "${GITHUB_ACTOR}" -F- <<<"🤖 backported \"${ORIGINAL_TITLE}\"
#${ORIGINAL_PULL_REQUEST_NUMBER}"
echo "New PR has been created"
fi
env:
ORIGINAL_TITLE: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.title }}
ORIGINAL_BASE_REF: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.base.ref }}
ORIGINAL_BASE_SHA: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.base.sha }}
ORIGINAL_HEAD_REF: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.head.ref }}
ORIGINAL_HEAD_SHA: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.head.sha }}
ORIGINAL_PULL_REQUEST_NUMBER: ${{ fromJson(steps.branch_info.outputs.result).originalPullRequest.number }}
TARGET_BRANCH: ${{ fromJson(steps.branch_info.outputs.result).targetBranch }}
BACKPORT_BRANCH: ${{ fromJson(steps.branch_info.outputs.result).backportBranch }}
START_SHA: ${{ fromJson(steps.branch_info.outputs.result).startSha }}
END_SHA: ${{ fromJson(steps.branch_info.outputs.result).endSha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
notify_when_failed:
runs-on: ubuntu-20.04
name: Notify about failure
needs: create_pull_request
if: ${{ failure() }}
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/notify-pull-request
with:
include-log: true
message: something went wrong while creating a backport

44
.github/workflows/build-scripts.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Build scripts
on:
push:
branches:
- 'master'
- 'release-**'
pull_request:
jobs:
test-build-scripts:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'build-scripts'
- name: Run metabuild-common build script tests
run: clojure -M:test
working-directory: bin/common
timeout-minutes: 15
- name: Run build-drivers build script tests
run: clojure -M:test
working-directory: bin/build-drivers
timeout-minutes: 15
- name: Run i18n script tests
run: clojure -M:test
working-directory: bin/i18n
timeout-minutes: 15
- name: Run build-mb build script tests
run: clojure -M:test
working-directory: bin/build-mb
timeout-minutes: 15
- name: Run release script tests
run: clojure -M:test
working-directory: bin/release
timeout-minutes: 15
- name: Run Liquibase migrations linter tests
run: clojure -M:test
working-directory: bin/lint-migrations-file
timeout-minutes: 15

20
.github/workflows/cljs.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: CLJS
on:
push:
branches:
- 'master'
- 'release-**'
pull_request:
jobs:
shared-tests-cljs:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Run Cljs tests for shared/ code
run: yarn run test-cljs

17
.github/workflows/codenotify.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: Codenotify
on:
pull_request:
types: [opened, synchronize, ready_for_review]
jobs:
codenotify:
runs-on: ubuntu-20.04
name: Codenotify
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: sourcegraph/codenotify@v0.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,19 +1,13 @@
name: "CodeQL"
on:
pull_request:
paths-ignore:
- 'docs/**'
push:
paths-ignore:
- 'docs/**'
on: [push, pull_request]
jobs:
analyze:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:

View File

@@ -1,26 +0,0 @@
name: Docker
on:
pull_request:
paths:
- 'Dockerfile'
- '.github/workflows/docker.yml'
jobs:
build:
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- name: Build container image
run: docker build -t test-container-image .
- name: Launch container
run: docker run -dp 3000:3000 test-container-image
timeout-minutes: 5
- run: docker ps
- name: Wait for Metabase to start
run: while ! curl -s localhost:3000/api/health; do sleep 1; done
timeout-minutes: 1
- name: Check API health
run: curl -s localhost:3000/api/health

20
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: Docs
on:
push:
branches:
- 'master'
- 'release-**'
pull_request:
jobs:
fe-linter-docs-links:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn run lint-docs-links
name: Run docs links checker

138
.github/workflows/e2e-tests.yml vendored Normal file
View File

@@ -0,0 +1,138 @@
name: E2E Tests
on:
push:
branches:
- 'master'
paths-ignore:
- "docs/**"
- "**.md"
- ".circleci/**"
jobs:
build:
runs-on: buildjet-2vcpu-ubuntu-2004
timeout-minutes: 25
strategy:
matrix:
edition: [oss, ee]
env:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- run: ./bin/build version
- run: ./bin/build translations
- run: ./bin/build frontend
- run: ./bin/build licenses
- run: ./bin/build drivers
- run: ./bin/build uberjar
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
e2e-tests:
runs-on: buildjet-4vcpu-ubuntu-2004
timeout-minutes: 30
needs: build
name: e2e-tests-${{ matrix.folder }}-${{ matrix.edition }}
env:
MB_EDITION: ${{ matrix.edition }}
DISPLAY: ""
QA_DB_ENABLED: true
ENTERPRISE_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
MB_SNOWPLOW_AVAILABLE: true
MB_SNOWPLOW_URL: "http://localhost:9090" # Snowplow micro
strategy:
fail-fast: false
matrix:
edition: [oss, ee]
folder:
- "admin"
- "binning"
- "collections"
- "custom-column"
- "dashboard"
- "dashboard-filters"
- "dashboard-filters-sql"
- "downloads"
- "embedding"
- "joins"
- "models"
- "moderation"
- "native"
- "native-filters"
- "permissions"
- "question"
- "sharing"
- "visualizations"
services:
maildev:
image: maildev/maildev:1.1.0
ports:
- "80:80"
- "25:25"
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
postgres-sample:
image: metabase/qa-databases:postgres-sample-12
ports:
- "5432:5432"
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
mongo-sample:
image: metabase/qa-databases:mongo-sample-4.0
ports:
- 27017:27017
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
mysql-sample:
image: metabase/qa-databases:mysql-sample-8
ports:
- 3306:3306
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- name: Run Snowplow micro
uses: ./.github/actions/run-snowplow-micro
- uses: actions/download-artifact@v2
name: Retrieve uberjar artifact for ${{ matrix.edition }}
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Run Cypress tests on ${{ matrix.folder }}
run: yarn run test-cypress-no-build --folder ${{ matrix.folder }} --record --key ${{ secrets.CURRENTS_KEY }} --group ${{ matrix.folder }}-${{ matrix.edition }} --ci-build-id "${{ github.run_id }}-${{ github.run_attempt }}"
env:
TERM: xterm
- name: Upload Cypress recording upon failure
uses: actions/upload-artifact@v2
if: failure()
with:
name: cypress-recording-${{ matrix.folder }}-${{ matrix.edition }}
path: |
./cypress
./logs/test.log
if-no-files-found: ignore

View File

@@ -1,77 +1,82 @@
name: Frontend
on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
- 'fix**'
- 'ci**'
tags:
- '**'
paths:
- 'frontend/**'
- 'shared/**'
- 'enterprise/frontend/**'
- 'docs/**'
- '**/package.lock'
- '**/yarn.lock'
- '.github/workflows/**'
- 'master'
- 'release-**'
pull_request:
jobs:
fe-linter-prettier:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Prepare Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Get yarn cache
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn run lint-prettier
name: Run Prettier formatting linter
fe-linter-eslint:
runs-on: ubuntu-20.04
timeout-minutes: 10
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- name: Prepare Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Get yarn cache
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn run lint-eslint
name: Run ESLint linter
fe-linter-docs-links:
fe-type-check:
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Prepare Node.js
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn type-check
name: Check types
fe-tests-unit:
runs-on: buildjet-2vcpu-ubuntu-2004
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn run test-unit --coverage --silent
name: Run frontend unit tests
- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v2
with:
node-version: 14.x
- name: Get yarn cache
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile --prefer-offline
- run: yarn run lint-docs-links
name: Run docs links checker
files: ./coverage/lcov.info
flags: front-end
fe-tests-timezones:
runs-on: buildjet-2vcpu-ubuntu-2004
timeout-minutes: 14
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn run test-timezones
name: Run frontend timezones tests
fe-chromatic:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Publish to Chromatic
uses: chromaui/action@v1
env:
PUBLISH_CHROMATIC: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
if: env.PUBLISH_CHROMATIC != null
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

36
.github/workflows/fuzzing.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Fuzzing
on:
push:
branches:
- 'master'
- 'release-**'
pull_request:
paths-ignore:
- 'docs/**'
jobs:
fe-fuzz-tokenizer:
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn test-unit frontend/test/metabase/lib/expressions/fuzz.tokenizer.unit.spec.js
env:
MB_FUZZ: 1
name: Run fuzz testing on the tokenizer
fe-fuzz-recursive-parser:
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn test-unit frontend/test/metabase/lib/expressions/fuzz.recursive-parser.unit.spec.js
env:
MB_FUZZ: 1
name: Run fuzz testing on the recursive parser

View File

@@ -1,46 +1,27 @@
name: i18n
on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
tags:
- '**'
paths:
- '**.clj'
- '**.js'
- '**.jsx'
- '.github/workflows/**'
- 'bin/**'
- 'master'
- 'release-**'
pull_request:
jobs:
verify-i18n-files:
runs-on: ubuntu-20.04
timeout-minutes: 10
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Prepare Node.js
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
node-version: 14.x
- name: Get yarn cache
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-i18n-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile --prefer-offline
m2-cache-key: 'i18n'
- run: sudo apt install gettext
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
sudo bash ./linux-install-1.10.1.708.sh
- run: ./bin/i18n/update-translation-template
name: Check i18n tags/make sure template can be built
- run: ./bin/i18n/build-translation-resources

20
.github/workflows/migrations.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: Migrations
on:
push:
branches:
- 'master'
- 'release-**'
pull_request:
jobs:
check-migrations:
runs-on: ubuntu-20.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- name: Verify Liquibase Migrations
run: ./bin/lint-migrations-file.sh

View File

@@ -0,0 +1,105 @@
# 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-20.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:
- id: is_organization_member
uses: JamesSingleton/is-organization-member@1.0.0
with:
organization: metabase
username: ${{ github.event.issue.user.login }}
token: ${{ secrets.GITHUB_TOKEN }}
- run: |
result=${{ steps.is_organization_member.outputs.result }}
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 }}
build:
runs-on: ubuntu-20.04
needs: pr_info
timeout-minutes: 30
strategy:
matrix:
edition: [oss]
env:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
steps:
- uses: actions/checkout@v3
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
- run: ./bin/build
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
percy:
timeout-minutes: 30
runs-on: buildjet-4vcpu-ubuntu-2004
needs: [build, pr_info]
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
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
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- uses: actions/download-artifact@v2
name: Retrieve uberjar artifact
with:
name: metabase-oss-uberjar
- 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 80:80 -p 25:25 maildev/maildev:1.1.0
- name: Percy Test
run: yarn run test-visual-no-build
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 }}

65
.github/workflows/percy.yml vendored Normal file
View File

@@ -0,0 +1,65 @@
# Triggers Percy job on push to master and release branches to create baseline screenshots
name: Percy
on:
push:
branches:
- master
- "release-**"
paths-ignore:
- "docs/**"
- "**.md"
- "**unit.spec.js"
- "frontend/test/**"
- "!frontend/test/metabase-visual/**"
jobs:
build:
runs-on: buildjet-2vcpu-ubuntu-2004
timeout-minutes: 25
strategy:
matrix:
edition: [oss]
env:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- run: ./bin/build
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
percy:
timeout-minutes: 30
runs-on: buildjet-4vcpu-ubuntu-2004
needs: build
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- uses: actions/download-artifact@v2
name: Retrieve uberjar artifact
with:
name: metabase-oss-uberjar
- 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 80:80 -p 25:25 maildev/maildev:1.1.0
- name: Percy Test
run: yarn run test-visual-no-build
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
if: env.PERCY_TOKEN != null

View File

@@ -0,0 +1,74 @@
name: Kerberized Presto Integration Test
on:
pull_request:
paths:
- '**/presto_jdbc/**'
- '**/presto_jdbc.clj'
push:
branches:
- master
- 'release**'
- 'feature**'
tags:
- '**'
paths:
- '**/presto_jdbc/**'
- '**/presto_jdbc.clj'
jobs:
run-presto-kerberos-test:
runs-on: ubuntu-20.04
timeout-minutes: 40
steps:
- name: Install babashka
run: >
mkdir -p /tmp/babashka-install \
&& cd /tmp/babashka-install \
&& curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install \
&& chmod +x install \
&& sudo ./install \
&& cd -
- name: Checkout Metabase repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check out Presto Kerberos Docker Compose
uses: actions/checkout@v3
with:
repository: metabase/presto-kerberos-docker
# use a custom branch if/until upstream (mik-laj/presto-kerberos-docker) can be fixed with PRs 23 and 24
ref: hacked-dec-2021
token: ${{ secrets.GITHUB_TOKEN }}
path: presto-kerberos-docker
- name: Bring up Presto+Kerberos cluster
run: cd presto-kerberos-docker && docker-compose up -d && cd ..
- name: Run Presto test query from command line (sanity check)
run: cd presto-kerberos-docker && ./test.sh && cd ..
# Since we are managing the Docker containers from the GitHub action container, we need to copy all the
# relevant resources now, into the resources dir for later consumption by the app
- name: Copy Presto SSL keystore to resources
run: docker cp presto-kerberos:/tmp/ssl_keystore.jks resources
- name: Copy krb5.conf file to resources
run: docker cp presto-kerberos:/etc/krb5.conf resources
- name: Copy client.keytab file to resources
run: docker cp presto-kerberos:/home/presto/client.keytab resources
- name: Checkout mba
uses: actions/checkout@v3
with:
repository: metabase/mba
ref: master
token: ${{ secrets.GITHUB_TOKEN }}
path: mba-src
- name: ls mba
run: ls -latr mba-src
- name: Symlink mba
run: cd mba-src && sudo ln -s $(pwd)/src/main.clj /usr/local/bin/mba && chmod +x /usr/local/bin/mba && cd ..
- name: Ensure mba
run: which mba
- name: Run Metabase via MBA
run: /home/runner/work/metabase/metabase/mba-src/src/main.clj --mb . --data-db postgres-data -n example.com up
- name: Run test script in MBA instance
run: >
mba --mb . --data-db postgres-data -n example.com \
run .github/scripts/run-presto-kerberos-integration-test.sh

19
.github/workflows/snowplow.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: Snowplow
on:
pull_request:
branches:
- '**'
paths:
- 'snowplow/**'
- '.github/workflows/**'
jobs:
lint:
runs-on: ubuntu-20.04
container: snowplow/igluctl:0.6.0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint
run: igluctl lint snowplow

View File

@@ -1,22 +1,19 @@
name: Uberjar
name: Build + Docker Uberjar
on:
push:
branches:
- master
- 'release-**'
tags:
- '**'
paths-ignore:
- 'docs/**'
- 'frontend/test/**'
- 'enterprise/frontend/test/**'
- ".**"
- "test*"
jobs:
build:
name: Build MB ${{ matrix.edition }}
runs-on: ubuntu-20.04
timeout-minutes: 60
timeout-minutes: 40
strategy:
matrix:
edition: [ee, oss]
@@ -24,112 +21,102 @@ jobs:
MB_EDITION: ${{ matrix.edition }}
INTERACTIVE: false
steps:
- uses: actions/checkout@v2
- name: Prepare Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Prepare JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
sudo bash ./linux-install-1.10.1.708.sh
- name: Check versions
run: |
echo "Node.js `node --version`"
echo "yarn `yarn --version`"
java -version
echo "Clojure `clojure -e "(println (clojure-version))"`"
lein --version
- name: Check out the code
uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- name: Build
run: ./bin/build
- name: Prepare uberjar artifact
uses: ./.github/actions/prepare-uberjar-artifact
- name: Get yarn cache
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }}-${{ hashFiles('**/deps.edn') }}
- run: yarn install --lockfile
- run: lein with-profile +include-all-drivers,+cloverage,+junit,+${{ matrix.edition }} deps
- run: ./bin/build
- name: Mark with the commit hash
run: git rev-parse --short HEAD > COMMIT-ID
- name: Calculate SHA256 checksum
run: sha256sum ./target/uberjar/metabase.jar > SHA256.sum
- name: Upload JARs as artifact
uses: actions/upload-artifact@v2
with:
name: metabase-${{ matrix.edition }}-uberjar
path: |
./target/uberjar/metabase.jar
./COMMIT-ID
./SHA256.sum
check:
check_jar_health:
runs-on: ubuntu-20.04
name: check ${{ matrix.edition }} (java ${{ matrix.java-version }})
name: Is ${{ matrix.edition }} (java ${{ matrix.java-version }}) healthy?
needs: build
timeout-minutes: 10
strategy:
matrix:
edition: [ee, oss]
java-version: [8, 11, 13]
java-version: [8, 11, 17]
steps:
- name: Prepare JRE (Java Run-time Environment)
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-package: jre
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- run: java -version
- uses: actions/download-artifact@v2
name: Retrieve uberjar artifact
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Launch uberjar
run: |
java -jar ./target/uberjar/metabase.jar &
sleep 180
timeout-minutes: 5
run: java -jar ./target/uberjar/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: Check API health
run: curl -s localhost:3000/api/health
known-issue-java15:
containerize_test_and_push_container:
runs-on: ubuntu-20.04
needs: build
timeout-minutes: 10
name: Containerize ${{ matrix.edition }}
needs: check_jar_health
strategy:
matrix:
edition: [ee, oss]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Prepare JRE 15
uses: actions/setup-java@v1
with:
java-package: jre
java-version: 15
- run: java -version
- uses: actions/download-artifact@v2
name: Retrieve uberjar artifact
- name: Extract and clean branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/} | sed 's/[^-._a-zA-Z0-9]/-/g')"
id: extract_branch
- name: Check out the code (Dockerfile needed)
uses: actions/checkout@v3
- name: Download uploaded artifacts to insert into container
uses: actions/download-artifact@v2
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Launch uberjar
run: |
java -jar ./target/uberjar/metabase.jar &
sleep 180
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@v1
with:
driver-opts: network=host
- name: Build ${{ matrix.edition }} container
uses: docker/build-push-action@v2
with:
context: bin/docker/.
platforms: linux/amd64
network: host
tags: localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-${{ matrix.edition }}
no-cache: true
push: true
- name: Launch ${{ matrix.edition }} container
run: docker run --rm -dp 3000:3000 localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-${{ matrix.edition }}
timeout-minutes: 5
- name: Check API health
run: curl -s localhost:3000/api/health
continue-on-error: true
- 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: 1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Retag and push images if master or main (ee)
if: ${{ (github.ref_name == 'master' || github.ref_name == 'main') && matrix.edition == 'ee' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-ee metabase/metabase-enterprise-head:latest && docker push metabase/metabase-enterprise-head:latest
- name: Retag and push images if master or main (oss)
if: ${{ (github.ref_name == 'master' || github.ref_name == 'main') && matrix.edition == 'oss' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-oss metabase/metabase-head:latest && docker push metabase/metabase-head:latest
- name: Retag and push images if branch
if: ${{ !(startsWith(github.ref_name,'master') || startsWith(github.ref_name,'main') || startsWith(github.ref_name,'backport')) && matrix.edition == 'ee' }}
run: docker tag localhost:5000/metabase-dev:${{ steps.extract_branch.outputs.branch }}-ee metabase/metabase-dev:${{ steps.extract_branch.outputs.branch }} && docker push metabase/metabase-dev:${{ steps.extract_branch.outputs.branch }}

21
.github/workflows/whitespace.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Whitespace
on:
push:
branches:
- 'master'
- 'release-**'
pull_request:
jobs:
whitespace-linter:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'whitespace-linter'
- run: clojure -T:whitespace-linter lint
name: Run Whitespace Linter

View File

@@ -1,34 +1,19 @@
name: YAML
on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
tags:
- '**'
paths:
- '**.yml'
- '**.yaml'
- 'package.json'
- 'master'
- 'release-**'
pull_request:
jobs:
yaml-linter:
runs-on: ubuntu-20.04
timeout-minutes: 5
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Prepare Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Get yarn cache
uses: actions/cache@v2
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- run: yarn install --frozen-lockfile --prefer-offline
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- run: yarn run lint-yaml

13
.gitignore vendored
View File

@@ -40,7 +40,6 @@
/modules/drivers/*/resources/namespaces.edn
/modules/drivers/*/target
/node_modules/
/osx-artifacts
/plugins
/process.yml
/reset-password-artifacts
@@ -50,19 +49,17 @@
/resources/frontend_client/index.html
/resources/frontend_client/public.html
/resources/i18n/*.edn
/resources/license-backend-third-party.txt
/resources/license-frontend-third-party.txt
/resources/namespaces.edn
/resources/sample-dataset.db.trace.db
/resources/version.properties
/screenshots
/sqlite.db
/stats.json
/storybook-static
/target
/test-report-*
OSX/.cpcache
OSX/Metabase/jre
OSX/Resources/metabase.jar
OSX/build
OSX/dsa_priv.pem
\#*\#
bin/node_modules/
bin/release/aws-eb/metabase-aws-eb.zip
@@ -75,10 +72,12 @@ xcshareddata
xcuserdata
dev/src/dev/nocommit/
*~
**/cypress_sample_dataset.json
**/cypress_sample_database.json
/frontend/src/cljs
.shadow-cljs
# lsp: ignore all but the config file
.lsp/*
!.lsp/config.edn
.clj-kondo/.cache
*.code-workspace

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn precommit

View File

@@ -1 +0,0 @@
lein_tasks

View File

@@ -1,4 +1,8 @@
{:keep-require-at-start? true
:show-docs-arity-on-same-line? true
:project-specs [{:project-path "project.clj"
:classpath-cmd ["lein" "with-profile" "+ee" "classpath"]}]}
:project-specs [{:project-path "deps.edn"
:classpath-cmd ["clojure" "-A:dev:ee:ee-dev:drivers:drivers-dev" "-Spath"]}]
:linters {:clojure-lsp/unused-public-var {:level :warning
:exclude-when-defined-by
#{metabase.api.common/defendpoint}}}}

7
.percy.yml Normal file
View File

@@ -0,0 +1,7 @@
version: 2
snapshot:
widths:
- 1280
min-height: 800
discovery:
disable-cache: true

29
.storybook/main.js Normal file
View File

@@ -0,0 +1,29 @@
const appConfig = require("../webpack.config");
module.exports = {
core: {
builder: "webpack5",
},
stories: [
"../frontend/**/*.stories.mdx",
"../frontend/**/*.stories.@(js|jsx|ts|tsx)",
],
addons: ["@storybook/addon-essentials", "@storybook/addon-links"],
webpackFinal: storybookConfig => ({
...storybookConfig,
module: {
...storybookConfig.module,
rules: [
...storybookConfig.module.rules.filter(rule => !isCSSRule(rule)),
...appConfig.module.rules.filter(rule => isCSSRule(rule)),
],
},
resolve: {
...storybookConfig.resolve,
alias: appConfig.resolve.alias,
extensions: appConfig.resolve.extensions,
},
}),
};
const isCSSRule = rule => rule.test.toString() === "/\\.css$/";

11
.storybook/preview.js Normal file
View File

@@ -0,0 +1,11 @@
import "metabase/css/index.css";
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};

22
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug with Firefox",
"request": "launch",
"type": "firefox",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
{
"name": "Debug with Chrome",
"request": "launch",
"type": "pwa-chrome",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
},
]
}

7
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"typescript.tsc.autoDetect": "off",
"grunt.autoDetect": "off",
"jake.autoDetect": "off",
"gulp.autoDetect": "off",
"npm.autoDetect": "off"
}

41
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,41 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Run front-end and back-end",
"type": "shell",
"command": "yarn dev",
"presentation": {
"reveal": "always"
},
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Format front-end code",
"type": "shell",
"command": "yarn prettier",
"presentation": {
"reveal": "always",
"panel": "dedicated",
"clear": true
}
},
{
"label": "Run front-end linters",
"type": "shell",
"command": "yarn lint",
"presentation": {
"reveal": "always",
"panel": "dedicated",
"clear": true
},
"problemMatcher": []
}
]
}

View File

@@ -1,94 +1,31 @@
###################
# STAGE 1.1: builder frontend
# STAGE 1: builder
###################
FROM node:12.20.1-alpine as frontend
WORKDIR /app/source
ENV FC_LANG en-US LC_CTYPE en_US.UTF-8
# frontend dependencies
COPY yarn.lock package.json .yarnrc ./
RUN yarn install --frozen-lockfile
###################
# STAGE 1.2: builder backend
###################
FROM adoptopenjdk/openjdk11:alpine as backend
WORKDIR /app/source
ENV FC_LANG en-US LC_CTYPE en_US.UTF-8
# bash: various shell scripts
# curl: needed by script that installs Clojure CLI
RUN apk add --no-cache curl bash
# lein: backend dependencies and building
RUN curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein -o /usr/local/bin/lein && \
chmod +x /usr/local/bin/lein && \
/usr/local/bin/lein upgrade
# backend dependencies
COPY project.clj .
RUN lein deps
###################
# STAGE 1.3: main builder
###################
FROM adoptopenjdk/openjdk11:alpine as builder
FROM metabase/ci:circleci-java-11-clj-1.10.3.929-07-27-2021-node-browsers as builder
ARG MB_EDITION=oss
WORKDIR /app/source
WORKDIR /home/circleci
ENV FC_LANG en-US LC_CTYPE en_US.UTF-8
# bash: various shell scripts
# curl: needed by script that installs Clojure CLI
# git: ./bin/version
# yarn: frontend building
# java-cacerts: installs updated cacerts to /etc/ssl/certs/java/cacerts
RUN apk add --no-cache coreutils bash yarn git curl java-cacerts
# lein: backend dependencies and building
RUN curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein -o /usr/local/bin/lein && \
chmod +x /usr/local/bin/lein && \
/usr/local/bin/lein upgrade
# Clojure CLI (needed for some build scripts)
RUN curl https://download.clojure.org/install/linux-install-1.10.1.708.sh -o /tmp/linux-install-1.10.1.708.sh && \
chmod +x /tmp/linux-install-1.10.1.708.sh && \
sh /tmp/linux-install-1.10.1.708.sh
COPY --from=frontend /app/source/. .
COPY --from=backend /app/source/. .
COPY --from=backend /root/. /root/
# add the rest of the source
COPY . .
# build the app
RUN INTERACTIVE=false MB_EDITION=$MB_EDITION bin/build
COPY --chown=circleci . .
RUN INTERACTIVE=false CI=true MB_EDITION=$MB_EDITION bin/build
# ###################
# # STAGE 2: runner
# ###################
FROM adoptopenjdk/openjdk11:alpine-jre as runner
## Remember that this runner image needs to be the same as bin/docker/Dockerfile with the exception that this one grabs the
## jar from the previous stage rather than the local build
WORKDIR /app
FROM eclipse-temurin:11-jre-alpine as runner
ENV FC_LANG en-US LC_CTYPE en_US.UTF-8
# dependencies
RUN apk -U upgrade && \
apk add --update --no-cache bash ttf-dejavu fontconfig curl java-cacerts && \
RUN apk add -U bash ttf-dejavu fontconfig curl java-cacerts && \
apk upgrade && \
rm -rf /var/cache/apk/* && \
mkdir -p /app/certs && \
curl https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem -o /app/certs/rds-combined-ca-bundle.pem && \
/opt/java/openjdk/bin/keytool -noprompt -import -trustcacerts -alias aws-rds -file /app/certs/rds-combined-ca-bundle.pem -keystore /etc/ssl/certs/java/cacerts -keypass changeit -storepass changeit && \
@@ -96,16 +33,12 @@ RUN apk -U upgrade && \
/opt/java/openjdk/bin/keytool -noprompt -import -trustcacerts -alias azure-cert -file /app/certs/DigiCertGlobalRootG2.crt.pem -keystore /etc/ssl/certs/java/cacerts -keypass changeit -storepass changeit && \
mkdir -p /plugins && chmod a+rwx /plugins
# add fixed cacerts
COPY --from=builder /etc/ssl/certs/java/cacerts /opt/java/openjdk/lib/security/cacerts
# add Metabase script and uberjar
RUN mkdir -p bin target/uberjar
COPY --from=builder /app/source/target/uberjar/metabase.jar /app/target/uberjar/
COPY --from=builder /app/source/bin/start /app/bin/
COPY --from=builder /home/circleci/target/uberjar/metabase.jar /app/
COPY bin/docker/run_metabase.sh /app/
# expose our default runtime port
EXPOSE 3000
# run it
ENTRYPOINT ["/app/bin/start"]
ENTRYPOINT ["/app/run_metabase.sh"]

View File

@@ -1,703 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
D105B23C1BB5BE4A00A5D850 /* back_icon@1x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B2331BB5BE4A00A5D850 /* back_icon@1x.png */; };
D105B23D1BB5BE4A00A5D850 /* back_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B2341BB5BE4A00A5D850 /* back_icon@2x.png */; };
D105B23E1BB5BE4A00A5D850 /* forward_icon@1x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B2351BB5BE4A00A5D850 /* forward_icon@1x.png */; };
D105B23F1BB5BE4A00A5D850 /* forward_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B2361BB5BE4A00A5D850 /* forward_icon@2x.png */; };
D105B2401BB5BE4A00A5D850 /* link_icon@1x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B2371BB5BE4A00A5D850 /* link_icon@1x.png */; };
D105B2411BB5BE4A00A5D850 /* link_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B2381BB5BE4A00A5D850 /* link_icon@2x.png */; };
D105B2431BB5BE4A00A5D850 /* refresh_icon@1x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B23A1BB5BE4A00A5D850 /* refresh_icon@1x.png */; };
D105B2441BB5BE4A00A5D850 /* refresh_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D105B23B1BB5BE4A00A5D850 /* refresh_icon@2x.png */; };
D121FD651BC5B2AF002101B0 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D121FD641BC5B2AF002101B0 /* Sparkle.framework */; };
D121FD671BC5B375002101B0 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = D121FD641BC5B2AF002101B0 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
D121FD691BC5B4E7002101B0 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = D121FD681BC5B4E7002101B0 /* dsa_pub.pem */; };
D162C4A81BC87D2B009F678F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D162C49A1BC87D2B009F678F /* AppDelegate.m */; };
D162C4A91BC87D2B009F678F /* MetabaseTask.m in Sources */ = {isa = PBXBuildFile; fileRef = D162C49C1BC87D2B009F678F /* MetabaseTask.m */; };
D162C4AA1BC87D2B009F678F /* SettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D162C49E1BC87D2B009F678F /* SettingsManager.m */; };
D162C4AB1BC87D2B009F678F /* TaskHealthChecker.m in Sources */ = {isa = PBXBuildFile; fileRef = D162C4A01BC87D2B009F678F /* TaskHealthChecker.m */; };
D162C4AE1BC87D2B009F678F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D162C4A51BC87D2B009F678F /* MainMenu.xib */; };
D162C4AF1BC87D2B009F678F /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D162C4A71BC87D2B009F678F /* MainViewController.m */; };
D18853BF1BB0CEC600D89803 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D18853BE1BB0CEC600D89803 /* Cocoa.framework */; };
D18853C91BB0CEC600D89803 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D18853C71BB0CEC600D89803 /* InfoPlist.strings */; };
D18853CB1BB0CEC600D89803 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D18853CA1BB0CEC600D89803 /* main.m */; };
D18853CF1BB0CEC600D89803 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = D18853CD1BB0CEC600D89803 /* Credits.rtf */; };
D18853D71BB0CEC600D89803 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D18853D61BB0CEC600D89803 /* Images.xcassets */; };
D18853DE1BB0CEC600D89803 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D18853DD1BB0CEC600D89803 /* XCTest.framework */; };
D18853DF1BB0CEC600D89803 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D18853BE1BB0CEC600D89803 /* Cocoa.framework */; };
D18853F91BB0D37C00D89803 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D18853F81BB0D37B00D89803 /* WebKit.framework */; };
D18854041BB0DC2600D89803 /* metabase.jar in Resources */ = {isa = PBXBuildFile; fileRef = D18854021BB0DB6000D89803 /* metabase.jar */; };
D18855611BB1C8D700D89803 /* jre in Resources */ = {isa = PBXBuildFile; fileRef = D188555E1BB1C86F00D89803 /* jre */; };
D1BDAC681C053E0A0075D3AC /* ResetPasswordWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = D1BDAC671C053E0A0075D3AC /* ResetPasswordWindowController.m */; };
D1BDAC6A1C053E220075D3AC /* ResetPasswordWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D1BDAC691C053E220075D3AC /* ResetPasswordWindowController.xib */; };
D1BDAC6D1C0565640075D3AC /* JavaTask.m in Sources */ = {isa = PBXBuildFile; fileRef = D1BDAC6C1C0565640075D3AC /* JavaTask.m */; };
D1BDAC721C05695B0075D3AC /* ResetPasswordTask.m in Sources */ = {isa = PBXBuildFile; fileRef = D1BDAC711C05695B0075D3AC /* ResetPasswordTask.m */; };
D1CB9FE81BCEDE9A009A61FB /* LoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = D1CB9FE71BCEDE9A009A61FB /* LoadingView.m */; };
D1CB9FEA1BCEDEA5009A61FB /* LoadingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D1CB9FE91BCEDEA5009A61FB /* LoadingView.xib */; };
D1CB9FED1BCEDF02009A61FB /* Loading_View_Inner.png in Resources */ = {isa = PBXBuildFile; fileRef = D1CB9FEB1BCEDF02009A61FB /* Loading_View_Inner.png */; };
D1CB9FEE1BCEDF02009A61FB /* Loading_View_Outer.png in Resources */ = {isa = PBXBuildFile; fileRef = D1CB9FEC1BCEDF02009A61FB /* Loading_View_Outer.png */; };
D1DFF6C31BCEF9E700ECC7B6 /* Loading_View_Inner@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D1DFF6C11BCEF9E700ECC7B6 /* Loading_View_Inner@2x.png */; };
D1DFF6C41BCEF9E700ECC7B6 /* Loading_View_Outer@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D1DFF6C21BCEF9E700ECC7B6 /* Loading_View_Outer@2x.png */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
D18853E01BB0CEC600D89803 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D18853B31BB0CEC600D89803 /* Project object */;
proxyType = 1;
remoteGlobalIDString = D18853BA1BB0CEC600D89803;
remoteInfo = Metabase;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
D121FD661BC5B364002101B0 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 12;
dstPath = "";
dstSubfolderSpec = 10;
files = (
D121FD671BC5B375002101B0 /* Sparkle.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
329A3BAF23C54C6700D0949B /* Metabase.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Metabase.entitlements; sourceTree = "<group>"; };
D105B2331BB5BE4A00A5D850 /* back_icon@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back_icon@1x.png"; sourceTree = "<group>"; };
D105B2341BB5BE4A00A5D850 /* back_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back_icon@2x.png"; sourceTree = "<group>"; };
D105B2351BB5BE4A00A5D850 /* forward_icon@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "forward_icon@1x.png"; sourceTree = "<group>"; };
D105B2361BB5BE4A00A5D850 /* forward_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "forward_icon@2x.png"; sourceTree = "<group>"; };
D105B2371BB5BE4A00A5D850 /* link_icon@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "link_icon@1x.png"; sourceTree = "<group>"; };
D105B2381BB5BE4A00A5D850 /* link_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "link_icon@2x.png"; sourceTree = "<group>"; };
D105B23A1BB5BE4A00A5D850 /* refresh_icon@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "refresh_icon@1x.png"; sourceTree = "<group>"; };
D105B23B1BB5BE4A00A5D850 /* refresh_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "refresh_icon@2x.png"; sourceTree = "<group>"; };
D121FD641BC5B2AF002101B0 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
D121FD681BC5B4E7002101B0 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; };
D162C4991BC87D2B009F678F /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
D162C49A1BC87D2B009F678F /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
D162C49B1BC87D2B009F678F /* MetabaseTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetabaseTask.h; sourceTree = "<group>"; };
D162C49C1BC87D2B009F678F /* MetabaseTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MetabaseTask.m; sourceTree = "<group>"; };
D162C49D1BC87D2B009F678F /* SettingsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsManager.h; sourceTree = "<group>"; };
D162C49E1BC87D2B009F678F /* SettingsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsManager.m; sourceTree = "<group>"; };
D162C49F1BC87D2B009F678F /* TaskHealthChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskHealthChecker.h; sourceTree = "<group>"; };
D162C4A01BC87D2B009F678F /* TaskHealthChecker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskHealthChecker.m; sourceTree = "<group>"; };
D162C4A51BC87D2B009F678F /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = "<group>"; };
D162C4A61BC87D2B009F678F /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; };
D162C4A71BC87D2B009F678F /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; };
D18853BB1BB0CEC600D89803 /* Metabase.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Metabase.app; sourceTree = BUILT_PRODUCTS_DIR; };
D18853BE1BB0CEC600D89803 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
D18853C11BB0CEC600D89803 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
D18853C21BB0CEC600D89803 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
D18853C31BB0CEC600D89803 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
D18853C61BB0CEC600D89803 /* Metabase-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Metabase-Info.plist"; sourceTree = "<group>"; };
D18853C81BB0CEC600D89803 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
D18853CA1BB0CEC600D89803 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
D18853CC1BB0CEC600D89803 /* Metabase-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Metabase-Prefix.pch"; sourceTree = "<group>"; };
D18853CE1BB0CEC600D89803 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
D18853D61BB0CEC600D89803 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ../Metabase/Images.xcassets; sourceTree = "<group>"; };
D18853DC1BB0CEC600D89803 /* MetabaseTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MetabaseTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
D18853DD1BB0CEC600D89803 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
D18853F81BB0D37B00D89803 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
D18854021BB0DB6000D89803 /* metabase.jar */ = {isa = PBXFileReference; lastKnownFileType = archive.jar; path = metabase.jar; sourceTree = "<group>"; };
D188555E1BB1C86F00D89803 /* jre */ = {isa = PBXFileReference; lastKnownFileType = folder; name = jre; path = Metabase/jre; sourceTree = "<group>"; };
D1BDAC661C053E0A0075D3AC /* ResetPasswordWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResetPasswordWindowController.h; sourceTree = "<group>"; };
D1BDAC671C053E0A0075D3AC /* ResetPasswordWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResetPasswordWindowController.m; sourceTree = "<group>"; };
D1BDAC691C053E220075D3AC /* ResetPasswordWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ResetPasswordWindowController.xib; sourceTree = "<group>"; };
D1BDAC6B1C0565640075D3AC /* JavaTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaTask.h; sourceTree = "<group>"; };
D1BDAC6C1C0565640075D3AC /* JavaTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JavaTask.m; sourceTree = "<group>"; };
D1BDAC701C05695B0075D3AC /* ResetPasswordTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResetPasswordTask.h; sourceTree = "<group>"; };
D1BDAC711C05695B0075D3AC /* ResetPasswordTask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ResetPasswordTask.m; sourceTree = "<group>"; };
D1CB9FE61BCEDE9A009A61FB /* LoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadingView.h; sourceTree = "<group>"; };
D1CB9FE71BCEDE9A009A61FB /* LoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoadingView.m; sourceTree = "<group>"; };
D1CB9FE91BCEDEA5009A61FB /* LoadingView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoadingView.xib; sourceTree = "<group>"; };
D1CB9FEB1BCEDF02009A61FB /* Loading_View_Inner.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Loading_View_Inner.png; sourceTree = "<group>"; };
D1CB9FEC1BCEDF02009A61FB /* Loading_View_Outer.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Loading_View_Outer.png; sourceTree = "<group>"; };
D1DFF6C11BCEF9E700ECC7B6 /* Loading_View_Inner@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Loading_View_Inner@2x.png"; sourceTree = "<group>"; };
D1DFF6C21BCEF9E700ECC7B6 /* Loading_View_Outer@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Loading_View_Outer@2x.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
D18853B81BB0CEC600D89803 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D18853F91BB0D37C00D89803 /* WebKit.framework in Frameworks */,
D121FD651BC5B2AF002101B0 /* Sparkle.framework in Frameworks */,
D18853BF1BB0CEC600D89803 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D18853D91BB0CEC600D89803 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D18853DF1BB0CEC600D89803 /* Cocoa.framework in Frameworks */,
D18853DE1BB0CEC600D89803 /* XCTest.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
D105B1BD1BB378C100A5D850 /* Vendor */ = {
isa = PBXGroup;
children = (
D121FD631BC5B2AF002101B0 /* Sparkle-1.11.0 */,
);
path = Vendor;
sourceTree = "<group>";
};
D105B2321BB5BE4A00A5D850 /* Images */ = {
isa = PBXGroup;
children = (
D1CB9FEB1BCEDF02009A61FB /* Loading_View_Inner.png */,
D1CB9FEC1BCEDF02009A61FB /* Loading_View_Outer.png */,
D1DFF6C11BCEF9E700ECC7B6 /* Loading_View_Inner@2x.png */,
D1DFF6C21BCEF9E700ECC7B6 /* Loading_View_Outer@2x.png */,
D105B2331BB5BE4A00A5D850 /* back_icon@1x.png */,
D105B2341BB5BE4A00A5D850 /* back_icon@2x.png */,
D105B2351BB5BE4A00A5D850 /* forward_icon@1x.png */,
D105B2361BB5BE4A00A5D850 /* forward_icon@2x.png */,
D105B2371BB5BE4A00A5D850 /* link_icon@1x.png */,
D105B2381BB5BE4A00A5D850 /* link_icon@2x.png */,
D105B23A1BB5BE4A00A5D850 /* refresh_icon@1x.png */,
D105B23B1BB5BE4A00A5D850 /* refresh_icon@2x.png */,
);
path = Images;
sourceTree = "<group>";
};
D121FD631BC5B2AF002101B0 /* Sparkle-1.11.0 */ = {
isa = PBXGroup;
children = (
D121FD641BC5B2AF002101B0 /* Sparkle.framework */,
);
path = "Sparkle-1.11.0";
sourceTree = "<group>";
};
D162C4981BC87D2B009F678F /* Backend */ = {
isa = PBXGroup;
children = (
D162C4991BC87D2B009F678F /* AppDelegate.h */,
D162C49A1BC87D2B009F678F /* AppDelegate.m */,
D162C49D1BC87D2B009F678F /* SettingsManager.h */,
D162C49E1BC87D2B009F678F /* SettingsManager.m */,
D162C49F1BC87D2B009F678F /* TaskHealthChecker.h */,
D162C4A01BC87D2B009F678F /* TaskHealthChecker.m */,
D1BDAC6B1C0565640075D3AC /* JavaTask.h */,
D1BDAC6C1C0565640075D3AC /* JavaTask.m */,
D162C49B1BC87D2B009F678F /* MetabaseTask.h */,
D162C49C1BC87D2B009F678F /* MetabaseTask.m */,
D1BDAC701C05695B0075D3AC /* ResetPasswordTask.h */,
D1BDAC711C05695B0075D3AC /* ResetPasswordTask.m */,
);
path = Backend;
sourceTree = "<group>";
};
D162C4A11BC87D2B009F678F /* UI */ = {
isa = PBXGroup;
children = (
D162C4A51BC87D2B009F678F /* MainMenu.xib */,
D162C4A61BC87D2B009F678F /* MainViewController.h */,
D162C4A71BC87D2B009F678F /* MainViewController.m */,
D1CB9FE61BCEDE9A009A61FB /* LoadingView.h */,
D1CB9FE71BCEDE9A009A61FB /* LoadingView.m */,
D1CB9FE91BCEDEA5009A61FB /* LoadingView.xib */,
D1BDAC661C053E0A0075D3AC /* ResetPasswordWindowController.h */,
D1BDAC671C053E0A0075D3AC /* ResetPasswordWindowController.m */,
D1BDAC691C053E220075D3AC /* ResetPasswordWindowController.xib */,
);
path = UI;
sourceTree = "<group>";
};
D18853B21BB0CEC600D89803 = {
isa = PBXGroup;
children = (
D188555E1BB1C86F00D89803 /* jre */,
D18853C41BB0CEC600D89803 /* Metabase */,
D18854011BB0DB6000D89803 /* Resources */,
D105B1BD1BB378C100A5D850 /* Vendor */,
D18853BD1BB0CEC600D89803 /* Frameworks */,
D18853BC1BB0CEC600D89803 /* Products */,
);
sourceTree = "<group>";
};
D18853BC1BB0CEC600D89803 /* Products */ = {
isa = PBXGroup;
children = (
D18853BB1BB0CEC600D89803 /* Metabase.app */,
D18853DC1BB0CEC600D89803 /* MetabaseTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
D18853BD1BB0CEC600D89803 /* Frameworks */ = {
isa = PBXGroup;
children = (
D18853F81BB0D37B00D89803 /* WebKit.framework */,
D18853BE1BB0CEC600D89803 /* Cocoa.framework */,
D18853DD1BB0CEC600D89803 /* XCTest.framework */,
D18853C01BB0CEC600D89803 /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
D18853C01BB0CEC600D89803 /* Other Frameworks */ = {
isa = PBXGroup;
children = (
D18853C11BB0CEC600D89803 /* AppKit.framework */,
D18853C21BB0CEC600D89803 /* CoreData.framework */,
D18853C31BB0CEC600D89803 /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
D18853C41BB0CEC600D89803 /* Metabase */ = {
isa = PBXGroup;
children = (
329A3BAF23C54C6700D0949B /* Metabase.entitlements */,
D162C4981BC87D2B009F678F /* Backend */,
D162C4A11BC87D2B009F678F /* UI */,
D18853C51BB0CEC600D89803 /* Supporting Files */,
);
path = Metabase;
sourceTree = "<group>";
};
D18853C51BB0CEC600D89803 /* Supporting Files */ = {
isa = PBXGroup;
children = (
D18853C61BB0CEC600D89803 /* Metabase-Info.plist */,
D18853C71BB0CEC600D89803 /* InfoPlist.strings */,
D18853CA1BB0CEC600D89803 /* main.m */,
D18853CC1BB0CEC600D89803 /* Metabase-Prefix.pch */,
D18853CD1BB0CEC600D89803 /* Credits.rtf */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
D18854011BB0DB6000D89803 /* Resources */ = {
isa = PBXGroup;
children = (
D18853D61BB0CEC600D89803 /* Images.xcassets */,
D105B2321BB5BE4A00A5D850 /* Images */,
D18854021BB0DB6000D89803 /* metabase.jar */,
D121FD681BC5B4E7002101B0 /* dsa_pub.pem */,
);
path = Resources;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
D18853BA1BB0CEC600D89803 /* Metabase */ = {
isa = PBXNativeTarget;
buildConfigurationList = D18853EC1BB0CEC600D89803 /* Build configuration list for PBXNativeTarget "Metabase" */;
buildPhases = (
D18853B71BB0CEC600D89803 /* Sources */,
D18853B81BB0CEC600D89803 /* Frameworks */,
D18853B91BB0CEC600D89803 /* Resources */,
D18854051BB1B90000D89803 /* Kill Existing Processes Listening on Ports 13000 - 14000 */,
D121FD661BC5B364002101B0 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = Metabase;
productName = Metabase;
productReference = D18853BB1BB0CEC600D89803 /* Metabase.app */;
productType = "com.apple.product-type.application";
};
D18853DB1BB0CEC600D89803 /* MetabaseTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = D18853EF1BB0CEC600D89803 /* Build configuration list for PBXNativeTarget "MetabaseTests" */;
buildPhases = (
D18853D81BB0CEC600D89803 /* Sources */,
D18853D91BB0CEC600D89803 /* Frameworks */,
D18853DA1BB0CEC600D89803 /* Resources */,
);
buildRules = (
);
dependencies = (
D18853E11BB0CEC600D89803 /* PBXTargetDependency */,
);
name = MetabaseTests;
productName = MetabaseTests;
productReference = D18853DC1BB0CEC600D89803 /* MetabaseTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
D18853B31BB0CEC600D89803 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1120;
ORGANIZATIONNAME = Metabase;
TargetAttributes = {
D18853BA1BB0CEC600D89803 = {
DevelopmentTeam = BR27ZJK7WW;
};
D18853DB1BB0CEC600D89803 = {
TestTargetID = D18853BA1BB0CEC600D89803;
};
};
};
buildConfigurationList = D18853B61BB0CEC600D89803 /* Build configuration list for PBXProject "Metabase" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D18853B21BB0CEC600D89803;
productRefGroup = D18853BC1BB0CEC600D89803 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
D18853BA1BB0CEC600D89803 /* Metabase */,
D18853DB1BB0CEC600D89803 /* MetabaseTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
D18853B91BB0CEC600D89803 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D1DFF6C31BCEF9E700ECC7B6 /* Loading_View_Inner@2x.png in Resources */,
D1CB9FEE1BCEDF02009A61FB /* Loading_View_Outer.png in Resources */,
D105B23D1BB5BE4A00A5D850 /* back_icon@2x.png in Resources */,
D121FD691BC5B4E7002101B0 /* dsa_pub.pem in Resources */,
D1BDAC6A1C053E220075D3AC /* ResetPasswordWindowController.xib in Resources */,
D18855611BB1C8D700D89803 /* jre in Resources */,
D162C4AE1BC87D2B009F678F /* MainMenu.xib in Resources */,
D105B2401BB5BE4A00A5D850 /* link_icon@1x.png in Resources */,
D18854041BB0DC2600D89803 /* metabase.jar in Resources */,
D18853C91BB0CEC600D89803 /* InfoPlist.strings in Resources */,
D105B2431BB5BE4A00A5D850 /* refresh_icon@1x.png in Resources */,
D105B23F1BB5BE4A00A5D850 /* forward_icon@2x.png in Resources */,
D18853D71BB0CEC600D89803 /* Images.xcassets in Resources */,
D105B23E1BB5BE4A00A5D850 /* forward_icon@1x.png in Resources */,
D1CB9FEA1BCEDEA5009A61FB /* LoadingView.xib in Resources */,
D1CB9FED1BCEDF02009A61FB /* Loading_View_Inner.png in Resources */,
D105B23C1BB5BE4A00A5D850 /* back_icon@1x.png in Resources */,
D1DFF6C41BCEF9E700ECC7B6 /* Loading_View_Outer@2x.png in Resources */,
D18853CF1BB0CEC600D89803 /* Credits.rtf in Resources */,
D105B2411BB5BE4A00A5D850 /* link_icon@2x.png in Resources */,
D105B2441BB5BE4A00A5D850 /* refresh_icon@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D18853DA1BB0CEC600D89803 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
D18854051BB1B90000D89803 /* Kill Existing Processes Listening on Ports 13000 - 14000 */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Kill Existing Processes Listening on Ports 13000 - 14000";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /usr/bin/perl;
shellScript = "foreach(split(/\\n/, `lsof -i :13000-14000`)) {\n s/^[^\\d]+(\\d+).*$/$1/;\n m/^\\d+$/ && system('kill', $_);\n}";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
D18853B71BB0CEC600D89803 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D162C4AB1BC87D2B009F678F /* TaskHealthChecker.m in Sources */,
D1CB9FE81BCEDE9A009A61FB /* LoadingView.m in Sources */,
D162C4AA1BC87D2B009F678F /* SettingsManager.m in Sources */,
D18853CB1BB0CEC600D89803 /* main.m in Sources */,
D162C4AF1BC87D2B009F678F /* MainViewController.m in Sources */,
D1BDAC6D1C0565640075D3AC /* JavaTask.m in Sources */,
D1BDAC721C05695B0075D3AC /* ResetPasswordTask.m in Sources */,
D162C4A91BC87D2B009F678F /* MetabaseTask.m in Sources */,
D162C4A81BC87D2B009F678F /* AppDelegate.m in Sources */,
D1BDAC681C053E0A0075D3AC /* ResetPasswordWindowController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
D18853D81BB0CEC600D89803 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
D18853E11BB0CEC600D89803 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D18853BA1BB0CEC600D89803 /* Metabase */;
targetProxy = D18853E01BB0CEC600D89803 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
D18853C71BB0CEC600D89803 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
D18853C81BB0CEC600D89803 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
D18853CD1BB0CEC600D89803 /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
D18853CE1BB0CEC600D89803 /* en */,
);
name = Credits.rtf;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
D18853EA1BB0CEC600D89803 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
};
name = Debug;
};
D18853EB1BB0CEC600D89803 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
VALID_ARCHS = x86_64;
};
name = Release;
};
D18853ED1BB0CEC600D89803 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Metabase/Metabase.entitlements;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Vendor/Sparkle-1.11.0",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Metabase/Metabase-Prefix.pch";
INFOPLIST_FILE = "Metabase/Metabase-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.metabase.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
D18853EE1BB0CEC600D89803 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Metabase/Metabase.entitlements;
CODE_SIGN_IDENTITY = "-";
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Vendor/Sparkle-1.11.0",
);
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Metabase/Metabase-Prefix.pch";
INFOPLIST_FILE = "Metabase/Metabase-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.metabase.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
D18853F01BB0CEC600D89803 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Metabase.app/Contents/MacOS/Metabase";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Metabase/Metabase-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "MetabaseTests/MetabaseTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
D18853F11BB0CEC600D89803 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Metabase.app/Contents/MacOS/Metabase";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(DEVELOPER_FRAMEWORKS_DIR)",
"$(inherited)",
);
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Metabase/Metabase-Prefix.pch";
INFOPLIST_FILE = "MetabaseTests/MetabaseTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
D18853B61BB0CEC600D89803 /* Build configuration list for PBXProject "Metabase" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D18853EA1BB0CEC600D89803 /* Debug */,
D18853EB1BB0CEC600D89803 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D18853EC1BB0CEC600D89803 /* Build configuration list for PBXNativeTarget "Metabase" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D18853ED1BB0CEC600D89803 /* Debug */,
D18853EE1BB0CEC600D89803 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
D18853EF1BB0CEC600D89803 /* Build configuration list for PBXNativeTarget "MetabaseTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D18853F01BB0CEC600D89803 /* Debug */,
D18853F11BB0CEC600D89803 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = D18853B31BB0CEC600D89803 /* Project object */;
}

View File

@@ -1,20 +0,0 @@
//
// AppDelegate.h
// Metabase
//
// Created by Cam Saul on 9/21/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
@import Cocoa;
@interface AppDelegate : NSObject <NSApplicationDelegate>
+ (AppDelegate *)instance;
@property (readonly) NSUInteger port;
- (void)stopMetabaseTask;
- (void)startMetabaseTask;
@end

View File

@@ -1,89 +0,0 @@
//
// AppDelegate.m
// Metabase
//
// Created by Cam Saul on 9/21/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import <Sparkle/Sparkle.h>
#import "AppDelegate.h"
#import "MainViewController.h"
#import "MetabaseTask.h"
#import "TaskHealthChecker.h"
@interface AppDelegate ()
@property (weak) IBOutlet NSWindow *window;
@property (strong, nonatomic) MetabaseTask *task;
@property (strong, nonatomic) TaskHealthChecker *healthChecker;
@end
static AppDelegate *sInstance = nil;
@implementation AppDelegate
+ (AppDelegate *)instance {
return sInstance;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
sInstance = self;
[[SUUpdater sharedUpdater] checkForUpdatesInBackground];
[self startMetabaseTask];
[self.healthChecker start];
}
- (void)applicationDidBecomeActive:(NSNotification *)notification {
// re-start the health checker if it's not checking like it should be : the HEALTH CHECKER HEALTH CHECKER
[self.healthChecker start];
}
- (void)applicationWillTerminate:(NSNotification *)notification {
[self stopMetabaseTask];
}
#pragma mark - Static Methods
- (void)startMetabaseTask {
self.task = [MetabaseTask task];
self.healthChecker.port = self.task.port;
}
- (void)stopMetabaseTask {
[self.task disableTerminationAlert];
self.task = nil;
}
#pragma mark - Getters / Setters
- (TaskHealthChecker *)healthChecker {
if (!_healthChecker) {
_healthChecker = [[TaskHealthChecker alloc] init];
}
return _healthChecker;
}
- (void)setTask:(MetabaseTask *)task {
[_task terminate];
_task = task;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[task launch];
});
}
- (NSUInteger)port {
return self.task.port;
}
@end

View File

@@ -1,26 +0,0 @@
//
// JavaTask.h
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
NSString *JREPath();
NSString *UberjarPath();
NSString *DBPath(); ///< Path to the H2 DB file
NSString *PluginsDirPath(); ///< Path for plugins
/// Base class for running JRE-based NSTasks
@interface JavaTask : NSObject
@property (strong, nonatomic) NSTask *task;
/// Called when a new data is written to the task's stdin / stdout. Default implementation does nothing. This is called on a background thread!
- (void)readHandleDidRead:(NSString *)message;
/// Terminate the associated NSTask.
- (void)terminate;
@end

View File

@@ -1,115 +0,0 @@
//
// JavaTask.m
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import "JavaTask.h"
NSString *JREPath() {
return [[NSBundle mainBundle] pathForResource:@"java" ofType:nil inDirectory:@"jre/bin"];
}
NSString *UberjarPath() {
return [[NSBundle mainBundle] pathForResource:@"metabase" ofType:@"jar"];
}
NSString *ApplicationSupportDirPath() {
NSString *applicationSupportDir = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:@"Metabase"];
if (![[NSFileManager defaultManager] fileExistsAtPath:applicationSupportDir]) {
NSError *error = nil;
[[NSFileManager defaultManager] createDirectoryAtPath:applicationSupportDir withIntermediateDirectories:YES attributes:nil error:&error];
if (error) {
NSLog(@"Error creating %@: %@", applicationSupportDir, error.localizedDescription);
}
}
return applicationSupportDir;
}
NSString *DBPath() {
return [ApplicationSupportDirPath() stringByAppendingPathComponent:@"metabase.db"];
}
NSString *PluginsDirPath() {
return [ApplicationSupportDirPath() stringByAppendingPathComponent:@"Plugins"];
}
@interface JavaTask ()
@property (nonatomic, strong) NSPipe *pipe;
@property (nonatomic, strong) NSFileHandle *readHandle;
@end
@implementation JavaTask
- (void)dealloc {
[self terminate];
}
#pragma mark - Local Methods
- (void)readHandleDidReadData:(NSData *)data {
NSString *message = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
if (!message.length) return;
[self readHandleDidRead:message];
}
- (void)readHandleDidRead:(NSString *)message {}
- (void)terminate {
if (!self.task) return; // already dead
NSLog(@"Killing %@ @ 0x%zx...", [self class], (size_t)self);
self.task = nil;
}
#pragma mark - Getters / Setters
- (void)setTask:(NSTask *)task {
self.pipe = nil;
[_task terminate];
_task = task;
if (task) {
self.pipe = [NSPipe pipe];
task.standardOutput = self.pipe;
task.standardError = self.pipe;
}
}
- (void)setPipe:(NSPipe *)pipe {
self.readHandle = nil;
_pipe = pipe;
if (pipe) {
self.readHandle = pipe.fileHandleForReading;
}
}
- (void)setReadHandle:(NSFileHandle *)readHandle {
[_readHandle closeFile];
_readHandle = readHandle;
if (readHandle) {
__weak JavaTask *weakSelf = self;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
while (readHandle == weakSelf.readHandle) {
NSData *data = readHandle.availableData;
if (!data.length) return;
[weakSelf readHandleDidReadData:data];
}
});
}
}
@end

View File

@@ -1,25 +0,0 @@
//
// MetabaseTask.h
// Metabase
//
// Created by Cam Saul on 10/9/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import "JavaTask.h"
/// Task for running the MetabaseServer
@interface MetabaseTask : JavaTask
/// Create (and launch) a task to run the Metabase backend server.
+ (MetabaseTask *)task;
- (void)launch;
/// Remove the task termination handler that pops up the 'Task died unexpectedly' alert.
/// For cases when we want to kill the Metabase task without freaking the user out, e.g. for Reset Password
- (void)disableTerminationAlert;
- (NSUInteger)port;
@end

View File

@@ -1,134 +0,0 @@
//
// MetabaseTask.m
// Metabase
//
// Created by Cam Saul on 10/9/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import "MetabaseTask.h"
@interface MetabaseTask ()
@property (nonatomic) NSUInteger port;
@property (nonatomic, strong) NSMutableArray *lastMessages; ///< 10 most recently logged messages.
@end
@implementation MetabaseTask
+ (MetabaseTask *)task {
return [[MetabaseTask alloc] init];
}
#pragma mark - Local Methods
- (void)readHandleDidRead:(NSString *)message {
// skip calls to health endpoint
if ([message rangeOfString:@"GET /api/health"].location != NSNotFound) return;
// strip off the timestamp that comes back from the backend so we don't get double-timestamps when NSLog adds its own
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^[\\d-:,\\s]+(.*$)" options:NSRegularExpressionAnchorsMatchLines|NSRegularExpressionAllowCommentsAndWhitespace error:nil];
message = [regex stringByReplacingMatchesInString:message options:0 range:NSMakeRange(0, message.length) withTemplate:@"$1"];
// remove control codes used to color output
regex = [NSRegularExpression regularExpressionWithPattern:@"\\[\\d+m" options:0 error:nil];
message = [regex stringByReplacingMatchesInString:message options:0 range:NSMakeRange(0, message.length) withTemplate:@""];
// add the message to the recently logged messages. If we now have more than 5 remove the oldest
[self.lastMessages addObject:message];
if (self.lastMessages.count > 10) [self.lastMessages removeObjectAtIndex:0];
// log the message the normal way as well
NSLog(@"%@", message);
}
- (void)deleteOldDBLockFilesIfNeeded {
NSString *lockFile = [DBPath() stringByAppendingString:@".lock.db"];
NSString *traceFile = [DBPath() stringByAppendingString:@".trace.db"];
for (NSString *file in @[lockFile, traceFile]) {
if ([[NSFileManager defaultManager] fileExistsAtPath:file]) {
NSLog(@"Deleting %@...", file);
NSError *error = nil;
[[NSFileManager defaultManager] removeItemAtPath:file error:&error];
if (error) {
NSLog(@"Error deleting %@: %@", file, error.localizedDescription);
}
}
}
}
- (void)launch {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[self deleteOldDBLockFilesIfNeeded];
NSLog(@"Starting MetabaseTask @ 0x%zx...", (size_t)self);
self.task = [[NSTask alloc] init];
self.task.launchPath = JREPath();
self.task.environment = @{@"MB_DB_FILE": DBPath(),
@"MB_PLUGINS_DIR": PluginsDirPath(),
@"MB_JETTY_PORT": @(self.port),
@"MB_CLIENT": @"OSX"};
self.task.arguments = @[@"-Djava.awt.headless=true", // this prevents the extra java icon from popping up in the dock when running
@"-client", // make sure we're running in -client mode, which has a faster lanuch time
@"-Xverify:none", // disable bytecode verification for faster launch speed, not really needed here since JAR is packaged as part of signed .app
@"-jar", UberjarPath()];
__weak MetabaseTask *weakSelf = self;
self.task.terminationHandler = ^(NSTask *task){
NSLog(@"\n\n!!!!! Task terminated with exit code %d !!!!!\n\n", task.terminationStatus);
dispatch_async(dispatch_get_main_queue(), ^{
if ([[NSAlert alertWithMessageText:@"Fatal Error"
defaultButton:@"Restart"
alternateButton:@"Quit"
otherButton:nil
informativeTextWithFormat:@"The Metabase server terminated unexpectedly.\n\nMessages:\n%@", [weakSelf.lastMessages componentsJoinedByString:@""]] // components should already have newline at end
runModal] == NSAlertDefaultReturn) {
[weakSelf launch];
} else {
exit(task.terminationStatus);
}
});
};
NSLog(@"Launching MetabaseTask\nMB_DB_FILE='%@'\nMB_PLUGINS_DIR='%@'\nMB_JETTY_PORT=%lu\n%@ -jar %@", DBPath(), PluginsDirPath(), self.port, JREPath(), UberjarPath());
[self.task launch];
});
}
- (void)terminate {
[super terminate];
_port = 0;
}
- (void)disableTerminationAlert {
self.task.terminationHandler = nil;
}
#pragma mark - Getters / Setters
- (NSUInteger)port {
if (!_port) {
srand((unsigned)time(NULL));
_port = (rand() % 1000) + 13000;
NSLog(@"Using port %lu", _port);
}
return _port;
}
- (NSMutableArray *)lastMessages {
if (!_lastMessages) _lastMessages = [NSMutableArray array];
return _lastMessages;
}
@end

View File

@@ -1,16 +0,0 @@
//
// ResetPasswordTask.h
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import "JavaTask.h"
@interface ResetPasswordTask : JavaTask
/// blocks are ran on main thread <3
- (void)resetPasswordForEmailAddress:(NSString *)emailAddress success:(void(^)(NSString *resetToken))successBlock error:(void(^)(NSString *errorMessage))errorBlock;
@end

View File

@@ -1,85 +0,0 @@
//
// ResetPasswordTask.m
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import "AppDelegate.h"
#import "ResetPasswordTask.h"
@interface ResetPasswordTask ()
@property (copy) NSString *output;
@end
@implementation ResetPasswordTask
#pragma mark - Local Methods
- (void)resetPasswordForEmailAddress:(NSString *)emailAddress success:(void (^)(NSString *))successBlock error:(void (^)(NSString *))errorBlock {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
// first, we need to stop the main Metabase task so we can access the DB
NSLog(@"Stopping Metabase task in order to reset password...");
[[AppDelegate instance] stopMetabaseTask];
self.task = [[NSTask alloc] init];
// time travelers from the future: this is hardcoded since I'm the only one who works on this. I give you permission to fix it - Cam
#define DEBUG_RUN_LEIN_TASK 0
#if DEBUG_RUN_LEIN_TASK
self.task.environment = @{@"MB_DB_FILE": DBPath()};
self.task.currentDirectoryPath = @"/Users/cam/metabase";
self.task.launchPath = @"/usr/local/bin/lein";
self.task.arguments = @[@"run", @"reset-password", emailAddress];
NSLog(@"Launching ResetPasswordTask\nMB_DB_FILE='%@' lein run reset-password %@", DBPath(), emailAddress);
#else
self.task.environment = @{@"MB_DB_FILE": DBPath()};
self.task.launchPath = JREPath();
self.task.arguments = @[@"-Djava.awt.headless=true", // this prevents the extra java icon from popping up in the dock when running
@"-Xverify:none", // disable bytecode verification for faster launch speed, not really needed here since JAR is packaged as part of signed .app
@"-jar", UberjarPath(),
@"reset-password", emailAddress];
NSLog(@"Launching ResetPasswordTask\nMB_DB_FILE='%@' %@ -jar %@ reset-password %@", DBPath(), JREPath(), UberjarPath(), emailAddress);
#endif
__weak ResetPasswordTask *weakSelf = self;
self.task.terminationHandler = ^(NSTask *task) {
NSLog(@"ResetPasswordTask terminated with status: %d", task.terminationStatus);
[weakSelf terminate];
dispatch_async(dispatch_get_main_queue(), ^{
if (!task.terminationStatus && weakSelf.output.length >= 38) { // should be of format <user-id>_<36-char-uuid>, e.g. "1_b20466b9-1f5b-488d-8ab6-5039107482f8"
successBlock(weakSelf.output);
} else {
errorBlock(weakSelf.output.length ? weakSelf.output : @"An unknown error has occured.");
}
// now restart the main Metabase task
NSLog(@"Reset password complete, restarting Metabase task...");
[[AppDelegate instance] startMetabaseTask];
});
};
[self.task launch];
});
}
- (void)readHandleDidRead:(NSString *)message {
NSLog(@"[PasswordResetTask] %@", message);
/// output comes back like "STATUS [[[message]]]"
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^(?:(?:OK)||(?:FAIL))\\s+\\[\\[\\[(.+)\\]\\]\\]\\s*$" options:NSRegularExpressionAnchorsMatchLines|NSRegularExpressionAllowCommentsAndWhitespace error:NULL];
if (![regex numberOfMatchesInString:message options:0 range:NSMakeRange(0, message.length)]) return;
NSString *result = [regex stringByReplacingMatchesInString:message options:0 range:NSMakeRange(0, message.length) withTemplate:@"$1"];
if (result) {
self.output = result;
NSLog(@"[PasswordResetTask] task output is '%@'", self.output);
}
}
@end

View File

@@ -1,17 +0,0 @@
//
// SettingsManager.h
// Metabase
//
// Created by Cam Saul on 9/22/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
NSString *LocalHostBaseURL();
@interface SettingsManager : NSObject
+ (instancetype)instance;
@property (copy) NSString *baseURL;
@end

View File

@@ -1,41 +0,0 @@
//
// SettingsManager.m
// Metabase
//
// Created by Cam Saul on 9/22/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import "AppDelegate.h"
#import "SettingsManager.h"
static SettingsManager *sSettingsManager = nil;
static NSString * const BaseURLUserDefaultsKey = @"com.metabase.baseURL";
NSString *LocalHostBaseURL() {
return [NSString stringWithFormat:@"http://localhost:%lu", [AppDelegate instance].port];
}
@implementation SettingsManager
+ (instancetype)instance {
@synchronized(self) {
if (!sSettingsManager) sSettingsManager = [[SettingsManager alloc] init];
}
return sSettingsManager;
}
#pragma mark - Getters / Setters
- (NSString *)baseURL {
return [[NSUserDefaults standardUserDefaults] objectForKey:BaseURLUserDefaultsKey];
}
- (void)setBaseURL:(NSString *)baseURL {
[[NSUserDefaults standardUserDefaults] setObject:[baseURL copy] forKey:BaseURLUserDefaultsKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end

View File

@@ -1,21 +0,0 @@
//
// TaskHealthChecker.h
// Metabase
//
// Created by Cam Saul on 10/9/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
static NSString * const MetabaseTaskBecameHealthyNotification = @"MetabaseTaskBecameHealthyNotification";
static NSString * const MetabaseTaskBecameUnhealthyNotification = @"MetabaseTaskBecameUnhealthyNotification";
/// Manages the MetabaseTask (server) and restarts it if it gets unresponsive
@interface TaskHealthChecker : NSObject
@property () NSUInteger port;
/// (re)start the health checker
- (void)start;
- (void)stop;
@end

View File

@@ -1,117 +0,0 @@
//
// TaskHealthChecker.m
// Metabase
//
// Created by Cam Saul on 10/9/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import "TaskHealthChecker.h"
/// Check out health every this many seconds
static const CGFloat HealthCheckIntervalSeconds = 1.0f;
/// This number should be lower than HealthCheckIntervalSeconds so requests don't end up piling up
static const CGFloat HealthCheckRequestTimeout = 1.75f;
@interface TaskHealthChecker ()
@property (strong, nonatomic) NSOperationQueue *healthCheckOperationQueue;
@property (strong, nonatomic) NSTimer *healthCheckTimer;
@property (nonatomic) BOOL healthy;
/// Set this to YES after server has started successfully one time
/// we'll hold of on the whole killing the Metabase server until it launches one time, I guess
@property (nonatomic) BOOL hasEverBeenHealthy;
@end
@implementation TaskHealthChecker
- (void)dealloc {
[self stop];
}
#pragma mark - Local Methods
- (void)start {
NSLog(@"(re)starting health checker @ 0x%zx...", (size_t)self);
self.healthCheckOperationQueue = [[NSOperationQueue alloc] init];
self.healthCheckOperationQueue.maxConcurrentOperationCount = 1;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
self.healthCheckTimer = [NSTimer timerWithTimeInterval:HealthCheckIntervalSeconds target:self selector:@selector(checkHealth) userInfo:nil repeats:YES];
self.healthCheckTimer.tolerance = HealthCheckIntervalSeconds / 2.0f;
[[NSRunLoop mainRunLoop] addTimer:self.healthCheckTimer forMode:NSRunLoopCommonModes];
});
}
- (void)stop {
self.healthCheckTimer = nil;
self.healthCheckOperationQueue = nil;
}
- (void)checkHealth:(void(^)(BOOL healthy))completion {
/// Cancel any pending checks so they don't pile up indefinitely
[self.healthCheckOperationQueue cancelAllOperations];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:%lu/api/health", self.port]] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:HealthCheckRequestTimeout];
[NSURLConnection sendAsynchronousRequest:request queue:self.healthCheckOperationQueue completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (connectionError) {
completion(NO);
return;
}
NSError *jsonError = nil;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&jsonError];
if (jsonError) {
completion(NO);
return;
}
completion([json[@"status"] isEqualToString:@"ok"]);
}];
}
- (void)checkHealth {
// run the health check on the high-priorty GCD queue because it's imperative that it complete so we can get an accurate picture of Mac App health
__weak TaskHealthChecker *weakSelf = self;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[weakSelf checkHealth:^(BOOL healthy) {
if (!healthy) NSLog(@"😷");
if (healthy && !weakSelf.healthy) NSLog(@"✅");
weakSelf.healthy = healthy;
}];
});
}
#pragma mark - Getters / Setters
- (void)setHealthCheckTimer:(NSTimer *)healthCheckTimer {
[_healthCheckTimer invalidate];
_healthCheckTimer = healthCheckTimer;
}
- (void)setHealthCheckOperationQueue:(NSOperationQueue *)healthCheckOperationQueue {
[_healthCheckOperationQueue cancelAllOperations];
_healthCheckOperationQueue = healthCheckOperationQueue;
}
- (void)setHealthy:(BOOL)healthy {
if (_healthy == healthy) return;
_healthy = healthy;
NSLog(@"Server is now %@", healthy ? @"HEALTHY" : @"UNHEALTHY");
__weak TaskHealthChecker *weakSelf = self;
NSString *notification = healthy ? MetabaseTaskBecameHealthyNotification : MetabaseTaskBecameUnhealthyNotification;
[[NSNotificationCenter defaultCenter] postNotificationName:notification object:weakSelf];
}
@end

View File

@@ -1,68 +0,0 @@
{
"images" : [
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "Logo_16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "Logo_32.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "Logo_32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "Logo_64.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "Logo_128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "Logo_256.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "Logo_256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "Logo_512.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "Logo_512.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "Logo_1024.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

View File

@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.37.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.37.2</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Metabase. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SUEnableAutomaticChecks</key>
<true/>
<key>SUFeedURL</key>
<string>https://downloads.metabase.com/appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
</dict>
</plist>

View File

@@ -1,9 +0,0 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#ifdef __OBJC__
@import Cocoa;
#endif

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>

View File

@@ -1,15 +0,0 @@
//
// LoadingView.h
// Metabase
//
// Created by Cam Saul on 10/14/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
@import Cocoa;
@interface LoadingView : NSView
@property (nonatomic) BOOL animate;
@end

View File

@@ -1,58 +0,0 @@
//
// LoadingView.m
// Metabase
//
// Created by Cam Saul on 10/14/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
@import QuartzCore;
#import "LoadingView.h"
@interface LoadingView ()
@property (weak) IBOutlet NSImageView *outerImageView;
@end
@implementation LoadingView
#pragma mark - Lifecycle
- (instancetype)init {
NSArray *objects;
[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil topLevelObjects:&objects];
for (id obj in objects) {
if ([obj isMemberOfClass:[self class]]) return obj;
}
return nil;
}
- (void)awakeFromNib {
self.outerImageView.wantsLayer = YES;
}
#pragma mark - Getters / Setters
- (void)setAnimate:(BOOL)animate {
if (_animate == animate) return;
_animate = animate;
if (!animate) {
[self.outerImageView.layer removeAllAnimations];
} else {
self.outerImageView.layer.position = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
self.outerImageView.layer.anchorPoint = CGPointMake(0.5f, 0.5f);
CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotation.fromValue = @(M_PI * 2.0f);
rotation.toValue = @0.0f;
rotation.duration = 2.0f;
rotation.repeatCount = HUGE_VALF;
[self.outerImageView.layer addAnimation:rotation forKey:@"rotation"];
}
}
@end

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="c22-O7-iKe" customClass="LoadingView">
<rect key="frame" x="0.0" y="0.0" width="200" height="200"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView canDrawConcurrently="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cZb-9N-gBv" userLabel="outerImageView">
<rect key="frame" x="6" y="6" width="188" height="188"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" image="Loading_View_Outer" id="gdw-zk-O24"/>
</imageView>
<imageView canDrawConcurrently="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Ppb-yU-gW5" userLabel="innerImageView">
<rect key="frame" x="42" y="42" width="116" height="116"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" image="Loading_View_Inner" id="umY-yg-KA6"/>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="centerY" secondItem="Ppb-yU-gW5" secondAttribute="centerY" id="DZe-EF-QxD"/>
<constraint firstAttribute="centerX" secondItem="Ppb-yU-gW5" secondAttribute="centerX" id="Xtt-Ah-8QM"/>
<constraint firstAttribute="centerY" secondItem="cZb-9N-gBv" secondAttribute="centerY" id="YLx-iu-oop"/>
<constraint firstAttribute="centerX" secondItem="cZb-9N-gBv" secondAttribute="centerX" id="aJ4-b5-5M8"/>
</constraints>
<connections>
<outlet property="outerImageView" destination="cZb-9N-gBv" id="K4s-1M-P8D"/>
</connections>
</customView>
</objects>
<resources>
<image name="Loading_View_Inner" width="116" height="116"/>
<image name="Loading_View_Outer" width="188" height="188"/>
</resources>
</document>

View File

@@ -1,298 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15702" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15702"/>
<plugIn identifier="com.apple.WebKitIBPlugin" version="15702"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
<connections>
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="SvH-Fm-ua3" customClass="SUUpdater"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
<connections>
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<viewController title="MainViewController" nibName="" id="8au-ff-PAw" customClass="MainViewController">
<connections>
<outlet property="backButtonCell" destination="lEo-fP-VyB" id="Liq-b8-nP9"/>
<outlet property="forwardButtonCell" destination="uF3-qn-F0a" id="eR7-ml-w4X"/>
<outlet property="leftTitleBarView" destination="V9v-oH-CLo" id="TdT-j4-Ooc"/>
<outlet property="linkButtonCell" destination="D9P-hg-lf8" id="G2L-cA-69g"/>
<outlet property="refreshButtonCell" destination="SSf-hM-lhY" id="xJE-83-OZr"/>
<outlet property="rightTitleBarView" destination="Iss-xM-4Ib" id="US0-BJ-PTe"/>
<outlet property="view" destination="EiT-Mj-1SZ" id="hOv-v9-VQo"/>
<outlet property="webView" destination="mhE-X5-FF6" id="MTz-Fg-4Di"/>
</connections>
</viewController>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
<menuItem title="Metabase" id="1Xt-HY-uBw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Metabase" systemMenu="apple" id="uQy-DD-JDr">
<items>
<menuItem title="Check for Updates..." id="deG-HF-Nuu">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="checkForUpdates:" target="SvH-Fm-ua3" id="hKn-lq-Ugp"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="45c-9m-ljg"/>
<menuItem title="Hide Metabase" keyEquivalent="h" id="Olw-nP-bQN">
<connections>
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
</connections>
</menuItem>
<menuItem title="Show All" id="Kd2-mp-pUS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
<menuItem title="Quit Metabase" keyEquivalent="q" id="4sb-4s-VLi">
<connections>
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Navigate" id="OrU-aO-QrS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Navigate" id="Vm8-vh-NMO">
<items>
<menuItem title="Back" keyEquivalent="" id="1tY-ia-YVu">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
<connections>
<action selector="back:" target="8au-ff-PAw" id="E1u-Hv-xOJ"/>
</connections>
</menuItem>
<menuItem title="Forward" keyEquivalent="" id="XMU-vQ-kD4">
<modifierMask key="keyEquivalentModifierMask" option="YES"/>
<connections>
<action selector="forward:" target="8au-ff-PAw" id="wGg-7M-OEs"/>
</connections>
</menuItem>
<menuItem title="Reload" keyEquivalent="r" id="4nb-4K-Z2y">
<connections>
<action selector="reload:" target="8au-ff-PAw" id="LU6-rC-mFx"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="HRY-1F-Mgz"/>
<menuItem title="Copy Current URL to Clipboard" keyEquivalent="c" id="9UT-kQ-RV6">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyURLToClipboard:" target="8au-ff-PAw" id="grb-Hc-gc4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="aUF-d1-5bR">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
<connections>
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="wpr-3q-Mcd">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Help" id="3h4-7P-k86">
<items>
<menuItem title="Reset Password..." id="nSX-ZV-AqB">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="resetPassword:" target="8au-ff-PAw" id="CAh-3G-VDo"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
<point key="canvasLocation" x="140" y="154"/>
</menu>
<window title="Metabase" allowsToolTipsWhenApplicationIsInactive="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="335" y="390" width="1000" height="700"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="2537"/>
<value key="minSize" type="size" width="800" height="600"/>
<view key="contentView" canDrawConcurrently="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="1000" height="700"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<webView canDrawConcurrently="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mhE-X5-FF6">
<rect key="frame" x="0.0" y="0.0" width="1000" height="700"/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12" plugInsEnabled="NO" javaEnabled="NO">
<nil key="identifier"/>
</webPreferences>
<connections>
<outlet property="policyDelegate" destination="8au-ff-PAw" id="Ywf-Ex-Plw"/>
<outlet property="resourceLoadDelegate" destination="8au-ff-PAw" id="Rnd-KA-IRb"/>
</connections>
</webView>
</subviews>
<constraints>
<constraint firstItem="mhE-X5-FF6" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="AbJ-I7-UJl"/>
<constraint firstItem="mhE-X5-FF6" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="JBU-I1-v0p"/>
<constraint firstAttribute="bottom" secondItem="mhE-X5-FF6" secondAttribute="bottom" id="OA1-e5-N7X"/>
<constraint firstAttribute="trailing" secondItem="mhE-X5-FF6" secondAttribute="trailing" id="z4U-O6-LWv"/>
</constraints>
</view>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="showsTitle" value="NO"/>
</userDefinedRuntimeAttributes>
<point key="canvasLocation" x="-203" y="602"/>
</window>
<customView id="V9v-oH-CLo">
<rect key="frame" x="0.0" y="0.0" width="72" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="dZP-Ul-oSB">
<rect key="frame" x="0.0" y="9" width="24" height="15"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="6zn-IR-p7a"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="back_icon" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="lEo-fP-VyB">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system" size="23"/>
</buttonCell>
<connections>
<action selector="back:" target="8au-ff-PAw" id="MfY-gk-scw"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="5Bt-VB-Dba">
<rect key="frame" x="24" y="9" width="24" height="15"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="cZI-NR-ghh"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="forward_icon" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="uF3-qn-F0a">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system" size="23"/>
</buttonCell>
<connections>
<action selector="forward:" target="8au-ff-PAw" id="Hwj-Yo-Qtt"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="HAI-2S-GZQ">
<rect key="frame" x="48" y="9" width="24" height="15"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="Bk3-9A-EeN"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="refresh_icon" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="SSf-hM-lhY">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system" size="23"/>
</buttonCell>
<connections>
<action selector="reload:" target="8au-ff-PAw" id="y95-m6-iZ1"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstAttribute="centerY" secondItem="5Bt-VB-Dba" secondAttribute="centerY" id="2iz-ND-ODT"/>
<constraint firstAttribute="centerY" secondItem="HAI-2S-GZQ" secondAttribute="centerY" id="Efu-ly-nfn"/>
<constraint firstAttribute="centerY" secondItem="dZP-Ul-oSB" secondAttribute="centerY" id="FYl-6N-5zd"/>
<constraint firstItem="dZP-Ul-oSB" firstAttribute="leading" secondItem="V9v-oH-CLo" secondAttribute="leading" id="P36-OS-GAI"/>
<constraint firstItem="HAI-2S-GZQ" firstAttribute="leading" secondItem="5Bt-VB-Dba" secondAttribute="trailing" id="cAU-bJ-DfV"/>
<constraint firstItem="5Bt-VB-Dba" firstAttribute="leading" secondItem="dZP-Ul-oSB" secondAttribute="trailing" id="pHA-7b-NC5"/>
<constraint firstAttribute="trailing" secondItem="HAI-2S-GZQ" secondAttribute="trailing" id="soW-Yt-FUQ"/>
</constraints>
<point key="canvasLocation" x="-426" y="1199"/>
</customView>
<customView id="Iss-xM-4Ib">
<rect key="frame" x="0.0" y="0.0" width="24" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button translatesAutoresizingMaskIntoConstraints="NO" id="XfF-w9-qlO">
<rect key="frame" x="0.0" y="9" width="24" height="15"/>
<constraints>
<constraint firstAttribute="width" constant="24" id="O1n-dk-WFr"/>
</constraints>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="link_icon" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="D9P-hg-lf8">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system" size="23"/>
</buttonCell>
<connections>
<action selector="copyURLToClipboard:" target="8au-ff-PAw" id="EEq-ZQ-Cwv"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="XfF-w9-qlO" firstAttribute="leading" secondItem="Iss-xM-4Ib" secondAttribute="leading" id="0V6-XG-Ewc"/>
<constraint firstAttribute="trailing" secondItem="XfF-w9-qlO" secondAttribute="trailing" id="jGa-xG-jnk"/>
<constraint firstItem="XfF-w9-qlO" firstAttribute="centerY" secondItem="Iss-xM-4Ib" secondAttribute="centerY" id="sOf-6o-oSa"/>
</constraints>
<point key="canvasLocation" x="-190" y="1087"/>
</customView>
</objects>
<resources>
<image name="back_icon" width="10" height="15"/>
<image name="forward_icon" width="10" height="15"/>
<image name="link_icon" width="16" height="15"/>
<image name="refresh_icon" width="14" height="15"/>
</resources>
</document>

View File

@@ -1,13 +0,0 @@
//
// MainViewController.h
// Metabase
//
// Created by Cam Saul on 9/21/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
@import Cocoa;
@interface MainViewController : NSViewController
@end

View File

@@ -1,297 +0,0 @@
//
// MainViewController.m
// Metabase
//
// Created by Cam Saul on 9/21/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
@import JavaScriptCore;
@import WebKit;
#import "LoadingView.h"
#import "MainViewController.h"
#import "ResetPasswordWindowController.h"
#import "SettingsManager.h"
#import "TaskHealthChecker.h"
NSString *BaseURL() {
return SettingsManager.instance.baseURL.length ? SettingsManager.instance.baseURL : LocalHostBaseURL();
}
@interface MainViewController () <ResetPasswordWindowControllerDelegate>
@property (weak) IBOutlet WebView *webView;
@property (strong) IBOutlet NSView *leftTitleBarView;
@property (strong) IBOutlet NSView *rightTitleBarView;
@property (weak) IBOutlet NSButtonCell *backButtonCell;
@property (weak) IBOutlet NSButtonCell *forwardButtonCell;
@property (weak) IBOutlet NSButtonCell *refreshButtonCell;
@property (weak) IBOutlet NSButtonCell *linkButtonCell;
@property (nonatomic, strong) ResetPasswordWindowController *resetPasswordWindowController;
@property (weak) LoadingView *loadingView;
@property (nonatomic) BOOL loading;
@property (nonatomic, strong) NSString *launchRoute; ///< redirect to this URL on launch if set. Used for password reset to take you to reset password page.
@end
@implementation MainViewController
#pragma mark - Lifecycle
- (void)awakeFromNib {
// configure window / title bar accessory views
{
self.view.wantsLayer = YES;
self.view.layer.backgroundColor = [NSColor whiteColor].CGColor;
NSTitlebarAccessoryViewController* leftTitleBarAccessoryViewController = [[NSTitlebarAccessoryViewController alloc] init];
leftTitleBarAccessoryViewController.layoutAttribute = NSLayoutAttributeLeft;
leftTitleBarAccessoryViewController.view = self.leftTitleBarView;
[self.view.window addTitlebarAccessoryViewController:leftTitleBarAccessoryViewController];
NSTitlebarAccessoryViewController* rightTitleBarAccessoryViewController = [[NSTitlebarAccessoryViewController alloc] init];
rightTitleBarAccessoryViewController.layoutAttribute = NSLayoutAttributeRight;
rightTitleBarAccessoryViewController.view = self.rightTitleBarView;
[self.view.window addTitlebarAccessoryViewController:rightTitleBarAccessoryViewController];
}
// programatically add loading view to container
{
LoadingView *loadingView = [[LoadingView alloc] init];
[self.view addSubview:loadingView];
[self.view addConstraints:@[[NSLayoutConstraint constraintWithItem:loadingView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:200.0f],
[NSLayoutConstraint constraintWithItem:loadingView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:200.0f],
[NSLayoutConstraint constraintWithItem:loadingView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0],
[NSLayoutConstraint constraintWithItem:loadingView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0f constant:0]]];
self.loadingView = loadingView;
}
self.webView.wantsLayer = YES;
self.webView.animator.alphaValue = 0.0f;
dispatch_async(dispatch_get_main_queue(), ^{
self.loading = YES;
});
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskBecameHealthy:) name:MetabaseTaskBecameHealthyNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskBecameUnhealthy:) name:MetabaseTaskBecameUnhealthyNotification object:nil];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - Notifications
- (void)taskBecameHealthy:(NSNotification *)notification {
dispatch_async(dispatch_get_main_queue(), ^{
if (self.launchRoute) {
[self navigateToRoute:self.launchRoute];
self.launchRoute = nil;
} else {
[self loadMainPage];
}
dispatch_async(dispatch_get_main_queue(), ^{
self.loading = NO;
});
});
}
- (void)taskBecameUnhealthy:(NSNotification *)notification {
dispatch_async(dispatch_get_main_queue(), ^{
self.loading = YES;
});
}
#pragma mark - Local Methods
- (void)navigateToRoute:(nonnull NSString *)route {
NSString *urlString = [BaseURL() stringByAppendingString:route];
NSLog(@"Connecting to Metabase instance, navigating to page: %@", urlString);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
request.cachePolicy = NSURLCacheStorageAllowedInMemoryOnly;
[self.webView.mainFrame loadRequest:request];
}
- (void)loadMainPage {
[self navigateToRoute:@"/"];
}
- (void)downloadWithMethod:(NSString *)methodString url:(NSString *)urlString params:(NSDictionary *)paramsDict extensions:(NSArray *)extensions {
NSSavePanel *savePanel = [NSSavePanel savePanel];
savePanel.extensionHidden = NO;
savePanel.showsTagField = NO;
if ([extensions count] > 0) {
savePanel.allowedFileTypes = extensions;
savePanel.allowsOtherFileTypes = NO;
}
NSString *downloadsDirectory = NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, NSUserDomainMask, YES)[0];
savePanel.directoryURL = [NSURL URLWithString:downloadsDirectory];
// TODO: either figure out how to pull default filename from the Content-Disposition header or pass it in from JS land.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH_mm_ss";
savePanel.nameFieldStringValue = [NSString stringWithFormat:@"query_result_%@", [dateFormatter stringFromDate:[NSDate date]]];
if ([savePanel runModal] == NSFileHandlingPanelOKButton) {
NSLog(@"Will save file at: %@", savePanel.URL);
NSString *method = [methodString uppercaseString];
NSURL *url = [NSURL URLWithString:urlString relativeToURL:[NSURL URLWithString:BaseURL()]];
NSMutableString *query = [NSMutableString string];
for (NSString* key in paramsDict) {
NSString* value = [paramsDict objectForKey:key];
[query appendFormat:@"%@=%@",
[key stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]],
[value stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]];
}
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0f];
request.HTTPMethod = [method uppercaseString];
if ([query length] > 0) {
if ([request.HTTPMethod isEqualToString:@"POST"] || [request.HTTPMethod isEqualToString:@"PUT"]) {
NSData *data = [query dataUsingEncoding:NSUTF8StringEncoding];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%lu", (NSUInteger)data.length] forHTTPHeaderField:@"Content-Length"];
request.HTTPBody = data;
} else {
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", urlString, query] relativeToURL:[NSURL URLWithString:BaseURL()]]];
}
}
[NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
NSError *writeError = nil;
[data writeToURL:savePanel.URL options:NSDataWritingAtomic error:&writeError];
dispatch_async(dispatch_get_main_queue(), ^{
if (writeError) {
[[NSAlert alertWithError:writeError] runModal];
} else {
[[NSAlert alertWithMessageText:@"Saved" defaultButton:@"Done" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Your data has been saved."] runModal];
}
});
}];
}
}
- (void)injectJS {
JSContext *context = self.webView.mainFrame.javaScriptContext;
// replace console.log with a function that calls NSLog so we can see the output
context[@"console"][@"log"] = ^(JSValue *message) {
NSLog(@"console.log: %@", message);
};
// custom functions for OS X integration are available to the frontend as properties of window.OSX
context[@"OSX"] = @{@"download": ^(JSValue *method, JSValue *url, JSValue *params, JSValue *extensions) {
[self downloadWithMethod:[method toString] url:[url toString] params:[params toDictionary] extensions:[extensions toArray]];
}, @"resetPassword": ^(){
[self resetPassword:nil];
}};
}
#pragma mark - Getters / Setters
- (void)setLoading:(BOOL)loading {
_loading = loading;
if (loading) {
self.webView.animator.alphaValue = 0;
self.loadingView.animator.alphaValue = 1;
} else {
self.webView.animator.alphaValue = 1;
self.loadingView.animator.alphaValue = 0;
self.backButtonCell.enabled = self.forwardButtonCell.enabled = self.linkButtonCell.enabled = NO;
}
self.loadingView.animate = loading;
}
- (void)setResetPasswordWindowController:(ResetPasswordWindowController *)resetPasswordWindowController {
[_resetPasswordWindowController.window close];
_resetPasswordWindowController = resetPasswordWindowController;
resetPasswordWindowController.delegate = self;
[resetPasswordWindowController.window makeKeyWindow];
}
#pragma mark - Actions
- (IBAction)back:(id)sender {
[self.webView goBack];
}
- (IBAction)forward:(id)sender {
[self.webView goForward];
}
- (IBAction)reload:(id)sender {
[self.webView.mainFrame reload];
}
- (IBAction)copyURLToClipboard:(id)sender {
[NSPasteboard.generalPasteboard declareTypes:@[NSStringPboardType] owner:nil];
[NSPasteboard.generalPasteboard setString:self.webView.mainFrameURL forType:NSStringPboardType];
[[NSAlert alertWithMessageText:@"Link Copied" defaultButton:@"Ok" alternateButton:nil otherButton:nil informativeTextWithFormat:@"A link to this page has been copied to your clipboard."] runModal];
}
- (IBAction)resetPassword:(id)sender {
self.resetPasswordWindowController = [[ResetPasswordWindowController alloc] init];
}
#pragma mark - ResetPasswordWindowControllerDelegate
- (void)resetPasswordWindowController:(ResetPasswordWindowController *)resetPasswordWindowController didFinishWithResetToken:(NSString *)resetToken {
self.resetPasswordWindowController = nil;
// now tell the app to reroute to the reset password page once Metabase relauches
self.launchRoute = [@"/auth/reset_password/" stringByAppendingString:resetToken];
}
#pragma mark - WebResourceLoadDelegate
- (void)webView:(WebView *)sender resource:(id)identifier didFinishLoadingFromDataSource:(WebDataSource *)dataSource {
[self injectJS];
self.linkButtonCell.enabled = YES;
self.backButtonCell.enabled = self.webView.canGoBack;
self.forwardButtonCell.enabled = self.webView.canGoForward;
}
#pragma mark - WebPolicyDelegate
- (void)webView:(WebView *)webView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request newFrameName:(NSString *)frameName decisionListener:(id<WebPolicyDecisionListener>)listener {
// Tell webkit window to open new links in browser
NSURL *url = actionInformation[WebActionOriginalURLKey];
[[NSWorkspace sharedWorkspace] openURL:url];
[listener ignore];
}
@end

View File

@@ -1,22 +0,0 @@
//
// ResetPasswordWindowController.h
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
@import Cocoa;
@class ResetPasswordWindowController;
@protocol ResetPasswordWindowControllerDelegate <NSObject>
- (void)resetPasswordWindowController:(ResetPasswordWindowController *)resetPasswordWindowController didFinishWithResetToken:(NSString *)resetToken;
@end
@interface ResetPasswordWindowController : NSWindowController
@property (weak) id<ResetPasswordWindowControllerDelegate> delegate;
@end

View File

@@ -1,71 +0,0 @@
//
// ResetPasswordWindowController.m
// Metabase
//
// Created by Cam Saul on 11/24/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
#import <objc/runtime.h>
#import "ResetPasswordTask.h"
#import "ResetPasswordWindowController.h"
@interface ResetPasswordWindowController () <NSTextFieldDelegate>
@property (weak) IBOutlet NSButton *resetPasswordButton;
@property (weak) IBOutlet NSTextField *emailAddressTextField;
@property (nonatomic, strong) ResetPasswordTask *resetPasswordTask;
@end
@implementation ResetPasswordWindowController
#pragma mark - Lifecycle
- (NSString *)windowNibName {
return NSStringFromClass(self.class);
}
- (void)windowDidLoad {
[super windowDidLoad];
}
#pragma mark - Actions
- (IBAction)resetPasswordButtonPressed:(NSButton *)sender {
self.resetPasswordButton.enabled = NO;
self.resetPasswordButton.title = @"One moment...";
self.emailAddressTextField.enabled = NO;
self.resetPasswordTask = [[ResetPasswordTask alloc] init];
[self.resetPasswordTask resetPasswordForEmailAddress:self.emailAddressTextField.stringValue success:^(NSString *resetToken) {
self.emailAddressTextField.enabled = YES;
self.resetPasswordButton.title = @"Success!";
NSLog(@"Got reset token: '%@'", resetToken);
[self.delegate resetPasswordWindowController:self didFinishWithResetToken:resetToken];
} error:^(NSString *errorMessage) {
self.emailAddressTextField.enabled = YES;
self.resetPasswordButton.enabled = YES;
self.resetPasswordButton.title = @"Reset Password";
[[NSAlert alertWithMessageText:@"Password Reset Failed" defaultButton:@"Done" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", errorMessage] runModal];
}];
}
- (IBAction)emailAddressTextFieldDidReturn:(id)sender {
if (self.resetPasswordButton.isEnabled) [self resetPasswordButtonPressed:self.resetPasswordButton];
}
#pragma mark - NSTextFieldDelegate
- (void)controlTextDidChange:(NSNotification *)obj {
self.resetPasswordButton.title = @"Reset Password";
self.resetPasswordButton.enabled = self.emailAddressTextField.stringValue.length > 5;
}
@end

View File

@@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5053" systemVersion="13A603" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5053"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ResetPasswordWindowController">
<connections>
<outlet property="emailAddressTextField" destination="SGZ-eW-nZQ" id="aMf-FE-ey1"/>
<outlet property="resetPasswordButton" destination="1wF-h5-c8o" id="N1J-e1-a4y"/>
<outlet property="window" destination="FU9-gs-izu" id="SSm-mw-LIb"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window title="Reset Password" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" animationBehavior="default" id="FU9-gs-izu">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="283" y="305" width="492" height="229"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<view key="contentView" id="3rs-Tz-giP">
<rect key="frame" x="0.0" y="0.0" width="492" height="229"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="249" verticalHuggingPriority="249" horizontalCompressionResistancePriority="240" verticalCompressionResistancePriority="800" translatesAutoresizingMaskIntoConstraints="NO" id="oEx-8w-YG4">
<rect key="frame" x="14" y="175" width="464" height="34"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="460" id="qwI-wW-wTd"/>
</constraints>
<textFieldCell key="cell" enabled="NO" refusesFirstResponder="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" title="Enter the email address you used to create your Metabase account on this computer and we'll get started changing your password." id="Lgy-GU-YOj">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1wF-h5-c8o">
<rect key="frame" x="178" y="13" width="136" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Reset Password" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="YII-IA-Kyg">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="resetPasswordButtonPressed:" target="-2" id="Y6X-98-Hsn"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8ft-6m-5T0">
<rect key="frame" x="200" y="126" width="92" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" refusesFirstResponder="YES" sendsActionOnEndEditing="YES" title="Email Address" id="ETj-8f-dsZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="SGZ-eW-nZQ">
<rect key="frame" x="118" y="96" width="256" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<constraints>
<constraint firstAttribute="width" constant="256" id="8Fr-91-TXf"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" state="on" borderStyle="bezel" alignment="center" placeholderString="cam@toucans4lyfe.org" drawsBackground="YES" id="mP8-DI-PfW">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<action selector="emailAddressTextFieldDidReturn:" target="-2" id="JLo-r8-R9z"/>
<outlet property="delegate" destination="-2" id="h0P-Zb-hJJ"/>
</connections>
</textField>
</subviews>
<constraints>
<constraint firstItem="oEx-8w-YG4" firstAttribute="leading" secondItem="3rs-Tz-giP" secondAttribute="leading" constant="16" id="056-xy-j5r"/>
<constraint firstItem="8ft-6m-5T0" firstAttribute="top" relation="greaterThanOrEqual" secondItem="oEx-8w-YG4" secondAttribute="bottom" constant="32" id="2Jb-ua-CCI"/>
<constraint firstAttribute="centerX" secondItem="SGZ-eW-nZQ" secondAttribute="centerX" id="90I-fl-PKI"/>
<constraint firstItem="1wF-h5-c8o" firstAttribute="top" relation="greaterThanOrEqual" secondItem="SGZ-eW-nZQ" secondAttribute="bottom" constant="32" id="CM1-Nh-mnk"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="SGZ-eW-nZQ" secondAttribute="trailing" constant="16" id="NHO-1C-XOJ"/>
<constraint firstItem="SGZ-eW-nZQ" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="3rs-Tz-giP" secondAttribute="leading" constant="16" id="On6-0w-5PF"/>
<constraint firstAttribute="bottom" secondItem="1wF-h5-c8o" secondAttribute="bottom" constant="20" id="VRO-Qm-4vb"/>
<constraint firstItem="oEx-8w-YG4" firstAttribute="top" secondItem="3rs-Tz-giP" secondAttribute="top" constant="20" id="bzN-6L-86m"/>
<constraint firstItem="SGZ-eW-nZQ" firstAttribute="top" secondItem="8ft-6m-5T0" secondAttribute="bottom" constant="8" id="e7T-c5-OYs"/>
<constraint firstAttribute="centerY" secondItem="SGZ-eW-nZQ" secondAttribute="centerY" constant="-8" id="mTu-yO-Smv"/>
<constraint firstAttribute="trailing" secondItem="oEx-8w-YG4" secondAttribute="trailing" constant="16" id="shZ-a7-r8y"/>
<constraint firstAttribute="centerX" secondItem="1wF-h5-c8o" secondAttribute="centerX" id="vH7-Xk-LcO"/>
<constraint firstAttribute="centerX" secondItem="8ft-6m-5T0" secondAttribute="centerX" id="vh8-pN-ohL"/>
</constraints>
</view>
</window>
</objects>
</document>

View File

@@ -1,29 +0,0 @@
{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw9840\paperh8400
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
\f0\b\fs24 \cf0 Engineering:
\b0 \
Some people\
\
\b Human Interface Design:
\b0 \
Some other people\
\
\b Testing:
\b0 \
Hopefully not nobody\
\
\b Documentation:
\b0 \
Whoever\
\
\b With special thanks to:
\b0 \
Mom\
}

View File

@@ -1,2 +0,0 @@
/* Localized versions of Info.plist keys */

View File

@@ -1,14 +0,0 @@
//
// main.m
// Metabase
//
// Created by Cam Saul on 9/21/15.
// Copyright (c) 2015 Metabase. All rights reserved.
//
@import Cocoa;
int main(int argc, const char * argv[])
{
return NSApplicationMain(argc, argv);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

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