Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expressions in AggregationPicker without legacy query #36031

Merged

Conversation

kamilmielnik
Copy link
Contributor

@kamilmielnik kamilmielnik commented Nov 22, 2023

Closes #35947

Blocked by #36075, #36120, #36167, #36168
Target branch includes fixes for #36167.

Description

AggregationPicker no longer uses legacyQuery or expression.
ExpressionWidget, ExpressionEditorTextfield & AggregationPicker still receive legacyQuery and expression props for backwards-compatibility but now they also work without them.

How to test it

image

@kamilmielnik kamilmielnik added no-backport Do not backport this PR to any branch .Team/QueryingComponents labels Nov 22, 2023
@kamilmielnik kamilmielnik self-assigned this Nov 22, 2023
Comment on lines +38 to +39
let expression = null;
let expressionClause = null;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjusting to match onChange and onCommit props in ExpressionEditorTextfield which were/are typed with null.

@kamilmielnik kamilmielnik changed the base branch from master to 36167-with-expression-name-to-set-display-name December 4, 2023 12:00
Copy link
Contributor

@uladzimirdev uladzimirdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🤞

Base automatically changed from 36167-with-expression-name-to-set-display-name to master December 5, 2023 15:01
@kamilmielnik kamilmielnik enabled auto-merge (squash) December 5, 2023 15:30
@kamilmielnik kamilmielnik merged commit 6e8e6f0 into master Dec 5, 2023
107 checks passed
@kamilmielnik kamilmielnik deleted the 35947-legacy-expression-clause-filters-and-aggregations branch December 5, 2023 15:36
Copy link

github-actions bot commented Dec 5, 2023

@kamilmielnik Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

qnkhuat pushed a commit that referenced this pull request Dec 12, 2023
* Add expression-clause-for-legacy-expression

Fixes #34830.

* Add legacy-expression-for-expression-clause

* Fix wrapper function name

* Include ExpressionClause in Aggregatable type

* Use Aggregatable type in aggregate function

* Rename query to legacyQuery in Expressions (part 1)

* Rename query to legacyQuery in Expressions (part 2)

* Rename query to legacyQuery in Expressions (part 3)

* Support MLv2 expressionClause in processSource and ExpressionWidget

* Revert changes to ExpressionStep as it's out of scope of this task

* Use new expressionClause in ExpressionWidget

* Use onSelect instead of onSelectLegacy in handleExpressionChange

* Remove onSelectLegacy from AggregationPicker

* Use nullish coalescing operator

* Assert new onChangeExpression argument in test

* Assert new onChangeExpression argument in test

* Update AggregationPicker tests

* Replace toEqual + expect.objectContaining with toMatchObject

* Add stageIndex to setup, use destructuring for onSelect arguments

* Deal with awkward assertions

* Use props in a conservative way

* Replace legacyQuery.database() with query + metadata

* Add a TODO comment

* Add clause prop to AggregationPicker

* Migrate clause name

* Replace 3rd argument in onChangeExpression with onChangeExpressionClause

* Use destructuring

* Allow AggregationClause, drop expression from ExpressionEditorTextfield

* Make withExpressionName work with AggregationClause

* Rename expressionClause to clause

* Update tests with new interface

* Use overloading instead of generics

* Add function body

* Rename operator to clause

* Revert "Use overloading instead of generics"

This reverts commit 3953f85.

* Fix tests failing due to useSelect usage in AggregationPicker

* Omit aggregation options converting expressions to legacy

Fixes #36120.

* Remove temporary hack

* Get rid of props spread

* Migrate isExpressionEditorInitiallyOpen to MLv2

* Omit aggregation options converting expressions to legacy

Fixes #36120.

* Normalize legacy expressions as MBQL expressions

* Fix isExpressionEditorInitiallyOpen

* Update expressionName signature

* Pass props in ExpressionStep tests in a usual way

* Drop a conditional statement

* Bring back expression prop for backwards-compatibility

* Update ExpressionWidget validation & tests

* Bring back using expression in componentWillReceiveProps

* Bring back removed assertion

* Remove legacyQuery prop from AggregationPicker

* Add a test case for isExpressionEditorInitiallyOpen (which uses Lib.expressionName)

* Fix legacyQuery creation

* Add assertion for expression name

* Fix committing expression with done button

* Improve assertions in tests

* Make with-expression-name set the display-name of the clause

Fixes #36167.

This is needed to be able to set/change the display name of custom aggregation columns too.

* Add expression name assertion

* Add expression name assertion

* Add expression name assertion

* Add expression name assertion

* Add expression name assertion

* Add expression name assertion

* Add expression name assertion

* Unskip an e2e test

* Add expression name assertion

* Add expression name assertion

* Use displayInfo instead of displayName
- see #36203 (comment)

* Deprecate displayName in favor of displayInfo
- see https://metaboat.slack.com/archives/C0645JP1W81/p1701341786914219?thread_ts=1701335646.088359&cid=C0645JP1W81

* Use clearer notation

* Format code

* Use displayInfo instead of expressionName in tests

* Add isNamed attribute to ColumnDisplayInfo and ClauseDisplayInfo

* Use displayInfo instead of expressionName in AggregationPicker

* Drop expressionName

* Drop redundant cast

* Simplify isExpressionEditorInitiallyOpen interface

* Use display-info with :named? instead of expression-name

* Improve comment

* Add :named? to the schema of display-info

* Use conditional types for ExpressionWidget prop

* Use getNotebookStep

* Simplify condition

* Simplify assertions

* Use .lastCall

* Remove isNamed attribute from ColumnDisplayInfo

* Use .lastCall

* Fix typing

* Bring back legacyQuery prop to AggregationPicker

* Fix isExpressionEditorInitiallyOpen for new clauses

* Fix unit tests

* Remove wrong assertion

* Fix assertion

* Trigger a change

* Revert "Trigger a change"

This reverts commit 254913d.

* Fix assertion

---------

Co-authored-by: Tamás Benkő <tamas@metabase.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-backport Do not backport this PR to any branch .Team/QueryingComponents
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FE - Expressions in AggregationPicker without legacy query
4 participants