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

Add most used functions to suggestions when they open #41267

Merged
merged 49 commits into from
Apr 16, 2024

Conversation

romeovs
Copy link
Contributor

@romeovs romeovs commented Apr 10, 2024

Closes #41237

Description

Adds the most used functions to the list of suggestions when the expression editor opens.

To accomplish this, this PR:

  • adds a list of popular functions
  • returns that list when suggestions for the empty string are requested
  • adds grouping to the suggestion dropdown
  • adds a (permanent) link to all functions in the suggestion dropdown

How to verify

Describe the steps to verify that the changes are working as expected.

  1. New question → Sample dataset → Orders
  2. Click "Custom Column"
  3. The expression editor should open with the dropdown for suggestions opened and showing most popular suggestions.

Demo

Screenshot 2024-04-10 at 19 57 24

Checklist

  • Tests have been added/updated to cover changes in this PR

Note

This PR is a follow up of #41236, so it contains changes from it.

Copy link

replay-io bot commented Apr 10, 2024

Status In Progress ↗︎ 57 / 58
Commit e266a5b
Results
⚠️ 24 Flaky
2385 Passed

@romeovs romeovs force-pushed the 41237-add-most-used-functions branch 2 times, most recently from 4043029 to 353d366 Compare April 11, 2024 11:06
@romeovs romeovs added the no-backport Do not backport this PR to any branch label Apr 11, 2024
@romeovs romeovs force-pushed the 41237-add-most-used-functions branch 3 times, most recently from 5335797 to 3c6be77 Compare April 11, 2024 17:09
@romeovs romeovs changed the base branch from master to expression-editor-suggestions April 12, 2024 07:18
@romeovs romeovs requested a review from a team April 12, 2024 07:20
@romeovs romeovs force-pushed the 41237-add-most-used-functions branch 3 times, most recently from 84dc86b to 1c2c4ba Compare April 12, 2024 09:39
Base automatically changed from expression-editor-suggestions to master April 12, 2024 14:40
@romeovs romeovs force-pushed the 41237-add-most-used-functions branch from 1c2c4ba to 87837ce Compare April 12, 2024 14:47
helpText?: HelpText;
};

function suggestWithFooters(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding the footer seemed misplaced in metabase-lib/v1/expressions, so I decided to do it here.

I wanted to keep the footers in the list of suggestions to avoid having to jump trough hoops to add the footer to the up/down arrow flow.

@romeovs romeovs mentioned this pull request Apr 12, 2024
1 task
Fix e2e tests
@romeovs romeovs force-pushed the 41237-add-most-used-functions branch from b98d921 to 1f356ad Compare April 16, 2024 08:01
Copy link
Contributor

@kamilmielnik kamilmielnik left a comment

Choose a reason for hiding this comment

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

Works really well with 2 small exceptions.

Nice work! 🚀

}) {
function handleMouseDownCapture(evt: MouseEvent) {
// prevent the dropdown from closing
evt.preventDefault();
Copy link
Contributor

Choose a reason for hiding this comment

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

Still unresolved. I don't think it should prevent this PR from being merged, but let's keep it somewhere in the backlog as a P3 bug.

type SuggestArgs = {
export const GROUPS = {
popularExpressions: {
displayName: t`Most used functions`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Clicking the group title causes the popover to disappear. Not critical, but if it's easy to fix we should do it.

2024-04-16.15-21-40.mp4

@romeovs romeovs merged commit 176f631 into master Apr 16, 2024
107 checks passed
@romeovs romeovs deleted the 41237-add-most-used-functions branch April 16, 2024 14:16
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.

Add "Most used functions" to suggestion dropdown
4 participants