-
- Downloads
[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:
Tamás Benkő <tamas@metabase.com>
Showing
- frontend/src/metabase-lib/Question.ts 6 additions, 79 deletionsfrontend/src/metabase-lib/Question.ts
- frontend/src/metabase-lib/aggregation.ts 8 additions, 0 deletionsfrontend/src/metabase-lib/aggregation.ts
- frontend/src/metabase-lib/breakout.ts 8 additions, 0 deletionsfrontend/src/metabase-lib/breakout.ts
- frontend/src/metabase-lib/types.ts 2 additions, 0 deletionsfrontend/src/metabase-lib/types.ts
- frontend/src/metabase-lib/v2.ts 1 addition, 0 deletionsfrontend/src/metabase-lib/v2.ts
- frontend/src/metabase-lib/viz/display.ts 130 additions, 0 deletionsfrontend/src/metabase-lib/viz/display.ts
- frontend/src/metabase-lib/viz/display.unit.spec.ts 224 additions, 0 deletionsfrontend/src/metabase-lib/viz/display.unit.spec.ts
- frontend/src/metabase-lib/viz/index.ts 1 addition, 0 deletionsfrontend/src/metabase-lib/viz/index.ts
Loading
Please register or sign in to comment