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

New Recents + Popular API Format - Frontend #42305

Merged
merged 12 commits into from
May 10, 2024

Conversation

iethree
Copy link
Contributor

@iethree iethree commented May 7, 2024

Note

The frontend code here is ready for review, but there is one little piece missing in the backend: models should return with model: dataset, but currently they have model: card

Important

I highly recommend looking at this PR by commit, rather than all at once. The first few commits have all the substance, and the bulk of the PR is just cleaning up types and test mocks

Closes #41957

Description

Uses a better, beefier recents format from the backend, and handles a larger number of recent items.

Recents appear in:

. .
Homepage Screen Shot 2024-05-07 at 4 49 01 PM
Search Results Screen Shot 2024-05-07 at 4 48 55 PM
Command Palette Screen Shot 2024-05-07 at 4 48 51 PM

Popular items only appear on the home page for brand new users.

Screen Shot 2024-05-07 at 3 58 20 PM

To test this component, i'd recommend just modifying the if statement in HomeContent.tsx like so:

Screen Shot 2024-05-07 at 4 52 09 PM

Checklist

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

@iethree iethree self-assigned this May 7, 2024
@iethree iethree linked an issue May 7, 2024 that may be closed by this pull request
@metabase-bot metabase-bot bot added the .Team/AdminWebapp Admin and Webapp team label May 7, 2024
@iethree iethree added the no-backport Do not backport this PR to any branch label May 7, 2024
@iethree iethree requested a review from a team May 7, 2024 22:56
@iethree iethree marked this pull request as ready for review May 7, 2024 22:56
@metabase-bot metabase-bot bot added the visual Run Percy visual testing label May 7, 2024
@iethree iethree changed the title wip - new recents format frontend New Recents API Format - Frontend May 7, 2024
@iethree iethree changed the title New Recents API Format - Frontend New Recents + Popular API Format - Frontend May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Codenotify: Notifying subscribers in CODENOTIFY files for diff 8bb8b77...2d23023.

Notify File(s)
@alxnddr frontend/src/metabase/visualizations/visualizations/LinkViz/LinkViz.unit.spec.tsx
@ranquild frontend/src/metabase/home/components/HomeContent/HomeContent.tsx
frontend/src/metabase/home/components/HomeContent/HomeContent.unit.spec.tsx
frontend/src/metabase/home/components/HomePopularSection/HomePopularSection.tsx
frontend/src/metabase/home/components/HomePopularSection/HomePopularSection.unit.spec.tsx
frontend/src/metabase/home/components/HomeRecentSection/HomeRecentSection.tsx
frontend/src/metabase/home/components/HomeRecentSection/HomeRecentSection.unit.spec.tsx

Copy link

replay-io bot commented May 7, 2024

Status In Progress ↗︎ 52 / 53
Commit 2d23023
Results
⚠️ 7 Flaky
2474 Passed

@iethree iethree mentioned this pull request May 8, 2024
1 task
card: Card | null,
card: Partial<
Pick<Card, "id" | "name" | "type" | "card_id" | "model">
> | null,
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be off my head but would Partial<Card> | null work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would work, but I kind of like how Pick describes what the component actually might use. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, I dig it!

@iethree iethree force-pushed the beefup-recents-frontend branch 2 times, most recently from 4a26947 to ecbdc46 Compare May 10, 2024 15:22
@iethree iethree requested a review from camsaul as a code owner May 10, 2024 19:31
@iethree iethree removed the visual Run Percy visual testing label May 10, 2024
@iethree iethree merged commit f878b56 into bcm-beefup-recents May 10, 2024
113 checks passed
@iethree iethree deleted the beefup-recents-frontend branch May 10, 2024 21:20
iethree added a commit that referenced this pull request May 13, 2024
* fix tests

* new API payload format for recents and populars

* update url generation

* update recents components

* update tests

* only show 5 recents in command palette

* remove unused types

* update tests

* obey the linter

* type updates

* fix unit test

* change where we filter recents

---------

Co-authored-by: Bryan Maass <[email protected]>
escherize added a commit that referenced this pull request May 13, 2024
* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* ellide inactive tables

* wip

* adds more collection-touch events

* remove sneaky dep that slipped in

* cleaning up, and adding tests

* respond to review comments + mini bug reports

* make it official

* double official

* cleanup + return recent-views/Item for `GET activity/popular_items`

* get popular_items returning the proper shape

* compare doesn't what I thought

* add display_name to tables

* table.database.name should be the db name, not the table name

* add table.database.initial_sync_status

* improve call to toucan2

* light renaming + many text fixes

* include moderated_status in cards and datasets

* look up Dashboard permissions for Dashboards

* stop double-querying for `can-write?` checks

- also include some debug logging

* fix card <-> model dispatching

also gets tests passing locally

* let the test runner run the tests

* fix gc test

* adds description

* description can be null

* better tests

no more nils passed through the app

* debugging test

* fix tests and skip archived

* mysql finesse

* New Recents + Popular API Format - Frontend (#42305)

* fix tests

* new API payload format for recents and populars

* update url generation

* update recents components

* update tests

* only show 5 recents in command palette

* remove unused types

* update tests

* obey the linter

* type updates

* fix unit test

* change where we filter recents

---------

Co-authored-by: Bryan Maass <[email protected]>

* fix modelToUrl types

* respond to review comments

* post merge test fix

---------

Co-authored-by: Ryan Laurie <[email protected]>
Co-authored-by: Ryan Laurie <[email protected]>
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/AdminWebapp Admin and Webapp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Beef up Recents 🥩
3 participants