Skip to content
Snippets Groups Projects
Unverified Commit 2a70cd5d authored by Kamil Mielnik's avatar Kamil Mielnik Committed by GitHub
Browse files

[MLv2] [FE] Migrate `setDefaultDisplay` to MLv2 (#38221)


* Add new Question.prototype.setDefaultDisplay boilerplate
- rename old one to _setDefaultDisplay

* Handle native queries

* Handle table & scalar displays

* Add aggregationColumn wrapper

* Add breakoutColumn wrapper

* Add semanticType to ColumnDisplayInfo

* Add skeleton for the rest of setDefaultDisplay

* Add effectiveType to ColumnDisplayInfo

* Extract getDefaultDisplay out of Question

* Add test suite for getDefaultDisplay

* Add a test case for simple queries

* Add a test case for 1 aggregation and no breakouts

* Add a test case for 1 aggregation, 1 breakout and state column

* Format code

* Update test query

* Add a test case for 1 aggregation, 1 breakout and country column

* Update test names

* Simplify setup

* Add date-related tests

* Extract isState, isCountry, deal with breakout info vs column info

* Handle dates

* Move helpers down

* Add tests for binning

* Add explanatory variable

* Handle 1 aggregation and 2 breakouts, at least 1 of which is date

* Handle 1 aggregation and 2 breakouts by coordinates

* Add a test case for default return

* Use parameterless aggregation

* Handle categories

* Optimize: do not call Lib.displayInfo for all breakouts

* Optimize: extract getBreakoutInfos and call it only when necessary

* Do not group tests

* Remove redundant createQueryWithClauses calls

* Rename getBreakoutInfos to getBreakoutColumnInfos

* Fix Question.prototype.updateSettings typing

* Simplify test setup

* Simplify code

* Use accounts table

* Remove Question.prototype._setDefaultDisplay

* Rename getDefaultDisplay to defaultDisplay and expose it in metabase-lib/v2

* Update test names

* Consolidate conditions

* Fully migrate Category and Date checks

* Fix typo

* Split unrelated conditions to make it look like in the original function

* Reorder arguments to match the convention

* Rename getBreakoutColumnInfos to getBreakoutsWithColumnInfo

* Prevent categorizing extraction of/truncation to year as temporal-extraction

Fixes #37172.

* Move display.ts to viz/display.ts

* Use existing Lib.is* functions

* Make a change to trigger CI

* Revert "Make a change to trigger CI"

This reverts commit 328becd8e659073aa2f0daffd6011fa785bfa99e.

* Do the same for any display-info calculation

---------

Co-authored-by: default avatarTamás Benkő <tamas@metabase.com>
parent d601f0e8
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment